* [PATCH v1 1/1] net/iavf: remove global adminq response buffer
@ 2026-02-25 12:09 Anatoly Burakov
2026-02-26 10:41 ` [PATCH v2 " Anatoly Burakov
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
0 siblings, 2 replies; 23+ messages in thread
From: Anatoly Burakov @ 2026-02-25 12:09 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
In many places where we are calling down into virtchnl, we are using a
globally allocated adminq response buffer. This is unnecessary, so replace
with adminq buffers allocated on stack.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf.h | 1 -
drivers/net/intel/iavf/iavf_ethdev.c | 13 --
drivers/net/intel/iavf/iavf_vchnl.c | 240 +++++++++++++++------------
3 files changed, 136 insertions(+), 118 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index f9bb398a77..c44ef54766 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -242,7 +242,6 @@ 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 */
/** iAVF watchdog enable */
bool watchdog_enabled;
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 26e7febecf..d32a3c56a1 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -2545,11 +2545,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;
@@ -2623,8 +2618,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;
@@ -2642,9 +2635,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;
@@ -2997,9 +2987,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 08dd6f2d7f..5e8ca20cf1 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -510,14 +510,11 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
uint16_t pending, aq_opc;
enum virtchnl_ops msg_opc;
enum iavf_status msg_ret;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
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;
+ info.buf_len = sizeof(msg_buf);
+ info.msg_buf = msg_buf;
pending = 1;
while (pending) {
@@ -599,16 +596,16 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
int
iavf_enable_vlan_strip(struct iavf_adapter *adapter)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "Failed to execute command of"
@@ -620,16 +617,16 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
int
iavf_disable_vlan_strip(struct iavf_adapter *adapter)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "Failed to execute command of"
@@ -647,6 +644,7 @@ iavf_check_api_version(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_version_info version, *pver;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -656,8 +654,8 @@ iavf_check_api_version(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_VERSION;
args.in_args = (uint8_t *)&version;
args.in_args_size = sizeof(version);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -697,12 +695,13 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t caps, len;
int err, i;
args.ops = VIRTCHNL_OP_GET_VF_RESOURCES;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
caps = IAVF_BASIC_OFFLOAD_CAPS | VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
@@ -758,13 +757,14 @@ iavf_get_supported_rxdid(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
args.ops = VIRTCHNL_OP_GET_SUPPORTED_RXDIDS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret) {
@@ -785,6 +785,7 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *stripping_caps;
struct virtchnl_vlan_setting vlan_strip;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t *ethertype;
int ret;
@@ -808,8 +809,8 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2;
args.in_args = (uint8_t *)&vlan_strip;
args.in_args_size = sizeof(vlan_strip);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -825,6 +826,7 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *insertion_caps;
struct virtchnl_vlan_setting vlan_insert;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t *ethertype;
int ret;
@@ -848,8 +850,8 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2;
args.in_args = (uint8_t *)&vlan_insert;
args.in_args_size = sizeof(vlan_insert);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -867,6 +869,7 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
struct virtchnl_vlan_filter_list_v2 vlan_filter;
struct virtchnl_vlan *vlan_setting;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t filtering_caps;
int err;
@@ -891,8 +894,8 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_VLAN_V2 : VIRTCHNL_OP_DEL_VLAN_V2;
args.in_args = (uint8_t *)&vlan_filter;
args.in_args_size = sizeof(vlan_filter);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -906,13 +909,14 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
args.ops = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret) {
@@ -921,7 +925,7 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
return ret;
}
- rte_memcpy(&vf->vlan_v2_caps, vf->aq_resp, sizeof(vf->vlan_v2_caps));
+ rte_memcpy(&vf->vlan_v2_caps, msg_buf, sizeof(vf->vlan_v2_caps));
return 0;
}
@@ -932,6 +936,7 @@ iavf_enable_queues(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&queue_select, 0, sizeof(queue_select));
@@ -943,8 +948,8 @@ iavf_enable_queues(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR,
@@ -960,6 +965,7 @@ iavf_disable_queues(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&queue_select, 0, sizeof(queue_select));
@@ -971,8 +977,8 @@ iavf_disable_queues(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR,
@@ -989,6 +995,7 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1007,8 +1014,8 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
args.ops = VIRTCHNL_OP_DISABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of %s",
@@ -1027,6 +1034,7 @@ iavf_enable_queues_lv(struct iavf_adapter *adapter)
struct virtchnl_del_ena_dis_queues *queue_select = &queue_req.msg;
struct virtchnl_queue_chunk *queue_chunk = queue_select->chunks.chunks;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
queue_select->chunks.num_chunks = IAVF_RXTX_QUEUE_CHUNKS_NUM;
@@ -1045,8 +1053,8 @@ iavf_enable_queues_lv(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR,
@@ -1066,6 +1074,7 @@ iavf_disable_queues_lv(struct iavf_adapter *adapter)
struct virtchnl_del_ena_dis_queues *queue_select = &queue_req.msg;
struct virtchnl_queue_chunk *queue_chunk = queue_select->chunks.chunks;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
queue_select->chunks.num_chunks = IAVF_RXTX_QUEUE_CHUNKS_NUM;
@@ -1084,8 +1093,8 @@ iavf_disable_queues_lv(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR,
@@ -1105,6 +1114,7 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
struct virtchnl_del_ena_dis_queues *queue_select = &queue_req.msg;
struct virtchnl_queue_chunk *queue_chunk = queue_select->chunks.chunks;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
queue_select->chunks.num_chunks = 1;
@@ -1126,8 +1136,8 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
args.ops = VIRTCHNL_OP_DISABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of %s",
@@ -1142,6 +1152,7 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_rss_lut *rss_lut;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int len, err = 0;
len = sizeof(*rss_lut) + vf->vf_res->rss_lut_size - 1;
@@ -1156,8 +1167,8 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_RSS_LUT;
args.in_args = (u8 *)rss_lut;
args.in_args_size = len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1174,6 +1185,7 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_rss_key *rss_key;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int len, err = 0;
len = sizeof(*rss_key) + vf->vf_res->rss_key_size - 1;
@@ -1188,8 +1200,8 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_RSS_KEY;
args.in_args = (u8 *)rss_key;
args.in_args_size = len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1266,6 +1278,7 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
uint16_t chunk_end = chunk_start + chunk_sz;
uint16_t i;
size_t buf_len;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (chunk_sz > IAVF_CFG_Q_NUM_PER_BUF)
@@ -1284,8 +1297,8 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
args.in_args = (uint8_t *)vc_config;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1325,6 +1338,7 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
} map_req = {0};
struct virtchnl_irq_map_info *map_info = &map_req.map_info;
struct iavf_cmd_info args = {0};
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int i, err, max_vmi = -1;
size_t buf_len;
@@ -1368,8 +1382,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
args.in_args = (u8 *)map_info;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
@@ -1391,6 +1405,7 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
struct virtchnl_queue_vector_maps *map_info = &chunk_req.map_info;
struct virtchnl_queue_vector *qv_maps = chunk_req.qv_maps;
size_t buf_len;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint16_t i;
if (chunk_sz > IAVF_CFG_Q_NUM_PER_BUF)
@@ -1413,8 +1428,8 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_MAP_QUEUE_VECTOR;
args.in_args = (u8 *)map_info;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
return iavf_execute_vf_cmd_safe(adapter, &args, 0);
}
@@ -1447,6 +1462,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
struct virtchnl_ether_addr_list *list = &list_req.list;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args = {0};
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err, i;
size_t buf_len;
@@ -1473,8 +1489,8 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR;
args.in_args = (uint8_t *)list;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -1488,6 +1504,7 @@ iavf_query_stats(struct iavf_adapter *adapter,
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select q_stats;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1498,8 +1515,8 @@ iavf_query_stats(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_GET_STATS;
args.in_args = (uint8_t *)&q_stats;
args.in_args_size = sizeof(q_stats);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1519,6 +1536,7 @@ iavf_config_promisc(struct iavf_adapter *adapter,
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_promisc_info promisc;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1536,8 +1554,8 @@ iavf_config_promisc(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
args.in_args = (uint8_t *)&promisc;
args.in_args_size = sizeof(promisc);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
@@ -1565,6 +1583,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
uint8_t cmd_buffer[sizeof(struct virtchnl_ether_addr_list) +
sizeof(struct virtchnl_ether_addr)];
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1580,8 +1599,8 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR;
args.in_args = cmd_buffer;
args.in_args_size = sizeof(cmd_buffer);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -1597,6 +1616,7 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
sizeof(uint16_t)];
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
vlan_list = (struct virtchnl_vlan_filter_list *)cmd_buffer;
@@ -1607,8 +1627,8 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_VLAN : VIRTCHNL_OP_DEL_VLAN;
args.in_args = cmd_buffer;
args.in_args_size = sizeof(cmd_buffer);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -1625,6 +1645,7 @@ iavf_fdir_add(struct iavf_adapter *adapter,
struct virtchnl_fdir_add *fdir_ret;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->add_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1633,8 +1654,8 @@ iavf_fdir_add(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_ADD_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->add_fltr);
args.in_args_size = sizeof(*(&filter->add_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1685,6 +1706,7 @@ iavf_fdir_del(struct iavf_adapter *adapter,
struct virtchnl_fdir_del *fdir_ret;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->del_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1693,8 +1715,8 @@ iavf_fdir_del(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_DEL_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->del_fltr);
args.in_args_size = sizeof(filter->del_fltr);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1732,6 +1754,7 @@ iavf_fdir_check(struct iavf_adapter *adapter,
struct virtchnl_fdir_add *fdir_ret;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->add_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1740,8 +1763,8 @@ iavf_fdir_check(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_ADD_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->add_fltr);
args.in_args_size = sizeof(*(&filter->add_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1774,6 +1797,7 @@ iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_flow_sub *fsub_cfg;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->sub_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1783,8 +1807,8 @@ iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.ops = VIRTCHNL_OP_FLOW_SUBSCRIBE;
args.in_args = (uint8_t *)(&filter->sub_fltr);
args.in_args_size = sizeof(*(&filter->sub_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1825,6 +1849,7 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_flow_unsub *unsub_cfg;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->unsub_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1834,8 +1859,8 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.ops = VIRTCHNL_OP_FLOW_UNSUBSCRIBE;
args.in_args = (uint8_t *)(&filter->unsub_fltr);
args.in_args_size = sizeof(filter->unsub_fltr);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1869,6 +1894,7 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
struct virtchnl_flow_sub *fsub_cfg;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->sub_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1877,8 +1903,8 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_FLOW_SUBSCRIBE;
args.in_args = (uint8_t *)(&filter->sub_fltr);
args.in_args_size = sizeof(*(&filter->sub_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1908,8 +1934,8 @@ int
iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
struct virtchnl_rss_cfg *rss_cfg, bool add)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&args, 0, sizeof(args));
@@ -1917,8 +1943,8 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
VIRTCHNL_OP_DEL_RSS_CFG;
args.in_args = (u8 *)rss_cfg;
args.in_args_size = sizeof(*rss_cfg);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1933,15 +1959,15 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
int
iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
args.ops = VIRTCHNL_OP_GET_RSS_HENA_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1957,17 +1983,17 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
int
iavf_set_hena(struct iavf_adapter *adapter, uint64_t hena)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_rss_hena vrh;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
vrh.hena = hena;
args.ops = VIRTCHNL_OP_SET_RSS_HENA;
args.in_args = (u8 *)&vrh;
args.in_args_size = sizeof(vrh);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1982,14 +2008,15 @@ iavf_get_qos_cap(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t len;
int err;
args.ops = VIRTCHNL_OP_GET_QOS_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2012,16 +2039,16 @@ int iavf_set_q_tc_map(struct rte_eth_dev *dev,
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP;
args.in_args = (uint8_t *)q_tc_mapping;
args.in_args_size = size;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -2035,16 +2062,16 @@ int iavf_set_q_bw(struct rte_eth_dev *dev,
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_CONFIG_QUEUE_BW;
args.in_args = (uint8_t *)q_bw;
args.in_args_size = size;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -2063,6 +2090,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
(IAVF_NUM_MACADDR_MAX * sizeof(struct virtchnl_ether_addr))];
struct virtchnl_ether_addr_list *list;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t i;
int err;
@@ -2089,8 +2117,8 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
args.in_args = cmd_buffer;
args.in_args_size = sizeof(struct virtchnl_ether_addr_list) +
i * sizeof(struct virtchnl_ether_addr);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2110,6 +2138,7 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vf_res_request vfres;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint16_t num_queue_pairs;
int err;
int i = 0;
@@ -2129,8 +2158,8 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
args.ops = VIRTCHNL_OP_REQUEST_QUEUES;
args.in_args = (u8 *)&vfres;
args.in_args_size = sizeof(vfres);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
@@ -2173,14 +2202,15 @@ iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint16_t qregion_width;
int err;
args.ops = VIRTCHNL_OP_GET_MAX_RSS_QREGION;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2203,15 +2233,15 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
uint8_t *msg, size_t msg_len,
uint8_t *resp_msg, size_t resp_msg_len)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
args.ops = VIRTCHNL_OP_INLINE_IPSEC_CRYPTO;
args.in_args = msg;
args.in_args_size = msg_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 1);
if (err) {
@@ -2228,9 +2258,9 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
int
iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 num_queues)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
struct virtchnl_quanta_cfg q_quanta;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->devargs.quanta_size == 0)
@@ -2244,8 +2274,8 @@ iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 nu
args.ops = VIRTCHNL_OP_CONFIG_QUANTA;
args.in_args = (uint8_t *)&q_quanta;
args.in_args_size = sizeof(q_quanta);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2262,6 +2292,7 @@ iavf_get_ptp_cap(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_ptp_caps ptp_caps;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
ptp_caps.caps = VIRTCHNL_1588_PTP_CAP_RX_TSTAMP |
@@ -2270,8 +2301,8 @@ iavf_get_ptp_cap(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_1588_PTP_GET_CAPS;
args.in_args = (uint8_t *)&ptp_caps;
args.in_args_size = sizeof(ptp_caps);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2292,13 +2323,14 @@ iavf_get_phc_time(struct ci_rx_queue *rxq)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_phc_time phc_time;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err = 0;
args.ops = VIRTCHNL_OP_1588_PTP_GET_TIME;
args.in_args = (uint8_t *)&phc_time;
args.in_args_size = sizeof(phc_time);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
rte_spinlock_lock(&vf->phc_time_aq_lock);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 1/1] net/iavf: remove global adminq response buffer
2026-02-25 12:09 [PATCH v1 1/1] net/iavf: remove global adminq response buffer Anatoly Burakov
@ 2026-02-26 10:41 ` Anatoly Burakov
2026-02-26 10:52 ` Burakov, Anatoly
2026-02-27 10:58 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
1 sibling, 2 replies; 23+ messages in thread
From: Anatoly Burakov @ 2026-02-26 10:41 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
In many places where we are calling down into virtchnl, we are using a
globally allocated adminq response buffer. This is unnecessary, so replace
with adminq buffers allocated on stack.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf.h | 3 +-
drivers/net/intel/iavf/iavf_ethdev.c | 43 ++---
drivers/net/intel/iavf/iavf_vchnl.c | 250 +++++++++++++++------------
3 files changed, 156 insertions(+), 140 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index f9bb398a77..33ba3115d0 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -242,7 +242,6 @@ 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 */
/** iAVF watchdog enable */
bool watchdog_enabled;
@@ -517,7 +516,7 @@ int iavf_dev_link_update(struct rte_eth_dev *dev,
__rte_unused int wait_to_complete);
void iavf_dev_alarm_handler(void *param);
int iavf_query_stats(struct iavf_adapter *adapter,
- struct virtchnl_eth_stats **pstats);
+ struct virtchnl_eth_stats *pstats);
int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast,
bool enable_multicast);
int iavf_add_del_eth_addr(struct iavf_adapter *adapter,
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 26e7febecf..c1160c8967 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -1785,7 +1785,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_vsi *vsi = &vf->vsi;
- struct virtchnl_eth_stats *pstats = NULL;
+ struct virtchnl_eth_stats pstats = {0};
int ret;
ret = iavf_query_stats(adapter, &pstats);
@@ -1793,16 +1793,16 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
RTE_ETHER_CRC_LEN;
- iavf_update_stats(vsi, pstats);
- stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
- pstats->rx_broadcast - pstats->rx_discards;
- stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
- pstats->tx_unicast;
- stats->imissed = pstats->rx_discards;
- stats->oerrors = pstats->tx_errors + pstats->tx_discards;
- stats->ibytes = pstats->rx_bytes;
+ iavf_update_stats(vsi, &pstats);
+ stats->ipackets = pstats.rx_unicast + pstats.rx_multicast +
+ pstats.rx_broadcast - pstats.rx_discards;
+ stats->opackets = pstats.tx_broadcast + pstats.tx_multicast +
+ pstats.tx_unicast;
+ stats->imissed = pstats.rx_discards;
+ stats->oerrors = pstats.tx_errors + pstats.tx_discards;
+ stats->ibytes = pstats.rx_bytes;
stats->ibytes -= stats->ipackets * crc_stats_len;
- stats->obytes = pstats->tx_bytes;
+ stats->obytes = pstats.tx_bytes;
} else {
PMD_DRV_LOG(ERR, "Get statistics failed");
}
@@ -1817,7 +1817,7 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_vsi *vsi = &vf->vsi;
- struct virtchnl_eth_stats *pstats = NULL;
+ struct virtchnl_eth_stats pstats = {0};
/* read stat values to clear hardware registers */
ret = iavf_query_stats(adapter, &pstats);
@@ -1825,7 +1825,7 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
return ret;
/* set stats offset base on current values */
- vsi->eth_stats_offset.eth_stats = *pstats;
+ vsi->eth_stats_offset.eth_stats = pstats;
return 0;
}
@@ -1901,7 +1901,7 @@ static int iavf_dev_xstats_get(struct rte_eth_dev *dev,
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_vsi *vsi = &vf->vsi;
- struct virtchnl_eth_stats *pstats = NULL;
+ struct virtchnl_eth_stats pstats = {0};
struct iavf_eth_xstats iavf_xtats = {{0}};
if (n < IAVF_NB_XSTATS)
@@ -1914,8 +1914,8 @@ static int iavf_dev_xstats_get(struct rte_eth_dev *dev,
if (!xstats)
return 0;
- iavf_update_stats(vsi, pstats);
- iavf_xtats.eth_stats = *pstats;
+ iavf_update_stats(vsi, &pstats);
+ iavf_xtats.eth_stats = pstats;
if (iavf_ipsec_crypto_supported(adapter))
iavf_dev_update_ipsec_xstats(dev, &iavf_xtats.ips_stats);
@@ -2545,11 +2545,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;
@@ -2623,8 +2618,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;
@@ -2642,9 +2635,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;
@@ -2997,9 +2987,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 08dd6f2d7f..bfe963edaf 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -510,14 +510,11 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
uint16_t pending, aq_opc;
enum virtchnl_ops msg_opc;
enum iavf_status msg_ret;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
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;
+ info.buf_len = sizeof(msg_buf);
+ info.msg_buf = msg_buf;
pending = 1;
while (pending) {
@@ -599,16 +596,16 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
int
iavf_enable_vlan_strip(struct iavf_adapter *adapter)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "Failed to execute command of"
@@ -620,16 +617,16 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
int
iavf_disable_vlan_strip(struct iavf_adapter *adapter)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "Failed to execute command of"
@@ -647,6 +644,7 @@ iavf_check_api_version(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_version_info version, *pver;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -656,8 +654,8 @@ iavf_check_api_version(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_VERSION;
args.in_args = (uint8_t *)&version;
args.in_args_size = sizeof(version);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -697,12 +695,13 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t caps, len;
int err, i;
args.ops = VIRTCHNL_OP_GET_VF_RESOURCES;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
caps = IAVF_BASIC_OFFLOAD_CAPS | VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
@@ -758,13 +757,14 @@ iavf_get_supported_rxdid(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
args.ops = VIRTCHNL_OP_GET_SUPPORTED_RXDIDS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret) {
@@ -785,6 +785,7 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *stripping_caps;
struct virtchnl_vlan_setting vlan_strip;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t *ethertype;
int ret;
@@ -808,8 +809,8 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2;
args.in_args = (uint8_t *)&vlan_strip;
args.in_args_size = sizeof(vlan_strip);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -825,6 +826,7 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *insertion_caps;
struct virtchnl_vlan_setting vlan_insert;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t *ethertype;
int ret;
@@ -848,8 +850,8 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2;
args.in_args = (uint8_t *)&vlan_insert;
args.in_args_size = sizeof(vlan_insert);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -867,6 +869,7 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
struct virtchnl_vlan_filter_list_v2 vlan_filter;
struct virtchnl_vlan *vlan_setting;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t filtering_caps;
int err;
@@ -891,8 +894,8 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_VLAN_V2 : VIRTCHNL_OP_DEL_VLAN_V2;
args.in_args = (uint8_t *)&vlan_filter;
args.in_args_size = sizeof(vlan_filter);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -906,13 +909,14 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int ret;
args.ops = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (ret) {
@@ -921,7 +925,7 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
return ret;
}
- rte_memcpy(&vf->vlan_v2_caps, vf->aq_resp, sizeof(vf->vlan_v2_caps));
+ rte_memcpy(&vf->vlan_v2_caps, msg_buf, sizeof(vf->vlan_v2_caps));
return 0;
}
@@ -932,6 +936,7 @@ iavf_enable_queues(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&queue_select, 0, sizeof(queue_select));
@@ -943,8 +948,8 @@ iavf_enable_queues(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR,
@@ -960,6 +965,7 @@ iavf_disable_queues(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&queue_select, 0, sizeof(queue_select));
@@ -971,8 +977,8 @@ iavf_disable_queues(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR,
@@ -989,6 +995,7 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1007,8 +1014,8 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
args.ops = VIRTCHNL_OP_DISABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of %s",
@@ -1027,6 +1034,7 @@ iavf_enable_queues_lv(struct iavf_adapter *adapter)
struct virtchnl_del_ena_dis_queues *queue_select = &queue_req.msg;
struct virtchnl_queue_chunk *queue_chunk = queue_select->chunks.chunks;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
queue_select->chunks.num_chunks = IAVF_RXTX_QUEUE_CHUNKS_NUM;
@@ -1045,8 +1053,8 @@ iavf_enable_queues_lv(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR,
@@ -1066,6 +1074,7 @@ iavf_disable_queues_lv(struct iavf_adapter *adapter)
struct virtchnl_del_ena_dis_queues *queue_select = &queue_req.msg;
struct virtchnl_queue_chunk *queue_chunk = queue_select->chunks.chunks;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
queue_select->chunks.num_chunks = IAVF_RXTX_QUEUE_CHUNKS_NUM;
@@ -1084,8 +1093,8 @@ iavf_disable_queues_lv(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR,
@@ -1105,6 +1114,7 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
struct virtchnl_del_ena_dis_queues *queue_select = &queue_req.msg;
struct virtchnl_queue_chunk *queue_chunk = queue_select->chunks.chunks;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
queue_select->chunks.num_chunks = 1;
@@ -1126,8 +1136,8 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
args.ops = VIRTCHNL_OP_DISABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of %s",
@@ -1142,6 +1152,7 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_rss_lut *rss_lut;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int len, err = 0;
len = sizeof(*rss_lut) + vf->vf_res->rss_lut_size - 1;
@@ -1156,8 +1167,8 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_RSS_LUT;
args.in_args = (u8 *)rss_lut;
args.in_args_size = len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1174,6 +1185,7 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_rss_key *rss_key;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int len, err = 0;
len = sizeof(*rss_key) + vf->vf_res->rss_key_size - 1;
@@ -1188,8 +1200,8 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_RSS_KEY;
args.in_args = (u8 *)rss_key;
args.in_args_size = len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1266,6 +1278,7 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
uint16_t chunk_end = chunk_start + chunk_sz;
uint16_t i;
size_t buf_len;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (chunk_sz > IAVF_CFG_Q_NUM_PER_BUF)
@@ -1284,8 +1297,8 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
args.in_args = (uint8_t *)vc_config;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1325,6 +1338,7 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
} map_req = {0};
struct virtchnl_irq_map_info *map_info = &map_req.map_info;
struct iavf_cmd_info args = {0};
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int i, err, max_vmi = -1;
size_t buf_len;
@@ -1368,8 +1382,8 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
args.in_args = (u8 *)map_info;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
@@ -1391,6 +1405,7 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
struct virtchnl_queue_vector_maps *map_info = &chunk_req.map_info;
struct virtchnl_queue_vector *qv_maps = chunk_req.qv_maps;
size_t buf_len;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint16_t i;
if (chunk_sz > IAVF_CFG_Q_NUM_PER_BUF)
@@ -1413,8 +1428,8 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_MAP_QUEUE_VECTOR;
args.in_args = (u8 *)map_info;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
return iavf_execute_vf_cmd_safe(adapter, &args, 0);
}
@@ -1447,6 +1462,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
struct virtchnl_ether_addr_list *list = &list_req.list;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args = {0};
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err, i;
size_t buf_len;
@@ -1473,8 +1489,8 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR;
args.in_args = (uint8_t *)list;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -1483,31 +1499,30 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
int
iavf_query_stats(struct iavf_adapter *adapter,
- struct virtchnl_eth_stats **pstats)
+ struct virtchnl_eth_stats *pstats)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
- struct virtchnl_queue_select q_stats;
- struct iavf_cmd_info args;
+ struct virtchnl_queue_select q_stats = {0};
+ struct iavf_cmd_info args = {0};
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
return -EIO;
- memset(&q_stats, 0, sizeof(q_stats));
q_stats.vsi_id = vf->vsi_res->vsi_id;
args.ops = VIRTCHNL_OP_GET_STATS;
args.in_args = (uint8_t *)&q_stats;
args.in_args_size = sizeof(q_stats);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
- *pstats = NULL;
return err;
}
- *pstats = (struct virtchnl_eth_stats *)args.out_buffer;
+ *pstats = *(struct virtchnl_eth_stats *)msg_buf;
return 0;
}
@@ -1519,6 +1534,7 @@ iavf_config_promisc(struct iavf_adapter *adapter,
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_promisc_info promisc;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1536,8 +1552,8 @@ iavf_config_promisc(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
args.in_args = (uint8_t *)&promisc;
args.in_args_size = sizeof(promisc);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
@@ -1565,6 +1581,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
uint8_t cmd_buffer[sizeof(struct virtchnl_ether_addr_list) +
sizeof(struct virtchnl_ether_addr)];
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->closed)
@@ -1580,8 +1597,8 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR;
args.in_args = cmd_buffer;
args.in_args_size = sizeof(cmd_buffer);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -1597,6 +1614,7 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
sizeof(uint16_t)];
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
vlan_list = (struct virtchnl_vlan_filter_list *)cmd_buffer;
@@ -1607,8 +1625,8 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_VLAN : VIRTCHNL_OP_DEL_VLAN;
args.in_args = cmd_buffer;
args.in_args_size = sizeof(cmd_buffer);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -1625,6 +1643,7 @@ iavf_fdir_add(struct iavf_adapter *adapter,
struct virtchnl_fdir_add *fdir_ret;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->add_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1633,8 +1652,8 @@ iavf_fdir_add(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_ADD_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->add_fltr);
args.in_args_size = sizeof(*(&filter->add_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1685,6 +1704,7 @@ iavf_fdir_del(struct iavf_adapter *adapter,
struct virtchnl_fdir_del *fdir_ret;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->del_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1693,8 +1713,8 @@ iavf_fdir_del(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_DEL_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->del_fltr);
args.in_args_size = sizeof(filter->del_fltr);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1732,6 +1752,7 @@ iavf_fdir_check(struct iavf_adapter *adapter,
struct virtchnl_fdir_add *fdir_ret;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->add_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1740,8 +1761,8 @@ iavf_fdir_check(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_ADD_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->add_fltr);
args.in_args_size = sizeof(*(&filter->add_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1774,6 +1795,7 @@ iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_flow_sub *fsub_cfg;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->sub_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1783,8 +1805,8 @@ iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.ops = VIRTCHNL_OP_FLOW_SUBSCRIBE;
args.in_args = (uint8_t *)(&filter->sub_fltr);
args.in_args_size = sizeof(*(&filter->sub_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1825,6 +1847,7 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_flow_unsub *unsub_cfg;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->unsub_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1834,8 +1857,8 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.ops = VIRTCHNL_OP_FLOW_UNSUBSCRIBE;
args.in_args = (uint8_t *)(&filter->unsub_fltr);
args.in_args_size = sizeof(filter->unsub_fltr);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1869,6 +1892,7 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
struct virtchnl_flow_sub *fsub_cfg;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
filter->sub_fltr.vsi_id = vf->vsi_res->vsi_id;
@@ -1877,8 +1901,8 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_FLOW_SUBSCRIBE;
args.in_args = (uint8_t *)(&filter->sub_fltr);
args.in_args_size = sizeof(*(&filter->sub_fltr));
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1908,8 +1932,8 @@ int
iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
struct virtchnl_rss_cfg *rss_cfg, bool add)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&args, 0, sizeof(args));
@@ -1917,8 +1941,8 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
VIRTCHNL_OP_DEL_RSS_CFG;
args.in_args = (u8 *)rss_cfg;
args.in_args_size = sizeof(*rss_cfg);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1933,15 +1957,15 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
int
iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
args.ops = VIRTCHNL_OP_GET_RSS_HENA_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -1957,17 +1981,17 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
int
iavf_set_hena(struct iavf_adapter *adapter, uint64_t hena)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_rss_hena vrh;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
vrh.hena = hena;
args.ops = VIRTCHNL_OP_SET_RSS_HENA;
args.in_args = (u8 *)&vrh;
args.in_args_size = sizeof(vrh);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -1982,14 +2006,15 @@ iavf_get_qos_cap(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t len;
int err;
args.ops = VIRTCHNL_OP_GET_QOS_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2012,16 +2037,16 @@ int iavf_set_q_tc_map(struct rte_eth_dev *dev,
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP;
args.in_args = (uint8_t *)q_tc_mapping;
args.in_args_size = size;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -2035,16 +2060,16 @@ int iavf_set_q_bw(struct rte_eth_dev *dev,
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
memset(&args, 0, sizeof(args));
args.ops = VIRTCHNL_OP_CONFIG_QUEUE_BW;
args.in_args = (uint8_t *)q_bw;
args.in_args_size = size;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err)
@@ -2063,6 +2088,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
(IAVF_NUM_MACADDR_MAX * sizeof(struct virtchnl_ether_addr))];
struct virtchnl_ether_addr_list *list;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint32_t i;
int err;
@@ -2089,8 +2115,8 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
args.in_args = cmd_buffer;
args.in_args_size = sizeof(struct virtchnl_ether_addr_list) +
i * sizeof(struct virtchnl_ether_addr);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2110,6 +2136,7 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vf_res_request vfres;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint16_t num_queue_pairs;
int err;
int i = 0;
@@ -2129,8 +2156,8 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
args.ops = VIRTCHNL_OP_REQUEST_QUEUES;
args.in_args = (u8 *)&vfres;
args.in_args_size = sizeof(vfres);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
@@ -2173,14 +2200,15 @@ iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint16_t qregion_width;
int err;
args.ops = VIRTCHNL_OP_GET_MAX_RSS_QREGION;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2203,15 +2231,15 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
uint8_t *msg, size_t msg_len,
uint8_t *resp_msg, size_t resp_msg_len)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
args.ops = VIRTCHNL_OP_INLINE_IPSEC_CRYPTO;
args.in_args = msg;
args.in_args_size = msg_len;
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 1);
if (err) {
@@ -2228,9 +2256,9 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
int
iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 num_queues)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct iavf_cmd_info args;
struct virtchnl_quanta_cfg q_quanta;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
if (adapter->devargs.quanta_size == 0)
@@ -2244,8 +2272,8 @@ iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 nu
args.ops = VIRTCHNL_OP_CONFIG_QUANTA;
args.in_args = (uint8_t *)&q_quanta;
args.in_args_size = sizeof(q_quanta);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2262,6 +2290,7 @@ iavf_get_ptp_cap(struct iavf_adapter *adapter)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_ptp_caps ptp_caps;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err;
ptp_caps.caps = VIRTCHNL_1588_PTP_CAP_RX_TSTAMP |
@@ -2270,8 +2299,8 @@ iavf_get_ptp_cap(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_1588_PTP_GET_CAPS;
args.in_args = (uint8_t *)&ptp_caps;
args.in_args_size = sizeof(ptp_caps);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
@@ -2292,13 +2321,14 @@ iavf_get_phc_time(struct ci_rx_queue *rxq)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_phc_time phc_time;
struct iavf_cmd_info args;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
int err = 0;
args.ops = VIRTCHNL_OP_1588_PTP_GET_TIME;
args.in_args = (uint8_t *)&phc_time;
args.in_args_size = sizeof(phc_time);
- args.out_buffer = vf->aq_resp;
- args.out_size = IAVF_AQ_BUF_SZ;
+ args.out_buffer = msg_buf;
+ args.out_size = sizeof(msg_buf);
rte_spinlock_lock(&vf->phc_time_aq_lock);
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v2 1/1] net/iavf: remove global adminq response buffer
2026-02-26 10:41 ` [PATCH v2 " Anatoly Burakov
@ 2026-02-26 10:52 ` Burakov, Anatoly
2026-02-27 10:58 ` Bruce Richardson
1 sibling, 0 replies; 23+ messages in thread
From: Burakov, Anatoly @ 2026-02-26 10:52 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
On 2/26/2026 11:41 AM, Anatoly Burakov wrote:
> In many places where we are calling down into virtchnl, we are using a
> globally allocated adminq response buffer. This is unnecessary, so replace
> with adminq buffers allocated on stack.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Changes from v1:
Stats query was passing in a pointer-to-pointer and storing pointer to
global adminq response buffer as output parameter, so changing that to a
local buffer resulted in storing a pointer to a buffer that was stack
allocated (i.e. introduced a use-after-free).
I've changed that to allocate the stats structure on the stack and write
into that, instead of returning a pointer to output buffer and reading
from it.
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 1/1] net/iavf: remove global adminq response buffer
2026-02-26 10:41 ` [PATCH v2 " Anatoly Burakov
2026-02-26 10:52 ` Burakov, Anatoly
@ 2026-02-27 10:58 ` Bruce Richardson
2026-03-03 8:52 ` Bruce Richardson
1 sibling, 1 reply; 23+ messages in thread
From: Bruce Richardson @ 2026-02-27 10:58 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Thu, Feb 26, 2026 at 10:41:02AM +0000, Anatoly Burakov wrote:
> In many places where we are calling down into virtchnl, we are using a
> globally allocated adminq response buffer. This is unnecessary, so replace
> with adminq buffers allocated on stack.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied to dpdk-next-net-intel.
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 1/1] net/iavf: remove global adminq response buffer
2026-02-27 10:58 ` Bruce Richardson
@ 2026-03-03 8:52 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-03-03 8:52 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Feb 27, 2026 at 10:58:41AM +0000, Bruce Richardson wrote:
> On Thu, Feb 26, 2026 at 10:41:02AM +0000, Anatoly Burakov wrote:
> > In many places where we are calling down into virtchnl, we are using a
> > globally allocated adminq response buffer. This is unnecessary, so replace
> > with adminq buffers allocated on stack.
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
> Applied to dpdk-next-net-intel.
I've actually removed this patch from next-net-intel as we are seeing
failures in Intel CI on next-net-intel branch and this patch has been
identified as the culprit. Please investigate and resubmit a new patch for
26.07.
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF
2026-02-25 12:09 [PATCH v1 1/1] net/iavf: remove global adminq response buffer Anatoly Burakov
2026-02-26 10:41 ` [PATCH v2 " Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-03-06 10:58 ` [PATCH v3 1/8] net/iavf: avoid passing around pointers Anatoly Burakov
` (8 more replies)
1 sibling, 9 replies; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev
In many places where we are calling down into virtchnl, we are using a
globally allocated adminq response buffer. This is unnecessary, so replace
with adminq buffers allocated on stack. However, because IAVF virtchnl
message queue works asynchronously in most cases, we can't remove the
global buffer entirely, and we need to do some cleanup and refactoring to
be able to reduce our usage of these buffers. This patchset does that.
v1 -> v2:
- Stats query was passing in a pointer-to-pointer and storing pointer to
global adminq response buffer as output parameter, so changing that to a
local buffer resulted in storing a pointer to a buffer that was stack
allocated (i.e. introduced a use-after-free).
v2 -> v3:
- Reworked the virtchnl message handling to not rely on implicit behavior
- Split up into 8 patches for easy review
Anatoly Burakov (8):
net/iavf: avoid passing around pointers
net/iavf: add a variable for hena
net/iavf: add virtchnl interrupt enable flag
net/iavf: rework "async" virtchnl requests
net/iavf: refactor sending virtchnl messages
net/iavf: respect output buffer in virtchnl
net/iavf: do not use global virtchnl buffer
net/iavf: embed virtchnl response buffer
drivers/net/intel/iavf/iavf.h | 58 +---
drivers/net/intel/iavf/iavf_ethdev.c | 50 ++-
drivers/net/intel/iavf/iavf_vchnl.c | 483 ++++++++++++++++-----------
3 files changed, 304 insertions(+), 287 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v3 1/8] net/iavf: avoid passing around pointers
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 10:37 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 2/8] net/iavf: add a variable for hena Anatoly Burakov
` (7 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
Currently, when querying the stats for IAVF, we pass a pointer-to-pointer
and then use it as an input for another function. It does not really need
to be a pointer because it is populated from virtchnl command response
anyway. Replace it with passing in a stack-allocated struct, and pass it
into the stats query function.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf.h | 2 +-
drivers/net/intel/iavf/iavf_ethdev.c | 34 ++++++++++++++--------------
drivers/net/intel/iavf/iavf_vchnl.c | 5 ++--
3 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index 403c61e2e8..b2389e0bbd 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -518,7 +518,7 @@ int iavf_dev_link_update(struct rte_eth_dev *dev,
__rte_unused int wait_to_complete);
void iavf_dev_alarm_handler(void *param);
int iavf_query_stats(struct iavf_adapter *adapter,
- struct virtchnl_eth_stats **pstats);
+ struct virtchnl_eth_stats *pstats);
int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast,
bool enable_multicast);
int iavf_add_del_eth_addr(struct iavf_adapter *adapter,
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 1eca20bc9a..e3690cce11 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -1793,7 +1793,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_vsi *vsi = &vf->vsi;
- struct virtchnl_eth_stats *pstats = NULL;
+ struct virtchnl_eth_stats pstats;
int ret;
ret = iavf_query_stats(adapter, &pstats);
@@ -1801,16 +1801,16 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
RTE_ETHER_CRC_LEN;
- iavf_update_stats(vsi, pstats);
- stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
- pstats->rx_broadcast - pstats->rx_discards;
- stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
- pstats->tx_unicast;
- stats->imissed = pstats->rx_discards;
- stats->oerrors = pstats->tx_errors + pstats->tx_discards;
- stats->ibytes = pstats->rx_bytes;
+ iavf_update_stats(vsi, &pstats);
+ stats->ipackets = pstats.rx_unicast + pstats.rx_multicast +
+ pstats.rx_broadcast - pstats.rx_discards;
+ stats->opackets = pstats.tx_broadcast + pstats.tx_multicast +
+ pstats.tx_unicast;
+ stats->imissed = pstats.rx_discards;
+ stats->oerrors = pstats.tx_errors + pstats.tx_discards;
+ stats->ibytes = pstats.rx_bytes;
stats->ibytes -= stats->ipackets * crc_stats_len;
- stats->obytes = pstats->tx_bytes;
+ stats->obytes = pstats.tx_bytes;
} else {
PMD_DRV_LOG(ERR, "Get statistics failed");
}
@@ -1825,15 +1825,15 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_vsi *vsi = &vf->vsi;
- struct virtchnl_eth_stats *pstats = NULL;
+ struct virtchnl_eth_stats stats;
/* read stat values to clear hardware registers */
- ret = iavf_query_stats(adapter, &pstats);
+ ret = iavf_query_stats(adapter, &stats);
if (ret != 0)
return ret;
/* set stats offset base on current values */
- vsi->eth_stats_offset.eth_stats = *pstats;
+ vsi->eth_stats_offset.eth_stats = stats;
return 0;
}
@@ -1909,21 +1909,21 @@ static int iavf_dev_xstats_get(struct rte_eth_dev *dev,
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
struct iavf_vsi *vsi = &vf->vsi;
- struct virtchnl_eth_stats *pstats = NULL;
+ struct virtchnl_eth_stats stats;
struct iavf_eth_xstats iavf_xtats = {{0}};
if (n < IAVF_NB_XSTATS)
return IAVF_NB_XSTATS;
- ret = iavf_query_stats(adapter, &pstats);
+ ret = iavf_query_stats(adapter, &stats);
if (ret != 0)
return 0;
if (!xstats)
return 0;
- iavf_update_stats(vsi, pstats);
- iavf_xtats.eth_stats = *pstats;
+ iavf_update_stats(vsi, &stats);
+ iavf_xtats.eth_stats = stats;
if (iavf_ipsec_crypto_supported(adapter))
iavf_dev_update_ipsec_xstats(dev, &iavf_xtats.ips_stats);
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index 08dd6f2d7f..a1dc573841 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -1483,7 +1483,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
int
iavf_query_stats(struct iavf_adapter *adapter,
- struct virtchnl_eth_stats **pstats)
+ struct virtchnl_eth_stats *pstats)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select q_stats;
@@ -1504,10 +1504,9 @@ iavf_query_stats(struct iavf_adapter *adapter,
err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
- *pstats = NULL;
return err;
}
- *pstats = (struct virtchnl_eth_stats *)args.out_buffer;
+ *pstats = *(struct virtchnl_eth_stats *)args.out_buffer;
return 0;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 2/8] net/iavf: add a variable for hena
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
2026-03-06 10:58 ` [PATCH v3 1/8] net/iavf: avoid passing around pointers Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 10:39 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 3/8] net/iavf: add virtchnl interrupt enable flag Anatoly Burakov
` (6 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
Currently, we read RSS hena value directly from output buffer using an in
place pointer cast. Use a variable instead.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf_vchnl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index a1dc573841..d97bdf0dc1 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -1933,6 +1933,7 @@ int
iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ struct virtchnl_rss_hena *hena;
struct iavf_cmd_info args;
int err;
@@ -1949,7 +1950,8 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
return err;
}
- *caps = ((struct virtchnl_rss_hena *)args.out_buffer)->hena;
+ hena = (struct virtchnl_rss_hena *)args.out_buffer;
+ *caps = hena->hena;
return 0;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 3/8] net/iavf: add virtchnl interrupt enable flag
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
2026-03-06 10:58 ` [PATCH v3 1/8] net/iavf: avoid passing around pointers Anatoly Burakov
2026-03-06 10:58 ` [PATCH v3 2/8] net/iavf: add a variable for hena Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 10:42 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 4/8] net/iavf: rework "async" virtchnl requests Anatoly Burakov
` (5 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
For some functionality, we will need to know if the virtchnl message queue
interrupts are enabled (i.e. if the new virtchnl messages will be delivered
into an interrupt thread as opposed to having to directly poll the queue).
Add such flag and track its status during init/close.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf.h | 1 +
drivers/net/intel/iavf/iavf_ethdev.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index b2389e0bbd..cf98d12247 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -243,6 +243,7 @@ struct iavf_info {
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 */
+ bool aq_intr_enabled;
/** iAVF watchdog enable */
bool watchdog_enabled;
diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index e3690cce11..9fdebec0f4 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -2853,6 +2853,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
/* configure and enable device interrupt */
iavf_enable_irq0(hw);
+ vf->aq_intr_enabled = true;
ret = iavf_flow_init(adapter);
if (ret) {
@@ -2900,6 +2901,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
iavf_security_ctx_destroy(adapter);
flow_init_err:
+ vf->aq_intr_enabled = false;
iavf_disable_irq0(hw);
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
@@ -2975,6 +2977,7 @@ iavf_dev_close(struct rte_eth_dev *dev)
iavf_config_promisc(adapter, false, false);
iavf_vf_reset(hw);
+ vf->aq_intr_enabled = false;
iavf_shutdown_adminq(hw);
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
/* disable uio intr before callback unregister */
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 4/8] net/iavf: rework "async" virtchnl requests
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
` (2 preceding siblings ...)
2026-03-06 10:58 ` [PATCH v3 3/8] net/iavf: add virtchnl interrupt enable flag Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 10:52 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 5/8] net/iavf: refactor sending virtchnl messages Anatoly Burakov
` (4 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
Currently, IPsec crypto requests are called with `async` parameter set to 1
on account of these requests generating two virtchnl responses instead of
having just one, like all other requests.
However, this terminology is misleading, because in actuality *almost all*
virtchnl requests are asynchronously implemented; that is, almost all of
them will send a request into virtchnl command queue, and then expect to
receive a virtchnl response in an interrupt thread, which will update the
global "pending command" status and write into the global response buffer,
while the pending request will simply check pending command status on a
timer. So, for almost all requests, the command status is updated
asynchronously. The only times this *doesn't* happen is 1) when the
request is sent from an interrupt thread context, or 2) when the requests
are sent at init time and the interrupt thread isn't active yet. In both
of those cases we directly poll the virtchnl queue for responses.
To make things a little less confusing, remove the usage of "asynchronous"
terminology across all callsites, and instead make it explicit that what
we're actually interested in is the number of responses we are waiting for,
and whether the thread is meant to directly poll the message queue or wait
for interrupt thread to update command status, not whether the requests
are "asynchronous". We also make it an implementation detail, not part of
the API for executing VF commands.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf.h | 53 --------
drivers/net/intel/iavf/iavf_vchnl.c | 187 ++++++++++++++++++----------
2 files changed, 121 insertions(+), 119 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
index cf98d12247..440376c4ca 100644
--- a/drivers/net/intel/iavf/iavf.h
+++ b/drivers/net/intel/iavf/iavf.h
@@ -432,59 +432,6 @@ struct iavf_cmd_info {
uint32_t out_size; /* buffer size for response */
};
-/* notify current command done. Only call in case execute
- * _atomic_set_cmd successfully.
- */
-static inline void
-_notify_cmd(struct iavf_info *vf, int msg_ret)
-{
- vf->cmd_retval = msg_ret;
- rte_wmb();
- vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
-}
-
-/* clear current command. Only call in case execute
- * _atomic_set_cmd successfully.
- */
-static inline void
-_clear_cmd(struct iavf_info *vf)
-{
- rte_wmb();
- vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
- vf->cmd_retval = VIRTCHNL_STATUS_SUCCESS;
-}
-
-/* Check there is pending cmd in execution. If none, set new command. */
-static inline int
-_atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
-{
- enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
- int ret = rte_atomic_compare_exchange_strong_explicit(&vf->pend_cmd, &op_unk, ops,
- rte_memory_order_acquire, rte_memory_order_acquire);
-
- if (!ret)
- PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
-
- rte_atomic_store_explicit(&vf->pend_cmd_count, 1, rte_memory_order_relaxed);
-
- return !ret;
-}
-
-/* Check there is pending cmd in execution. If none, set new command. */
-static inline int
-_atomic_set_async_response_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
-{
- enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
- int ret = rte_atomic_compare_exchange_strong_explicit(&vf->pend_cmd, &op_unk, ops,
- rte_memory_order_acquire, rte_memory_order_acquire);
-
- if (!ret)
- PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
-
- rte_atomic_store_explicit(&vf->pend_cmd_count, 2, rte_memory_order_relaxed);
-
- return !ret;
-}
int iavf_check_api_version(struct iavf_adapter *adapter);
int iavf_get_vf_resource(struct iavf_adapter *adapter);
void iavf_dev_event_post(struct rte_eth_dev *dev,
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index d97bdf0dc1..d240745f5c 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -309,42 +309,97 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
}
static int
-iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
- int async)
+iavf_set_pending_cmd(struct iavf_info *vf, enum virtchnl_ops ops,
+ uint32_t resp_count)
+{
+ enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
+ int ret = rte_atomic_compare_exchange_strong_explicit(&vf->pend_cmd,
+ &op_unk, ops, rte_memory_order_acquire,
+ rte_memory_order_acquire);
+
+ if (ret == 0) {
+ PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
+ return -1;
+ }
+
+ rte_atomic_store_explicit(&vf->pend_cmd_count, resp_count,
+ rte_memory_order_relaxed);
+
+ return 0;
+}
+
+static inline void
+iavf_clear_pending_cmd(struct iavf_info *vf)
+{
+ rte_wmb();
+ vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
+ vf->cmd_retval = VIRTCHNL_STATUS_SUCCESS;
+}
+
+static inline void
+iavf_notify_pending_cmd(struct iavf_info *vf, int msg_ret)
+{
+ vf->cmd_retval = msg_ret;
+ rte_wmb();
+ vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
+}
+
+static int
+iavf_get_cmd_resp_count(enum virtchnl_ops op)
+{
+ switch (op) {
+ case VIRTCHNL_OP_RESET_VF:
+ case VIRTCHNL_OP_REQUEST_QUEUES:
+ /* These commands trigger reset and are not waited for */
+ return 0;
+ case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO:
+ /* IPsec crypto commands generate two responses */
+ return 2;
+ default:
+ /* All other commands generate one response */
+ return 1;
+ }
+}
+
+static int
+iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)
{
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
enum iavf_aq_result result;
enum iavf_status ret;
+ uint32_t resp_count;
int err = 0;
int i = 0;
if (vf->vf_reset)
return -EIO;
+ resp_count = iavf_get_cmd_resp_count(args->ops);
- if (async) {
- if (_atomic_set_async_response_cmd(vf, args->ops))
- return -1;
- } else {
- if (_atomic_set_cmd(vf, args->ops))
- return -1;
- }
+ /*
+ * For some commands, we are not waiting for responses because they
+ * produce a reset event. However, we still need to set pending command
+ * to avoid sending commands while another one is already in progress.
+ */
+ if (iavf_set_pending_cmd(vf, args->ops, RTE_MAX(1U, resp_count)))
+ return -1;
ret = iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS,
args->in_args, args->in_args_size, NULL);
if (ret) {
PMD_DRV_LOG(ERR, "fail to send cmd %d", args->ops);
- _clear_cmd(vf);
+ iavf_clear_pending_cmd(vf);
return err;
}
+ if (resp_count == 0) {
+ /* reset pending commands, counter will be overwritten on reset */
+ iavf_clear_pending_cmd(vf);
+ return 0;
+ }
+
switch (args->ops) {
- case VIRTCHNL_OP_RESET_VF:
- case VIRTCHNL_OP_REQUEST_QUEUES:
- /*no need to wait for response */
- _clear_cmd(vf);
- break;
case VIRTCHNL_OP_VERSION:
case VIRTCHNL_OP_GET_VF_RESOURCES:
case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
@@ -363,7 +418,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
PMD_DRV_LOG(ERR, "No response or return failure (%d)"
" for cmd %d", vf->cmd_retval, args->ops);
}
- _clear_cmd(vf);
+ iavf_clear_pending_cmd(vf);
break;
default:
if (rte_thread_is_intr()) {
@@ -383,7 +438,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
PMD_DRV_LOG(ERR, "No response or return failure (%d)"
" for cmd %d", vf->cmd_retval, args->ops);
}
- _clear_cmd(vf);
+ iavf_clear_pending_cmd(vf);
} else {
/* For other virtchnl ops in running time,
* wait for the cmd done flag.
@@ -397,7 +452,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
if (i >= MAX_TRY_TIMES) {
PMD_DRV_LOG(ERR, "No response for cmd %d", args->ops);
- _clear_cmd(vf);
+ iavf_clear_pending_cmd(vf);
err = -EIO;
} else if (vf->cmd_retval ==
VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
@@ -417,7 +472,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
static int
iavf_execute_vf_cmd_safe(struct iavf_adapter *adapter,
- struct iavf_cmd_info *args, int async)
+ struct iavf_cmd_info *args)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
int ret;
@@ -429,7 +484,7 @@ iavf_execute_vf_cmd_safe(struct iavf_adapter *adapter,
} else {
rte_spinlock_lock(&vf->aq_lock);
}
- ret = iavf_execute_vf_cmd(adapter, args, async);
+ ret = iavf_execute_vf_cmd(adapter, args);
rte_spinlock_unlock(&vf->aq_lock);
return ret;
@@ -577,7 +632,7 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
rte_atomic_fetch_sub_explicit(&vf->pend_cmd_count,
1, rte_memory_order_relaxed) - 1;
if (cmd_count == 0)
- _notify_cmd(vf, msg_ret);
+ iavf_notify_pending_cmd(vf, msg_ret);
} else {
PMD_DRV_LOG(ERR,
"command mismatch, expect %u, get %u",
@@ -609,7 +664,7 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
args.in_args_size = 0;
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
PMD_DRV_LOG(ERR, "Failed to execute command of"
" OP_ENABLE_VLAN_STRIPPING");
@@ -630,7 +685,7 @@ iavf_disable_vlan_strip(struct iavf_adapter *adapter)
args.in_args_size = 0;
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
PMD_DRV_LOG(ERR, "Failed to execute command of"
" OP_DISABLE_VLAN_STRIPPING");
@@ -659,7 +714,7 @@ iavf_check_api_version(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_INIT_LOG(ERR, "Fail to execute command of OP_VERSION");
return err;
@@ -721,7 +776,7 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
args.in_args = (uint8_t *)∩︀
args.in_args_size = sizeof(caps);
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
@@ -766,7 +821,7 @@ iavf_get_supported_rxdid(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret) {
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_GET_SUPPORTED_RXDIDS");
@@ -810,7 +865,7 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
args.in_args_size = sizeof(vlan_strip);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
PMD_DRV_LOG(ERR, "fail to execute command %s",
enable ? "VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2" :
@@ -850,7 +905,7 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
args.in_args_size = sizeof(vlan_insert);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
PMD_DRV_LOG(ERR, "fail to execute command %s",
enable ? "VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2" :
@@ -893,7 +948,7 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.in_args_size = sizeof(vlan_filter);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
add ? "OP_ADD_VLAN_V2" : "OP_DEL_VLAN_V2");
@@ -914,7 +969,7 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- ret = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret) {
PMD_DRV_LOG(ERR,
"Failed to execute command of VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS");
@@ -945,7 +1000,7 @@ iavf_enable_queues(struct iavf_adapter *adapter)
args.in_args_size = sizeof(queue_select);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_ENABLE_QUEUES");
@@ -973,7 +1028,7 @@ iavf_disable_queues(struct iavf_adapter *adapter)
args.in_args_size = sizeof(queue_select);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_DISABLE_QUEUES");
@@ -1009,7 +1064,7 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
args.in_args_size = sizeof(queue_select);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of %s",
on ? "OP_ENABLE_QUEUES" : "OP_DISABLE_QUEUES");
@@ -1047,7 +1102,7 @@ iavf_enable_queues_lv(struct iavf_adapter *adapter)
args.in_args_size = sizeof(queue_req);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_ENABLE_QUEUES_V2");
@@ -1086,7 +1141,7 @@ iavf_disable_queues_lv(struct iavf_adapter *adapter)
args.in_args_size = sizeof(queue_req);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_DISABLE_QUEUES_V2");
@@ -1128,7 +1183,7 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
args.in_args_size = sizeof(queue_req);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of %s",
on ? "OP_ENABLE_QUEUES_V2" : "OP_DISABLE_QUEUES_V2");
@@ -1159,7 +1214,7 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_CONFIG_RSS_LUT");
@@ -1191,7 +1246,7 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_CONFIG_RSS_KEY");
@@ -1287,7 +1342,7 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command VIRTCHNL_OP_CONFIG_VSI_QUEUES");
return err;
@@ -1370,7 +1425,7 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
args.in_args_size = buf_len;
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command OP_CONFIG_IRQ_MAP");
@@ -1416,7 +1471,7 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- return iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ return iavf_execute_vf_cmd_safe(adapter, &args);
}
int
@@ -1475,7 +1530,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
args.in_args_size = buf_len;
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
add ? "OP_ADD_ETHER_ADDRESS" : "OP_DEL_ETHER_ADDRESS");
@@ -1501,7 +1556,7 @@ iavf_query_stats(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command OP_GET_STATS");
return err;
@@ -1538,7 +1593,7 @@ iavf_config_promisc(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
@@ -1581,7 +1636,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
args.in_args_size = sizeof(cmd_buffer);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
add ? "OP_ADD_ETH_ADDR" : "OP_DEL_ETH_ADDR");
@@ -1608,7 +1663,7 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.in_args_size = sizeof(cmd_buffer);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "fail to execute command %s",
add ? "OP_ADD_VLAN" : "OP_DEL_VLAN");
@@ -1635,7 +1690,7 @@ iavf_fdir_add(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command OP_ADD_FDIR_FILTER");
return err;
@@ -1695,7 +1750,7 @@ iavf_fdir_del(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command OP_DEL_FDIR_FILTER");
return err;
@@ -1742,7 +1797,7 @@ iavf_fdir_check(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "fail to check flow director rule");
return err;
@@ -1785,7 +1840,7 @@ iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "Failed to execute command of "
"OP_FLOW_SUBSCRIBE");
@@ -1836,7 +1891,7 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "Failed to execute command of "
"OP_FLOW_UNSUBSCRIBE");
@@ -1879,7 +1934,7 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "Failed to check flow subscription rule");
return err;
@@ -1919,7 +1974,7 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR,
"Failed to execute command of %s",
@@ -1943,7 +1998,7 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_GET_RSS_HENA_CAPS");
@@ -1970,7 +2025,7 @@ iavf_set_hena(struct iavf_adapter *adapter, uint64_t hena)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_SET_RSS_HENA");
@@ -1991,7 +2046,7 @@ iavf_get_qos_cap(struct iavf_adapter *adapter)
args.in_args_size = 0;
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
@@ -2024,7 +2079,7 @@ int iavf_set_q_tc_map(struct rte_eth_dev *dev,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of"
" VIRTCHNL_OP_CONFIG_TC_MAP");
@@ -2047,7 +2102,7 @@ int iavf_set_q_bw(struct rte_eth_dev *dev,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
PMD_DRV_LOG(ERR, "Failed to execute command of"
" VIRTCHNL_OP_CONFIG_QUEUE_BW");
@@ -2092,7 +2147,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
i * sizeof(struct virtchnl_ether_addr);
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command %s",
@@ -2134,10 +2189,10 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
args.out_size = IAVF_AQ_BUF_SZ;
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
} else {
rte_eal_alarm_cancel(iavf_dev_alarm_handler, dev);
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
rte_eal_alarm_set(IAVF_ALARM_INTERVAL,
iavf_dev_alarm_handler, dev);
}
@@ -2183,7 +2238,7 @@ iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "Failed to execute command of VIRTCHNL_OP_GET_MAX_RSS_QREGION");
return err;
@@ -2214,7 +2269,7 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 1);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "fail to execute command %s",
"OP_INLINE_IPSEC_CRYPTO");
@@ -2248,7 +2303,7 @@ iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 nu
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR, "Failed to execute command VIRTCHNL_OP_CONFIG_QUANTA");
return err;
@@ -2274,7 +2329,7 @@ iavf_get_ptp_cap(struct iavf_adapter *adapter)
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
"Failed to execute command of OP_1588_PTP_GET_CAPS");
@@ -2302,7 +2357,7 @@ iavf_get_phc_time(struct ci_rx_queue *rxq)
args.out_size = IAVF_AQ_BUF_SZ;
rte_spinlock_lock(&vf->phc_time_aq_lock);
- err = iavf_execute_vf_cmd_safe(adapter, &args, 0);
+ err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
PMD_DRV_LOG(ERR,
"Failed to execute command of VIRTCHNL_OP_1588_PTP_GET_TIME");
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 5/8] net/iavf: refactor sending virtchnl messages
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
` (3 preceding siblings ...)
2026-03-06 10:58 ` [PATCH v3 4/8] net/iavf: rework "async" virtchnl requests Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 10:55 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 6/8] net/iavf: respect output buffer in virtchnl Anatoly Burakov
` (3 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
Currently, there is a certain amount of duplication and unnecessary
branching in the virtchnl message handling function which makes it
difficult to read and reason about.
Refactor the function to achieve the following:
- clean and explicit distinction between synchronous and asynchronous ops
- common looping and error handling logic
- fewer and clearer special cases
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf_vchnl.c | 151 +++++++++++++---------------
1 file changed, 70 insertions(+), 81 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index d240745f5c..3f6ce0dd89 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -361,16 +361,66 @@ iavf_get_cmd_resp_count(enum virtchnl_ops op)
}
}
+static int
+iavf_op_needs_poll(struct iavf_info *vf)
+{
+ /* Poll if interrupts disabled or we are in interrupt thread */
+ return !vf->aq_intr_enabled || rte_thread_is_intr();
+}
+
+static int
+iavf_wait_for_msg(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
+ bool poll)
+{
+ struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ int err = 0;
+ int i = 0;
+
+ if (args->out_buffer == NULL) {
+ PMD_DRV_LOG(ERR, "Invalid buffer for cmd %d response", args->ops);
+ return -EINVAL;
+ }
+
+ /* Wait for command completion */
+ do {
+ if (poll) {
+ enum iavf_aq_result result;
+ result = iavf_read_msg_from_pf(adapter, args->out_size,
+ args->out_buffer);
+ if (result == IAVF_MSG_CMD)
+ break;
+ } else {
+ /* check if interrupt thread has erased pending cmd */
+ if (vf->pend_cmd == VIRTCHNL_OP_UNKNOWN)
+ break;
+ }
+ iavf_msec_delay(ASQ_DELAY_MS);
+ } while (i++ < MAX_TRY_TIMES);
+
+ if (i >= MAX_TRY_TIMES) {
+ PMD_DRV_LOG(ERR, "No response for cmd %d", args->ops);
+ err = -EIO;
+ } else if (vf->cmd_retval == VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
+ PMD_DRV_LOG(ERR, "Cmd %d not supported", args->ops);
+ err = -ENOTSUP;
+ } else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
+ PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
+ vf->cmd_retval, args->ops);
+ err = -EINVAL;
+ }
+
+ return err;
+}
+
static int
iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)
{
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
- enum iavf_aq_result result;
- enum iavf_status ret;
+ enum iavf_status status;
uint32_t resp_count;
- int err = 0;
- int i = 0;
+ bool poll = iavf_op_needs_poll(vf);
+ int err;
if (vf->vf_reset)
return -EIO;
@@ -385,89 +435,28 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)
if (iavf_set_pending_cmd(vf, args->ops, RTE_MAX(1U, resp_count)))
return -1;
- ret = iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS,
- args->in_args, args->in_args_size, NULL);
- if (ret) {
+ status = iavf_aq_send_msg_to_pf(hw, args->ops, IAVF_SUCCESS,
+ args->in_args, args->in_args_size, NULL);
+ if (status != IAVF_SUCCESS) {
PMD_DRV_LOG(ERR, "fail to send cmd %d", args->ops);
- iavf_clear_pending_cmd(vf);
- return err;
+ err = (int)status;
+ goto clear_cmd;
+ } else if (resp_count == 0) {
+ /* we're not waiting on responses */
+ err = 0;
+ goto clear_cmd;
}
- if (resp_count == 0) {
- /* reset pending commands, counter will be overwritten on reset */
- iavf_clear_pending_cmd(vf);
- return 0;
- }
-
- switch (args->ops) {
- case VIRTCHNL_OP_VERSION:
- case VIRTCHNL_OP_GET_VF_RESOURCES:
- case VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:
- case VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS:
- /* for init virtchnl ops, need to poll the response */
- do {
- result = iavf_read_msg_from_pf(adapter, args->out_size,
- args->out_buffer);
- if (result == IAVF_MSG_CMD)
- break;
- iavf_msec_delay(ASQ_DELAY_MS);
- } while (i++ < MAX_TRY_TIMES);
- if (i >= MAX_TRY_TIMES ||
- vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
- err = -1;
- PMD_DRV_LOG(ERR, "No response or return failure (%d)"
- " for cmd %d", vf->cmd_retval, args->ops);
- }
- iavf_clear_pending_cmd(vf);
- break;
- default:
- if (rte_thread_is_intr()) {
- /* For virtchnl ops were executed in eal_intr_thread,
- * need to poll the response.
- */
- do {
- result = iavf_read_msg_from_pf(adapter, args->out_size,
- args->out_buffer);
- if (result == IAVF_MSG_CMD)
- break;
- iavf_msec_delay(ASQ_DELAY_MS);
- } while (i++ < MAX_TRY_TIMES);
- if (i >= MAX_TRY_TIMES ||
- vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
- err = -1;
- PMD_DRV_LOG(ERR, "No response or return failure (%d)"
- " for cmd %d", vf->cmd_retval, args->ops);
- }
- iavf_clear_pending_cmd(vf);
- } else {
- /* For other virtchnl ops in running time,
- * wait for the cmd done flag.
- */
- do {
- if (vf->pend_cmd == VIRTCHNL_OP_UNKNOWN)
- break;
- iavf_msec_delay(ASQ_DELAY_MS);
- /* If don't read msg or read sys event, continue */
- } while (i++ < MAX_TRY_TIMES);
+ err = iavf_wait_for_msg(adapter, args, poll);
- if (i >= MAX_TRY_TIMES) {
- PMD_DRV_LOG(ERR, "No response for cmd %d", args->ops);
- iavf_clear_pending_cmd(vf);
- err = -EIO;
- } else if (vf->cmd_retval ==
- VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) {
- PMD_DRV_LOG(ERR, "Cmd %d not supported", args->ops);
- err = -ENOTSUP;
- } else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) {
- PMD_DRV_LOG(ERR, "Return failure %d for cmd %d",
- vf->cmd_retval, args->ops);
- err = -EINVAL;
- }
- }
- break;
- }
+ /* in interrupt success case, pending cmd is cleared by intr thread */
+ if (err != 0 || poll)
+ goto clear_cmd;
return err;
+clear_cmd:
+ iavf_clear_pending_cmd(vf);
+ return err;
}
static int
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 6/8] net/iavf: respect output buffer in virtchnl
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
` (4 preceding siblings ...)
2026-03-06 10:58 ` [PATCH v3 5/8] net/iavf: refactor sending virtchnl messages Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 11:08 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 7/8] net/iavf: do not use global virtchnl buffer Anatoly Burakov
` (2 subsequent siblings)
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
Currently, in asynchronous case for virtchnl messages, we only store the
command response data inside the global buffer. This is correct, because we
populate the response in a different thread from the caller context, but
this results in caller's `out_buffer` value being ignored. Correct it by
populating caller's response buffer with data from response even in cases
where the messages arrive asynchronously.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf_vchnl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index 3f6ce0dd89..250816c24a 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -449,6 +449,13 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)
err = iavf_wait_for_msg(adapter, args, poll);
+ /*
+ * messages received through interrupts store their response in global
+ * buffer, so we need to copy it if we received the message.
+ */
+ if (!poll && err == 0)
+ memcpy(args->out_buffer, vf->aq_resp, args->out_size);
+
/* in interrupt success case, pending cmd is cleared by intr thread */
if (err != 0 || poll)
goto clear_cmd;
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 7/8] net/iavf: do not use global virtchnl buffer
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
` (5 preceding siblings ...)
2026-03-06 10:58 ` [PATCH v3 6/8] net/iavf: respect output buffer in virtchnl Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 11:10 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 8/8] net/iavf: embed virtchnl response buffer Anatoly Burakov
2026-04-03 13:13 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Bruce Richardson
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
Currently, a lot of virtchnl requests will use global virtchnl output
buffer as their `out_buffer` for VF requests. This was originally done this
way because most requests were done asynchronously and the response was not
written directly into the `out_buffer`. This is no longer the case, so the
per-command buffers can be safely replaced with stack allocated buffers.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/iavf/iavf_vchnl.c | 147 +++++++++++++++++-----------
1 file changed, 89 insertions(+), 58 deletions(-)
diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
index 250816c24a..1e98503b31 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -650,7 +650,7 @@ iavf_handle_virtchnl_msg(struct rte_eth_dev *dev)
int
iavf_enable_vlan_strip(struct iavf_adapter *adapter)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int ret;
@@ -658,7 +658,7 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_VLAN_STRIPPING;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
@@ -671,7 +671,7 @@ iavf_enable_vlan_strip(struct iavf_adapter *adapter)
int
iavf_disable_vlan_strip(struct iavf_adapter *adapter)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int ret;
@@ -679,7 +679,7 @@ iavf_disable_vlan_strip(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_VLAN_STRIPPING;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
@@ -698,6 +698,7 @@ iavf_check_api_version(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_version_info version, *pver;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -707,7 +708,7 @@ iavf_check_api_version(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_VERSION;
args.in_args = (uint8_t *)&version;
args.in_args_size = sizeof(version);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -747,12 +748,13 @@ iavf_get_vf_resource(struct iavf_adapter *adapter)
{
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t caps, len;
int err, i;
args.ops = VIRTCHNL_OP_GET_VF_RESOURCES;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
caps = IAVF_BASIC_OFFLOAD_CAPS | VIRTCHNL_VF_CAP_ADV_LINK_SPEED |
@@ -808,13 +810,14 @@ int
iavf_get_supported_rxdid(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int ret;
args.ops = VIRTCHNL_OP_GET_SUPPORTED_RXDIDS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
ret = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -836,6 +839,7 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *stripping_caps;
struct virtchnl_vlan_setting vlan_strip;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t *ethertype;
int ret;
@@ -859,7 +863,7 @@ iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable)
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2;
args.in_args = (uint8_t *)&vlan_strip;
args.in_args_size = sizeof(vlan_strip);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
@@ -876,6 +880,7 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *insertion_caps;
struct virtchnl_vlan_setting vlan_insert;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t *ethertype;
int ret;
@@ -899,7 +904,7 @@ iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable)
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2;
args.in_args = (uint8_t *)&vlan_insert;
args.in_args_size = sizeof(vlan_insert);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
ret = iavf_execute_vf_cmd_safe(adapter, &args);
if (ret)
@@ -916,6 +921,7 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_vlan_supported_caps *supported_caps;
struct virtchnl_vlan_filter_list_v2 vlan_filter;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_vlan *vlan_setting;
struct iavf_cmd_info args;
uint32_t filtering_caps;
@@ -942,7 +948,7 @@ iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_VLAN_V2 : VIRTCHNL_OP_DEL_VLAN_V2;
args.in_args = (uint8_t *)&vlan_filter;
args.in_args_size = sizeof(vlan_filter);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -956,13 +962,14 @@ int
iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int ret;
args.ops = VIRTCHNL_OP_GET_OFFLOAD_VLAN_V2_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
ret = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -972,7 +979,7 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter)
return ret;
}
- rte_memcpy(&vf->vlan_v2_caps, vf->aq_resp, sizeof(vf->vlan_v2_caps));
+ rte_memcpy(&vf->vlan_v2_caps, args.out_buffer, sizeof(vf->vlan_v2_caps));
return 0;
}
@@ -982,6 +989,7 @@ iavf_enable_queues(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -994,7 +1002,7 @@ iavf_enable_queues(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
@@ -1010,6 +1018,7 @@ iavf_disable_queues(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1022,7 +1031,7 @@ iavf_disable_queues(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err) {
@@ -1039,6 +1048,7 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_queue_select queue_select;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1058,7 +1068,7 @@ iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
args.ops = VIRTCHNL_OP_DISABLE_QUEUES;
args.in_args = (u8 *)&queue_select;
args.in_args_size = sizeof(queue_select);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1071,6 +1081,7 @@ int
iavf_enable_queues_lv(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct {
struct virtchnl_del_ena_dis_queues msg;
struct virtchnl_queue_chunk chunks[IAVF_RXTX_QUEUE_CHUNKS_NUM - 1];
@@ -1096,7 +1107,7 @@ iavf_enable_queues_lv(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_ENABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1110,6 +1121,7 @@ int
iavf_disable_queues_lv(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct {
struct virtchnl_del_ena_dis_queues msg;
struct virtchnl_queue_chunk chunks[IAVF_RXTX_QUEUE_CHUNKS_NUM - 1];
@@ -1135,7 +1147,7 @@ iavf_disable_queues_lv(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_DISABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1150,6 +1162,7 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
bool rx, bool on)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct {
struct virtchnl_del_ena_dis_queues msg;
} queue_req = {0};
@@ -1177,7 +1190,7 @@ iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
args.ops = VIRTCHNL_OP_DISABLE_QUEUES_V2;
args.in_args = (u8 *)queue_select;
args.in_args_size = sizeof(queue_req);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1191,6 +1204,7 @@ int
iavf_configure_rss_lut(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_rss_lut *rss_lut;
struct iavf_cmd_info args;
int len, err = 0;
@@ -1207,7 +1221,7 @@ iavf_configure_rss_lut(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_RSS_LUT;
args.in_args = (u8 *)rss_lut;
args.in_args_size = len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1223,6 +1237,7 @@ int
iavf_configure_rss_key(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_rss_key *rss_key;
struct iavf_cmd_info args;
int len, err = 0;
@@ -1239,7 +1254,7 @@ iavf_configure_rss_key(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_RSS_KEY;
args.in_args = (u8 *)rss_key;
args.in_args_size = len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1307,6 +1322,7 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
uint16_t chunk_start)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct {
struct virtchnl_vsi_queue_config_info config;
struct virtchnl_queue_pair_info qp[IAVF_CFG_Q_NUM_PER_BUF];
@@ -1335,7 +1351,7 @@ iavf_configure_queue_chunk(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_CONFIG_VSI_QUEUES;
args.in_args = (uint8_t *)vc_config;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1370,6 +1386,7 @@ int
iavf_config_irq_map(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct {
struct virtchnl_irq_map_info map_info;
struct virtchnl_vector_map vecmap[IAVF_MAX_NUM_QUEUES_DFLT];
@@ -1419,7 +1436,7 @@ iavf_config_irq_map(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;
args.in_args = (u8 *)map_info;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1438,6 +1455,7 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
struct virtchnl_queue_vector qv_maps[IAVF_CFG_Q_NUM_PER_BUF];
} chunk_req = {0};
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args = {0};
struct virtchnl_queue_vector_maps *map_info = &chunk_req.map_info;
struct virtchnl_queue_vector *qv_maps = chunk_req.qv_maps;
@@ -1464,7 +1482,7 @@ iavf_config_irq_map_lv_chunk(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_MAP_QUEUE_VECTOR;
args.in_args = (u8 *)map_info;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
return iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1497,6 +1515,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
} list_req = {0};
struct virtchnl_ether_addr_list *list = &list_req.list;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args = {0};
int err, i;
size_t buf_len;
@@ -1524,7 +1543,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR;
args.in_args = (uint8_t *)list;
args.in_args_size = buf_len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1537,6 +1556,7 @@ iavf_query_stats(struct iavf_adapter *adapter,
struct virtchnl_eth_stats *pstats)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_queue_select q_stats;
struct iavf_cmd_info args;
int err;
@@ -1549,7 +1569,7 @@ iavf_query_stats(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_GET_STATS;
args.in_args = (uint8_t *)&q_stats;
args.in_args_size = sizeof(q_stats);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1567,6 +1587,7 @@ iavf_config_promisc(struct iavf_adapter *adapter,
bool enable_multicast)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_promisc_info promisc;
struct iavf_cmd_info args;
int err;
@@ -1586,7 +1607,7 @@ iavf_config_promisc(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE;
args.in_args = (uint8_t *)&promisc;
args.in_args_size = sizeof(promisc);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1612,6 +1633,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
{
struct virtchnl_ether_addr_list *list;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint8_t cmd_buffer[sizeof(struct virtchnl_ether_addr_list) +
sizeof(struct virtchnl_ether_addr)];
struct iavf_cmd_info args;
@@ -1630,7 +1652,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr,
args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR;
args.in_args = cmd_buffer;
args.in_args_size = sizeof(cmd_buffer);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1644,6 +1666,7 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
{
struct virtchnl_vlan_filter_list *vlan_list;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint8_t cmd_buffer[sizeof(struct virtchnl_vlan_filter_list) +
sizeof(uint16_t)];
struct iavf_cmd_info args;
@@ -1657,7 +1680,7 @@ iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add)
args.ops = add ? VIRTCHNL_OP_ADD_VLAN : VIRTCHNL_OP_DEL_VLAN;
args.in_args = cmd_buffer;
args.in_args_size = sizeof(cmd_buffer);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
if (err)
@@ -1673,7 +1696,7 @@ iavf_fdir_add(struct iavf_adapter *adapter,
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_fdir_add *fdir_ret;
-
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1683,7 +1706,7 @@ iavf_fdir_add(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_ADD_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->add_fltr);
args.in_args_size = sizeof(*(&filter->add_fltr));
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1733,7 +1756,7 @@ iavf_fdir_del(struct iavf_adapter *adapter,
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_fdir_del *fdir_ret;
-
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1743,7 +1766,7 @@ iavf_fdir_del(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_DEL_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->del_fltr);
args.in_args_size = sizeof(filter->del_fltr);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1780,7 +1803,7 @@ iavf_fdir_check(struct iavf_adapter *adapter,
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_fdir_add *fdir_ret;
-
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1790,7 +1813,7 @@ iavf_fdir_check(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_ADD_FDIR_FILTER;
args.in_args = (uint8_t *)(&filter->add_fltr);
args.in_args_size = sizeof(*(&filter->add_fltr));
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1822,6 +1845,7 @@ int
iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_flow_sub *fsub_cfg;
struct iavf_cmd_info args;
int err;
@@ -1833,7 +1857,7 @@ iavf_flow_sub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.ops = VIRTCHNL_OP_FLOW_SUBSCRIBE;
args.in_args = (uint8_t *)(&filter->sub_fltr);
args.in_args_size = sizeof(*(&filter->sub_fltr));
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1874,6 +1898,7 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_flow_unsub *unsub_cfg;
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1884,7 +1909,7 @@ iavf_flow_unsub(struct iavf_adapter *adapter, struct iavf_fsub_conf *filter)
args.ops = VIRTCHNL_OP_FLOW_UNSUBSCRIBE;
args.in_args = (uint8_t *)(&filter->unsub_fltr);
args.in_args_size = sizeof(filter->unsub_fltr);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1917,7 +1942,7 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_flow_sub *fsub_cfg;
-
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1927,7 +1952,7 @@ iavf_flow_sub_check(struct iavf_adapter *adapter,
args.ops = VIRTCHNL_OP_FLOW_SUBSCRIBE;
args.in_args = (uint8_t *)(&filter->sub_fltr);
args.in_args_size = sizeof(*(&filter->sub_fltr));
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1958,7 +1983,7 @@ int
iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
struct virtchnl_rss_cfg *rss_cfg, bool add)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -1967,7 +1992,7 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
VIRTCHNL_OP_DEL_RSS_CFG;
args.in_args = (u8 *)rss_cfg;
args.in_args_size = sizeof(*rss_cfg);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -1983,7 +2008,7 @@ iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
int
iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_rss_hena *hena;
struct iavf_cmd_info args;
int err;
@@ -1991,7 +2016,7 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
args.ops = VIRTCHNL_OP_GET_RSS_HENA_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2009,7 +2034,7 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
int
iavf_set_hena(struct iavf_adapter *adapter, uint64_t hena)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_rss_hena vrh;
struct iavf_cmd_info args;
int err;
@@ -2018,7 +2043,7 @@ iavf_set_hena(struct iavf_adapter *adapter, uint64_t hena)
args.ops = VIRTCHNL_OP_SET_RSS_HENA;
args.in_args = (u8 *)&vrh;
args.in_args_size = sizeof(vrh);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2033,6 +2058,7 @@ int
iavf_get_qos_cap(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint32_t len;
int err;
@@ -2040,7 +2066,7 @@ iavf_get_qos_cap(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_GET_QOS_CAPS;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2064,7 +2090,7 @@ int iavf_set_q_tc_map(struct rte_eth_dev *dev,
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -2072,7 +2098,7 @@ int iavf_set_q_tc_map(struct rte_eth_dev *dev,
args.ops = VIRTCHNL_OP_CONFIG_QUEUE_TC_MAP;
args.in_args = (uint8_t *)q_tc_mapping;
args.in_args_size = size;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2087,7 +2113,7 @@ int iavf_set_q_bw(struct rte_eth_dev *dev,
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
@@ -2095,7 +2121,7 @@ int iavf_set_q_bw(struct rte_eth_dev *dev,
args.ops = VIRTCHNL_OP_CONFIG_QUEUE_BW;
args.in_args = (uint8_t *)q_bw;
args.in_args_size = size;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2111,6 +2137,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
uint32_t mc_addrs_num, bool add)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
uint8_t cmd_buffer[sizeof(struct virtchnl_ether_addr_list) +
(IAVF_NUM_MACADDR_MAX * sizeof(struct virtchnl_ether_addr))];
struct virtchnl_ether_addr_list *list;
@@ -2141,7 +2168,7 @@ iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
args.in_args = cmd_buffer;
args.in_args_size = sizeof(struct virtchnl_ether_addr_list) +
i * sizeof(struct virtchnl_ether_addr);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2160,6 +2187,7 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_vf_res_request vfres;
struct iavf_cmd_info args;
uint16_t num_queue_pairs;
@@ -2181,7 +2209,7 @@ iavf_request_queues(struct rte_eth_dev *dev, uint16_t num)
args.ops = VIRTCHNL_OP_REQUEST_QUEUES;
args.in_args = (u8 *)&vfres;
args.in_args_size = sizeof(vfres);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
@@ -2224,6 +2252,7 @@ int
iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
uint16_t qregion_width;
int err;
@@ -2231,7 +2260,7 @@ iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_GET_MAX_RSS_QREGION;
args.in_args = NULL;
args.in_args_size = 0;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2255,14 +2284,14 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
uint8_t *msg, size_t msg_len,
uint8_t *resp_msg, size_t resp_msg_len)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
int err;
args.ops = VIRTCHNL_OP_INLINE_IPSEC_CRYPTO;
args.in_args = msg;
args.in_args_size = msg_len;
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2280,7 +2309,7 @@ iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
int
iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 num_queues)
{
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct iavf_cmd_info args;
struct virtchnl_quanta_cfg q_quanta;
int err;
@@ -2296,7 +2325,7 @@ iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id, u16 nu
args.ops = VIRTCHNL_OP_CONFIG_QUANTA;
args.in_args = (uint8_t *)&q_quanta;
args.in_args_size = sizeof(q_quanta);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2312,6 +2341,7 @@ int
iavf_get_ptp_cap(struct iavf_adapter *adapter)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_ptp_caps ptp_caps;
struct iavf_cmd_info args;
int err;
@@ -2322,7 +2352,7 @@ iavf_get_ptp_cap(struct iavf_adapter *adapter)
args.ops = VIRTCHNL_OP_1588_PTP_GET_CAPS;
args.in_args = (uint8_t *)&ptp_caps;
args.in_args_size = sizeof(ptp_caps);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
err = iavf_execute_vf_cmd_safe(adapter, &args);
@@ -2342,6 +2372,7 @@ iavf_get_phc_time(struct ci_rx_queue *rxq)
{
struct iavf_adapter *adapter = rxq->iavf_vsi->adapter;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
+ uint8_t msg_buf[IAVF_AQ_BUF_SZ] = {0};
struct virtchnl_phc_time phc_time;
struct iavf_cmd_info args;
int err = 0;
@@ -2349,7 +2380,7 @@ iavf_get_phc_time(struct ci_rx_queue *rxq)
args.ops = VIRTCHNL_OP_1588_PTP_GET_TIME;
args.in_args = (uint8_t *)&phc_time;
args.in_args_size = sizeof(phc_time);
- args.out_buffer = vf->aq_resp;
+ args.out_buffer = msg_buf;
args.out_size = IAVF_AQ_BUF_SZ;
rte_spinlock_lock(&vf->phc_time_aq_lock);
--
2.47.3
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 8/8] net/iavf: embed virtchnl response buffer
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
` (6 preceding siblings ...)
2026-03-06 10:58 ` [PATCH v3 7/8] net/iavf: do not use global virtchnl buffer Anatoly Burakov
@ 2026-03-06 10:58 ` Anatoly Burakov
2026-04-03 11:11 ` Bruce Richardson
2026-04-03 13:13 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Bruce Richardson
8 siblings, 1 reply; 23+ messages in thread
From: Anatoly Burakov @ 2026-03-06 10:58 UTC (permalink / raw)
To: dev, Vladimir Medvedkin
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 <anatoly.burakov@intel.com>
---
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
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v3 1/8] net/iavf: avoid passing around pointers
2026-03-06 10:58 ` [PATCH v3 1/8] net/iavf: avoid passing around pointers Anatoly Burakov
@ 2026-04-03 10:37 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 10:37 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:17AM +0000, Anatoly Burakov wrote:
> Currently, when querying the stats for IAVF, we pass a pointer-to-pointer
> and then use it as an input for another function. It does not really need
> to be a pointer because it is populated from virtchnl command response
> anyway. Replace it with passing in a stack-allocated struct, and pass it
> into the stats query function.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 2/8] net/iavf: add a variable for hena
2026-03-06 10:58 ` [PATCH v3 2/8] net/iavf: add a variable for hena Anatoly Burakov
@ 2026-04-03 10:39 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 10:39 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:18AM +0000, Anatoly Burakov wrote:
> Currently, we read RSS hena value directly from output buffer using an in
> place pointer cast. Use a variable instead.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Not sure I see that much point in this patch alone, but it's harmless.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> drivers/net/intel/iavf/iavf_vchnl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
> index a1dc573841..d97bdf0dc1 100644
> --- a/drivers/net/intel/iavf/iavf_vchnl.c
> +++ b/drivers/net/intel/iavf/iavf_vchnl.c
> @@ -1933,6 +1933,7 @@ int
> iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
> {
> struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> + struct virtchnl_rss_hena *hena;
> struct iavf_cmd_info args;
> int err;
>
> @@ -1949,7 +1950,8 @@ iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps)
> return err;
> }
>
> - *caps = ((struct virtchnl_rss_hena *)args.out_buffer)->hena;
> + hena = (struct virtchnl_rss_hena *)args.out_buffer;
> + *caps = hena->hena;
> return 0;
> }
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 3/8] net/iavf: add virtchnl interrupt enable flag
2026-03-06 10:58 ` [PATCH v3 3/8] net/iavf: add virtchnl interrupt enable flag Anatoly Burakov
@ 2026-04-03 10:42 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 10:42 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:19AM +0000, Anatoly Burakov wrote:
> For some functionality, we will need to know if the virtchnl message queue
> interrupts are enabled (i.e. if the new virtchnl messages will be delivered
> into an interrupt thread as opposed to having to directly poll the queue).
> Add such flag and track its status during init/close.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 4/8] net/iavf: rework "async" virtchnl requests
2026-03-06 10:58 ` [PATCH v3 4/8] net/iavf: rework "async" virtchnl requests Anatoly Burakov
@ 2026-04-03 10:52 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 10:52 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:20AM +0000, Anatoly Burakov wrote:
> Currently, IPsec crypto requests are called with `async` parameter set to 1
> on account of these requests generating two virtchnl responses instead of
> having just one, like all other requests.
>
> However, this terminology is misleading, because in actuality *almost all*
> virtchnl requests are asynchronously implemented; that is, almost all of
> them will send a request into virtchnl command queue, and then expect to
> receive a virtchnl response in an interrupt thread, which will update the
> global "pending command" status and write into the global response buffer,
> while the pending request will simply check pending command status on a
> timer. So, for almost all requests, the command status is updated
> asynchronously. The only times this *doesn't* happen is 1) when the
> request is sent from an interrupt thread context, or 2) when the requests
> are sent at init time and the interrupt thread isn't active yet. In both
> of those cases we directly poll the virtchnl queue for responses.
>
> To make things a little less confusing, remove the usage of "asynchronous"
> terminology across all callsites, and instead make it explicit that what
> we're actually interested in is the number of responses we are waiting for,
> and whether the thread is meant to directly poll the message queue or wait
> for interrupt thread to update command status, not whether the requests
> are "asynchronous". We also make it an implementation detail, not part of
> the API for executing VF commands.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
One minor nit inline below.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> drivers/net/intel/iavf/iavf.h | 53 --------
> drivers/net/intel/iavf/iavf_vchnl.c | 187 ++++++++++++++++++----------
> 2 files changed, 121 insertions(+), 119 deletions(-)
>
> diff --git a/drivers/net/intel/iavf/iavf.h b/drivers/net/intel/iavf/iavf.h
> index cf98d12247..440376c4ca 100644
> --- a/drivers/net/intel/iavf/iavf.h
> +++ b/drivers/net/intel/iavf/iavf.h
> @@ -432,59 +432,6 @@ struct iavf_cmd_info {
> uint32_t out_size; /* buffer size for response */
> };
>
> -/* notify current command done. Only call in case execute
> - * _atomic_set_cmd successfully.
> - */
> -static inline void
> -_notify_cmd(struct iavf_info *vf, int msg_ret)
> -{
> - vf->cmd_retval = msg_ret;
> - rte_wmb();
> - vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
> -}
> -
> -/* clear current command. Only call in case execute
> - * _atomic_set_cmd successfully.
> - */
> -static inline void
> -_clear_cmd(struct iavf_info *vf)
> -{
> - rte_wmb();
> - vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
> - vf->cmd_retval = VIRTCHNL_STATUS_SUCCESS;
> -}
> -
> -/* Check there is pending cmd in execution. If none, set new command. */
> -static inline int
> -_atomic_set_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
> -{
> - enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
> - int ret = rte_atomic_compare_exchange_strong_explicit(&vf->pend_cmd, &op_unk, ops,
> - rte_memory_order_acquire, rte_memory_order_acquire);
> -
> - if (!ret)
> - PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
> -
> - rte_atomic_store_explicit(&vf->pend_cmd_count, 1, rte_memory_order_relaxed);
> -
> - return !ret;
> -}
> -
> -/* Check there is pending cmd in execution. If none, set new command. */
> -static inline int
> -_atomic_set_async_response_cmd(struct iavf_info *vf, enum virtchnl_ops ops)
> -{
> - enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
> - int ret = rte_atomic_compare_exchange_strong_explicit(&vf->pend_cmd, &op_unk, ops,
> - rte_memory_order_acquire, rte_memory_order_acquire);
> -
> - if (!ret)
> - PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
> -
> - rte_atomic_store_explicit(&vf->pend_cmd_count, 2, rte_memory_order_relaxed);
> -
> - return !ret;
> -}
> int iavf_check_api_version(struct iavf_adapter *adapter);
> int iavf_get_vf_resource(struct iavf_adapter *adapter);
> void iavf_dev_event_post(struct rte_eth_dev *dev,
> diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
> index d97bdf0dc1..d240745f5c 100644
> --- a/drivers/net/intel/iavf/iavf_vchnl.c
> +++ b/drivers/net/intel/iavf/iavf_vchnl.c
> @@ -309,42 +309,97 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
> }
>
> static int
> -iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
> - int async)
> +iavf_set_pending_cmd(struct iavf_info *vf, enum virtchnl_ops ops,
> + uint32_t resp_count)
> +{
> + enum virtchnl_ops op_unk = VIRTCHNL_OP_UNKNOWN;
> + int ret = rte_atomic_compare_exchange_strong_explicit(&vf->pend_cmd,
> + &op_unk, ops, rte_memory_order_acquire,
> + rte_memory_order_acquire);
> +
> + if (ret == 0) {
> + PMD_DRV_LOG(ERR, "There is incomplete cmd %d", vf->pend_cmd);
> + return -1;
> + }
> +
> + rte_atomic_store_explicit(&vf->pend_cmd_count, resp_count,
> + rte_memory_order_relaxed);
> +
> + return 0;
> +}
> +
> +static inline void
> +iavf_clear_pending_cmd(struct iavf_info *vf)
> +{
> + rte_wmb();
> + vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
> + vf->cmd_retval = VIRTCHNL_STATUS_SUCCESS;
> +}
> +
> +static inline void
> +iavf_notify_pending_cmd(struct iavf_info *vf, int msg_ret)
> +{
> + vf->cmd_retval = msg_ret;
> + rte_wmb();
> + vf->pend_cmd = VIRTCHNL_OP_UNKNOWN;
> +}
> +
> +static int
> +iavf_get_cmd_resp_count(enum virtchnl_ops op)
> +{
> + switch (op) {
> + case VIRTCHNL_OP_RESET_VF:
> + case VIRTCHNL_OP_REQUEST_QUEUES:
> + /* These commands trigger reset and are not waited for */
> + return 0;
> + case VIRTCHNL_OP_INLINE_IPSEC_CRYPTO:
> + /* IPsec crypto commands generate two responses */
> + return 2;
> + default:
> + /* All other commands generate one response */
> + return 1;
> + }
> +}
> +
> +static int
> +iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)
> {
> struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
> struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> enum iavf_aq_result result;
> enum iavf_status ret;
> + uint32_t resp_count;
> int err = 0;
> int i = 0;
>
> if (vf->vf_reset)
> return -EIO;
>
> + resp_count = iavf_get_cmd_resp_count(args->ops);
>
> - if (async) {
> - if (_atomic_set_async_response_cmd(vf, args->ops))
> - return -1;
> - } else {
> - if (_atomic_set_cmd(vf, args->ops))
> - return -1;
> - }
> + /*
> + * For some commands, we are not waiting for responses because they
> + * produce a reset event. However, we still need to set pending command
> + * to avoid sending commands while another one is already in progress.
> + */
> + if (iavf_set_pending_cmd(vf, args->ops, RTE_MAX(1U, resp_count)))
Nit: according to coding style this should be explicitly "!= 0"
> + return -1;
>
<snip>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 5/8] net/iavf: refactor sending virtchnl messages
2026-03-06 10:58 ` [PATCH v3 5/8] net/iavf: refactor sending virtchnl messages Anatoly Burakov
@ 2026-04-03 10:55 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 10:55 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:21AM +0000, Anatoly Burakov wrote:
> Currently, there is a certain amount of duplication and unnecessary
> branching in the virtchnl message handling function which makes it
> difficult to read and reason about.
>
> Refactor the function to achieve the following:
>
> - clean and explicit distinction between synchronous and asynchronous ops
> - common looping and error handling logic
> - fewer and clearer special cases
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> drivers/net/intel/iavf/iavf_vchnl.c | 151 +++++++++++++---------------
> 1 file changed, 70 insertions(+), 81 deletions(-)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/8] net/iavf: respect output buffer in virtchnl
2026-03-06 10:58 ` [PATCH v3 6/8] net/iavf: respect output buffer in virtchnl Anatoly Burakov
@ 2026-04-03 11:08 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 11:08 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:22AM +0000, Anatoly Burakov wrote:
> Currently, in asynchronous case for virtchnl messages, we only store the
> command response data inside the global buffer. This is correct, because we
> populate the response in a different thread from the caller context, but
> this results in caller's `out_buffer` value being ignored. Correct it by
> populating caller's response buffer with data from response even in cases
> where the messages arrive asynchronously.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> drivers/net/intel/iavf/iavf_vchnl.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 7/8] net/iavf: do not use global virtchnl buffer
2026-03-06 10:58 ` [PATCH v3 7/8] net/iavf: do not use global virtchnl buffer Anatoly Burakov
@ 2026-04-03 11:10 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 11:10 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:23AM +0000, Anatoly Burakov wrote:
> Currently, a lot of virtchnl requests will use global virtchnl output
> buffer as their `out_buffer` for VF requests. This was originally done this
> way because most requests were done asynchronously and the response was not
> written directly into the `out_buffer`. This is no longer the case, so the
> per-command buffers can be safely replaced with stack allocated buffers.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> drivers/net/intel/iavf/iavf_vchnl.c | 147 +++++++++++++++++-----------
> 1 file changed, 89 insertions(+), 58 deletions(-)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 8/8] net/iavf: embed virtchnl response buffer
2026-03-06 10:58 ` [PATCH v3 8/8] net/iavf: embed virtchnl response buffer Anatoly Burakov
@ 2026-04-03 11:11 ` Bruce Richardson
0 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 11:11 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin
On Fri, Mar 06, 2026 at 10:58:24AM +0000, Anatoly Burakov wrote:
> 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 <anatoly.burakov@intel.com>
> ---
> 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(-)
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
` (7 preceding siblings ...)
2026-03-06 10:58 ` [PATCH v3 8/8] net/iavf: embed virtchnl response buffer Anatoly Burakov
@ 2026-04-03 13:13 ` Bruce Richardson
8 siblings, 0 replies; 23+ messages in thread
From: Bruce Richardson @ 2026-04-03 13:13 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev
On Fri, Mar 06, 2026 at 10:58:16AM +0000, Anatoly Burakov wrote:
> In many places where we are calling down into virtchnl, we are using a
> globally allocated adminq response buffer. This is unnecessary, so replace
> with adminq buffers allocated on stack. However, because IAVF virtchnl
> message queue works asynchronously in most cases, we can't remove the
> global buffer entirely, and we need to do some cleanup and refactoring to
> be able to reduce our usage of these buffers. This patchset does that.
>
> v1 -> v2:
> - Stats query was passing in a pointer-to-pointer and storing pointer to
> global adminq response buffer as output parameter, so changing that to a
> local buffer resulted in storing a pointer to a buffer that was stack
> allocated (i.e. introduced a use-after-free).
>
> v2 -> v3:
> - Reworked the virtchnl message handling to not rely on implicit behavior
> - Split up into 8 patches for easy review
>
> Anatoly Burakov (8):
> net/iavf: avoid passing around pointers
> net/iavf: add a variable for hena
> net/iavf: add virtchnl interrupt enable flag
> net/iavf: rework "async" virtchnl requests
> net/iavf: refactor sending virtchnl messages
> net/iavf: respect output buffer in virtchnl
> net/iavf: do not use global virtchnl buffer
> net/iavf: embed virtchnl response buffer
>
Series applied to dpdk-next-net-intel.
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2026-04-03 13:13 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 12:09 [PATCH v1 1/1] net/iavf: remove global adminq response buffer Anatoly Burakov
2026-02-26 10:41 ` [PATCH v2 " Anatoly Burakov
2026-02-26 10:52 ` Burakov, Anatoly
2026-02-27 10:58 ` Bruce Richardson
2026-03-03 8:52 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Anatoly Burakov
2026-03-06 10:58 ` [PATCH v3 1/8] net/iavf: avoid passing around pointers Anatoly Burakov
2026-04-03 10:37 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 2/8] net/iavf: add a variable for hena Anatoly Burakov
2026-04-03 10:39 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 3/8] net/iavf: add virtchnl interrupt enable flag Anatoly Burakov
2026-04-03 10:42 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 4/8] net/iavf: rework "async" virtchnl requests Anatoly Burakov
2026-04-03 10:52 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 5/8] net/iavf: refactor sending virtchnl messages Anatoly Burakov
2026-04-03 10:55 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 6/8] net/iavf: respect output buffer in virtchnl Anatoly Burakov
2026-04-03 11:08 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 7/8] net/iavf: do not use global virtchnl buffer Anatoly Burakov
2026-04-03 11:10 ` Bruce Richardson
2026-03-06 10:58 ` [PATCH v3 8/8] net/iavf: embed virtchnl response buffer Anatoly Burakov
2026-04-03 11:11 ` Bruce Richardson
2026-04-03 13:13 ` [PATCH v3 0/8] Reduce reliance on global response buffer in IAVF Bruce Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox