net/iavf: fix large vf queues cannot re-use.

Message ID 20230508165824.2086818-1-shiyangx.he@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/iavf: fix large vf queues cannot re-use. |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS

Commit Message

Shiyang He May 8, 2023, 4:58 p.m. UTC
  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

Qi Zhang May 15, 2023, 2:25 a.m. UTC | #1
> -----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
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f6d68403ce..9c55eaa66e 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -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 */