aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-09-05 03:43:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-09-16 16:50:36 -0400
commit13225977f5429fc5a8c0c1933e3283ab4c7042d8 (patch)
tree2cb39a7e536a2bd88bd93da070b8a8ecf2fb97da /drivers/net/ethernet/sfc
parent9e393b3060ec4ed7e7c7c5de154e08e48c98f623 (diff)
sfc: Use correct fields of struct ethtool_coalesce
An earlier developer misunderstood the meaning of the 'irq' fields and the driver did not support the standard fields. To avoid invalidating existing user documentation, we report and accept changes through either the standard or 'irq' fields. If both are changed at the same time, we prefer the standard field. Also explain why we don't currently use the 'max_frames' fields. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 98b363bb4a75..93f1fb99432d 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -595,6 +595,20 @@ static int efx_ethtool_nway_reset(struct net_device *net_dev)
595 * automatically changed too, but otherwise we fail if the two values 595 * automatically changed too, but otherwise we fail if the two values
596 * are requested to be different. 596 * are requested to be different.
597 * 597 *
598 * The hardware does not support a limit on the number of completions
599 * before an IRQ, so we do not use the max_frames fields. We should
600 * report and require that max_frames == (usecs != 0), but this would
601 * invalidate existing user documentation.
602 *
603 * The hardware does not have distinct settings for interrupt
604 * moderation while the previous IRQ is being handled, so we should
605 * not use the 'irq' fields. However, an earlier developer
606 * misunderstood the meaning of the 'irq' fields and the driver did
607 * not support the standard fields. To avoid invalidating existing
608 * user documentation, we report and accept changes through either the
609 * standard or 'irq' fields. If both are changed at the same time, we
610 * prefer the standard field.
611 *
598 * We implement adaptive IRQ moderation, but use a different algorithm 612 * We implement adaptive IRQ moderation, but use a different algorithm
599 * from that assumed in the definition of struct ethtool_coalesce. 613 * from that assumed in the definition of struct ethtool_coalesce.
600 * Therefore we do not use any of the adaptive moderation parameters 614 * Therefore we do not use any of the adaptive moderation parameters
@@ -610,7 +624,9 @@ static int efx_ethtool_get_coalesce(struct net_device *net_dev,
610 624
611 efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive); 625 efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &rx_adaptive);
612 626
627 coalesce->tx_coalesce_usecs = tx_usecs;
613 coalesce->tx_coalesce_usecs_irq = tx_usecs; 628 coalesce->tx_coalesce_usecs_irq = tx_usecs;
629 coalesce->rx_coalesce_usecs = rx_usecs;
614 coalesce->rx_coalesce_usecs_irq = rx_usecs; 630 coalesce->rx_coalesce_usecs_irq = rx_usecs;
615 coalesce->use_adaptive_rx_coalesce = rx_adaptive; 631 coalesce->use_adaptive_rx_coalesce = rx_adaptive;
616 632
@@ -629,22 +645,24 @@ static int efx_ethtool_set_coalesce(struct net_device *net_dev,
629 if (coalesce->use_adaptive_tx_coalesce) 645 if (coalesce->use_adaptive_tx_coalesce)
630 return -EINVAL; 646 return -EINVAL;
631 647
632 if (coalesce->rx_coalesce_usecs || coalesce->tx_coalesce_usecs) {
633 netif_err(efx, drv, efx->net_dev, "invalid coalescing setting. "
634 "Only rx/tx_coalesce_usecs_irq are supported\n");
635 return -EINVAL;
636 }
637
638 efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive); 648 efx_get_irq_moderation(efx, &tx_usecs, &rx_usecs, &adaptive);
639 649
640 rx_usecs = coalesce->rx_coalesce_usecs_irq; 650 if (coalesce->rx_coalesce_usecs != rx_usecs)
651 rx_usecs = coalesce->rx_coalesce_usecs;
652 else
653 rx_usecs = coalesce->rx_coalesce_usecs_irq;
654
641 adaptive = coalesce->use_adaptive_rx_coalesce; 655 adaptive = coalesce->use_adaptive_rx_coalesce;
642 656
643 /* If channels are shared, TX IRQ moderation can be quietly 657 /* If channels are shared, TX IRQ moderation can be quietly
644 * overridden unless it is changed from its old value. 658 * overridden unless it is changed from its old value.
645 */ 659 */
646 rx_may_override_tx = coalesce->tx_coalesce_usecs_irq == tx_usecs; 660 rx_may_override_tx = (coalesce->tx_coalesce_usecs == tx_usecs &&
647 tx_usecs = coalesce->tx_coalesce_usecs_irq; 661 coalesce->tx_coalesce_usecs_irq == tx_usecs);
662 if (coalesce->tx_coalesce_usecs != tx_usecs)
663 tx_usecs = coalesce->tx_coalesce_usecs;
664 else
665 tx_usecs = coalesce->tx_coalesce_usecs_irq;
648 666
649 rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive, 667 rc = efx_init_irq_moderation(efx, tx_usecs, rx_usecs, adaptive,
650 rx_may_override_tx); 668 rx_may_override_tx);