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 ac465c90a4..8a56f05eeb 100644 --- a/drivers/net/intel/i40e/i40e_ethdev.c +++ b/drivers/net/intel/i40e/i40e_ethdev.c @@ -11788,7 +11788,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; @@ -11799,7 +11799,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; } @@ -11880,7 +11880,7 @@ i40e_update_customized_pctype(struct rte_eth_dev *dev, uint8_t *pkg, } } - rte_free(pctype); + free(pctype); return 0; } @@ -11926,7 +11926,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; @@ -11938,15 +11938,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; } @@ -12084,8 +12083,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; } @@ -12120,7 +12119,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; @@ -12132,7 +12131,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; } @@ -12170,7 +12169,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

