Skip to contentSkip to conversation

devtools, lib, test, net, common: remove unused rte_bitmap_free() and plt_bitmap_free()

PATCH In review Ariel Otilibili 2 participants 13 messages Dec 22, 2024 – Jan 14

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

v4 cover devtools, lib, test, net, common: remove unused rte_bitmap_free() and plt_bitmap_free()

Hello,

The first version was about the clearing of Coverity IDs 357712 & 357737; now this series is about the removal of rte_bitmap_free() and its alias plt_bitmap_free().

As of commit 07604f2644 ("maintainers: update for next-net tree"):

* rte_bitmap_free() returns an integer, and does nothing else
* all functions that call rte_bitmap_free() do not use this return value.

Details are in d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Looking forward your feedback,

---
v4:
* fix style issues, https://patches.dpdk.org/project/dpdk/patch/[email protected]/
* fix build failures, https://github.com/ovsrobot/dpdk/actions/runs/12450201352

v3:
* addressed feedback from Stephen Hemminger
* removed rte_bitmap_free() wherever it was used

v2:
* fix style issues.

Ariel Otilibili (11):
devtools/cocci,lib/eal: remove unused rte_bitmap_free() app/test: remove unused rte_bitmap_free() net/sfc: remove unused rte_bitmap_free() crypto/ionic: remove unused rte_bitmap_free() net/cxgbe: remove unused rte_bitmap_free() net/mlx4: remove unused rte_bitmap_free() common/mlx5: remove unused rte_bitmap_free() net/bonding: remove unused rte_bitmap_free() net/netvsc: remove unused rte_bitmap_free() common/cnxk: remove unused plt_bitmap_free() {common,net}/cnxk: remove unused plt_bitmap_free()

 app/test/test_bitmap.c                   |  2 --
 devtools/cocci/nullfree.cocci            |  3 ---
 drivers/common/cnxk/roc_mcs.c            |  4 ----
 drivers/common/cnxk/roc_nix_inl_dev.c    |  2 --
 drivers/common/cnxk/roc_nix_tm.c         |  5 -----
 drivers/common/cnxk/roc_npa.c            |  4 ----
 drivers/common/cnxk/roc_npc_aging.c      |  1 -
 drivers/common/cnxk/roc_platform.h       |  1 -
 drivers/common/mlx5/mlx5_common_mr.c     |  1 -
 drivers/crypto/ionic/ionic_crypto_main.c |  1 -
 drivers/net/bonding/rte_eth_bond_pmd.c   |  1 -
 drivers/net/cnxk/cnxk_ethdev.c           |  1 -
 drivers/net/cxgbe/cxgbe_main.c           |  1 -
 drivers/net/mlx4/mlx4_mr.c               |  1 -
 drivers/net/netvsc/hn_rxtx.c             |  1 -
 drivers/net/sfc/sfc_sw_stats.c           |  1 -
 lib/eal/include/rte_bitmap.h             | 19 -------------------
 17 files changed, 49 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH v4 1/11 devtools/cocci, lib/eal: remove unused rte_bitmap_free()

Coverity reports return values of calls to rte_bitmap_free() are not used.

As of commit 07604f2644 ("maintainers: update for next-net tree"):

```
$ awk 'NR>281 && NR<300 {print NR ":" $0}' lib/eal/include/rte_bitmap.h

282:/**
283: * Bitmap free
284: *
285: * @param bmp
286: *   Handle to bitmap instance
287: * @return
288: *   0 upon success, error code otherwise
289: */
290:static inline int
291:rte_bitmap_free(struct rte_bitmap *bmp)
292:{
293:    /* Check input arguments */
294:    if (bmp == NULL) {
295:            return -1;
296:    }
297:
298:    return 0;
299:}
```

rte_bitmap_free() checks the pointer to its input rte_bitmap is not null, and does nothing else.

Functions wherein rte_bitmap_free() is called do not use its return value.

