From: Jason Gunthorpe <jgg@nvidia.com>
To: Shiraz Saleem <shiraz.saleem@intel.com>
Cc: leon@kernel.org, linux-rdma@vger.kernel.org,
Mustafa Ismail <mustafa.ismail@intel.com>
Subject: Re: [PATCH for-next v1] RDMA/irdma: Implement egress VLAN priority
Date: Fri, 9 Jun 2023 14:44:00 -0300 [thread overview]
Message-ID: <ZINk4KZamJbk+Ovb@nvidia.com> (raw)
In-Reply-To: <20230602230257.1430-1-shiraz.saleem@intel.com>
On Fri, Jun 02, 2023 at 06:02:57PM -0500, Shiraz Saleem wrote:
> From: Mustafa Ismail <mustafa.ismail@intel.com>
>
> When a VLAN interface is in use, get and use the VLAN
> egress mapping.
>
> Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> ---
> v0-->v1:
> Use rcu_dereference on GID attribute __rcu pointer
> vs the function arg in irdma_roce_get_vlan_prio
>
> drivers/infiniband/hw/irdma/cm.c | 50 +++++++++++++++++++++++++++++++++++--
> drivers/infiniband/hw/irdma/verbs.c | 45 ++++++++++++++++++++++++++-------
> 2 files changed, 84 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/infiniband/hw/irdma/cm.c b/drivers/infiniband/hw/irdma/cm.c
> index 70009b9..926823f 100644
> --- a/drivers/infiniband/hw/irdma/cm.c
> +++ b/drivers/infiniband/hw/irdma/cm.c
> @@ -1555,6 +1555,26 @@ static int irdma_del_multiple_qhash(struct irdma_device *iwdev,
> return ret;
> }
>
> +static u8 irdma_iw_get_vlan_prio(u32 *loc_addr, u8 prio, bool ipv4)
> +{
> + struct net_device *ndev;
> +
> + if (ipv4)
> + ndev = ip_dev_find(&init_net, htonl(loc_addr[0]));
> + else
> + ndev = irdma_netdev_vlan_ipv6(loc_addr, NULL, NULL);
> +
> + if (!ndev)
> + return prio;
> + if (is_vlan_dev(ndev))
> + prio = (vlan_dev_get_egress_qos_mask(ndev, prio) & VLAN_PRIO_MASK)
> + >> VLAN_PRIO_SHIFT;
> + if (ipv4)
> + dev_put(ndev);
Huuuuh??
struct net_device *irdma_netdev_vlan_ipv6(u32 *addr, u16 *vlan_id, u8 *mac)
{
struct net_device *ip_dev = NULL;
struct in6_addr laddr6;
if (!IS_ENABLED(CONFIG_IPV6))
return NULL;
irdma_copy_ip_htonl(laddr6.in6_u.u6_addr32, addr);
if (vlan_id)
*vlan_id = 0xFFFF; /* Match rdma_vlan_dev_vlan_id() */
if (mac)
eth_zero_addr(mac);
rcu_read_lock();
for_each_netdev_rcu (&init_net, ip_dev) {
if (ipv6_chk_addr(&init_net, &laddr6, ip_dev, 1)) {
if (vlan_id)
*vlan_id = rdma_vlan_dev_vlan_id(ip_dev);
if (ip_dev->dev_addr && mac)
ether_addr_copy(mac, ip_dev->dev_addr);
break;
}
}
rcu_read_unlock();
return ip_dev;
You can't take ip_dev out of the rcu
Jason
prev parent reply other threads:[~2023-06-09 17:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 23:02 [PATCH for-next v1] RDMA/irdma: Implement egress VLAN priority Shiraz Saleem
2023-06-09 17:44 ` 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=ZINk4KZamJbk+Ovb@nvidia.com \
--to=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mustafa.ismail@intel.com \
--cc=shiraz.saleem@intel.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 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).