DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code
@ 2017-05-27  7:55 Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 2/5] net/sfc/base: let caller know that queue is already flushed Andrew Rybchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2017-05-27  7:55 UTC (permalink / raw)
  To: dev; +Cc: Andy Moreton, stable

From: Andy Moreton <amoreton@solarflare.com>

MCDI results retuerned in req.emr_rc have already been translated
from MC_CMD_ERR_* to errno names, so using an MC_CMD_ERR_* value
is incorrect.

Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")
Cc: stable@dpdk.org

Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_rx.c | 2 +-
 drivers/net/sfc/base/ef10_tx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c
index b65faed..9d6756c 100644
--- a/drivers/net/sfc/base/ef10_rx.c
+++ b/drivers/net/sfc/base/ef10_rx.c
@@ -137,7 +137,7 @@ efx_mcdi_fini_rxq(
 
 	efx_mcdi_execute_quiet(enp, &req);
 
-	if ((req.emr_rc != 0) && (req.emr_rc != MC_CMD_ERR_EALREADY)) {
+	if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) {
 		rc = req.emr_rc;
 		goto fail1;
 	}
diff --git a/drivers/net/sfc/base/ef10_tx.c b/drivers/net/sfc/base/ef10_tx.c
index 0f8e9b1..dfa9e0b 100644
--- a/drivers/net/sfc/base/ef10_tx.c
+++ b/drivers/net/sfc/base/ef10_tx.c
@@ -148,7 +148,7 @@ efx_mcdi_fini_txq(
 
 	efx_mcdi_execute_quiet(enp, &req);
 
-	if ((req.emr_rc != 0) && (req.emr_rc != MC_CMD_ERR_EALREADY)) {
+	if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) {
 		rc = req.emr_rc;
 		goto fail1;
 	}
-- 
2.9.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/5] net/sfc/base: let caller know that queue is already flushed
  2017-05-27  7:55 [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Andrew Rybchenko
@ 2017-05-27  7:55 ` Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 3/5] net/sfc: handle already flushed Rx queue gracefully Andrew Rybchenko
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2017-05-27  7:55 UTC (permalink / raw)
  To: dev; +Cc: Andy Moreton

From: Andy Moreton <amoreton@solarflare.com>

Tx/Rx queue may be already flushed due to Tx/Rx error on the queue or
MC reboot. Caller needs to know that the queue is already flushed to
avoid waiting for flush done event.

Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_ev.c |  7 ++++++-
 drivers/net/sfc/base/ef10_rx.c | 18 +++++++++++++++---
 drivers/net/sfc/base/ef10_tx.c | 18 +++++++++++++++---
 3 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_ev.c b/drivers/net/sfc/base/ef10_ev.c
index 3522674..d9389da 100644
--- a/drivers/net/sfc/base/ef10_ev.c
+++ b/drivers/net/sfc/base/ef10_ev.c
@@ -431,7 +431,12 @@ efx_mcdi_fini_evq(
 	return (0);
 
 fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	/*
+	 * EALREADY is not an error, but indicates that the MC has rebooted and
+	 * that the EVQ has already been destroyed.
+	 */
+	if (rc != EALREADY)
+		EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
 	return (rc);
 }
diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c
index 9d6756c..661caa8 100644
--- a/drivers/net/sfc/base/ef10_rx.c
+++ b/drivers/net/sfc/base/ef10_rx.c
@@ -137,7 +137,7 @@ efx_mcdi_fini_rxq(
 
 	efx_mcdi_execute_quiet(enp, &req);
 
-	if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) {
+	if (req.emr_rc != 0) {
 		rc = req.emr_rc;
 		goto fail1;
 	}
@@ -145,7 +145,12 @@ efx_mcdi_fini_rxq(
 	return (0);
 
 fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	/*
+	 * EALREADY is not an error, but indicates that the MC has rebooted and
+	 * that the RXQ has already been destroyed.
+	 */
+	if (rc != EALREADY)
+		EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
 	return (rc);
 }
@@ -802,7 +807,14 @@ ef10_rx_qflush(
 	return (0);
 
 fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	/*
+	 * EALREADY is not an error, but indicates that the MC has rebooted and
+	 * that the RXQ has already been destroyed. Callers need to know that
+	 * the RXQ flush has completed to avoid waiting until timeout for a
+	 * flush done event that will not be delivered.
+	 */
+	if (rc != EALREADY)
+		EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
 	return (rc);
 }
diff --git a/drivers/net/sfc/base/ef10_tx.c b/drivers/net/sfc/base/ef10_tx.c
index dfa9e0b..211d265 100644
--- a/drivers/net/sfc/base/ef10_tx.c
+++ b/drivers/net/sfc/base/ef10_tx.c
@@ -148,7 +148,7 @@ efx_mcdi_fini_txq(
 
 	efx_mcdi_execute_quiet(enp, &req);
 
-	if ((req.emr_rc != 0) && (req.emr_rc != EALREADY)) {
+	if (req.emr_rc != 0) {
 		rc = req.emr_rc;
 		goto fail1;
 	}
@@ -156,7 +156,12 @@ efx_mcdi_fini_txq(
 	return (0);
 
 fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	/*
+	 * EALREADY is not an error, but indicates that the MC has rebooted and
+	 * that the TXQ has already been destroyed.
+	 */
+	if (rc != EALREADY)
+		EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
 	return (rc);
 }
@@ -675,7 +680,14 @@ ef10_tx_qflush(
 	return (0);
 
 fail1:
-	EFSYS_PROBE1(fail1, efx_rc_t, rc);
+	/*
+	 * EALREADY is not an error, but indicates that the MC has rebooted and
+	 * that the TXQ has already been destroyed. Callers need to know that
+	 * the TXQ flush has completed to avoid waiting until timeout for a
+	 * flush done event that will not be delivered.
+	 */
+	if (rc != EALREADY)
+		EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
 	return (rc);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 3/5] net/sfc: handle already flushed Rx queue gracefully
  2017-05-27  7:55 [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 2/5] net/sfc/base: let caller know that queue is already flushed Andrew Rybchenko
@ 2017-05-27  7:55 ` Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 4/5] net/sfc: add Tx queue flush failed flag for sanity Andrew Rybchenko
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2017-05-27  7:55 UTC (permalink / raw)
  To: dev

Rx queue may be already flushed because of previous Rx error or
MC reboot.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_rx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 122b657..325f32a 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -529,6 +529,7 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
 	struct sfc_rxq *rxq;
 	unsigned int retry_count;
 	unsigned int wait_count;
+	int rc;
 
 	rxq = sa->rxq_info[sw_index].rxq;
 	SFC_ASSERT(rxq->state & SFC_RXQ_STARTED);
@@ -541,8 +542,10 @@ sfc_rx_qflush(struct sfc_adapter *sa, unsigned int sw_index)
 	     ((rxq->state & SFC_RXQ_FLUSHED) == 0) &&
 	     (retry_count < SFC_RX_QFLUSH_ATTEMPTS);
 	     ++retry_count) {
-		if (efx_rx_qflush(rxq->common) != 0) {
-			rxq->state |= SFC_RXQ_FLUSH_FAILED;
+		rc = efx_rx_qflush(rxq->common);
+		if (rc != 0) {
+			rxq->state |= (rc == EALREADY) ?
+				SFC_RXQ_FLUSHED : SFC_RXQ_FLUSH_FAILED;
 			break;
 		}
 		rxq->state &= ~SFC_RXQ_FLUSH_FAILED;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 4/5] net/sfc: add Tx queue flush failed flag for sanity
  2017-05-27  7:55 [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 2/5] net/sfc/base: let caller know that queue is already flushed Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 3/5] net/sfc: handle already flushed Rx queue gracefully Andrew Rybchenko
@ 2017-05-27  7:55 ` Andrew Rybchenko
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 5/5] net/sfc: handle already flushed Tx queue gracefully Andrew Rybchenko
  2017-05-30 12:08 ` [dpdk-dev] [dpdk-stable] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2017-05-27  7:55 UTC (permalink / raw)
  To: dev; +Cc: stable

Avoid usage of flushing state when Tx queue flush init failed.

Fixes: fed9aeb46c19 ("net/sfc: implement transmit path start / stop")
Cc: stable@dpdk.org

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_tx.c | 2 +-
 drivers/net/sfc/sfc_tx.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index d75fb84..9e426ca 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -503,7 +503,7 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 	     (retry_count < SFC_TX_QFLUSH_ATTEMPTS);
 	     ++retry_count) {
 		if (efx_tx_qflush(txq->common) != 0) {
-			txq->state |= SFC_TXQ_FLUSHING;
+			txq->state |= SFC_TXQ_FLUSH_FAILED;
 			break;
 		}
 
diff --git a/drivers/net/sfc/sfc_tx.h b/drivers/net/sfc/sfc_tx.h
index 6c3ac3b..0c1c708 100644
--- a/drivers/net/sfc/sfc_tx.h
+++ b/drivers/net/sfc/sfc_tx.h
@@ -64,6 +64,8 @@ enum sfc_txq_state_bit {
 #define SFC_TXQ_FLUSHING	(1 << SFC_TXQ_FLUSHING_BIT)
 	SFC_TXQ_FLUSHED_BIT,
 #define SFC_TXQ_FLUSHED		(1 << SFC_TXQ_FLUSHED_BIT)
+	SFC_TXQ_FLUSH_FAILED_BIT,
+#define SFC_TXQ_FLUSH_FAILED	(1 << SFC_TXQ_FLUSH_FAILED_BIT)
 };
 
 /**
-- 
2.9.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 5/5] net/sfc: handle already flushed Tx queue gracefully
  2017-05-27  7:55 [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Andrew Rybchenko
                   ` (2 preceding siblings ...)
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 4/5] net/sfc: add Tx queue flush failed flag for sanity Andrew Rybchenko
@ 2017-05-27  7:55 ` Andrew Rybchenko
  2017-05-30 12:08 ` [dpdk-dev] [dpdk-stable] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2017-05-27  7:55 UTC (permalink / raw)
  To: dev

Tx queue may be already flushed because of previous Tx error or
MC reboot.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_tx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c
index 9e426ca..fc439cb 100644
--- a/drivers/net/sfc/sfc_tx.c
+++ b/drivers/net/sfc/sfc_tx.c
@@ -479,6 +479,7 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 	struct sfc_txq *txq;
 	unsigned int retry_count;
 	unsigned int wait_count;
+	int rc;
 
 	sfc_log_init(sa, "TxQ = %u", sw_index);
 
@@ -502,8 +503,10 @@ sfc_tx_qstop(struct sfc_adapter *sa, unsigned int sw_index)
 	     ((txq->state & SFC_TXQ_FLUSHED) == 0) &&
 	     (retry_count < SFC_TX_QFLUSH_ATTEMPTS);
 	     ++retry_count) {
-		if (efx_tx_qflush(txq->common) != 0) {
-			txq->state |= SFC_TXQ_FLUSH_FAILED;
+		rc = efx_tx_qflush(txq->common);
+		if (rc != 0) {
+			txq->state |= (rc == EALREADY) ?
+				SFC_TXQ_FLUSHED : SFC_TXQ_FLUSH_FAILED;
 			break;
 		}
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code
  2017-05-27  7:55 [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Andrew Rybchenko
                   ` (3 preceding siblings ...)
  2017-05-27  7:55 ` [dpdk-dev] [PATCH 5/5] net/sfc: handle already flushed Tx queue gracefully Andrew Rybchenko
@ 2017-05-30 12:08 ` Ferruh Yigit
  4 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-05-30 12:08 UTC (permalink / raw)
  To: Andrew Rybchenko, dev; +Cc: Andy Moreton, stable

On 5/27/2017 8:55 AM, Andrew Rybchenko wrote:
> From: Andy Moreton <amoreton@solarflare.com>
> 
> MCDI results retuerned in req.emr_rc have already been translated
> from MC_CMD_ERR_* to errno names, so using an MC_CMD_ERR_* value
> is incorrect.
> 
> Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Andy Moreton <amoreton@solarflare.com>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-30 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-27  7:55 [dpdk-dev] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Andrew Rybchenko
2017-05-27  7:55 ` [dpdk-dev] [PATCH 2/5] net/sfc/base: let caller know that queue is already flushed Andrew Rybchenko
2017-05-27  7:55 ` [dpdk-dev] [PATCH 3/5] net/sfc: handle already flushed Rx queue gracefully Andrew Rybchenko
2017-05-27  7:55 ` [dpdk-dev] [PATCH 4/5] net/sfc: add Tx queue flush failed flag for sanity Andrew Rybchenko
2017-05-27  7:55 ` [dpdk-dev] [PATCH 5/5] net/sfc: handle already flushed Tx queue gracefully Andrew Rybchenko
2017-05-30 12:08 ` [dpdk-dev] [dpdk-stable] [PATCH 1/5] net/sfc/base: fix incorrect error code usage in common code Ferruh Yigit

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).