mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>,
	linux-rdma@vger.kernel.org, leonro@nvidia.com, jgg@nvidia.com,
	zyjzyj2000@gmail.com
Cc: linux-kernel@vger.kernel.org, yangx.jy@fujitsu.com,
	lizhijian@fujitsu.com, y-goto@fujitsu.com
Subject: Re: [PATCH for-next v5 2/7] RDMA/rxe: Make MR functions accessible from other rxe source code
Date: Thu, 18 May 2023 17:28:36 -0500	[thread overview]
Message-ID: <a91d00eb-babc-de12-2413-c0d6a3b4dce6@gmail.com> (raw)
In-Reply-To: <412a29df988820ba9b7f0e8b4198ecae5b3dc79e.1684397037.git.matsuda-daisuke@fujitsu.com>

On 5/18/23 03:21, Daisuke Matsuda wrote:
> Some functions in rxe_mr.c are going to be used in rxe_odp.c, which is to
> be created in the subsequent patch. List the declarations of the functions
> in rxe_loc.h.
> 
> Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_loc.h | 14 ++++++++++++++
>  drivers/infiniband/sw/rxe/rxe_mr.c  | 18 ++++--------------
>  2 files changed, 18 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> index 804b15e929dd..00fedd1a4980 100644
> --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> @@ -60,7 +60,9 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
>  
>  /* rxe_mr.c */
>  u8 rxe_get_next_key(u32 last_key);
> +void rxe_mr_init(int access, struct rxe_mr *mr);
>  void rxe_mr_init_dma(int access, struct rxe_mr *mr);
> +int rxe_mr_fill_pages_from_sgt(struct rxe_mr *mr, struct sg_table *sgt);
>  int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>  		     int access, struct rxe_mr *mr);
>  int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr);
> @@ -71,6 +73,8 @@ int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
>  	      void *addr, int length, enum rxe_mr_copy_dir dir);
>  int rxe_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg,
>  		  int sg_nents, unsigned int *sg_offset);
> +int rxe_mr_copy_xarray(struct rxe_mr *mr, u64 iova, void *addr,
> +		       unsigned int length, enum rxe_mr_copy_dir dir);
>  int rxe_mr_do_atomic_op(struct rxe_mr *mr, u64 iova, int opcode,
>  			u64 compare, u64 swap_add, u64 *orig_val);
>  int rxe_mr_do_atomic_write(struct rxe_mr *mr, u64 iova, u64 value);
> @@ -82,6 +86,16 @@ int rxe_invalidate_mr(struct rxe_qp *qp, u32 key);
>  int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe);
>  void rxe_mr_cleanup(struct rxe_pool_elem *elem);
>  
> +static inline unsigned long rxe_mr_iova_to_index(struct rxe_mr *mr, u64 iova)
> +{
> +	return (iova >> mr->page_shift) - (mr->ibmr.iova >> mr->page_shift);
> +}
> +
> +static inline unsigned long rxe_mr_iova_to_page_offset(struct rxe_mr *mr, u64 iova)
> +{
> +	return iova & (mr_page_size(mr) - 1);
> +}
> +
>  /* rxe_mw.c */
>  int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata);
>  int rxe_dealloc_mw(struct ib_mw *ibmw);
> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> index 0e538fafcc20..ffbac6f5e828 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> @@ -49,7 +49,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)
>  				| IB_ACCESS_REMOTE_WRITE	\
>  				| IB_ACCESS_REMOTE_ATOMIC)
>  
> -static void rxe_mr_init(int access, struct rxe_mr *mr)
> +void rxe_mr_init(int access, struct rxe_mr *mr)
>  {
>  	u32 lkey = mr->elem.index << 8 | rxe_get_next_key(-1);
>  	u32 rkey = (access & IB_ACCESS_REMOTE) ? lkey : 0;
> @@ -77,16 +77,6 @@ void rxe_mr_init_dma(int access, struct rxe_mr *mr)
>  	mr->ibmr.type = IB_MR_TYPE_DMA;
>  }
>  
> -static unsigned long rxe_mr_iova_to_index(struct rxe_mr *mr, u64 iova)
> -{
> -	return (iova >> mr->page_shift) - (mr->ibmr.iova >> mr->page_shift);
> -}
> -
> -static unsigned long rxe_mr_iova_to_page_offset(struct rxe_mr *mr, u64 iova)
> -{
> -	return iova & (mr_page_size(mr) - 1);
> -}
> -
>  static bool is_pmem_page(struct page *pg)
>  {
>  	unsigned long paddr = page_to_phys(pg);
> @@ -96,7 +86,7 @@ static bool is_pmem_page(struct page *pg)
>  				 IORES_DESC_PERSISTENT_MEMORY);
>  }
>  
> -static int rxe_mr_fill_pages_from_sgt(struct rxe_mr *mr, struct sg_table *sgt)
> +int rxe_mr_fill_pages_from_sgt(struct rxe_mr *mr, struct sg_table *sgt)
>  {
>  	XA_STATE(xas, &mr->page_list, 0);
>  	struct sg_page_iter sg_iter;
> @@ -247,8 +237,8 @@ int rxe_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sgl,
>  	return ib_sg_to_pages(ibmr, sgl, sg_nents, sg_offset, rxe_set_page);
>  }
>  
> -static int rxe_mr_copy_xarray(struct rxe_mr *mr, u64 iova, void *addr,
> -			      unsigned int length, enum rxe_mr_copy_dir dir)
> +int rxe_mr_copy_xarray(struct rxe_mr *mr, u64 iova, void *addr,
> +		       unsigned int length, enum rxe_mr_copy_dir dir)
>  {
>  	unsigned int page_offset = rxe_mr_iova_to_page_offset(mr, iova);
>  	unsigned long index = rxe_mr_iova_to_index(mr, iova);

Looks good.

Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>


  reply	other threads:[~2023-05-18 22:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18  8:21 [PATCH for-next v5 0/7] On-Demand Paging on SoftRoCE Daisuke Matsuda
2023-05-18  8:21 ` [PATCH for-next v5 1/7] RDMA/rxe: Always defer tasks on responder and completer to workqueue Daisuke Matsuda
2023-05-18  8:26   ` Daisuke Matsuda (Fujitsu)
2023-05-18 22:25   ` Bob Pearson
2023-05-18  8:21 ` [PATCH for-next v5 2/7] RDMA/rxe: Make MR functions accessible from other rxe source code Daisuke Matsuda
2023-05-18 22:28   ` Bob Pearson [this message]
2023-05-18  8:21 ` [PATCH for-next v5 3/7] RDMA/rxe: Move resp_states definition to rxe_verbs.h Daisuke Matsuda
2023-05-18 22:30   ` Bob Pearson
2023-05-18  8:21 ` [PATCH for-next v5 4/7] RDMA/rxe: Add page invalidation support Daisuke Matsuda
2023-05-19 17:08   ` Bob Pearson
2023-05-18  8:21 ` [PATCH for-next v5 5/7] RDMA/rxe: Allow registering MRs for On-Demand Paging Daisuke Matsuda
2023-05-19 17:09   ` Bob Pearson
2023-06-12 16:18   ` Jason Gunthorpe
2023-07-19  6:00     ` Daisuke Matsuda (Fujitsu)
2023-07-21 18:46       ` Jason Gunthorpe
2023-05-18  8:21 ` [PATCH for-next v5 6/7] RDMA/rxe: Add support for Send/Recv/Write/Read with ODP Daisuke Matsuda
2023-05-19 17:10   ` Bob Pearson
2023-05-19 17:10   ` Bob Pearson
2023-06-12 16:22   ` Jason Gunthorpe
2023-07-19  6:01     ` Daisuke Matsuda (Fujitsu)
2023-09-08  6:35     ` Daisuke Matsuda (Fujitsu)
2023-09-08 13:14       ` Jason Gunthorpe
2023-05-18  8:21 ` [PATCH for-next v5 7/7] RDMA/rxe: Add support for the traditional Atomic operations " Daisuke Matsuda
2023-05-22 18:49   ` Bob Pearson
2023-05-19  6:41 ` [PATCH for-next v5 0/7] On-Demand Paging on SoftRoCE Guoqing Jiang
2023-05-19  9:57   ` Daisuke Matsuda (Fujitsu)
2023-05-19 10:20     ` Guoqing Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a91d00eb-babc-de12-2413-c0d6a3b4dce6@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=matsuda-daisuke@fujitsu.com \
    --cc=y-goto@fujitsu.com \
    --cc=yangx.jy@fujitsu.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome