netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12
@ 2020-10-12 18:13 Tony Nguyen
  2020-10-12 18:13 ` [net-next v2 1/2] i40e: Allow changing FEC settings on X722 if supported by FW Tony Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tony Nguyen @ 2020-10-12 18:13 UTC (permalink / raw)
  To: davem, kuba; +Cc: Tony Nguyen, netdev, nhorman, sassmann

This series contains updates to i40e and e1000 drivers.

Jaroslaw adds support for changing FEC on i40e if the firmware supports it.

Jesse fixes a kbuild-bot warning regarding ternary operator on e1000. 

v2: Return -EOPNOTSUPP instead of -EINVAL when FEC settings are not
supported by firmware. Remove, unneeded, done label and return errors
directly in i40e_set_fec_param() for patch 1. Dropped, previous patch 2,
to send to net. 

The following are changes since commit 15f5e48f93c0e028b4d5cc0e8ede1168a2308fe6:
  cx82310_eth: use netdev_err instead of dev_err
and are available in the git repository at:
  https://github.com/anguy11/next-queue.git 40GbE

Jaroslaw Gawin (1):
  i40e: Allow changing FEC settings on X722 if supported by FW

Jesse Brandeburg (1):
  e1000: remove unused and incorrect code

 drivers/net/ethernet/intel/e1000/e1000_hw.c   | 10 +-----
 drivers/net/ethernet/intel/i40e/i40e_adminq.c |  6 ++++
 .../net/ethernet/intel/i40e/i40e_adminq_cmd.h |  2 ++
 .../net/ethernet/intel/i40e/i40e_ethtool.c    | 33 ++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_main.c   | 19 +++++++++++
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  1 +
 6 files changed, 50 insertions(+), 21 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [net-next v2 1/2] i40e: Allow changing FEC settings on X722 if supported by FW
  2020-10-12 18:13 [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Tony Nguyen
@ 2020-10-12 18:13 ` Tony Nguyen
  2020-10-12 18:13 ` [net-next v2 2/2] e1000: remove unused and incorrect code Tony Nguyen
  2020-10-14  2:46 ` [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2020-10-12 18:13 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jaroslaw Gawin, netdev, nhorman, sassmann, anthony.l.nguyen,
	Aleksandr Loktionov, Arkadiusz Kubalewski, Andrew Bowers

From: Jaroslaw Gawin <jaroslawx.gawin@intel.com>

Starting with API version 1.10 firmware for X722 devices has ability
to change FEC settings in PHY. Code added in this patch allows
changing FEC settings if the capability flag indicates the device
supports this feature.

Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c |  6 ++++
 .../net/ethernet/intel/i40e/i40e_adminq_cmd.h |  2 ++
 .../net/ethernet/intel/i40e/i40e_ethtool.c    | 33 ++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_main.c   | 19 +++++++++++
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  1 +
 5 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
index c897a2863e4f..593912b17609 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
@@ -541,6 +541,12 @@ static void i40e_set_hw_flags(struct i40e_hw *hw)
 		    (aq->api_maj_ver == 1 &&
 		     aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722))
 			hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE;
+
+		if (aq->api_maj_ver > 1 ||
+		    (aq->api_maj_ver == 1 &&
+		     aq->api_min_ver >= I40E_MINOR_VER_FW_REQUEST_FEC_X722))
+			hw->flags |= I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE;
+
 		fallthrough;
 	default:
 		break;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
index c0c8efe42fce..1e960c3c7ef0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
@@ -24,6 +24,8 @@
 #define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009
 /* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */
 #define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006
