Skip to contentSkip to conversation

update ixgbe shared code to version 16.11.21

PATCH In review Wei Dai 2 participants 33 messages Dec 21, 2016 – Dec 22, 2016 Network drivers

lore
Share & tools
lore

Wei Dai

author
#0 lore raw

v2 cover update ixgbe shared code to version 16.11.21

update ixgbe shared code to version 16.11.21 .
v2 changes:
modify subject line and message body of git log according to feedbacks from communtiy.

split the 24th patch into 2 separate ones.
the 24th of v1 is net/ixgbe/base: add EEE support for DNL-controlled PHYs the 24th of v2 is net/ixgbe/base: add EEE support for some PHYs the 25th of v2 is net/ixgbe/base: remove unused enum type

correct RAEDME

Wei Dai (30):
net/ixgbe/base: fix PHY reset check for x550em-ext net/ixgbe/base: fix clearing SAN MAC address net/ixgbe/base: use fast MDIO for non-10G devices net/ixgbe/base: fix PHY identification for x550a net/ixgbe/base: clean up X557 link status check net/ixgbe/base: add driver version to firmware net/ixgbe/base: store link active LED net/ixgbe/base: cleanup X540 checksum calculation net/ixgbe/base: enable LASI only for X552 devices net/ixgbe/base: limit iXFI setup to X552 devices net/ixgbe/base: fix getting PHY type for some x550 devices net/ixgbe/base: fix SGMII link setup for M88 PHYs net/ixgbe/base: cleanup dead EEE code net/ixgbe/base: fix setting unsupported autoneg speeds net/ixgbe/base: support FW commands to control some PHYs net/ixgbe/base: use FW commands to control some PHYs net/ixgbe/base: support busy SGMII register reads net/ixgbe/base: include new speeds in VFLINK interpretation net/ixgbe/base: limit 5Gb support to X550 devices net/ixgbe/base: add physical layer options for FW PHY type net/ixgbe/base: remove unneeded MAC type check net/ixgbe/base: remove unused PHY ID net/ixgbe/base: update FW PHY flow control net/ixgbe/base: add EEE support for some PHYs net/ixgbe/base: remove unused enum type net/ixgbe/base: fix IXGBE LSWFW register net/ixgbe/base: remove unused EEE code net/ixgbe/base: add write flush required by Inphi PHY net/ixgbe/base: report physical layer for SGMII PHY type net/ixgbe/base: update shared code version to 2016.11.21

 drivers/net/ixgbe/Makefile            |   1 +
 drivers/net/ixgbe/base/README         |   3 +-
 drivers/net/ixgbe/base/ixgbe_api.c    |   7 +-
 drivers/net/ixgbe/base/ixgbe_api.h    |   2 +-
 drivers/net/ixgbe/base/ixgbe_common.c |  54 +-
 drivers/net/ixgbe/base/ixgbe_common.h |   7 +-
 drivers/net/ixgbe/base/ixgbe_hv_vf.c  | 240 +++++++++
 drivers/net/ixgbe/base/ixgbe_hv_vf.h  |  41 ++
 drivers/net/ixgbe/base/ixgbe_osdep.h  |   4 +-
 drivers/net/ixgbe/base/ixgbe_phy.c    | 168 +++---
 drivers/net/ixgbe/base/ixgbe_phy.h    |  72 +--
 drivers/net/ixgbe/base/ixgbe_type.h   | 104 +++-
 drivers/net/ixgbe/base/ixgbe_vf.c     |  16 +
 drivers/net/ixgbe/base/ixgbe_vf.h     |   3 +
 drivers/net/ixgbe/base/ixgbe_x540.c   |  10 +-
 drivers/net/ixgbe/base/ixgbe_x550.c   | 977 +++++++++++++++-------------------
 drivers/net/ixgbe/base/ixgbe_x550.h   |   4 +-
 17 files changed, 977 insertions(+), 736 deletions(-)
 create mode 100644 drivers/net/ixgbe/base/ixgbe_hv_vf.c
 create mode 100644 drivers/net/ixgbe/base/ixgbe_hv_vf.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/30 net/ixgbe/base: fix PHY reset check for x550em-ext

PHY type ixgbe_phy_x550em_ext_t requires different check to verify reset status.

Fixes af75078fece3 ("first public release")
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/net/ixgbe/base/ixgbe_phy.c +24 -5
index 43c55d7..1d9fb3e 100644
@@ -528,11 +528,30 @@ s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw)
 	 */
 	for (i = 0; i < 30; i++) {
 		msec_delay(100);
-		hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_XS_CONTROL,
-				     IXGBE_MDIO_PHY_XS_DEV_TYPE, &ctrl);
-		if (!(ctrl & IXGBE_MDIO_PHY_XS_RESET)) {
-			usec_delay(2);
-			break;
+		if (hw->phy.type == ixgbe_phy_x550em_ext_t) {
+			status = hw->phy.ops.read_reg(hw,
+						  IXGBE_MDIO_TX_VENDOR_ALARMS_3,
+						  IXGBE_MDIO_PMA_PMD_DEV_TYPE,
+						  &ctrl);
+			if (status != IXGBE_SUCCESS)
+				return status;
+
+			if (ctrl & IXGBE_MDIO_TX_VENDOR_ALARMS_3_RST_MASK) {
+				usec_delay(2);
+				break;
+			}
+		} else {
+			status = hw->phy.ops.read_reg(hw,
+						     IXGBE_MDIO_PHY_XS_CONTROL,
+						     IXGBE_MDIO_PHY_XS_DEV_TYPE,
+						     &ctrl);
+			if (status != IXGBE_SUCCESS)
+				return status;
+
+			if (!(ctrl & IXGBE_MDIO_PHY_XS_RESET)) {
+				usec_delay(2);
+				break;
+			}
 		}
 	}
 
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/30 net/ixgbe/base: fix clearing SAN MAC address

In reply to Wei Dai

Receive Address Register (RAR) entries, including SAN MAC address, are cleared when VMDq pool bits are cleared.
Prevent SAN MAC address to be cleared.

Fixes af75078fece3 ("first public release")
---
 drivers/net/ixgbe/base/ixgbe_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_common.c +2 -1
index cca19ef..b2cc6fb 100644
@@ -3764,7 +3764,8 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
 	}
 
 	/* was that the last pool using this rar? */
-	if (mpsar_lo == 0 && mpsar_hi == 0 && rar != 0)
+	if (mpsar_lo == 0 && mpsar_hi == 0 &&
+	    rar != 0 && rar != hw->mac.san_mac_rar_index)
 		hw->mac.ops.clear_rar(hw, rar);
 done:
 	return IXGBE_SUCCESS;
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/30 net/ixgbe/base: use fast MDIO for non-10G devices

In reply to Wei Dai

Devices that cannot go 10G speeds can safely select a faster Management Data Input/Output (MDIO) speed.
Select fast MDIO clock speed for for those devices.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +7 -2
index acb8140..c1fac1a 100644
@@ -2549,8 +2549,6 @@ STATIC void ixgbe_set_mdio_speed(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_X_10G_T:
 	case IXGBE_DEV_ID_X550EM_A_SGMII:
 	case IXGBE_DEV_ID_X550EM_A_SGMII_L:
-	case IXGBE_DEV_ID_X550EM_A_1G_T:
-	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 	case IXGBE_DEV_ID_X550EM_A_10G_T:
 	case IXGBE_DEV_ID_X550EM_A_SFP:
 	case IXGBE_DEV_ID_X550EM_A_QSFP:
@@ -2559,6 +2557,13 @@ STATIC void ixgbe_set_mdio_speed(struct ixgbe_hw *hw)
 		hlreg0 &= ~IXGBE_HLREG0_MDCSPD;
 		IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
 		break;
+	case IXGBE_DEV_ID_X550EM_A_1G_T:
+	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
+		/* Select fast MDIO clock speed for these devices */
+		hlreg0 = IXGBE_READ_REG(hw, IXGBE_HLREG0);
+		hlreg0 |= IXGBE_HLREG0_MDCSPD;
+		IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
+		break;
 	default:
 		break;
 	}
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 4/30 net/ixgbe/base: fix PHY identification for x550a

In reply to Wei Dai

Method to identify the CS4223/CS4227 is incorrect and unreliable. Provide a new register to differentiate between these PHY SKUs.

Fixes fc0559bdb5e3 ("net/ixgbe/base: add link MAC setup for X550a SFP+")
---
 drivers/net/ixgbe/base/ixgbe_phy.h  | 5 +++--
 drivers/net/ixgbe/base/ixgbe_x550.c | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/ixgbe/base/ixgbe_phy.h +3 -2
index da14abc..816de36 100644
@@ -92,8 +92,9 @@ POSSIBILITY OF SUCH DAMAGE.
 #define IXGBE_CS4227_GLOBAL_ID_MSB	1
 #define IXGBE_CS4227_SCRATCH		2
 #define IXGBE_CS4227_GLOBAL_ID_VALUE	0x03E5
-#define IXGBE_CS4223_PHY_ID		0x7003	/* Quad port */
-#define IXGBE_CS4227_PHY_ID		0x3003	/* Dual port */
+#define IXGBE_CS4227_EFUSE_PDF_SKU	0x19F
+#define IXGBE_CS4223_SKU_ID		0x0010	/* Quad port */
+#define IXGBE_CS4227_SKU_ID		0x0014	/* Dual port */
 #define IXGBE_CS4227_RESET_PENDING	0x1357
 #define IXGBE_CS4227_RESET_COMPLETE	0x5AA5
 #define IXGBE_CS4227_RETRIES		15
