From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Usha Ketineni <usha.k.ketineni@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 01/15] ixgbe: Avoid Tx hang by not allowing more than the number of VFs supported.
Date: Tue, 18 Apr 2017 16:01:51 -0700 [thread overview]
Message-ID: <20170418230205.37223-2-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20170418230205.37223-1-jeffrey.t.kirsher@intel.com>
From: Usha Ketineni <usha.k.ketineni@intel.com>
When DCB is enabled, add checks to ensure creation of number of VF's is
valid based on the traffic classes configured by the device.
Signed-off-by: Usha Ketineni <usha.k.ketineni@intel.com>
Tested-by: Ronald Bynoe <ronald.j.bynoe@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 26 +++++++++++++++++++++++---
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h | 3 +++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 044cb44747cf..39e109da9bd9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -298,6 +298,7 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
#ifdef CONFIG_PCI_IOV
struct ixgbe_adapter *adapter = pci_get_drvdata(dev);
int err = 0;
+ u8 num_tc;
int i;
int pre_existing_vfs = pci_num_vf(dev);
@@ -310,16 +311,35 @@ static int ixgbe_pci_sriov_enable(struct pci_dev *dev, int num_vfs)
return err;
/* While the SR-IOV capability structure reports total VFs to be 64,
- * we have to limit the actual number allocated based on two factors.
+ * we limit the actual number allocated as below based on two factors.
+ * Num_TCs MAX_VFs
+ * 1 63
+ * <=4 31
+ * >4 15
* First, we reserve some transmit/receive resources for the PF.
* Second, VMDQ also uses the same pools that SR-IOV does. We need to
* account for this, so that we don't accidentally allocate more VFs
* than we have available pools. The PCI bus driver already checks for
* other values out of range.
*/
- if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VF_FUNCTIONS)
- return -EPERM;
+ num_tc = netdev_get_num_tc(adapter->netdev);
+ if (num_tc > 4) {
+ if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VFS_8TC) {
+ e_dev_err("Currently the device is configured with %d TCs, Creating more than %d VFs is not allowed\n", num_tc, IXGBE_MAX_VFS_8TC);
+ return -EPERM;
+ }
+ } else if ((num_tc > 1) && (num_tc <= 4)) {
+ if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VFS_4TC) {
+ e_dev_err("Currently the device is configured with %d TCs, Creating more than %d VFs is not allowed\n", num_tc, IXGBE_MAX_VFS_4TC);
+ return -EPERM;
+ }
+ } else {
+ if ((num_vfs + adapter->num_rx_pools) > IXGBE_MAX_VFS_1TC) {
+ e_dev_err("Currently the device is configured with %d TCs, Creating more than %d VFs is not allowed\n", num_tc, IXGBE_MAX_VFS_1TC);
+ return -EPERM;
+ }
+ }
adapter->num_vfs = num_vfs;
err = __ixgbe_enable_sriov(adapter);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
index 0c7977d27b71..3166fd164e51 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
@@ -33,6 +33,9 @@
* 63 (IXGBE_MAX_VF_FUNCTIONS - 1)
*/
#define IXGBE_MAX_VFS_DRV_LIMIT (IXGBE_MAX_VF_FUNCTIONS - 1)
+#define IXGBE_MAX_VFS_1TC IXGBE_MAX_VF_FUNCTIONS
+#define IXGBE_MAX_VFS_4TC 32
+#define IXGBE_MAX_VFS_8TC 16
#ifdef CONFIG_PCI_IOV
void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
--
2.12.2
next prev parent reply other threads:[~2017-04-18 23:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 23:01 [net-next 00/15][pull request] 10GbE Intel Wired LAN Driver Updates 2017-04-18 Jeff Kirsher
2017-04-18 23:01 ` Jeff Kirsher [this message]
2017-04-18 23:01 ` [net-next 02/15] ixgbe: Remove pr_cont uses Jeff Kirsher
2017-04-18 23:01 ` [net-next 03/15] ixgbe: Remove driver config for KX4 PHY Jeff Kirsher
2017-04-18 23:01 ` [net-next 04/15] ixgbe: Complete support for X553 sgmii Jeff Kirsher
2017-04-18 23:01 ` [net-next 05/15] ixgbe: Add X552 XFI backplane support Jeff Kirsher
2017-04-18 23:01 ` [net-next 06/15] ixgbe: list X553 backplane speeds correctly Jeff Kirsher
2017-04-18 23:01 ` [net-next 07/15] ixgbe: add default setup_link for x550em_a MAC type Jeff Kirsher
2017-04-18 23:01 ` [net-next 08/15] ixgbe: move num_vfs_macvlans allocation into separate function Jeff Kirsher
2017-04-18 23:01 ` [net-next 09/15] ixgbe: return early instead of wrap block in if statement Jeff Kirsher
2017-04-18 23:02 ` [net-next 10/15] ixgbe: do not use adapter->num_vfs when setting VFs via module parameter Jeff Kirsher
2017-04-18 23:02 ` [net-next 11/15] ixgbe: Remove unused define Jeff Kirsher
2017-04-18 23:02 ` [net-next 12/15] ixgbevf: use new api ethtool_{get|set}_link_ksettings Jeff Kirsher
2017-04-18 23:02 ` [net-next 13/15] ixgbe: add check for VETO bit when configuring link for KR Jeff Kirsher
2017-04-18 23:02 ` [net-next 14/15] ixgbe: Add support for maximum headroom when using build_skb Jeff Kirsher
2017-04-18 23:02 ` [net-next 15/15] ixgbe: Fix output from ixgbe_dump Jeff Kirsher
2017-04-20 5:25 ` [net-next 00/15][pull request] 10GbE Intel Wired LAN Driver Updates 2017-04-18 Alexei Starovoitov
2017-04-20 8:44 ` Jeff Kirsher
2017-04-20 20:11 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170418230205.37223-2-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
--cc=usha.k.ketineni@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).