There is no need to dynamically allocate this buffer separately as it is fixed in size and is always allocated for all driver instances no matter the configuration. Embed it in `iavf_info` struct.
Signed-off-by: Anatoly Burakov <[email protected]> --- drivers/net/intel/iavf/iavf.h | 2 +- drivers/net/intel/iavf/iavf_ethdev.c | 13 ------------- drivers/net/intel/iavf/iavf_vchnl.c | 4 ---- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h index 440376c4ca..067ebc29d0 100644 --- a/drivers/net/intel/iavf/iavf.h +++ b/drivers/net/intel/iavf/iavf.h @@ -242,7 +242,7 @@ struct iavf_info { volatile RTE_ATOMIC(enum virtchnl_ops) pend_cmd; /* pending command not finished */ RTE_ATOMIC(uint32_t) pend_cmd_count; int cmd_retval; /* return value of the cmd response from PF */ - uint8_t *aq_resp; /* buffer to store the adminq response from PF */ + uint8_t aq_resp[IAVF_AQ_BUF_SZ]; /* buffer to store the adminq response from PF */ bool aq_intr_enabled; /** iAVF watchdog enable */ diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c index 9fdebec0f4..6d0306b3ac 100644 --- a/drivers/net/intel/iavf/iavf_ethdev.c +++ b/drivers/net/intel/iavf/iavf_ethdev.c @@ -2553,11 +2553,6 @@ iavf_init_vf(struct rte_eth_dev *dev) goto err; } - vf->aq_resp = rte_zmalloc("vf_aq_resp", IAVF_AQ_BUF_SZ, 0); - if (!vf->aq_resp) { - PMD_INIT_LOG(ERR, "unable to allocate vf_aq_resp memory"); - goto err_aq; - } if (iavf_check_api_version(adapter) != 0) { PMD_INIT_LOG(ERR, "check_api version failed"); goto err_api; @@ -2631,8 +2626,6 @@ iavf_init_vf(struct rte_eth_dev *dev) rte_free(vf->vf_res); vf->vsi_res = NULL; err_api: - rte_free(vf->aq_resp); -err_aq: iavf_shutdown_adminq(hw); err: return -1; @@ -2650,9 +2643,6 @@ iavf_uninit_vf(struct rte_eth_dev *dev) vf->vsi_res = NULL; vf->vf_res = NULL; - rte_free(vf->aq_resp); - vf->aq_resp = NULL; - rte_free(vf->qos_cap); vf->qos_cap = NULL; @@ -3009,9 +2999,6 @@ iavf_dev_close(struct rte_eth_dev *dev) vf->vsi_res = NULL; vf->vf_res = NULL; - rte_free(vf->aq_resp); - vf->aq_resp = NULL; - /* * If the VF is reset via VFLR, the device will be knocked out of bus * master mode, and the driver will fail to recover from the reset. Fix diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c index 1e98503b31..03cb2a55d8 100644 --- a/drivers/net/intel/iavf/iavf_vchnl.c +++ b/drivers/net/intel/iavf/iavf_vchnl.c @@ -564,10 +564,6 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev) int ret; info.buf_len = IAVF_AQ_BUF_SZ; - if (!vf->aq_resp) { - PMD_DRV_LOG(ERR, "Buffer for adminq resp should not be NULL"); - return; - } info.msg_buf = vf->aq_resp; pending = 1; -- 2.47.3