drivers/net/ixgbe/base/ixgbe_x550.c +3 -3
index c1fac1a..f5143f9 100644
@@ -2927,8 +2927,8 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 			return IXGBE_ERR_PHY_ADDR_INVALID;
 		}
 
-		/* Get external PHY device id */
-		ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_GLOBAL_ID_MSB,
+		/* Get external PHY SKU id */
+		ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_EFUSE_PDF_SKU,
 					IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
 
 		if (ret_val != IXGBE_SUCCESS)
@@ -2937,7 +2937,7 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 		/* When configuring quad port CS4223, the MAC instance is part
 		 * of the slice offset.
 		 */
-		if (reg_phy_ext == IXGBE_CS4223_PHY_ID)
+		if (reg_phy_ext == IXGBE_CS4223_SKU_ID)
 			slice_offset = (hw->bus.lan_id +
 					(hw->bus.instance_id << 1)) << 12;
 		else
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v2 5/30 net/ixgbe/base: clean up X557 link status check

In reply to Wei Dai

This patch cleans up the code and clarifies the comment around the X557 PHY link status check in ixgbe_check_link_t_x550em().

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +11 -14
index f5143f9..69aa9d5 100644
@@ -4660,7 +4660,7 @@ s32 ixgbe_check_link_t_X550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 			      bool *link_up, bool link_up_wait_to_complete)
 {
 	u32 status;
-	u16 autoneg_status;
+	u16 i, autoneg_status = 0;
 
 	if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper)
 		return IXGBE_ERR_CONFIG;
@@ -4673,21 +4673,18 @@ s32 ixgbe_check_link_t_X550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 		return status;
 
 	/* MAC link is up, so check external PHY link.
-	 * Read this twice back to back to indicate current status.
+	 * X557 PHY. Link status is latching low, and can only be used to detect
+	 * link drop, and not the current status of the link without performing
+	 * back-to-back reads.
 	 */
-	status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      &autoneg_status);
-
-	if (status != IXGBE_SUCCESS)
-		return status;
-
-	status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      &autoneg_status);
+	for (i = 0; i < 2; i++) {
+		status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_STATUS,
+					      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+					      &autoneg_status);
 
-	if (status != IXGBE_SUCCESS)
-		return status;
+		if (status != IXGBE_SUCCESS)
+			return status;
+	}
 
 	/* If external PHY link is not up, then indicate link not up */
 	if (!(autoneg_status & IXGBE_MDIO_AUTO_NEG_LINK_STATUS))
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v2 6/30 net/ixgbe/base: add driver version to firmware

In reply to Wei Dai

Send the driver version string to firmware through the host interface command on x550 devices.

---
 drivers/net/ixgbe/base/ixgbe_api.c    |  7 ++--
 drivers/net/ixgbe/base/ixgbe_api.h    |  2 +-
 drivers/net/ixgbe/base/ixgbe_common.c |  4 ++-
 drivers/net/ixgbe/base/ixgbe_common.h |  2 +-
 drivers/net/ixgbe/base/ixgbe_type.h   | 14 +++++++-
 drivers/net/ixgbe/base/ixgbe_x550.c   | 63 +++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_x550.h   |  2 ++
 7 files changed, 88 insertions(+), 6 deletions(-)
drivers/net/ixgbe/base/ixgbe_api.c +5 -2
index 094ee52..0ddafcb 100644
@@ -1147,12 +1147,15 @@ s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
  * @min: driver minor number to be sent to firmware
  * @build: driver build number to be sent to firmware
  * @ver: driver version number to be sent to firmware
+ * @len: length of driver_ver string
+ * @driver_ver: driver string
  **/
 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
-			 u8 ver)
+			 u8 ver, u16 len, char *driver_ver)
 {
 	return ixgbe_call_func(hw, hw->mac.ops.set_fw_drv_ver, (hw, maj, min,
-			       build, ver), IXGBE_NOT_IMPLEMENTED);
+			       build, ver, len, driver_ver),
+			       IXGBE_NOT_IMPLEMENTED);
 }
 
 
drivers/net/ixgbe/base/ixgbe_api.h +1 -1
index 24c4ae8..af85d4e 100644
@@ -133,7 +133,7 @@ s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 s32 ixgbe_fc_enable(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc(struct ixgbe_hw *hw);
 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
-			 u8 ver);
+			 u8 ver, u16 len, char *driver_ver);
 s32 ixgbe_get_thermal_sensor_data(struct ixgbe_hw *hw);
 s32 ixgbe_init_thermal_sensor_thresh(struct ixgbe_hw *hw);
 void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr);
drivers/net/ixgbe/base/ixgbe_common.c +3 -1
index b2cc6fb..a6016dc 100644
@@ -4596,13 +4596,15 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
  *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
  **/
 s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
-				 u8 build, u8 sub)
+				 u8 build, u8 sub, u16 len,
+				 const char *driver_ver)
 {
 	struct ixgbe_hic_drv_info fw_cmd;
 	int i;
 	s32 ret_val = IXGBE_SUCCESS;
 
 	DEBUGFUNC("ixgbe_set_fw_drv_ver_generic");
+	UNREFERENCED_2PARAMETER(len, driver_ver);
 
 	fw_cmd.hdr.cmd = FW_CEM_CMD_DRIVER_INFO;
 	fw_cmd.hdr.buf_len = FW_CEM_CMD_DRIVER_INFO_LEN;
drivers/net/ixgbe/base/ixgbe_common.h +1 -1
index 66dd565..ae28206 100644
@@ -155,7 +155,7 @@ void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb, u32 headroom,
 			     int strategy);
 void ixgbe_enable_relaxed_ordering_gen2(struct ixgbe_hw *hw);
 s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
-				 u8 build, u8 ver);
+				 u8 build, u8 ver, u16 len, const char *str);
 u8 ixgbe_calculate_checksum(u8 *buffer, u32 length);
 s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 				 u32 length, u32 timeout, bool return_data);
drivers/net/ixgbe/base/ixgbe_type.h +13 -1
index 4982e03..5b2506a 100644
@@ -3037,6 +3037,7 @@ enum ixgbe_fdir_pballoc_type {
 #define FW_CEM_UNUSED_VER		0x0
 #define FW_CEM_MAX_RETRIES		3
 #define FW_CEM_RESP_STATUS_SUCCESS	0x1
+#define FW_CEM_DRIVER_VERSION_SIZE	39 /* +9 would send 48 bytes to fw */
 #define FW_READ_SHADOW_RAM_CMD		0x31
 #define FW_READ_SHADOW_RAM_LEN		0x6
 #define FW_WRITE_SHADOW_RAM_CMD		0x33
@@ -3111,6 +3112,16 @@ struct ixgbe_hic_drv_info {
 	u16 pad2; /* end spacing to ensure length is mult. of dword2 */
 };
 
+struct ixgbe_hic_drv_info2 {
+	struct ixgbe_hic_hdr hdr;
+	u8 port_num;
+	u8 ver_sub;
+	u8 ver_build;
+	u8 ver_min;
+	u8 ver_maj;
+	char driver_string[FW_CEM_DRIVER_VERSION_SIZE];
+};
+
 /* These need to be dword aligned */
 struct ixgbe_hic_read_shadow_ram {
 	union ixgbe_hic_hdr2 hdr;
@@ -3907,7 +3918,8 @@ struct ixgbe_mac_operations {
 	void (*fc_autoneg)(struct ixgbe_hw *);
 
 	/* Manageability interface */
-	s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
+	s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8, u16,
+			      const char *);
 	s32 (*get_thermal_sensor_data)(struct ixgbe_hw *);
 	s32 (*init_thermal_sensor_thresh)(struct ixgbe_hw *hw);
 	void (*get_rtrup2tc)(struct ixgbe_hw *hw, u8 *map);
drivers/net/ixgbe/base/ixgbe_x550.c +63 -0

72 lines not on this page · raw message

drivers/net/ixgbe/base/ixgbe_x550.h +2 -0
index cd4db29..2d1876b 100644
@@ -67,6 +67,8 @@ s32 ixgbe_write_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
 				 u32 device_type, u32 data);
 s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
 	u32 device_type, u32 *data);
+s32 ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min,
+			      u8 build, u8 ver, u16 len, const char *str);
 s32 ixgbe_get_phy_token(struct ixgbe_hw *);
 s32 ixgbe_put_phy_token(struct ixgbe_hw *);
 s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
Signature · 1 line
2.7.4
author
#7 lore raw

PATCH v2 7/30 net/ixgbe/base: store link active LED

In reply to Wei Dai

Add support to get the link active LED index via the LEDCTL register. If the LEDCTL register does not have link active LED set then use MAC default LED index.
Link active LED is used for adapter identify/blink support.

---
 drivers/net/ixgbe/base/ixgbe_common.c | 45 +++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_common.h |  1 +
 drivers/net/ixgbe/base/ixgbe_type.h   |  2 ++
 3 files changed, 48 insertions(+)
drivers/net/ixgbe/base/ixgbe_common.c +45 -0
index a6016dc..89b4b5f 100644
@@ -113,6 +113,7 @@ s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw)
 	mac->ops.led_off = ixgbe_led_off_generic;
 	mac->ops.blink_led_start = ixgbe_blink_led_start_generic;
 	mac->ops.blink_led_stop = ixgbe_blink_led_stop_generic;
