Merge branch 'mlx4-fixes'

Tariq Toukan says:

====================
mlx4 bug fixes for 4.9

This patchset includes 2 bug fixes:
* In patch 1 we revert the commit that avoids invoking unregister_netdev
in shutdown flow, as it introduces netdev presence issues where
it can be accessed unsafely by ndo operations during the flow.
* Patch 2 is a simple fix for a variable uninitialization issue.

Series generated against net commit:
6998cc6ec2 tipc: resolve connection flow control compatibility problem
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2016-11-28 15:33:47 -05:00
commit 2fc8d112d7
4 changed files with 9 additions and 21 deletions

View File

@ -2079,13 +2079,6 @@ err:
return -ENOMEM; return -ENOMEM;
} }
static void mlx4_en_shutdown(struct net_device *dev)
{
rtnl_lock();
netif_device_detach(dev);
mlx4_en_close(dev);
rtnl_unlock();
}
static int mlx4_en_copy_priv(struct mlx4_en_priv *dst, static int mlx4_en_copy_priv(struct mlx4_en_priv *dst,
struct mlx4_en_priv *src, struct mlx4_en_priv *src,
@ -2162,8 +2155,6 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
{ {
struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_en_priv *priv = netdev_priv(dev);
struct mlx4_en_dev *mdev = priv->mdev; struct mlx4_en_dev *mdev = priv->mdev;
bool shutdown = mdev->dev->persist->interface_state &
MLX4_INTERFACE_STATE_SHUTDOWN;
en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port); en_dbg(DRV, priv, "Destroying netdev on port:%d\n", priv->port);
@ -2171,10 +2162,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
if (priv->registered) { if (priv->registered) {
devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev, devlink_port_type_clear(mlx4_get_devlink_port(mdev->dev,
priv->port)); priv->port));
if (shutdown) unregister_netdev(dev);
mlx4_en_shutdown(dev);
else
unregister_netdev(dev);
} }
if (priv->allocated) if (priv->allocated)
@ -2203,8 +2191,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
kfree(priv->tx_ring); kfree(priv->tx_ring);
kfree(priv->tx_cq); kfree(priv->tx_cq);
if (!shutdown) free_netdev(dev);
free_netdev(dev);
} }
static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu) static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)

View File

@ -4147,11 +4147,8 @@ static void mlx4_shutdown(struct pci_dev *pdev)
mlx4_info(persist->dev, "mlx4_shutdown was called\n"); mlx4_info(persist->dev, "mlx4_shutdown was called\n");
mutex_lock(&persist->interface_state_mutex); mutex_lock(&persist->interface_state_mutex);
if (persist->interface_state & MLX4_INTERFACE_STATE_UP) { if (persist->interface_state & MLX4_INTERFACE_STATE_UP)
/* Notify mlx4 clients that the kernel is being shut down */
persist->interface_state |= MLX4_INTERFACE_STATE_SHUTDOWN;
mlx4_unload_one(pdev); mlx4_unload_one(pdev);
}
mutex_unlock(&persist->interface_state_mutex); mutex_unlock(&persist->interface_state_mutex);
} }

View File

@ -1457,7 +1457,12 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_detach);
int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port, int mlx4_flow_steer_promisc_add(struct mlx4_dev *dev, u8 port,
u32 qpn, enum mlx4_net_trans_promisc_mode mode) u32 qpn, enum mlx4_net_trans_promisc_mode mode)
{ {
struct mlx4_net_trans_rule rule; struct mlx4_net_trans_rule rule = {
.queue_mode = MLX4_NET_TRANS_Q_FIFO,
.exclusive = 0,
.allow_loopback = 1,
};
u64 *regid_p; u64 *regid_p;
switch (mode) { switch (mode) {

View File

@ -476,7 +476,6 @@ enum {
enum { enum {
MLX4_INTERFACE_STATE_UP = 1 << 0, MLX4_INTERFACE_STATE_UP = 1 << 0,
MLX4_INTERFACE_STATE_DELETION = 1 << 1, MLX4_INTERFACE_STATE_DELETION = 1 << 1,
MLX4_INTERFACE_STATE_SHUTDOWN = 1 << 2,
}; };
#define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \