Skip to contentSkip to conversation

RDMA/siw: Remove unused siw_mem_add

PATCH Applied [email protected] 3 participants 3 messages May 5, 2025 – May 6, 2025

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

PATCH 1/1 RDMA/siw: Remove unused siw_mem_add

From: "Dr. David Alan Gilbert" <[email protected]>

siw_mem_add() was added in 2019 by
commit 2251334dcac9 ("rdma/siw: application buffer management") but has remained unused.

Remove it.

---
 drivers/infiniband/sw/siw/siw_mem.c | 24 ------------------------
 drivers/infiniband/sw/siw/siw_mem.h |  1 -
 2 files changed, 25 deletions(-)
drivers/infiniband/sw/siw/siw_mem.c +0 -24
index dcb963607c8b..ac943474d797 100644
@@ -17,30 +17,6 @@
 /* Stag lookup is based on its index part only (24 bits). */
 #define SIW_STAG_MAX_INDEX	0x00ffffff
 
-/*
- * The code avoids special Stag of zero and tries to randomize
- * STag values between 1 and SIW_STAG_MAX_INDEX.
- */
-int siw_mem_add(struct siw_device *sdev, struct siw_mem *m)
-{
-	struct xa_limit limit = XA_LIMIT(1, SIW_STAG_MAX_INDEX);
-	u32 id, next;
-
-	get_random_bytes(&next, 4);
-	next &= SIW_STAG_MAX_INDEX;
-
-	if (xa_alloc_cyclic(&sdev->mem_xa, &id, m, limit, &next,
-	    GFP_KERNEL) < 0)
-		return -ENOMEM;
-
-	/* Set the STag index part */
-	m->stag = id << 8;
-
-	siw_dbg_mem(m, "new MEM object\n");
-
-	return 0;
-}
-
 /*
  * siw_mem_id2obj()
  *
drivers/infiniband/sw/siw/siw_mem.h +0 -1
index e74cfcd6dbc1..8e769d30e2ac 100644
@@ -12,7 +12,6 @@ void siw_umem_release(struct siw_umem *umem);
 struct siw_pbl *siw_pbl_alloc(u32 num_buf);
 dma_addr_t siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int *idx);
 struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index);
-int siw_mem_add(struct siw_device *sdev, struct siw_mem *m);
 int siw_invalidate_stag(struct ib_pd *pd, u32 stag);
 int siw_check_mem(struct ib_pd *pd, struct siw_mem *mem, u64 addr,
 		  enum ib_access_flags perms, int len);
Signature · 1 line
2.49.0
Acked-by on v1 1/1
#1 lore raw
Quoted 73 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, May 5, 2025 11:02 PM
To: Bernard Metzler <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Dr. David Alan Gilbert <[email protected]>
Subject: [EXTERNAL] [PATCH] RDMA/siw: Remove unused siw_mem_add

From: "Dr. David Alan Gilbert" <[email protected]>

siw_mem_add() was added in 2019 by
commit 2251334dcac9 ("rdma/siw: application buffer management") but has remained unused.

Remove it.

---
 drivers/infiniband/sw/siw/siw_mem.c | 24 ------------------------
 drivers/infiniband/sw/siw/siw_mem.h |  1 -
 2 files changed, 25 deletions(-)
drivers/infiniband/sw/siw/siw_mem.c +0 -24
index dcb963607c8b..ac943474d797 100644
@@ -17,30 +17,6 @@
 /* Stag lookup is based on its index part only (24 bits). */
 #define SIW_STAG_MAX_INDEX	0x00ffffff
 
-/*
- * The code avoids special Stag of zero and tries to randomize
- * STag values between 1 and SIW_STAG_MAX_INDEX.
- */
-int siw_mem_add(struct siw_device *sdev, struct siw_mem *m)
-{
-	struct xa_limit limit = XA_LIMIT(1, SIW_STAG_MAX_INDEX);
-	u32 id, next;
-
-	get_random_bytes(&next, 4);
-	next &= SIW_STAG_MAX_INDEX;
-
-	if (xa_alloc_cyclic(&sdev->mem_xa, &id, m, limit, &next,
-	    GFP_KERNEL) < 0)
-		return -ENOMEM;
-
-	/* Set the STag index part */
-	m->stag = id << 8;
-
-	siw_dbg_mem(m, "new MEM object\n");
-
-	return 0;
-}
-
 /*
  * siw_mem_id2obj()
  *
drivers/infiniband/sw/siw/siw_mem.h +0 -1
index e74cfcd6dbc1..8e769d30e2ac 100644
@@ -12,7 +12,6 @@ void siw_umem_release(struct siw_umem *umem);
 struct siw_pbl *siw_pbl_alloc(u32 num_buf);
 dma_addr_t siw_pbl_get_buffer(struct siw_pbl *pbl, u64 off, int *len, int
 *idx);
 struct siw_mem *siw_mem_id2obj(struct siw_device *sdev, int stag_index);
-int siw_mem_add(struct siw_device *sdev, struct siw_mem *m);
 int siw_invalidate_stag(struct ib_pd *pd, u32 stag);
 int siw_check_mem(struct ib_pd *pd, struct siw_mem *mem, u64 addr,
Quoted 3 lines

enum ib_access_flags perms, int len);
--
2.49.0

Thanks David, good catch!

maintainer Applied
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Mon, May 05, 2025 at 10:02:26PM +0100, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

siw_mem_add() was added in 2019 by
commit 2251334dcac9 ("rdma/siw: application buffer management") but has remained unused.

Quoted 8 lines

Remove it.

---
 drivers/infiniband/sw/siw/siw_mem.c | 24 ------------------------
 drivers/infiniband/sw/siw/siw_mem.h |  1 -
 2 files changed, 25 deletions(-)

Applied to for-next, thanks

Jason