>diff --git a/drivers/net/qede/base/bcm_osal.c
>b/drivers/net/qede/base/bcm_osal.c
>index 2c59397..f195f2c 100644
>--- a/drivers/net/qede/base/bcm_osal.c
>+++ b/drivers/net/qede/base/bcm_osal.c
>@@ -47,10 +47,26 @@ void osal_poll_mode_dpc(osal_int_ptr_t
>hwfn_cookie)  }
>
> /* Array of memzone pointers */
>-static const struct rte_memzone
>*ecore_mz_mapping[RTE_MAX_MEMZONE];
>+static const struct rte_memzone **ecore_mz_mapping;
> /* Counter to track current memzone allocated */  static uint16_t
>ecore_mz_count;
>
>+int ecore_mz_mapping_alloc(void)
>+{
>+      ecore_mz_mapping = rte_malloc("ecore_mz_map", 0,
>+              rte_memzone_max_get() * sizeof(struct rte_memzone *));

Second parameter of rte_malloc() should be size and Third parameter should be 
alignment 0 in this case.

Check 
https://doc.dpdk.org/api/rte__malloc_8h.html#a247c99e8d36300c52729c9ee58c2b489

>diff --git a/drivers/net/qede/base/bcm_osal.h
>b/drivers/net/qede/base/bcm_osal.h
>index 67e7f75..97e261d 100644
>--- a/drivers/net/qede/base/bcm_osal.h
>+++ b/drivers/net/qede/base/bcm_osal.h
>@@ -477,4 +477,7 @@ enum dbg_status
>       qed_dbg_alloc_user_data(struct ecore_hwfn *p_hwfn,
>       qed_dbg_alloc_user_data(p_hwfn, user_data_ptr)  #define
>OSAL_DB_REC_OCCURRED(p_hwfn) nothing
>
>+int ecore_mz_mapping_alloc(void);
>+void ecore_mz_mapping_free(void);
>+
> #endif /* __BCM_OSAL_H */
>diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
>index 0303903..f116e86 100644
>--- a/drivers/net/qede/qede_main.c
>+++ b/drivers/net/qede/qede_main.c
>@@ -78,6 +78,12 @@ qed_probe(struct ecore_dev *edev, struct
>rte_pci_device *pci_dev,
>               return rc;
>       }
>
>+      rc = ecore_mz_mapping_alloc();

ecore_mz_mapping_alloc() should be called prior to calling ecore_hw_prepare().

>+      if (rc) {
>+              DP_ERR(edev, "mem zones array allocation failed\n");
>+              return rc;
>+      }
>+
>       return rc;
> }
>
>@@ -721,6 +727,7 @@ static void qed_remove(struct ecore_dev *edev)
>       if (!edev)
>               return;
>
>+      ecore_mz_mapping_free();
>       ecore_hw_remove(edev);
> }

ecore_mz_mapping_free() should be called after ecore_hw_remove();

Reply via email to