```
$ git grep -Pn 'rte_bitmap_free\('

app/test/test_bitmap.c:211:     rte_bitmap_free(bmp);
app/test/test_bitmap.c:257:     rte_bitmap_free(bmp);
devtools/cocci/nullfree.cocci:19:- if (E != NULL) rte_bitmap_free(E);
devtools/cocci/nullfree.cocci:20:+ rte_bitmap_free(E);
drivers/common/cnxk/roc_platform.h:127:#define plt_bitmap_free                  rte_bitmap_free
drivers/common/mlx5/mlx5_common_mr.c:497:       rte_bitmap_free(mr->ms_bmp);
drivers/crypto/ionic/ionic_crypto_main.c:817:           rte_bitmap_free(dev->sess_bm);
drivers/net/bonding/rte_eth_bond_pmd.c:2246:    rte_bitmap_free(internals->vlan_filter_bmp);
drivers/net/cxgbe/cxgbe_main.c:468:             rte_bitmap_free(t->ftid_bmap);
drivers/net/mlx4/mlx4_mr.c:474: rte_bitmap_free(mr->ms_bmp);
drivers/net/netvsc/hn_rxtx.c:186:       rte_bitmap_free(hv->chim_bmap);
drivers/net/sfc/sfc_sw_stats.c:818:     rte_bitmap_free(sa->sw_stats.queues_bitmap);
lib/eal/include/rte_bitmap.h:291:rte_bitmap_free(struct rte_bitmap *bmp)
```

The clearing of these Coverity warnings have been discussed more than once this year, the question of its existence has also been asked.

Subsequent commits will remove rte_bitmap_free where it was used.

Coverity issue: 357712, 357737

---
Cc: [email protected]
Cc: Stephen Hemminger <[email protected]>
Cc: Andrew Boyer <[email protected]>

---
 devtools/cocci/nullfree.cocci |  3 ---
 lib/eal/include/rte_bitmap.h  | 19 -------------------
 2 files changed, 22 deletions(-)
devtools/cocci/nullfree.cocci +0 -3
index c0526a2a3f..8f0c4a4144 100644
@@ -16,9 +16,6 @@ expression E;
 - if (E != NULL) rte_acl_free(E);
 + rte_acl_free(E);
 |
-- if (E != NULL) rte_bitmap_free(E);
-+ rte_bitmap_free(E);
-|
 - if (E != NULL) rte_comp_op_free(E);
 + rte_comp_op_free(E);
 |
lib/eal/include/rte_bitmap.h +0 -19
index abb102f1d3..63d54f5761 100644
@@ -279,25 +279,6 @@ rte_bitmap_init_with_all_set(uint32_t n_bits, uint8_t *mem, uint32_t mem_size)
 	return bmp;
 }
 
-/**
- * Bitmap free
- *
- * @param bmp
- *   Handle to bitmap instance
- * @return
- *   0 upon success, error code otherwise
- */
-static inline int
-rte_bitmap_free(struct rte_bitmap *bmp)
-{
-	/* Check input arguments */
-	if (bmp == NULL) {
-		return -1;
-	}
-
-	return 0;
-}
-
 /**
  * Bitmap reset
  *
Signature · 1 line
2.47.1
#2 lore raw

PATCH v4 2/11 app/test: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Coverity issue: 357712, 357737

Fixes 24d376bfee ("test/bitmap: fix memory leak")

--
Cc: [email protected]
Cc: Cristian Dumitrescu <[email protected]>
Cc: Stephen Hemminger <[email protected]>

---
 app/test/test_bitmap.c | 2 --
 1 file changed, 2 deletions(-)
app/test/test_bitmap.c +0 -2
index bab11812c7..a21210a215 100644
@@ -208,7 +208,6 @@ test_bitmap_all_clear(void)
 	if (test_bitmap_scan_operations(bmp) < 0)
 		return TEST_FAILED;
 
-	rte_bitmap_free(bmp);
 	rte_free(mem);
 
 	return TEST_SUCCESS;
@@ -254,7 +253,6 @@ test_bitmap_all_set(void)
 		return TEST_FAILED;
 	}
 
-	rte_bitmap_free(bmp);
 	rte_free(mem);
 
 	return TEST_SUCCESS;
Signature · 1 line
2.47.1
#3 lore raw

PATCH v4 3/11 net/sfc: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes e00c3a0c1b ("net/sfc: rename SW stats structures")

---
Cc: [email protected]
Cc: Andrew Rybchenko <[email protected]>

---
 drivers/net/sfc/sfc_sw_stats.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/sfc/sfc_sw_stats.c +0 -1
index 3ae5023b6f..90e95aed22 100644
@@ -815,7 +815,6 @@ sfc_sw_xstats_configure(struct sfc_adapter *sa)
 static void
 sfc_sw_xstats_free_queues_bitmap(struct sfc_adapter *sa)
 {
-	rte_bitmap_free(sa->sw_stats.queues_bitmap);
 	rte_free(sa->sw_stats.queues_bitmap_mem);
 }
 
Signature · 1 line
2.47.1
#4 lore raw

PATCH v4 4/11 crypto/ionic: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes 6bc7f2cf66 ("crypto/ionic: support sessions")

---
Cc: [email protected]
Cc: Andrew Boyer <[email protected]>

---
 drivers/crypto/ionic/ionic_crypto_main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/crypto/ionic/ionic_crypto_main.c +0 -1
index f670d6e658..ef5b54f161 100644
@@ -814,7 +814,6 @@ iocpt_free_objs(struct iocpt_dev *dev)
 	}
 
 	if (dev->sess_bm != NULL) {
-		rte_bitmap_free(dev->sess_bm);
 		rte_free(dev->sess_bm);
 		dev->sess_bm = NULL;
 	}
Signature · 1 line
2.47.1
#5 lore raw

PATCH v4 5/11 net/cxgbe: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes 06c047b680 ("remove unnecessary null checks")

---
Cc: [email protected]
Cc: Potnuri Bharat Teja <[email protected]>

---
 drivers/net/cxgbe/cxgbe_main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/cxgbe/cxgbe_main.c +0 -1
index 2ed21f2d66..91ecddd287 100644
@@ -465,7 +465,6 @@ void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid,
 static void tid_free(struct tid_info *t)
 {
 	if (t->tid_tab) {
-		rte_bitmap_free(t->ftid_bmap);
 
 		if (t->ftid_bmap_array)
 			t4_os_free(t->ftid_bmap_array);
Signature · 1 line
2.47.1
#6 lore raw

PATCH v4 6/11 net/mlx4: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes 06c047b680 ("remove unnecessary null checks")

---
Cc: [email protected]
Cc: Matan Azrad <[email protected]>
Cc: Viacheslav Ovsiienko <[email protected]>

---
 drivers/net/mlx4/mlx4_mr.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/mlx4/mlx4_mr.c +0 -1
index 2251c624ff..67a2a66481 100644
@@ -471,7 +471,6 @@ mr_free(struct mlx4_mr *mr)
 	DEBUG("freeing MR(%p):", (void *)mr);
 	if (mr->ibv_mr != NULL)
 		claim_zero(mlx4_glue->dereg_mr(mr->ibv_mr));
-	rte_bitmap_free(mr->ms_bmp);
 	rte_free(mr);
 }
 
Signature · 1 line
2.47.1
#7 lore raw

PATCH v4 7/11 common/mlx5: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes 06c047b680 ("remove unnecessary null checks")

---
Cc: [email protected]
Cc: Dariusz Sosnowski <[email protected]>
Cc: Viacheslav Ovsiienko <[email protected]>
Cc: Bing Zhao <[email protected]>
Cc: Ori Kam <[email protected]>
Cc: Suanming Mou <[email protected]>
Cc: Matan Azrad <[email protected]>

---
 drivers/common/mlx5/mlx5_common_mr.c | 1 -
 1 file changed, 1 deletion(-)
drivers/common/mlx5/mlx5_common_mr.c +0 -1
index 50922ad398..dee0b521dd 100644
@@ -494,7 +494,6 @@ mlx5_mr_free(struct mlx5_mr *mr, mlx5_dereg_mr_t dereg_mr_cb)
 		return;
 	DRV_LOG(DEBUG, "freeing MR(%p):", (void *)mr);
 	dereg_mr_cb(&mr->pmd_mr);
-	rte_bitmap_free(mr->ms_bmp);
 	mlx5_free(mr);
 }
 
Signature · 1 line
2.47.1
#8 lore raw

PATCH v4 8/11 net/bonding: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes 171875d067 ("net/bonding: release port upon close")

---
Cc: [email protected]
Cc: Chas Williams <[email protected]>
Cc: "Min Hu (Connor)" <[email protected]>

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -1
index 91bf2c2345..5f9a739e55 100644
@@ -2243,7 +2243,6 @@ bond_ethdev_close(struct rte_eth_dev *dev)
 
 	bond_ethdev_free_queues(dev);
 	rte_bitmap_reset(internals->vlan_filter_bmp);
-	rte_bitmap_free(internals->vlan_filter_bmp);
 	rte_free(internals->vlan_filter_bmpmem);
 
 	/* Try to release mempool used in mode6. If the bond
Signature · 1 line
2.47.1
#9 lore raw

PATCH v4 9/11 net/netvsc: remove unused rte_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes cc02518132 ("net/netvsc: split send buffers from Tx descriptors")

---
Cc: [email protected]
Cc: Long Li <[email protected]>
Cc: Wei Hu <[email protected]>

---
 drivers/net/netvsc/hn_rxtx.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/netvsc/hn_rxtx.c +0 -1
index 9d3948e03d..148c7c4a33 100644
@@ -183,7 +183,6 @@ hn_chim_uninit(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
 
-	rte_bitmap_free(hv->chim_bmap);
 	rte_free(hv->chim_bmem);
 	hv->chim_bmem = NULL;
 }
Signature · 1 line
2.47.1
#10 lore raw

PATCH v4 10/11 common/cnxk: remove unused plt_bitmap_free()

In reply to Ariel Otilibili

Depends on d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

plt_bitmap_free() is an alias of rte_bitmap_free().

A subsequent commit removes all its occurrences:

```
$ git grep -Pn 'plt_bitmap_free\('

drivers/common/cnxk/roc_mcs.c:722:      plt_bitmap_free(rsrc->tcam_bmap);
drivers/common/cnxk/roc_mcs.c:724:      plt_bitmap_free(rsrc->secy_bmap);
drivers/common/cnxk/roc_mcs.c:726:      plt_bitmap_free(rsrc->sc_bmap);
drivers/common/cnxk/roc_mcs.c:728:      plt_bitmap_free(rsrc->sa_bmap);
drivers/common/cnxk/roc_nix_inl_dev.c:840:              plt_bitmap_free(inl_dev->soft_exp_ring_bmap);
drivers/common/cnxk/roc_nix_inl_dev.c:1072:             plt_bitmap_free(inl_dev->soft_exp_ring_bmap);
drivers/common/cnxk/roc_nix_tm.c:2036:          plt_bitmap_free(nix->schq_bmp[hw_lvl]);
drivers/common/cnxk/roc_nix_tm.c:2037:          plt_bitmap_free(nix->schq_contig_bmp[hw_lvl]);
drivers/common/cnxk/roc_npa.c:1260:     plt_bitmap_free(lf->npa_bmp);
drivers/common/cnxk/roc_npa.c:1277:     plt_bitmap_free(lf->npa_bmp);
drivers/common/cnxk/roc_npc_aging.c:46: plt_bitmap_free(flow_age->aged_flows);
drivers/net/cnxk/cnxk_ethdev.c:314:             plt_bitmap_free(dev->outb.sa_bmap);
```
Fixes fa8f86a14e ("common/cnxk: add build infrastructre and HW definition")

---
Cc: [email protected]
Cc: Nithin Dabilpuram <[email protected]>
Cc: Kiran Kumar K <[email protected]>
Cc: Sunil Kumar Kori <[email protected]>
Cc: Satha Rao <[email protected]>
Cc: Harman Kalra <[email protected]>

---
 drivers/common/cnxk/roc_platform.h | 1 -
 1 file changed, 1 deletion(-)
drivers/common/cnxk/roc_platform.h +0 -1
index df4f88f288..6c4a69377f 100644
@@ -124,7 +124,6 @@
 #define plt_bitmap			rte_bitmap
 #define plt_bitmap_init			rte_bitmap_init
 #define plt_bitmap_reset		rte_bitmap_reset
-#define plt_bitmap_free			rte_bitmap_free
 #define plt_bitmap_clear		rte_bitmap_clear
 #define plt_bitmap_set			rte_bitmap_set
 #define plt_bitmap_get			rte_bitmap_get
Signature · 1 line
2.47.1
#11 lore raw

PATCH v4 11/11 {common,net}/cnxk: remove unused plt_bitmap_free()

In reply to Ariel Otilibili

Depends on commits:
* 13844f8557 ("common/cnxk: remove unused plt_bitmap_free()")
* d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Fixes f752780f30 ("common/cnxk: add ROC MACsec initialization")
Fixes bea5d990a9 ("net/cnxk: support outbound soft expiry notification")
Fixes 05d727e8b1 ("common/cnxk: support NIX traffic management")
Fixes 124ff1a4cb ("common/cnxk: support NPA device")
Fixes 357f5ebc8a ("common/cnxk: support flow aging")
Fixes 7eabd6c637 ("net/cnxk: support inline security setup for cn9k")

---
Cc: [email protected]
Cc: Nithin Dabilpuram <[email protected]>
Cc: Kiran Kumar K <[email protected]>
Cc: Sunil Kumar Kori <[email protected]>
Cc: Satha Rao <[email protected]>
Cc: Harman Kalra <[email protected]>

---
 drivers/common/cnxk/roc_mcs.c         | 4 ----
 drivers/common/cnxk/roc_nix_inl_dev.c | 2 --
 drivers/common/cnxk/roc_nix_tm.c      | 5 -----
 drivers/common/cnxk/roc_npa.c         | 4 ----
 drivers/common/cnxk/roc_npc_aging.c   | 1 -
 drivers/net/cnxk/cnxk_ethdev.c        | 1 -
 6 files changed, 17 deletions(-)
drivers/common/cnxk/roc_mcs.c +0 -4
index f823f7f478..4df3b2ff92 100644
@@ -719,13 +719,9 @@ mcs_alloc_bmap(uint16_t entries, void **mem, struct plt_bitmap **bmap)
 static void
 rsrc_bmap_free(struct mcs_rsrc *rsrc)
 {
-	plt_bitmap_free(rsrc->tcam_bmap);
 	plt_free(rsrc->tcam_bmap_mem);
-	plt_bitmap_free(rsrc->secy_bmap);
 	plt_free(rsrc->secy_bmap_mem);
-	plt_bitmap_free(rsrc->sc_bmap);
 	plt_free(rsrc->sc_bmap_mem);
-	plt_bitmap_free(rsrc->sa_bmap);
 	plt_free(rsrc->sa_bmap_mem);
 }
 
drivers/common/cnxk/roc_nix_inl_dev.c +0 -2
index ffe6eef81f..d2b5aa5bab 100644
@@ -837,7 +837,6 @@ nix_inl_outb_poll_thread_setup(struct nix_inl_dev *inl_dev)
 	rc = plt_thread_create_control(&inl_dev->soft_exp_poll_thread,
 			"outb-poll", nix_inl_outb_poll_thread, inl_dev);
 	if (rc) {
-		plt_bitmap_free(inl_dev->soft_exp_ring_bmap);
 		plt_free(inl_dev->soft_exp_ring_bmap_mem);
 	}
 
@@ -1069,7 +1068,6 @@ roc_nix_inl_dev_fini(struct roc_nix_inl_dev *roc_inl_dev)
 	if (inl_dev->set_soft_exp_poll) {
 		soft_exp_poll_thread_exit = true;
 		plt_thread_join(inl_dev->soft_exp_poll_thread, NULL);
-		plt_bitmap_free(inl_dev->soft_exp_ring_bmap);
 		plt_free(inl_dev->soft_exp_ring_bmap_mem);
 		plt_free(inl_dev->sa_soft_exp_ring);
 	}
drivers/common/cnxk/roc_nix_tm.c +0 -5
index abfe80978b..f8b14acb16 100644
@@ -2030,11 +2030,6 @@ void
 nix_tm_conf_fini(struct roc_nix *roc_nix)
 {
 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
-	uint16_t hw_lvl;
 
-	for (hw_lvl = 0; hw_lvl < NIX_TXSCH_LVL_CNT; hw_lvl++) {
-		plt_bitmap_free(nix->schq_bmp[hw_lvl]);
-		plt_bitmap_free(nix->schq_contig_bmp[hw_lvl]);
-	}
 	plt_free(nix->schq_bmp_mem);
 }
drivers/common/cnxk/roc_npa.c +0 -4
index a33f9a8499..9ec010119b 100644
@@ -1227,7 +1227,6 @@ npa_dev_init(struct npa_lf *lf, uintptr_t base, struct mbox *mbox)
 	lf->npa_qint_mem = plt_zmalloc(sizeof(struct npa_qint) * nr_pools, 0);
 	if (lf->npa_qint_mem == NULL) {
 		rc = NPA_ERR_ALLOC;
-		goto bmap_free;
 	}
 
 	/* Allocate memory for nap_aura_lim memory */
