Skip to contentSkip to conversation

Fixes for clang 15

PATCH In review David Marchand 4 participants 17 messages Nov 18, 2022 – Nov 21, 2022 1 message not in the archive Network drivers

lore
Share & tools
lore
#0 lore raw

cover Fixes for clang 15

Fedora 37 has just been released with clang 15.
The latter seems more picky wrt unused variable.

Fixes have been tested in GHA with a simple patch I used in my own repo:
https://github.com/david-marchand/dpdk/commit/82cd57ae5490
https://github.com/david-marchand/dpdk/actions/runs/3495454457

Signature · 31 lines
David Marchand

David Marchand (11):
  service: fix build with clang 15
  vhost: fix build with clang 15
  bus/dpaa: fix build with clang 15
  net/atlantic: fix build with clang 15
  net/dpaa2: fix build with clang 15
  net/ice: fix build with clang 15
  app/testpmd: fix build with clang 15
  app/testpmd: fix build with clang 15 in flow code
  test/efd: fix build with clang 15
  test/member: fix build with clang 15
  test/event: fix build with clang 15

 app/test-pmd/config.c               | 14 --------------
 app/test-pmd/noisy_vnf.c            |  2 +-
 app/test/test_efd_perf.c            |  1 -
 app/test/test_event_timer_adapter.c |  2 --
 app/test/test_member.c              |  1 -
 app/test/test_member_perf.c         |  1 -
 drivers/bus/dpaa/base/qbman/bman.h  |  4 +---
 drivers/net/atlantic/atl_rxtx.c     |  5 ++---
 drivers/net/dpaa2/dpaa2_rxtx.c      |  4 +---
 drivers/net/ice/ice_ddp_package.c   |  3 ---
 lib/eal/common/rte_service.c        |  2 --
 lib/vhost/virtio_net.c              |  2 --
 12 files changed, 5 insertions(+), 36 deletions(-)

-- 
2.38.1
#1 lore raw

PATCH 1/11 service: fix build with clang 15

This variable is not used.

Bugzilla ID: 1130

Fixes 21698354c832 ("service: introduce service cores concept")
---
 lib/eal/common/rte_service.c | 2 --
 1 file changed, 2 deletions(-)
lib/eal/common/rte_service.c +0 -2
index bcc2e19077..42ca1d001d 100644
@@ -107,14 +107,12 @@ rte_service_init(void)
 	}
 
 	int i;
-	int count = 0;
 	struct rte_config *cfg = rte_eal_get_configuration();
 	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		if (lcore_config[i].core_role == ROLE_SERVICE) {
 			if ((unsigned int)i == cfg->main_lcore)
 				continue;
 			rte_service_lcore_add(i);
-			count++;
 		}
 	}
 
Signature · 1 line
2.38.1
Acked-by on v1 1/11
#2 lore raw

RE: [PATCH 01/11] service: fix build with clang 15

Quoted 8 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday, November 18, 2022 8:53 AM
To: [email protected]
Cc: [email protected]; Van Haaren, Harry <[email protected]>; Jerin Jacob <[email protected]>
Subject: [PATCH 01/11] service: fix build with clang 15

Quoted 7 lines

This variable is not used.

Bugzilla ID: 1130

Fixes 21698354c832 ("service: introduce service cores concept")
#3 lore raw

PATCH 2/11 vhost: fix build with clang 15

In reply to David Marchand

This variable is not used.

Fixes abeb86525577 ("vhost: remove copy threshold for async path")
---
 lib/vhost/virtio_net.c | 2 --
 1 file changed, 2 deletions(-)
lib/vhost/virtio_net.c +0 -2
index 4358899718..9abf752f30 100644
@@ -1877,7 +1877,6 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev, struct vhost_virtqueue
 	struct rte_mbuf **pkts, uint32_t count, int16_t dma_id, uint16_t vchan_id)
 {
 	uint32_t pkt_idx = 0;
-	uint32_t remained = count;
 	uint16_t n_xfer;
 	uint16_t num_buffers;
 	uint16_t num_descs;
@@ -1903,7 +1902,6 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev, struct vhost_virtqueue
 		pkts_info[slot_idx].mbuf = pkts[pkt_idx];
 
 		pkt_idx++;
-		remained--;
 		vq_inc_last_avail_packed(vq, num_descs);
 	} while (pkt_idx < count);
 
