Skip to contentSkip to conversation

fix unused but set variables

PATCH In review Conor Walsh 8 participants 31 messages Nov 12, 2021 – Nov 16, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover fix unused but set variables

When DPDK is compiled with clang 13, several warnings for unused but set variables are present.

This patchset fixes these warnings, which were present within:
- app/test
- drivers/bus/fslmc
- drivers/common/qat
- drivers/event/sw
- drivers/net
- examples/performance-thread
- lib/power

I split this patchset into 7 patches grouped broadly by subdir, as this set touches code from a lot of different authors I thought it would make it easier to review.

Bugzilla ID: 881

Conor Walsh (7):
app/test: fix unused but set variables drivers/bus/fslmc: fix unused but set variables drivers/common/qat: fix unused but set variables drivers/event/sw: fix unused but set variables drivers/net: fix unused but set variables examples/performance-thread: fix unused but set variables lib/power: fix unused but set variables

 app/test/test_distributor_perf.c              |  3 ---
 app/test/test_thash_perf.c                    |  2 ++
 drivers/bus/fslmc/fslmc_bus.c                 |  2 --
 drivers/common/qat/qat_pf2vf.c                |  2 --
 drivers/event/sw/sw_evdev.c                   |  2 --
 drivers/net/bnxt/bnxt_rxr.c                   | 22 -------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c       |  6 -----
 drivers/net/liquidio/lio_rxtx.c               |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c              |  6 ++---
 drivers/net/octeontx/octeontx_rxtx.h          |  3 +--
 drivers/net/qede/base/ecore_vf.c              |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c           |  2 ++
 drivers/net/vmxnet3/vmxnet3_rxtx.c            |  8 +++++++
 .../performance-thread/l3fwd-thread/main.c    |  3 ---
 lib/power/rte_power_empty_poll.c              |  3 +--
 16 files changed, 17 insertions(+), 57 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/7 app/test: fix unused but set variables

This patch fixes unused but set variables within the following test apps:
- test distributor perf
- test thash perf

Bugzilla ID: 881

Fixes c0de0eb82e40 ("distributor: switch over to new API")
Fixes 239fffe0402e ("test/thash: add performance tests for Toeplitz hash")
---
 app/test/test_distributor_perf.c | 3 ---
 app/test/test_thash_perf.c       | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
app/test/test_distributor_perf.c +0 -3
index fdbeae6d2f..92e330f194 100644
@@ -108,7 +108,6 @@ static int
 handle_work(void *arg)
 {
 	struct rte_distributor *d = arg;
-	unsigned int count = 0;
 	unsigned int num = 0;
 	int i;
 	unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED);
@@ -120,11 +119,9 @@ handle_work(void *arg)
 	num = rte_distributor_get_pkt(d, id, buf, buf, num);
 	while (!quit) {
 		worker_stats[id].handled_packets += num;
-		count += num;
 		num = rte_distributor_get_pkt(d, id, buf, buf, num);
 	}
 	worker_stats[id].handled_packets += num;
-	count += num;
 	rte_distributor_return_pkt(d, id, buf, num);
 	return 0;
 }
app/test/test_thash_perf.c +2 -0
index 7aa9360120..c95785d8bb 100644
@@ -61,6 +61,8 @@ run_rss_calc(uint32_t *tuples[BATCH_SZ], enum test_rss_type type, int len,
 	}
 	end_tsc = rte_rdtsc_precise();
 
+	RTE_SET_USED(hash);
+
 	return end_tsc - start_tsc;
 }
 
Signature · 1 line
2.25.1
Acked-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] app/test: fix unused but set variables

Quoted 46 lines · Conor Walsh

This patch fixes unused but set variables within the following test apps:
- test distributor perf
- test thash perf

Bugzilla ID: 881

Fixes c0de0eb82e40 ("distributor: switch over to new API")
Fixes 239fffe0402e ("test/thash: add performance tests for Toeplitz hash")
---
  app/test/test_distributor_perf.c | 3 ---
  app/test/test_thash_perf.c       | 2 ++
  2 files changed, 2 insertions(+), 3 deletions(-)
app/test/test_distributor_perf.c +0 -3
index fdbeae6d2f..92e330f194 100644
@@ -108,7 +108,6 @@ static int
  handle_work(void *arg)
  {
  	struct rte_distributor *d = arg;
-	unsigned int count = 0;
  	unsigned int num = 0;
  	int i;
  	unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED);
@@ -120,11 +119,9 @@ handle_work(void *arg)
  	num = rte_distributor_get_pkt(d, id, buf, buf, num);
  	while (!quit) {
  		worker_stats[id].handled_packets += num;
-		count += num;
  		num = rte_distributor_get_pkt(d, id, buf, buf, num);
  	}
  	worker_stats[id].handled_packets += num;
-	count += num;
  	rte_distributor_return_pkt(d, id, buf, num);
  	return 0;
  }
app/test/test_thash_perf.c +0 -0
index 7aa9360120..c95785d8bb 100644

app/test/test_thash_perf.c run_rss_calc(uint32_t *tuples[BATCH_SZ], enum test_rss_type type, int len, · line 68

Quoted 8 lines
app/test/test_thash_perf.c +2 -0
@@ -61,6 +61,8 @@ run_rss_calc(uint32_t *tuples[BATCH_SZ], enum test_rss_type type, int len,
  	}
  	end_tsc = rte_rdtsc_precise();
 
+	RTE_SET_USED(hash);
+
  	return end_tsc - start_tsc;
  }
 
Signature · 2 lines
Regards,
Vladimir
#3 lore raw

PATCH 2/7 drivers/bus/fslmc: fix unused but set variables

In reply to Conor Walsh

This patch removes the device_count variable from the rte_fslmc_scan function within the fslmc bus driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
---
 drivers/bus/fslmc/fslmc_bus.c | 2 --
 1 file changed, 2 deletions(-)
drivers/bus/fslmc/fslmc_bus.c +0 -2
index ac3cb4aa5a..a0ef24cdc8 100644
@@ -315,7 +315,6 @@ static int
 rte_fslmc_scan(void)
 {
 	int ret;
-	int device_count = 0;
 	char fslmc_dirpath[PATH_MAX];
 	DIR *dir;
 	struct dirent *entry;
@@ -349,7 +348,6 @@ rte_fslmc_scan(void)
 			/* Error in parsing directory - exit gracefully */
 			goto scan_fail_cleanup;
 		}
-		device_count += 1;
 	}
 
 	closedir(dir);
Signature · 1 line
2.25.1
#4 lore raw

PATCH 3/7 drivers/common/qat: fix unused but set variables

In reply to Conor Walsh

This patch removes the us variable from the qat_pf2vf_exch_msg function within the PF to VF section of the QAT driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes b17d16fb47b4 ("common/qat: add PF to VF communication")
---
 drivers/common/qat/qat_pf2vf.c | 2 --
 1 file changed, 2 deletions(-)
drivers/common/qat/qat_pf2vf.c +0 -2
index 6327311199..4e9ffc72fc 100644
@@ -54,14 +54,12 @@ int qat_pf2vf_exch_msg(struct qat_pci_device *qat_dev,
 		msg |= ADF_PFVF_INT | ADF_PFVF_MSGORIGIN_SYSTEM;
 
 		ADF_CSR_WR(pmisc_bar_addr, vf_csr_off, msg);
-		int us = 0;
 		/*
 		 * Wait for confirmation from remote that it received
 		 * the message
 		 */
 		do {
 			rte_delay_us_sleep(5);
-			us += 5;
 			val = ADF_CSR_RD(pmisc_bar_addr, vf_csr_off);
 		} while ((val & ADF_PFVF_INT) &&
 			(++count < ADF_IOV_MSG_ACK_MAX_RETRY));
Signature · 1 line
2.25.1
#5 lore raw

PATCH 4/7 drivers/event/sw: fix unused but set variables

In reply to Conor Walsh

This patch removes the inflights variable from the sw_dump function within the software section of the event driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes c66baa68e453 ("event/sw: add dump function for easier debugging")
---
 drivers/event/sw/sw_evdev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/event/sw/sw_evdev.c +0 -2
index 070a4802e9..fa72ceb949 100644
@@ -711,7 +711,6 @@ sw_dump(struct rte_eventdev *dev, FILE *f)
 			continue;
 		}
 		int affinities_per_port[SW_PORTS_MAX] = {0};
-		uint32_t inflights = 0;
 
 		fprintf(f, "  Queue %d (%s)\n", i, q_type_strings[qid->type]);
 		fprintf(f, "\trx   %"PRIu64"\tdrop %"PRIu64"\ttx   %"PRIu64"\n",
@@ -732,7 +731,6 @@ sw_dump(struct rte_eventdev *dev, FILE *f)
 		for (flow = 0; flow < RTE_DIM(qid->fids); flow++)
 			if (qid->fids[flow].cq != -1) {
 				affinities_per_port[qid->fids[flow].cq]++;
-				inflights += qid->fids[flow].pcount;
 			}
 
 		uint32_t port;
Signature · 1 line
2.25.1
#6 lore raw

RE: [PATCH 4/7] drivers/event/sw: fix unused but set variables

Quoted 22 lines

-----Original Message-----
From: Walsh, Conor <[email protected]>
Sent: Friday, November 12, 2021 2:01 PM
To: Yigit, Ferruh <[email protected]>; [email protected]; Liang, LongfengX <[email protected]>; [email protected]
Cc: Hunt, David <[email protected]>; Wang, Yipeng1 <[email protected]>; Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>; Medvedkin, Vladimir <[email protected]>; [email protected]; [email protected]; Trahe, Fiona <[email protected]>; Griffin, John <[email protected]>; Jain, Deepak K <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Wang, Yong <[email protected]>; Mcnamara, John <[email protected]>; [email protected]; [email protected]; [email protected]; Zhang, Roy Fan <[email protected]>; Kusztal, ArkadiuszX <[email protected]>; [email protected]; [email protected]; [email protected];

Quoted 8 lines

[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Walsh, Conor <[email protected]>
Subject: [PATCH 4/7] drivers/event/sw: fix unused but set variables

-CC to just to people involved & list to avoid spamming too wide.

Quoted 10 lines

This patch removes the inflights variable from the sw_dump function within the software section of the event driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes c66baa68e453 ("event/sw: add dump function for easier debugging")

Acked by: Harry van Haaren <[email protected]>

#7 lore raw

PATCH 5/7 drivers/net: fix unused but set variables

In reply to Conor Walsh

This patch fixes unused but set variables in the following net drivers:
- bnxt
- hinic
- liquidio
- nfp
- octeontx
- qede
- txgbe
- vmxnet3

This patch also fixes an unused function warning for vmxnet3_unmap_pkt from within vmxnet3

Bugzilla ID: 881

Fixes b87abb2e55cb ("net/bnxt: support marking packet")
Fixes 88badb3aef94 ("net/bnxt: add helper functions for blob/regfile ops")
Fixes a4957d87e05a ("net/hinic/base: add mgmt module")
Fixes 5ee7640f95a0 ("net/liquidio: add API to flush IQ")
Fixes 19af5a38f7b6 ("net/nfp: move CPP bridge to separate file")
Fixes 9eb5cb3b11cc ("net/octeontx: fix access to indirect buffers")
Fixes 86a2265e59d7 ("qede: add SRIOV support")
Fixes b7311360fb67 ("net/txgbe: support VF interrupt")
Fixes c3ecdbb376da ("vmxnet3: support TSO")
---
 drivers/net/bnxt/bnxt_rxr.c             | 22 ----------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c     |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c |  6 ------
 drivers/net/liquidio/lio_rxtx.c         |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c        |  6 ++----
 drivers/net/octeontx/octeontx_rxtx.h    |  3 +--
 drivers/net/qede/base/ecore_vf.c        |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c     |  2 ++
 drivers/net/vmxnet3/vmxnet3_rxtx.c      |  8 ++++++++
 9 files changed, 14 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -22
index 8bc8ddc353..157297bc64 100644
@@ -823,9 +823,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
 			   struct rte_mbuf *mbuf)
 {
 	uint32_t cfa_code = 0;
-	uint8_t meta_fmt = 0;
-	uint16_t flags2 = 0;
-	uint32_t meta =  0;
 
 	cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
 	if (!cfa_code)
@@ -834,25 +831,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
 	if (cfa_code && !bp->mark_table[cfa_code].valid)
 		return;
 
-	flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
-	meta = rte_le_to_cpu_32(rxcmp1->metadata);
-	if (meta) {
-		meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
-
-		/* The flags field holds extra bits of info from [6:4]
-		 * which indicate if the flow is in TCAM or EM or EEM
-		 */
-		meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
-			   BNXT_CFA_META_FMT_SHFT;
-
-		/* meta_fmt == 4 => 'b100 => 'b10x => EM.
-		 * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
-		 * meta_fmt == 6 => 'b110 => 'b11x => EEM
-		 * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
-		 */
-		meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
-	}
-
 	mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
 	mbuf->ol_flags |= RTE_MBUF_F_RX_FDIR | RTE_MBUF_F_RX_FDIR_ID;
 }
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -3
index df3afaa6fd..c60d81d14a 100644
@@ -200,7 +200,6 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 {
 	int i;
 	int cnt = (len + 7) / 8;
-	int tlen = len;
 
 	/* Handle any remainder bits */
 	int tmp = len % 8;
@@ -211,12 +210,10 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 	ulp_bs_put_msb(bs, pos, tmp, val[0]);
 
 	pos += tmp;
-	tlen -= tmp;
 
 	for (i = 1; i < cnt; i++) {
 		ulp_bs_put_msb(bs, pos, 8, val[i]);
 		pos += 8;
-		tlen -= 8;
 	}
 
 	return len;
drivers/net/hinic/base/hinic_pmd_mgmt.c +0 -6
index 9b399502de..6ecca407a1 100644
@@ -133,16 +133,12 @@ static void prepare_header(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 static void prepare_mgmt_cmd(u8 *mgmt_cmd, u64 *header, void *msg,
 			     int msg_len)
 {
-	u32 cmd_buf_max = MAX_PF_MGMT_BUF_SIZE;
-
 	memset(mgmt_cmd, 0, MGMT_MSG_RSVD_FOR_DEV);
 
 	mgmt_cmd += MGMT_MSG_RSVD_FOR_DEV;
-	cmd_buf_max -= MGMT_MSG_RSVD_FOR_DEV;
 	memcpy(mgmt_cmd, header, sizeof(*header));
 
 	mgmt_cmd += sizeof(*header);
-	cmd_buf_max -= sizeof(*header);
 	memcpy(mgmt_cmd, msg, msg_len);
 }
 
@@ -615,7 +611,6 @@ static int recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 	void *msg_body = header + sizeof(msg_header);
 	u8 *dest_msg;
 	u8 seq_id, seq_len;
-	u32 msg_buf_max = MAX_PF_MGMT_BUF_SIZE;
 	u8 front_id;
 	u16 msg_id;
 
@@ -635,7 +630,6 @@ static int recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 	}
 
 	dest_msg = (u8 *)recv_msg->msg + seq_id * HINIC_MSG_SEG_LEN;
-	msg_buf_max -= seq_id * HINIC_MSG_SEG_LEN;
 	memcpy(dest_msg, msg_body, seq_len);
 
 	if (!HINIC_MSG_HEADER_GET(msg_header, LAST))
drivers/net/liquidio/lio_rxtx.c +0 -2
index ef127f26c4..e09798ddd7 100644
@@ -1050,7 +1050,6 @@ lio_update_read_index(struct lio_instr_queue *iq)
 int
 lio_flush_iq(struct lio_device *lio_dev, struct lio_instr_queue *iq)
 {
-	uint32_t tot_inst_processed = 0;
 	uint32_t inst_processed = 0;
 	int tx_done = 1;
 
@@ -1073,7 +1072,6 @@ lio_flush_iq(struct lio_device *lio_dev, struct lio_instr_queue *iq)
 			iq->stats.instr_processed += inst_processed;
 		}
 
-		tot_inst_processed += inst_processed;
 		inst_processed = 0;
 
 	} while (1);
drivers/net/nfp/nfp_cpp_bridge.c +2 -4
index 74a0eacb3f..0922ea9cf9 100644
@@ -58,7 +58,7 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
 	off_t offset, nfp_offset;
 	uint32_t cpp_id, pos, len;
 	uint32_t tmpbuf[16];
-	size_t count, curlen, totlen = 0;
+	size_t count, curlen;
 	int err = 0;
 
 	PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__,
@@ -135,7 +135,6 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
 		}
 
 		nfp_offset += pos;
