From: Parav Pandit <parav@mellanox.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Leon Romanovsky <leonro@mellanox.com>
Subject: RE: [PATCH rdma-next] IB/cma: Honor traffic class from lower netdevice for RoCE
Date: Tue, 8 Oct 2019 19:44:48 +0000 [thread overview]
Message-ID: <AM0PR05MB48668C582A96F040B4F4C7D4D19A0@AM0PR05MB4866.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20191008191005.GA13576@ziepe.ca>
> -----Original Message-----
> From: Jason Gunthorpe <jgg@ziepe.ca>
> Sent: Tuesday, October 8, 2019 2:10 PM
> To: Leon Romanovsky <leon@kernel.org>
> Cc: Doug Ledford <dledford@redhat.com>; Parav Pandit
> <parav@mellanox.com>; RDMA mailing list <linux-rdma@vger.kernel.org>;
> Leon Romanovsky <leonro@mellanox.com>
> Subject: Re: [PATCH rdma-next] IB/cma: Honor traffic class from lower
> netdevice for RoCE
>
>
> On Wed, Oct 02, 2019 at 03:19:59PM +0300, Leon Romanovsky wrote:
> > From: Parav Pandit <parav@mellanox.com>
> >
> > When macvlan netdevice is used for RoCE, consider the tos->prio->tc
> > mapping as SL using its lower netdevice.
> > 1. If lower netdevice is VLAN netdevice, consider such VLAN netdevice
> > and it's parent netdevice for mapping 2. If lower netdevice is not a
> > VLAN netdevice, consider tc mapping directly from such lower netdevice
> >
> > Signed-off-by: Parav Pandit <parav@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > drivers/infiniband/core/cma.c | 59 +++++++++++++++++++++++++++++------
> > 1 file changed, 50 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/infiniband/core/cma.c
> > b/drivers/infiniband/core/cma.c index 0e3cf3461999..18b5ad8c7d5f
> > 100644
> > +++ b/drivers/infiniband/core/cma.c
> > @@ -2827,22 +2827,63 @@ static int cma_resolve_iw_route(struct
> rdma_id_private *id_priv)
> > return 0;
> > }
> >
> > -static int iboe_tos_to_sl(struct net_device *ndev, int tos)
> > +static int get_vlan_ndev_tc(struct net_device *vlan_ndev, int prio)
> > {
> > - int prio;
> > struct net_device *dev;
> >
> > - prio = rt_tos2priority(tos);
> > - dev = is_vlan_dev(ndev) ? vlan_dev_real_dev(ndev) : ndev;
> > + dev = vlan_dev_real_dev(vlan_ndev);
> > if (dev->num_tc)
> > return netdev_get_prio_tc_map(dev, prio);
> >
> > -#if IS_ENABLED(CONFIG_VLAN_8021Q)
> > + return (vlan_dev_get_egress_qos_mask(vlan_ndev, prio) &
> > + VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; }
> > +
> > +struct iboe_prio_tc_map {
> > + int input_prio;
> > + int output_tc;
> > + bool found;
> > +};
> > +
> > +static int get_lower_vlan_dev_tc(struct net_device *dev, void *data)
> > +{
> > + struct iboe_prio_tc_map *map = data;
> > +
> > + if (is_vlan_dev(dev))
> > + map->output_tc = get_vlan_ndev_tc(dev, map->input_prio);
> > + else if (dev->num_tc)
> > + map->output_tc = netdev_get_prio_tc_map(dev, map-
> >input_prio);
> > + else
> > + map->output_tc = 0;
> > + /* We are interested only in first level VLAN device, so always
> > + * return 1 to stop iterating over next level devices.
> > + */
> > + map->found = true;
> > + return 1;
> > +}
> > +
> > +static int iboe_tos_to_sl(struct net_device *ndev, int tos) {
> > + struct iboe_prio_tc_map prio_tc_map = {};
> > + int prio = rt_tos2priority(tos);
> > +
> > + /* If VLAN device, get it directly from the VLAN netdev */
> > if (is_vlan_dev(ndev))
> > - return (vlan_dev_get_egress_qos_mask(ndev, prio) &
> > - VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
> > -#endif
> > - return 0;
> > + return get_vlan_ndev_tc(ndev, prio);
> > +
> > + prio_tc_map.input_prio = prio;
> > + netdev_walk_all_lower_dev_rcu(ndev,
> > + get_lower_vlan_dev_tc,
> > + &prio_tc_map);
>
> Kinda looks like you have to hold rcu before calling this?
>
Oh yes, my bad.
rcu lock unlock calls are missing around netdev_walk_all_lower_dev_rcu().
Will respin through Leon's tree.
> Jason
prev parent reply other threads:[~2019-10-08 19:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 12:19 [PATCH rdma-next] IB/cma: Honor traffic class from lower netdevice for RoCE Leon Romanovsky
2019-10-08 19:10 ` Jason Gunthorpe
2019-10-08 19:44 ` Parav Pandit [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=AM0PR05MB48668C582A96F040B4F4C7D4D19A0@AM0PR05MB4866.eurprd05.prod.outlook.com \
--to=parav@mellanox.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-rdma@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).