While testing D61945 I added a lot of VLANs to the lagg, and with 512
of them every re-init of the ports failed with
bnxt0: HWRM_CFA_L2_FILTER_ALLOC command returned RESOURCE_ALLOC_ERROR error.
and both ports stayed down until I removed VLANs. On this BCM57416 a
port seems to get 509 L2 filters, one for the MAC address and the rest
for VLANs.
As far as I can tell the per-VLAN filters aren't needed to receive
tagged traffic: the MAC filter doesn't match on VLAN, and VLANs added
while the port is up don't get a filter until the next init anyway,
and they work fine. So this patch treats running out of VLAN filters
(ENOMEM) as non-fatal: the remaining VLANs go without a filter, and it
logs once per init how many. Any other error still fails the init.
It also appends new tags to the end of the list instead of the front,
so the VLANs that go without a filter are the most recently added
ones, not the oldest.
It's not clear to me whether the per-VLAN filters are needed for something
I'm not seeing, or on P5 chips, which I can't test.
Proposed commit message:
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.