-		totlen += pos;
 		nfp_cpp_area_release(area);
 		nfp_cpp_area_free(area);
 
@@ -160,7 +159,7 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 	off_t offset, nfp_offset;
 	uint32_t cpp_id, pos, len;
 	uint32_t tmpbuf[16];
-	size_t count, curlen, totlen = 0;
+	size_t count, curlen;
 	int err = 0;
 
 	PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__,
@@ -236,7 +235,6 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 		}
 
 		nfp_offset += pos;
-		totlen += pos;
 		nfp_cpp_area_release(area);
 		nfp_cpp_area_free(area);
 
drivers/net/octeontx/octeontx_rxtx.h +1 -2
index 56f11d3dd5..b63a5edfb3 100644
@@ -365,7 +365,7 @@ __octeontx_xmit_mseg_prepare(struct rte_mbuf *tx_pkt, uint64_t *cmd_buf,
 			const uint16_t flag)
 {
 	uint16_t nb_segs, nb_desc = 0;
-	uint16_t gaura_id, len = 0;
+	uint16_t gaura_id;
 	struct rte_mbuf *m_next = NULL, *m_tofree;
 	rte_iova_t iova;
 	uint16_t data_len;
@@ -425,7 +425,6 @@ __octeontx_xmit_mseg_prepare(struct rte_mbuf *tx_pkt, uint64_t *cmd_buf,
 		cmd_buf[nb_desc++] = iova;
 
 		nb_segs--;
-		len += data_len;
 		tx_pkt = m_next;
 	} while (nb_segs);
 
drivers/net/qede/base/ecore_vf.c +1 -4
index db03bc494f..a36ae47c2b 100644
@@ -73,7 +73,7 @@ static void ecore_vf_pf_req_end(struct ecore_hwfn *p_hwfn,
 #endif
 static enum _ecore_status_t
 ecore_send_msg2pf(struct ecore_hwfn *p_hwfn,
-		  u8 *done, u32 resp_size)
+		  u8 *done, __rte_unused u32 resp_size)
 {
 	union vfpf_tlvs *p_req = p_hwfn->vf_iov_info->vf2pf_request;
 	struct ustorm_trigger_vf_zone trigger;
@@ -86,9 +86,6 @@ ecore_send_msg2pf(struct ecore_hwfn *p_hwfn,
 	/* output tlvs list */
 	ecore_dp_tlv_list(p_hwfn, p_req);
 
-	/* need to add the END TLV to the message size */
-	resp_size += sizeof(struct channel_list_end_tlv);
-
 	/* Send TLVs over HW channel */
 	OSAL_MEMSET(&trigger, 0, sizeof(struct ustorm_trigger_vf_zone));
 	trigger.vf_pf_msg_valid = 1;
drivers/net/txgbe/txgbe_ethdev_vf.c +2 -0
index 67ae69dec3..be460ab733 100644
@@ -1291,6 +1291,8 @@ txgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev)
 	/* Workround for ICR lost */
 	intr->flags |= TXGBE_FLAG_MAILBOX;
 
+	RTE_SET_USED(eicr);
+
 	return 0;
 }
 
drivers/net/vmxnet3/vmxnet3_rxtx.c +8 -0
index deba64be6a..642c64dc2e 100644
@@ -294,6 +294,7 @@ vmxnet3_dev_clear_queues(struct rte_eth_dev *dev)
 	}
 }
 
+#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
 static int
 vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq)
 {
@@ -322,24 +323,31 @@ vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq)
 
 	return completed + 1;
 }
+#endif
 
 static void
 vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
 {
+	#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
 	int completed = 0;
+	#endif
 	vmxnet3_comp_ring_t *comp_ring = &txq->comp_ring;
 	struct Vmxnet3_TxCompDesc *tcd = (struct Vmxnet3_TxCompDesc *)
 		(comp_ring->base + comp_ring->next2proc);
 
 	while (tcd->gen == comp_ring->gen) {
+		#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
 		completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
+		#endif
 
 		vmxnet3_comp_ring_adv_next2proc(comp_ring);
 		tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
 						    comp_ring->next2proc);
 	}
 
+	#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
 	PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
+	#endif
 }
 
 uint16_t
Signature · 1 line
2.25.1
#8 lore raw

Re: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 14 lines · Conor Walsh
  static void
  vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
  {
drivers/net/vmxnet3/vmxnet3_rxtx.c +4 -0
+	#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
  	int completed = 0;
+	#endif
  	vmxnet3_comp_ring_t *comp_ring = &txq->comp_ring;
  	struct Vmxnet3_TxCompDesc *tcd = (struct Vmxnet3_TxCompDesc *)
  		(comp_ring->base + comp_ring->next2proc);
 
  	while (tcd->gen == comp_ring->gen) {
+		#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
  		completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
+		#endif

drivers/net/vmxnet3/vmxnet3_rxtx.c vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq) · line 351

Quoted 10 lines
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
 
  		vmxnet3_comp_ring_adv_next2proc(comp_ring);
  		tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
  						    comp_ring->next2proc);
  	}
 
+	#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
  	PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
+	#endif
  }

'PMD_TX_LOG' doesn't require 'RTE_LIBRTE_VMXNET3_DEBUG_TX' wrap.

#9 lore raw

Re: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 12 lines · Ferruh Yigit
Quoted 10 lines · Conor Walsh
  static void
  vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
  {
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+     #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
      int completed = 0;
+     #endif
      vmxnet3_comp_ring_t *comp_ring = &txq->comp_ring;
      struct Vmxnet3_TxCompDesc *tcd = (struct Vmxnet3_TxCompDesc *)
              (comp_ring->base + comp_ring->next2proc);
Quoted 4 lines

drivers/net/vmxnet3/vmxnet3_rxtx.c vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq) · line 341

Quoted 4 lines
      while (tcd->gen == comp_ring->gen) {
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+             #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
              completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
+             #endif

And this vmxnet_unmap_pkt does useful work.
We should probably still call it regardless of debug logs.

Quoted 13 lines

drivers/net/vmxnet3/vmxnet3_rxtx.c vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq) · line 351

Quoted 10 lines
              vmxnet3_comp_ring_adv_next2proc(comp_ring);
              tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
                                                  comp_ring->next2proc);
      }
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+     #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
      PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
+     #endif
  }

'PMD_TX_LOG' doesn't require 'RTE_LIBRTE_VMXNET3_DEBUG_TX' wrap.

Signature · 1 line
David Marchand
#10 lore raw

RE: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 15 lines

Subject: Re: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 12 lines · Ferruh Yigit
Quoted 10 lines · Conor Walsh
  static void
  vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
  {
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+     #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
      int completed = 0;
+     #endif
      vmxnet3_comp_ring_t *comp_ring = &txq->comp_ring;
      struct Vmxnet3_TxCompDesc *tcd = (struct Vmxnet3_TxCompDesc *)
              (comp_ring->base + comp_ring->next2proc);
Quoted 7 lines
Quoted 4 lines

drivers/net/vmxnet3/vmxnet3_rxtx.c vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq) · line 341

Quoted 4 lines
      while (tcd->gen == comp_ring->gen) {
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+             #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
              completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
+             #endif

And this vmxnet_unmap_pkt does useful work.
We should probably still call it regardless of debug logs.

Would something along the lines of this make more sense?

#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
#else
vmxnet3_unmap_pkt(tcd->txdIdx, txq);
#endif

Thanks,
Conor.

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines


              vmxnet3_comp_ring_adv_next2proc(comp_ring);
              tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
                                                  comp_ring->next2proc);
      }

+ #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.",

completed);

Quoted 5 lines
Quoted 2 lines

+ #endif
}

'PMD_TX_LOG' doesn't require 'RTE_LIBRTE_VMXNET3_DEBUG_TX' wrap.

--
David Marchand

#11 lore raw

Re: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 10 lines · Conor

Would something along the lines of this make more sense?

#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
#else
vmxnet3_unmap_pkt(tcd->txdIdx, txq);
#endif

Thanks,
Conor.

Why not just

	RTE_USED(completed);

#ifdef's introduce more testing issues.

#12 lore raw

RE: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 11 lines
Quoted 8 lines · Conor

Would something along the lines of this make more sense?

#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
#else
vmxnet3_unmap_pkt(tcd->txdIdx, txq);
#endif

Quoted 7 lines
Quoted 2 lines

Thanks,
Conor.

Why not just

	RTE_USED(completed);

#ifdef's introduce more testing issues.

That makes more sense, I'll change it to that in v2.

Thanks,
Conor.

#13 lore raw

RE: [PATCH 5/7] drivers/net: fix unused but set variables

In reply to Ferruh Yigit
Quoted 22 lines · Conor Walsh

drivers/net/vmxnet3/vmxnet3_rxtx.c vmxnet3_unmap_pkt(uint16_t eop_idx, vmxnet3_tx_queue_t *txq)

Quoted 8 lines
  static void
  vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
  {
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+	#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
  	int completed = 0;
+	#endif
  	vmxnet3_comp_ring_t *comp_ring = &txq->comp_ring;
  	struct Vmxnet3_TxCompDesc *tcd = (struct Vmxnet3_TxCompDesc

*)

Quoted 12 lines
  		(comp_ring->base + comp_ring->next2proc);

  	while (tcd->gen == comp_ring->gen) {
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -0
+		#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
  		completed += vmxnet3_unmap_pkt(tcd->txdIdx, txq);
+		#endif
 
  		vmxnet3_comp_ring_adv_next2proc(comp_ring);
  		tcd = (struct Vmxnet3_TxCompDesc *)(comp_ring->base +
  						    comp_ring->next2proc);
  	}
Quoted 7 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	#ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX
  	PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.",

completed);

Review

Quoted 2 lines
(quoted diff) +1 -0
+	#endif
  }

'PMD_TX_LOG' doesn't require 'RTE_LIBRTE_VMXNET3_DEBUG_TX' wrap.

Hi Ferruh,

I will rework in v2.

Thanks,
Conor.

#14 lore raw

Re: [PATCH 5/7] drivers/net: fix unused but set variables

In reply to Conor Walsh

Hello Ajit, Somnath,

Quoted 95 lines · Conor Walsh

This patch fixes unused but set variables in the following net drivers:
- bnxt
- hinic
- liquidio
- nfp
- octeontx
- qede
- txgbe
- vmxnet3

This patch also fixes an unused function warning for vmxnet3_unmap_pkt from within vmxnet3

Bugzilla ID: 881

Fixes b87abb2e55cb ("net/bnxt: support marking packet")
Fixes 88badb3aef94 ("net/bnxt: add helper functions for blob/regfile ops")
Fixes a4957d87e05a ("net/hinic/base: add mgmt module")
Fixes 5ee7640f95a0 ("net/liquidio: add API to flush IQ")
Fixes 19af5a38f7b6 ("net/nfp: move CPP bridge to separate file")
Fixes 9eb5cb3b11cc ("net/octeontx: fix access to indirect buffers")
Fixes 86a2265e59d7 ("qede: add SRIOV support")
Fixes b7311360fb67 ("net/txgbe: support VF interrupt")
Fixes c3ecdbb376da ("vmxnet3: support TSO")
---
 drivers/net/bnxt/bnxt_rxr.c             | 22 ----------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c     |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c |  6 ------
 drivers/net/liquidio/lio_rxtx.c         |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c        |  6 ++----
 drivers/net/octeontx/octeontx_rxtx.h    |  3 +--
 drivers/net/qede/base/ecore_vf.c        |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c     |  2 ++
 drivers/net/vmxnet3/vmxnet3_rxtx.c      |  8 ++++++++
 9 files changed, 14 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -22
index 8bc8ddc353..157297bc64 100644
@@ -823,9 +823,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
                           struct rte_mbuf *mbuf)
 {
        uint32_t cfa_code = 0;
-       uint8_t meta_fmt = 0;
-       uint16_t flags2 = 0;
-       uint32_t meta =  0;
 
        cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
        if (!cfa_code)
@@ -834,25 +831,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
        if (cfa_code && !bp->mark_table[cfa_code].valid)
                return;
 
-       flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
-       meta = rte_le_to_cpu_32(rxcmp1->metadata);
-       if (meta) {
-               meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
-
-               /* The flags field holds extra bits of info from [6:4]
-                * which indicate if the flow is in TCAM or EM or EEM
-                */
-               meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
-                          BNXT_CFA_META_FMT_SHFT;
-
-               /* meta_fmt == 4 => 'b100 => 'b10x => EM.
-                * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
-                * meta_fmt == 6 => 'b110 => 'b11x => EEM
-                * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
-                */
-               meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
-       }
-
        mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
        mbuf->ol_flags |= RTE_MBUF_F_RX_FDIR | RTE_MBUF_F_RX_FDIR_ID;
 }
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -1
index df3afaa6fd..c60d81d14a 100644
@@ -200,7 +200,6 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 {
        int i;
        int cnt = (len + 7) / 8;
-       int tlen = len;
 
        /* Handle any remainder bits */
        int tmp = len % 8;
@@ -211,12 +210,10 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
        ulp_bs_put_msb(bs, pos, tmp, val[0]);
 

drivers/net/bnxt/tf_ulp/ulp_utils.c ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val) · line 219

Quoted 10 lines
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -2
        pos += tmp;
-       tlen -= tmp;
 
        for (i = 1; i < cnt; i++) {
                ulp_bs_put_msb(bs, pos, 8, val[i]);
                pos += 8;
-               tlen -= 8;
        }
 
        return len;

Review please.

Signature · 1 line
David Marchand
Acked-by
#15 lore raw

Re: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 108 lines · David Marchand

Hello Ajit, Somnath,

Quoted 104 lines · Conor Walsh

This patch fixes unused but set variables in the following net drivers:
- bnxt
- hinic
- liquidio
- nfp
- octeontx
- qede
- txgbe
- vmxnet3

This patch also fixes an unused function warning for vmxnet3_unmap_pkt from within vmxnet3

Bugzilla ID: 881

Fixes b87abb2e55cb ("net/bnxt: support marking packet")
Fixes 88badb3aef94 ("net/bnxt: add helper functions for blob/regfile ops")
Fixes a4957d87e05a ("net/hinic/base: add mgmt module")
Fixes 5ee7640f95a0 ("net/liquidio: add API to flush IQ")
Fixes 19af5a38f7b6 ("net/nfp: move CPP bridge to separate file")
Fixes 9eb5cb3b11cc ("net/octeontx: fix access to indirect buffers")
Fixes 86a2265e59d7 ("qede: add SRIOV support")
Fixes b7311360fb67 ("net/txgbe: support VF interrupt")
Fixes c3ecdbb376da ("vmxnet3: support TSO")
---
 drivers/net/bnxt/bnxt_rxr.c             | 22 ----------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c     |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c |  6 ------
 drivers/net/liquidio/lio_rxtx.c         |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c        |  6 ++----
 drivers/net/octeontx/octeontx_rxtx.h    |  3 +--
 drivers/net/qede/base/ecore_vf.c        |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c     |  2 ++
 drivers/net/vmxnet3/vmxnet3_rxtx.c      |  8 ++++++++
 9 files changed, 14 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -22
