Fallback to all multicast mode if FW rejects multicast filter
programming.

The firmware can reject the MC filter programming request if
it is running low in resources when there is a large number of functions.
The driver must be prepared to fallback to the all-multicast mode
if the original MC filter programming request is rejected.

Signed-off-by: Ajit Khaparde <ajit.khapa...@broadcom.com>
Reviewed-by: Damodharam Ammepalli <damodharam.ammepa...@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5b775e7716..7aed6d3ab6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2947,7 +2947,17 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
                vnic->flags &= ~BNXT_VNIC_INFO_MCAST;
 
 allmulti:
-       return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+       rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+       if (rc == -ENOSPC && (vnic->flags & BNXT_VNIC_INFO_MCAST)) {
+               /* If MCAST addition failed because FW ran out of
+                * multicast filters, enable all multicast mode.
+                */
+               vnic->flags &= ~BNXT_VNIC_INFO_MCAST;
+               vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
+               goto allmulti;
+       }
+
+       return rc;
 }
 
 static int
-- 
2.39.2 (Apple Git-143)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to