aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2010-06-21 18:50:17 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-29 02:04:10 -0400
commitd2ef8590343f1f236f5f7f070fb4cd3f5c3ffb69 (patch)
tree78be29bd5a1d14180c6b6e5fe828e553129cc0fe /drivers/net/mlx4
parent958de1931cbfbcd9c0d425a2291a769a851f15d0 (diff)
mlx4: add dynamic LRO disable support
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks NETIF_F_LRO flag in rx path without rtnl lock. (I don't have mlx4 card, so only did compiling test. Anyone who wants to test this is more than welcome.) This is based on Neil's initial work too, and heavily modified based on Stanislaw's suggestions. Signed-off-by: WANG Cong <amwang@redhat.com> Signed-off-by: Neil Horman <nhorman@redhat.com> Acked-by: Neil Horman <nhorman@redhat.com> Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com> Cc: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r--drivers/net/mlx4/en_ethtool.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c
index d5afd037cd7d..b275238fe70d 100644
--- a/drivers/net/mlx4/en_ethtool.c
+++ b/drivers/net/mlx4/en_ethtool.c
@@ -387,6 +387,42 @@ static void mlx4_en_get_ringparam(struct net_device *dev,
387 param->tx_pending = mdev->profile.prof[priv->port].tx_ring_size; 387 param->tx_pending = mdev->profile.prof[priv->port].tx_ring_size;
388} 388}
389 389
390static int mlx4_ethtool_op_set_flags(struct net_device *dev, u32 data)
391{
392 struct mlx4_en_priv *priv = netdev_priv(dev);
393 struct mlx4_en_dev *mdev = priv->mdev;
394 int rc = 0;
395 int changed = 0;
396
397 if (data & ~ETH_FLAG_LRO)
398 return -EOPNOTSUPP;
399
400 if (data & ETH_FLAG_LRO) {
401 if (mdev->profile.num_lro == 0)
402 return -EOPNOTSUPP;
403 if (!(dev->features & NETIF_F_LRO))
404 changed = 1;
405 } else if (dev->features & NETIF_F_LRO) {
406 changed = 1;
407 }
408
409 if (changed) {
410 if (netif_running(dev)) {
411 mutex_lock(&mdev->state_lock);
412 mlx4_en_stop_port(dev);
413 }
414 dev->features ^= NETIF_F_LRO;
415 if (netif_running(dev)) {
416 rc = mlx4_en_start_port(dev);
417 if (rc)
418 en_err(priv, "Failed to restart port\n");
419 mutex_unlock(&mdev->state_lock);
420 }
421 }
422
423 return rc;
424}
425
390const struct ethtool_ops mlx4_en_ethtool_ops = { 426const struct ethtool_ops mlx4_en_ethtool_ops = {
391 .get_drvinfo = mlx4_en_get_drvinfo, 427 .get_drvinfo = mlx4_en_get_drvinfo,
392 .get_settings = mlx4_en_get_settings, 428 .get_settings = mlx4_en_get_settings,
@@ -415,7 +451,7 @@ const struct ethtool_ops mlx4_en_ethtool_ops = {
415 .get_ringparam = mlx4_en_get_ringparam, 451 .get_ringparam = mlx4_en_get_ringparam,
416 .set_ringparam = mlx4_en_set_ringparam, 452 .set_ringparam = mlx4_en_set_ringparam,
417 .get_flags = ethtool_op_get_flags, 453 .get_flags = ethtool_op_get_flags,
418 .set_flags = ethtool_op_set_flags, 454 .set_flags = mlx4_ethtool_op_set_flags,
419}; 455};
420 456
421 457