@@ -1256,8 +1255,6 @@ npa_dev_init(struct npa_lf *lf, uintptr_t base, struct mbox *mbox)
 	plt_free(lf->aura_lim);
 qint_free:
 	plt_free(lf->npa_qint_mem);
-bmap_free:
-	plt_bitmap_free(lf->npa_bmp);
 bmap_mem_free:
 	plt_free(lf->npa_bmp_mem);
 lf_free:
@@ -1274,7 +1271,6 @@ npa_dev_fini(struct npa_lf *lf)
 
 	plt_free(lf->aura_lim);
 	plt_free(lf->npa_qint_mem);
-	plt_bitmap_free(lf->npa_bmp);
 	plt_free(lf->npa_bmp_mem);
 	plt_free(lf->aura_attr);
 
drivers/common/cnxk/roc_npc_aging.c +0 -1
index 258c15e341..93b1bf2a47 100644
@@ -43,7 +43,6 @@ npc_aged_flows_bitmap_free(struct roc_npc *roc_npc)
 	struct roc_npc_flow_age *flow_age;
 
 	flow_age = &roc_npc->flow_age;
-	plt_bitmap_free(flow_age->aged_flows);
 	if (flow_age->age_mem)
 		plt_free(roc_npc->flow_age.age_mem);
 }
drivers/net/cnxk/cnxk_ethdev.c +0 -1
index ea980a6d5e..3d30c2939f 100644
@@ -311,7 +311,6 @@ nix_security_release(struct cnxk_eth_dev *dev)
 			plt_err("Failed to cleanup nix inline outb, rc=%d", rc);
 		ret |= rc;
 
-		plt_bitmap_free(dev->outb.sa_bmap);
 		plt_free(dev->outb.sa_bmap_mem);
 		dev->outb.sa_bmap = NULL;
 		dev->outb.sa_bmap_mem = NULL;
Signature · 1 line
2.47.1
#12 lore raw
In reply to Ariel Otilibili
Quoted 4 lines · On Sun, 22 Dec 2024 13:49:20 +0100 Ariel Otilibili <[email protected]> wrote:

Hello,

The first version was about the clearing of Coverity IDs 357712 & 357737; now this series is about the removal of rte_bitmap_free() and its alias plt_bitmap_free().

Quoted 8 lines

As of commit 07604f2644 ("maintainers: update for next-net tree"):

* rte_bitmap_free() returns an integer, and does nothing else
* all functions that call rte_bitmap_free() do not use this return value.

Details are in d5941e7269 ("devtools/cocci,lib/eal: remove unused rte_bitmap_free()").

