From nobody Wed Nov 25 15:49:52 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jZPJK21GKz71jP5 for ; Wed, 25 Nov 2026 15:49:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jZPJJ72Zwz4mNy for ; Wed, 25 Nov 2026 15:49:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795621793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O89nUCzWzJjw31V3rhOcOfEA1/fOpzsNm7CW6m7cQRY=; b=OhKe+40F3PEn+cQFZMArBnJerBw5/F1TeHNikpOBdxly8B4wyR+svWNghY84QR00xdCpTj 13UoOdq4K1cfqAoZj/J2W60WSQenWpH9LcG55qZzEdXq18YKqRFBCj/YKB3raeyIIdYUHZ f3zFllbowUh5ZogS76OJBSp1wYqbPq3f0kco6ETznIWGjFl6mt3m/ig/nRZ+FJfogZJDxa C4fFA6ijJROJI7Znaq2jGnf78N5fIQuVwZtt+pr21i2FwZYBlkvf5GAmhQyiSVE5gNS6+o K3DscJ/fPJ49N/9DxKGN5lOiXC3PRwOnoGl2N5vzvVxNw1ot9SvnuzYeh17xYw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795621793; b=RxqDDRZ4jgovamzetgnGQKcp4UQRitbbUPm6svZThm0F+ckPfePki38Pmc0sHjQx94DA2/ s5kZurk6U8Ug5XabDXuoN6b4fax0T/ShQQ5cTIF9xRvd8S+LP4mPB33Qd5AIyZw4Cn+BTM LBrwiUiEOEjG3lFE+UpytcYm239n+rOvNFL0kUEYMKkcK1PD+gCIkFV0nvjjTUyw9znAxw okhzE0t4b83C198l38QBu4tCis67nCdT3REXyDd/X/S3GUSg46qmF9UugRGFtvn0xXIBMR e4hbU+Z5AYlB4BMMzSyFY1jQ1dT9lnc/0j/mkj7O4a+XLFs6BP44eEm8nB8ttA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795621793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=O89nUCzWzJjw31V3rhOcOfEA1/fOpzsNm7CW6m7cQRY=; b=Jw3Tilcnu18NxZYXkNYyIjd3L6NZoQjx8iDY4G0RuMB8rHJwN4paj2HqQaRRenIR2vZV/f tPfZe09I9ky1vzw0uLmRefjTfMgdqcLqhbDLfpcDqUSk+JDDfeieDyIbBp87+xixqdrE9s tHUdgmjJfMx2UoHqgF9fC/xStOpUzoSsm9mHExKEbI0ZQyLlMvzB3DrX7jf8khXuytSba6 5U/gTgQzFxAl8UUuhyEeohMxsOqojXwMQKkjK65/bQ/v4z9t2i1OL9Bm0XmZLOw159OGvz 3MUWyUXDJDvqsq782b0xixEOYzia+2FO/4nHViBoZs+W2bEw+R5eUBpmbVRuFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jZPJJ50tPzX1M for ; Wed, 25 Nov 2026 15:49:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id eaa5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 25 Nov 2026 15:49:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Greg Becker From: Bojan Novk=?utf-8?Q?ovi=C4=87?= Subject: git: b1020d33404d - main - bnxt: don't fail init when out of VLAN L2 filters List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1020d33404dc7a6f44bb84339fcdb9eafa683da Auto-Submitted: auto-generated Date: Wed, 25 Nov 2026 15:49:52 +0000 Message-Id: <6b0703a0.eaa5.7337a12f@gitrepo.freebsd.org> The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=b1020d33404dc7a6f44bb84339fcdb9eafa683da commit b1020d33404dc7a6f44bb84339fcdb9eafa683da Author: Greg Becker AuthorDate: 2026-11-25 15:39:46 +0000 Commit: Bojan Novković CommitDate: 2026-11-25 15:48:32 +0000 bnxt: don't fail init when out of VLAN L2 filters bnxt_hwrm_set_filter() allocates an L2 filter for every configured VLAN and fails the init if any allocation fails. A port has a fixed number of L2 filters (509 on a BCM57416), so with enough VLANs every init fails with RESOURCE_ALLOC_ERROR and the port stays down until VLANs are removed. The port's MAC filter does not match on VLAN, so the per-VLAN filters are not needed to receive tagged traffic ( VLANs added while the port is running already work without one until the next init). Treat ENOMEM from the VLAN filter allocations as non-fatal (leave the remaining tags without a filter and log their count, once per init). Any other error still fails the init. Append new tags in bnxt_vlan_register() instead of prepending them, so the oldest VLANs keep their filters and the most recently added ones beyond the ports capabilities do not get a filter. Fixes: 91fcacc35597 ("if_bnxt: Add support for VLAN on Thor") MFC after: 2 weeks Sponsored by: E-CARD LTD. Sponsored by: Klara, Inc. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D61948 --- sys/dev/bnxt/bnxt_en/bnxt_hwrm.c | 24 ++++++++++++++++++++++++ sys/dev/bnxt/bnxt_en/if_bnxt.c | 10 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c index 2d9983393995..d278d1a87ee2 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c +++ b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c @@ -2531,17 +2531,41 @@ bnxt_hwrm_set_filter(struct bnxt_softc *softc) { struct bnxt_vnic_info *vnic = &softc->vnic_info; struct bnxt_vlan_tag *tag; + int nfilters = 0; int rc = 0; rc = bnxt_hwrm_l2_filter_alloc(softc, 0xffff, &vnic->filter_id); if (rc) goto end; + /* + * The filter above matches our MAC on any VLAN, so per-VLAN + * filters are not needed to receive tagged traffic. Running out + * of VLAN filters (ENOMEM) must not fail the init and take the + * port down. The VLAN tag list is ordered from oldest to newest + * by bnxt_vlan_register(), so the VLANs that do not get a filter + * are the ones most recently added. Any other error is fatal. + */ SLIST_FOREACH(tag, &vnic->vlan_tags, next) { rc = bnxt_hwrm_l2_filter_alloc(softc, tag->tag, &tag->filter_id); + if (rc == ENOMEM) + break; if (rc) goto end; + nfilters++; + } + + if (tag != NULL) { + struct bnxt_vlan_tag *full = tag; + int ntags = nfilters; + + SLIST_FOREACH_FROM(tag, &vnic->vlan_tags, next) + ntags++; + device_printf(softc->dev, "out of L2 filters: %d of %d VLANs " + "have none (VLAN %d and newer)\n", ntags - nfilters, + ntags, full->tag); + rc = 0; } end: diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index 032d3a4368ee..a1126755345c 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -4749,13 +4749,21 @@ bnxt_vlan_register(if_ctx_t ctx, uint16_t vtag) { struct bnxt_softc *softc = iflib_get_softc(ctx); struct bnxt_vlan_tag *new_tag; + struct vlan_head tail; new_tag = malloc(sizeof(struct bnxt_vlan_tag), M_DEVBUF, M_NOWAIT); if (new_tag == NULL) return; new_tag->tag = vtag; new_tag->filter_id = -1; - SLIST_INSERT_HEAD(&softc->vnic_info.vlan_tags, new_tag, next); + + /* + * Append new tags to the list so that the oldest VLANs (re)acquire + * L2 filters if bnxt_hwrm_set_filter() runs out. + */ + SLIST_INIT(&tail); + SLIST_INSERT_HEAD(&tail, new_tag, next); + SLIST_CONCAT(&softc->vnic_info.vlan_tags, &tail, bnxt_vlan_tag, next); }; static void