diff options
author | Bert Kenward <bkenward@solarflare.com> | 2016-08-11 15:02:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-13 06:42:20 +0300 |
commit | d95e329a55baaea8c00d1b3e0ce22c974d447524 (patch) | |
tree | f95631818601476a296eeee1fb6c0bf81e70505f /drivers/net/ethernet/sfc/efx.c | |
parent | 539de7c5240a257c9028b3063873170a6867b159 (diff) | |
download | linux-d95e329a55baaea8c00d1b3e0ce22c974d447524.tar.xz |
sfc: get timer configuration from adapter
On SFN8000 series adapters the MC provides a method to get the timer
quantum and the maximum timer setting. We revert to the old values if the
new call is unavailable.
Signed-off-by: Bert Kenward <bkenward@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/efx.c')
-rw-r--r-- | drivers/net/ethernet/sfc/efx.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index b26e1f929dc4..f3826ae28bac 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c @@ -1979,12 +1979,13 @@ int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, bool rx_may_override_tx) { struct efx_channel *channel; - unsigned int irq_mod_max = DIV_ROUND_UP(efx->type->timer_period_max * - efx->timer_quantum_ns, - 1000); + unsigned int timer_max_us; + EFX_ASSERT_RESET_SERIALISED(efx); - if (tx_usecs > irq_mod_max || rx_usecs > irq_mod_max) + timer_max_us = efx->timer_max_ns / 1000; + + if (tx_usecs > timer_max_us || rx_usecs > timer_max_us) return -EINVAL; if (tx_usecs != rx_usecs && efx->tx_channel_offset == 0 && |