All of lore.kernel.org
 help / color / mirror / Atom feed
From: Knut Omang <knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Yishai Hadas <yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mukesh Kacker
	<mukesh.kacker-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	"yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org"
	<yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Subject: Re: [PATCH libibverbs 1/3] Add new call ibv_cmd_create_ah_ex which supports extra parameters
Date: Mon, 05 Sep 2016 13:53:31 +0200	[thread overview]
Message-ID: <1473076411.3975.87.camel@oracle.com> (raw)
In-Reply-To: <09e67035-0c8a-9b44-fa84-08413dd6ac46-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

On Thu, 2016-09-01 at 11:34 +0300, Yishai Hadas wrote:
> On 9/1/2016 9:59 AM, Knut Omang wrote:
> > 
> > The original call ibv_cmd_create_ah does not allow vendor specific request or
> > response parameters to be defined and passed through to kernel space.
> > 
> > To keep backward compatibility, introduce a new extended call which accepts
> > cmd and resp parameters similar to other parts of the API.
> > Reimplement the old call to just use the new extended call.
> > 
> > Signed-off-by: Knut Omang <knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > Reviewed-by: Mukesh Kacker <mukesh.kacker-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > ---
> >  include/infiniband/driver.h |  4 ++++
> >  src/cmd.c                   | 50 +++++++++++++++++++++++++--------------------
> >  src/libibverbs.map          |  1 +
> >  3 files changed, 33 insertions(+), 22 deletions(-)
> > 
> > diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
> > index 65fa44f..c46c55f 100644
> > --- a/include/infiniband/driver.h
> > +++ b/include/infiniband/driver.h
> > @@ -229,6 +229,10 @@ int ibv_cmd_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr,
> >  			  struct ibv_recv_wr **bad_wr);
> >  int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
> >  		      struct ibv_ah_attr *attr);
> > +int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah,
> > +			struct ibv_ah_attr *attr,
> > +			struct ibv_create_ah *cmd, size_t cmd_size,
> > +			struct ibv_create_ah_resp *resp, size_t resp_size);
> >  int ibv_cmd_destroy_ah(struct ibv_ah *ah);
> >  int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
> >  int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t lid);
> > diff --git a/src/cmd.c b/src/cmd.c
> > index cb9e34c..12d8640 100644
> > --- a/src/cmd.c
> > +++ b/src/cmd.c
> > @@ -1463,38 +1463,44 @@ int ibv_cmd_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr,
> >  	return ret;
> >  }
> > 
> > -int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
> > -		      struct ibv_ah_attr *attr)
> > +int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_attr *attr,
> > +			 struct ibv_create_ah *cmd, size_t cmd_size,
> > +			 struct ibv_create_ah_resp *resp, size_t resp_size)
> >  {
> > -	struct ibv_create_ah      cmd;
> > -	struct ibv_create_ah_resp resp;
> > -
> > -	IBV_INIT_CMD_RESP(&cmd, sizeof cmd, CREATE_AH, &resp, sizeof resp);
> > -	cmd.user_handle            = (uintptr_t) ah;
> > -	cmd.pd_handle              = pd->handle;
> > -	cmd.attr.dlid              = attr->dlid;
> > -	cmd.attr.sl                = attr->sl;
> > -	cmd.attr.src_path_bits     = attr->src_path_bits;
> > -	cmd.attr.static_rate       = attr->static_rate;
> > -	cmd.attr.is_global         = attr->is_global;
> > -	cmd.attr.port_num          = attr->port_num;
> > -	cmd.attr.grh.flow_label    = attr->grh.flow_label;
> > -	cmd.attr.grh.sgid_index    = attr->grh.sgid_index;
> > -	cmd.attr.grh.hop_limit     = attr->grh.hop_limit;
> > -	cmd.attr.grh.traffic_class = attr->grh.traffic_class;
> > -	memcpy(cmd.attr.grh.dgid, attr->grh.dgid.raw, 16);
> > +	IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_AH, resp, resp_size);
> You should start with a patch extending the kernel part while supporting 
> backwards compatibility, later on when patch applied come with a 
> matching user space patch for a review.
> 
> In addition, if you supply an extended command you should work with the 
> extended macros for issuing a command to fully enable future extensions 
> (e.g IBV_INIT_CMD_RESP_EX_V) and with a specific EX command as done in 
> other cases (e.g CREATE_QP_EX).

Having looked at the details, I tend to think that what I am adding here is not
an extended command, it is more of a fix for a missing feature of 
the original ibv_cmd_create_ah, and the only reason for introducing a new 
call is to maintain backward comp. Introducing additional complexity 
with the kernel involved for something that is a pure user level side
seems somewhat overkill.

Maybe I can rename it to ibv_cmd_create_ah_v2 (or v3?) to avoid associating it
with the extended command set? 

As Jason and I discussed in another subthread here, we can consolidate this into a 
single command once we get to a common library,
as this is all internal to the rdma user level stack.

Ok?

Knut

> > 
> > +	cmd->user_handle            = (uintptr_t) ah;
> > +	cmd->pd_handle              = pd->handle;
> > +	cmd->attr.dlid              = attr->dlid;
> > +	cmd->attr.sl                = attr->sl;
> > +	cmd->attr.src_path_bits     = attr->src_path_bits;
> > +	cmd->attr.static_rate       = attr->static_rate;
> > +	cmd->attr.is_global         = attr->is_global;
> > +	cmd->attr.port_num          = attr->port_num;
> > +	cmd->attr.grh.flow_label    = attr->grh.flow_label;
> > +	cmd->attr.grh.sgid_index    = attr->grh.sgid_index;
> > +	cmd->attr.grh.hop_limit     = attr->grh.hop_limit;
> > +	cmd->attr.grh.traffic_class = attr->grh.traffic_class;
> > +	memcpy(cmd->attr.grh.dgid, attr->grh.dgid.raw, 16);
> > 
> > -	if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
> > +	if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
> >  		return errno;
> > 
> > -	(void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
> > +	(void) VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp);
> > 
> > -	ah->handle  = resp.handle;
> > +	ah->handle  = resp->handle;
> >  	ah->context = pd->context;
> > 
> >  	return 0;
> >  }
> > 
> > +int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
> > +		      struct ibv_ah_attr *attr)
> > +{
> > +	struct ibv_create_ah      cmd;
> > +	struct ibv_create_ah_resp resp;
> > +	return ibv_cmd_create_ah_ex(pd, ah, attr, &cmd, sizeof(cmd), &resp, sizeof(resp));
> > +}
> > +
> >  int ibv_cmd_destroy_ah(struct ibv_ah *ah)
> >  {
> >  	struct ibv_destroy_ah cmd;
> > diff --git a/src/libibverbs.map b/src/libibverbs.map
> > index 5134bd9..483df72 100644
> > --- a/src/libibverbs.map
> > +++ b/src/libibverbs.map
> > @@ -64,6 +64,7 @@ IBVERBS_1.0 {
> >  		ibv_cmd_post_recv;
> >  		ibv_cmd_post_srq_recv;
> >  		ibv_cmd_create_ah;
> > +		ibv_cmd_create_ah_ex;
> >  		ibv_cmd_destroy_ah;
> >  		ibv_cmd_attach_mcast;
> >  		ibv_cmd_detach_mcast;
> > 
> --
> 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
--
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:[~2016-09-05 11:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01  6:59 [PATCH libibverbs 0/3] SIF related libibverbs patches Knut Omang
     [not found] ` <1472713193-22397-1-git-send-email-knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-01  6:59   ` [PATCH libibverbs 1/3] Add new call ibv_cmd_create_ah_ex which supports extra parameters Knut Omang
     [not found]     ` <1472713193-22397-2-git-send-email-knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-01  8:34       ` Yishai Hadas
     [not found]         ` <09e67035-0c8a-9b44-fa84-08413dd6ac46-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-01  9:53           ` Knut Omang
2016-09-05 11:53           ` Knut Omang [this message]
     [not found]             ` <1473076411.3975.87.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-05 14:05               ` Yishai Hadas
     [not found]                 ` <50c8e0ab-f7f4-85b1-09f7-a930ad445ee0-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-05 14:55                   ` Knut Omang
2016-09-01 16:49       ` Jason Gunthorpe
     [not found]         ` <20160901164939.GD6479-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-01 17:22           ` Knut Omang
     [not found]             ` <1472750558.9410.230.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-01 17:36               ` Jason Gunthorpe
2016-09-01 18:05               ` Jason Gunthorpe
     [not found]                 ` <20160901180512.GB20098-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-01 18:23                   ` Knut Omang
     [not found]                     ` <1472754220.9410.236.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-02  2:06                       ` Jason Gunthorpe
     [not found]                         ` <20160902020642.GA30057-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-02  7:49                           ` Knut Omang
     [not found]                             ` <1472802582.3975.16.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-03  7:30                               ` Knut Omang
     [not found]                                 ` <1472887840.9410.364.camel-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-05  2:38                                   ` Jason Gunthorpe
     [not found]                                     ` <20160905023817.GD21542-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-05  4:56                                       ` Knut Omang
2016-09-01  6:59   ` [PATCH libibverbs 2/3] Add padding to get proper end alignment of ibv_reg_mr_resp Knut Omang
     [not found]     ` <1472713193-22397-3-git-send-email-knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-01  8:56       ` Yishai Hadas
     [not found]         ` <6ce4a2f9-64ee-29af-72e8-1c8844436a20-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-01  9:07           ` Knut Omang
2016-09-01 16:42       ` Jason Gunthorpe
     [not found]         ` <20160901164216.GB6479-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-01 17:17           ` Knut Omang
2016-09-01  6:59   ` [PATCH libibverbs 3/3] Provide remote XRC SRQ number in kernel post_send Knut Omang
     [not found]     ` <1472713193-22397-4-git-send-email-knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-01  9:00       ` Yishai Hadas
     [not found]         ` <67f23338-1a5c-5080-d346-8441afb47670-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-05 15:50           ` Knut Omang

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=1473076411.3975.87.camel@oracle.com \
    --to=knut.omang-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mukesh.kacker-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=yishaih-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@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.