index 8bc8ddc353..157297bc64 100644
@@ -823,9 +823,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
                           struct rte_mbuf *mbuf)
 {
        uint32_t cfa_code = 0;
-       uint8_t meta_fmt = 0;
-       uint16_t flags2 = 0;
-       uint32_t meta =  0;
 
        cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
        if (!cfa_code)
@@ -834,25 +831,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
        if (cfa_code && !bp->mark_table[cfa_code].valid)
                return;
 
-       flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
-       meta = rte_le_to_cpu_32(rxcmp1->metadata);
-       if (meta) {
-               meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
-
-               /* The flags field holds extra bits of info from [6:4]
-                * which indicate if the flow is in TCAM or EM or EEM
-                */
-               meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
-                          BNXT_CFA_META_FMT_SHFT;
-
-               /* meta_fmt == 4 => 'b100 => 'b10x => EM.
-                * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
-                * meta_fmt == 6 => 'b110 => 'b11x => EEM
-                * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
-                */
-               meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
-       }
-
        mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
        mbuf->ol_flags |= RTE_MBUF_F_RX_FDIR | RTE_MBUF_F_RX_FDIR_ID;
 }
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -3
index df3afaa6fd..c60d81d14a 100644
@@ -200,7 +200,6 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 {
        int i;
        int cnt = (len + 7) / 8;
-       int tlen = len;
 
        /* Handle any remainder bits */
        int tmp = len % 8;
@@ -211,12 +210,10 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
        ulp_bs_put_msb(bs, pos, tmp, val[0]);
 
        pos += tmp;
-       tlen -= tmp;
 
        for (i = 1; i < cnt; i++) {
                ulp_bs_put_msb(bs, pos, 8, val[i]);
                pos += 8;
-               tlen -= 8;
        }
 
Quoted 3 lines

drivers/net/bnxt/tf_ulp/ulp_utils.c ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val) · line 219

Quoted 1 line
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -0
        return len;

Review please.

Quoted 5 lines

--
David Marchand

Acked-by
#16 lore raw

Re: [PATCH 5/7] drivers/net: fix unused but set variables

Quoted 111 lines · Somnath Kotur
Quoted 108 lines · David Marchand

Hello Ajit, Somnath,

Quoted 104 lines · Conor Walsh

This patch fixes unused but set variables in the following net drivers:
- bnxt
- hinic
- liquidio
- nfp
- octeontx
- qede
- txgbe
- vmxnet3

This patch also fixes an unused function warning for vmxnet3_unmap_pkt from within vmxnet3

Bugzilla ID: 881

Fixes b87abb2e55cb ("net/bnxt: support marking packet")
Fixes 88badb3aef94 ("net/bnxt: add helper functions for blob/regfile ops")
Fixes a4957d87e05a ("net/hinic/base: add mgmt module")
Fixes 5ee7640f95a0 ("net/liquidio: add API to flush IQ")
Fixes 19af5a38f7b6 ("net/nfp: move CPP bridge to separate file")
Fixes 9eb5cb3b11cc ("net/octeontx: fix access to indirect buffers")
Fixes 86a2265e59d7 ("qede: add SRIOV support")
Fixes b7311360fb67 ("net/txgbe: support VF interrupt")
Fixes c3ecdbb376da ("vmxnet3: support TSO")
---
 drivers/net/bnxt/bnxt_rxr.c             | 22 ----------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c     |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c |  6 ------
 drivers/net/liquidio/lio_rxtx.c         |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c        |  6 ++----
 drivers/net/octeontx/octeontx_rxtx.h    |  3 +--
 drivers/net/qede/base/ecore_vf.c        |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c     |  2 ++
 drivers/net/vmxnet3/vmxnet3_rxtx.c      |  8 ++++++++
 9 files changed, 14 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -22
index 8bc8ddc353..157297bc64 100644
@@ -823,9 +823,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
                           struct rte_mbuf *mbuf)
 {
        uint32_t cfa_code = 0;
-       uint8_t meta_fmt = 0;
-       uint16_t flags2 = 0;
-       uint32_t meta =  0;
 
        cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
        if (!cfa_code)
@@ -834,25 +831,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
        if (cfa_code && !bp->mark_table[cfa_code].valid)
                return;
 
-       flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
-       meta = rte_le_to_cpu_32(rxcmp1->metadata);
-       if (meta) {
-               meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
-
-               /* The flags field holds extra bits of info from [6:4]
-                * which indicate if the flow is in TCAM or EM or EEM
-                */
-               meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
-                          BNXT_CFA_META_FMT_SHFT;
-
-               /* meta_fmt == 4 => 'b100 => 'b10x => EM.
-                * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
-                * meta_fmt == 6 => 'b110 => 'b11x => EEM
-                * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
-                */
-               meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
-       }
-
        mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
        mbuf->ol_flags |= RTE_MBUF_F_RX_FDIR | RTE_MBUF_F_RX_FDIR_ID;
 }
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -3
index df3afaa6fd..c60d81d14a 100644
@@ -200,7 +200,6 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 {
        int i;
        int cnt = (len + 7) / 8;
-       int tlen = len;
 
        /* Handle any remainder bits */
        int tmp = len % 8;
@@ -211,12 +210,10 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
        ulp_bs_put_msb(bs, pos, tmp, val[0]);
 
        pos += tmp;
-       tlen -= tmp;
 
        for (i = 1; i < cnt; i++) {
                ulp_bs_put_msb(bs, pos, 8, val[i]);
                pos += 8;
-               tlen -= 8;
        }
 
Quoted 3 lines
Quoted 3 lines

drivers/net/bnxt/tf_ulp/ulp_utils.c ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val) · line 219

Quoted 1 line
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -0
        return len;

Review please.

Thanks for the reminder.

Quoted 1 line
Quoted 5 lines
Quoted 5 lines

--
David Marchand

#17 lore raw

PATCH 6/7 examples/performance-thread: fix unused but set variables

In reply to Conor Walsh

This patch removes the hits variable from the cpu_load_collector function within the performance thread example app as it is an unused but set variable.

Bugzilla ID: 881

Fixes d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
---
 examples/performance-thread/l3fwd-thread/main.c | 3 ---
 1 file changed, 3 deletions(-)
