linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Doug Ledford <dledford@redhat.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	Christoph Hellwig <hch@lst.de>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, rds-devel@oss.oracle.com,
	Sagi Grimberg <sagi@grimberg.me>,
	Santosh Shilimkar <santosh.shilimkar@oracle.com>,
	target-devel@vger.kernel.org
Subject: Re: [PATCH rdma-next v2 7/7] RDMA/cma: Provide ECE reject reason
Date: Tue, 26 May 2020 08:49:52 +0300	[thread overview]
Message-ID: <20200526054952.GO10591@unreal> (raw)
In-Reply-To: <20200525183647.GI744@ziepe.ca>

On Mon, May 25, 2020 at 03:36:47PM -0300, Jason Gunthorpe wrote:
> On Mon, May 25, 2020 at 09:22:42PM +0300, Leon Romanovsky wrote:
> > On Mon, May 25, 2020 at 03:14:17PM -0300, Jason Gunthorpe wrote:
> > > On Mon, Apr 13, 2020 at 05:15:38PM +0300, Leon Romanovsky wrote:
> > > > @@ -4223,7 +4223,7 @@ int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event)
> > > >  EXPORT_SYMBOL(rdma_notify);
> > > >
> > > >  int rdma_reject(struct rdma_cm_id *id, const void *private_data,
> > > > -		u8 private_data_len)
> > > > +		u8 private_data_len, enum rdma_ucm_reject_reason reason)
> > > >  {
> > > >  	struct rdma_id_private *id_priv;
> > > >  	int ret;
> > > > @@ -4237,10 +4237,12 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
> > > >  			ret = cma_send_sidr_rep(id_priv, IB_SIDR_REJECT, 0,
> > > >  						private_data, private_data_len);
> > > >  		} else {
> > > > +			enum ib_cm_rej_reason r =
> > > > +				(reason) ?: IB_CM_REJ_CONSUMER_DEFINED;
> > > > +
> > > >  			trace_cm_send_rej(id_priv);
> > > > -			ret = ib_send_cm_rej(id_priv->cm_id.ib,
> > > > -					     IB_CM_REJ_CONSUMER_DEFINED, NULL,
> > > > -					     0, private_data, private_data_len);
> > > > +			ret = ib_send_cm_rej(id_priv->cm_id.ib, r, NULL, 0,
> > > > +					     private_data, private_data_len);
> > > >  		}
> > > >  	} else if (rdma_cap_iw_cm(id->device, id->port_num)) {
> > > >  		ret = iw_cm_reject(id_priv->cm_id.iw,
> > > > diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
> > > > index d41598954cc4..99482dc5934b 100644
> > > > +++ b/drivers/infiniband/core/ucma.c
> > > > @@ -1178,12 +1178,17 @@ static ssize_t ucma_reject(struct ucma_file *file, const char __user *inbuf,
> > > >  	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
> > > >  		return -EFAULT;
> > > >
> > > > +	if (cmd.reason &&
> > > > +	    cmd.reason != RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED)
> > > > +		return -EINVAL;
> > >
> > > It would be clearer to set cmd.reason to IB_CM_REJ_CONSUMER_DEFINED at
> > > this point..
> > >
> > > if (!cmd.reason)
> > >    cmd.reason = IB_CM_REJ_CONSUMER_DEFINED
> > >
> > > if (cmd.reason != IB_CM_REJ_CONSUMER_DEFINED && cmd.reason !=
> > >     RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED)
> > >    return -EINVAL
> > >
> > > Esaier to follow and no reason userspace shouldn't be able to
> > > explicitly specifiy the reason's that it is allowed to use.
> > >
> > >
> > > > index 8d961d8b7cdb..f8781b132f62 100644
> > > > +++ b/include/rdma/rdma_cm.h
> > > > @@ -324,11 +324,12 @@ int __rdma_accept_ece(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
> > > >   */
> > > >  int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event);
> > > >
> > > > +
> > > >  /**
> > >
> > > Extra hunk?
> > >
> > > >   * rdma_reject - Called to reject a connection request or response.
> > > >   */
> > > >  int rdma_reject(struct rdma_cm_id *id, const void *private_data,
> > > > -		u8 private_data_len);
> > > > +		u8 private_data_len, enum rdma_ucm_reject_reason reason);
> > > >
> > > >  /**
> > > >   * rdma_disconnect - This function disconnects the associated QP and
> > > > diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
> > > > index c4ca1412bcf9..e545f2de1e13 100644
> > > > +++ b/include/uapi/rdma/rdma_user_cm.h
> > > > @@ -78,6 +78,10 @@ enum rdma_ucm_port_space {
> > > >  	RDMA_PS_UDP   = 0x0111,
> > > >  };
> > > >
> > > > +enum rdma_ucm_reject_reason {
> > > > +	RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED = 35
> > > > +};
> > >
> > > not sure we need ABI defines for IBTA constants?
> >
> > Do you want to give an option to write any number?
> > Right now, I'm enforcing only allowed by IBTA reason
> > and which is used in user space.
>
> no, just the allowed numbers, just wondering if we need constants for
> fixed IBTA values ..

I will take a look.

Thanks

>
> Jason

  reply	other threads:[~2020-05-26  5:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 14:15 [PATCH rdma-next v2 0/7] Add Enhanced Connection Established (ECE) Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 1/7] RDMA/cm: Add Enhanced Connection Establishment (ECE) bits Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 2/7] RDMA/uapi: Add ECE definitions to UCMA Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 3/7] RDMA/ucma: Extend ucma_connect to receive ECE parameters Leon Romanovsky
2020-05-25 17:41   ` Jason Gunthorpe
2020-05-25 17:47     ` Leon Romanovsky
2020-05-25 18:15       ` Jason Gunthorpe
2020-05-25 18:23         ` Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 4/7] RDMA/ucma: Deliver ECE parameters through UCMA events Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 5/7] RDMA/cm: Send and receive ECE parameter over the wire Leon Romanovsky
2020-05-25 17:58   ` Jason Gunthorpe
2020-05-25 18:02     ` Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 6/7] RDMA/cma: Connect ECE to rdma_accept Leon Romanovsky
2020-04-13 14:15 ` [PATCH rdma-next v2 7/7] RDMA/cma: Provide ECE reject reason Leon Romanovsky
2020-05-25 18:14   ` Jason Gunthorpe
2020-05-25 18:22     ` Leon Romanovsky
2020-05-25 18:36       ` Jason Gunthorpe
2020-05-26  5:49         ` Leon Romanovsky [this message]
2020-04-20 13:36 ` [PATCH rdma-next v2 0/7] Add Enhanced Connection Established (ECE) Leon Romanovsky

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=20200526054952.GO10591@unreal \
    --to=leon@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=hch@lst.de \
    --cc=jgg@ziepe.ca \
    --cc=kuba@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=sagi@grimberg.me \
    --cc=santosh.shilimkar@oracle.com \
    --cc=target-devel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).