+	mac->ops.init_led_link_act = ixgbe_init_led_link_act_generic;
 
 	/* RAR, Multicast, VLAN */
 	mac->ops.set_rar = ixgbe_set_rar_generic;
@@ -497,6 +498,9 @@ s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw)
 		status = hw->mac.ops.start_hw(hw);
 	}
 
+	/* Initialize the LED link active for LED blink support */
+	hw->mac.ops.init_led_link_act(hw);
+
 	return status;
 }
 
@@ -1136,6 +1140,47 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_init_led_link_act_generic - Store the LED index link/activity.
+ *  @hw: pointer to hardware structure
+ *
+ *  Store the index for the link active LED. This will be used to support
+ *  blinking the LED.
+ **/
+s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	u32 led_reg, led_mode;
+	u16 i;
+
+	led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
+
+	/* Get LED link active from the LEDCTL register */
+	for (i = 0; i < 4; i++) {
+		led_mode = led_reg >> IXGBE_LED_MODE_SHIFT(i);
+
+		if ((led_mode & IXGBE_LED_MODE_MASK_BASE) ==
+		     IXGBE_LED_LINK_ACTIVE) {
+			mac->led_link_act = i;
+			return IXGBE_SUCCESS;
+		}
+	}
+
+	/*
+	 * If LEDCTL register does not have the LED link active set, then use
+	 * known MAC defaults.
+	 */
+	switch (hw->mac.type) {
+	case ixgbe_mac_X550EM_a:
+	case ixgbe_mac_X550EM_x:
+		mac->led_link_act = 1;
+		break;
+	default:
+		mac->led_link_act = 2;
+	}
+	return IXGBE_SUCCESS;
+}
+
+/**
  *  ixgbe_led_on_generic - Turns on the software controllable LEDs.
  *  @hw: pointer to hardware structure
  *  @index: led number to turn on
drivers/net/ixgbe/base/ixgbe_common.h +1 -0
index ae28206..93e80ea 100644
@@ -72,6 +72,7 @@ s32 ixgbe_stop_adapter_generic(struct ixgbe_hw *hw);
 
 s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index);
 s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index);
+s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw);
 
 s32 ixgbe_init_eeprom_params_generic(struct ixgbe_hw *hw);
 s32 ixgbe_write_eeprom_generic(struct ixgbe_hw *hw, u16 offset, u16 data);
drivers/net/ixgbe/base/ixgbe_type.h +2 -0
index 5b2506a..b90ae6d 100644
@@ -3886,6 +3886,7 @@ struct ixgbe_mac_operations {
 	s32 (*led_off)(struct ixgbe_hw *, u32);
 	s32 (*blink_led_start)(struct ixgbe_hw *, u32);
 	s32 (*blink_led_stop)(struct ixgbe_hw *, u32);
+	s32 (*init_led_link_act)(struct ixgbe_hw *);
 
 	/* RAR, Multicast, VLAN */
 	s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32);
@@ -4029,6 +4030,7 @@ struct ixgbe_mac_info {
 	struct ixgbe_dmac_config dmac_config;
 	bool set_lben;
 	u32  max_link_up_time;
+	u8   led_link_act;
 };
 
 struct ixgbe_phy_info {
Signature · 1 line
2.7.4
author
#8 lore raw

PATCH v2 8/30 net/ixgbe/base: cleanup X540 checksum calculation

In reply to Wei Dai

The variable checksum_last_word is used only for bounds check. So remove this variable and use IXGBE_EEPROM_CHECKSUM directly.

---
 drivers/net/ixgbe/base/ixgbe_x540.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ixgbe/base/ixgbe_x540.c +5 -5
index 6e778bc..49bf154 100644
@@ -491,7 +491,6 @@ s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)
 	u16 length = 0;
 	u16 pointer = 0;
 	u16 word = 0;
-	u16 checksum_last_word = IXGBE_EEPROM_CHECKSUM;
 	u16 ptr_start = IXGBE_PCIE_ANALOG_PTR;
 
 	/* Do not use hw->eeprom.ops.read because we do not want to take
@@ -501,14 +500,15 @@ s32 ixgbe_calc_eeprom_checksum_X540(struct ixgbe_hw *hw)
 
 	DEBUGFUNC("ixgbe_calc_eeprom_checksum_X540");
 
-	/* Include 0x0-0x3F in the checksum */
-	for (i = 0; i <= checksum_last_word; i++) {
+	/* Include 0x0 up to IXGBE_EEPROM_CHECKSUM; do not include the
+	 * checksum itself
+	 */
+	for (i = 0; i < IXGBE_EEPROM_CHECKSUM; i++) {
 		if (ixgbe_read_eerd_generic(hw, i, &word)) {
 			DEBUGOUT("EEPROM read failed\n");
 			return IXGBE_ERR_EEPROM;
 		}
-		if (i != IXGBE_EEPROM_CHECKSUM)
-			checksum += word;
+		checksum += word;
 	}
 
 	/* Include all data from pointers 0x3, 0x6-0xE.  This excludes the
Signature · 1 line
2.7.4
author
#9 lore raw

PATCH v2 9/30 net/ixgbe/base: enable LASI only for X552 devices

In reply to Wei Dai

Enable the Link Alarm Status Interrupt (LASI) only for X552 devices to receive notifications of the link configurations of the external PHY and correspondingly support the configuration of the internal iXFI link, since iXFI does not support auto-negotiation.

This is not required for X553 devices having KR support, which performs auto-negotiations and which is used as the internal link to the external PHY.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +22 -9
index 28c7ce3..fecc8e6 100644
@@ -2026,19 +2026,32 @@ STATIC s32 ixgbe_enable_lasi_ext_t_x550em(struct ixgbe_hw *hw)
 	status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc);
 
 	/* Enable link status change alarm */
-	status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &reg);
 
