Exemplo n.º 1
0
static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
{
	u32 loopback_ok = 0;
	int i;


        priv->loopback_ok = 0;
	priv->validate_loopback = 1;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);

	/* xmit */
	if (mlx4_en_test_loopback_xmit(priv)) {
		en_err(priv, "Transmitting loopback packet failed\n");
		goto mlx4_en_test_loopback_exit;
	}

	/* polling for result */
	for (i = 0; i < MLX4_EN_LOOPBACK_RETRIES; ++i) {
		msleep(MLX4_EN_LOOPBACK_TIMEOUT);
		if (priv->loopback_ok) {
			loopback_ok = 1;
			break;
		}
	}
	if (!loopback_ok)
		en_err(priv, "Loopback packet didn't arrive\n");

mlx4_en_test_loopback_exit:

	priv->validate_loopback = 0;
	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
	return (!loopback_ok);
}
Exemplo n.º 2
0
static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
{
	uint32_t loopback_ok = 0;
	int i;
	bool gro_enabled;

        priv->loopback_ok = 0;
	priv->validate_loopback = 1;
	gro_enabled = priv->dev->feat & NETIF_F_GRO;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->feat);
	priv->dev->feat &= ~NETIF_F_GRO;

	/* xmit */
	if (mlx4_en_test_loopback_xmit(priv)) {
		en_err(priv, "Transmitting loopback packet failed\n");
		goto mlx4_en_test_loopback_exit;
	}

	/* polling for result */
	for (i = 0; i < MLX4_EN_LOOPBACK_RETRIES; ++i) {
		kthread_usleep(1000 * MLX4_EN_LOOPBACK_TIMEOUT);
		if (priv->loopback_ok) {
			loopback_ok = 1;
			break;
		}
	}
	if (!loopback_ok)
		en_err(priv, "Loopback packet didn't arrive\n");

mlx4_en_test_loopback_exit:

	priv->validate_loopback = 0;

	if (gro_enabled)
		priv->dev->feat |= NETIF_F_GRO;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->feat);
	return !loopback_ok;
}