examples/performance-thread/l3fwd-thread/main.c +0 -3
index 3a6a33bda3..8a35040597 100644
@@ -1885,7 +1885,6 @@ process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx,
 static int __rte_noreturn
 cpu_load_collector(__rte_unused void *arg) {
 	unsigned i, j, k;
-	uint64_t hits;
 	uint64_t prev_tsc, diff_tsc, cur_tsc;
 	uint64_t total[MAX_CPU] = { 0 };
 	unsigned min_cpu = MAX_CPU;
@@ -1972,12 +1971,10 @@ cpu_load_collector(__rte_unused void *arg) {
 			printf("cpu#     proc%%  poll%%  overhead%%\n\n");
 
 			for (i = min_cpu; i <= max_cpu; i++) {
-				hits = 0;
 				printf("CPU %d:", i);
 				for (j = 0; j < MAX_CPU_COUNTER; j++) {
 					printf("%7" PRIu64 "",
 							cpu_load.hits[j][i] * 100 / cpu_load.counter);
-					hits += cpu_load.hits[j][i];
 					cpu_load.hits[j][i] = 0;
 				}
 				printf("%7" PRIu64 "\n",
Signature · 1 line
2.25.1
#18 lore raw

PATCH 7/7 lib/power: fix unused but set variables

In reply to Conor Walsh

This patch removes the tot_ppi variable from the update_stats function within empty poll in the power library as it is an unused but set variable.

Bugzilla ID: 881

Fixes 450f0791312c ("power: add traffic pattern aware power control")
---
 lib/power/rte_power_empty_poll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/power/rte_power_empty_poll.c +1 -2
index 975aa92997..8a2d60c576 100644
@@ -207,7 +207,7 @@ update_training_stats(struct priority_worker *poll_stats,
 static __rte_always_inline uint32_t
 update_stats(struct priority_worker *poll_stats)
 {
-	uint64_t tot_edpi = 0, tot_ppi = 0;
+	uint64_t tot_edpi = 0;
 	uint32_t j, percent;
 
 	struct priority_worker *s = poll_stats;
@@ -237,7 +237,6 @@ update_stats(struct priority_worker *poll_stats)
 
 	for (j = 0; j < BINS_AV; j++) {
 		tot_edpi += s->edpi_av[j];
-		tot_ppi += s->ppi_av[j];
 	}
 
 	tot_edpi = tot_edpi / BINS_AV;
Signature · 1 line
2.25.1
#19 lore raw

Re: [PATCH 7/7] lib/power: fix unused but set variables

Hello Conor,

Quoted 4 lines · Conor Walsh

This patch removes the tot_ppi variable from the update_stats function within empty poll in the power library as it is an unused but set variable.

About the commitlog, commenting on this patch, but it applies to other of the series.

Quoted 2 lines

Bugzilla ID: 881

No need for an empty line between bugzilla and fixes lines.

Quoted 2 lines
Fixes 450f0791312c ("power: add traffic pattern aware power control")

We will want those fixes in stable branches.
Cc: [email protected]

Quoted 3 lines

Reports come before signing off a fix :-)

Now, on this specific patch, Jim already provided a fix for this issue, you can drop it from your series.
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Signature · 1 line
David Marchand
#20 lore raw

RE: [PATCH 7/7] lib/power: fix unused but set variables

Hi David,

I will make those changes to the commit logs and respin them. I'll also drop this patch from the set.

Thanks,
Conor.

Quoted 38 lines

Hello Conor,

Quoted 4 lines · Conor Walsh

This patch removes the tot_ppi variable from the update_stats function within empty poll in the power library as it is an unused but set variable.

About the commitlog, commenting on this patch, but it applies to other of the series.

Quoted 2 lines

Bugzilla ID: 881

No need for an empty line between bugzilla and fixes lines.

Quoted 2 lines
Fixes 450f0791312c ("power: add traffic pattern aware power control")

We will want those fixes in stable branches.
Cc: [email protected]

Quoted 3 lines

Reports come before signing off a fix :-)

Now, on this specific patch, Jim already provided a fix for this issue, you can drop it from your series.
https://patchwork.dpdk.org/project/dpdk/patch/20211105155351.350403-1-
[email protected]/

--
David Marchand

#21 lore raw

Re: [PATCH 7/7] lib/power: fix unused but set variables

Quoted 5 lines · Conor

Hi David,

I will make those changes to the commit logs and respin them. I'll also drop this patch from the set.

These comments are trivial.

We might get more substantial comments from drivers maintainers. I recommend waiting a bit before respinning.

Thanks.

Signature · 1 line
David Marchand
#22 lore raw

cover fix unused but set variables

In reply to Conor Walsh

When DPDK is compiled with clang 13, several warnings for unused but set variables are present.

This patchset fixes these warnings, which were present within:
- app/test
- drivers/bus/fslmc
- drivers/common/qat
- drivers/event/sw
- drivers/net
- examples/performance-thread

This patchset is split into 6 patches grouped broadly by subdir, as this set touches code from a lot of different authors this should make it easier to review.

Bugzilla ID: 881

---

v2:
- Drop lib/power patch as already covered by 0353121c3384 ("power: fix build with clang 13").
- Rework changes to vmxnet3 to ensure vmxnet_unmap_pkt is run.
- Minor changes to commit logs.
- Dropped all addresses from CC that bounced back.

Conor Walsh (6):
app/test: fix unused but set variables drivers/bus/fslmc: fix unused but set variables drivers/common/qat: fix unused but set variables drivers/event/sw: fix unused but set variables drivers/net: fix unused but set variables examples/performance-thread: fix unused but set variables

 app/test/test_distributor_perf.c              |  3 ---
 app/test/test_thash_perf.c                    |  3 +++
 drivers/bus/fslmc/fslmc_bus.c                 |  2 --
 drivers/common/qat/qat_pf2vf.c                |  2 --
 drivers/event/sw/sw_evdev.c                   |  2 --
 drivers/net/bnxt/bnxt_rxr.c                   | 22 -------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c       |  6 -----
 drivers/net/liquidio/lio_rxtx.c               |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c              |  6 ++---
 drivers/net/octeontx/octeontx_rxtx.h          |  3 +--
 drivers/net/qede/base/ecore_vf.c              |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c           |  3 +++
 drivers/net/vmxnet3/vmxnet3_rxtx.c            |  3 +++
 .../performance-thread/l3fwd-thread/main.c    |  3 ---
 15 files changed, 13 insertions(+), 55 deletions(-)
Signature · 1 line
2.25.1
#23 lore raw

PATCH 1/6 app/test: fix unused but set variables

This patch fixes unused but set variables within the following test apps:
- test distributor perf
- test thash perf

Bugzilla ID: 881

Fixes c0de0eb82e40 ("distributor: switch over to new API")
Fixes 239fffe0402e ("test/thash: add performance tests for Toeplitz hash")
---
 app/test/test_distributor_perf.c | 3 ---
 app/test/test_thash_perf.c       | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)
app/test/test_distributor_perf.c +0 -3
index fdbeae6d2f..92e330f194 100644
@@ -108,7 +108,6 @@ static int
 handle_work(void *arg)
 {
 	struct rte_distributor *d = arg;
-	unsigned int count = 0;
 	unsigned int num = 0;
 	int i;
 	unsigned int id = __atomic_fetch_add(&worker_idx, 1, __ATOMIC_RELAXED);
@@ -120,11 +119,9 @@ handle_work(void *arg)
 	num = rte_distributor_get_pkt(d, id, buf, buf, num);
 	while (!quit) {
 		worker_stats[id].handled_packets += num;
-		count += num;
 		num = rte_distributor_get_pkt(d, id, buf, buf, num);
 	}
 	worker_stats[id].handled_packets += num;
-	count += num;
 	rte_distributor_return_pkt(d, id, buf, num);
 	return 0;
 }
app/test/test_thash_perf.c +3 -0
index 7aa9360120..687582aa32 100644
@@ -61,6 +61,9 @@ run_rss_calc(uint32_t *tuples[BATCH_SZ], enum test_rss_type type, int len,
 	}
 	end_tsc = rte_rdtsc_precise();
 
+	/* To avoid compiler warnings set hash to used. */
+	RTE_SET_USED(hash);
+
 	return end_tsc - start_tsc;
 }
 
Signature · 1 line
2.25.1
#24 lore raw

PATCH 2/6 drivers/bus/fslmc: fix unused but set variables

In reply to Conor Walsh

This patch removes the device_count variable from the rte_fslmc_scan function within the fslmc bus driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
---
 drivers/bus/fslmc/fslmc_bus.c | 2 --
 1 file changed, 2 deletions(-)
drivers/bus/fslmc/fslmc_bus.c +0 -2
index ac3cb4aa5a..a0ef24cdc8 100644
@@ -315,7 +315,6 @@ static int
 rte_fslmc_scan(void)
 {
 	int ret;
-	int device_count = 0;
 	char fslmc_dirpath[PATH_MAX];
 	DIR *dir;
 	struct dirent *entry;
@@ -349,7 +348,6 @@ rte_fslmc_scan(void)
 			/* Error in parsing directory - exit gracefully */
 			goto scan_fail_cleanup;
 		}
-		device_count += 1;
 	}
 
 	closedir(dir);
Signature · 1 line
2.25.1
#25 lore raw

PATCH 3/6 drivers/common/qat: fix unused but set variables

In reply to Conor Walsh

This patch removes the us variable from the qat_pf2vf_exch_msg function within the PF to VF section of the QAT driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes b17d16fb47b4 ("common/qat: add PF to VF communication")
---
 drivers/common/qat/qat_pf2vf.c | 2 --
 1 file changed, 2 deletions(-)
drivers/common/qat/qat_pf2vf.c +0 -2
index 6327311199..4e9ffc72fc 100644
@@ -54,14 +54,12 @@ int qat_pf2vf_exch_msg(struct qat_pci_device *qat_dev,
 		msg |= ADF_PFVF_INT | ADF_PFVF_MSGORIGIN_SYSTEM;
 
 		ADF_CSR_WR(pmisc_bar_addr, vf_csr_off, msg);
-		int us = 0;
 		/*
 		 * Wait for confirmation from remote that it received
 		 * the message
 		 */
 		do {
 			rte_delay_us_sleep(5);
-			us += 5;
 			val = ADF_CSR_RD(pmisc_bar_addr, vf_csr_off);
 		} while ((val & ADF_PFVF_INT) &&
 			(++count < ADF_IOV_MSG_ACK_MAX_RETRY));
Signature · 1 line
2.25.1
#26 lore raw

PATCH 4/6 drivers/event/sw: fix unused but set variables

In reply to Conor Walsh

This patch removes the inflights variable from the sw_dump function within the software section of the event driver as it is an unused but set variable.

Bugzilla ID: 881

Fixes c66baa68e453 ("event/sw: add dump function for easier debugging")
---
 drivers/event/sw/sw_evdev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/event/sw/sw_evdev.c +0 -2
index 070a4802e9..fa72ceb949 100644
@@ -711,7 +711,6 @@ sw_dump(struct rte_eventdev *dev, FILE *f)
 			continue;
 		}
 		int affinities_per_port[SW_PORTS_MAX] = {0};
-		uint32_t inflights = 0;
 
 		fprintf(f, "  Queue %d (%s)\n", i, q_type_strings[qid->type]);
 		fprintf(f, "\trx   %"PRIu64"\tdrop %"PRIu64"\ttx   %"PRIu64"\n",
@@ -732,7 +731,6 @@ sw_dump(struct rte_eventdev *dev, FILE *f)
 		for (flow = 0; flow < RTE_DIM(qid->fids); flow++)
 			if (qid->fids[flow].cq != -1) {
 				affinities_per_port[qid->fids[flow].cq]++;
-				inflights += qid->fids[flow].pcount;
 			}
 
 		uint32_t port;
Signature · 1 line
2.25.1
#27 lore raw

PATCH 5/6 drivers/net: fix unused but set variables

In reply to Conor Walsh

This patch fixes unused but set variables in the following net drivers:
- bnxt
- hinic
- liquidio
- nfp
- octeontx
- qede
- txgbe
- vmxnet3

Bugzilla ID: 881

Fixes b87abb2e55cb ("net/bnxt: support marking packet")
Fixes 88badb3aef94 ("net/bnxt: add helper functions for blob/regfile ops")
Fixes a4957d87e05a ("net/hinic/base: add mgmt module")
Fixes 5ee7640f95a0 ("net/liquidio: add API to flush IQ")
Fixes 19af5a38f7b6 ("net/nfp: move CPP bridge to separate file")
Fixes 9eb5cb3b11cc ("net/octeontx: fix access to indirect buffers")
Fixes 86a2265e59d7 ("qede: add SRIOV support")
Fixes b7311360fb67 ("net/txgbe: support VF interrupt")
Fixes c3ecdbb376da ("vmxnet3: support TSO")
---
 drivers/net/bnxt/bnxt_rxr.c             | 22 ----------------------
 drivers/net/bnxt/tf_ulp/ulp_utils.c     |  3 ---
 drivers/net/hinic/base/hinic_pmd_mgmt.c |  6 ------
 drivers/net/liquidio/lio_rxtx.c         |  2 --
 drivers/net/nfp/nfp_cpp_bridge.c        |  6 ++----
 drivers/net/octeontx/octeontx_rxtx.h    |  3 +--
 drivers/net/qede/base/ecore_vf.c        |  5 +----
 drivers/net/txgbe/txgbe_ethdev_vf.c     |  3 +++
 drivers/net/vmxnet3/vmxnet3_rxtx.c      |  3 +++
 9 files changed, 10 insertions(+), 43 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +0 -22
index 8bc8ddc353..157297bc64 100644
@@ -823,9 +823,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
 			   struct rte_mbuf *mbuf)
 {
 	uint32_t cfa_code = 0;
-	uint8_t meta_fmt = 0;
-	uint16_t flags2 = 0;
-	uint32_t meta =  0;
 
 	cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
 	if (!cfa_code)
@@ -834,25 +831,6 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
 	if (cfa_code && !bp->mark_table[cfa_code].valid)
 		return;
 
-	flags2 = rte_le_to_cpu_16(rxcmp1->flags2);
-	meta = rte_le_to_cpu_32(rxcmp1->metadata);
-	if (meta) {
-		meta >>= BNXT_RX_META_CFA_CODE_SHIFT;
-
-		/* The flags field holds extra bits of info from [6:4]
-		 * which indicate if the flow is in TCAM or EM or EEM
-		 */
-		meta_fmt = (flags2 & BNXT_CFA_META_FMT_MASK) >>
-			   BNXT_CFA_META_FMT_SHFT;
-
-		/* meta_fmt == 4 => 'b100 => 'b10x => EM.
-		 * meta_fmt == 5 => 'b101 => 'b10x => EM + VLAN
-		 * meta_fmt == 6 => 'b110 => 'b11x => EEM
-		 * meta_fmt == 7 => 'b111 => 'b11x => EEM + VLAN.
-		 */
-		meta_fmt >>= BNXT_CFA_META_FMT_EM_EEM_SHFT;
-	}
-
 	mbuf->hash.fdir.hi = bp->mark_table[cfa_code].mark_id;
 	mbuf->ol_flags |= RTE_MBUF_F_RX_FDIR | RTE_MBUF_F_RX_FDIR_ID;
 }
drivers/net/bnxt/tf_ulp/ulp_utils.c +0 -3
index df3afaa6fd..c60d81d14a 100644
@@ -200,7 +200,6 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 {
 	int i;
 	int cnt = (len + 7) / 8;
-	int tlen = len;
 
 	/* Handle any remainder bits */
 	int tmp = len % 8;
@@ -211,12 +210,10 @@ ulp_bs_push_msb(uint8_t *bs, uint16_t pos, uint8_t len, uint8_t *val)
 	ulp_bs_put_msb(bs, pos, tmp, val[0]);
 
 	pos += tmp;
-	tlen -= tmp;
 
 	for (i = 1; i < cnt; i++) {
 		ulp_bs_put_msb(bs, pos, 8, val[i]);
 		pos += 8;
-		tlen -= 8;
 	}
 
 	return len;
drivers/net/hinic/base/hinic_pmd_mgmt.c +0 -6
index 9b399502de..6ecca407a1 100644
@@ -133,16 +133,12 @@ static void prepare_header(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 static void prepare_mgmt_cmd(u8 *mgmt_cmd, u64 *header, void *msg,
 			     int msg_len)
 {
-	u32 cmd_buf_max = MAX_PF_MGMT_BUF_SIZE;
-
 	memset(mgmt_cmd, 0, MGMT_MSG_RSVD_FOR_DEV);
 
 	mgmt_cmd += MGMT_MSG_RSVD_FOR_DEV;
-	cmd_buf_max -= MGMT_MSG_RSVD_FOR_DEV;
 	memcpy(mgmt_cmd, header, sizeof(*header));
 
 	mgmt_cmd += sizeof(*header);
-	cmd_buf_max -= sizeof(*header);
 	memcpy(mgmt_cmd, msg, msg_len);
 }
 
@@ -615,7 +611,6 @@ static int recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 	void *msg_body = header + sizeof(msg_header);
 	u8 *dest_msg;
 	u8 seq_id, seq_len;
-	u32 msg_buf_max = MAX_PF_MGMT_BUF_SIZE;
 	u8 front_id;
 	u16 msg_id;
 
@@ -635,7 +630,6 @@ static int recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt,
 	}
 
 	dest_msg = (u8 *)recv_msg->msg + seq_id * HINIC_MSG_SEG_LEN;
-	msg_buf_max -= seq_id * HINIC_MSG_SEG_LEN;
 	memcpy(dest_msg, msg_body, seq_len);
 
 	if (!HINIC_MSG_HEADER_GET(msg_header, LAST))
drivers/net/liquidio/lio_rxtx.c +0 -2
index ef127f26c4..e09798ddd7 100644
@@ -1050,7 +1050,6 @@ lio_update_read_index(struct lio_instr_queue *iq)
 int
 lio_flush_iq(struct lio_device *lio_dev, struct lio_instr_queue *iq)
 {
-	uint32_t tot_inst_processed = 0;
 	uint32_t inst_processed = 0;
 	int tx_done = 1;
 
@@ -1073,7 +1072,6 @@ lio_flush_iq(struct lio_device *lio_dev, struct lio_instr_queue *iq)
 			iq->stats.instr_processed += inst_processed;
 		}
 
-		tot_inst_processed += inst_processed;
 		inst_processed = 0;
 
 	} while (1);
drivers/net/nfp/nfp_cpp_bridge.c +2 -4
index 74a0eacb3f..0922ea9cf9 100644
@@ -58,7 +58,7 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
 	off_t offset, nfp_offset;
 	uint32_t cpp_id, pos, len;
 	uint32_t tmpbuf[16];
-	size_t count, curlen, totlen = 0;
+	size_t count, curlen;
 	int err = 0;
 
 	PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__,
@@ -135,7 +135,6 @@ nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
 		}
 
 		nfp_offset += pos;
