[SRU,X,1/1] ixgbevf: Use cached link state instead of re-reading the value for ethtool
diff mbox series

Message ID 20190716201343.29258-3-gpiccoli@canonical.com
State New
Headers show
Series
  • [SRU,X,1/1] ixgbevf: Use cached link state instead of re-reading the value for ethtool
Related show

Commit Message

Guilherme G. Piccoli July 16, 2019, 8:13 p.m. UTC
From: Alexander Duyck <alexander.h.duyck@linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1836760

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 G. Piccoli" <gpiccoli@canonical.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(backported from commit 1e1b0c658d9bb364b4a2a4b08a760d3e4c239bdc)
[gpiccoli:
* Context adjustment for v4.4.
* Changed the patch to use the old ethtool API for get link settings
(get_link_ksettings -> get_settings); the new API was introduced in
v4.6 by commit 3f1ac7a700d039.]
Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
---
 drivers/net/ethernet/intel/ixgbevf/ethtool.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Khalid Elmously July 23, 2019, 5:33 a.m. UTC | #1
On 2019-07-16 17:13:43 , Guilherme G. Piccoli wrote:
> From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1836760
> 
> 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 G. Piccoli" <gpiccoli@canonical.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> (backported from commit 1e1b0c658d9bb364b4a2a4b08a760d3e4c239bdc)
> [gpiccoli:
> * Context adjustment for v4.4.
> * Changed the patch to use the old ethtool API for get link settings
> (get_link_ksettings -> get_settings); the new API was introduced in
> v4.6 by commit 3f1ac7a700d039.]
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
> ---
>  drivers/net/ethernet/intel/ixgbevf/ethtool.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
> index 508e72c5f1c2..be788ba75c95 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
> @@ -95,22 +95,16 @@ static int ixgbevf_get_settings(struct net_device *netdev,
>  				struct ethtool_cmd *ecmd)
>  {
>  	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
> -	struct ixgbe_hw *hw = &adapter->hw;
> -	u32 link_speed = 0;
> -	bool link_up;
>  
>  	ecmd->supported = SUPPORTED_10000baseT_Full;
>  	ecmd->autoneg = AUTONEG_DISABLE;
>  	ecmd->transceiver = XCVR_DUMMY1;
>  	ecmd->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;

Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Khalid Elmously July 23, 2019, 5:34 a.m. UTC | #2
On 2019-07-16 17:13:43 , Guilherme G. Piccoli wrote:
> From: Alexander Duyck <alexander.h.duyck@linux.intel.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1836760
> 
> 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 G. Piccoli" <gpiccoli@canonical.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> (backported from commit 1e1b0c658d9bb364b4a2a4b08a760d3e4c239bdc)
> [gpiccoli:
> * Context adjustment for v4.4.
> * Changed the patch to use the old ethtool API for get link settings
> (get_link_ksettings -> get_settings); the new API was introduced in
> v4.6 by commit 3f1ac7a700d039.]
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
> ---
>  drivers/net/ethernet/intel/ixgbevf/ethtool.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
> index 508e72c5f1c2..be788ba75c95 100644
> --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
> @@ -95,22 +95,16 @@ static int ixgbevf_get_settings(struct net_device *netdev,
>  				struct ethtool_cmd *ecmd)
>  {
>  	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
> -	struct ixgbe_hw *hw = &adapter->hw;
> -	u32 link_speed = 0;
> -	bool link_up;
>  
>  	ecmd->supported = SUPPORTED_10000baseT_Full;
>  	ecmd->autoneg = AUTONEG_DISABLE;
>  	ecmd->transceiver = XCVR_DUMMY1;
>  	ecmd->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;
> -- 
> 2.22.0
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Patch
diff mbox series

diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index 508e72c5f1c2..be788ba75c95 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -95,22 +95,16 @@  static int ixgbevf_get_settings(struct net_device *netdev,
 				struct ethtool_cmd *ecmd)
 {
 	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
-	struct ixgbe_hw *hw = &adapter->hw;
-	u32 link_speed = 0;
-	bool link_up;
 
 	ecmd->supported = SUPPORTED_10000baseT_Full;
 	ecmd->autoneg = AUTONEG_DISABLE;
 	ecmd->transceiver = XCVR_DUMMY1;
 	ecmd->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;