Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Jun 2021 11:12:40 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 58632fa7a386 - main - iflib: Add a new quirk
Message-ID:  <202106241112.15OBCerB065248@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=58632fa7a386f6338996b945fb38e807fc44db72

commit 58632fa7a386f6338996b945fb38e807fc44db72
Author:     Marcin Wojtas <mw@FreeBSD.org>
AuthorDate: 2021-05-19 09:09:16 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2021-06-24 11:00:56 +0000

    iflib: Add a new quirk
    
    ENETC NIC found in LS1028A has a bug where clearing TX pidx/cidx
    causes the ring to hang after being re-enabled.
    Add a new flag, if set iflib will preserve the indices during restart.
    
    Submitted by: Kornel Duleba <mindal@semihalf.com>
    Reviewed by: gallatin, erj
    Obtained from: Semihalf
    Sponsored by: Alstom Group
    Differential Revision: https://reviews.freebsd.org/D30728
---
 sys/net/iflib.c | 7 ++++++-
 sys/net/iflib.h | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 01da882f0d12..ea3754a07ee6 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -2604,7 +2604,12 @@ iflib_stop(if_ctx_t ctx)
 			iflib_txsd_free(ctx, txq, j);
 		}
 		txq->ift_processed = txq->ift_cleaned = txq->ift_cidx_processed = 0;
-		txq->ift_in_use = txq->ift_gen = txq->ift_cidx = txq->ift_pidx = txq->ift_no_desc_avail = 0;
+		txq->ift_in_use = txq->ift_gen = txq->ift_no_desc_avail = 0;
+		if (sctx->isc_flags & IFLIB_PRESERVE_TX_INDICES)
+			txq->ift_cidx = txq->ift_pidx;
+		else
+			txq->ift_cidx = txq->ift_pidx = 0;
+
 		txq->ift_closed = txq->ift_mbuf_defrag = txq->ift_mbuf_defrag_failed = 0;
 		txq->ift_no_tx_dma_setup = txq->ift_txd_encap_efbig = txq->ift_map_failed = 0;
 		txq->ift_pullups = 0;
diff --git a/sys/net/iflib.h b/sys/net/iflib.h
index f88294b3d01a..b6dcf6311d2b 100644
--- a/sys/net/iflib.h
+++ b/sys/net/iflib.h
@@ -402,6 +402,10 @@ typedef enum {
  * Interface has an admin completion queue
  */
 #define IFLIB_HAS_ADMINCQ	0x100000
+/*
+ * Interface needs to preserve TX ring indices across restarts.
+ */
+#define IFLIB_PRESERVE_TX_INDICES	0x200000
 
 /*
  * These enum values are used in iflib_needs_restart to indicate to iflib



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106241112.15OBCerB065248>