-		totlen += pos;
 		nfp_cpp_area_release(area);
 		nfp_cpp_area_free(area);
 
@@ -160,7 +159,7 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 	off_t offset, nfp_offset;
 	uint32_t cpp_id, pos, len;
 	uint32_t tmpbuf[16];
-	size_t count, curlen, totlen = 0;
+	size_t count, curlen;
 	int err = 0;
 
 	PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__,
@@ -236,7 +235,6 @@ nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
 		}
 
 		nfp_offset += pos;
-		totlen += pos;
 		nfp_cpp_area_release(area);
 		nfp_cpp_area_free(area);
 
drivers/net/octeontx/octeontx_rxtx.h +1 -2
index 56f11d3dd5..b63a5edfb3 100644
@@ -365,7 +365,7 @@ __octeontx_xmit_mseg_prepare(struct rte_mbuf *tx_pkt, uint64_t *cmd_buf,
 			const uint16_t flag)
 {
 	uint16_t nb_segs, nb_desc = 0;
-	uint16_t gaura_id, len = 0;
+	uint16_t gaura_id;
 	struct rte_mbuf *m_next = NULL, *m_tofree;
 	rte_iova_t iova;
 	uint16_t data_len;
@@ -425,7 +425,6 @@ __octeontx_xmit_mseg_prepare(struct rte_mbuf *tx_pkt, uint64_t *cmd_buf,
 		cmd_buf[nb_desc++] = iova;
 
 		nb_segs--;
-		len += data_len;
 		tx_pkt = m_next;
 	} while (nb_segs);
 
drivers/net/qede/base/ecore_vf.c +1 -4
index db03bc494f..a36ae47c2b 100644
@@ -73,7 +73,7 @@ static void ecore_vf_pf_req_end(struct ecore_hwfn *p_hwfn,
 #endif
 static enum _ecore_status_t
 ecore_send_msg2pf(struct ecore_hwfn *p_hwfn,
-		  u8 *done, u32 resp_size)
+		  u8 *done, __rte_unused u32 resp_size)
 {
 	union vfpf_tlvs *p_req = p_hwfn->vf_iov_info->vf2pf_request;
 	struct ustorm_trigger_vf_zone trigger;
@@ -86,9 +86,6 @@ ecore_send_msg2pf(struct ecore_hwfn *p_hwfn,
 	/* output tlvs list */
 	ecore_dp_tlv_list(p_hwfn, p_req);
 
-	/* need to add the END TLV to the message size */
-	resp_size += sizeof(struct channel_list_end_tlv);
-
 	/* Send TLVs over HW channel */
 	OSAL_MEMSET(&trigger, 0, sizeof(struct ustorm_trigger_vf_zone));
 	trigger.vf_pf_msg_valid = 1;
drivers/net/txgbe/txgbe_ethdev_vf.c +3 -0
index 67ae69dec3..8eb6fdd3c9 100644
@@ -1291,6 +1291,9 @@ txgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev)
 	/* Workround for ICR lost */
 	intr->flags |= TXGBE_FLAG_MAILBOX;
 
+	/* To avoid compiler warnings set eicr to used. */
+	RTE_SET_USED(eicr);
+
 	return 0;
 }
 
drivers/net/vmxnet3/vmxnet3_rxtx.c +3 -0
index deba64be6a..77a2917137 100644
@@ -340,6 +340,9 @@ vmxnet3_tq_tx_complete(vmxnet3_tx_queue_t *txq)
 	}
 
 	PMD_TX_LOG(DEBUG, "Processed %d tx comps & command descs.", completed);
