]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
i40e: add interrupt rate limit verbosity
authorAlan Brady <alan.brady@intel.com>
Tue, 29 Nov 2016 00:06:03 +0000 (16:06 -0800)
committerJack Vogel <jack.vogel@oracle.com>
Sat, 10 Jun 2017 01:57:01 +0000 (18:57 -0700)
Due to the resolution of the register controlling interrupt rate
limiting, setting certain values for the interrupt rate limit make it
appear as though the limiting is not completely accurate.  The problem
is that the interrupt rate limit is getting rounded down to the nearest
multiple of 4.  This patch fixes the problem by adding some feedback to
the user as to the actual interrupt rate limit being used when it
differs from the requested limit.  Without this patch setting interrupt
rate limits may appear to behave inaccurately.

Change-ID: I3093cf3f2d437d35a4c4f4bb5af5ce1b85ab21b7
Signed-off-by: Alan Brady <alan.brady@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 26132523
(cherry picked from commit 33084060fb6d51ff566439a387f69ed90301280c)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_ethtool.c

index b90eec88b8d3095c66e5fa85eefc47d4c51ce5b5..ab5dab20e44a1bf0aa68f5ae54c436455e99f991 100644 (file)
@@ -2110,6 +2110,7 @@ static int __i40e_set_coalesce(struct net_device *netdev,
        struct i40e_netdev_priv *np = netdev_priv(netdev);
        struct i40e_vsi *vsi = np->vsi;
        struct i40e_pf *pf = vsi->back;
+       u16 intrl_reg;
        int i;
 
        if (ec->tx_max_coalesced_frames_irq || ec->rx_max_coalesced_frames_irq)
@@ -2121,8 +2122,9 @@ static int __i40e_set_coalesce(struct net_device *netdev,
                return -EINVAL;
        }
 
-       if (ec->rx_coalesce_usecs_high >= INTRL_REG_TO_USEC(I40E_MAX_INTRL)) {
-               netif_info(pf, drv, netdev, "Invalid value, rx-usecs-high range is 0-235\n");
+       if (ec->rx_coalesce_usecs_high > INTRL_REG_TO_USEC(I40E_MAX_INTRL)) {
+               netif_info(pf, drv, netdev, "Invalid value, rx-usecs-high range is 0-%lu\n",
+                          INTRL_REG_TO_USEC(I40E_MAX_INTRL));
                return -EINVAL;
        }
 
@@ -2135,7 +2137,12 @@ static int __i40e_set_coalesce(struct net_device *netdev,
                        return -EINVAL;
        }
 
-       vsi->int_rate_limit = ec->rx_coalesce_usecs_high;
+       intrl_reg = i40e_intrl_usec_to_reg(ec->rx_coalesce_usecs_high);
+       vsi->int_rate_limit = INTRL_REG_TO_USEC(intrl_reg);
+       if (vsi->int_rate_limit != ec->rx_coalesce_usecs_high) {
+               netif_info(pf, drv, netdev, "Interrupt rate limit rounded down to %d\n",
+                          vsi->int_rate_limit);
+       }
 
        if (ec->tx_coalesce_usecs == 0) {
                if (ec->use_adaptive_tx_coalesce)