diff mbox series

[net] ixgbevf: Use cached link state instead of re-reading the value for ethtool

Message ID 20190619165853.28234-1-jeffrey.t.kirsher@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show
Series [net] ixgbevf: Use cached link state instead of re-reading the value for ethtool | expand

Commit Message

Kirsher, Jeffrey T June 19, 2019, 4:58 p.m. UTC
From: Alexander Duyck <alexander.h.duyck@linux.intel.com>

Change the ethtool link settings call to just read the cached state out of
the adapter structure instead of trying to recheck the value from the PF.
Doing this should prevent excessive reading of the mailbox.

Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Reviewed-by: Guilherme Piccoli <gpiccoli@canonical.com>
---
 drivers/net/ethernet/intel/ixgbevf/ethtool.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Guilherme G. Piccoli June 19, 2019, 5:41 p.m. UTC | #1
On Wed, Jun 19, 2019 at 1:58 PM Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
>
> From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
>
> Change the ethtool link settings call to just read the cached state out of
> the adapter structure instead of trying to recheck the value from the PF.
> Doing this should prevent excessive reading of the mailbox.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> Reviewed-by: Guilherme Piccoli <gpiccoli@canonical.com>

[+ Jay Vosburgh]

Thanks Jeff! A minor nit: if possible can you change my name <for consistency>
before merging?
s/Guilherme Piccoli/Guilherme G. Piccoli

Otherwise looks fine to me!
Cheers,


Guilherme
Bowers, AndrewX June 19, 2019, 11:21 p.m. UTC | #2
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On
> Behalf Of Jeff Kirsher
> Sent: Wednesday, June 19, 2019 9:59 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>; Guilherme
> Piccoli <gpiccoli@canonical.com>
> Subject: [Intel-wired-lan] [net] ixgbevf: Use cached link state instead of re-
> reading the value for ethtool
> 
> From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> 
> Change the ethtool link settings call to just read the cached state out of the
> adapter structure instead of trying to recheck the value from the PF.
> Doing this should prevent excessive reading of the mailbox.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> Reviewed-by: Guilherme Piccoli <gpiccoli@canonical.com>
> ---
>  drivers/net/ethernet/intel/ixgbevf/ethtool.c |   10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index 5399787e07af..54459b69c948 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -85,22 +85,16 @@  static int ixgbevf_get_link_ksettings(struct net_device *netdev,
 				      struct ethtool_link_ksettings *cmd)
 {
 	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
-	struct ixgbe_hw *hw = &adapter->hw;
-	u32 link_speed = 0;
-	bool link_up;
 
 	ethtool_link_ksettings_zero_link_mode(cmd, supported);
 	ethtool_link_ksettings_add_link_mode(cmd, supported, 10000baseT_Full);
 	cmd->base.autoneg = AUTONEG_DISABLE;
 	cmd->base.port = -1;
 
-	hw->mac.get_link_status = 1;
-	hw->mac.ops.check_link(hw, &link_speed, &link_up, false);
-
-	if (link_up) {
+	if (adapter->link_up) {
 		__u32 speed = SPEED_10000;
 
-		switch (link_speed) {
+		switch (adapter->link_speed) {
 		case IXGBE_LINK_SPEED_10GB_FULL:
 			speed = SPEED_10000;
 			break;