On Fri, Jun 02, 2023 at 06:02:57PM -0500, Shiraz Saleem wrote: > From: Mustafa Ismail <mustafa.ismail@xxxxxxxxx> > > When a VLAN interface is in use, get and use the VLAN > egress mapping. > > Signed-off-by: Mustafa Ismail <mustafa.ismail@xxxxxxxxx> > Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> > --- > 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