diff mbox series

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

Message ID 20220224005842.1707-2-shiraz.saleem@intel.com (mailing list archive)
State Superseded
Headers show
Series irdma driver updates | expand

Commit Message

Shiraz Saleem Feb. 24, 2022, 12:58 a.m. UTC
From: Mustafa Ismail <mustafa.ismail@intel.com>

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@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
---
 drivers/infiniband/hw/irdma/utils.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Feb. 24, 2022, 7:29 p.m. UTC | #1
On Wed, Feb 23, 2022 at 06:58:40PM -0600, Shiraz Saleem wrote:
> From: Mustafa Ismail <mustafa.ismail@intel.com>
> 
> 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@intel.com>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> ---
>  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
>
diff mbox series

Patch

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;