All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 11/11] IB: provide better access flags for fast registrations
Date: Mon, 23 Nov 2015 11:58:29 -0700	[thread overview]
Message-ID: <20151123185829.GE32085@obsidianresearch.com> (raw)
In-Reply-To: <1448214409-7729-12-git-send-email-hch-jcswGhMUV9g@public.gmane.org>

On Sun, Nov 22, 2015 at 06:46:49PM +0100, Christoph Hellwig wrote:
> Instead of the confusing IB spec values provide a flags argument that
> describes:
> 
>   a) the operation we perform the memory registration for, and
>   b) if we want to access it for read or write purposes.
> 
> This helps to abstract out the IB vs iWarp differences as well.

This is so much better, thanks

> +#define IB_REG_LKEY		(ib_reg_scope_t)0x0000
> +#define IB_REG_RKEY		(ib_reg_scope_t)0x0001

Wrap in () just for convention?

> +static inline int ib_scope_to_access(ib_reg_scope_t scope)
> +{
> +	unsigned int acc = 0;
> +
> +	if (scope & IB_REG_RKEY) {
> +		WARN_ON(scope & IB_REG_OP_SEND);
> +
> +		if (scope & IB_REG_OP_RDMA_READ)
> +			acc |= IB_ACCESS_REMOTE_READ;
> +		if (scope & IB_REG_OP_RDMA_WRITE)
> +			acc |= IB_ACCESS_REMOTE_WRITE | IB_ACCESS_LOCAL_WRITE;
> +	} else {
> +		if (scope & IB_REG_OP_RDMA_READ)
> +			acc |= IB_ACCESS_LOCAL_WRITE;

> +	}
> +
> +	return acc;
> +}
> +
> +static inline int iwarp_scope_to_access(ib_reg_scope_t scope)
> +{

Maybe

unsigned int acc = ib_scope_to_access(scope);
if ((scope & (IB_REG_RKEY | IB_REG_OP_RDMA_READ)) == (IB_REG_RKEY | IB_REG_OP_RDMA_READ))
   acc |= IB_ACCESS_LOCAL_WRITE;

return acc;

Makes it a bit clearer what the only difference is.

Is this enough to purge the cap test related to this?

Jaason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-11-23 18:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-22 17:46 memory registration updates Christoph Hellwig
     [not found] ` <1448214409-7729-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-11-22 17:46   ` [PATCH 01/11] IB: start documenting device capabilities Christoph Hellwig
2015-11-22 17:46   ` [PATCH 02/11] IB: remove ib_query_mr Christoph Hellwig
2015-11-22 17:46   ` [PATCH 03/11] IB: remove support for phys MRs Christoph Hellwig
     [not found]     ` <1448214409-7729-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-11-24 12:01       ` Devesh Sharma
2015-11-22 17:46   ` [PATCH 04/11] IB: remove in-kernel support for memory windows Christoph Hellwig
2015-11-22 17:46   ` [PATCH 05/11] cxgb3: simplify iwch_get_dma_wr Christoph Hellwig
2015-11-22 17:46   ` [PATCH 06/11] nes: simplify nes_reg_phys_mr calling conventions Christoph Hellwig
2015-11-22 17:46   ` [PATCH 07/11] amso1100: fold c2_reg_phys_mr into c2_get_dma_mr Christoph Hellwig
2015-11-22 17:46   ` [PATCH 08/11] ehca: stop using struct ib_phys_buf Christoph Hellwig
2015-11-22 17:46   ` [PATCH 09/11] IB: remove the struct ib_phys_buf definition Christoph Hellwig
2015-11-22 17:46   ` [PATCH 10/11] IB: only keep a single key in struct ib_mr Christoph Hellwig
     [not found]     ` <1448214409-7729-11-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-11-23 19:41       ` Jason Gunthorpe
     [not found]         ` <20151123194124.GF32085-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-11-23 19:48           ` Christoph Hellwig
2015-12-22  9:17       ` Sagi Grimberg
     [not found]         ` <56791542.6020604-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-22 13:13           ` Christoph Hellwig
     [not found]             ` <20151222131326.GA25267-jcswGhMUV9g@public.gmane.org>
2015-12-22 13:50               ` Sagi Grimberg
     [not found]                 ` <56795514.9090704-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-22 13:59                   ` Christoph Hellwig
     [not found]                     ` <20151222135927.GA26311-jcswGhMUV9g@public.gmane.org>
2015-12-22 16:58                       ` Sagi Grimberg
     [not found]                         ` <56798126.9000003-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-22 21:09                           ` Jason Gunthorpe
     [not found]                             ` <7sikrilf3ik3fjsgppqxh9gn.1451043246057@email.android.com>
     [not found]                               ` <CAMHdiBDv9mScD+5o90OQ_tmAKw9o48_jfao6W+EBOZkUg+wReA@mail.gmail.com>
     [not found]                                 ` <CAMHdiBDv9mScD+5o90OQ_tmAKw9o48_jfao6W+EBOZkUg+wReA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-25 16:46                                   ` Liran Liss
     [not found]                                     ` <CAMHdiBC75n+u9BSMsKxJwcaBnGL68_3UBeQQtHp_CD5KGcUTnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-01-05 17:46                                       ` Jason Gunthorpe
     [not found]                                         ` <20160105174636.GD16269-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-01-06  6:08                                           ` Christoph Hellwig
     [not found]                                             ` <20160106060806.GA16509-jcswGhMUV9g@public.gmane.org>
2016-01-06 15:10                                               ` Sagi Grimberg
     [not found]                                                 ` <568D2E4E.5020806-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-01-06 16:59                                                   ` Jason Gunthorpe
2015-11-22 17:46   ` [PATCH 11/11] IB: provide better access flags for fast registrations Christoph Hellwig
     [not found]     ` <1448214409-7729-12-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-11-23 15:09       ` Chuck Lever
     [not found]         ` <EE465F12-A5F6-4C95-A77C-199DFF8F77BD-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2015-11-23 15:49           ` Christoph Hellwig
2015-11-23 18:58       ` Jason Gunthorpe [this message]
     [not found]         ` <20151123185829.GE32085-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-11-23 19:44           ` Christoph Hellwig
2015-11-23  9:03   ` memory registration updates Sagi Grimberg
     [not found]     ` <5652D66E.5070600-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-11-23 14:16       ` Christoph Hellwig
     [not found]         ` <20151123141650.GA11116-jcswGhMUV9g@public.gmane.org>
2015-11-23 15:17           ` Sagi Grimberg
     [not found]             ` <56532E0A.20907-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-11-23 19:43               ` Christoph Hellwig
2015-11-23 15:06   ` Steve Wise

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=20151123185829.GE32085@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.