git: 6792568fe268 - main - cxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Mon, 10 Jan 2022 20:23:52 UTC
The branch main has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=6792568fe2687db960cb02cfc744b2e87947d38b

commit 6792568fe2687db960cb02cfc744b2e87947d38b
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2022-01-10 19:18:38 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2022-01-10 20:15:12 +0000

    cxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgb/cxgb_adapter.h  |  2 +-
 sys/dev/cxgb/cxgb_osdep.h    | 15 +++------------
 sys/dev/cxgb/cxgb_sge.c      | 27 +++------------------------
 sys/dev/cxgb/cxgb_t3fw.c     | 15 +++++----------
 sys/dev/cxgb/sys/uipc_mvec.c |  2 --
 5 files changed, 12 insertions(+), 49 deletions(-)

diff --git a/sys/dev/cxgb/cxgb_adapter.h b/sys/dev/cxgb/cxgb_adapter.h
index 97e7d96ec7aa..ae5fa9f357c8 100644
--- a/sys/dev/cxgb/cxgb_adapter.h
+++ b/sys/dev/cxgb/cxgb_adapter.h
@@ -117,7 +117,7 @@ struct port_info {
 #define PORT_NAME_LEN 32
 	char            lockbuf[PORT_LOCK_NAME_LEN];
 	char            namebuf[PORT_NAME_LEN];
-} __aligned(L1_CACHE_BYTES);
+} __aligned(CACHE_LINE_SIZE);
 
 enum {
 	/* adapter flags */
diff --git a/sys/dev/cxgb/cxgb_osdep.h b/sys/dev/cxgb/cxgb_osdep.h
index ceccbe4178df..e3f745fee020 100644
--- a/sys/dev/cxgb/cxgb_osdep.h
+++ b/sys/dev/cxgb/cxgb_osdep.h
@@ -94,28 +94,19 @@ struct t3_mbuf_hdr {
 #define TX_WR_COUNT_MAX         7              /* the maximum total number of packets that can be
 						* aggregated into a single TX WR
 						*/
-#if defined(__i386__) || defined(__amd64__)  
 
-static __inline
-void prefetch(void *x) 
-{ 
-        __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
-}
+#define prefetch(x) __builtin_prefetch(x)
 
+#if defined(__i386__) || defined(__amd64__)
 #define smp_mb() mb()
-
-#define L1_CACHE_BYTES 128
 #define WARN_ON(condition) do { \
 	if (__predict_false((condition)!=0)) {  \
                 log(LOG_WARNING, "BUG: warning at %s:%d/%s()\n", __FILE__, __LINE__, __FUNCTION__); \
                 kdb_backtrace(); \
         } \
 } while (0)
-
-#else 
+#else
 #define smp_mb()
-#define prefetch(x)
-#define L1_CACHE_BYTES 32
 #endif
 
 #define DBG_RX          (1 << 0)
diff --git a/sys/dev/cxgb/cxgb_sge.c b/sys/dev/cxgb/cxgb_sge.c
index eb9d8f51dcd3..dbc0ddea6b7c 100644
--- a/sys/dev/cxgb/cxgb_sge.c
+++ b/sys/dev/cxgb/cxgb_sge.c
@@ -2105,27 +2105,8 @@ t3_sge_start(adapter_t *sc)
 void
 t3_sge_stop(adapter_t *sc)
 {
-	int i, nqsets;
-	
-	t3_set_reg_field(sc, A_SG_CONTROL, F_GLOBALENABLE, 0);
 
-	if (sc->tq == NULL)
-		return;
-	
-	for (nqsets = i = 0; i < (sc)->params.nports; i++) 
-		nqsets += sc->port[i].nqsets;
-#ifdef notyet
-	/*
-	 * 
-	 * XXX
-	 */
-	for (i = 0; i < nqsets; ++i) {
-		struct sge_qset *qs = &sc->sge.qs[i];
-		
-		taskqueue_drain(sc->tq, &qs->txq[TXQ_OFLD].qresume_task);
-		taskqueue_drain(sc->tq, &qs->txq[TXQ_CTRL].qresume_task);
-	}
-#endif
+	t3_set_reg_field(sc, A_SG_CONTROL, F_GLOBALENABLE, 0);
 }
 
 /**
@@ -2337,11 +2318,9 @@ restart_offloadq(void *data, int npending)
 	struct sge_qset *qs = data;
 	struct sge_txq *q = &qs->txq[TXQ_OFLD];
 	adapter_t *adap = qs->port->adapter;
-	int cleaned;
-		
-	TXQ_LOCK(qs);
-again:	cleaned = reclaim_completed_tx(qs, 16, TXQ_OFLD);
 
+	TXQ_LOCK(qs);
+again:
 	while ((m = mbufq_first(&q->sendq)) != NULL) {
 		unsigned int gen, pidx;
 		struct ofld_hdr *oh = mtod(m, struct ofld_hdr *);
diff --git a/sys/dev/cxgb/cxgb_t3fw.c b/sys/dev/cxgb/cxgb_t3fw.c
index 44a41031aaa6..a084cae0f971 100644
--- a/sys/dev/cxgb/cxgb_t3fw.c
+++ b/sys/dev/cxgb/cxgb_t3fw.c
@@ -19,7 +19,7 @@ __FBSDID("$FreeBSD$");
 static int
 cxgb_t3fw_modevent(module_t mod, int type, void *unused)
 {
-	const struct firmware *fp, *parent;
+	const struct firmware *fp;
 	int error;
 	switch (type) {
 	case MOD_LOAD:
@@ -29,7 +29,6 @@ cxgb_t3fw_modevent(module_t mod, int type, void *unused)
 				       0, NULL);
 		if (fp == NULL)
 			goto fail_0;
-		parent = fp;
 		return (0);
 	fail_0:
 		return (ENXIO);
@@ -52,7 +51,7 @@ MODULE_DEPEND(cxgb_t3fw, firmware, 1, 1, 1);
 static int
 cxgb_t3b_protocol_sram_modevent(module_t mod, int type, void *unused)
 {
-	const struct firmware *fp, *parent;
+	const struct firmware *fp;
 	int error;
 	switch (type) {
 	case MOD_LOAD:
@@ -62,7 +61,6 @@ cxgb_t3b_protocol_sram_modevent(module_t mod, int type, void *unused)
 				       0, NULL);
 		if (fp == NULL)
 			goto fail_0;
-		parent = fp;
 		return (0);
 	fail_0:
 		return (ENXIO);
@@ -85,7 +83,7 @@ MODULE_DEPEND(cxgb_t3b_protocol_sram, firmware, 1, 1, 1);
 static int
 cxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused)
 {
-	const struct firmware *fp, *parent;
+	const struct firmware *fp;
 	int error;
 	switch (type) {
 	case MOD_LOAD:
@@ -95,7 +93,6 @@ cxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused)
 				       0, NULL);
 		if (fp == NULL)
 			goto fail_0;
-		parent = fp;
 		return (0);
 	fail_0:
 		return (ENXIO);
@@ -118,7 +115,7 @@ MODULE_DEPEND(cxgb_t3b_tp_eeprom, firmware, 1, 1, 1);
 static int
 cxgb_t3c_protocol_sram_modevent(module_t mod, int type, void *unused)
 {
-	const struct firmware *fp, *parent;
+	const struct firmware *fp;
 	int error;
 	switch (type) {
 	case MOD_LOAD:
@@ -128,7 +125,6 @@ cxgb_t3c_protocol_sram_modevent(module_t mod, int type, void *unused)
 				       0, NULL);
 		if (fp == NULL)
 			goto fail_0;
-		parent = fp;
 		return (0);
 	fail_0:
 		return (ENXIO);
@@ -151,7 +147,7 @@ MODULE_DEPEND(cxgb_t3c_protocol_sram, firmware, 1, 1, 1);
 static int
 cxgb_t3c_tp_eeprom_modevent(module_t mod, int type, void *unused)
 {
-	const struct firmware *fp, *parent;
+	const struct firmware *fp;
 	int error;
 	switch (type) {
 	case MOD_LOAD:
@@ -161,7 +157,6 @@ cxgb_t3c_tp_eeprom_modevent(module_t mod, int type, void *unused)
 				       0, NULL);
 		if (fp == NULL)
 			goto fail_0;
-		parent = fp;
 		return (0);
 	fail_0:
 		return (ENXIO);
diff --git a/sys/dev/cxgb/sys/uipc_mvec.c b/sys/dev/cxgb/sys/uipc_mvec.c
index 02f437079468..2ee01324f1da 100644
--- a/sys/dev/cxgb/sys/uipc_mvec.c
+++ b/sys/dev/cxgb/sys/uipc_mvec.c
@@ -57,13 +57,11 @@ busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map,
 {
 	struct mbuf *n = *m;
 	int seg_count, defragged = 0, err = 0;
-	bus_dma_segment_t *psegs;
 	
 	KASSERT(n->m_pkthdr.len, ("packet has zero header len"));
 	if (n->m_pkthdr.len <= PIO_LEN)
 		return (0);
 retry:
-	psegs = segs;
 	seg_count = 0;
 	err = bus_dmamap_load_mbuf_sg(tag, map, *m, segs, &seg_count, 0);
 	if (seg_count == 0) {