[dpdk-dev,13/13] net/sfc: fix device reconfigure

Message ID 1490955743-9868-14-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Andrew Rybchenko March 31, 2017, 10:22 a.m. UTC
  Device reconfigure should be done without close which releases
all transmit and receive queue. ethdev API assumes that previously
setup queues (minimum from configured before and now) are kept
across device reconfigure.

Fixes: aaa3f5f0f79d ("net/sfc: add configure and close stubs")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
---
 drivers/net/sfc/sfc.c        |  3 ++-
 drivers/net/sfc/sfc.h        | 28 ++++++++++++++--------------
 drivers/net/sfc/sfc_ethdev.c |  2 --
 3 files changed, 16 insertions(+), 17 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 22141c6..4e241b2 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -398,7 +398,8 @@  sfc_configure(struct sfc_adapter *sa)
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
-	SFC_ASSERT(sa->state == SFC_ADAPTER_INITIALIZED);
+	SFC_ASSERT(sa->state == SFC_ADAPTER_INITIALIZED ||
+		   sa->state == SFC_ADAPTER_CONFIGURED);
 	sa->state = SFC_ADAPTER_CONFIGURING;
 
 	rc = sfc_check_conf(sa);
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index cee1eb8..fad0ce0 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -64,20 +64,20 @@  extern "C" {
  *	V			|
  * +---------------+------------+
  * |  INITIALIZED  |
- * +---------------+<-----------+
- *	|.dev_configure		|
- *	V			|
- * +---------------+		|
- * |  CONFIGURING  |------------^
- * +---------------+ failed	|
- *	|success		|
- *	|		+---------------+
- *	|		|    CLOSING    |
- *	|		+---------------+
- *	|			^
- *	V			|.dev_close
- * +---------------+------------+
- * |  CONFIGURED   |
+ * +---------------+<-----------<---------------+
+ *	|.dev_configure		|		|
+ *	V			|failed		|
+ * +---------------+------------+		|
+ * |  CONFIGURING  |				|
+ * +---------------+----+			|
+ *	|success	|			|
+ *	|		|		+---------------+
+ *	|		|		|    CLOSING    |
+ *	|		|		+---------------+
+ *	|		|			^
+ *	V		|.dev_configure		|
+ * +---------------+----+			|.dev_close
+ * |  CONFIGURED   |----------------------------+
  * +---------------+<-----------+
  *	|.dev_start		|
  *	V			|
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 7edb17d..4f7b640 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -192,8 +192,6 @@  sfc_dev_configure(struct rte_eth_dev *dev)
 	sfc_adapter_lock(sa);
 	switch (sa->state) {
 	case SFC_ADAPTER_CONFIGURED:
-		sfc_close(sa);
-		SFC_ASSERT(sa->state == SFC_ADAPTER_INITIALIZED);
 		/* FALLTHROUGH */
 	case SFC_ADAPTER_INITIALIZED:
 		rc = sfc_configure(sa);