public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH libibverbs v6 3/7] livibverbs: Add support for XRC SRQs
Date: Tue, 4 Jun 2013 14:48:59 -0600	[thread overview]
Message-ID: <20130604204859.GA30182@obsidianresearch.com> (raw)
In-Reply-To: <1370371791-15018-4-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Tue, Jun 04, 2013 at 11:49:47AM -0700, sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:

>  enum verbs_context_mask {
>  	VERBS_CONTEXT_XRCD	= 1 << 0,
> -	VERBS_CONTEXT_RESERVED	= 1 << 1
> +	VERBS_CONTEXT_SRQ	= 1 << 1,
> +	VERBS_CONTEXT_RESERVED	= 1 << 2
>  };

Why is _RESERVED being re-numbered here? That worries me..

For that matter, what is it for?

Frankly, I would ditch mask for verbs_context op members and other
structures that are size based. What does it mean if the size includes
get_srq_num, but VERBS_CONTEXT_SRQ is 0 and *get_srq_num is
null/non-null?

Simpler rule: If the size says the entry is there, then it is
there.

Reserve mask for some other future use.

> +static inline uint32_t ibv_get_srq_num(struct ibv_srq *srq)
> +{
> +	struct verbs_context *vctx = verbs_get_ctx_op(srq->context, get_srq_num);
> +	if (!vctx) {
> +		errno = ENOSYS;
> +		return 0;
> +	}
> +	return vctx->get_srq_num(srq);

Might want to stream line this flow a bit:

static inline struct verbs_context *__verbs_get_ctx_op(struct ibv_context *context,
                                                       size_t op)
{
       struct verbs_context *vctx = verbs_get_ctx(ctx);
       if (vctx && vctx->sz >= sizeof(*vctx) - op &&
           *((void **)vctx + op) != NULL)
         return vctx;
       errno = ENOSYS;
       return NULL;
}
#define verbs_get_ctx_op(ctx, op) __verbs_get_ctx_op(ctx, offsetof(struct verbs_context, op))

static inline uint32_t ibv_get_srq_num(struct ibv_srq *srq)
{
	struct verbs_context *vctx = verbs_get_ctx_op(srq->context,get_srq_num);
	if (!vctx)
	     return 0;
	return vctx->get_srq_num(srq);
}

> diff --git a/src/libibverbs.map b/src/libibverbs.map
> index c190eb9..00f9062 100644
> +++ b/src/libibverbs.map
> @@ -103,4 +103,6 @@ IBVERBS_1.1 {
>  
>  		ibv_cmd_open_xrcd;
>  		ibv_cmd_close_xrcd;
> +		ibv_cmd_create_srq_ex;
> +		
>  } IBVERBS_1.0;

Hum, so drivers that implement XRC will need to be paired with a new
verbs... Bit disappointing, did we want to try and address that?

Jason
--
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:[~2013-06-04 20:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 18:49 [PATCH libibverbs v6 0/7] Add extension and XRC QP support sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1370371791-15018-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-06-04 18:49   ` [PATCH libibverbs v6 1/7] Infrastructure to support verbs extensions sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-06-04 18:49   ` [PATCH libibverbs v6 2/7] libibverbs: Introduce XRC domains sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-06-04 18:49   ` [PATCH libibverbs v6 3/7] livibverbs: Add support for XRC SRQs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1370371791-15018-4-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-06-04 20:48       ` Jason Gunthorpe [this message]
     [not found]         ` <20130604204859.GA30182-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-04 21:44           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A823736FD2CF92-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-06-04 21:59               ` Jason Gunthorpe
2013-06-04 18:49   ` [PATCH libibverbs v6 4/7] libibverbs: Add support for XRC QPs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-06-04 18:49   ` [PATCH libibverbs v6 5/7] libibverbs: Add ibv_open_qp sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2013-06-04 18:49   ` [PATCH libibverbs v6 6/7] libibverbs: Add man page for ibv_open_qp sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found]     ` <1370371791-15018-7-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-06-04 19:02       ` Steve Wise
2013-06-04 20:54       ` Jason Gunthorpe
     [not found]         ` <20130604205413.GB30182-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-06-04 21:49           ` Hefty, Sean
     [not found]             ` <1828884A29C6694DAF28B7E6B8A823736FD2CFAB-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2013-06-04 22:02               ` Jason Gunthorpe
2013-06-04 18:49   ` [PATCH libibverbs v6 7/7] libibverbs: Add XRC sample application sean.hefty-ral2JQCrhuEAvxtiuMwx3w

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=20130604204859.GA30182@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox