Re: [PATCH rdma-rc 1/3] RDMA/irdma: Fix netdev notifications for vlan's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 23, 2022 at 06:58:40PM -0600, Shiraz Saleem wrote:
> From: Mustafa Ismail <mustafa.ismail@xxxxxxxxx>
> 
> Currently, events on vlan netdevs are being ignored. Fix
> this by finding the real netdev and processing the
> notifications for vlan netdevs.
> 
> Fixes: 915cc7ac0f8e ("RDMA/irdma: Add miscellaneous utility definitions")
> Signed-off-by: Mustafa Ismail <mustafa.ismail@xxxxxxxxx>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/irdma/utils.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

It is better to use the existing coding pattern.

real_dev = rdma_vlan_dev_real_dev(netdev);
if (!real_dev)
   real_dev = netdev;

> 
> diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
> index 398736d..26407d8 100644
> --- a/drivers/infiniband/hw/irdma/utils.c
> +++ b/drivers/infiniband/hw/irdma/utils.c
> @@ -155,6 +155,8 @@ int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event,
>  	struct ib_device *ibdev;
>  	u32 local_ipaddr;
>  
> +	if (is_vlan_dev(netdev))
> +		netdev = vlan_dev_real_dev(netdev);
>  	ibdev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_IRDMA);
>  	if (!ibdev)
>  		return NOTIFY_DONE;
> @@ -201,6 +203,8 @@ int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event,
>  	struct ib_device *ibdev;
>  	u32 local_ipaddr6[4];
>  
> +	if (is_vlan_dev(netdev))
> +		netdev = vlan_dev_real_dev(netdev);
>  	ibdev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_IRDMA);
>  	if (!ibdev)
>  		return NOTIFY_DONE;
> @@ -243,14 +247,16 @@ int irdma_net_event(struct notifier_block *notifier, unsigned long event,
>  		    void *ptr)
>  {
>  	struct neighbour *neigh = ptr;
> +	struct net_device *netdev = (struct net_device *)neigh->dev;
>  	struct irdma_device *iwdev;
>  	struct ib_device *ibdev;
>  	__be32 *p;
>  	u32 local_ipaddr[4] = {};
>  	bool ipv4 = true;
>  
> -	ibdev = ib_device_get_by_netdev((struct net_device *)neigh->dev,
> -					RDMA_DRIVER_IRDMA);
> +	if (is_vlan_dev(netdev))
> +		netdev = vlan_dev_real_dev(netdev);
> +	ibdev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_IRDMA);
>  	if (!ibdev)
>  		return NOTIFY_DONE;
>  
> -- 
> 1.8.3.1
> 



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux