[dpdk-dev] [PATCH] igb_uio: cap max VFs at 7 to reserve one for PF

Chris Wright chrisw at redhat.com
Fri Jun 13 19:51:37 CEST 2014


To keep from confusing users, cap max VFs at 7, despite PCI SR-IOV config
space showing a max of 8.  This reserves a queue pair for the PF.

This issue was cited here:

 http://dpdk.org/ml/archives/dev/2014-April/001832.html

Cc: Bruce Richardson <bruce.richardson at intel.com>
Cc: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Chris Wright <chrisw at redhat.com>
---

This is what Linux kernel driver does.  I have only
compile tested it.  Stephen sending to you and Bruce
in case you want to Ack and add to your current queue.

 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index 6fa7396..d5db97a 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -139,6 +139,12 @@ store_max_vfs(struct device *dev, struct device_attribute *attr,
 	if (0 != strict_strtoul(buf, 0, &max_vfs))
 		return -EINVAL;
 
+	/* reserve a queue pair for PF */
+	if (max_vfs > 7) {
+		dev_warn(dev, "Maxixum of 7 VFs per PF, using max\n");
+		max_vfs = 7;
+	}
+
 	if (0 == max_vfs)
 		pci_disable_sriov(pdev);
 	else if (0 == local_pci_num_vf(pdev))


More information about the dev mailing list