Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2018 09:35:53 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341784 - head/sys/dev/sfxge
Message-ID:  <201812100935.wBA9Zr63002463@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Mon Dec 10 09:35:53 2018
New Revision: 341784
URL: https://svnweb.freebsd.org/changeset/base/341784

Log:
  sfxge(4): prepare the number of Tx queues on event queue 0 to become variable
  
  The number of Tx queues on event queue 0 can depend on the NIC family type,
  and this property will be leveraged by future patches.
  This patch prepares the code for this change.
  
  Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      1 week
  Differential Revision:  https://reviews.freebsd.org/D18389

Modified:
  head/sys/dev/sfxge/sfxge.c
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge.c
==============================================================================
--- head/sys/dev/sfxge/sfxge.c	Mon Dec 10 09:35:45 2018	(r341783)
+++ head/sys/dev/sfxge/sfxge.c	Mon Dec 10 09:35:53 2018	(r341784)
@@ -151,8 +151,8 @@ sfxge_estimate_rsrc_limits(struct sfxge_softc *sc)
 
 	limits.edl_min_evq_count = 1;
 	limits.edl_max_evq_count = evq_max;
-	limits.edl_min_txq_count = SFXGE_TXQ_NTYPES;
-	limits.edl_max_txq_count = evq_max + SFXGE_TXQ_NTYPES - 1;
+	limits.edl_min_txq_count = SFXGE_EVQ0_N_TXQ(sc);
+	limits.edl_max_txq_count = evq_max + SFXGE_EVQ0_N_TXQ(sc) - 1;
 	limits.edl_min_rxq_count = 1;
 	limits.edl_max_rxq_count = evq_max;
 
@@ -168,12 +168,12 @@ sfxge_estimate_rsrc_limits(struct sfxge_softc *sc)
 		return (rc);
 	}
 
-	KASSERT(txq_allocated >= SFXGE_TXQ_NTYPES,
-		("txq_allocated < SFXGE_TXQ_NTYPES"));
+	KASSERT(txq_allocated >= SFXGE_EVQ0_N_TXQ(sc),
+		("txq_allocated < %u", SFXGE_EVQ0_N_TXQ(sc)));
 
 	sc->evq_max = MIN(evq_allocated, evq_max);
 	sc->evq_max = MIN(rxq_allocated, sc->evq_max);
-	sc->evq_max = MIN(txq_allocated - (SFXGE_TXQ_NTYPES - 1),
+	sc->evq_max = MIN(txq_allocated - (SFXGE_EVQ0_N_TXQ(sc) - 1),
 			  sc->evq_max);
 
 	KASSERT(sc->evq_max <= evq_max,
@@ -205,7 +205,7 @@ sfxge_set_drv_limits(struct sfxge_softc *sc)
 	limits.edl_min_evq_count = limits.edl_max_evq_count =
 	    sc->intr.n_alloc;
 	limits.edl_min_txq_count = limits.edl_max_txq_count =
-	    sc->intr.n_alloc + SFXGE_TXQ_NTYPES - 1;
+	    sc->intr.n_alloc + SFXGE_EVQ0_N_TXQ(sc) - 1;
 	limits.edl_min_rxq_count = limits.edl_max_rxq_count =
 	    sc->intr.n_alloc;
 

Modified: head/sys/dev/sfxge/sfxge_ev.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_ev.c	Mon Dec 10 09:35:45 2018	(r341783)
+++ head/sys/dev/sfxge/sfxge_ev.c	Mon Dec 10 09:35:53 2018	(r341784)
@@ -269,9 +269,10 @@ sfxge_get_txq_by_label(struct sfxge_evq *evq, enum sfx
 {
 	unsigned int index;
 
-	KASSERT((evq->index == 0 && label < SFXGE_TXQ_NTYPES) ||
+	KASSERT((evq->index == 0 && label < SFXGE_EVQ0_N_TXQ(evq->sc)) ||
 	    (label == SFXGE_TXQ_IP_TCP_UDP_CKSUM), ("unexpected txq label"));
-	index = (evq->index == 0) ? label : (evq->index - 1 + SFXGE_TXQ_NTYPES);
+	index = (evq->index == 0) ?
+		label : (evq->index - 1 + SFXGE_EVQ0_N_TXQ(evq->sc));
 	return (evq->sc->txq[index]);
 }
 

Modified: head/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.c	Mon Dec 10 09:35:45 2018	(r341783)
+++ head/sys/dev/sfxge/sfxge_tx.c	Mon Dec 10 09:35:53 2018	(r341784)
@@ -1973,7 +1973,7 @@ sfxge_tx_init(struct sfxge_softc *sc)
 		goto fail_tx_dpl_put_max;
 	}
 
-	sc->txq_count = SFXGE_TXQ_NTYPES - 1 + sc->intr.n_alloc;
+	sc->txq_count = SFXGE_EVQ0_N_TXQ(sc) - 1 + sc->intr.n_alloc;
 
 	sc->tso_fw_assisted = sfxge_tso_fw_assisted;
 	if ((~encp->enc_features & EFX_FEATURE_FW_ASSISTED_TSO) ||
@@ -2002,9 +2002,9 @@ sfxge_tx_init(struct sfxge_softc *sc)
 		goto fail2;
 
 	for (index = 0;
-	     index < sc->txq_count - SFXGE_TXQ_NTYPES + 1;
+	     index < sc->txq_count - SFXGE_EVQ0_N_TXQ(sc) + 1;
 	     index++) {
-		if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_NTYPES - 1 + index,
+		if ((rc = sfxge_tx_qinit(sc, SFXGE_EVQ0_N_TXQ(sc) - 1 + index,
 		    SFXGE_TXQ_IP_TCP_UDP_CKSUM, index)) != 0)
 			goto fail3;
 	}

Modified: head/sys/dev/sfxge/sfxge_tx.h
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.h	Mon Dec 10 09:35:45 2018	(r341783)
+++ head/sys/dev/sfxge/sfxge_tx.h	Mon Dec 10 09:35:53 2018	(r341784)
@@ -139,6 +139,8 @@ enum sfxge_txq_type {
 	SFXGE_TXQ_NTYPES
 };
 
+#define	SFXGE_EVQ0_N_TXQ(_sc)	SFXGE_TXQ_NTYPES
+
 #define	SFXGE_TXQ_UNBLOCK_LEVEL(_entries)	(EFX_TXQ_LIMIT(_entries) / 4)
 
 #define	SFXGE_TX_BATCH	64



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