-	if (status != IXGBE_SUCCESS)
-		return status;
+	/* Enable the LASI interrupts on X552 devices to receive notifications
+	 * of the link configurations of the external PHY and correspondingly
+	 * support the configuration of the internal iXFI link, since iXFI does
+	 * not support auto-negotiation. This is not required for X553 devices
+	 * having KR support, which performs auto-negotiations and which is used
+	 * as the internal link to the external PHY. Hence adding a check here
+	 * to avoid enabling LASI interrupts for X553 devices.
+	 */
+	if (hw->mac.type != ixgbe_mac_X550EM_a) {
+		status = hw->phy.ops.read_reg(hw,
+					IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
+					IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &reg);
+
+		if (status != IXGBE_SUCCESS)
+			return status;
 
-	reg |= IXGBE_MDIO_PMA_TX_VEN_LASI_INT_EN;
+		reg |= IXGBE_MDIO_PMA_TX_VEN_LASI_INT_EN;
 
-	status = hw->phy.ops.write_reg(hw, IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
-				       IXGBE_MDIO_AUTO_NEG_DEV_TYPE, reg);
+		status = hw->phy.ops.write_reg(hw,
+					IXGBE_MDIO_PMA_TX_VEN_LASI_INT_MASK,
+					IXGBE_MDIO_AUTO_NEG_DEV_TYPE, reg);
 
-	if (status != IXGBE_SUCCESS)
-		return status;
+		if (status != IXGBE_SUCCESS)
+			return status;
+	}
 
 	/* Enable high temperature failure and global fault alarms */
 	status = hw->phy.ops.read_reg(hw, IXGBE_MDIO_GLOBAL_INT_MASK,
Signature · 1 line
2.7.4
author
#10 lore raw

PATCH v2 10/30 net/ixgbe/base: limit iXFI setup to X552 devices

In reply to Wei Dai

The MAC register NW_MNG_IF_SEL fields have been redefined for X553. These changes impact the iXFI driver code flow. Since iXFI is only supported in X552, this patch adds X552 MAC check for iXFI flows.

---
 drivers/net/ixgbe/base/ixgbe_type.h |  4 ++--
 drivers/net/ixgbe/base/ixgbe_x550.c | 13 ++++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/net/ixgbe/base/ixgbe_type.h +2 -2
index b90ae6d..adc5fb3 100644
@@ -4271,8 +4271,8 @@ struct ixgbe_hw {
 #define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_1G	(1u << 19)
 #define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G	(1u << 20)
 #define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_10G	(1u << 21)
-#define IXGBE_NW_MNG_IF_SEL_ENABLE_10_100M (1 << 23)
-#define IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE (1 << 24)
+#define IXGBE_NW_MNG_IF_SEL_SGMII_ENABLE	(1u << 25)
+#define IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE (1 << 24) /* X552 reg field only */
 #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT 3
 #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD	\
 				(0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT)
drivers/net/ixgbe/base/ixgbe_x550.c +10 -3
index fecc8e6..a338a79 100644
@@ -3053,6 +3053,10 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	s32 status;
 	u32 reg_val;
 
+	/* iXFI is only supported with X552 */
+	if (mac->type != ixgbe_mac_X550EM_x)
+		return IXGBE_ERR_LINK_SETUP;
+
 	/* Disable AN and force speed to 10G Serial. */
 	status = mac->ops.read_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
@@ -3149,7 +3153,8 @@ s32 ixgbe_setup_internal_phy_t_x550em(struct ixgbe_hw *hw)
 	if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper)
 		return IXGBE_ERR_CONFIG;
 
-	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
+	if (hw->mac.type == ixgbe_mac_X550EM_x &&
+	    !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
 		/* If link is down, there is no setup necessary so return  */
 		status = ixgbe_ext_phy_t_x550em_get_link(hw, &link_up);
 		if (status != IXGBE_SUCCESS)
@@ -4651,8 +4656,10 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 	else
 		force_speed = IXGBE_LINK_SPEED_1GB_FULL;
 
-	/* If internal link mode is XFI, then setup XFI internal link. */
-	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
+	/* If X552 and internal link mode is XFI, then setup XFI internal link.
+	 */
+	if (hw->mac.type == ixgbe_mac_X550EM_x &&
+	    !(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
 		status = ixgbe_setup_ixfi_x550em(hw, &force_speed);
 
 		if (status != IXGBE_SUCCESS)
Signature · 1 line
2.7.4
author
#11 lore raw

PATCH v2 11/30 net/ixgbe/base: fix getting PHY type for some x550 devices

In reply to Wei Dai

Return correct physical layer for some x550 devices.

Fixes 76d5b807ff74 ("ixgbe/base: new X557 phy")
Fixes d2e72774e58c ("ixgbe/base: support X550")
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +2 -0
index a338a79..d5dffdf 100644
@@ -3797,6 +3797,8 @@ u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
 		if (ext_ability & IXGBE_MDIO_PHY_1000BASET_ABILITY)
 			physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
 		break;
+	case ixgbe_phy_m88:
+		physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T;
 	default:
 		break;
 	}
Signature · 1 line
2.7.4
author
#12 lore raw

PATCH v2 12/30 net/ixgbe/base: fix SGMII link setup for M88 PHYs

In reply to Wei Dai

Fix ixgbe_setup_sgmii_m88 to set lane speed to autoneg instead of 1G to prevent problems with link between PHYs

Fixes d4b4c6845487 ("net/ixgbe/base: add X550em_a FW ALEF support")
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_x550.c +1 -1
index d5dffdf..5cf9e40 100644
@@ -1778,7 +1778,7 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 		return rc;
 
 	flx_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
-	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
 	flx_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
 	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
 	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
Signature · 1 line
2.7.4
author
#13 lore raw

PATCH v2 13/30 net/ixgbe/base: cleanup dead EEE code

In reply to Wei Dai

Remove some specific code for enabling/disabling Energy Efficient Ethernet (EEE).

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 61 ++++++-------------------------------
 1 file changed, 10 insertions(+), 51 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +10 -51
index 5cf9e40..97fbf88 100644
@@ -62,7 +62,7 @@ s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw)
 	mac->ops.dmac_config = ixgbe_dmac_config_X550;
 	mac->ops.dmac_config_tcs = ixgbe_dmac_config_tcs_X550;
 	mac->ops.dmac_update_tcs = ixgbe_dmac_update_tcs_X550;
-	mac->ops.setup_eee = ixgbe_setup_eee_X550;
+	mac->ops.setup_eee = NULL;
 	mac->ops.set_source_address_pruning =
 			ixgbe_set_source_address_pruning_X550;
 	mac->ops.set_ethertype_anti_spoofing =
@@ -603,15 +603,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	else
 		mac->ops.setup_fc = ixgbe_setup_fc_X550em;
 
-	switch (hw->device_id) {
-	case IXGBE_DEV_ID_X550EM_X_KR:
-	case IXGBE_DEV_ID_X550EM_A_KR:
-	case IXGBE_DEV_ID_X550EM_A_KR_L:
-		break;
-	default:
-		mac->ops.setup_eee = NULL;
-	}
-
 	/* PHY */
 	phy->ops.init = ixgbe_init_phy_ops_X550em;
 	phy->ops.identify = ixgbe_identify_phy_x550em;
@@ -679,6 +670,15 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 		mac->ops.setup_fc = ixgbe_setup_fc_sgmii_x550em_a;
 	}
 
+	switch (hw->device_id) {
+	case IXGBE_DEV_ID_X550EM_A_KR:
+	case IXGBE_DEV_ID_X550EM_A_KR_L:
+		mac->ops.setup_eee = ixgbe_setup_eee_X550;
+		break;
+	default:
+		mac->ops.setup_eee = NULL;
+	}
+
 	return ret_val;
 }
 
@@ -883,28 +883,10 @@ s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw)
  */
 STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
 {
-	u16 autoneg_eee_reg;
 	u32 link_reg;
 	s32 status;
 
-	if (hw->mac.type == ixgbe_mac_X550) {
-		/* Advertise EEE capability */
-		hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_eee_reg);
-
-		autoneg_eee_reg |= (IXGBE_AUTO_NEG_10GBASE_EEE_ADVT |
-				    IXGBE_AUTO_NEG_1000BASE_EEE_ADVT |
-				    IXGBE_AUTO_NEG_100BASE_EEE_ADVT);
-
-		hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_eee_reg);
-		return IXGBE_SUCCESS;
-	}
-
 	switch (hw->device_id) {
-	case IXGBE_DEV_ID_X550EM_X_KR:
 	case IXGBE_DEV_ID_X550EM_A_KR:
 	case IXGBE_DEV_ID_X550EM_A_KR_L:
 		status = hw->mac.ops.read_iosf_sb_reg(hw,
@@ -938,26 +920,9 @@ STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
  */
 STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
 {
-	u16 autoneg_eee_reg;
 	u32 link_reg;
 	s32 status;
 
-	if (hw->mac.type == ixgbe_mac_X550) {
-		/* Disable advertised EEE capability */
-		hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_eee_reg);
-
-		autoneg_eee_reg &= ~(IXGBE_AUTO_NEG_10GBASE_EEE_ADVT |
-				     IXGBE_AUTO_NEG_1000BASE_EEE_ADVT |
-				     IXGBE_AUTO_NEG_100BASE_EEE_ADVT);
-
-		hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_EEE_ADVT,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_eee_reg);
-		return IXGBE_SUCCESS;
-	}
-
 	switch (hw->device_id) {
 	case IXGBE_DEV_ID_X550EM_X_KR:
 	case IXGBE_DEV_ID_X550EM_A_KR:
@@ -1009,12 +974,6 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
 	if (enable_eee) {
 		eeer |= (IXGBE_EEER_TX_LPI_EN | IXGBE_EEER_RX_LPI_EN);
 
-		/* Not supported on first revision of X550EM_x. */
-		if ((hw->mac.type == ixgbe_mac_X550EM_x) &&
-		    !(IXGBE_FUSES0_REV_MASK &
-		      IXGBE_READ_REG(hw, IXGBE_FUSES0_GROUP(0))))
-			return IXGBE_SUCCESS;
-
 		status = ixgbe_enable_eee_x550(hw);
 		if (status)
 			return status;
Signature · 1 line
2.7.4
author
#14 lore raw

PATCH v2 14/30 net/ixgbe/base: fix setting unsupported autoneg speeds

In reply to Wei Dai

Update ixgbe_setup_phy_link_generic that set/unset auto-negotiation. Ensure that unsupported auto-negotiation speeds are unset.

This is necessary since the PHY NVM may advertise unsupported speeds.

Fixes af75078fece3 ("first public release")
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 130 +++++++++++++++----------------------
 1 file changed, 51 insertions(+), 79 deletions(-)
drivers/net/ixgbe/base/ixgbe_phy.c +51 -79
index 1d9fb3e..54e45b2 100644
@@ -787,91 +787,63 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
 
 	ixgbe_get_copper_link_capabilities_generic(hw, &speed, &autoneg);
 
-	if (speed & IXGBE_LINK_SPEED_10GB_FULL) {
-		/* Set or unset auto-negotiation 10G advertisement */
-		hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_reg);
-
-		autoneg_reg &= ~IXGBE_MII_10GBASE_T_ADVERTISE;
-		if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL)
-			autoneg_reg |= IXGBE_MII_10GBASE_T_ADVERTISE;
-
-		hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_reg);
-	}
-
-	if (hw->mac.type == ixgbe_mac_X550) {
-		if (speed & IXGBE_LINK_SPEED_5GB_FULL) {
-			/* Set or unset auto-negotiation 5G advertisement */
-			hw->phy.ops.read_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				&autoneg_reg);
-
-			autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE;
-			if (hw->phy.autoneg_advertised &
-			     IXGBE_LINK_SPEED_5GB_FULL)
-				autoneg_reg |= IXGBE_MII_5GBASE_T_ADVERTISE;
-
-			hw->phy.ops.write_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				autoneg_reg);
-		}
+	/* Set or unset auto-negotiation 10G advertisement */
+	hw->phy.ops.read_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
+			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			     &autoneg_reg);
 
-		if (speed & IXGBE_LINK_SPEED_2_5GB_FULL) {
-			/* Set or unset auto-negotiation 2.5G advertisement */
-			hw->phy.ops.read_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				&autoneg_reg);
-
-			autoneg_reg &= ~IXGBE_MII_2_5GBASE_T_ADVERTISE;
-			if (hw->phy.autoneg_advertised &
-			    IXGBE_LINK_SPEED_2_5GB_FULL)
-				autoneg_reg |= IXGBE_MII_2_5GBASE_T_ADVERTISE;
-
-			hw->phy.ops.write_reg(hw,
-				IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				autoneg_reg);
-		}
-	}
+	autoneg_reg &= ~IXGBE_MII_10GBASE_T_ADVERTISE;
+	if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10GB_FULL) &&
+	    (speed & IXGBE_LINK_SPEED_10GB_FULL))
+		autoneg_reg |= IXGBE_MII_10GBASE_T_ADVERTISE;
 
