Currently, when updating customized protocol and packet type information via DDP packages, we are using rte_zmalloc followed by immediate rte_free. This is not needed as these buffers are only used temporarily within the function scope, so replace it with regular malloc/free.
Signed-off-by: Anatoly Burakov <[email protected]> --- drivers/net/intel/i40e/i40e_ethdev.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c index 2e0c2e2482..f27fbf89ee 100644 --- a/drivers/net/intel/i40e/i40e_ethdev.c +++ b/drivers/net/intel/i40e/i40e_ethdev.c @@ -11787,7 +11787,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg, } buff_size = pctype_num * sizeof(struct rte_pmd_i40e_proto_info); - pctype = rte_zmalloc("new_pctype", buff_size, 0); + pctype = calloc(pctype_num, sizeof(struct rte_pmd_i40e_proto_info)); if (!pctype) { PMD_DRV_LOG(ERR, "Failed to allocate memory"); return -1; @@ -11798,7 +11798,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg, RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST); if (ret) { PMD_DRV_LOG(ERR, "Failed to get pctype list"); - rte_free(pctype); + free(pctype); return -1; } @@ -11879,7 +11879,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg, } } - rte_free(pctype); + free(pctype); return 0; } @@ -11925,7 +11925,7 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg, } buff_size = ptype_num * sizeof(struct rte_pmd_i40e_ptype_info); - ptype = rte_zmalloc("new_ptype", buff_size, 0); + ptype = calloc(ptype_num, sizeof(struct rte_pmd_i40e_ptype_info)); if (!ptype) { PMD_DRV_LOG(ERR, "Failed to allocate memory"); return -1; @@ -11937,15 +11937,14 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg, RTE_PMD_I40E_PKG_INFO_PTYPE_LIST); if (ret) { PMD_DRV_LOG(ERR, "Failed to get ptype list"); - rte_free(ptype); + free(ptype); return ret; } - buff_size = ptype_num * sizeof(struct rte_pmd_i40e_ptype_mapping); - ptype_mapping = rte_zmalloc("ptype_mapping", buff_size, 0); + ptype_mapping = calloc(ptype_num, sizeof(struct rte_pmd_i40e_ptype_mapping)); if (!ptype_mapping) { PMD_DRV_LOG(ERR, "Failed to allocate memory"); - rte_free(ptype); + free(ptype); return -1; } @@ -12083,8 +12082,8 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg, if (ret) PMD_DRV_LOG(ERR, "Failed to update ptype mapping table."); - rte_free(ptype_mapping); - rte_free(ptype); + free(ptype_mapping); + free(ptype); return ret; } @@ -12119,7 +12118,7 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg, } buff_size = proto_num * sizeof(struct rte_pmd_i40e_proto_info); - proto = rte_zmalloc("new_proto", buff_size, 0); + proto = calloc(proto_num, sizeof(struct rte_pmd_i40e_proto_info)); if (!proto) { PMD_DRV_LOG(ERR, "Failed to allocate memory"); return; @@ -12131,7 +12130,7 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg, RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST); if (ret) { PMD_DRV_LOG(ERR, "Failed to get protocol list"); - rte_free(proto); + free(proto); return; } @@ -12169,7 +12168,7 @@ i40e_update_customized_info(struct rte_eth_dev *dev, uint8_t *pkg, if (ret) PMD_DRV_LOG(INFO, "No ptype is updated."); - rte_free(proto); + free(proto); } /* Create a QinQ cloud filter -- 2.47.3

