diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-09-05 11:43:04 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-17 00:50:36 +0400 |
commit | 9e393b3060ec4ed7e7c7c5de154e08e48c98f623 (patch) | |
tree | 94951da6c8fadeab0265aa825f6b95266a6ded60 /drivers/net/ethernet/sfc/ethtool.c | |
parent | a0c4faf5484b1fe38952d5b975f19e9f4b8f0f2b (diff) | |
download | linux-9e393b3060ec4ed7e7c7c5de154e08e48c98f623.tar.xz |
sfc: Validate IRQ moderation parameters in efx_init_irq_moderation()
Add a range check, and move the check that RX and TX are consistent
from efx_ethtool_set_coalesce().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/ethtool.c')
-rw-r--r-- | drivers/net/ethernet/sfc/ethtool.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c index 1cb6ed0a255c..98b363bb4a75 100644 --- a/drivers/net/ethernet/sfc/ethtool.c +++ b/drivers/net/ethernet/sfc/ethtool.c @@ -623,7 +623,8 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, struct efx_nic *efx = netdev_priv(net_dev); struct efx_channel *channel; unsigned int tx_usecs, rx_usecs; - bool adaptive; + bool adaptive, rx_may_override_tx; + int rc; if (coalesce->use_adaptive_tx_coalesce) return -EINVAL; @@ -642,16 +643,14 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev, /* If channels are shared, TX IRQ moderation can be quietly * overridden unless it is changed from its old value. */ - if (efx->tx_channel_offset == 0 && - coalesce->tx_coalesce_usecs_irq != tx_usecs && - coalesce->tx_coalesce_usecs_irq != rx_usecs) { - netif_err(efx, drv, efx->net_dev, "Channels are shared. " - "RX and TX IRQ moderation must be equal\n"); - return -EINVAL; - } + rx_may_override_tx = coalesce->tx_coalesce_usecs_irq == tx_usecs; tx_usecs = coalesce->tx_coalesce_usecs_irq; - efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive); + rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive, + rx_may_override_tx); + if (rc != 0) + return rc; + efx_for_each_channel(channel, efx) efx->type->push_irq_moderation(channel); |