All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Hay <joshua.a.hay@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH S23 07/13] i40evf: allow channel bonding of VFs
Date: Wed,  9 Dec 2015 15:50:27 -0800	[thread overview]
Message-ID: <1449705033-4968-8-git-send-email-joshua.a.hay@intel.com> (raw)
In-Reply-To: <1449705033-4968-1-git-send-email-joshua.a.hay@intel.com>

From: Mitch Williams <mitch.a.williams@intel.com>

In some modes, bonding would not enslave VF interfaces. This is due to
bonding calling change_mtu and the immediately calling open. Because of
the asynchronous nature of the admin queue mechanism, the VF returns
-EBUSY to the open call, because it knows the previous operation hasn't
finished yet. This causes bonding to fail with a less-than-useful error
message.

To fix this, remove the check for pending operations at the beginning of
open. But this introduces a new bug where the driver will panic on a
quick close/open cycle. To fix that, we add a new driver state,
__I40EVF_DOWN_PENDING, that the driver enters when down is called. The
driver finally transitions to a fully DOWN state when it receives
confirmation from the PF driver that all the queues are disabled. This
allows open to complete even if there is a pending mtu change, and
bonding is finally happy.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Change-ID: I06f4c7e435d5bacbfceaa7c3f209e0ff04be21cc
---
 drivers/net/ethernet/intel/i40evf/i40evf.h          | 1 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c     | 9 +++++----
 drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c | 2 ++
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h
index be1b72b..9e15f68 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf.h
+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h
@@ -173,6 +173,7 @@ enum i40evf_state_t {
 	__I40EVF_RESETTING,		/* in reset */
 	/* Below here, watchdog is running */
 	__I40EVF_DOWN,			/* ready, can be opened */
+	__I40EVF_DOWN_PENDING,		/* descending, waiting for watchdog */
 	__I40EVF_TESTING,		/* in ethtool self-test */
 	__I40EVF_RUNNING,		/* opened, working */
 };
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 455394c..d859045 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1032,7 +1032,7 @@ void i40evf_down(struct i40evf_adapter *adapter)
 	struct net_device *netdev = adapter->netdev;
 	struct i40evf_mac_filter *f;
 
-	if (adapter->state == __I40EVF_DOWN)
+	if (adapter->state <= __I40EVF_DOWN_PENDING)
 		return;
 
 	while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,
@@ -2142,7 +2142,8 @@ static int i40evf_open(struct net_device *netdev)
 		dev_err(&adapter->pdev->dev, "Unable to open device due to PF driver failure.\n");
 		return -EIO;
 	}
-	if (adapter->state != __I40EVF_DOWN || adapter->aq_required)
+
+	if (adapter->state != __I40EVF_DOWN)
 		return -EBUSY;
 
 	/* allocate transmit descriptors */
@@ -2197,14 +2198,14 @@ static int i40evf_close(struct net_device *netdev)
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 
-	if (adapter->state <= __I40EVF_DOWN)
+	if (adapter->state <= __I40EVF_DOWN_PENDING)
 		return 0;
 
 
 	set_bit(__I40E_DOWN, &adapter->vsi.state);
 
 	i40evf_down(adapter);
-	adapter->state = __I40EVF_DOWN;
+	adapter->state = __I40EVF_DOWN_PENDING;
 	i40evf_free_traffic_irqs(adapter);
 
 	return 0;
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
index c1c5262..d3739cc 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c
@@ -804,6 +804,8 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 	case I40E_VIRTCHNL_OP_DISABLE_QUEUES:
 		i40evf_free_all_tx_resources(adapter);
 		i40evf_free_all_rx_resources(adapter);
+		if (adapter->state == __I40EVF_DOWN_PENDING)
+			adapter->state = __I40EVF_DOWN;
 		break;
 	case I40E_VIRTCHNL_OP_VERSION:
 	case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP:
-- 
2.1.0


  parent reply	other threads:[~2015-12-09 23:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 23:50 [Intel-wired-lan] [next PATCH S23 00/13] i40e/i40evf updates Joshua Hay
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 01/13] i40e: Fix Rx hash reported to the stack by our driver Joshua Hay
2015-12-16 18:31   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 02/13] i40e: remove forever unused ID Joshua Hay
2015-12-16 18:35   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 03/13] i40e: Add mac_filter_element at the end of the list instead of HEAD Joshua Hay
2015-12-16 18:37   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 04/13] i40e/i40evf: Fix RSS rx-flow-hash configuration through ethtool Joshua Hay
2016-01-13 19:25   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 05/13] i40e: Replace X722 mac check in ethtool get_settings Joshua Hay
2016-01-13 18:58   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 06/13] i40e/i40evf: tunnels can be generic Joshua Hay
2015-12-17 16:43   ` Bowers, AndrewX
2016-01-20  3:54   ` [Intel-wired-lan] [next, S23, " Alexander Duyck
2016-01-20 22:13     ` Jeff Kirsher
2016-01-20 22:39     ` Jesse Brandeburg
2016-01-20 22:44       ` Alexander Duyck
2015-12-09 23:50 ` Joshua Hay [this message]
2015-12-17 16:49   ` [Intel-wired-lan] [next PATCH S23 07/13] i40evf: allow channel bonding of VFs Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 08/13] i40e: define function capabilities in only one place Joshua Hay
2015-12-10 18:47   ` Jesse Brandeburg
2015-12-17 16:53   ` Bowers, AndrewX
2015-12-30 16:12     ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 09/13] i40e: Make some changes in the nvm read code Joshua Hay
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 10/13] i40evf: null out ring pointers on free Joshua Hay
2015-12-17 16:58   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 11/13] i40e: Cleanup the code with respect to restarting autoneg Joshua Hay
2015-12-17 17:00   ` Bowers, AndrewX
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 12/13] i40e: update features with right offload Joshua Hay
2015-12-10 18:46   ` Jesse Brandeburg
2015-12-09 23:50 ` [Intel-wired-lan] [next PATCH S23 13/13] i40e: bump version to 1.4.10 Joshua Hay
2015-12-17 17:09   ` Bowers, AndrewX

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=1449705033-4968-8-git-send-email-joshua.a.hay@intel.com \
    --to=joshua.a.hay@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.