-	if (speed & IXGBE_LINK_SPEED_1GB_FULL) {
-		/* Set or unset auto-negotiation 1G advertisement */
-		hw->phy.ops.read_reg(hw,
-				     IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_reg);
+	hw->phy.ops.write_reg(hw, IXGBE_MII_10GBASE_T_AUTONEG_CTRL_REG,
+			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			      autoneg_reg);
 
-		autoneg_reg &= ~IXGBE_MII_1GBASE_T_ADVERTISE;
-		if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL)
-			autoneg_reg |= IXGBE_MII_1GBASE_T_ADVERTISE;
+	hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
+			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			     &autoneg_reg);
 
-		hw->phy.ops.write_reg(hw,
-				      IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_reg);
+	if (hw->mac.type == ixgbe_mac_X550) {
+		/* Set or unset auto-negotiation 5G advertisement */
+		autoneg_reg &= ~IXGBE_MII_5GBASE_T_ADVERTISE;
+		if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_5GB_FULL) &&
+		    (speed & IXGBE_LINK_SPEED_5GB_FULL))
+			autoneg_reg |= IXGBE_MII_5GBASE_T_ADVERTISE;
+
+		/* Set or unset auto-negotiation 2.5G advertisement */
+		autoneg_reg &= ~IXGBE_MII_2_5GBASE_T_ADVERTISE;
+		if ((hw->phy.autoneg_advertised &
+		     IXGBE_LINK_SPEED_2_5GB_FULL) &&
+		    (speed & IXGBE_LINK_SPEED_2_5GB_FULL))
+			autoneg_reg |= IXGBE_MII_2_5GBASE_T_ADVERTISE;
 	}
 
-	if (speed & IXGBE_LINK_SPEED_100_FULL) {
-		/* Set or unset auto-negotiation 100M advertisement */
-		hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
-				     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				     &autoneg_reg);
-
-		autoneg_reg &= ~(IXGBE_MII_100BASE_T_ADVERTISE |
-				 IXGBE_MII_100BASE_T_ADVERTISE_HALF);
-		if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL)
-			autoneg_reg |= IXGBE_MII_100BASE_T_ADVERTISE;
-
-		hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
-				      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
-				      autoneg_reg);
-	}
+	/* Set or unset auto-negotiation 1G advertisement */
+	autoneg_reg &= ~IXGBE_MII_1GBASE_T_ADVERTISE;
+	if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL) &&
+	    (speed & IXGBE_LINK_SPEED_1GB_FULL))
+		autoneg_reg |= IXGBE_MII_1GBASE_T_ADVERTISE;
+
+	hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_VENDOR_PROVISION_1_REG,
+			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			      autoneg_reg);
+
+	/* Set or unset auto-negotiation 100M advertisement */
+	hw->phy.ops.read_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
+			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			     &autoneg_reg);
+
+	autoneg_reg &= ~(IXGBE_MII_100BASE_T_ADVERTISE |
+			 IXGBE_MII_100BASE_T_ADVERTISE_HALF);
+	if ((hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL) &&
+	    (speed & IXGBE_LINK_SPEED_100_FULL))
+		autoneg_reg |= IXGBE_MII_100BASE_T_ADVERTISE;
+
+	hw->phy.ops.write_reg(hw, IXGBE_MII_AUTONEG_ADVERTISE_REG,
+			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE,
+			      autoneg_reg);
 
 	/* Blocked by MNG FW so don't reset PHY */
 	if (ixgbe_check_reset_blocked(hw))
Signature · 1 line
2.7.4
author
#15 lore raw

PATCH v2 15/30 net/ixgbe/base: support FW commands to control some PHYs

In reply to Wei Dai

Implement support for new firmware commands to be used to access and control some PHYs.

---
 drivers/net/ixgbe/base/ixgbe_common.h |   4 +-
 drivers/net/ixgbe/base/ixgbe_osdep.h  |   3 +-
 drivers/net/ixgbe/base/ixgbe_type.h   |  70 ++++++++++-
 drivers/net/ixgbe/base/ixgbe_x550.c   | 230 +++++++++++++++++++++++++++++++++-
 4 files changed, 300 insertions(+), 7 deletions(-)
drivers/net/ixgbe/base/ixgbe_common.h +3 -1
index 93e80ea..903f34d 100644
@@ -161,7 +161,9 @@ u8 ixgbe_calculate_checksum(u8 *buffer, u32 length);
 s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 				 u32 length, u32 timeout, bool return_data);
 s32 ixgbe_hic_unlocked(struct ixgbe_hw *, u32 *buffer, u32 length, u32 timeout);
-
+s32 ixgbe_shutdown_fw_phy(struct ixgbe_hw *);
+s32 ixgbe_fw_phy_activity(struct ixgbe_hw *, u16 activity,
+			  u32 (*data)[FW_PHY_ACT_DATA_COUNT]);
 void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
 
 extern s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
drivers/net/ixgbe/base/ixgbe_osdep.h +2 -1
index 77f0af5..b0977b6 100644
@@ -95,8 +95,9 @@ enum {
 #define STATIC static
 #define IXGBE_NTOHL(_i)	rte_be_to_cpu_32(_i)
 #define IXGBE_NTOHS(_i)	rte_be_to_cpu_16(_i)
+#define IXGBE_CPU_TO_LE16(_i)  rte_cpu_to_le_16(_i)
 #define IXGBE_CPU_TO_LE32(_i)  rte_cpu_to_le_32(_i)
-#define IXGBE_LE32_TO_CPU(_i) rte_le_to_cpu_32(_i)
+#define IXGBE_LE32_TO_CPU(_i)  rte_le_to_cpu_32(_i)
 #define IXGBE_LE32_TO_CPUS(_i) rte_le_to_cpu_32(_i)
 #define IXGBE_CPU_TO_BE16(_i)  rte_cpu_to_be_16(_i)
 #define IXGBE_CPU_TO_BE32(_i)  rte_cpu_to_be_32(_i)
drivers/net/ixgbe/base/ixgbe_type.h +68 -2

88 lines not on this page · raw message

drivers/net/ixgbe/base/ixgbe_x550.c +227 -3

259 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#16 lore raw

PATCH v2 16/30 net/ixgbe/base: use FW commands to control some PHYs

In reply to Wei Dai

Use the new firmware interface to access and control some PHYs.

---
 drivers/net/ixgbe/base/ixgbe_phy.c  |   4 -
 drivers/net/ixgbe/base/ixgbe_phy.h  |  67 ------
 drivers/net/ixgbe/base/ixgbe_type.h |   2 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 412 ++++++------------------------------
 4 files changed, 68 insertions(+), 417 deletions(-)
drivers/net/ixgbe/base/ixgbe_phy.c +0 -4
index 54e45b2..8901fc1 100644
@@ -475,10 +475,6 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id)
 	case X557_PHY_ID2:
 		phy_type = ixgbe_phy_x550em_ext_t;
 		break;
-	case IXGBE_M88E1500_E_PHY_ID:
-	case IXGBE_M88E1543_E_PHY_ID:
-		phy_type = ixgbe_phy_m88;
-		break;
 	default:
 		phy_type = ixgbe_phy_unknown;
 		break;
drivers/net/ixgbe/base/ixgbe_phy.h +0 -67

73 lines not on this page · raw message

drivers/net/ixgbe/base/ixgbe_type.h +1 -1
index c7100b0..6ab466b 100644
@@ -3663,7 +3663,7 @@ enum ixgbe_phy_type {
 	ixgbe_phy_qsfp_unknown,
 	ixgbe_phy_sfp_unsupported, /*Enforce bit set with unsupported module*/
 	ixgbe_phy_sgmii,
-	ixgbe_phy_m88,
+	ixgbe_phy_fw,
 	ixgbe_phy_generic
 };
 
drivers/net/ixgbe/base/ixgbe_x550.c +67 -345

538 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#17 lore raw

PATCH v2 17/30 net/ixgbe/base: support busy SGMII register reads

In reply to Wei Dai

Read and store NW_MNG_IF_SEL register because register fields are used to determine SGMII link for busy SGMII register reads.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_x550.c +5 -1
index c7ccd81..0011f21 100644
@@ -2444,6 +2444,9 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 
 	DEBUGFUNC("ixgbe_init_phy_ops_X550em");
 
+	hw->mac.ops.set_lan_id(hw);
+	ixgbe_read_mng_if_sel_x550em(hw);
+
 	if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) {
 		phy->phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
 		ixgbe_setup_mux_ctl(hw);
@@ -2483,7 +2486,8 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 
 	/* Identify the PHY or SFP module */
 	ret_val = phy->ops.identify(hw);
-	if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED)
+	if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED ||
+	    ret_val == IXGBE_ERR_PHY_ADDR_INVALID)
 		return ret_val;
 
 	/* Setup function pointers based on detected hardware */
Signature · 1 line
2.7.4
author
#18 lore raw

PATCH v2 18/30 net/ixgbe/base: include new speeds in VFLINK interpretation

In reply to Wei Dai

This patch moves some of the extended speeds that come with X552 (5G, 2.5G, 10M) into the link check functions.
It also now returns speed_unknown for speeds that are not known how to interpret.

---
 drivers/net/ixgbe/Makefile           |   1 +
 drivers/net/ixgbe/base/ixgbe_hv_vf.c | 240 +++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_hv_vf.h |  41 ++++++
 drivers/net/ixgbe/base/ixgbe_osdep.h |   1 +
 drivers/net/ixgbe/base/ixgbe_vf.c    |  16 +++
 drivers/net/ixgbe/base/ixgbe_vf.h    |   3 +
 6 files changed, 302 insertions(+)
 create mode 100644 drivers/net/ixgbe/base/ixgbe_hv_vf.c
 create mode 100644 drivers/net/ixgbe/base/ixgbe_hv_vf.h