Looking forward your feedback,

Not sure why this got ignored. Probably because it hit at the wrong time in the development cycle.

Since it ends up being an ABI change, it would need to happen on the next .11 release (ie 26.11) and would need to have a deprecation step. Ideally do a patch to remove all uses of the function in an earlier release like 26.03 or 26.07 and add a release note, then drop it in 26.11

Would also need to be rebased, since code base has changed. Automated patch review also raised some concerns.

## Patch Series Review: Remove unused rte_bitmap_free()

**Series Author:** Ariel Otilibili <[email protected]> **Version:** v4
**Patches:** 11

### Series Overview

This series removes the no-op rte_bitmap_free() function and all its callers across the DPDK codebase. The function only performed a NULL check and returned, making it functionally useless and causing Coverity warnings about unused return values.

---

### Patch 1/11: devtools/cocci, lib/eal: remove unused rte_bitmap_free()

**Subject Line Analysis:**

| Check | Status | Notes |
|-------|--------|-------|
| Length ≤60 chars | ❌ **ERROR** | Subject is 53 chars but contains a comma |
| Punctuation | ❌ **ERROR** | Contains comma (`,`) which is forbidden per AGENTS.md |
| Format | ⚠️ **WARNING** | Dual-component subjects should typically be separate patches |

**Commit Body:**

| Check | Status |
|-------|--------|
| Line wrap ≤75 chars | ✅ OK |
| Doesn't start with "It" | ✅ OK |
| Signed-off-by present | ✅ OK |
| Coverity issue tag | ✅ OK (properly formatted: `Coverity issue: 357712, 357737`) |

**Tag Order:**

| Check | Status | Notes |
|-------|--------|-------|
| Coverity before Fixes | ✅ OK | N/A - no Fixes tag in this patch |
| Cc: [email protected] | ✅ OK | Present (in commit notes after `---`) |

**Code Review:**
- ✅ Removes the no-op function correctly
- ✅ Removes the cocci rule that references this function
- ⚠️ **WARNING**: This is an ABI-breaking change (removes a public API). Should have release notes in doc/guides/rel_notes/.

---

### Patch 2/11: app/test: remove unused rte_bitmap_free()

**Subject Line Analysis:**