Signature · 1 line
2.38.1
Reviewed-by on v1 2/11
#4 lore raw

Re: [PATCH 02/11] vhost: fix build with clang 15

Quoted 23 lines · David Marchand

This variable is not used.

Fixes abeb86525577 ("vhost: remove copy threshold for async path")
---
  lib/vhost/virtio_net.c | 2 --
  1 file changed, 2 deletions(-)
lib/vhost/virtio_net.c +0 -1
index 4358899718..9abf752f30 100644
@@ -1877,7 +1877,6 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev, struct vhost_virtqueue
  	struct rte_mbuf **pkts, uint32_t count, int16_t dma_id, uint16_t vchan_id)
  {
  	uint32_t pkt_idx = 0;
-	uint32_t remained = count;
  	uint16_t n_xfer;
  	uint16_t num_buffers;
  	uint16_t num_descs;

lib/vhost/virtio_net.c virtio_dev_rx_async_submit_packed(struct virtio_net *dev, struct vhost_virtqueue · line 1907

Quoted 7 lines
lib/vhost/virtio_net.c +0 -1
@@ -1903,7 +1902,6 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev, struct vhost_virtqueue
  		pkts_info[slot_idx].mbuf = pkts[pkt_idx];
 
  		pkt_idx++;
-		remained--;
  		vq_inc_last_avail_packed(vq, num_descs);
  	} while (pkt_idx < count);
 

Thanks,
Maxime

#5 lore raw

PATCH 3/11 bus/dpaa: fix build with clang 15

In reply to David Marchand

This variable is not used.

Fixes f38f61e982f8 ("bus/dpaa: add BMAN hardware interfaces")
---
 drivers/bus/dpaa/base/qbman/bman.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/bus/dpaa/base/qbman/bman.h +1 -3
index 21a6bee778..b2aa93e046 100644
@@ -519,7 +519,6 @@ static inline int bm_shutdown_pool(struct bm_portal *p, u32 bpid)
 	struct bm_mc_command *bm_cmd;
 	struct bm_mc_result *bm_res;
 
-	int aq_count = 0;
 	bool stop = false;
 
 	while (!stop) {
@@ -532,8 +531,7 @@ static inline int bm_shutdown_pool(struct bm_portal *p, u32 bpid)
 		if (!(bm_res->verb & BM_MCR_VERB_ACQUIRE_BUFCOUNT)) {
 			/* Pool is empty */
 			stop = true;
-		} else
-			++aq_count;
+		}
 	};
 	return 0;
 }
Signature · 1 line
2.38.1
#6 lore raw

PATCH 4/11 net/atlantic: fix build with clang 15

In reply to David Marchand

This variable is not used.

Fixes 2b1472d7150c ("net/atlantic: implement Tx path")
---
 drivers/net/atlantic/atl_rxtx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/atlantic/atl_rxtx.c +2 -3
index aeb79bf5a2..cb6f8141a8 100644
@@ -1127,10 +1127,9 @@ atl_xmit_cleanup(struct atl_tx_queue *txq)
 	if (txq != NULL) {
 		sw_ring = txq->sw_ring;
 		int head = txq->tx_head;
-		int cnt;
-		int i;
+		int cnt = head;
 
-		for (i = 0, cnt = head; ; i++) {
+		while (true) {
 			txd = &txq->hw_ring[cnt];
 
 			if (txd->dd)
Signature · 1 line
2.38.1
#7 lore raw

PATCH 5/11 net/dpaa2: fix build with clang 15

In reply to David Marchand

This variable is not used.

Fixes 4690a6114ff6 ("net/dpaa2: enable error queues optionally")
---
 drivers/net/dpaa2/dpaa2_rxtx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/dpaa2/dpaa2_rxtx.c +1 -3
index 5b02260e71..f60e78e1fd 100644
@@ -620,7 +620,7 @@ dump_err_pkts(struct dpaa2_queue *dpaa2_q)
 	/* Function receive frames for a given device and VQ */
 	struct qbman_result *dq_storage;
 	uint32_t fqid = dpaa2_q->fqid;
-	int ret, num_rx = 0, num_pulled;
+	int ret, num_rx = 0;
 	uint8_t pending, status;
 	struct qbman_swp *swp;
 	const struct qbman_fd *fd;
@@ -660,7 +660,6 @@ dump_err_pkts(struct dpaa2_queue *dpaa2_q)
 	while (!qbman_check_command_complete(dq_storage))
 		;
 
-	num_pulled = 0;
 	pending = 1;
 	do {
 		/* Loop until the dq_storage is updated with
@@ -695,7 +694,6 @@ dump_err_pkts(struct dpaa2_queue *dpaa2_q)
 
 		dq_storage++;
 		num_rx++;
-		num_pulled++;
 	} while (pending);
 
 	dpaa2_q->err_pkts += num_rx;
Signature · 1 line
2.38.1
#8 lore raw

PATCH 6/11 net/ice: fix build with clang 15

In reply to David Marchand

This variable is not used.

Fixes 0d8d7bd720ba ("net/ice: support DDP dump switch rule binary")
---
 drivers/net/ice/ice_ddp_package.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/ice/ice_ddp_package.c +0 -3
index a27a4a2da2..0aa19eb282 100644
@@ -439,7 +439,6 @@ ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 	int i = 0;
 	uint16_t tbl_id = 0;
 	uint32_t tbl_idx = 0;
-	int tbl_cnt = 0;
 	uint8_t *buffer = *buff2;
 
 	hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -481,10 +480,8 @@ ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 
 		free(buff);
 
-		tbl_cnt++;
 		if (tbl_idx == 0xffffffff) {
 			tbl_idx = 0;
-			tbl_cnt = 0;
 			memset(buffer, '\n', sizeof(char));
 			buffer++;
 			offset = 0;
Signature · 1 line
2.38.1
#9 lore raw

PATCH 7/11 app/testpmd: fix build with clang 15

In reply to David Marchand

This variable is used to create some artificial load.

Fixes 3c156061b938 ("app/testpmd: add noisy neighbour forwarding mode")
---
 app/test-pmd/noisy_vnf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/noisy_vnf.c +1 -1
index b17a1febd3..c65ec6f06a 100644
@@ -57,8 +57,8 @@ do_write(char *vnf_mem)
 static inline void
 do_read(char *vnf_mem)
 {
+	uint64_t r __rte_unused;
 	uint64_t i = rte_rand();
-	uint64_t r;
 
 	r = vnf_mem[i % ((noisy_lkup_mem_sz * 1024 * 1024) /
 			RTE_CACHE_LINE_SIZE)];
Signature · 1 line
2.38.1
#10 lore raw

PATCH 8/11 app/testpmd: fix build with clang 15 in flow code

In reply to David Marchand

This variable is not used and has been copy/pasted in a lot of other code.

Fixes 938a184a1870 ("app/testpmd: implement basic support for flow API")
Fixes 55509e3a49fb ("app/testpmd: support shared flow action")
Fixes 04cc665fab38 ("app/testpmd: add flow template management")
Fixes c4b38873346b ("app/testpmd: add flow table management")
Fixes ecdc927b99f2 ("app/testpmd: add async flow create/destroy operations")
Fixes d906fff51878 ("app/testpmd: add async indirect actions operations")
---
 app/test-pmd/config.c | 14 --------------
 1 file changed, 14 deletions(-)
app/test-pmd/config.c +0 -14
index 982549ffed..9103ba6c77 100644
@@ -1787,7 +1787,6 @@ port_action_handle_destroy(portid_t port_id,
 {
 	struct rte_port *port;
 	struct port_indirect_action **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -1822,7 +1821,6 @@ port_action_handle_destroy(portid_t port_id,
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
@@ -2251,7 +2249,6 @@ port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,
 {
 	struct rte_port *port;
 	struct port_template **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2288,7 +2285,6 @@ port_flow_pattern_template_destroy(portid_t port_id, uint32_t n,
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
@@ -2368,7 +2364,6 @@ port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
 {
 	struct rte_port *port;
 	struct port_template **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2404,7 +2399,6 @@ port_flow_actions_template_destroy(portid_t port_id, uint32_t n,
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
@@ -2534,7 +2528,6 @@ port_flow_template_table_destroy(portid_t port_id,
 {
 	struct rte_port *port;
 	struct port_table **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -2571,7 +2564,6 @@ port_flow_template_table_destroy(portid_t port_id,
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
@@ -2719,7 +2711,6 @@ port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,
 	struct rte_flow_op_attr op_attr = { .postpone = postpone };
 	struct rte_port *port;
 	struct port_flow **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 	struct queue_job *job;
 
@@ -2768,7 +2759,6 @@ port_queue_flow_destroy(portid_t port_id, queueid_t queue_id,
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
@@ -2836,7 +2826,6 @@ port_queue_action_handle_destroy(portid_t port_id,
 	const struct rte_flow_op_attr attr = { .postpone = postpone};
 	struct rte_port *port;
 	struct port_indirect_action **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 	struct queue_job *job;
 
@@ -2886,7 +2875,6 @@ port_queue_action_handle_destroy(portid_t port_id,
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
@@ -3304,7 +3292,6 @@ port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule)
 {
 	struct rte_port *port;
 	struct port_flow **tmp;
-	uint32_t c = 0;
 	int ret = 0;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN) ||
@@ -3337,7 +3324,6 @@ port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule)
 		}
 		if (i == n)
 			tmp = &(*tmp)->next;
-		++c;
 	}
 	return ret;
 }
Signature · 1 line
2.38.1
#11 lore raw

PATCH 9/11 test/efd: fix build with clang 15

In reply to David Marchand

This local variable hides the more global one. The original intent was probably to use the global one.

Fixes 0e925aef2779 ("app/test: add EFD functional and perf tests")
---
 app/test/test_efd_perf.c | 1 -
 1 file changed, 1 deletion(-)
app/test/test_efd_perf.c +0 -1
index d7f4d83549..4d04ed93e3 100644
@@ -153,7 +153,6 @@ setup_keys_and_data(struct efd_perf_params *params, unsigned int cycle)
 		qsort(keys, KEYS_TO_ADD, MAX_KEYSIZE, key_compare);
 
 		/* Sift through the list of keys and look for duplicates */
-		int num_duplicates = 0;
 		for (i = 0; i < KEYS_TO_ADD - 1; i++) {
 			if (memcmp(keys[i], keys[i + 1], params->key_size) == 0) {
 				/* This key already exists, try again */
Signature · 1 line
2.38.1
#12 lore raw

PATCH 10/11 test/member: fix build with clang 15

In reply to David Marchand

This local variable hides the more global one. The original intent was probably to use the global one.

Fixes 0cc67a96e486 ("test/member: add functional and perf tests")
---
 app/test/test_member.c      | 1 -
 app/test/test_member_perf.c | 1 -
 2 files changed, 2 deletions(-)
app/test/test_member.c +0 -1
index c1b6a7d8b9..4a93f8bff4 100644
@@ -573,7 +573,6 @@ setup_keys_and_data(void)
 		qsort(generated_keys, MAX_ENTRIES, KEY_SIZE, key_compare);
 
 		/* Sift through the list of keys and look for duplicates */
-		int num_duplicates = 0;
 		for (i = 0; i < MAX_ENTRIES - 1; i++) {
 			if (memcmp(generated_keys[i], generated_keys[i + 1],
 					KEY_SIZE) == 0) {
app/test/test_member_perf.c +0 -1
index 7b6adf913e..2f79888fbd 100644
@@ -178,7 +178,6 @@ setup_keys_and_data(struct member_perf_params *params, unsigned int cycle,
 		qsort(keys, KEYS_TO_ADD, MAX_KEYSIZE, key_compare);
 
 		/* Sift through the list of keys and look for duplicates */
-		int num_duplicates = 0;
 		for (i = 0; i < KEYS_TO_ADD - 1; i++) {
 			if (memcmp(keys[i], keys[i + 1],
 					params->key_size) == 0) {
Signature · 1 line
2.38.1
#13 lore raw

PATCH 11/11 test/event: fix build with clang 15

In reply to David Marchand

This variable is not used.

Fixes d1f3385d0076 ("test: add event timer adapter auto-test")
---
 app/test/test_event_timer_adapter.c | 2 --
 1 file changed, 2 deletions(-)
app/test/test_event_timer_adapter.c +0 -2
index 654c412836..1a440dfd10 100644
@@ -911,7 +911,6 @@ _cancel_thread(void *args)
 {
 	RTE_SET_USED(args);
 	struct rte_event_timer *ev_tim = NULL;
-	uint64_t cancel_count = 0;
 	uint16_t ret;
 
 	while (!arm_done || rte_ring_count(timer_producer_ring) > 0) {
@@ -921,7 +920,6 @@ _cancel_thread(void *args)
 		ret = rte_event_timer_cancel_burst(timdev, &ev_tim, 1);
 		TEST_ASSERT_EQUAL(ret, 1, "Failed to cancel timer");
 		rte_mempool_put(eventdev_test_mempool, (void *)ev_tim);
-		cancel_count++;
 	}
 
 	return TEST_SUCCESS;
Signature · 1 line
2.38.1
Tested-by on v1 11/11
#14 lore raw

RE: [PATCH 11/11] test/event: fix build with clang 15

Quoted 8 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: 2022年11月18日 16:53
To: [email protected]
Cc: [email protected]; Carrillo, Erik G <[email protected]>; Pavan Nikhilesh <[email protected]>
Subject: [PATCH 11/11] test/event: fix build with clang 15

Quoted 6 lines

This variable is not used.

Fixes d1f3385d0076 ("test: add event timer adapter auto-test")

A message that is not in the archive (sent off-list or not yet received): 20221119001318.GA16784@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net

#16 lore raw
Quoted 5 lines · Tyler Retzlaff
Quoted 3 lines · David Marchand

Fedora 37 has just been released with clang 15.
The latter seems more picky wrt unused variable.

Quoted 7 lines
Quoted 5 lines

Fixes have been tested in GHA with a simple patch I used in my own repo:
https://github.com/david-marchand/dpdk/commit/82cd57ae5490
https://github.com/david-marchand/dpdk/actions/runs/3495454457

--

Thanks for the ack.
Re-adding dev@.

Signature · 1 line
David Marchand
#17 lore raw
In reply to David Marchand
Quoted 24 lines · David Marchand

Fedora 37 has just been released with clang 15.
The latter seems more picky wrt unused variable.

Fixes have been tested in GHA with a simple patch I used in my own repo:
https://github.com/david-marchand/dpdk/commit/82cd57ae5490
https://github.com/david-marchand/dpdk/actions/runs/3495454457

--
David Marchand

David Marchand (11):
service: fix build with clang 15
vhost: fix build with clang 15
bus/dpaa: fix build with clang 15 net/atlantic: fix build with clang 15 net/dpaa2: fix build with clang 15 net/ice: fix build with clang 15 app/testpmd: fix build with clang 15 app/testpmd: fix build with clang 15 in flow code test/efd: fix build with clang 15 test/member: fix build with clang 15 test/event: fix build with clang 15

Quoted 13 lines
 app/test-pmd/config.c               | 14 --------------
 app/test-pmd/noisy_vnf.c            |  2 +-
 app/test/test_efd_perf.c            |  1 -
 app/test/test_event_timer_adapter.c |  2 --
 app/test/test_member.c              |  1 -
 app/test/test_member_perf.c         |  1 -
 drivers/bus/dpaa/base/qbman/bman.h  |  4 +---
 drivers/net/atlantic/atl_rxtx.c     |  5 ++---
 drivers/net/dpaa2/dpaa2_rxtx.c      |  4 +---
 drivers/net/ice/ice_ddp_package.c   |  3 ---
 lib/eal/common/rte_service.c        |  2 --
 lib/vhost/virtio_net.c              |  2 --
 12 files changed, 5 insertions(+), 36 deletions(-)

Series applied for rc4, thanks.

Signature · 1 line
David Marchand