[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200525183647.GI744@ziepe.ca>
Date: Mon, 25 May 2020 15:36:47 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Leon Romanovsky <leon@...nel.org>
Cc: Doug Ledford <dledford@...hat.com>,
Bart Van Assche <bvanassche@....org>,
Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
Christoph Hellwig <hch@....de>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
linux-nvme@...ts.infradead.org, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org, rds-devel@....oracle.com,
Sagi Grimberg <sagi@...mberg.me>,
Santosh Shilimkar <santosh.shilimkar@...cle.com>,
target-devel@...r.kernel.org
Subject: Re: [PATCH rdma-next v2 7/7] RDMA/cma: Provide ECE reject reason
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 ..
Jason
Powered by blists - more mailing lists