Page MenuHomeFreeBSD

D61948.1795600823.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61948.1795600823.diff

diff --git a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
--- a/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
@@ -2531,17 +2531,41 @@
{
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
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -4749,13 +4749,21 @@
{
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

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 25, 10:00 AM (20 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41958430
Default Alt Text
D61948.1795600823.diff (2 KB)

Event Timeline