drivers/net/ixgbe/Makefile +1 -0
index 94ddc7b..a3e6a52 100644
@@ -100,6 +100,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_x550.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_phy.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_api.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_vf.c
+SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_hv_vf.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_dcb.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_dcb_82599.c
 SRCS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe_dcb_82598.c
drivers/net/ixgbe/base/ixgbe_hv_vf.c new file +240 -0

240 lines not on this page · raw message

drivers/net/ixgbe/base/ixgbe_hv_vf.h new file +41 -0

41 lines not on this page · raw message

drivers/net/ixgbe/base/ixgbe_osdep.h +1 -0
index b0977b6..fe532aa 100644
@@ -81,6 +81,7 @@
 #define UNREFERENCED_2PARAMETER(_p, _q)
 #define UNREFERENCED_3PARAMETER(_p, _q, _r) 
 #define UNREFERENCED_4PARAMETER(_p, _q, _r, _s) 
+#define UNREFERENCED_5PARAMETER(_p, _q, _r, _s, _t)
 
 /* Shared code error reporting */
 enum {
drivers/net/ixgbe/base/ixgbe_vf.c +16 -0
index e9c13f2..66486ea 100644
@@ -613,13 +613,29 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 	switch (links_reg & IXGBE_LINKS_SPEED_82599) {
 	case IXGBE_LINKS_SPEED_10G_82599:
 		*speed = IXGBE_LINK_SPEED_10GB_FULL;
+		if (hw->mac.type >= ixgbe_mac_X550) {
+			if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
+				*speed = IXGBE_LINK_SPEED_2_5GB_FULL;
+		}
 		break;
 	case IXGBE_LINKS_SPEED_1G_82599:
 		*speed = IXGBE_LINK_SPEED_1GB_FULL;
 		break;
 	case IXGBE_LINKS_SPEED_100_82599:
 		*speed = IXGBE_LINK_SPEED_100_FULL;
+		if (hw->mac.type >= ixgbe_mac_X550) {
+			if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
+				*speed = IXGBE_LINK_SPEED_5GB_FULL;
+		}
 		break;
+	case IXGBE_LINKS_SPEED_10_X550EM_A:
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
+		/* Since Reserved in older MAC's */
+		if (hw->mac.type >= ixgbe_mac_X550)
+			*speed = IXGBE_LINK_SPEED_10_FULL;
+		break;
+	default:
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
 	}
 
 	/* if the read failed it could just be a mailbox collision, best wait
drivers/net/ixgbe/base/ixgbe_vf.h +3 -0
index d288f31..3efffe8 100644
@@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
 #ifndef _IXGBE_VF_H_
 #define _IXGBE_VF_H_
 
+#include "ixgbe_type.h"
+
 #define IXGBE_VF_IRQ_CLEAR_MASK	7
 #define IXGBE_VF_MAX_TX_QUEUES	8
 #define IXGBE_VF_MAX_RX_QUEUES	8
@@ -114,6 +116,7 @@ struct ixgbevf_hw_stats {
 	u64 saved_reset_vfmprc;
 };
 
+s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
 s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw);
 s32 ixgbe_start_hw_vf(struct ixgbe_hw *hw);
 s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw);
Signature · 1 line
2.7.4
author
#19 lore raw

PATCH v2 19/30 net/ixgbe/base: limit 5Gb support to X550 devices

In reply to Wei Dai

Only X550 devices support 5Gb. MAC type checks for 5Gb should be done only for X550 devices.

---
 drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
 drivers/net/ixgbe/base/ixgbe_hv_vf.c  | 2 +-
 drivers/net/ixgbe/base/ixgbe_vf.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_common.c +1 -1
index 89b4b5f..18bb18c 100644
@@ -4230,7 +4230,7 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 		break;
 	case IXGBE_LINKS_SPEED_100_82599:
 		*speed = IXGBE_LINK_SPEED_100_FULL;
-		if (hw->mac.type >= ixgbe_mac_X550) {
+		if (hw->mac.type == ixgbe_mac_X550) {
 			if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
 				*speed = IXGBE_LINK_SPEED_5GB_FULL;
 		}
drivers/net/ixgbe/base/ixgbe_hv_vf.c +1 -1
index c29f99a..47143a2 100644
@@ -147,7 +147,7 @@ static s32 ixgbevf_hv_check_mac_link_vf(struct ixgbe_hw *hw,
 		break;
 	case IXGBE_LINKS_SPEED_100_82599:
 		*speed = IXGBE_LINK_SPEED_100_FULL;
-		if (hw->mac.type >= ixgbe_mac_X550) {
+		if (hw->mac.type == ixgbe_mac_X550) {
 			if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
 				*speed = IXGBE_LINK_SPEED_5GB_FULL;
 		}
drivers/net/ixgbe/base/ixgbe_vf.c +1 -1
index 66486ea..8775ee5 100644
@@ -623,7 +623,7 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 		break;
 	case IXGBE_LINKS_SPEED_100_82599:
 		*speed = IXGBE_LINK_SPEED_100_FULL;
-		if (hw->mac.type >= ixgbe_mac_X550) {
+		if (hw->mac.type == ixgbe_mac_X550) {
 			if (links_reg & IXGBE_LINKS_SPEED_NON_STD)
 				*speed = IXGBE_LINK_SPEED_5GB_FULL;
 		}
Signature · 1 line
2.7.4
author
#20 lore raw

PATCH v2 20/30 net/ixgbe/base: add physical layer options for FW PHY type

In reply to Wei Dai

The "FW" PHY type now supports speeds 10M, 100M, and 1G. Previously, only the 1G speed was reported for this PHY type. Add reporting 10M and 100M speed options.

---
 drivers/net/ixgbe/base/ixgbe_type.h | 1 +
 drivers/net/ixgbe/base/ixgbe_x550.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_type.h +1 -0
index 6ab466b..9851d84 100644
@@ -3426,6 +3426,7 @@ typedef u32 ixgbe_physical_layer;
 #define IXGBE_PHYSICAL_LAYER_10GBASE_XAUI	0x1000
 #define IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA	0x2000
 #define IXGBE_PHYSICAL_LAYER_1000BASE_SX	0x4000
+#define IXGBE_PHYSICAL_LAYER_10BASE_T		0x8000
 
 /* Flow Control Data Sheet defined values
  * Calculation and defines taken from 802.1bb Annex O
drivers/net/ixgbe/base/ixgbe_x550.c +7 -1
index 0011f21..f1f1fbe 100644
@@ -3784,7 +3784,13 @@ u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
 			physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
 		break;
 	case ixgbe_phy_fw:
-		physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_T;
+		if (hw->phy.speeds_supported & IXGBE_LINK_SPEED_1GB_FULL)
+			physical_layer |= IXGBE_PHYSICAL_LAYER_1000BASE_T;
+		if (hw->phy.speeds_supported & IXGBE_LINK_SPEED_100_FULL)
+			physical_layer |= IXGBE_PHYSICAL_LAYER_100BASE_TX;
+		if (hw->phy.speeds_supported & IXGBE_LINK_SPEED_10_FULL)
+			physical_layer |= IXGBE_PHYSICAL_LAYER_10BASE_T;
+		break;
 	default:
 		break;
 	}
Signature · 1 line
2.7.4
author
#21 lore raw

PATCH v2 21/30 net/ixgbe/base: remove unneeded MAC type check

In reply to Wei Dai

ixgbe_read_i2c_combined_generic_int() is only used by devices >= X550. Set the initial value accordingly and remove the MAC type check.

---
 drivers/net/ixgbe/base/ixgbe_phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ixgbe/base/ixgbe_phy.c +1 -3
index 8901fc1..209e9d0 100644
@@ -113,7 +113,7 @@ s32 ixgbe_read_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr, u16 reg,
 					u16 *val, bool lock)
 {
 	u32 swfw_mask = hw->phy.phy_semaphore_mask;
-	int max_retry = 10;
+	int max_retry = 3;
 	int retry = 0;
 	u8 csum_byte;
 	u8 high_bits;
@@ -121,8 +121,6 @@ s32 ixgbe_read_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr, u16 reg,
 	u8 reg_high;
 	u8 csum;
 
-	if (hw->mac.type >= ixgbe_mac_X550)
-		max_retry = 3;
 	reg_high = ((reg >> 7) & 0xFE) | 1;	/* Indicate read combined */
 	csum = ixgbe_ones_comp_byte_add(reg_high, reg & 0xFF);
 	csum = ~csum;
Signature · 1 line
2.7.4
author
#22 lore raw

PATCH v2 22/30 net/ixgbe/base: remove unused PHY ID

In reply to Wei Dai

The first PHY ID for X550 was only used on original HW and never released. So remove these unused PHY ID.

---
 drivers/net/ixgbe/base/ixgbe_phy.c  | 1 -
 drivers/net/ixgbe/base/ixgbe_type.h | 1 -
 2 files changed, 2 deletions(-)
drivers/net/ixgbe/base/ixgbe_phy.c +0 -1
index 209e9d0..5ad4dfe 100644
@@ -457,7 +457,6 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id)
 	case TN1010_PHY_ID:
 		phy_type = ixgbe_phy_tn;
 		break;
-	case X550_PHY_ID1:
 	case X550_PHY_ID2:
 	case X550_PHY_ID3:
 	case X540_PHY_ID:
drivers/net/ixgbe/base/ixgbe_type.h +0 -1
index 9851d84..9ec17a9 100644
@@ -1647,7 +1647,6 @@ struct ixgbe_dmac_config {
 #define TN1010_PHY_ID	0x00A19410
 #define TNX_FW_REV	0xB
 #define X540_PHY_ID	0x01540200
-#define X550_PHY_ID1	0x01540220
 #define X550_PHY_ID2	0x01540223
 #define X550_PHY_ID3	0x01540221
 #define X557_PHY_ID	0x01540240
Signature · 1 line
2.7.4
author
#23 lore raw

PATCH v2 23/30 net/ixgbe/base: update FW PHY flow control

In reply to Wei Dai

This patch removes the flow control conversion from Rx and Tx to pause and asymmetric pause, as that is handled by the ixgbe_negotiate_fc().

Performing the conversion prior to ixgbe_negotiate_fc() results in an incorrect fc mode if Rx only pause is selected when the link partner is advertising Tx.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +1 -15
index f1f1fbe..49b59e7 100644
@@ -4199,7 +4199,6 @@ void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw)
 	u32 info[FW_PHY_ACT_DATA_COUNT] = { 0 };
 	ixgbe_link_speed speed;
 	bool link_up;
-	u32 fc;
 
 	/* AN should have completed when the cable was plugged in.
 	 * Look for reasons to bail out.  Bail out if:
@@ -4227,21 +4226,8 @@ void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw)
 		goto out;
 	}
 
-	/* Get the advertized flow control and modify it to indicate
-	 * pause and asymmetric pause instead of rx and tx
-	 */
-	fc = info[0];
-	if (fc & FW_PHY_ACT_GET_LINK_INFO_FC_RX)
-		fc ^= FW_PHY_ACT_GET_LINK_INFO_FC_TX;
-
-	/* Modify link partner's flow control to indicate pause and
-	 * asymmetric pause instead of rx and tx
-	 */
-	if (fc & FW_PHY_ACT_GET_LINK_INFO_LP_FC_RX)
-		fc ^= FW_PHY_ACT_GET_LINK_INFO_LP_FC_TX;
-
 	/* Negotiate the flow control */
-	status = ixgbe_negotiate_fc(hw, fc, fc,
+	status = ixgbe_negotiate_fc(hw, info[0], info[0],
 				    FW_PHY_ACT_GET_LINK_INFO_FC_RX,
 				    FW_PHY_ACT_GET_LINK_INFO_FC_TX,
 				    FW_PHY_ACT_GET_LINK_INFO_LP_FC_RX,
Signature · 1 line
2.7.4
author
#24 lore raw

PATCH v2 24/30 net/ixgbe/base: add EEE support for some PHYs

In reply to Wei Dai

This patch adds Energy Efficient Ethernet (EEE) support for some Marvell PHYs on some future platforms.
Because EEE capability or status was not indicated previously, this patch simply assumes that it is supported.

As soon as there is a PHY that does not support EEE, there will be defects in this area because the driver will not report the EEE status correctly.

This also deletes some now-unused definitions from an earlier Marvell PHY implementation and combines a device ID check into a switch statement.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +7 -8
index 49b59e7..2aaed6b 100644
@@ -896,19 +896,18 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 		break;
 	}
 
-	if ((hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T) ||
-		(hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L)) {
+	switch (hw->device_id) {
+	case IXGBE_DEV_ID_X550EM_A_1G_T:
+	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 		mac->ops.fc_autoneg = ixgbe_fc_autoneg_sgmii_x550em_a;
 		mac->ops.setup_fc = ixgbe_fc_autoneg_fw;
-	}
-
-	switch (hw->device_id) {
-	case IXGBE_DEV_ID_X550EM_A_KR:
-	case IXGBE_DEV_ID_X550EM_A_KR_L:
 		mac->ops.setup_eee = ixgbe_setup_eee_fw;
+		hw->phy.eee_speeds_supported = IXGBE_LINK_SPEED_100_FULL |
+					       IXGBE_LINK_SPEED_1GB_FULL;
+		hw->phy.eee_speeds_advertised = hw->phy.eee_speeds_supported;
 		break;
 	default:
-		mac->ops.setup_eee = NULL;
+		break;
 	}
 
 	return ret_val;
Signature · 1 line
2.7.4
author
#25 lore raw

PATCH v2 25/30 net/ixgbe/base: remove unused enum type

In reply to Wei Dai

remove unused enum type for master/slave control
in ixbge_type.h

---
 drivers/net/ixgbe/base/ixgbe_type.h | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/ixgbe/base/ixgbe_type.h +0 -8
index 9ec17a9..f1761a3 100644
@@ -3720,14 +3720,6 @@ enum ixgbe_fc_mode {
 	ixgbe_fc_default
 };
 
-/* Master/slave control */
-enum ixgbe_ms_type {
-	ixgbe_ms_hw_default = 0,
-	ixgbe_ms_force_master,
-	ixgbe_ms_force_slave,
-	ixgbe_ms_auto
-};
-
 /* Smart Speed Settings */
 #define IXGBE_SMARTSPEED_MAX_RETRIES	3
 enum ixgbe_smart_speed {
Signature · 1 line
2.7.4
author
#26 lore raw

PATCH v2 26/30 net/ixgbe/base: fix IXGBE LSWFW register

In reply to Wei Dai

This register was incorrect when compared to the data sheet. Even though the driver doesn't currently use this register, it is better to fix it upstream.

Fixes af75078fece3 ("first public release")
---
 drivers/net/ixgbe/base/ixgbe_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/base/ixgbe_type.h +1 -1
index f1761a3..b609f6e 100644
@@ -1045,7 +1045,7 @@ struct ixgbe_dmac_config {
 #define IXGBE_FTFT		0x09400 /* 0x9400-0x97FC */
 #define IXGBE_METF(_i)		(0x05190 + ((_i) * 4)) /* 4 of these (0-3) */
 #define IXGBE_MDEF_EXT(_i)	(0x05160 + ((_i) * 4)) /* 8 of these (0-7) */
-#define IXGBE_LSWFW		0x15014
+#define IXGBE_LSWFW		0x15F14
 #define IXGBE_BMCIP(_i)		(0x05050 + ((_i) * 4)) /* 0x5050-0x505C */
 #define IXGBE_BMCIPVAL		0x05060
 #define IXGBE_BMCIP_IPADDR_TYPE	0x00000001
Signature · 1 line
2.7.4
author
#27 lore raw

PATCH v2 27/30 net/ixgbe/base: remove unused EEE code

In reply to Wei Dai

Remove unused old Energy Efficient Ethernet (EEE) code.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 113 +-----------------------------------
 drivers/net/ixgbe/base/ixgbe_x550.h |   2 -
 2 files changed, 1 insertion(+), 114 deletions(-)
drivers/net/ixgbe/base/ixgbe_x550.c +1 -112
index 2aaed6b..4a98530 100644
@@ -942,6 +942,7 @@ s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw)
 				      ixgbe_write_i2c_combined_generic_unlocked;
 	link->addr = IXGBE_CS4227;
 
+
 	return ret_val;
 }
 
@@ -1109,118 +1110,6 @@ s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw)
 }
 
 /**
- * ixgbe_enable_eee_x550 - Enable EEE support
- * @hw: pointer to hardware structure
- */
-STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
-{
-	u32 link_reg;
-	s32 status;
-
-	switch (hw->device_id) {
-	case IXGBE_DEV_ID_X550EM_A_KR:
-	case IXGBE_DEV_ID_X550EM_A_KR_L:
-		status = hw->mac.ops.read_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
-		if (status != IXGBE_SUCCESS)
-			return status;
-
-		link_reg |= IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KR |
-			    IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX;
-
-		/* Don't advertise FEC capability when EEE enabled. */
-		link_reg &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC;
-
-		status = hw->mac.ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
-		if (status != IXGBE_SUCCESS)
-			return status;
-		break;
-	default:
-		break;
-	}
-
-	return IXGBE_SUCCESS;
-}
-
-/**
- * ixgbe_disable_eee_x550 - Disable EEE support
- * @hw: pointer to hardware structure
- */
-STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
-{
-	u32 link_reg;
-	s32 status;
-
-	switch (hw->device_id) {
-	case IXGBE_DEV_ID_X550EM_X_KR:
-	case IXGBE_DEV_ID_X550EM_A_KR:
-	case IXGBE_DEV_ID_X550EM_A_KR_L:
-		status = hw->mac.ops.read_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
-		if (status != IXGBE_SUCCESS)
-			return status;
-
-		link_reg &= ~(IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KR |
-			      IXGBE_KRM_LINK_CTRL_1_TETH_EEE_CAP_KX);
-
-		/* Advertise FEC capability when EEE is disabled. */
-		link_reg |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_FEC;
-
-		status = hw->mac.ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
-		if (status != IXGBE_SUCCESS)
-			return status;
-		break;
-	default:
-		break;
-	}
-
-	return IXGBE_SUCCESS;
-}
-
-/**
- *  ixgbe_setup_eee_X550 - Enable/disable EEE support
- *  @hw: pointer to the HW structure
- *  @enable_eee: boolean flag to enable EEE
- *
- *  Enable/disable EEE based on enable_eee flag.
- *  Auto-negotiation must be started after BASE-T EEE bits in PHY register 7.3C
- *  are modified.
- *
- **/
-s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
-{
-	s32 status;
-	u32 eeer;
-
-	DEBUGFUNC("ixgbe_setup_eee_X550");
-
-	eeer = IXGBE_READ_REG(hw, IXGBE_EEER);
-	/* Enable or disable EEE per flag */
-	if (enable_eee) {
-		eeer |= (IXGBE_EEER_TX_LPI_EN | IXGBE_EEER_RX_LPI_EN);
-
-		status = ixgbe_enable_eee_x550(hw);
-		if (status)
-			return status;
-	} else {
-		eeer &= ~(IXGBE_EEER_TX_LPI_EN | IXGBE_EEER_RX_LPI_EN);
-
-		status = ixgbe_disable_eee_x550(hw);
-		if (status)
-			return status;
-	}
-	IXGBE_WRITE_REG(hw, IXGBE_EEER, eeer);
-
-	return IXGBE_SUCCESS;
-}
-
-/**
  * ixgbe_set_source_address_pruning_X550 - Enable/Disbale source address pruning
  * @hw: pointer to hardware structure
  * @enable: enable or disable source address pruning
drivers/net/ixgbe/base/ixgbe_x550.h +0 -2
index 2d1876b..30ca5df 100644
@@ -57,8 +57,6 @@ s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
 u16				*data);
 s32 ixgbe_write_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
 				    u16 data);
-s32 ixgbe_set_eee_X550(struct ixgbe_hw *hw, bool enable_eee);
-s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee);
 void ixgbe_set_source_address_pruning_X550(struct ixgbe_hw *hw, bool enable,
 					   unsigned int pool);
 void ixgbe_set_ethertype_anti_spoofing_X550(struct ixgbe_hw *hw,
Signature · 1 line
2.7.4
author
#28 lore raw

PATCH v2 28/30 net/ixgbe/base: add write flush required by Inphi PHY

In reply to Wei Dai

This patch updates the configuration of PHY from Inphi (www.inphi.com) to flush the register write with a reg read.
The Inphi PHY is configured in ixgbe_setup_mac_link_sfp_x550a. The Inphy PHY setup flow has been updated to read configuration reg, write only linear/non-linear, and then read (write flush).

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +14 -0
index 4a98530..a57ba74 100644
@@ -2834,12 +2834,26 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 
 		/* Configure CS4227/CS4223 LINE side to proper mode. */
 		reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB + slice_offset;
