Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9737c6ab authored by Or Gerlitz's avatar Or Gerlitz Committed by David S. Miller
Browse files

net/mlx4_en: Add VXLAN ndo calls to the PF net device ops too



This is currently missing, which results in a crash when one attempts
to set VXLAN tunnel over the mlx4_en when acting as PF.

	[ 2408.785472] BUG: unable to handle kernel NULL pointer dereference at (null)
	[...]
	[ 2408.994104] Call Trace:
	[ 2408.996584]  [<ffffffffa021f7f5>] ? vxlan_get_rx_port+0xd6/0x103 [vxlan]
	[ 2409.003316]  [<ffffffffa021f71f>] ? vxlan_lowerdev_event+0xf2/0xf2 [vxlan]
	[ 2409.010225]  [<ffffffffa0630358>] mlx4_en_start_port+0x862/0x96a [mlx4_en]
	[ 2409.017132]  [<ffffffffa063070f>] mlx4_en_open+0x17f/0x1b8 [mlx4_en]

While here, make sure to invoke vxlan_get_rx_port() only when VXLAN
offloads are actually enabled and not when they are only supported.

Reported-by: default avatarIdo Shamay <idos@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8e4500f
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev)
	mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
	mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);


#ifdef CONFIG_MLX4_EN_VXLAN
#ifdef CONFIG_MLX4_EN_VXLAN
	if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS)
	if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)
		vxlan_get_rx_port(dev);
		vxlan_get_rx_port(dev);
#endif
#endif
	priv->port_up = true;
	priv->port_up = true;
@@ -2422,6 +2422,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = {
	.ndo_rx_flow_steer	= mlx4_en_filter_rfs,
	.ndo_rx_flow_steer	= mlx4_en_filter_rfs,
#endif
#endif
	.ndo_get_phys_port_id	= mlx4_en_get_phys_port_id,
	.ndo_get_phys_port_id	= mlx4_en_get_phys_port_id,
#ifdef CONFIG_MLX4_EN_VXLAN
	.ndo_add_vxlan_port	= mlx4_en_add_vxlan_port,
	.ndo_del_vxlan_port	= mlx4_en_del_vxlan_port,
	.ndo_gso_check		= mlx4_en_gso_check,
#endif
};
};


int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,