From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S23 v4 05/15] ice: fix set pause param autoneg check
Date: Thu, 25 Jul 2019 01:55:31 -0700 [thread overview]
Message-ID: <20190725085541.55104-5-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20190725085541.55104-1-anthony.l.nguyen@intel.com>
From: Paul Greenwalt <paul.greenwalt@intel.com>
When ETHTOOL_GLINKSETTINGS is defined get pause param pause->autoneg
reports SW configured setting, however when not defined get pause param
pause->autoneg reports the link status. Set pause param needs to compare
pause->autoneg with the same source as get pause param to block the user
from changing autoneg with the set pause param option, or the user
may be incorrectly blocked from changing Rx|Tx pause settings.
Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
---
drivers/net/ethernet/intel/ice/ice_ethtool.c | 28 +++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 1fe048cfb737..ba29aede99ad 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2856,6 +2856,7 @@ static int
ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
{
struct ice_netdev_priv *np = netdev_priv(netdev);
+ struct ice_aqc_get_phy_caps_data *pcaps;
struct ice_link_status *hw_link_info;
struct ice_pf *pf = np->vsi->back;
struct ice_dcbx_cfg *dcbx_cfg;
@@ -2866,6 +2867,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
u8 aq_failures;
bool link_up;
int err = 0;
+ u32 is_an;
pi = vsi->port_info;
hw_link_info = &pi->phy.link_info;
@@ -2880,7 +2882,31 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause)
return -EOPNOTSUPP;
}
- if (pause->autoneg != (hw_link_info->an_info & ICE_AQ_AN_COMPLETED)) {
+ /* Get pause param reports configured and negotiated flow control pause
+ * when ETHTOOL_GLINKSETTINGS is defined. Since ETHTOOL_GLINKSETTINGS is
+ * defined get pause param pause->autoneg reports SW configured setting,
+ * so compare pause->autoneg with SW configured to prevent the user from
+ * using set pause param to chance autoneg.
+ */
+ pcaps = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*pcaps),
+ GFP_KERNEL);
+ if (!pcaps)
+ return -ENOMEM;
+
+ /* Get current PHY config */
+ status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_SW_CFG, pcaps,
+ NULL);
+ if (status) {
+ devm_kfree(&vsi->back->pdev->dev, pcaps);
+ return -EIO;
+ }
+
+ is_an = ((pcaps->caps & ICE_AQC_PHY_AN_MODE) ?
+ AUTONEG_ENABLE : AUTONEG_DISABLE);
+
+ devm_kfree(&vsi->back->pdev->dev, pcaps);
+
+ if (pause->autoneg != is_an) {
netdev_info(netdev, "To change autoneg please use: ethtool -s <dev> autoneg <on|off>\n");
return -EOPNOTSUPP;
}
--
2.20.1
next prev parent reply other threads:[~2019-07-25 8:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 8:55 [Intel-wired-lan] [PATCH S23 v4 01/15] ice: Implement ethtool ops for channels Tony Nguyen
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 02/15] ice: Use the software based tail when checking for hung Tx ring Tony Nguyen
2019-07-31 17:33 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 03/15] ice: Assume that more than one Rx queue is rare in ice_napi_poll Tony Nguyen
2019-07-31 17:34 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 04/15] ice: Restructure VFs initialization flows Tony Nguyen
2019-07-31 17:34 ` Bowers, AndrewX
2019-07-25 8:55 ` Tony Nguyen [this message]
2019-07-31 17:35 ` [Intel-wired-lan] [PATCH S23 v4 05/15] ice: fix set pause param autoneg check Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 06/15] ice: Set WB_ON_ITR when we don't re-enable interrupts Tony Nguyen
2019-07-31 17:35 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 07/15] ice: Fix kernel hang with DCB reset in CEE mode Tony Nguyen
2019-07-31 17:36 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 08/15] ice: allow empty rx descriptors Tony Nguyen
2019-07-31 17:36 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 09/15] ice: Do not always bring up PF VSI in ice_ena_vsi() Tony Nguyen
2019-07-31 17:37 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 10/15] ice: update GLINT_DYN_CTL and GLINT_VECT2FUNC register access Tony Nguyen
2019-07-31 17:37 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 11/15] ice: Reduce wait times during VF bringup/reset Tony Nguyen
2019-07-31 17:38 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 12/15] ice: Increase size of Mailbox receive queue for many VFs Tony Nguyen
2019-07-31 17:38 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 13/15] ice: Move VF resources definition to SR-IOV specific file Tony Nguyen
2019-07-31 17:39 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 14/15] ice: Change type for queue counts Tony Nguyen
2019-07-31 17:40 ` Bowers, AndrewX
2019-07-25 8:55 ` [Intel-wired-lan] [PATCH S23 v4 15/15] ice: improve print for VF's when adding/deleting MAC filters Tony Nguyen
2019-07-31 17:40 ` Bowers, AndrewX
2019-07-31 17:33 ` [Intel-wired-lan] [PATCH S23 v4 01/15] ice: Implement ethtool ops for channels Bowers, AndrewX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190725085541.55104-5-anthony.l.nguyen@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@osuosl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox