From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Mark Zhang <markzhang@nvidia.com>,
linux-rdma@vger.kernel.org,
syzbot+8fcbb77276d43cc8b693@syzkaller.appspotmail.com
Subject: Re: [PATCH rdma-rc v1] RDMA/cma: Limit join multicast to UD QP type only
Date: Wed, 20 Apr 2022 15:26:33 -0300 [thread overview]
Message-ID: <20220420182633.GA1478070@nvidia.com> (raw)
In-Reply-To: <98466723510491a832171031f591c77e5691979a.1650362467.git.leonro@nvidia.com>
On Tue, Apr 19, 2022 at 01:03:21PM +0300, Leon Romanovsky wrote:
> @@ -528,9 +517,22 @@ static int cma_set_qkey(struct rdma_id_private *id_priv, u32 qkey)
> default:
> break;
> }
> +
> return ret;
> }
>
> +static int cma_set_qkey(struct rdma_id_private *id_priv, u32 qkey)
> +{
> + if (!qkey)
> + return cma_set_default_qkey(id_priv);
The point was to get rid of this if since we don't need it once all
the 0 qkey means default cases were split out.
The remaining call sites:
static int cma_sidr_rep_handler(struct ib_cm_id *cm_id,
const struct ib_cm_event *ib_event)
{
ret = cma_set_qkey(id_priv, rep->qkey);
'rep' is CM_SIDR_REP_Q_KEY and 0 does not mean default in a MAD (0 is
an error)
static void cma_make_mc_event(int status, struct rdma_id_private *id_priv,
struct ib_sa_multicast *multicast,
struct rdma_cm_event *event,
struct cma_multicast *mc)
{
status = cma_set_qkey(id_priv, be32_to_cpu(multicast->rec.qkey));
Comes from the SA in the IB case (zero is error)
Is wired to ib.rec.qkey = cpu_to_be32(RDMA_UDP_QKEY); for roce case
static int cma_send_sidr_rep(struct rdma_id_private *id_priv,
enum ib_cm_sidr_status status, u32 qkey,
const void *private_data, int private_data_len)
{
ret = cma_set_qkey(id_priv, qkey);
Is rdma_conn_param::qkey, which is only ever set here:
dst->qkey = (id->route.addr.src_addr.ss_family == AF_IB) ? src->qkey : 0;
Which is the only other place that wants a default set, so I'd prefer
to see the default set open coded here and the normal cma_set_qkey()
return error for 0 qkey.
> @@ -4683,7 +4681,7 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv,
> if (ret)
> return ret;
>
> - ret = cma_set_qkey(id_priv, 0);
> + ret = cma_set_default_qkey(id_priv);
> if (ret)
> return ret;
I'm still not convinced this is right.
I think the flow has the caller do a cma_send_sidr_rep() which will
set a non-default qkey as above, and then do cma_join_ib_multicast
which is supposed to follow the non-default qkey. So this should be
conditional on not already having a set qkey.
> @@ -4762,8 +4760,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
> cma_iboe_set_mgid(addr, &ib.rec.mgid, gid_type);
>
> ib.rec.pkey = cpu_to_be16(0xffff);
> - if (id_priv->id.ps == RDMA_PS_UDP)
> - ib.rec.qkey = cpu_to_be32(RDMA_UDP_QKEY);
> + ib.rec.qkey = cpu_to_be32(RDMA_UDP_QKEY);
And the same logic should apply here, we can't just ignore the qkey
that was set by cma_send_sidr_rep() and program in the UDP_QKEY to the
QP, that would break it. (though that seems like another commit)
Jason
prev parent reply other threads:[~2022-04-20 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 10:03 [PATCH rdma-rc v1] RDMA/cma: Limit join multicast to UD QP type only Leon Romanovsky
2022-04-20 18:26 ` Jason Gunthorpe [this message]
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=20220420182633.GA1478070@nvidia.com \
--to=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=markzhang@nvidia.com \
--cc=syzbot+8fcbb77276d43cc8b693@syzkaller.appspotmail.com \
/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.