+
+		ret_val = hw->phy.ops.read_reg(hw, reg_slice,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
+
+		if (ret_val != IXGBE_SUCCESS)
+			return ret_val;
+
+		reg_phy_ext &= ~((IXGBE_CS4227_EDC_MODE_CX1 << 1) |
+				 (IXGBE_CS4227_EDC_MODE_SR << 1));
+
 		if (setup_linear)
 			reg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
 		else
 			reg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
 		ret_val = hw->phy.ops.write_reg(hw, reg_slice,
 					 IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);
+
+		/* Flush previous write with a read */
+		ret_val = hw->phy.ops.read_reg(hw, reg_slice,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
 	}
 	return ret_val;
 }
Signature · 1 line
2.7.4
author
#29 lore raw

PATCH v2 29/30 net/ixgbe/base: report physical layer for SGMII PHY type

In reply to Wei Dai

For the PHY type SGMII, report the pyhsical layer.

---
 drivers/net/ixgbe/base/ixgbe_x550.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ixgbe/base/ixgbe_x550.c +3 -0
index a57ba74..782ca91 100644
@@ -3693,6 +3693,9 @@ u32 ixgbe_get_supported_physical_layer_X550em(struct ixgbe_hw *hw)
 		if (hw->phy.speeds_supported & IXGBE_LINK_SPEED_10_FULL)
 			physical_layer |= IXGBE_PHYSICAL_LAYER_10BASE_T;
 		break;
+	case ixgbe_phy_sgmii:
+		physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_KX;
+		break;
 	default:
 		break;
 	}
Signature · 1 line
2.7.4
author
#30 lore raw

PATCH v2 30/30 net/ixgbe/base: update shared code version to 2016.11.21

In reply to Wei Dai

update the version of shared codes to cid-ixgbe.2016.11.21.tar.gz,

all files in net/ixgbe/base are developped by another team and DPDK PMD uses them accordingly.

---
 drivers/net/ixgbe/base/README | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ixgbe/base/README +2 -1
index 6b54c31..1936191 100644
@@ -34,7 +34,8 @@ Intel® IXGBE driver
 ===================
 
 This directory contains source code of FreeBSD ixgbe driver of version
-cid-10g-shared-code.2016.08.15 released by ND. The sub-directory of base/
+cid-10g-shared-code.2016.11.21 released by the team which develop
+basic drivers for any ixgbe NIC. The sub-directory of base/
 contains the original source package.
 This driver is valid for the product(s) listed below
 
Signature · 1 line
2.7.4
#31 lore raw
In reply to Wei Dai
Quoted 35 lines · Wei Dai

update ixgbe shared code to version 16.11.21 .
v2 changes:
modify subject line and message body of git log according to feedbacks from communtiy.

split the 24th patch into 2 separate ones.
the 24th of v1 is net/ixgbe/base: add EEE support for DNL-controlled PHYs the 24th of v2 is net/ixgbe/base: add EEE support for some PHYs the 25th of v2 is net/ixgbe/base: remove unused enum type

correct RAEDME

Wei Dai (30):
net/ixgbe/base: fix PHY reset check for x550em-ext net/ixgbe/base: fix clearing SAN MAC address net/ixgbe/base: use fast MDIO for non-10G devices net/ixgbe/base: fix PHY identification for x550a net/ixgbe/base: clean up X557 link status check net/ixgbe/base: add driver version to firmware net/ixgbe/base: store link active LED net/ixgbe/base: cleanup X540 checksum calculation net/ixgbe/base: enable LASI only for X552 devices net/ixgbe/base: limit iXFI setup to X552 devices net/ixgbe/base: fix getting PHY type for some x550 devices net/ixgbe/base: fix SGMII link setup for M88 PHYs net/ixgbe/base: cleanup dead EEE code net/ixgbe/base: fix setting unsupported autoneg speeds net/ixgbe/base: support FW commands to control some PHYs net/ixgbe/base: use FW commands to control some PHYs net/ixgbe/base: support busy SGMII register reads net/ixgbe/base: include new speeds in VFLINK interpretation net/ixgbe/base: limit 5Gb support to X550 devices net/ixgbe/base: add physical layer options for FW PHY type net/ixgbe/base: remove unneeded MAC type check net/ixgbe/base: remove unused PHY ID

Quoted 8 lines

net/ixgbe/base: update FW PHY flow control net/ixgbe/base: add EEE support for some PHYs net/ixgbe/base: remove unused enum type net/ixgbe/base: fix IXGBE LSWFW register net/ixgbe/base: remove unused EEE code net/ixgbe/base: add write flush required by Inphi PHY net/ixgbe/base: report physical layer for SGMII PHY type net/ixgbe/base: update shared code version to 2016.11.21

<...>

Series applied to dpdk-next-net/master, thanks.

author
#32 lore raw

Many thanks to you for your taking time to review this patch set.

Thanks
-Wei

Quoted 57 lines

-----Original Message-----
From: Yigit, Ferruh
Sent: Thursday, December 22, 2016 1:20 AM
To: Dai, Wei <[email protected]>; [email protected]
Cc: Zhang, Helin <[email protected]>; Ananyev, Konstantin <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 00/30] update ixgbe shared code to version 16.11.21

Quoted 35 lines · Wei Dai

update ixgbe shared code to version 16.11.21 .
v2 changes:
modify subject line and message body of git log according to feedbacks from communtiy.

split the 24th patch into 2 separate ones.
the 24th of v1 is net/ixgbe/base: add EEE support for DNL-controlled PHYs the 24th of v2 is net/ixgbe/base: add EEE support for some PHYs the 25th of v2 is net/ixgbe/base: remove unused enum type

correct RAEDME

Wei Dai (30):
net/ixgbe/base: fix PHY reset check for x550em-ext net/ixgbe/base: fix clearing SAN MAC address net/ixgbe/base: use fast MDIO for non-10G devices net/ixgbe/base: fix PHY identification for x550a net/ixgbe/base: clean up X557 link status check net/ixgbe/base: add driver version to firmware net/ixgbe/base: store link active LED net/ixgbe/base: cleanup X540 checksum calculation net/ixgbe/base: enable LASI only for X552 devices net/ixgbe/base: limit iXFI setup to X552 devices net/ixgbe/base: fix getting PHY type for some x550 devices net/ixgbe/base: fix SGMII link setup for M88 PHYs net/ixgbe/base: cleanup dead EEE code net/ixgbe/base: fix setting unsupported autoneg speeds net/ixgbe/base: support FW commands to control some PHYs net/ixgbe/base: use FW commands to control some PHYs net/ixgbe/base: support busy SGMII register reads net/ixgbe/base: include new speeds in VFLINK interpretation net/ixgbe/base: limit 5Gb support to X550 devices net/ixgbe/base: add physical layer options for FW PHY type net/ixgbe/base: remove unneeded MAC type check net/ixgbe/base: remove unused PHY ID

Quoted 8 lines

net/ixgbe/base: update FW PHY flow control net/ixgbe/base: add EEE support for some PHYs net/ixgbe/base: remove unused enum type net/ixgbe/base: fix IXGBE LSWFW register net/ixgbe/base: remove unused EEE code net/ixgbe/base: add write flush required by Inphi PHY net/ixgbe/base: report physical layer for SGMII PHY type net/ixgbe/base: update shared code version to 2016.11.21

<...>

Series applied to dpdk-next-net/master, thanks.