+
+	/* To avoid compiler warnings when not in DEBUG mode set completed to used. */
+	RTE_SET_USED(completed);
 }
 
 uint16_t
Signature · 1 line
2.25.1
Reviewed-by on v1 5/6
#28 lore raw

Re: [PATCH 5/6] drivers/net: fix unused but set variables

Quoted 11 lines · Conor Walsh

This patch fixes unused but set variables in the following net drivers:
- bnxt
- hinic
- liquidio
- nfp
- octeontx
- qede
- txgbe
- vmxnet3

Quoted 6 lines

Bugzilla ID: 881

Fixes b87abb2e55cb ("net/bnxt: support marking packet")
Fixes 88badb3aef94 ("net/bnxt: add helper functions for blob/regfile ops")
Fixes a4957d87e05a ("net/hinic/base: add mgmt module")
Fixes 5ee7640f95a0 ("net/liquidio: add API to flush IQ")
Fixes 19af5a38f7b6 ("net/nfp: move CPP bridge to separate file")

This change only moves code, it should be:

Fixes 29a62d1476b6 ("net/nfp: add CPP bridge as service")

I will fix while applying.

Quoted 4 lines
Fixes 9eb5cb3b11cc ("net/octeontx: fix access to indirect buffers")
Fixes 86a2265e59d7 ("qede: add SRIOV support")
Fixes b7311360fb67 ("net/txgbe: support VF interrupt")
Fixes c3ecdbb376da ("vmxnet3: support TSO")

Putting everything in a single patch will make life a bit harder for
backports: we have candidates for backports in 19.11 and 20.11, and some patches are not relevant to backport.
I'll split this patch per driver since the Fixes: tags for each driver only affect one version.

Quoted 4 lines
Signature · 1 line
David Marchand
#29 lore raw

PATCH 6/6 examples/performance-thread: fix unused but set variables

In reply to Conor Walsh

This patch removes the hits variable from the cpu_load_collector function within the performance thread example app as it is an unused but set variable.

Bugzilla ID: 881

Fixes d48415e1fee3 ("examples/performance-thread: add l3fwd-thread app")
---
 examples/performance-thread/l3fwd-thread/main.c | 3 ---
 1 file changed, 3 deletions(-)
examples/performance-thread/l3fwd-thread/main.c +0 -3
index 3a6a33bda3..8a35040597 100644
@@ -1885,7 +1885,6 @@ process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx,
 static int __rte_noreturn
 cpu_load_collector(__rte_unused void *arg) {
 	unsigned i, j, k;
-	uint64_t hits;
 	uint64_t prev_tsc, diff_tsc, cur_tsc;
 	uint64_t total[MAX_CPU] = { 0 };
 	unsigned min_cpu = MAX_CPU;
@@ -1972,12 +1971,10 @@ cpu_load_collector(__rte_unused void *arg) {
 			printf("cpu#     proc%%  poll%%  overhead%%\n\n");
 
 			for (i = min_cpu; i <= max_cpu; i++) {
-				hits = 0;
 				printf("CPU %d:", i);
 				for (j = 0; j < MAX_CPU_COUNTER; j++) {
 					printf("%7" PRIu64 "",
 							cpu_load.hits[j][i] * 100 / cpu_load.counter);
-					hits += cpu_load.hits[j][i];
 					cpu_load.hits[j][i] = 0;
 				}
 				printf("%7" PRIu64 "\n",
Signature · 1 line
2.25.1
Reviewed-by on the v1 series
#30 lore raw
In reply to Conor Walsh
Quoted 12 lines · Conor Walsh

When DPDK is compiled with clang 13, several warnings for unused but set variables are present.

This patchset fixes these warnings, which were present within:
- app/test
- drivers/bus/fslmc
- drivers/common/qat
- drivers/event/sw
- drivers/net
- examples/performance-thread

Quoted 3 lines

This patchset is split into 6 patches grouped broadly by subdir, as this set touches code from a lot of different authors this should make it easier to review.

For the series,

I updated titles and did some patch splitting to simplify backports.

This has been tested with a F35 container in GHA (I'll send the patch for this):
https://github.com/david-marchand/dpdk/runs/4224438074

Series applied, thanks Conor.

Signature · 1 line
David Marchand