+/* API version 1.10 for X722 devices adds ability to request FEC encoding */
+#define I40E_MINOR_VER_FW_REQUEST_FEC_X722 0x000A
 
 struct i40e_aq_desc {
 	__le16 flags;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index dc1577156bb6..26ba1f3eb2d8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -891,6 +891,7 @@ static void i40e_get_settings_link_up(struct i40e_hw *hw,
 		if (hw_link_info->requested_speeds & I40E_LINK_SPEED_10GB)
 			ethtool_link_ksettings_add_link_mode(ks, advertising,
 							     10000baseT_Full);
+		i40e_get_settings_link_up_fec(hw_link_info->req_fec_info, ks);
 		break;
 	case I40E_PHY_TYPE_SGMII:
 		ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
@@ -1481,12 +1482,16 @@ static int i40e_set_fec_param(struct net_device *netdev,
 	struct i40e_pf *pf = np->vsi->back;
 	struct i40e_hw *hw = &pf->hw;
 	u8 fec_cfg = 0;
-	int err = 0;
 
 	if (hw->device_id != I40E_DEV_ID_25G_SFP28 &&
-	    hw->device_id != I40E_DEV_ID_25G_B) {
-		err = -EPERM;
-		goto done;
+	    hw->device_id != I40E_DEV_ID_25G_B &&
+	    hw->device_id != I40E_DEV_ID_KX_X722)
+		return -EPERM;
+
+	if (hw->mac.type == I40E_MAC_X722 &&
+	    !(hw->flags & I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE)) {
+		netdev_err(netdev, "Setting FEC encoding not supported by firmware. Please update the NVM image.\n");
+		return -EOPNOTSUPP;
 	}
 
 	switch (fecparam->fec) {
@@ -1508,14 +1513,10 @@ static int i40e_set_fec_param(struct net_device *netdev,
 	default:
 		dev_warn(&pf->pdev->dev, "Unsupported FEC mode: %d",
 			 fecparam->fec);
-		err = -EINVAL;
-		goto done;
+		return -EINVAL;
 	}
 
-	err = i40e_set_fec_cfg(netdev, fec_cfg);
-
-done:
-	return err;
+	return i40e_set_fec_cfg(netdev, fec_cfg);
 }
 
 static int i40e_nway_reset(struct net_device *netdev)
@@ -4951,8 +4952,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 		}
 	}
 
-	if (((changed_flags & I40E_FLAG_RS_FEC) ||
-	     (changed_flags & I40E_FLAG_BASE_R_FEC)) &&
+	if (changed_flags & I40E_FLAG_RS_FEC &&
 	    pf->hw.device_id != I40E_DEV_ID_25G_SFP28 &&
 	    pf->hw.device_id != I40E_DEV_ID_25G_B) {
 		dev_warn(&pf->pdev->dev,
@@ -4960,6 +4960,15 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 		return -EOPNOTSUPP;
 	}
 
+	if (changed_flags & I40E_FLAG_BASE_R_FEC &&
+	    pf->hw.device_id != I40E_DEV_ID_25G_SFP28 &&
+	    pf->hw.device_id != I40E_DEV_ID_25G_B &&
+	    pf->hw.device_id != I40E_DEV_ID_KX_X722) {
+		dev_warn(&pf->pdev->dev,
+			 "Device does not support changing FEC configuration\n");
+		return -EOPNOTSUPP;
+	}
+
 	/* Process any additional changes needed as a result of flag changes.
 	 * The changed_flags value reflects the list of bits that were
 	 * changed in the code above.
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 929c64789119..4f8a2154b93f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6622,6 +6622,25 @@ void i40e_print_link_message(struct i40e_vsi *vsi, bool isup)
 			else
 				req_fec = "CL74 FC-FEC/BASE-R";
 		}
+		netdev_info(vsi->netdev,
+			    "NIC Link is Up, %sbps Full Duplex, Requested FEC: %s, Negotiated FEC: %s, Autoneg: %s, Flow Control: %s\n",
+			    speed, req_fec, fec, an, fc);
+	} else if (pf->hw.device_id == I40E_DEV_ID_KX_X722) {
+		req_fec = "None";
+		fec = "None";
+		an = "False";
+
+		if (pf->hw.phy.link_info.an_info & I40E_AQ_AN_COMPLETED)
+			an = "True";
+
+		if (pf->hw.phy.link_info.fec_info &
+		    I40E_AQ_CONFIG_FEC_KR_ENA)
+			fec = "CL74 FC-FEC/BASE-R";
+
+		if (pf->hw.phy.link_info.req_fec_info &
+		    I40E_AQ_REQUEST_FEC_KR)
+			req_fec = "CL74 FC-FEC/BASE-R";
+
 		netdev_info(vsi->netdev,
 			    "NIC Link is Up, %sbps Full Duplex, Requested FEC: %s, Negotiated FEC: %s, Autoneg: %s, Flow Control: %s\n",
 			    speed, req_fec, fec, an, fc);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 97d29df65f9e..c0bdc666f557 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -595,6 +595,7 @@ struct i40e_hw {
 #define I40E_HW_FLAG_FW_LLDP_PERSISTENT     BIT_ULL(5)
 #define I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED BIT_ULL(6)
 #define I40E_HW_FLAG_DROP_MODE              BIT_ULL(7)
+#define I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE BIT_ULL(8)
 	u64 flags;
 
 	/* Used in set switch config AQ command */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [net-next v2 2/2] e1000: remove unused and incorrect code
  2020-10-12 18:13 [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Tony Nguyen
  2020-10-12 18:13 ` [net-next v2 1/2] i40e: Allow changing FEC settings on X722 if supported by FW Tony Nguyen
@ 2020-10-12 18:13 ` Tony Nguyen
  2020-10-14  2:46 ` [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Nguyen @ 2020-10-12 18:13 UTC (permalink / raw)
  To: davem, kuba
  Cc: Jesse Brandeburg, netdev, nhorman, sassmann, anthony.l.nguyen,
	Aaron Brown

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

The e1000_clear_vfta function was triggering a warning in kbuild-bot
testing. It's actually a bug but has no functional impact.

drivers/net/ethernet/intel/e1000/e1000_hw.c:4415:58: warning: Same expression in both branches of ternary operator. [duplicateExpressionTernary]

Fix this warning by removing the offending code and simplifying
the routine to do exactly what it did before, no functional
change.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/e1000/e1000_hw.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_hw.c b/drivers/net/ethernet/intel/e1000/e1000_hw.c
index fb5af23880c3..4c0c9433bd60 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_hw.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_hw.c
@@ -4401,17 +4401,9 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
 static void e1000_clear_vfta(struct e1000_hw *hw)
 {
 	u32 offset;
-	u32 vfta_value = 0;
-	u32 vfta_offset = 0;
-	u32 vfta_bit_in_reg = 0;
 
 	for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) {
-		/* If the offset we want to clear is the same offset of the
-		 * manageability VLAN ID, then clear all bits except that of the
-		 * manageability unit
-		 */
-		vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
-		E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
+		E1000_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
 		E1000_WRITE_FLUSH();
 	}
 }
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12
  2020-10-12 18:13 [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Tony Nguyen
  2020-10-12 18:13 ` [net-next v2 1/2] i40e: Allow changing FEC settings on X722 if supported by FW Tony Nguyen
  2020-10-12 18:13 ` [net-next v2 2/2] e1000: remove unused and incorrect code Tony Nguyen
@ 2020-10-14  2:46 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-10-14  2:46 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, netdev, nhorman, sassmann

On Mon, 12 Oct 2020 11:13:44 -0700 Tony Nguyen wrote:
> This series contains updates to i40e and e1000 drivers.
> 
> Jaroslaw adds support for changing FEC on i40e if the firmware supports it.
> 
> Jesse fixes a kbuild-bot warning regarding ternary operator on e1000. 
> 
> v2: Return -EOPNOTSUPP instead of -EINVAL when FEC settings are not
> supported by firmware. Remove, unneeded, done label and return errors
> directly in i40e_set_fec_param() for patch 1. Dropped, previous patch 2,
> to send to net. 

Applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-14  2:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 18:13 [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Tony Nguyen
2020-10-12 18:13 ` [net-next v2 1/2] i40e: Allow changing FEC settings on X722 if supported by FW Tony Nguyen
2020-10-12 18:13 ` [net-next v2 2/2] e1000: remove unused and incorrect code Tony Nguyen
2020-10-14  2:46 ` [net-next v2 0/2][pull request] 40GbE Intel Wired LAN Driver Updates 2020-10-12 Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).