From: Kalesh AP <kalesh-anakkur.pura...@broadcom.com>

On older firmware versions, HWRM_FUNC_QCAPS response is not
returning the maximum number of multicast filters that can be
supported by the function. As a result, memory allocation with
size 0 fails.

Bugzilla ID: 1309
Cc: sta...@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.pura...@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khapa...@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      | 1 +
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index cfdbfd3f54..cd85a944e8 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -974,6 +974,7 @@ struct bnxt {
        struct rte_ether_addr   *mcast_addr_list;
        rte_iova_t              mc_list_dma_addr;
        uint32_t                nb_mc_addr;
+#define BNXT_DFLT_MAX_MC_ADDR  16 /* for compatibility with older firmware */
        uint32_t                max_mcast_addr; /* maximum number of mcast 
filters supported */
 
        struct rte_eth_rss_conf rss_conf; /* RSS configuration. */
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index a1f3a8251f..d649f217ec 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -901,6 +901,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
                    bp->max_l2_ctx, bp->max_vnics);
        bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
        bp->max_mcast_addr = rte_le_to_cpu_32(resp->max_mcast_filters);
+       if (!bp->max_mcast_addr)
+               bp->max_mcast_addr = BNXT_DFLT_MAX_MC_ADDR;
        memcpy(bp->dsn, resp->device_serial_number, sizeof(bp->dsn));
 
        if (BNXT_PF(bp))
-- 
2.39.2 (Apple Git-143)

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

Reply via email to