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

Commit e59cc767 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'mlx4-fixes'



Tariq Toukan says:

====================
mlx4 misc fixes for 4.9

This patchset contains several bug fixes from the team to the
mlx4 Eth and Core drivers.

Series generated against net commit:
ecc515d7 'sctp: fix the panic caused by route update'
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ff57087f eb4b6788
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2469,6 +2469,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
	kfree(priv->mfunc.master.slave_state);
err_comm:
	iounmap(priv->mfunc.comm);
	priv->mfunc.comm = NULL;
err_vhcr:
	dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE,
			  priv->mfunc.vhcr,
@@ -2537,6 +2538,13 @@ void mlx4_report_internal_err_comm_event(struct mlx4_dev *dev)
	int slave;
	u32 slave_read;

	/* If the comm channel has not yet been initialized,
	 * skip reporting the internal error event to all
	 * the communication channels.
	 */
	if (!priv->mfunc.comm)
		return;

	/* Report an internal error event to all
	 * communication channels.
	 */
@@ -2571,6 +2579,7 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev)
	}

	iounmap(priv->mfunc.comm);
	priv->mfunc.comm = NULL;
}

void mlx4_cmd_cleanup(struct mlx4_dev *dev, int cleanup_mask)
+4 −1
Original line number Diff line number Diff line
@@ -245,8 +245,11 @@ static u32 freq_to_shift(u16 freq)
{
	u32 freq_khz = freq * 1000;
	u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC;
	u64 tmp_rounded =
		roundup_pow_of_two(max_val_cycles) > max_val_cycles ?
		roundup_pow_of_two(max_val_cycles) - 1 : UINT_MAX;
	u64 max_val_cycles_rounded = is_power_of_2(max_val_cycles + 1) ?
		max_val_cycles : roundup_pow_of_two(max_val_cycles) - 1;
		max_val_cycles : tmp_rounded;
	/* calculate max possible multiplier in order to fit in 64bit */
	u64 max_mul = div_u64(0xffffffffffffffffULL, max_val_cycles_rounded);

+11 −2
Original line number Diff line number Diff line
@@ -1733,6 +1733,13 @@ int mlx4_en_start_port(struct net_device *dev)
		udp_tunnel_get_rx_info(dev);

	priv->port_up = true;

	/* Process all completions if exist to prevent
	 * the queues freezing if they are full
	 */
	for (i = 0; i < priv->rx_ring_num; i++)
		napi_schedule(&priv->rx_cq[i]->napi);

	netif_tx_start_all_queues(dev);
	netif_device_attach(dev);

@@ -1910,6 +1917,7 @@ static void mlx4_en_clear_stats(struct net_device *dev)
	struct mlx4_en_dev *mdev = priv->mdev;
	int i;

	if (!mlx4_is_slave(mdev->dev))
		if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1))
			en_dbg(HW, priv, "Failed dumping statistics\n");

@@ -2194,6 +2202,7 @@ void mlx4_en_destroy_netdev(struct net_device *dev)

	if (!shutdown)
		free_netdev(dev);
	dev->ethtool_ops = NULL;
}

static int mlx4_en_change_mtu(struct net_device *dev, int new_mtu)
+2 −2
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
		return PTR_ERR(mailbox);
	err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, in_mod, 0,
			   MLX4_CMD_DUMP_ETH_STATS, MLX4_CMD_TIME_CLASS_B,
			   MLX4_CMD_WRAPPED);
			   MLX4_CMD_NATIVE);
	if (err)
		goto out;

@@ -322,7 +322,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
		err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma,
				   in_mod | MLX4_DUMP_ETH_STATS_FLOW_CONTROL,
				   0, MLX4_CMD_DUMP_ETH_STATS,
				   MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED);
				   MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE);
		if (err)
			goto out;
	}
+24 −2
Original line number Diff line number Diff line
@@ -118,6 +118,29 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
	return !loopback_ok;
}

static int mlx4_en_test_interrupts(struct mlx4_en_priv *priv)
{
	struct mlx4_en_dev *mdev = priv->mdev;
	int err = 0;
	int i = 0;

	err = mlx4_test_async(mdev->dev);
	/* When not in MSI_X or slave, test only async */
	if (!(mdev->dev->flags & MLX4_FLAG_MSI_X) || mlx4_is_slave(mdev->dev))
		return err;

	/* A loop over all completion vectors of current port,
	 * for each vector check whether it works by mapping command
	 * completions to that vector and performing a NOP command
	 */
	for (i = 0; i < priv->rx_ring_num; i++) {
		err = mlx4_test_interrupt(mdev->dev, priv->rx_cq[i]->vector);
		if (err)
			break;
	}

	return err;
}

static int mlx4_en_test_link(struct mlx4_en_priv *priv)
{
@@ -151,7 +174,6 @@ static int mlx4_en_test_speed(struct mlx4_en_priv *priv)
void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf)
{
	struct mlx4_en_priv *priv = netdev_priv(dev);
	struct mlx4_en_dev *mdev = priv->mdev;
	int i, carrier_ok;

	memset(buf, 0, sizeof(u64) * MLX4_EN_NUM_SELF_TEST);
@@ -177,7 +199,7 @@ void mlx4_en_ex_selftest(struct net_device *dev, u32 *flags, u64 *buf)
			netif_carrier_on(dev);

	}
	buf[0] = mlx4_test_interrupts(mdev->dev);
	buf[0] = mlx4_en_test_interrupts(priv);
	buf[1] = mlx4_en_test_link(priv);
	buf[2] = mlx4_en_test_speed(priv);

Loading