From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Achiad Shochat <achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path
Date: Thu, 19 Jan 2017 09:54:54 +0200 [thread overview]
Message-ID: <20170119075454.GL32481@mtr-leonro.local> (raw)
In-Reply-To: <20170118202343.GC17688@yuval-lap>
[-- Attachment #1: Type: text/plain, Size: 3059 bytes --]
On Wed, Jan 18, 2017 at 10:23:44PM +0200, Yuval Shaia wrote:
> On Wed, Jan 18, 2017 at 02:10:35PM +0200, Leon Romanovsky wrote:
> > From: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > For Routable RoCE QPs, the DSCP should be set in the QP's
> > address path.
> >
> > The DSCP's value is derived from the traffic class.
> >
> > Fixes: 2811ba51b049 ("IB/mlx5: Add RoCE fields to Address Vector")
> > Cc: Achiad Shochat <achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Signed-off-by: Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Reviewed-by: Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > ---
> > drivers/infiniband/hw/mlx5/main.c | 21 +++++++++++++++++++++
> > drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++
> > drivers/infiniband/hw/mlx5/qp.c | 7 +++++++
> > 3 files changed, 30 insertions(+)
> >
> > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> > index 1dea407..6a81f027 100644
> > --- a/drivers/infiniband/hw/mlx5/main.c
> > +++ b/drivers/infiniband/hw/mlx5/main.c
> > @@ -325,6 +325,27 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
> > return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port));
> > }
> >
> > +int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
> > + int index, enum ib_gid_type *gid_type)
> > +{
> > + struct ib_gid_attr attr;
> > + union ib_gid gid;
> > + int ret;
> > +
> > + ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr);
> > + if (ret)
> > + return ret;
> > +
> > + if (!attr.ndev)
> > + return -ENODEV;
>
> Two questions:
> First for my understanding :) I see that this check is already done in
> __ib_cache_gid_get so why it is not enough?
> Second: Since this is light test, can we have it before the call to
> ib_get_cached_gid?
I don't see such check there, can you point me?
428 static int __ib_cache_gid_get(struct ib_device *ib_dev, u8 port, int index,
429 union ib_gid *gid, struct ib_gid_attr *attr)
430 {
431 struct ib_gid_table **ports_table = ib_dev->cache.gid_cache;
432 struct ib_gid_table *table;
433
434 table = ports_table[port - rdma_start_port(ib_dev)];
435
436 if (index < 0 || index >= table->sz)
437 return -EINVAL;
438
439 if (table->data_vec[index].props &GID_TABLE_ENTRY_INVALID)
440 return -EAGAIN;
441
442 memcpy(gid, &table->data_vec[index].gid, sizeof(*gid));
443 if (attr) {
444 memcpy(attr, &table->data_vec[index].attr, sizeof(*attr));
445 if (attr->ndev)
446 dev_hold(attr->ndev);
447 }
448
449 return 0;
And regarding your second question, as you can see above in line 444, we
are overwriting attr->ndev, so it can be zero. It requires us to check
attr->ndev after calling to ib_get_cached_gid too.
Thanks
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-01-19 7:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 12:10 [PATCH rdma-next 0/7] mlx5 fixes for 4.11 Leon Romanovsky
[not found] ` <20170118121036.32642-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:10 ` [PATCH rdma-next 1/7] IB/mlx5: Fix out-of-bound access Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 2/7] IB/mlx5: Return error for unsupported signature type Leon Romanovsky
[not found] ` <20170118121036.32642-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 20:37 ` Yuval Shaia
2017-01-19 6:41 ` Leon Romanovsky
[not found] ` <20170119064107.GK32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-19 7:58 ` Sagi Grimberg
2017-01-18 12:10 ` [PATCH rdma-next 3/7] IB/mlx5: Verify that Q counters are supported Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 4/7] IB/mlx5: Add additional checks before processing MADs Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 5/7] IB/mlx5: Avoid SMP MADs from VFs Leon Romanovsky
2017-01-18 12:10 ` [PATCH rdma-next 6/7] IB/mlx5: Assign DSCP for R-RoCE QPs Address Path Leon Romanovsky
[not found] ` <20170118121036.32642-7-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 20:23 ` Yuval Shaia
2017-01-19 7:54 ` Leon Romanovsky [this message]
[not found] ` <20170119075454.GL32481-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-01-19 10:45 ` Yuval Shaia
2017-01-18 12:10 ` [PATCH rdma-next 7/7] IB/mlx5: Remove deprecated module parameter Leon Romanovsky
[not found] ` <20170118121036.32642-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 20:26 ` Yuval Shaia
2017-02-14 15:15 ` [PATCH rdma-next 0/7] mlx5 fixes for 4.11 Doug Ledford
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=20170119075454.GL32481@mtr-leonro.local \
--to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=achiad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@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;
as well as URLs for NNTP newsgroup(s).