| Check | Status |
|-------|--------|
| Length ≤60 chars | ✅ OK (42 chars) |
| Lowercase after colon | ✅ OK |
| No trailing period | ✅ OK |
| No forbidden punctuation | ✅ OK |
| Correct prefix | ✅ OK (`app/test:`) |

**Commit Body:**

| Check | Status | Notes |
|-------|--------|-------|
| Line wrap ≤75 chars | ✅ OK | |
| Doesn't start with "It" | ✅ OK | |
| Signed-off-by | ✅ OK | |
| Coverity issue tag | ✅ OK | |
| Fixes tag format | ✅ OK | 12-char SHA with exact subject |
| Cc: [email protected] | ✅ OK | |

**Dependency Note:**
- Uses informal Depends on format in commit body. DPDK guidelines suggest Depends-on: series-NNNNN ("Title") in commit notes after ---.

---

### Patch 3/11: net/sfc: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body Issues:**

| Check | Status | Notes |
|-------|--------|-------|
| Cc: [email protected] | ⚠️ **WARNING** | Has Fixes tag but `Cc: [email protected]` is only in commit notes, not the commit message body proper |
| Signed-off-by | ✅ OK | |
| Fixes tag | ✅ OK | |

---

### Patch 4/11: crypto/ionic: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK - All required elements present.

---

### Patch 5/11: net/cxgbe: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK

---

### Patch 6/11: net/mlx4: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK

---

### Patch 7/11: common/mlx5: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK

---

### Patch 8/11: net/bonding: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK

---

### Patch 9/11: net/netvsc: remove unused rte_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK

---

### Patch 10/11: common/cnxk: remove unused plt_bitmap_free()

**Subject Line:** ✅ OK

**Commit Body:** ✅ OK - Good explanation of why plt_bitmap_free is being removed (it's an alias).

---

### Patch 11/11: {common,net}/cnxk: remove unused plt_bitmap_free()

**Subject Line Analysis:**

| Check | Status | Notes |
|-------|--------|-------|
| Length ≤60 chars | ✅ OK (54 chars) |
| Punctuation | ❌ **ERROR** | Contains comma (`,`) inside braces, which is forbidden |

**Commit Body:**

| Check | Status | Notes |
|-------|--------|-------|
| Depends-on format | ⚠️ **WARNING** | Uses informal `Depends on commits:` format instead of proper `Depends-on: series-NNNNN` |
| Multiple Fixes tags | ✅ OK | Multiple Fixes tags are acceptable |
| Signed-off-by | ✅ OK | |

**Code Review:**
- ⚠️ **WARNING** (Patch 11, roc_npa.c): Removing the goto bmap_free label and associated code creates a situation where if plt_zmalloc fails, the function falls through without returning an error. The error handling path looks broken:

```c
if (lf->npa_qint_mem == NULL) {
    rc = NPA_ERR_ALLOC;
-   goto bmap_free;
}
```

After this change, rc is set but execution continues to the next allocation. This appears to be a **bug**.

---

## Summary

### Errors (Must Fix)

1. **Patch 1/11**: Subject line contains forbidden comma punctuation
2. **Patch 11/11**: Subject line contains forbidden comma punctuation
3. **Patch 11/11**: Potential bug in roc_npa.c - error handling path appears broken after removing the goto bmap_free label

### Warnings (Should Fix)

1. **Patch 1/11**: Missing release notes for ABI-breaking change (removal of public API rte_bitmap_free)
2. **Patches 2-11**: Informal dependency notation; consider using Depends-on: series-NNNNN ("Title") format in commit notes
3. **All patches with Fixes tags**: Cc: [email protected] appears in commit notes after --- rather than in the commit message body (though this is a common practice and may be acceptable)

### Info (Consider)

- The series is well-structured with clear progression: first remove the function definition, then remove all callers
- Good use of Coverity issue tags where applicable
- Thorough identification of all callers across the codebase

### Recommended Actions

1. Fix subject lines in patches 1 and 11 to avoid commas:
- Patch 1: Split into two patches, or use devtools/cocci: remove rte_bitmap_free cocci rule and a separate patch for EAL
- Patch 11: Use common/cnxk: remove unused plt_bitmap_free() and include net/cnxk changes with it (or split into two patches)

2. Verify the error handling in roc_npa.c (patch 11) - the removal of goto bmap_free appears to break error handling when plt_zmalloc fails.

3. Add release notes for the removal of rte_bitmap_free() API.