net/iavf: fix large vf queues cannot re-use.
Checks
Commit Message
Multiple vfs created based on one PF. If one of the vf requests a large
number of queues, the queue resources are not released when exiting the
program, resulting in these queues cannot be available to other vfs.
This commit fixes the issue by resetting the number of queues to default
when closing the dev (refer to the kernel driver) .
Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
Cc: stable@dpdk.org
Signed-off-by: Shiyang He <shiyangx.he@intel.com>
---
drivers/net/iavf/iavf_ethdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
> -----Original Message-----
> From: Shiyang He <shiyangx.he@intel.com>
> Sent: Tuesday, May 9, 2023 12:58 AM
> To: dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; He, ShiyangX
> <shiyangx.he@intel.com>; stable@dpdk.org; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Xu, Ting
> <ting.xu@intel.com>
> Subject: [PATCH] net/iavf: fix large vf queues cannot re-use.
>
> Multiple vfs created based on one PF. If one of the vf requests a large
> number of queues, the queue resources are not released when exiting the
> program, resulting in these queues cannot be available to other vfs.
>
> This commit fixes the issue by resetting the number of queues to default
> when closing the dev (refer to the kernel driver) .
>
> Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more
> queues")
> Cc: stable@dpdk.org
>
> Signed-off-by: Shiyang He <shiyangx.he@intel.com>
I assume this is a workaround, as the queue resources may not be released if the PMD quits abnormally. A robust solution would rely on the kernel driver to reclaim the resources during a VF reset.
Nevertheless, this fix is not harmful and provides temporary relief for the issue until a proper solution can be implemented in the kernel driver.
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Applied to dpdk-next-net-intel.
Thanks
Qi
@@ -2735,6 +2735,18 @@ iavf_dev_close(struct rte_eth_dev *dev)
if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled)
iavf_config_promisc(adapter, false, false);
+ /*
+ * Release redundant queue resource when close the dev
+ * so that other vfs can re-use the queues.
+ */
+ if (vf->lv_enabled) {
+ ret = iavf_request_queues(dev, IAVF_MAX_NUM_QUEUES_DFLT);
+ if (ret)
+ PMD_DRV_LOG(ERR, "Reset the num of queues failed");
+
+ vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT;
+ }
+
iavf_shutdown_adminq(hw);
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
/* disable uio intr before callback unregister */