public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/siw: Remove unused siw_mem_add
@ 2025-05-05 21:02 linux
  2025-05-06  8:54 ` Bernard Metzler
  2025-05-06 17:31 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: linux @ 2025-05-05 21:02 UTC (permalink / raw)
  To: bmt, jgg, leon; +Cc: linux-rdma, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

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

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/infiniband/sw/siw/siw_mem.c | 24 ------------------------
 drivers/infiniband/sw/siw/siw_mem.h |  1 -
 2 files changed, 25 deletions(-)

diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c
index dcb963607c8b..ac943474d797 100644
--- a/drivers/infiniband/sw/siw/siw_mem.c
+++ b/drivers/infiniband/sw/siw/siw_mem.c
@@ -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()
  *
diff --git a/drivers/infiniband/sw/siw/siw_mem.h b/drivers/infiniband/sw/siw/siw_mem.h
index e74cfcd6dbc1..8e769d30e2ac 100644
--- a/drivers/infiniband/sw/siw/siw_mem.h
+++ b/drivers/infiniband/sw/siw/siw_mem.h
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE:  [PATCH] RDMA/siw: Remove unused siw_mem_add
  2025-05-05 21:02 [PATCH] RDMA/siw: Remove unused siw_mem_add linux
@ 2025-05-06  8:54 ` Bernard Metzler
  2025-05-06 17:31 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Bernard Metzler @ 2025-05-06  8:54 UTC (permalink / raw)
  To: linux@treblig.org, jgg@ziepe.ca, leon@kernel.org
  Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: linux@treblig.org <linux@treblig.org>
> Sent: Monday, May 5, 2025 11:02 PM
> To: Bernard Metzler <BMT@zurich.ibm.com>; jgg@ziepe.ca; leon@kernel.org
> Cc: linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org; Dr. David
> Alan Gilbert <linux@treblig.org>
> Subject: [EXTERNAL] [PATCH] RDMA/siw: Remove unused siw_mem_add
> 
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> siw_mem_add() was added in 2019 by
> commit 2251334dcac9 ("rdma/siw: application buffer management")
> but has remained unused.
> 
> Remove it.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>  drivers/infiniband/sw/siw/siw_mem.c | 24 ------------------------
>  drivers/infiniband/sw/siw/siw_mem.h |  1 -
>  2 files changed, 25 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_mem.c
> b/drivers/infiniband/sw/siw/siw_mem.c
> index dcb963607c8b..ac943474d797 100644
> --- a/drivers/infiniband/sw/siw/siw_mem.c
> +++ b/drivers/infiniband/sw/siw/siw_mem.c
> @@ -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()
>   *
> diff --git a/drivers/infiniband/sw/siw/siw_mem.h
> b/drivers/infiniband/sw/siw/siw_mem.h
> index e74cfcd6dbc1..8e769d30e2ac 100644
> --- a/drivers/infiniband/sw/siw/siw_mem.h
> +++ b/drivers/infiniband/sw/siw/siw_mem.h
> @@ -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);
> --
> 2.49.0

Thanks David, good catch!

Acked-by: Bernard Metzler <bmt@zurich.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/siw: Remove unused siw_mem_add
  2025-05-05 21:02 [PATCH] RDMA/siw: Remove unused siw_mem_add linux
  2025-05-06  8:54 ` Bernard Metzler
@ 2025-05-06 17:31 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2025-05-06 17:31 UTC (permalink / raw)
  To: linux; +Cc: bmt, leon, linux-rdma, linux-kernel

On Mon, May 05, 2025 at 10:02:26PM +0100, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> siw_mem_add() was added in 2019 by
> commit 2251334dcac9 ("rdma/siw: application buffer management")
> but has remained unused.
> 
> Remove it.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-06 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-05 21:02 [PATCH] RDMA/siw: Remove unused siw_mem_add linux
2025-05-06  8:54 ` Bernard Metzler
2025-05-06 17:31 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox