DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update
@ 2016-08-27 15:47 Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
                   ` (38 more replies)
  0 siblings, 39 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

     Update ixgbe base driver, including the following changes:

     * add X550em_a 10G PHY support
     * add VF multicast promiscuous mode support
     * support flow control auto negotiation for X550em_a 1G PHY
     * add X550em_a FW ALEF support
	 * some functional fixes

Xiao Wang (39):
  net/ixgbe/base: fix delta check for setting VFTA
  net/ixgbe/base: remove X550em SFP iXFI setup
  net/ixgbe/base: change endianness of PHY data
  net/ixgbe/base: add X550em_a 10G PHY support
  net/ixgbe/base: support VF multicast promiscuous
  net/ixgbe/base: introduce new ops init functions
  net/ixgbe/base: separate PHY probe code
  net/ixgbe/base: fully initialize X550em_a 1G PHYs
  net/ixgbe/base: add macros for VF promiscuous mode
  net/ixgbe/base: add FC setup for X550em_a fiber
  net/ixgbe/base: add FC autoneg for X550em_a fiber
  net/ixgbe/base: clear page register in error path
  net/ixgbe/base: configure DMAC for 10Mb operation
  net/ixgbe/base: fix function comments about X550
  net/ixgbe/base: report setting LPE register error
  net/ixgbe/base: bump mailbox version
  net/ixgbe/base: access IOSF by host interface
  net/ixgbe/base: fix check on NACK
  net/ixgbe/base: define X550 PCIe serial MAC addr
  net/ixgbe/base: bypass checking link for crosstalk
  net/ixgbe/base: support X550em_a SGMII FC autoneg
  net/ixgbe/base: add macros for GENEVE UDP port
  net/ixgbe/base: add bound check in LED functions
  net/ixgbe/base: use default check link function
  net/ixgbe/base: set default autoneg speed at reset
  net/ixgbe/base: add missing FDIRSCTPM mask setting
  net/ixgbe/base: commonize mailbox write and read
  net/ixgbe/base: reduce delay for SWFW semaphore
  net/ixgbe/base: report autoneg supported for X550
  net/ixgbe/base: remove X550em_a 100Mbps support
  net/ixgbe/base: unify link speed value
  net/ixgbe/base: separate ops init from PHY init
  net/ixgbe/base: add X550em_a FW ALEF support
  net/ixgbe/base: add two MAC ops for Hyper-V
  net/ixgbe/base: hold semaphore for shadow RAM access
  net/ixgbe/base: update X550em_a backplane speed
  net/ixgbe/base: clean code of flow control autoneg
  net/ixgbe/base: do not skip PHY configuration
  net/ixgbe/base: add base driver update brief

 doc/guides/rel_notes/release_16_11.rst |    8 +
 drivers/net/ixgbe/base/README          |    2 +-
 drivers/net/ixgbe/base/ixgbe_82598.c   |    6 +-
 drivers/net/ixgbe/base/ixgbe_82599.c   |   16 +-
 drivers/net/ixgbe/base/ixgbe_api.c     |   11 +-
 drivers/net/ixgbe/base/ixgbe_api.h     |    2 +
 drivers/net/ixgbe/base/ixgbe_common.c  |  258 +++++--
 drivers/net/ixgbe/base/ixgbe_common.h  |    3 +-
 drivers/net/ixgbe/base/ixgbe_mbx.h     |    7 +-
 drivers/net/ixgbe/base/ixgbe_osdep.h   |    1 +
 drivers/net/ixgbe/base/ixgbe_phy.c     |  100 ++-
 drivers/net/ixgbe/base/ixgbe_phy.h     |   71 +-
 drivers/net/ixgbe/base/ixgbe_type.h    |   73 +-
 drivers/net/ixgbe/base/ixgbe_vf.c      |  103 ++-
 drivers/net/ixgbe/base/ixgbe_vf.h      |    3 +-
 drivers/net/ixgbe/base/ixgbe_x540.c    |   10 +-
 drivers/net/ixgbe/base/ixgbe_x550.c    | 1262 +++++++++++++++++++++-----------
 drivers/net/ixgbe/base/ixgbe_x550.h    |   61 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |   43 +-
 19 files changed, 1359 insertions(+), 681 deletions(-)

-- 
1.9.3

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

* [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-09-19 17:00   ` Ferruh Yigit
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
                   ` (37 subsequent siblings)
  38 siblings, 2 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

The delta value rather than vfta_delta pointer should be checked.

Fixes: b978f7b38c14 ("net/ixgbe/base: simplify VLAN management")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_82598.c  | 6 +++---
 drivers/net/ixgbe/base/ixgbe_api.c    | 7 ++++---
 drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_82598.c b/drivers/net/ixgbe/base/ixgbe_82598.c
index db80880..724dcbb 100644
--- a/drivers/net/ixgbe/base/ixgbe_82598.c
+++ b/drivers/net/ixgbe/base/ixgbe_82598.c
@@ -995,19 +995,19 @@ STATIC s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  *  @vlan: VLAN id to write to VLAN filter
  *  @vind: VMDq output index that maps queue to VLAN id in VFTA
  *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
- *  @bypass_vlvf: boolean flag - unused
+ *  @vlvf_bypass: boolean flag - unused
  *
  *  Turn on/off specified VLAN in the VLAN filter table.
  **/
 s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
-			 bool vlan_on, bool bypass_vlvf)
+			 bool vlan_on, bool vlvf_bypass)
 {
 	u32 regindex;
 	u32 bitindex;
 	u32 bits;
 	u32 vftabyte;
 
-	UNREFERENCED_1PARAMETER(bypass_vlvf);
+	UNREFERENCED_1PARAMETER(vlvf_bypass);
 
 	DEBUGFUNC("ixgbe_set_vfta_82598");
 
diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
index 1786867..5b721af 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.c
+++ b/drivers/net/ixgbe/base/ixgbe_api.c
@@ -1090,7 +1090,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
 		   bool vlvf_bypass)
 {
 	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
-				  vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
+			       vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
 }
 
 /**
@@ -1100,7 +1100,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
  *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
  *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
  *  @vfta_delta: pointer to the difference between the current value of VFTA
- *               and the desired value
+ *		 and the desired value
  *  @vfta: the desired value of the VFTA
  *  @vlvf_bypass: boolean flag indicating updating the default pool is okay
  *
@@ -1110,7 +1110,7 @@ s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
 		   u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
 {
 	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
-				vlan_on, vfta_delta, vfta, vlvf_bypass),
+			       vlan_on, vfta_delta, vfta, vlvf_bypass),
 			       IXGBE_NOT_IMPLEMENTED);
 }
 
@@ -1659,6 +1659,7 @@ void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
 		hw->mac.ops.init_swfw_sync(hw);
 }
 
+
 void ixgbe_disable_rx(struct ixgbe_hw *hw)
 {
 	if (hw->mac.ops.disable_rx)
diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 811875a..161bf32 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -3967,7 +3967,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		 * we run the risk of stray packets leaking into
 		 * the PF via the default pool
 		 */
-		if (vfta_delta)
+		if (*vfta_delta)
 			IXGBE_WRITE_REG(hw, IXGBE_VFTA(vlan / 32), vfta);
 
 		/* disable VLVF and clear remaining bit from pool */
-- 
1.9.3

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

* [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-09-19 17:01   ` Ferruh Yigit
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data Xiao Wang
                   ` (36 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch removes X550em SFP iXFI setup for the drivers since there
is no released hardware production with SFP iXFI.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 57 +++++++------------------------------
 1 file changed, 11 insertions(+), 46 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index aa6e859..b8fdb00 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -2460,53 +2460,18 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 	if (ret_val != IXGBE_SUCCESS)
 		return ret_val;
 
-	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
-		/* Configure CS4227 LINE side to 10G SR. */
-		reg_slice = IXGBE_CS4227_LINE_SPARE22_MSB +
-			    (hw->bus.lan_id << 12);
-		reg_val = IXGBE_CS4227_SPEED_10G;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
-			    (hw->bus.lan_id << 12);
+	/* Configure internal PHY for KR/KX. */
+	ixgbe_setup_kr_speed_x550em(hw, speed);
+
+	/* Configure CS4227 LINE side to proper mode. */
+	reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
+		    (hw->bus.lan_id << 12);
+	if (setup_linear)
+		reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
+	else
 		reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		/* Configure CS4227 for HOST connection rate then type. */
-		reg_slice = IXGBE_CS4227_HOST_SPARE22_MSB +
-			    (hw->bus.lan_id << 12);
-		reg_val = (speed & IXGBE_LINK_SPEED_10GB_FULL) ?
-		IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		reg_slice = IXGBE_CS4227_HOST_SPARE24_LSB +
-			    (hw->bus.lan_id << 12);
-		if (setup_linear)
-			reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
-		else
-			reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		/* Setup XFI internal link. */
-		ret_val = ixgbe_setup_ixfi_x550em(hw, &speed);
-	} else {
-		/* Configure internal PHY for KR/KX. */
-		ixgbe_setup_kr_speed_x550em(hw, speed);
-
-		/* Configure CS4227 LINE side to proper mode. */
-		reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
-			    (hw->bus.lan_id << 12);
-		if (setup_linear)
-			reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
-		else
-			reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-	}
+	ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
+					  reg_val);
 	return ret_val;
 }
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-09-19 17:01   ` Ferruh Yigit
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 04/39] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
                   ` (35 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

The latest firmware reverses the endianness of the PHY data read and
written via host interface command, so make corresponding changes
to that.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_osdep.h | 1 +
 drivers/net/ixgbe/base/ixgbe_type.h  | 4 ++--
 drivers/net/ixgbe/base/ixgbe_x550.c  | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h
index 06d1ee1..77f0af5 100644
--- a/drivers/net/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/ixgbe/base/ixgbe_osdep.h
@@ -100,6 +100,7 @@ enum {
 #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)
+#define IXGBE_BE32_TO_CPU(_i)  rte_be_to_cpu_32(_i)
 
 typedef uint8_t		u8;
 typedef int8_t		s8;
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 83818a9..b2fdfcd 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3136,13 +3136,13 @@ struct ixgbe_hic_internal_phy_req {
 	u8 command_type;
 	__be16 address;
 	u16 rsv1;
-	__le32 write_data;
+	__be32 write_data;
 	u16 pad;
 };
 
 struct ixgbe_hic_internal_phy_resp {
 	struct ixgbe_hic_hdr hdr;
-	__le32 read_data;
+	__be32 read_data;
 };
 
 #ifdef C99
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index b8fdb00..2c80a9b 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1278,7 +1278,7 @@ s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 	write_cmd.port_number = hw->bus.lan_id;
 	write_cmd.command_type = FW_INT_PHY_REQ_WRITE;
 	write_cmd.address = IXGBE_CPU_TO_BE16(reg_addr);
-	write_cmd.write_data = IXGBE_CPU_TO_LE32(data);
+	write_cmd.write_data = IXGBE_CPU_TO_BE32(data);
 
 	status = ixgbe_host_interface_command(hw, (u32 *)&write_cmd,
 					      sizeof(write_cmd),
@@ -1318,7 +1318,7 @@ s32 ixgbe_read_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 					      IXGBE_HI_COMMAND_TIMEOUT, true);
 
 	/* Extract the register value from the response. */
-	*data = IXGBE_LE32_TO_CPU(hic.rsp.read_data);
+	*data = IXGBE_BE32_TO_CPU(hic.rsp.read_data);
 
 	return status;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 04/39] net/ixgbe/base: add X550em_a 10G PHY support
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (2 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous Xiao Wang
                   ` (34 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch use the shared MDIO functions ixgbe_read_phy_reg_x550a
and ixgbe_write_phy_reg_x550a for X550em_a 10G PHY which supports
flow control auto-negotiation.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 1 +
 drivers/net/ixgbe/base/ixgbe_x550.c   | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 161bf32..e46af23 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -188,6 +188,7 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 		case IXGBE_DEV_ID_X550T:
 		case IXGBE_DEV_ID_X550T1:
 		case IXGBE_DEV_ID_X550EM_X_10G_T:
+		case IXGBE_DEV_ID_X550EM_A_10G_T:
 			supported = true;
 			break;
 		default:
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 2c80a9b..5c09bfe 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -494,9 +494,12 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_KR_L:
 		hw->phy.type = ixgbe_phy_x550em_kr;
 		break;
+	case IXGBE_DEV_ID_X550EM_A_10G_T:
+		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
+		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
+       /* Fallthrough to ixgbe_identify_phy_generic */
 	case IXGBE_DEV_ID_X550EM_X_1G_T:
 	case IXGBE_DEV_ID_X550EM_X_10G_T:
-	case IXGBE_DEV_ID_X550EM_A_10G_T:
 		return ixgbe_identify_phy_generic(hw);
 	case IXGBE_DEV_ID_X550EM_A_1G_T:
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
-- 
1.9.3

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

* [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (3 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 04/39] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-09-19 17:05   ` Ferruh Yigit
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 06/39] net/ixgbe/base: introduce new ops init functions Xiao Wang
                   ` (33 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Currently, VF is limited to 30 multicast addresses. In order to
accommodate more addresses, this patch adds support for VF multicast
promiscuous.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_mbx.h  |  2 +-
 drivers/net/ixgbe/base/ixgbe_type.h |  1 +
 drivers/net/ixgbe/base/ixgbe_vf.c   | 38 ++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_vf.h   |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c    | 43 ++-----------------------------------
 5 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
index d775142..c3e301f 100644
--- a/drivers/net/ixgbe/base/ixgbe_mbx.h
+++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
@@ -111,7 +111,7 @@ enum ixgbe_pfvf_api_rev {
 /* mailbox API, version 1.2 VF requests */
 #define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
 #define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
-#define IXGBE_VF_UPDATE_XCAST_MODE	0x0C
+#define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
 
 /* GET_QUEUES return data indices within the mailbox */
 #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index b2fdfcd..96b5cbd 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3883,6 +3883,7 @@ struct ixgbe_mac_operations {
 	s32 (*init_uta_tables)(struct ixgbe_hw *);
 	void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
 	void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
+	s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
 
 	/* Flow Control */
 	s32 (*fc_enable)(struct ixgbe_hw *);
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index a75074a..20a739c 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -75,6 +75,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf;
 	hw->mac.ops.init_rx_addrs = NULL;
 	hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
+	hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode;
 	hw->mac.ops.enable_mc = NULL;
 	hw->mac.ops.disable_mc = NULL;
 	hw->mac.ops.clear_vfta = NULL;
@@ -419,6 +420,43 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 }
 
 /**
+ *  ixgbevf_update_xcast_mode - Update Multicast mode
+ *  @hw: pointer to the HW structure
+ *  @xcast_mode: new multicast mode
+ *
+ *  Updates the Multicast Mode of VF.
+ **/
+s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
+{
+	struct ixgbe_mbx_info *mbx = &hw->mbx;
+	u32 msgbuf[2];
+	s32 err;
+
+	switch (hw->api_version) {
+	case ixgbe_mbox_api_12:
+		break;
+	default:
+		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	}
+
+	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
+	msgbuf[1] = xcast_mode;
+
+	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
+	if (err)
+		return err;
+
+	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
+	if (err)
+		return err;
+
+	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
+	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
+		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	return IXGBE_SUCCESS;
+}
+
+/**
  *  ixgbe_set_vfta_vf - Set/Unset vlan filter table address
  *  @hw: pointer to the HW structure
  *  @vlan: 12 bit VLAN ID
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h b/drivers/net/ixgbe/base/ixgbe_vf.h
index 8851cb8..624a97d 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.h
+++ b/drivers/net/ixgbe/base/ixgbe_vf.h
@@ -131,6 +131,7 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr);
 s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 				 u32 mc_addr_count, ixgbe_mc_addr_itr,
 				 bool clear);
+s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		      bool vlan_on, bool vlvf_bypass);
 void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d478a15..7794960 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -7236,51 +7236,12 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 	return ret;
 }
 
-/* ixgbevf_update_xcast_mode - Update Multicast mode
- * @hw: pointer to the HW structure
- * @netdev: pointer to net device structure
- * @xcast_mode: new multicast mode
- *
- * Updates the Multicast Mode of VF.
- */
-static int ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,
-				     int xcast_mode)
-{
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
-	u32 msgbuf[2];
-	s32 err;
-
-	switch (hw->api_version) {
-	case ixgbe_mbox_api_12:
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
-	msgbuf[1] = xcast_mode;
-
-	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
-	if (err)
-		return err;
-
-	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
-	if (err)
-		return err;
-
-	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
-	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
-		return -EPERM;
-
-	return 0;
-}
-
 static void
 ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
 }
 
 static void
@@ -7288,7 +7249,7 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
 }
 
 static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
-- 
1.9.3

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

* [dpdk-dev] [PATCH 06/39] net/ixgbe/base: introduce new ops init functions
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (4 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 07/39] net/ixgbe/base: separate PHY probe code Xiao Wang
                   ` (32 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch introduces new init_ops functions for X550EM_a and X550EM_x.
This makes it easier to assign function pointers with specific
dependencies (like media type) for each MAC.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_api.c  |  4 +-
 drivers/net/ixgbe/base/ixgbe_api.h  |  2 +
 drivers/net/ixgbe/base/ixgbe_x550.c | 83 ++++++++++++++++++++++++++-----------
 3 files changed, 64 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
index 5b721af..094ee52 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.c
+++ b/drivers/net/ixgbe/base/ixgbe_api.c
@@ -106,8 +106,10 @@ s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
 		status = ixgbe_init_ops_X550(hw);
 		break;
 	case ixgbe_mac_X550EM_x:
+		status = ixgbe_init_ops_X550EM_x(hw);
+		break;
 	case ixgbe_mac_X550EM_a:
-		status = ixgbe_init_ops_X550EM(hw);
+		status = ixgbe_init_ops_X550EM_a(hw);
 		break;
 	case ixgbe_mac_82599_vf:
 	case ixgbe_mac_X540_vf:
diff --git a/drivers/net/ixgbe/base/ixgbe_api.h b/drivers/net/ixgbe/base/ixgbe_api.h
index 3aad1da..24c4ae8 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.h
+++ b/drivers/net/ixgbe/base/ixgbe_api.h
@@ -45,6 +45,8 @@ extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw);
+extern s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw);
+extern s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
 
 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw);
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 5c09bfe..db12339 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -604,7 +604,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	struct ixgbe_mac_info *mac = &hw->mac;
 	struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
 	struct ixgbe_phy_info *phy = &hw->phy;
-	struct ixgbe_link_info *link = &hw->link;
 	s32 ret_val;
 
 	DEBUGFUNC("ixgbe_init_ops_X550EM");
@@ -640,25 +639,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	hw->bus.type = ixgbe_bus_type_internal;
 	mac->ops.get_bus_info = ixgbe_get_bus_info_X550em;
 
-	if (hw->mac.type == ixgbe_mac_X550EM_x) {
-		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
-		mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
-		mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
-		link->ops.read_link = ixgbe_read_i2c_combined_generic;
-		link->ops.read_link_unlocked =
-				ixgbe_read_i2c_combined_generic_unlocked;
-		link->ops.write_link = ixgbe_write_i2c_combined_generic;
-		link->ops.write_link_unlocked =
-				ixgbe_write_i2c_combined_generic_unlocked;
-		link->addr = IXGBE_CS4227;
-	}
-	if (hw->mac.type == ixgbe_mac_X550EM_a) {
-		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
-		mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
-		mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	}
 
 	mac->ops.get_media_type = ixgbe_get_media_type_X550em;
 	mac->ops.setup_sfp = ixgbe_setup_sfp_modules_X550em;
@@ -669,10 +649,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 
 	if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper)
 		mac->ops.setup_fc = ixgbe_setup_fc_generic;
-	else if (hw->mac.type == ixgbe_mac_X550EM_a) {
-		mac->ops.setup_fc = ixgbe_setup_fc_x550a;
-		mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
-	}
 	else
 		mac->ops.setup_fc = ixgbe_setup_fc_X550em;
 
@@ -706,6 +682,65 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 }
 
 /**
+*  ixgbe_init_ops_X550EM_a - Inits func ptrs and MAC type
+*  @hw: pointer to hardware structure
+*
+*  Initialize the function pointers and for MAC type X550EM_a.
+*  Does not touch the hardware.
+**/
+s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 ret_val;
+
+	DEBUGFUNC("ixgbe_init_ops_X550EM_a");
+
+	/* Start with generic X550EM init */
+	ret_val = ixgbe_init_ops_X550EM(hw);
+
+	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
+	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
+	mac->ops.setup_fc = ixgbe_setup_fc_x550a;
+	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
+
+	return ret_val;
+}
+
+/**
+*  ixgbe_init_ops_X550EM_x - Inits func ptrs and MAC type
+*  @hw: pointer to hardware structure
+*
+*  Initialize the function pointers and for MAC type X550EM_x.
+*  Does not touch the hardware.
+**/
+s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	struct ixgbe_link_info *link = &hw->link;
+	s32 ret_val;
+
+	DEBUGFUNC("ixgbe_init_ops_X550EM_x");
+
+	/* Start with generic X550EM init */
+	ret_val = ixgbe_init_ops_X550EM(hw);
+
+	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
+	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
+	link->ops.read_link = ixgbe_read_i2c_combined_generic;
+	link->ops.read_link_unlocked = ixgbe_read_i2c_combined_generic_unlocked;
+	link->ops.write_link = ixgbe_write_i2c_combined_generic;
+	link->ops.write_link_unlocked =
+				      ixgbe_write_i2c_combined_generic_unlocked;
+	link->addr = IXGBE_CS4227;
+
+	return ret_val;
+}
+
+/**
  *  ixgbe_dmac_config_X550
  *  @hw: pointer to hardware structure
  *
-- 
1.9.3

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

* [dpdk-dev] [PATCH 07/39] net/ixgbe/base: separate PHY probe code
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (5 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 06/39] net/ixgbe/base: introduce new ops init functions Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 08/39] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
                   ` (31 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Move the PHY probe code into a separate function so that it can be
reused. A subsequent patch will use it for configurations that
provide the PHY address explicitly.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 58 +++++++++++++++++++++++---------------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index ed1b14f..297a335 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -283,6 +283,39 @@ s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw)
 }
 
 /**
+ * ixgbe_probe_phy - Probe a single address for a PHY
+ * @hw: pointer to hardware structure
+ * @phy_addr: PHY address to probe
+ *
+ * Returns true if PHY found
+ */
+static bool ixgbe_probe_phy(struct ixgbe_hw *hw, u16 phy_addr)
+{
+	u16 ext_ability = 0;
+
+	if (!ixgbe_validate_phy_addr(hw, phy_addr))
+		return false;
+
+	if (ixgbe_get_phy_id(hw))
+		return false;
+
+	hw->phy.type = ixgbe_get_phy_type_from_id(hw->phy.id);
+
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY,
+				     IXGBE_MDIO_PMA_PMD_DEV_TYPE, &ext_ability);
+		if (ext_ability &
+		    (IXGBE_MDIO_PHY_10GBASET_ABILITY |
+		     IXGBE_MDIO_PHY_1000BASET_ABILITY))
+			hw->phy.type = ixgbe_phy_cu_unknown;
+		else
+			hw->phy.type = ixgbe_phy_generic;
+	}
+
+	return true;
+}
+
+/**
  *  ixgbe_identify_phy_generic - Get physical layer module
  *  @hw: pointer to hardware structure
  *
@@ -291,8 +324,7 @@ s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw)
 s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 {
 	s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
-	u32 phy_addr;
-	u16 ext_ability = 0;
+	u16 phy_addr;
 
 	DEBUGFUNC("ixgbe_identify_phy_generic");
 
@@ -305,27 +337,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 
 	if (hw->phy.type == ixgbe_phy_unknown) {
 		for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
-			if (ixgbe_validate_phy_addr(hw, phy_addr)) {
-				hw->phy.addr = phy_addr;
-				ixgbe_get_phy_id(hw);
-				hw->phy.type =
-					ixgbe_get_phy_type_from_id(hw->phy.id);
-
-				if (hw->phy.type == ixgbe_phy_unknown) {
-					hw->phy.ops.read_reg(hw,
-						  IXGBE_MDIO_PHY_EXT_ABILITY,
-						  IXGBE_MDIO_PMA_PMD_DEV_TYPE,
-						  &ext_ability);
-					if (ext_ability &
-					    (IXGBE_MDIO_PHY_10GBASET_ABILITY |
-					     IXGBE_MDIO_PHY_1000BASET_ABILITY))
-						hw->phy.type =
-							 ixgbe_phy_cu_unknown;
-					else
-						hw->phy.type =
-							 ixgbe_phy_generic;
-				}
-
+		if (ixgbe_probe_phy(hw, phy_addr)) {
 				status = IXGBE_SUCCESS;
 				break;
 			}
-- 
1.9.3

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

* [dpdk-dev] [PATCH 08/39] net/ixgbe/base: fully initialize X550em_a 1G PHYs
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (6 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 07/39] net/ixgbe/base: separate PHY probe code Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 09/39] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
                   ` (30 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Fully initialize X550em_a 1G PHYs; move the PHY definitions from
ixgbe_x550.h to ixgbe_phy.h, where they really belong; define
register numbers in decimal because that is how they are in the spec.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c  |  43 +--
 drivers/net/ixgbe/base/ixgbe_phy.h  |  71 ++++-
 drivers/net/ixgbe/base/ixgbe_type.h |  14 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 514 ++++++++++++++++++++++++------------
 drivers/net/ixgbe/base/ixgbe_x550.h |  43 ---
 5 files changed, 454 insertions(+), 231 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index 297a335..d33d0f8 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -335,25 +335,33 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 			hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM;
 	}
 
-	if (hw->phy.type == ixgbe_phy_unknown) {
-		for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
-		if (ixgbe_probe_phy(hw, phy_addr)) {
-				status = IXGBE_SUCCESS;
-				break;
-			}
-		}
+	if (hw->phy.type != ixgbe_phy_unknown)
+		return IXGBE_SUCCESS;
 
-		/* Certain media types do not have a phy so an address will not
-		 * be found and the code will take this path.  Caller has to
-		 * decide if it is an error or not.
-		 */
-		if (status != IXGBE_SUCCESS) {
-			hw->phy.addr = 0;
+	if (hw->phy.nw_mng_if_sel) {
+		phy_addr = (hw->phy.nw_mng_if_sel &
+			    IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD) >>
+			   IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
+		if (ixgbe_probe_phy(hw, phy_addr))
+			return IXGBE_SUCCESS;
+		else
+			return IXGBE_ERR_PHY_ADDR_INVALID;
+	}
+
+	for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
+		if (ixgbe_probe_phy(hw, phy_addr)) {
+			status = IXGBE_SUCCESS;
+			break;
 		}
-	} else {
-		status = IXGBE_SUCCESS;
 	}
 
+	/* Certain media types do not have a phy so an address will not
+	 * be found and the code will take this path.  Caller has to
+	 * decide if it is an error or not.
+	 */
+	if (status != IXGBE_SUCCESS)
+		hw->phy.addr = 0;
+
 	return status;
 }
 
@@ -464,9 +472,11 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id)
 		phy_type = ixgbe_phy_nl;
 		break;
 	case X557_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:
@@ -894,6 +904,9 @@ s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
 	if (speed & IXGBE_LINK_SPEED_100_FULL)
 		hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL;
 
+	if (speed & IXGBE_LINK_SPEED_10_FULL)
+		hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10_FULL;
+
 	/* Setup link based on the new speed settings */
 	ixgbe_setup_phy_link(hw);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_phy.h b/drivers/net/ixgbe/base/ixgbe_phy.h
index 281f9fa..da14abc 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.h
+++ b/drivers/net/ixgbe/base/ixgbe_phy.h
@@ -92,8 +92,8 @@ 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_CS4223_PHY_ID		0x7003	/* Quad port */
+#define IXGBE_CS4227_PHY_ID		0x3003	/* Dual port */
 #define IXGBE_CS4227_RESET_PENDING	0x1357
 #define IXGBE_CS4227_RESET_COMPLETE	0x5AA5
 #define IXGBE_CS4227_RETRIES		15
@@ -154,6 +154,73 @@ POSSIBILITY OF SUCH DAMAGE.
 /* SFP+ SFF-8472 Compliance */
 #define IXGBE_SFF_SFF_8472_UNSUP	0x00
 
+/* More phy definitions */
+#define IXGBE_M88E1500_COPPER_CTRL		0	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_CTRL_RESET	(1u << 15)
+#define IXGBE_M88E1500_COPPER_CTRL_AN_EN	(1u << 12)
+#define IXGBE_M88E1500_COPPER_CTRL_POWER_DOWN	(1u << 11)
+#define IXGBE_M88E1500_COPPER_CTRL_RESTART_AN	(1u << 9)
+#define IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX	(1u << 8)
+#define IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB	(1u << 6)
+#define IXGBE_M88E1500_COPPER_STATUS		1	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_STATUS_AN_DONE	(1u << 5)
+#define IXGBE_M88E1500_COPPER_AN		4	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_AN_AS_PAUSE	(1u << 11)
+#define IXGBE_M88E1500_COPPER_AN_PAUSE		(1u << 10)
+#define IXGBE_M88E1500_COPPER_AN_T4		(1u << 9)
+#define IXGBE_M88E1500_COPPER_AN_100TX_FD	(1u << 8)
+#define IXGBE_M88E1500_COPPER_AN_100TX_HD	(1u << 7)
+#define IXGBE_M88E1500_COPPER_AN_10TX_FD	(1u << 6)
+#define IXGBE_M88E1500_COPPER_AN_10TX_HD	(1u << 5)
+#define IXGBE_M88E1500_COPPER_AN_LP_ABILITY	5	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_AN_LP_AS_PAUSE	(1u << 11)
+#define IXGBE_M88E1500_COPPER_AN_LP_PAUSE	(1u << 10)
+#define IXGBE_M88E1500_1000T_CTRL		9	/* Page 0 reg */
+/* 1=Configure PHY as Master 0=Configure PHY as Slave */
+#define IXGBE_M88E1500_1000T_CTRL_MS_VALUE	(1u << 11)
+#define IXGBE_M88E1500_1000T_CTRL_1G_FD		(1u << 9)
+/* 1=Master/Slave manual config value 0=Automatic Master/Slave config */
+#define IXGBE_M88E1500_1000T_CTRL_MS_ENABLE	(1u << 12)
+#define IXGBE_M88E1500_1000T_CTRL_FULL_DUPLEX	(1u << 9)
+#define IXGBE_M88E1500_1000T_CTRL_HALF_DUPLEX	(1u << 8)
+#define IXGBE_M88E1500_1000T_STATUS		10	/* Page 0 reg */
+#define IXGBE_M88E1500_AUTO_COPPER_SGMII	0x2
+#define IXGBE_M88E1500_AUTO_COPPER_BASEX	0x3
+#define IXGBE_M88E1500_STATUS_LINK		(1u << 2) /* Interface Link Bit */
+#define IXGBE_M88E1500_MAC_CTRL_1		16	/* Page 0 reg */
+#define IXGBE_M88E1500_MAC_CTRL_1_MODE_MASK	0x0380 /* Mode Select */
+#define IXGBE_M88E1500_MAC_CTRL_1_DWN_SHIFT	12
+#define IXGBE_M88E1500_MAC_CTRL_1_DWN_4X	3u
+#define IXGBE_M88E1500_MAC_CTRL_1_ED_SHIFT	8
+#define IXGBE_M88E1500_MAC_CTRL_1_ED_TM		3u
+#define IXGBE_M88E1500_MAC_CTRL_1_MDIX_SHIFT	5
+#define IXGBE_M88E1500_MAC_CTRL_1_MDIX_AUTO	3u
+#define IXGBE_M88E1500_MAC_CTRL_1_POWER_DOWN	(1u << 2)
+#define IXGBE_M88E1500_PHY_SPEC_STATUS		17	/* Page 0 reg */
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT	14
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_MASK	3u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_10		0u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_100	1u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_1000	2u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX		(1u << 13)
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED		(1u << 11)
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_LINK		(1u << 10)
+#define IXGBE_M88E1500_PAGE_ADDR		22	/* All pages reg */
+#define IXGBE_M88E1500_FIBER_CTRL		0	/* Page 1 reg */
+#define IXGBE_M88E1500_FIBER_CTRL_RESET		(1u << 15)
+#define IXGBE_M88E1500_FIBER_CTRL_SPEED_LSB	(1u << 13)
+#define IXGBE_M88E1500_FIBER_CTRL_AN_EN		(1u << 12)
+#define IXGBE_M88E1500_FIBER_CTRL_POWER_DOWN	(1u << 11)
+#define IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL	(1u << 8)
+#define IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB	(1u << 6)
+#define IXGBE_M88E1500_MAC_SPEC_CTRL		16	/* Page 2 reg */
+#define IXGBE_M88E1500_MAC_SPEC_CTRL_POWER_DOWN	(1u << 3)
+#define IXGBE_M88E1500_EEE_CTRL_1		0	/* Page 18 reg */
+#define IXGBE_M88E1500_EEE_CTRL_1_MS		(1u << 0) /* EEE Master/Slave */
+#define IXGBE_M88E1500_GEN_CTRL			20	/* Page 18 reg */
+#define IXGBE_M88E1500_GEN_CTRL_RESET		(1u << 15)
+#define IXGBE_M88E1500_GEN_CTRL_MODE_SGMII_COPPER	1u /* Mode bits 0-2 */
+
 s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw);
 bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr);
 enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 96b5cbd..39099d6 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -1644,13 +1644,14 @@ struct ixgbe_dmac_config {
 #define X550_PHY_ID2	0x01540223
 #define X550_PHY_ID3	0x01540221
 #define X557_PHY_ID	0x01540240
+#define X557_PHY_ID2	0x01540250
 #define AQ_FW_REV	0x20
 #define QT2022_PHY_ID	0x0043A400
 #define ATH_PHY_ID	0x03429050
 
 /* PHY Types */
-#define IXGBE_M88E1500_E_PHY_ID		0x01410DD0
-#define IXGBE_M88E1543_E_PHY_ID		0x01410EA0
+#define IXGBE_M88E1500_E_PHY_ID	0x01410DD0
+#define IXGBE_M88E1543_E_PHY_ID	0x01410EA0
 
 /* Special PHY Init Routine */
 #define IXGBE_PHY_INIT_OFFSET_NL	0x002B
@@ -3054,7 +3055,7 @@ enum ixgbe_fdir_pballoc_type {
 #ifdef C99
 #pragma pack(push, 1)
 #else
-#pragma pack(1)
+#pragma pack (1)
 #endif /* C99 */
 
 struct ixgbe_hic_hdr {
@@ -4170,6 +4171,7 @@ struct ixgbe_hw {
 
 #define IXGBE_KRM_AN_CNTL_8_LINEAR			(1 << 0)
 #define IXGBE_KRM_AN_CNTL_8_LIMITING			(1 << 1)
+
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH_SYM_PAUSE		(1 << 10)
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH_ASM_PAUSE		(1 << 11)
 
@@ -4208,11 +4210,13 @@ struct ixgbe_hw {
 #define IXGBE_SB_IOSF_TARGET_KR_PHY	0
 
 #define IXGBE_NW_MNG_IF_SEL		0x00011178
-#define IXGBE_NW_MNG_IF_SEL_MDIO_ACT	(1 << 1)
+#define IXGBE_NW_MNG_IF_SEL_MDIO_ACT	(1u << 1)
+#define IXGBE_NW_MNG_IF_SEL_MDIO_IF_MODE	(1u << 2)
+#define IXGBE_NW_MNG_IF_SEL_EN_SHARED_MDIO	(1u << 13)
 #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_MDIO_PHY_ADD_SHIFT 3
 #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD	\
-		(0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT)
+				(0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT)
 
 #endif /* _IXGBE_TYPE_H_ */
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index db12339..0de9238 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -342,11 +342,10 @@ STATIC s32 ixgbe_read_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
 	UNREFERENCED_1PARAMETER(dev_type);
 
 	/* Setup and write the read command */
-	command = (reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT)  |
-		(reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
-		(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
-		IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_READ |
-		IXGBE_MSCA_MDI_COMMAND;
+	command = (reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
+		  (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
+		  IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_READ_AUTOINC |
+		  IXGBE_MSCA_MDI_COMMAND;
 
 	IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
 
@@ -393,11 +392,10 @@ STATIC s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
 	IXGBE_WRITE_REG(hw, IXGBE_MSRWD, (u32)phy_data);
 
 	/* Setup and write the write command */
-	command = (reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT)  |
-		(reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
-		(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
-		IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_WRITE |
-		IXGBE_MSCA_MDI_COMMAND;
+	command = (reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
+		  (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
+		  IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_WRITE |
+		  IXGBE_MSCA_MDI_COMMAND;
 
 	IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
 
@@ -423,43 +421,6 @@ STATIC s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
 }
 
 /**
- * ixgbe_identify_phy_1g - Get 1g PHY type based on device id
- * @hw: pointer to hardware structure
- *
- * Returns error code
- */
-STATIC s32 ixgbe_identify_phy_1g(struct ixgbe_hw *hw)
-{
-	u32 swfw_mask = hw->phy.phy_semaphore_mask;
-	u16 phy_id_high;
-	u16 phy_id_low;
-	s32 rc;
-
-	rc = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
-	if (rc)
-		return rc;
-
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_MDIO_PHY_ID_HIGH, 0,
-				       &phy_id_high);
-	if (rc)
-		goto rel_out;
-
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_MDIO_PHY_ID_LOW, 0,
-				       &phy_id_low);
-	if (rc)
-		goto rel_out;
-
-	hw->phy.id = (u32)phy_id_high << 16;
-	hw->phy.id |= phy_id_low & IXGBE_PHY_REVISION_MASK;
-	hw->phy.revision = (u32)phy_id_low & ~IXGBE_PHY_REVISION_MASK;
-
-rel_out:
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-
-	return rc;
-}
-
-/**
  * ixgbe_identify_phy_x550em - Get PHY type based on device id
  * @hw: pointer to hardware structure
  *
@@ -498,18 +459,11 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
 		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
        /* Fallthrough to ixgbe_identify_phy_generic */
+	case IXGBE_DEV_ID_X550EM_A_1G_T:
+	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 	case IXGBE_DEV_ID_X550EM_X_1G_T:
 	case IXGBE_DEV_ID_X550EM_X_10G_T:
 		return ixgbe_identify_phy_generic(hw);
-	case IXGBE_DEV_ID_X550EM_A_1G_T:
-	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
-		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
-		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
-		if (hw->bus.lan_id)
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
-		else
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
-		return ixgbe_identify_phy_1g(hw);
 	default:
 		break;
 	}
@@ -1544,7 +1498,6 @@ enum ixgbe_media_type ixgbe_get_media_type_X550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_1G_T:
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 		media_type = ixgbe_media_type_copper;
-		hw->phy.type = ixgbe_phy_m88;
 		break;
 	default:
 		media_type = ixgbe_media_type_unknown;
@@ -1641,12 +1594,11 @@ s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw)
  * @hw: pointer to hardware structure
  */
 STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
-			     bool autoneg_wait_to_complete)
+			     bool autoneg_wait)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
 	u32 lval, sval;
 	s32 rc;
-	UNREFERENCED_2PARAMETER(speed, autoneg_wait_to_complete);
 
 	rc = mac->ops.read_iosf_sb_reg(hw,
 				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
@@ -1683,6 +1635,126 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	rc = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+	if (rc)
+		return rc;
+
+	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
+}
+
+ /**
+ * ixgbe_setup_sgmii_m88 - Set up link for sgmii with Marvell PHYs
+ * @hw: pointer to hardware structure
+ */
+STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
+				 bool autoneg_wait)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	u32 lval, sval;
+	s32 rc;
+
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &lval);
+	if (rc)
+		return rc;
+
+	lval &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
+	lval &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
+	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_SGMII_EN;
+	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CLAUSE_37_EN;
+	lval &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_1G;
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+	if (rc)
+		return rc;
+
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &sval);
+	if (rc)
+		return rc;
+
+	sval &= ~IXGBE_KRM_SGMII_CTRL_MAC_TAR_FORCE_10_D;
+	sval &= ~IXGBE_KRM_SGMII_CTRL_MAC_TAR_FORCE_100_D;
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, sval);
+	if (rc)
+		return rc;
+
+	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+	if (rc)
+		return rc;
+
+	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
+}
+
+/**
+ * ixgbe_check_link_m88 - Poll PHY for link
+ * @hw: pointer to hardware structure
+ * @speed: pointer to link speed
+ * @link_up: true when link is up
+ * @link_up_wait: bool indicating whether to wait for link
+ *
+ * Check that both the MAC and PHY have link.
+ */
+static s32
+ixgbe_check_link_m88(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
+		     bool *link_up, bool link_up_wait)
+{
+	u16 reg;
+	s32 rc;
+	u32 i;
+
+	rc = ixgbe_check_mac_link_generic(hw, speed, link_up, link_up_wait);
+	if (rc || !*link_up)
+		return rc;
+
+	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_PHY_SPEC_STATUS, 0, &reg);
+
+	/* MAC link is up, so check external PHY link */
+	*link_up = !!(reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK);
+
+	if (link_up_wait) {
+		for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
+			if (!rc &&
+			    (reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK)) {
+				*link_up = true;
+				break;
+			}
+			*link_up = false;
+			msec_delay(100);
+			rc = hw->phy.ops.read_reg(hw,
+						 IXGBE_M88E1500_PHY_SPEC_STATUS,
+						 0, &reg);
+		}
+	}
+
+#define M88_SPEED(x) (IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED  | \
+		      IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX     | \
+		      ((IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_##x) <<\
+			IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT))
+
+	reg &= M88_SPEED(MASK);
+	switch (reg) {
+	case M88_SPEED(10):
+		*speed = IXGBE_LINK_SPEED_10_FULL;
+		break;
+	case M88_SPEED(100):
+		*speed = IXGBE_LINK_SPEED_100_FULL;
+		break;
+	case M88_SPEED(1000):
+		*speed = IXGBE_LINK_SPEED_1GB_FULL;
+		break;
+	default:
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
+		break;
+	}
+#undef M88_SPEED
 
 	return rc;
 }
@@ -1717,8 +1789,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
 				ixgbe_setup_mac_link_sfp_x550em;
 		break;
 	case ixgbe_media_type_copper:
-		mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
-		mac->ops.check_link = ixgbe_check_link_t_X550em;
+		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
+		    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
+			mac->ops.setup_link = ixgbe_setup_sgmii_m88;
+			mac->ops.check_link = ixgbe_check_link_m88;
+		} else {
+			mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
+			mac->ops.check_link = ixgbe_check_link_t_X550em;
+		}
 		break;
 	case ixgbe_media_type_backplane:
 		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII ||
@@ -1766,8 +1844,9 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 	} else {
 		switch (hw->phy.type) {
 		case ixgbe_phy_m88:
-			*speed = IXGBE_LINK_SPEED_100_FULL |
-				 IXGBE_LINK_SPEED_1GB_FULL;
+			*speed = IXGBE_LINK_SPEED_1GB_FULL |
+				 IXGBE_LINK_SPEED_100_FULL |
+				 IXGBE_LINK_SPEED_10_FULL;
 			break;
 		case ixgbe_phy_sgmii:
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
@@ -2000,171 +2079,266 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 }
 
 /**
- * ixgbe_set_master_slave_mode - Set up PHY for master/slave mode
+ * ixgbe_setup_m88 - setup m88 PHY
  * @hw: pointer to hardware structure
- *
- * Must be called while holding the PHY semaphore and token
  */
-STATIC s32 ixgbe_set_master_slave_mode(struct ixgbe_hw *hw)
+STATIC s32 ixgbe_setup_m88(struct ixgbe_hw *hw)
 {
-	u16 phy_data;
+	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
+	u16 reg;
 	s32 rc;
 
-	/* Resolve master/slave mode */
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_M88E1500_1000T_CTRL, 0,
-				       &phy_data);
+	if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw))
+		return IXGBE_SUCCESS;
+
+	rc = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (rc)
 		return rc;
 
-	/* load defaults for future use */
-	if (phy_data & IXGBE_M88E1500_1000T_CTRL_MS_ENABLE) {
-		if (phy_data & IXGBE_M88E1500_1000T_CTRL_MS_VALUE)
-			hw->phy.original_ms_type = ixgbe_ms_force_master;
-		else
-			hw->phy.original_ms_type = ixgbe_ms_force_slave;
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+	if (reg & IXGBE_M88E1500_COPPER_CTRL_POWER_DOWN) {
+		reg &= ~IXGBE_M88E1500_COPPER_CTRL_POWER_DOWN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					  reg);
+	}
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_MAC_CTRL_1, 0, &reg);
+	if (rc)
+		goto out;
+	if (reg & IXGBE_M88E1500_MAC_CTRL_1_POWER_DOWN) {
+		reg &= ~IXGBE_M88E1500_MAC_CTRL_1_POWER_DOWN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_MAC_CTRL_1, 0,
+					  reg);
+	}
+
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 2);
+	if (rc)
+		goto out;
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_MAC_SPEC_CTRL, 0,
+				      &reg);
+	if (rc)
+		goto out;
+	if (reg & IXGBE_M88E1500_MAC_SPEC_CTRL_POWER_DOWN) {
+		reg &= ~IXGBE_M88E1500_MAC_SPEC_CTRL_POWER_DOWN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_MAC_SPEC_CTRL, 0,
+					  reg);
+		rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0,
+					       0);
+		if (rc)
+			goto out;
+		rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					      &reg);
+		if (rc)
+			goto out;
+		reg |= IXGBE_M88E1500_COPPER_CTRL_RESET;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					  reg);
+		usec_delay(50);
 	} else {
-		hw->phy.original_ms_type = ixgbe_ms_auto;
+		rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0,
+					       0);
+		if (rc)
+			goto out;
 	}
 
-	switch (hw->phy.ms_type) {
-	case ixgbe_ms_force_master:
-		phy_data |= IXGBE_M88E1500_1000T_CTRL_MS_ENABLE;
-		phy_data |= IXGBE_M88E1500_1000T_CTRL_MS_VALUE;
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+
+	if (!(reg & IXGBE_M88E1500_COPPER_CTRL_AN_EN)) {
+		reg |= IXGBE_M88E1500_COPPER_CTRL_AN_EN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					  reg);
+	}
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_1000T_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+	reg &= ~IXGBE_M88E1500_1000T_CTRL_HALF_DUPLEX;
+	reg &= ~IXGBE_M88E1500_1000T_CTRL_FULL_DUPLEX;
+	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL)
+		reg |= IXGBE_M88E1500_1000T_CTRL_FULL_DUPLEX;
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_1000T_CTRL, 0, reg);
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_AN, 0, &reg);
+	if (rc)
+		goto out;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_PAUSE;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_T4;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_FD;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_HD;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_FD;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_HD;
+	switch (hw->fc.current_mode) {
+	case ixgbe_fc_full:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
 		break;
-	case ixgbe_ms_force_slave:
-		phy_data |= IXGBE_M88E1500_1000T_CTRL_MS_ENABLE;
-		phy_data &= ~IXGBE_M88E1500_1000T_CTRL_MS_VALUE;
+	case ixgbe_fc_rx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
 		break;
-	case ixgbe_ms_auto:
-		phy_data &= ~IXGBE_M88E1500_1000T_CTRL_MS_ENABLE;
+	case ixgbe_fc_tx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
 		break;
 	default:
 		break;
 	}
 
-	return ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_1000T_CTRL, 0,
-					  phy_data);
+	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL)
+		reg |= IXGBE_M88E1500_COPPER_AN_100TX_FD;
+	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10_FULL)
+		reg |= IXGBE_M88E1500_COPPER_AN_10TX_FD;
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_AN, 0, reg);
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+	reg |= IXGBE_M88E1500_COPPER_CTRL_RESTART_AN;
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, reg);
+
+
+	hw->mac.ops.release_swfw_sync(hw, mask);
+	return rc;
+
+out:
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+	hw->mac.ops.release_swfw_sync(hw, mask);
+	return rc;
 }
 
 /**
- * ixgbe_reset_phy_m88_nolock - Reset m88 PHY without locking
+ * ixgbe_reset_phy_m88e1500 - Reset m88e1500 PHY
  * @hw: pointer to hardware structure
  *
- * Must be called while holding the PHY semaphore and token
+ * The PHY token must be held when calling this function.
  */
-STATIC s32 ixgbe_reset_phy_m88_nolock(struct ixgbe_hw *hw)
+static s32 ixgbe_reset_phy_m88e1500(struct ixgbe_hw *hw)
 {
+	u16 reg;
 	s32 rc;
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 1);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
 	if (rc)
 		return rc;
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_FIBER_CTRL, 0,
-					IXGBE_M88E1500_FIBER_CTRL_RESET |
-					IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL |
-					IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB);
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
 	if (rc)
-		goto res_out;
-
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 18);
-	if (rc)
-		goto res_out;
-
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_GEN_CTRL, 0,
-					IXGBE_M88E1500_GEN_CTRL_RESET |
-					IXGBE_M88E1500_GEN_CTRL_SGMII_COPPER);
-	if (rc)
-		goto res_out;
+		return rc;
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
-	if (rc)
-		goto res_out;
+	reg |= IXGBE_M88E1500_COPPER_CTRL_RESET;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, reg);
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
-					IXGBE_M88E1500_COPPER_CTRL_RESET |
-					IXGBE_M88E1500_COPPER_CTRL_AN_EN |
-					IXGBE_M88E1500_COPPER_CTRL_RESTART_AN |
-					IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX |
-					IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB);
+	usec_delay(10);
 
-res_out:
-	ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
 	return rc;
 }
 
 /**
+ * ixgbe_reset_phy_m88e1543 - Reset m88e1543 PHY
+ * @hw: pointer to hardware structure
+ *
+ * The PHY token must be held when calling this function.
+ */
+static s32 ixgbe_reset_phy_m88e1543(struct ixgbe_hw *hw)
+{
+	return hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+}
+
+/**
  * ixgbe_reset_phy_m88 - Reset m88 PHY
  * @hw: pointer to hardware structure
  */
 STATIC s32 ixgbe_reset_phy_m88(struct ixgbe_hw *hw)
 {
-	u32 swfw_mask = hw->phy.phy_semaphore_mask;
+	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
+	u16 reg;
 	s32 rc;
 
 	if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw))
 		return IXGBE_SUCCESS;
 
-	rc = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
+	rc = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (rc)
 		return rc;
 
-	rc = ixgbe_reset_phy_m88_nolock(hw);
+	switch (hw->phy.id) {
+	case IXGBE_M88E1500_E_PHY_ID:
+		rc = ixgbe_reset_phy_m88e1500(hw);
+		break;
+	case IXGBE_M88E1543_E_PHY_ID:
+		rc = ixgbe_reset_phy_m88e1543(hw);
+		break;
+	default:
+		rc = IXGBE_ERR_PHY;
+		break;
+	}
 
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-	return rc;
-}
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 1);
+	if (rc)
+		goto out;
 
-/**
- * ixgbe_setup_m88 - setup m88 PHY
- * @hw: pointer to hardware structure
- */
-STATIC s32 ixgbe_setup_m88(struct ixgbe_hw *hw)
-{
-	u32 swfw_mask = hw->phy.phy_semaphore_mask;
-	struct ixgbe_phy_info *phy = &hw->phy;
-	u16 phy_data;
-	s32 rc;
+	reg = IXGBE_M88E1500_FIBER_CTRL_RESET |
+	      IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL |
+	      IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_FIBER_CTRL, 0, reg);
+	if (rc)
+		goto out;
 
-	if (phy->reset_disable || ixgbe_check_reset_blocked(hw))
-		return IXGBE_SUCCESS;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 18);
+	if (rc)
+		goto out;
 
-	rc = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
+	reg = IXGBE_M88E1500_GEN_CTRL_RESET |
+	      IXGBE_M88E1500_GEN_CTRL_MODE_SGMII_COPPER;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_GEN_CTRL, 0, reg);
 	if (rc)
-		return rc;
+		goto out;
 
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_M88E1500_PHY_SPEC_CTRL, 0,
-				       &phy_data);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 1);
 	if (rc)
-		goto rel_out;
-
-	/* Enable downshift and setting it to X6 */
-	phy_data &= ~IXGBE_M88E1500_PSCR_DOWNSHIFT_ENABLE;
-	phy_data |= IXGBE_M88E1500_PSCR_DOWNSHIFT_6X;
-	phy_data |= IXGBE_M88E1500_PSCR_DOWNSHIFT_ENABLE;
-	rc = ixgbe_write_phy_reg_mdi_22(hw,
-					IXGBE_M88E1500_PHY_SPEC_CTRL, 0,
-					phy_data);
+		goto out;
+
+	reg = IXGBE_M88E1500_FIBER_CTRL_RESET |
+	      IXGBE_M88E1500_FIBER_CTRL_AN_EN |
+	      IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL |
+	      IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_FIBER_CTRL, 0, reg);
 	if (rc)
-		goto rel_out;
+		goto out;
 
-	ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+	if (rc)
+		goto out;
 
-	/* Commit the changes */
-	rc = ixgbe_reset_phy_m88_nolock(hw);
-	if (rc) {
-		DEBUGOUT("Error committing the PHY changes\n");
-		goto rel_out;
-	}
+	reg = (IXGBE_M88E1500_MAC_CTRL_1_DWN_4X <<
+	       IXGBE_M88E1500_MAC_CTRL_1_DWN_SHIFT) |
+	      (IXGBE_M88E1500_MAC_CTRL_1_ED_TM <<
+	       IXGBE_M88E1500_MAC_CTRL_1_ED_SHIFT) |
+	      (IXGBE_M88E1500_MAC_CTRL_1_MDIX_AUTO <<
+	       IXGBE_M88E1500_MAC_CTRL_1_MDIX_SHIFT);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_MAC_CTRL_1, 0, reg);
+	if (rc)
+		goto out;
 
-	rc = ixgbe_set_master_slave_mode(hw);
+	reg = IXGBE_M88E1500_COPPER_CTRL_RESET |
+	      IXGBE_M88E1500_COPPER_CTRL_AN_EN |
+	      IXGBE_M88E1500_COPPER_CTRL_RESTART_AN |
+	      IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX |
+	      IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, reg);
+	if (rc)
+		goto out;
 
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-	return rc;
+	hw->mac.ops.release_swfw_sync(hw, mask);
 
-rel_out:
-	ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
+	return ixgbe_setup_m88(hw);
+
+out:
+	hw->mac.ops.release_swfw_sync(hw, mask);
 	return rc;
 }
 
@@ -2220,6 +2394,16 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 		phy->ops.identify_sfp = ixgbe_identify_sfp_module_X550em;
 	}
 
+	switch (hw->device_id) {
+	case IXGBE_DEV_ID_X550EM_A_1G_T:
+	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
+		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
+		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
+		break;
+	default:
+		break;
+	}
+
 	/* Identify the PHY or SFP module */
 	ret_val = phy->ops.identify(hw);
 	if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED)
@@ -2263,8 +2447,6 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 		break;
 	case ixgbe_phy_m88:
 		phy->ops.setup_link = ixgbe_setup_m88;
-		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
-		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
 		phy->ops.reset = ixgbe_reset_phy_m88;
 		break;
 	default:
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 27d5d02..8a8381f 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -36,49 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "ixgbe_type.h"
 
-/* More phy definitions */
-#define IXGBE_M88E1500_COPPER_CTRL		0x0/* Page 0 reg */
-#define IXGBE_M88E1500_COPPER_CTRL_RESET	0x8000
-#define IXGBE_M88E1500_COPPER_CTRL_AN_EN	0x1000
-#define IXGBE_M88E1500_COPPER_CTRL_RESTART_AN	0x0200
-#define IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX	0x0100
-#define IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB	0x0040
-#define IXGBE_M88E1500_1000T_CTRL		0x09 /* 1000Base-T Ctrl Reg */
-/* 1=Configure PHY as Master 0=Configure PHY as Slave */
-#define IXGBE_M88E1500_1000T_CTRL_MS_VALUE	0x0800
-/* 1=Master/Slave manual config value 0=Automatic Master/Slave config */
-#define IXGBE_M88E1500_1000T_CTRL_MS_ENABLE	0x1000
-#define IXGBE_M88E1500_1000T_STATUS		0x0A /* 1000Base-T Status Reg */
-#define IXGBE_M88E1500_AUTO_COPPER_SGMII	0x2
-#define IXGBE_M88E1500_AUTO_COPPER_BASEX	0x3
-#define IXGBE_M88E1500_STATUS_LINK		0x0004 /* Interface Link Bit */
-#define IXGBE_M88E1500_MAC_CTRL_1		0x10
-#define IXGBE_M88E1500_MAC_CTRL_1_MODE_MASK	0x0380 /* Mode Select */
-#define IXGBE_M88E1500_CFG_REG_1		0x0010
-#define IXGBE_M88E1500_CFG_REG_2		0x0011
-#define IXGBE_M88E1500_CFG_REG_3		0x0007
-#define IXGBE_M88E1500_MODE			0x0014
-#define IXGBE_M88E1500_PAGE_ADDR		0x16/* Page Offset reg */
-#define IXGBE_M88E1500_FIBER_CTRL		0x0/* Page 1 reg */
-#define IXGBE_M88E1500_FIBER_CTRL_RESET		0x8000
-#define IXGBE_M88E1500_FIBER_CTRL_SPEED_LSB	0x2000
-#define IXGBE_M88E1500_FIBER_CTRL_POWER_DOWN	0x0800
-#define IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL	0x0100
-#define IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB	0x0040
-#define IXGBE_M88E1500_EEE_CTRL_1		0x0/* Page 18 reg */
-#define IXGBE_M88E1500_EEE_CTRL_1_MS		0x0001/* EEE Master/Slave */
-#define IXGBE_M88E1500_GEN_CTRL			0x14/* Page 18 reg */
-#define IXGBE_M88E1500_GEN_CTRL_RESET		0x8000
-#define IXGBE_M88E1500_GEN_CTRL_SGMII_COPPER	0x0001/* Mode bits 0-2 */
-
-/* M88E1500 Specific Registers */
-#define IXGBE_M88E1500_PHY_SPEC_CTRL		0x10 /* PHY Specific Ctrl Reg */
-#define IXGBE_M88E1500_PHY_SPEC_STATUS		0x11 /* PHY Specific Stat Reg */
-
-#define IXGBE_M88E1500_PSCR_DOWNSHIFT_ENABLE	0x0800
-#define IXGBE_M88E1500_PSCR_DOWNSHIFT_MASK	0x7000
-#define IXGBE_M88E1500_PSCR_DOWNSHIFT_6X	0x5000
-
 s32 ixgbe_dmac_config_X550(struct ixgbe_hw *hw);
 s32 ixgbe_dmac_config_tcs_X550(struct ixgbe_hw *hw);
 s32 ixgbe_dmac_update_tcs_X550(struct ixgbe_hw *hw);
-- 
1.9.3

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

* [dpdk-dev] [PATCH 09/39] net/ixgbe/base: add macros for VF promiscuous mode
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (7 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 08/39] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 10/39] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
                   ` (29 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Add new definitions to support VF unicast promiscuous mode which
will be implemented in a later patch.

Besides, rename definitions of subdevice IDs on SFP LOM to make it
easier to distinguish.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 39099d6..c65d3a3 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -105,11 +105,11 @@ POSSIBILITY OF SUCH DAMAGE.
 #define IXGBE_SUBDEV_ID_82599_560FLR		0x17D0
 #define IXGBE_SUBDEV_ID_82599_ECNA_DP		0x0470
 #define IXGBE_SUBDEV_ID_82599_SP_560FLR		0x211B
-#define IXGBE_SUBDEV_ID_82599_LOM_SFP		0x8976
 #define IXGBE_SUBDEV_ID_82599_LOM_SNAP6		0x2159
 #define IXGBE_SUBDEV_ID_82599_SFP_1OCP		0x000D
 #define IXGBE_SUBDEV_ID_82599_SFP_2OCP		0x0008
-#define IXGBE_SUBDEV_ID_82599_SFP_LOM		0x06EE
+#define IXGBE_SUBDEV_ID_82599_SFP_LOM_OEM1	0x8976
+#define IXGBE_SUBDEV_ID_82599_SFP_LOM_OEM2	0x06EE
 #define IXGBE_DEV_ID_82599_BACKPLANE_FCOE	0x152A
 #define IXGBE_DEV_ID_82599_SFP_FCOE		0x1529
 #define IXGBE_DEV_ID_82599_SFP_EM		0x1507
@@ -1766,6 +1766,8 @@ enum {
 #define IXGBE_VT_CTL_POOL_MASK		(0x3F << IXGBE_VT_CTL_POOL_SHIFT)
 
 /* VMOLR bitmasks */
+#define IXGBE_VMOLR_UPE		0x00400000 /* unicast promiscuous */
+#define IXGBE_VMOLR_VPE		0x00800000 /* VLAN promiscuous */
 #define IXGBE_VMOLR_AUPE	0x01000000 /* accept untagged packets */
 #define IXGBE_VMOLR_ROMPE	0x02000000 /* accept packets in MTA tbl */
 #define IXGBE_VMOLR_ROPE	0x04000000 /* accept packets in UC tbl */
-- 
1.9.3

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

* [dpdk-dev] [PATCH 10/39] net/ixgbe/base: add FC setup for X550em_a fiber
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (8 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 09/39] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 11/39] net/ixgbe/base: add FC autoneg " Xiao Wang
                   ` (28 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch adds a separate function for setting up FC (flow control)
on X550em_a fiber:

- rename ixgbe_setup_fc_x550a() to ixgbe_setup_fc_backplane_x550em_a().
- create ixgbe_setup_fc_fiber_x550em_a() to configure FC for fiber.
- add definitions for KRM_AN_CNTL_4 and KRM_PCS_KX_AN along with related
  definitions.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |   6 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 144 +++++++++++++++++++++++++++++++++++-
 drivers/net/ixgbe/base/ixgbe_x550.h |   3 +-
 3 files changed, 147 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index c65d3a3..1d38195 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4140,7 +4140,9 @@ struct ixgbe_hw {
 #define IXGBE_KRM_LINK_S1(P)		((P) ? 0x8200 : 0x4200)
 #define IXGBE_KRM_LINK_CTRL_1(P)	((P) ? 0x820C : 0x420C)
 #define IXGBE_KRM_AN_CNTL_1(P)		((P) ? 0x822C : 0x422C)
+#define IXGBE_KRM_AN_CNTL_4(P)		((P) ? 0x8238 : 0x4238)
 #define IXGBE_KRM_AN_CNTL_8(P)		((P) ? 0x8248 : 0x4248)
+#define IXGBE_KRM_PCS_KX_AN(P)		((P) ? 0x9918 : 0x5918)
 #define IXGBE_KRM_SGMII_CTRL(P)		((P) ? 0x82A0 : 0x42A0)
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P)	((P) ? 0x836C : 0x436C)
 #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)	((P) ? 0x8634 : 0x4634)
@@ -4170,7 +4172,9 @@ struct ixgbe_hw {
 
 #define IXGBE_KRM_AN_CNTL_1_SYM_PAUSE			(1 << 28)
 #define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE			(1 << 29)
-
+#define IXGBE_KRM_PCS_KX_AN_SYM_PAUSE			(1 << 1)
+#define IXGBE_KRM_PCS_KX_AN_ASM_PAUSE			(1 << 2)
+#define IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73		(1 << 29)
 #define IXGBE_KRM_AN_CNTL_8_LINEAR			(1 << 0)
 #define IXGBE_KRM_AN_CNTL_8_LIMITING			(1 << 1)
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 0de9238..b0697aa 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -656,9 +656,19 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
 	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
 	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	mac->ops.setup_fc = ixgbe_setup_fc_x550a;
 	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
 
+	switch (mac->ops.get_media_type(hw)) {
+	case ixgbe_media_type_fiber:
+		mac->ops.setup_fc = ixgbe_setup_fc_fiber_x550em_a;
+		break;
+	case ixgbe_media_type_backplane:
+		mac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a;
+		break;
+	default:
+		break;
+	}
+
 	return ret_val;
 }
 
@@ -4025,17 +4035,17 @@ out:
 }
 
 /**
- *  ixgbe_setup_fc_x550em - Set up flow control
+ *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control
  *  @hw: pointer to hardware structure
  *
  *  Called at init time to set up flow control.
  **/
-s32 ixgbe_setup_fc_x550a(struct ixgbe_hw *hw)
+s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 {
 	s32 status = IXGBE_SUCCESS;
 	u32 an_cntl, link_ctrl = 0;
 
-	DEBUGFUNC("ixgbe_setup_fc_x550em");
+	DEBUGFUNC("ixgbe_setup_fc_backplane_x550em_a");
 
 	/* Validate the requested mode */
 	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
@@ -4125,6 +4135,132 @@ s32 ixgbe_setup_fc_x550a(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_setup_fc_fiber_x550em_a - Set up flow control
+ *  @hw: pointer to hardware structure
+ *
+ *  Called at init time to set up flow control.
+ **/
+s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 rc = IXGBE_SUCCESS;
+	u32 an_cntl4, lctrl, pcs_an;
+
+	DEBUGFUNC("ixgbe_setup_fc_fiber_x550em_a");
+
+	/* Validate the requested mode */
+	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+		return IXGBE_ERR_INVALID_LINK_SETTINGS;
+	}
+
+	/* Enable clause 37 auto-negotiation in KRM_LINK_CTRL_1 */
+	if (hw->fc.requested_mode == ixgbe_fc_default)
+		hw->fc.requested_mode = ixgbe_fc_full;
+
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
+	if (rc)
+		return rc;
+
+	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
+	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CLAUSE_37_EN;
+
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
+	if (rc)
+		return rc;
+
+	/* Enable clause 37 over 73 in KRM_AN_CNTL_4 */
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl4);
+	if (rc)
+		return rc;
+
+	an_cntl4 |= IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73;
+
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl4);
+	if (rc)
+		return rc;
+
+	rc = hw->mac.ops.read_iosf_sb_reg(hw,
+					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
+
+	if (rc)
+		return rc;
+
+	/* The possible values of fc.requested_mode are:
+	 * 0: Flow control is completely disabled
+	 * 1: Rx flow control is enabled (we can receive pause frames,
+	 *    but not send pause frames).
+	 * 2: Tx flow control is enabled (we can send pause frames but
+	 *    we do not support receiving pause frames).
+	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
+	 * other: Invalid.
+	 */
+	switch (hw->fc.requested_mode) {
+	case ixgbe_fc_none:
+		/* Flow control completely disabled by software override. */
+		pcs_an &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
+			    IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
+		break;
+	case ixgbe_fc_tx_pause:
+		/* Tx Flow control is enabled, and Rx Flow control is
+		 * disabled by software override.
+		 */
+		pcs_an |= IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
+		pcs_an &= ~IXGBE_KRM_PCS_KX_AN_SYM_PAUSE;
+		break;
+	case ixgbe_fc_rx_pause:
+		/* Rx Flow control is enabled and Tx Flow control is
+		 * disabled by software override. Since there really
+		 * isn't a way to advertise that we are capable of RX
+		 * Pause ONLY, we will advertise that we support both
+		 * symmetric and asymmetric Rx PAUSE, as such we fall
+		 * through to the fc_full statement.  Later, we will
+		 * disable the adapter's ability to send PAUSE frames.
+		 */
+	case ixgbe_fc_full:
+		/* Flow control (both Rx and Tx) is enabled by SW override. */
+		pcs_an |= IXGBE_KRM_PCS_KX_AN_SYM_PAUSE |
+			   IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
+		break;
+	default:
+		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
+			      "Flow control param set incorrectly\n");
+		return IXGBE_ERR_CONFIG;
+	}
+
+	rc = hw->mac.ops.write_iosf_sb_reg(hw,
+					   IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+					   IXGBE_SB_IOSF_TARGET_KR_PHY, pcs_an);
+
+	/* Restart auto-negotiation. */
+	rc = hw->mac.ops.read_iosf_sb_reg(hw,
+					  IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					  IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
+
+	if (rc) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		return rc;
+	}
+
+	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	rc = hw->mac.ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
+
+	return rc;
+}
+
+/**
  * ixgbe_set_mux - Set mux for port 1 access with CS4227
  * @hw: pointer to hardware structure
  * @state: set mux if 1, clear if 0
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 8a8381f..d8278fa 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -107,7 +107,8 @@ s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			     u32 device_type, u16 *phy_data);
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			      u32 device_type, u16 phy_data);
-s32 ixgbe_setup_fc_x550a(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
 void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw);
 s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
-- 
1.9.3

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

* [dpdk-dev] [PATCH 11/39] net/ixgbe/base: add FC autoneg for X550em_a fiber
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (9 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 10/39] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 12/39] net/ixgbe/base: clear page register in error path Xiao Wang
                   ` (27 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch adds a separate function for enabling FC (flow control)
auto-negotiation on X550em_a:

- rename ixgbe_fc_autoneg_x550a() to ixgbe_fc_autoneg_backplane_x550em_a().
- create ixgbe_fc_autoneg_fiber_x550em_a() specifically for fiber.
- add definitions for KRM_PCS_KX_AN_LP register and related bits.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |  3 ++
 drivers/net/ixgbe/base/ixgbe_x550.c | 85 +++++++++++++++++++++++++++++++++++--
 drivers/net/ixgbe/base/ixgbe_x550.h |  3 +-
 3 files changed, 87 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 1d38195..f42ebaf 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4143,6 +4143,7 @@ struct ixgbe_hw {
 #define IXGBE_KRM_AN_CNTL_4(P)		((P) ? 0x8238 : 0x4238)
 #define IXGBE_KRM_AN_CNTL_8(P)		((P) ? 0x8248 : 0x4248)
 #define IXGBE_KRM_PCS_KX_AN(P)		((P) ? 0x9918 : 0x5918)
+#define IXGBE_KRM_PCS_KX_AN_LP(P)	((P) ? 0x991C : 0x591C)
 #define IXGBE_KRM_SGMII_CTRL(P)		((P) ? 0x82A0 : 0x42A0)
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P)	((P) ? 0x836C : 0x436C)
 #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)	((P) ? 0x8634 : 0x4634)
@@ -4174,6 +4175,8 @@ struct ixgbe_hw {
 #define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE			(1 << 29)
 #define IXGBE_KRM_PCS_KX_AN_SYM_PAUSE			(1 << 1)
 #define IXGBE_KRM_PCS_KX_AN_ASM_PAUSE			(1 << 2)
+#define IXGBE_KRM_PCS_KX_AN_LP_SYM_PAUSE		(1 << 2)
+#define IXGBE_KRM_PCS_KX_AN_LP_ASM_PAUSE		(1 << 3)
 #define IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73		(1 << 29)
 #define IXGBE_KRM_AN_CNTL_8_LINEAR			(1 << 0)
 #define IXGBE_KRM_AN_CNTL_8_LIMITING			(1 << 1)
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index b0697aa..bf3da10 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -656,13 +656,14 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
 	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
 	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
 
 	switch (mac->ops.get_media_type(hw)) {
 	case ixgbe_media_type_fiber:
 		mac->ops.setup_fc = ixgbe_setup_fc_fiber_x550em_a;
+		mac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a;
 		break;
 	case ixgbe_media_type_backplane:
+		mac->ops.fc_autoneg = ixgbe_fc_autoneg_backplane_x550em_a;
 		mac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a;
 		break;
 	default:
@@ -3958,12 +3959,12 @@ out:
 }
 
 /**
- *  ixgbe_fc_autoneg_x550a - Enable flow control IEEE clause 37
+ *  ixgbe_fc_autoneg_backplane_x550em_a - Enable flow control IEEE clause 37
  *  @hw: pointer to hardware structure
  *
  *  Enable flow control according to IEEE clause 37.
  **/
-void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw)
+void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 {
 	u32 link_s1, lp_an_page_low, an_cntl_1;
 	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
@@ -3995,6 +3996,7 @@ void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw)
 	if (status != IXGBE_SUCCESS ||
 	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
+		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
 		goto out;
 	}
 
@@ -4035,6 +4037,83 @@ out:
 }
 
 /**
+ *  ixgbe_fc_autoneg_fiber_x550em_a - Enable flow control IEEE clause 37
+ *  @hw: pointer to hardware structure
+ *
+ *  Enable flow control according to IEEE clause 37.
+ **/
+void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw)
+{
+	u32 link_s1, pcs_an_lp, pcs_an;
+	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+	ixgbe_link_speed speed;
+	bool link_up;
+
+	/* AN should have completed when the cable was plugged in.
+	 * Look for reasons to bail out.  Bail out if:
+	 * - FC autoneg is disabled, or if
+	 * - link is not up.
+	 */
+	if (hw->fc.disable_fc_autoneg) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			     "Flow control autoneg is disabled");
+		goto out;
+	}
+
+	hw->mac.ops.check_link(hw, &speed, &link_up, false);
+	if (!link_up) {
+		ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
+		goto out;
+	}
+
+	/* Check if auto-negotiation has completed */
+	status = hw->mac.ops.read_iosf_sb_reg(hw,
+					 IXGBE_KRM_LINK_S1(hw->bus.lan_id),
+					 IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
+
+	if (status != IXGBE_SUCCESS ||
+	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+		goto out;
+	}
+
+	/* Determine advertised flow control */
+	status = hw->mac.ops.read_iosf_sb_reg(hw,
+					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
+
+	if (status != IXGBE_SUCCESS) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		goto out;
+	}
+
+	/* Determine link parter flow control */
+	status = hw->mac.ops.read_iosf_sb_reg(hw,
+				  IXGBE_KRM_PCS_KX_AN_LP(hw->bus.lan_id),
+				  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an_lp);
+
+	if (status != IXGBE_SUCCESS) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		goto out;
+	}
+
+	status = ixgbe_negotiate_fc(hw, pcs_an, pcs_an_lp,
+				    IXGBE_KRM_PCS_KX_AN_SYM_PAUSE,
+				    IXGBE_KRM_PCS_KX_AN_ASM_PAUSE,
+				    IXGBE_KRM_PCS_KX_AN_LP_SYM_PAUSE,
+				    IXGBE_KRM_PCS_KX_AN_LP_ASM_PAUSE);
+
+out:
+	if (status == IXGBE_SUCCESS) {
+		hw->fc.fc_was_autonegged = true;
+	} else {
+		hw->fc.fc_was_autonegged = false;
+		hw->fc.current_mode = hw->fc.requested_mode;
+	}
+}
+
+/**
  *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control
  *  @hw: pointer to hardware structure
  *
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index d8278fa..db27c84 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -109,7 +109,8 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			      u32 device_type, u16 phy_data);
 s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
-void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw);
 s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 				  ixgbe_link_speed speed,
-- 
1.9.3

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

* [dpdk-dev] [PATCH 12/39] net/ixgbe/base: clear page register in error path
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (10 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 11/39] net/ixgbe/base: add FC autoneg " Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 13/39] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
                   ` (26 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

The error exit should at least try to set the page register to 0
since other code will assume that state.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index bf3da10..2cd5730 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -2349,6 +2349,7 @@ STATIC s32 ixgbe_reset_phy_m88(struct ixgbe_hw *hw)
 	return ixgbe_setup_m88(hw);
 
 out:
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
 	hw->mac.ops.release_swfw_sync(hw, mask);
 	return rc;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 13/39] net/ixgbe/base: configure DMAC for 10Mb operation
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (11 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 12/39] net/ixgbe/base: clear page register in error path Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 14/39] net/ixgbe/base: fix function comments about X550 Xiao Wang
                   ` (25 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Provide a DMA coalescing configuration for 10Mb link speed.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 2cd5730..08886a7 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -768,6 +768,7 @@ s32 ixgbe_dmac_config_tcs_X550(struct ixgbe_hw *hw)
 
 	/* Configure DMA coalescing enabled */
 	switch (hw->mac.dmac_config.link_speed) {
+	case IXGBE_LINK_SPEED_10_FULL:
 	case IXGBE_LINK_SPEED_100_FULL:
 		pb_headroom = IXGBE_DMACRXT_100M;
 		break;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 14/39] net/ixgbe/base: fix function comments about X550
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (12 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 13/39] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 15/39] net/ixgbe/base: report setting LPE register error Xiao Wang
                   ` (24 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Some function commets are obviously wrong, this patch rewords them.

Fixes: d2e72774e58c ("ixgbe/base: support X550")
Fixes: 0790adeb5675 ("ixgbe/base: support X550em_a device")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 08886a7..ddd1195 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1106,8 +1106,8 @@ STATIC s32 ixgbe_iosf_wait(struct ixgbe_hw *hw, u32 *ctrl)
 }
 
 /**
- *  ixgbe_write_iosf_sb_reg_x550 - Writes a value to specified register of the IOSF
- *  device
+ *  ixgbe_write_iosf_sb_reg_x550 - Writes a value to specified register
+ *  of the IOSF device
  *  @hw: pointer to hardware structure
  *  @reg_addr: 32 bit PHY register to write
  *  @device_type: 3 bit device type
@@ -1153,12 +1153,11 @@ out:
 }
 
 /**
- *  ixgbe_read_iosf_sb_reg_x550 - Writes a value to specified register of the IOSF
- *  device
+ *  ixgbe_read_iosf_sb_reg_x550 - Reads specified register of the IOSF device
  *  @hw: pointer to hardware structure
  *  @reg_addr: 32 bit PHY register to write
  *  @device_type: 3 bit device type
- *  @phy_data: Pointer to read data from the register
+ *  @data: Pointer to read data from the register
  **/
 s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
 			   u32 device_type, u32 *data)
@@ -1292,8 +1291,7 @@ s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 }
 
 /**
- *  ixgbe_read_iosf_sb_reg_x550a - Writes a value to specified register
- *  of the IOSF device.
+ *  ixgbe_read_iosf_sb_reg_x550a - Reads specified register of the IOSF device
  *  @hw: pointer to hardware structure
  *  @reg_addr: 32 bit PHY register to write
  *  @device_type: 3 bit device type
-- 
1.9.3

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

* [dpdk-dev] [PATCH 15/39] net/ixgbe/base: report setting LPE register error
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (13 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 14/39] net/ixgbe/base: fix function comments about X550 Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version Xiao Wang
                   ` (23 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Propagate return value when trying to set the maximum packet length. A
PF driver could return a NACK for this request, and the VF driver will
need to know this.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 24 +++++++++++++++++-------
 drivers/net/ixgbe/base/ixgbe_vf.h |  2 +-
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 20a739c..69805f7 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -323,15 +323,16 @@ STATIC s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
 	return vector;
 }
 
-STATIC void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,
-					u32 *msg, u16 size)
+STATIC s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,
+				      u32 *retmsg, u16 size)
 {
 	struct ixgbe_mbx_info *mbx = &hw->mbx;
-	u32 retmsg[IXGBE_VFMAILBOX_SIZE];
 	s32 retval = mbx->ops.write_posted(hw, msg, size, 0);
 
-	if (!retval)
-		mbx->ops.read_posted(hw, retmsg, size, 0);
+	if (retval)
+		return retval;
+
+	return mbx->ops.read_posted(hw, retmsg, size, 0);
 }
 
 /**
@@ -665,13 +666,22 @@ out:
  *  @hw: pointer to the HW structure
  *  @max_size: value to assign to max frame size
  **/
-void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
+s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
 {
 	u32 msgbuf[2];
+	s32 retval;
 
 	msgbuf[0] = IXGBE_VF_SET_LPE;
 	msgbuf[1] = max_size;
-	ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
+
+	retval = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+	if (retval)
+		return retval;
+	if ((msgbuf[0] & IXGBE_VF_SET_LPE) &&
+	    (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK))
+		return IXGBE_ERR_MBX;
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h b/drivers/net/ixgbe/base/ixgbe_vf.h
index 624a97d..d288f31 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.h
+++ b/drivers/net/ixgbe/base/ixgbe_vf.h
@@ -134,7 +134,7 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		      bool vlan_on, bool vlvf_bypass);
-void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
+s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
 int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
 int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 		       unsigned int *default_tc);
-- 
1.9.3

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

* [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (14 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 15/39] net/ixgbe/base: report setting LPE register error Xiao Wang
@ 2016-08-27 15:47 ` Xiao Wang
  2016-09-19 17:03   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface Xiao Wang
                   ` (22 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:47 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch will pave the way for the new VF unicast promiscuous
mode support.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_mbx.h | 5 +++--
 drivers/net/ixgbe/base/ixgbe_vf.c  | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
index c3e301f..7556a81 100644
--- a/drivers/net/ixgbe/base/ixgbe_mbx.h
+++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
@@ -90,6 +90,7 @@ enum ixgbe_pfvf_api_rev {
 	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
 	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
 	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
+	ixgbe_mbox_api_13,	/* API version 1.3, linux/freebsd VF driver */
 	/* This value should always be last */
 	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
 };
@@ -109,8 +110,8 @@ enum ixgbe_pfvf_api_rev {
 #define IXGBE_VF_GET_QUEUES	0x09 /* get queue configuration */
 
 /* mailbox API, version 1.2 VF requests */
-#define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
-#define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
+#define IXGBE_VF_GET_RETA      0x0a    /* VF request for RETA */
+#define IXGBE_VF_GET_RSS_KEY	0x0b    /* get RSS key */
 #define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
 
 /* GET_QUEUES return data indices within the mailbox */
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 69805f7..c0fedea 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -435,6 +435,7 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
 
 	switch (hw->api_version) {
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
@@ -728,6 +729,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 	switch (hw->api_version) {
 	case ixgbe_mbox_api_11:
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return 0;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (15 preceding siblings ...)
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:04   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK Xiao Wang
                   ` (21 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch makes sure that we access IOSF registers through the HIC
(host interface command) for the majority of X550em devices. All devices
with NVM are capable of using the HIC.

For consistency all instances where the ixgbe_read/write_iosf_sb_reg_x550
is called directly are converted to function pointer calls.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c  |  2 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 38 ++++++++++++++++++++++---------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index d33d0f8..ee8618f 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -741,7 +741,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
 	DEBUGFUNC("ixgbe_write_phy_reg_generic");
 
 	if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) {
-		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
+		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,
 						 phy_data);
 		hw->mac.ops.release_swfw_sync(hw, gssr);
 	} else {
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index ddd1195..c8873ee 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -652,8 +652,14 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 	/* Start with generic X550EM init */
 	ret_val = ixgbe_init_ops_X550EM(hw);
 
-	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII ||
+	    hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII_L) {
+		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	} else {
+		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550a;
+		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550a;
+	}
 	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
 	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
 
@@ -2807,24 +2813,25 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
  **/
 STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 {
+	struct ixgbe_mac_info *mac = &hw->mac;
 	s32 status;
 	u32 reg_val;
 
 	/* Disable training protocol FSM. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_CONV_WO_PROTOCOL;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Disable Flex from training TXFFE. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2832,12 +2839,12 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_C0_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2845,14 +2852,14 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_C0_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Enable override for coefficients. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2861,7 +2868,7 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 	reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CZERO_EN;
 	reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CPLUS1_OVRRD_EN;
 	reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CMINUS1_OVRRD_EN;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	return status;
@@ -2877,11 +2884,12 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
  **/
 STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 {
+	struct ixgbe_mac_info *mac = &hw->mac;
 	s32 status;
 	u32 reg_val;
 
 	/* Disable AN and force speed to 10G Serial. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2903,7 +2911,7 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 		return IXGBE_ERR_LINK_SETUP;
 	}
 
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2917,13 +2925,13 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	}
 
 	/* Toggle port SW reset by AN reset. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
@@ -4504,7 +4512,7 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 	DEBUGFUNC("ixgbe_write_phy_reg_x550a");
 
 	if (hw->mac.ops.acquire_swfw_sync(hw, mask) == IXGBE_SUCCESS) {
-		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
+		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,
 						 phy_data);
 		hw->mac.ops.release_swfw_sync(hw, mask);
 	} else {
-- 
1.9.3

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

* [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (16 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:07   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 19/39] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
                   ` (20 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Previously we checked only msgbuf[0] for
(IXGBE_VF_SET_MACVLAN |  IXGBE_VT_MSGTYPE_NACK), but this would not
work if index != 0 and as a result NACK will not be detected.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index c0fedea..f60ff7d 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -529,8 +529,7 @@ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr)
 
 s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
-	u32 msgbuf[3];
+	u32 msgbuf[3], msgbuf_chk;
 	u8 *msg_addr = (u8 *)(&msgbuf[1]);
 	s32 ret_val;
 
@@ -543,18 +542,17 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 	 */
 	msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT;
 	msgbuf[0] |= IXGBE_VF_SET_MACVLAN;
+	msgbuf_chk = msgbuf[0];
 	if (addr)
 		memcpy(msg_addr, addr, 6);
-	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
 
-	if (!ret_val)
-		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
+	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
+	if (!ret_val) {
+		msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
-	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
-
-	if (!ret_val)
-		if (msgbuf[0] == (IXGBE_VF_SET_MACVLAN | IXGBE_VT_MSGTYPE_NACK))
-			ret_val = IXGBE_ERR_OUT_OF_MEM;
+		if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_NACK))
+			return IXGBE_ERR_OUT_OF_MEM;
+	}
 
 	return ret_val;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 19/39] net/ixgbe/base: define X550 PCIe serial MAC addr
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (17 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 20/39] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
                   ` (19 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Add SERIAL_NUMBER_MAC_ADDR definition for X550.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index f42ebaf..1fc7c02 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -2338,7 +2338,9 @@ enum {
 
 #define IXGBE_SAN_MAC_ADDR_PTR		0x28
 #define IXGBE_DEVICE_CAPS		0x2C
-#define IXGBE_SERIAL_NUMBER_MAC_ADDR	0x11
+#define IXGBE_82599_SERIAL_NUMBER_MAC_ADDR	0x11
+#define IXGBE_X550_SERIAL_NUMBER_MAC_ADDR	0x04
+
 #define IXGBE_PCIE_MSIX_82599_CAPS	0x72
 #define IXGBE_MAX_MSIX_VECTORS_82599	0x40
 #define IXGBE_PCIE_MSIX_82598_CAPS	0x62
-- 
1.9.3

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

* [dpdk-dev] [PATCH 20/39] net/ixgbe/base: bypass checking link for crosstalk
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (18 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 19/39] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 21/39] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
                   ` (18 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

When HW starts, first read the NVM to see if the crosstalk fix should
be used on the given HW and cache that information in the HW structure.

When we check_link we first see if 1) NVM requests this fix 2) if
we are an SFP+ device 3) see if a module is not in the SFP+ cage.
If all the above are true then don't bother checking the link, just
say it is down.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 72 +++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_type.h   |  1 +
 2 files changed, 73 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index e46af23..1c7263d 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -372,6 +372,7 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 {
 	s32 ret_val;
 	u32 ctrl_ext;
+	u16 device_caps;
 
 	DEBUGFUNC("ixgbe_start_hw_generic");
 
@@ -397,6 +398,22 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 	if (ret_val != IXGBE_SUCCESS)
 		goto out;
 
+	/* Cache bit indicating need for crosstalk fix */
+	switch (hw->mac.type) {
+	case ixgbe_mac_82599EB:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
+		hw->mac.ops.get_device_caps(hw, &device_caps);
+		if (device_caps & IXGBE_DEVICE_CAPS_NO_CROSSTALK_WR)
+			hw->need_crosstalk_fix = false;
+		else
+			hw->need_crosstalk_fix = true;
+		break;
+	default:
+		hw->need_crosstalk_fix = false;
+		break;
+	}
+
 	/* Clear adapter stopped flag */
 	hw->adapter_stopped = false;
 
@@ -4026,6 +4043,32 @@ s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_need_crosstalk_fix - Determine if we need to do cross talk fix
+ *  @hw: pointer to hardware structure
+ *
+ *  Contains the logic to identify if we need to verify link for the
+ *  crosstalk fix
+ **/
+static bool ixgbe_need_crosstalk_fix(struct ixgbe_hw *hw)
+{
+
+	/* Does FW say we need the fix */
+	if (!hw->need_crosstalk_fix)
+		return false;
+
+	/* Only consider SFP+ PHYs i.e. media type fiber */
+	switch (hw->mac.ops.get_media_type(hw)) {
+	case ixgbe_media_type_fiber:
+	case ixgbe_media_type_fiber_qsfp:
+		break;
+	default:
+		return false;
+	}
+
+	return true;
+}
+
+/**
  *  ixgbe_check_mac_link_generic - Determine link and speed status
  *  @hw: pointer to hardware structure
  *  @speed: pointer to link speed
@@ -4042,6 +4085,35 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 
 	DEBUGFUNC("ixgbe_check_mac_link_generic");
 
+	/* If Crosstalk fix enabled do the sanity check of making sure
+	 * the SFP+ cage is full.
+	 */
+	if (ixgbe_need_crosstalk_fix(hw)) {
+		u32 sfp_cage_full;
+
+		switch (hw->mac.type) {
+		case ixgbe_mac_82599EB:
+			sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
+					IXGBE_ESDP_SDP2;
+			break;
+		case ixgbe_mac_X550EM_x:
+		case ixgbe_mac_X550EM_a:
+			sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
+					IXGBE_ESDP_SDP0;
+			break;
+		default:
+			/* sanity check - No SFP+ devices here */
+			sfp_cage_full = false;
+			break;
+		}
+
+		if (!sfp_cage_full) {
+			*link_up = false;
+			*speed = IXGBE_LINK_SPEED_UNKNOWN;
+			return IXGBE_SUCCESS;
+		}
+	}
+
 	/* clear the old state */
 	links_orig = IXGBE_READ_REG(hw, IXGBE_LINKS);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 1fc7c02..262f656 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4084,6 +4084,7 @@ struct ixgbe_hw {
 	bool force_full_reset;
 	bool allow_unsupported_sfp;
 	bool wol_enabled;
+	bool need_crosstalk_fix;
 };
 
 #define ixgbe_call_func(hw, func, params, error) \
-- 
1.9.3

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

* [dpdk-dev] [PATCH 21/39] net/ixgbe/base: support X550em_a SGMII FC autoneg
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (19 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 20/39] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 22/39] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
                   ` (17 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Create FC (flow control) setup and enable FC function with code to
configure the PHY registers to advertize FC settings according to the
user requested settings and to negotiate the same with the link partner
and arrive at a negotiated setting (RX and TX enabled, TX only enabled,
FC disabled and RX enabled (which also enables TX) ). Remove the part of
code that performs FC auto-negotiation (AN) in ixgbe_setup_m88 and put it
in a new function to maintain consistency with other FC AN implementations
so far.  Add function pointers to the setup-fc and enable-fc functions so
that they get called during init to perform FC AN.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 172 ++++++++++++++++++++++++++++++++----
 drivers/net/ixgbe/base/ixgbe_x550.h |   2 +
 2 files changed, 158 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index c8873ee..a9f4d2a 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -676,6 +676,12 @@ 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)) {
+		mac->ops.fc_autoneg = ixgbe_fc_autoneg_sgmii_x550em_a;
+		mac->ops.setup_fc = ixgbe_setup_fc_sgmii_x550em_a;
+	}
+
 	return ret_val;
 }
 
@@ -2182,27 +2188,15 @@ STATIC s32 ixgbe_setup_m88(struct ixgbe_hw *hw)
 	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_AN, 0, &reg);
 	if (rc)
 		goto out;
-	reg &= ~IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
-	reg &= ~IXGBE_M88E1500_COPPER_AN_PAUSE;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_T4;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_FD;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_HD;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_FD;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_HD;
-	switch (hw->fc.current_mode) {
-	case ixgbe_fc_full:
-		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
-		break;
-	case ixgbe_fc_rx_pause:
-		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
-		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
-		break;
-	case ixgbe_fc_tx_pause:
-		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
-		break;
-	default:
-		break;
-	}
+
+	/* Flow control auto negotiation configuration was moved from here to
+	 * the function ixgbe_setup_fc_sgmii_x550em_a()
+	 */
 
 	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL)
 		reg |= IXGBE_M88E1500_COPPER_AN_100TX_FD;
@@ -4122,6 +4116,152 @@ out:
 }
 
 /**
+ *  ixgbe_fc_autoneg_sgmii_x550em_a - Enable flow control IEEE clause 37
+ *  @hw: pointer to hardware structure
+ *
+ *  Enable flow control according to IEEE clause 37.
+ **/
+void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw)
+{
+	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+	u16 reg, pcs_an_lp, pcs_an;
+	ixgbe_link_speed speed;
+	bool link_up;
+
+	/* AN should have completed when the cable was plugged in.
+	 * Look for reasons to bail out.  Bail out if:
+	 * - FC autoneg is disabled, or if
+	 * - link is not up.
+	 */
+	if (hw->fc.disable_fc_autoneg) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			     "Flow control autoneg is disabled");
+		goto out;
+	}
+
+	hw->mac.ops.check_link(hw, &speed, &link_up, false);
+	if (!link_up) {
+		ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
+		goto out;
+	}
+
+	/* Check if auto-negotiation has completed */
+	status = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_STATUS,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg);
+	if (status != IXGBE_SUCCESS ||
+	    (reg & IXGBE_M88E1500_COPPER_STATUS_AN_DONE) == 0) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+		goto out;
+	}
+
+	/* Get the advertized flow control */
+	status = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_AN,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &pcs_an);
+	if (status != IXGBE_SUCCESS)
+		goto out;
+
+	/* Get link partner's flow control */
+	status = hw->phy.ops.read_reg(hw,
+			IXGBE_M88E1500_COPPER_AN_LP_ABILITY,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &pcs_an_lp);
+	if (status != IXGBE_SUCCESS)
+		goto out;
+
+	/* Negotiate the flow control */
+	status = ixgbe_negotiate_fc(hw, (u32)pcs_an, (u32)pcs_an_lp,
+				    IXGBE_M88E1500_COPPER_AN_PAUSE,
+				    IXGBE_M88E1500_COPPER_AN_AS_PAUSE,
+				    IXGBE_M88E1500_COPPER_AN_LP_PAUSE,
+				    IXGBE_M88E1500_COPPER_AN_LP_AS_PAUSE);
+
+out:
+	if (status == IXGBE_SUCCESS) {
+		hw->fc.fc_was_autonegged = true;
+	} else {
+		hw->fc.fc_was_autonegged = false;
+		hw->fc.current_mode = hw->fc.requested_mode;
+	}
+}
+
+/**
+ *  ixgbe_setup_fc_sgmii_x550em_a - Set up flow control
+ *  @hw: pointer to hardware structure
+ *
+ *  Called at init time to set up flow control.
+ **/
+s32 ixgbe_setup_fc_sgmii_x550em_a(struct ixgbe_hw *hw)
+{
+	u16 reg;
+	s32 rc;
+
+	/* Validate the requested mode */
+	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+		return IXGBE_ERR_INVALID_LINK_SETTINGS;
+	}
+
+	if (hw->fc.requested_mode == ixgbe_fc_default)
+		hw->fc.requested_mode = ixgbe_fc_full;
+
+	/* Read contents of the Auto-Negotiation register, page 0 reg 4 */
+	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_AN,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg);
+	if (rc)
+		goto out;
+
+	/* Disable all the settings related to Flow control Auto-negotiation */
+	reg &= ~IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_PAUSE;
+
+	/* Configure the Asymmetric and symmetric pause according to the user
+	 * requested mode.
+	 */
+	switch (hw->fc.requested_mode) {
+	case ixgbe_fc_full:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+		break;
+	case ixgbe_fc_rx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+		break;
+	case ixgbe_fc_tx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+		break;
+	default:
+		break;
+	}
+
+	/* Write back to the Auto-Negotiation register with newly configured
+	 * fields
+	 */
+	hw->phy.ops.write_reg(hw, IXGBE_M88E1500_COPPER_AN,
+					IXGBE_MDIO_ZERO_DEV_TYPE, reg);
+
+	/* In this section of the code we restart Auto-negotiation */
+
+	/* Read the CONTROL register, Page 0 reg 0 */
+	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_CTRL,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg);
+	if (rc)
+		goto out;
+
+	/* Set the bit to restart Auto-Neg. The bit to enable Auto-neg is ON
+	 * by default
+	 */
+	reg |= IXGBE_M88E1500_COPPER_CTRL_RESTART_AN;
+
+	/* write the new values to the register to restart Auto-Negotiation */
+	hw->phy.ops.write_reg(hw, IXGBE_M88E1500_COPPER_CTRL,
+					IXGBE_MDIO_ZERO_DEV_TYPE, reg);
+
+out:
+	return rc;
+}
+
+/**
  *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control
  *  @hw: pointer to hardware structure
  *
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index db27c84..c7253f0 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -109,8 +109,10 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			      u32 device_type, u16 phy_data);
 s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_sgmii_x550em_a(struct ixgbe_hw *hw);
 void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw);
 void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw);
 s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 				  ixgbe_link_speed speed,
-- 
1.9.3

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

* [dpdk-dev] [PATCH 22/39] net/ixgbe/base: add macros for GENEVE UDP port
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (20 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 21/39] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions Xiao Wang
                   ` (16 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

X550em_a adds GENEVE support by using the upper 16 bits of VXLANCTRL
to store the UDP port (VXLANCTRL.GENEVE_UDP_PORT).

This patch adds definitions that can be used to manipulate the ports
depending on which protocol is being configured.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 262f656..70f684c 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -565,6 +565,13 @@ struct ixgbe_thermal_sensor_data {
 #define IXGBE_PROXYFC	0x05F64 /* Proxying Filter Control Register */
 #define IXGBE_VXLANCTRL	0x0000507C /* Rx filter VXLAN UDPPORT Register */
 
+/* masks for accessing VXLAN and GENEVE UDP ports */
+#define IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK	0x0000ffff /* VXLAN port */
+#define IXGBE_VXLANCTRL_GENEVE_UDPPORT_MASK	0xffff0000 /* GENEVE port */
+#define IXGBE_VXLANCTRL_ALL_UDPPORT_MASK	0xffffffff /* GENEVE/VXLAN */
+
+#define IXGBE_VXLANCTRL_GENEVE_UDPPORT_SHIFT	16
+
 #define IXGBE_FHFT(_n)	(0x09000 + ((_n) * 0x100)) /* Flex host filter table */
 /* Ext Flexible Host Filter Table */
 #define IXGBE_FHFT_EXT(_n)	(0x09800 + ((_n) * 0x100))
@@ -2785,6 +2792,7 @@ enum {
 #define IXGBE_RXDADV_PKTTYPE_UDP	0x00000200 /* UDP hdr present */
 #define IXGBE_RXDADV_PKTTYPE_SCTP	0x00000400 /* SCTP hdr present */
 #define IXGBE_RXDADV_PKTTYPE_NFS	0x00000800 /* NFS hdr present */
+#define IXGBE_RXDADV_PKTTYPE_GENEVE	0x00000800 /* GENEVE hdr present */
 #define IXGBE_RXDADV_PKTTYPE_VXLAN	0x00000800 /* VXLAN hdr present */
 #define IXGBE_RXDADV_PKTTYPE_TUNNEL	0x00010000 /* Tunnel type */
 #define IXGBE_RXDADV_PKTTYPE_IPSEC_ESP	0x00001000 /* IPSec ESP */
-- 
1.9.3

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

* [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (21 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 22/39] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:06   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 24/39] net/ixgbe/base: use default check link function Xiao Wang
                   ` (15 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Do parameter check to prevent exceptional value being written into
register.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 15 ++++++++++++++-
 drivers/net/ixgbe/base/ixgbe_x540.c   |  6 ++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 1c7263d..3c3272e 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -1133,6 +1133,9 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_led_on_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/* To turn on the LED, set mode to ON. */
 	led_reg &= ~IXGBE_LED_MODE_MASK(index);
 	led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index);
@@ -1153,6 +1156,9 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_led_off_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/* To turn off the LED, set mode to OFF. */
 	led_reg &= ~IXGBE_LED_MODE_MASK(index);
 	led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index);
@@ -3341,7 +3347,7 @@ s32 prot_autoc_write_generic(struct ixgbe_hw *hw, u32 reg_val, bool locked)
  **/
 s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw)
 {
-	int secrxreg;
+	u32 secrxreg;
 
 	DEBUGFUNC("ixgbe_enable_sec_rx_path_generic");
 
@@ -3388,6 +3394,9 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_blink_led_start_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/*
 	 * Link must be up to auto-blink the LEDs;
 	 * Force it if link is down.
@@ -3433,6 +3442,10 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_blink_led_stop_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
+
 	ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, &autoc_reg);
 	if (ret_val != IXGBE_SUCCESS)
 		goto out;
diff --git a/drivers/net/ixgbe/base/ixgbe_x540.c b/drivers/net/ixgbe/base/ixgbe_x540.c
index 31dead0..24e9c93 100644
--- a/drivers/net/ixgbe/base/ixgbe_x540.c
+++ b/drivers/net/ixgbe/base/ixgbe_x540.c
@@ -982,6 +982,9 @@ s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_blink_led_start_X540");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/*
 	 * Link should be up in order for the blink bit in the LED control
 	 * register to work. Force link and speed in the MAC if link is down.
@@ -1016,6 +1019,9 @@ s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index)
 	u32 macc_reg;
 	u32 ledctl_reg;
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	DEBUGFUNC("ixgbe_blink_led_stop_X540");
 
 	/* Restore the LED to its default value. */
-- 
1.9.3

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

* [dpdk-dev] [PATCH 24/39] net/ixgbe/base: use default check link function
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (22 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 25/39] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
                   ` (14 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch removes X550em_a specific check link function and use default
ixgbe_check_mac_link_generic for it. It is not necessary to check both the
MAC link register and external PHY registers when checking link.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c |  7 ++++
 drivers/net/ixgbe/base/ixgbe_type.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_x550.c   | 78 ++++-------------------------------
 3 files changed, 16 insertions(+), 70 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 3c3272e..bc12bc1 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -4173,6 +4173,13 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 				*speed = IXGBE_LINK_SPEED_5GB_FULL;
 		}
 		break;
+	case IXGBE_LINKS_SPEED_10_X550EM_A:
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
+		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
+		    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
+			*speed = IXGBE_LINK_SPEED_10_FULL;
+		}
+		break;
 	default:
 		*speed = IXGBE_LINK_SPEED_UNKNOWN;
 	}
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 70f684c..f1e4274 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -2213,6 +2213,7 @@ enum {
 #define IXGBE_LINKS_SPEED_10G_82599	0x30000000
 #define IXGBE_LINKS_SPEED_1G_82599	0x20000000
 #define IXGBE_LINKS_SPEED_100_82599	0x10000000
+#define IXGBE_LINKS_SPEED_10_X550EM_A	0x00000000
 #define IXGBE_LINK_UP_TIME		90 /* 9.0 Seconds */
 #define IXGBE_AUTO_NEG_TIME		45 /* 4.5 Seconds */
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index a9f4d2a..3c19326 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1716,72 +1716,6 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 }
 
 /**
- * ixgbe_check_link_m88 - Poll PHY for link
- * @hw: pointer to hardware structure
- * @speed: pointer to link speed
- * @link_up: true when link is up
- * @link_up_wait: bool indicating whether to wait for link
- *
- * Check that both the MAC and PHY have link.
- */
-static s32
-ixgbe_check_link_m88(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
-		     bool *link_up, bool link_up_wait)
-{
-	u16 reg;
-	s32 rc;
-	u32 i;
-
-	rc = ixgbe_check_mac_link_generic(hw, speed, link_up, link_up_wait);
-	if (rc || !*link_up)
-		return rc;
-
-	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_PHY_SPEC_STATUS, 0, &reg);
-
-	/* MAC link is up, so check external PHY link */
-	*link_up = !!(reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK);
-
-	if (link_up_wait) {
-		for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
-			if (!rc &&
-			    (reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK)) {
-				*link_up = true;
-				break;
-			}
-			*link_up = false;
-			msec_delay(100);
-			rc = hw->phy.ops.read_reg(hw,
-						 IXGBE_M88E1500_PHY_SPEC_STATUS,
-						 0, &reg);
-		}
-	}
-
-#define M88_SPEED(x) (IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED  | \
-		      IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX     | \
-		      ((IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_##x) <<\
-			IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT))
-
-	reg &= M88_SPEED(MASK);
-	switch (reg) {
-	case M88_SPEED(10):
-		*speed = IXGBE_LINK_SPEED_10_FULL;
-		break;
-	case M88_SPEED(100):
-		*speed = IXGBE_LINK_SPEED_100_FULL;
-		break;
-	case M88_SPEED(1000):
-		*speed = IXGBE_LINK_SPEED_1GB_FULL;
-		break;
-	default:
-		*speed = IXGBE_LINK_SPEED_UNKNOWN;
-		break;
-	}
-#undef M88_SPEED
-
-	return rc;
-}
-
-/**
  *  ixgbe_init_mac_link_ops_X550em - init mac link function pointers
  *  @hw: pointer to hardware structure
  */
@@ -1811,10 +1745,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
 				ixgbe_setup_mac_link_sfp_x550em;
 		break;
 	case ixgbe_media_type_copper:
-		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
-		    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
-			mac->ops.setup_link = ixgbe_setup_sgmii_m88;
-			mac->ops.check_link = ixgbe_check_link_m88;
+		if (hw->mac.type == ixgbe_mac_X550EM_a) {
+			if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
+			    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
+				mac->ops.setup_link = ixgbe_setup_sgmii_m88;
+			} else {
+				mac->ops.setup_link =
+						  ixgbe_setup_mac_link_t_X550em;
+			}
 		} else {
 			mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
 			mac->ops.check_link = ixgbe_check_link_t_X550em;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 25/39] net/ixgbe/base: set default autoneg speed at reset
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (23 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 24/39] net/ixgbe/base: use default check link function Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 26/39] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
                   ` (13 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch avoids the situation where we initialize adapter and not
yet set up phy.autoneg_advertised speeds. In that case we could end
up in having no autoneg speeds enabled and get no link until we
reset link and set autoneg speeds correctly.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 3c19326..32759cc 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -2283,6 +2283,12 @@ STATIC s32 ixgbe_reset_phy_m88(struct ixgbe_hw *hw)
 
 	hw->mac.ops.release_swfw_sync(hw, mask);
 
+	/* In case of first reset set advertised speeds to default value */
+	if (!hw->phy.autoneg_advertised)
+		hw->phy.autoneg_advertised = IXGBE_LINK_SPEED_1GB_FULL |
+					     IXGBE_LINK_SPEED_100_FULL |
+					     IXGBE_LINK_SPEED_10_FULL;
+
 	return ixgbe_setup_m88(hw);
 
 out:
-- 
1.9.3

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

* [dpdk-dev] [PATCH 26/39] net/ixgbe/base: add missing FDIRSCTPM mask setting
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (24 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 25/39] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 27/39] net/ixgbe/base: commonize mailbox write and read Xiao Wang
                   ` (12 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch adds missing FDIRSCTPM mask setting for tunneled packets.
It should be set the same way as FDIRTCPM and FDIRUDPM so that SCTP
packets can be filtered correctly.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_82599.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_82599.c b/drivers/net/ixgbe/base/ixgbe_82599.c
index 5bc7c2b..832242e 100644
--- a/drivers/net/ixgbe/base/ixgbe_82599.c
+++ b/drivers/net/ixgbe/base/ixgbe_82599.c
@@ -1178,6 +1178,7 @@ mac_reset_top:
 	if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
 		/* Save the SAN MAC RAR index */
 		hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
+
 		hw->mac.ops.set_rar(hw, hw->mac.san_mac_rar_index,
 				    hw->mac.san_addr, 0, IXGBE_RAH_AV);
 
@@ -1809,14 +1810,23 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,
 		}
 		IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIP6M, fdirip6m);
 
-		/* Set all bits in FDIRTCPM, FDIRUDPM, FDIRSIP4M and
-		 * FDIRDIP4M in cloud mode to allow L3/L3 packets to
-		 * tunnel.
+		/* Set all bits in FDIRTCPM, FDIRUDPM, FDIRSCTPM,
+		 * FDIRSIP4M and FDIRDIP4M in cloud mode to allow
+		 * L3/L3 packets to tunnel.
 		 */
 		IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
 		IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
 		IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
 		IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+		switch (hw->mac.type) {
+		case ixgbe_mac_X550:
+		case ixgbe_mac_X550EM_x:
+		case ixgbe_mac_X550EM_a:
+			IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+			break;
+		default:
+			break;
+		}
 	}
 
 	/* Now mask VM pool and destination IPv6 - bits 5 and 2 */
-- 
1.9.3

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

* [dpdk-dev] [PATCH 27/39] net/ixgbe/base: commonize mailbox write and read
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (25 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 26/39] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 28/39] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
                   ` (11 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

ixgbevf_write_msg_read_ack() is now performing mailbox write and read,
so this patch use this function to commonize mailbox write and read.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index f60ff7d..919b975 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -346,7 +346,6 @@ STATIC s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,
 s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
 		     u32 enable_addr)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[3];
 	u8 *msg_addr = (u8 *)(&msgbuf[1]);
 	s32 ret_val;
@@ -355,10 +354,7 @@ s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
 	memset(msgbuf, 0, 12);
 	msgbuf[0] = IXGBE_VF_SET_MAC_ADDR;
 	memcpy(msg_addr, addr, 6);
-	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
-
-	if (!ret_val)
-		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
+	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
 
 	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
@@ -429,7 +425,6 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
  **/
 s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[2];
 	s32 err;
 
@@ -444,11 +439,7 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
 	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
 	msgbuf[1] = xcast_mode;
 
-	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
-	if (err)
-		return err;
-
-	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
+	err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
 	if (err)
 		return err;
 
@@ -465,11 +456,12 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
  *  @vind: unused by VF drivers
  *  @vlan_on: if true then set bit, else clear bit
  *  @vlvf_bypass: boolean flag indicating updating default pool is okay
+ *
+ *  Turn on/off specified VLAN in the VLAN filter table.
  **/
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		      bool vlan_on, bool vlvf_bypass)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[2];
 	s32 ret_val;
 	UNREFERENCED_2PARAMETER(vind, vlvf_bypass);
@@ -479,10 +471,7 @@ s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 	/* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
 	msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
 
-	ret_val = mbx->ops.write_posted(hw, msgbuf, 2, 0);
-	if (!ret_val)
-		ret_val = mbx->ops.read_posted(hw, msgbuf, 1, 0);
-
+	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
 	if (!ret_val && (msgbuf[0] & IXGBE_VT_MSGTYPE_ACK))
 		return IXGBE_SUCCESS;
 
@@ -697,11 +686,8 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api)
 	msg[0] = IXGBE_VF_API_NEGOTIATE;
 	msg[1] = api;
 	msg[2] = 0;
-	err = hw->mbx.ops.write_posted(hw, msg, 3, 0);
-
-	if (!err)
-		err = hw->mbx.ops.read_posted(hw, msg, 3, 0);
 
+	err = ixgbevf_write_msg_read_ack(hw, msg, msg, 3);
 	if (!err) {
 		msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
@@ -736,11 +722,8 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 	/* Fetch queue configuration from the PF */
 	msg[0] = IXGBE_VF_GET_QUEUES;
 	msg[1] = msg[2] = msg[3] = msg[4] = 0;
-	err = hw->mbx.ops.write_posted(hw, msg, 5, 0);
-
-	if (!err)
-		err = hw->mbx.ops.read_posted(hw, msg, 5, 0);
 
+	err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5);
 	if (!err) {
 		msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH 28/39] net/ixgbe/base: reduce delay for SWFW semaphore
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (26 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 27/39] net/ixgbe/base: commonize mailbox write and read Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
                   ` (10 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch reduces the SWFW semaphore/PHY Token retry delay.

ixgbe_release_swfw_sync_X540: Reduce 5 ms delay after releasing
semaphore to 2 ms. HW team indicated 1 ms delay would be sufficient
for FW access.

ixgbe_acquire_swfw_sync_X540: Remove 5 ms delay after acquiring
semaphore.

ixgbe_acquire_swfw_sync_X550a: Remove 5 ms delay since there are
two 2 ms delays in the semaphore release flow.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x540.c | 4 ++--
 drivers/net/ixgbe/base/ixgbe_x550.c | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x540.c b/drivers/net/ixgbe/base/ixgbe_x540.c
index 24e9c93..6e778bc 100644
--- a/drivers/net/ixgbe/base/ixgbe_x540.c
+++ b/drivers/net/ixgbe/base/ixgbe_x540.c
@@ -271,6 +271,7 @@ mac_reset_top:
 	if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
 		/* Save the SAN MAC RAR index */
 		hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
+
 		hw->mac.ops.set_rar(hw, hw->mac.san_mac_rar_index,
 				    hw->mac.san_addr, 0, IXGBE_RAH_AV);
 
@@ -783,7 +784,6 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
 			IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw),
 					swfw_sync);
 			ixgbe_release_swfw_sync_semaphore(hw);
-			msec_delay(5);
 			return IXGBE_SUCCESS;
 		}
 		/* Firmware currently using resource (fwmask), hardware
@@ -860,7 +860,7 @@ void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
 	IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw), swfw_sync);
 
 	ixgbe_release_swfw_sync_semaphore(hw);
-	msec_delay(5);
+	msec_delay(2);
 }
 
 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 32759cc..f2e885c 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -4523,7 +4523,6 @@ STATIC s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask)
 			ixgbe_release_swfw_sync_X540(hw, hmask);
 		if (status != IXGBE_ERR_TOKEN_RETRY)
 			return status;
-		msec_delay(FW_PHY_TOKEN_DELAY);
 	}
 
 	return status;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (27 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 28/39] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:07   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 30/39] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
                   ` (9 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Make sure ixgbe_device_supports_autoneg_fc() returns true for the device
IDs of Seabrook and Shady Acres.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index bc12bc1..9776ab9 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -189,6 +189,8 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 		case IXGBE_DEV_ID_X550T1:
 		case IXGBE_DEV_ID_X550EM_X_10G_T:
 		case IXGBE_DEV_ID_X550EM_A_10G_T:
+		case IXGBE_DEV_ID_X550EM_A_1G_T:
+		case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 			supported = true;
 			break;
 		default:
-- 
1.9.3

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

* [dpdk-dev] [PATCH 30/39] net/ixgbe/base: remove X550em_a 100Mbps support
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (28 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 31/39] net/ixgbe/base: unify link speed value Xiao Wang
                   ` (8 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

X550em_a only supports 10G/1G link.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index ee8618f..43c55d7 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -944,6 +944,7 @@ static s32 ixgbe_get_copper_speeds_supported(struct ixgbe_hw *hw)
 		hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL;
 		break;
 	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
 		hw->phy.speeds_supported &= ~IXGBE_LINK_SPEED_100_FULL;
 		break;
 	default:
-- 
1.9.3

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

* [dpdk-dev] [PATCH 31/39] net/ixgbe/base: unify link speed value
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (29 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 30/39] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 32/39] net/ixgbe/base: separate ops init from PHY init Xiao Wang
                   ` (7 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch changes the value of IXGBE_LINK_SPEED_10_FULL from 4 to 2,
as 4 is reserved to 100Mbit Half Duplex in E1000 shared code.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index f1e4274..a3cc5e2 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3319,7 +3319,7 @@ typedef u32 ixgbe_autoneg_advertised;
 /* Link speed */
 typedef u32 ixgbe_link_speed;
 #define IXGBE_LINK_SPEED_UNKNOWN	0
-#define IXGBE_LINK_SPEED_10_FULL	0x0004
+#define IXGBE_LINK_SPEED_10_FULL	0x0002
 #define IXGBE_LINK_SPEED_100_FULL	0x0008
 #define IXGBE_LINK_SPEED_1GB_FULL	0x0020
 #define IXGBE_LINK_SPEED_2_5GB_FULL	0x0400
-- 
1.9.3

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

* [dpdk-dev] [PATCH 32/39] net/ixgbe/base: separate ops init from PHY init
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (30 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 31/39] net/ixgbe/base: unify link speed value Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
                   ` (6 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch moves PHY ops pointers initialization to
ixgbe_init_phy_ops_X550em and PHY identifying/initializing
to ixgbe_identify_phy_x550em.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 39 ++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index f2e885c..19a554d 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
 STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed);
 STATIC s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
 STATIC void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
+STATIC s32 ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw);
 
 /**
  *  ixgbe_init_ops_X550 - Inits func ptrs and MAC type
@@ -428,18 +429,15 @@ STATIC s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 {
+	hw->mac.ops.set_lan_id(hw);
+
+	ixgbe_read_mng_if_sel_x550em(hw);
+
 	switch (hw->device_id) {
 	case IXGBE_DEV_ID_X550EM_A_SFP:
-		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
-		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
-		if (hw->bus.lan_id)
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
-		else
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
 		return ixgbe_identify_module_generic(hw);
 	case IXGBE_DEV_ID_X550EM_X_SFP:
 		/* set up for CS4227 usage */
-		hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
 		ixgbe_setup_mux_ctl(hw);
 		ixgbe_check_cs4227(hw);
 		/* Fallthrough */
@@ -456,9 +454,6 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 		hw->phy.type = ixgbe_phy_x550em_kr;
 		break;
 	case IXGBE_DEV_ID_X550EM_A_10G_T:
-		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
-		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
-       /* Fallthrough to ixgbe_identify_phy_generic */
 	case IXGBE_DEV_ID_X550EM_A_1G_T:
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 	case IXGBE_DEV_ID_X550EM_X_1G_T:
@@ -2339,10 +2334,6 @@ 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);
@@ -2354,6 +2345,26 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
 		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
+		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
+		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
+		if (hw->bus.lan_id)
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
+		else
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
+
+		break;
+	case IXGBE_DEV_ID_X550EM_A_10G_T:
+	case IXGBE_DEV_ID_X550EM_A_SFP:
+		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
+		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
+		if (hw->bus.lan_id)
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
+		else
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
+		break;
+	case IXGBE_DEV_ID_X550EM_X_SFP:
+		/* set up for CS4227 usage */
+		hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
 		break;
 	default:
 		break;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (31 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 32/39] net/ixgbe/base: separate ops init from PHY init Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:07   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 34/39] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
                   ` (5 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch adds X550em_a FW ALEF support for B0 per DCR 64. ALEF is
the new unified FW. The driver uses the KRM_PMD_RX_FLEX_PORT/
FLX_MASK_ST20 registers to configure the lane mode.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |  16 +++
 drivers/net/ixgbe/base/ixgbe_x550.c | 223 ++++++++++++++++++++++++++----------
 2 files changed, 180 insertions(+), 59 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index a3cc5e2..92c3e24 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4162,9 +4162,25 @@ struct ixgbe_hw {
 #define IXGBE_KRM_DSP_TXFFE_STATE_5(P)	((P) ? 0x8638 : 0x4638)
 #define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)	((P) ? 0x8B00 : 0x4B00)
 #define IXGBE_KRM_PMD_DFX_BURNIN(P)	((P) ? 0x8E00 : 0x4E00)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20(P)	((P) ? 0x9054 : 0x5054)
 #define IXGBE_KRM_TX_COEFF_CTRL_1(P)	((P) ? 0x9520 : 0x5520)
 #define IXGBE_KRM_RX_ANA_CTL(P)		((P) ? 0x9A00 : 0x5A00)
 
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA		~(0x3 << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR		(1u << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_LR		(0x2 << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN		(1u << 25)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN		(1u << 26)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN		(1u << 27)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10M		~(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_100M		(1u << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G		(0x2 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10G		(0x3 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN		(0x4 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_2_5G		(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK		(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_FW_AN_RESTART	(1u << 31)
+
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B		(1 << 9)
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS		(1 << 11)
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 19a554d..0cc7a3f 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1607,6 +1607,53 @@ s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw)
 }
 
 /**
+*  ixgbe_restart_an_internal_phy_x550em - restart autonegotiation for the
+*  internal PHY
+*  @hw: pointer to hardware structure
+**/
+STATIC s32 ixgbe_restart_an_internal_phy_x550em(struct ixgbe_hw *hw)
+{
+	s32 status;
+	u32 link_ctrl;
+
+	/* Restart auto-negotiation. */
+	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_ctrl);
+
+	if (status) {
+		DEBUGOUT("Auto-negotiation did not complete\n");
+		return status;
+	}
+
+	link_ctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	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_ctrl);
+
+	if (hw->mac.type == ixgbe_mac_X550EM_a) {
+		u32 flx_mask_st20;
+
+		/* Indicate to FW that AN restart has been asserted */
+		status = hw->mac.ops.read_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &flx_mask_st20);
+
+		if (status) {
+			DEBUGOUT("Auto-negotiation did not complete\n");
+			return status;
+		}
+
+		flx_mask_st20 |= IXGBE_KRM_PMD_FLX_MASK_ST20_FW_AN_RESTART;
+		status = hw->mac.ops.write_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, flx_mask_st20);
+	}
+
+	return status;
+}
+
+/**
  * ixgbe_setup_sgmii - Set up link for sgmii
  * @hw: pointer to hardware structure
  */
@@ -1614,7 +1661,7 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 			     bool autoneg_wait)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
-	u32 lval, sval;
+	u32 lval, sval, flx_val;
 	s32 rc;
 
 	rc = mac->ops.read_iosf_sb_reg(hw,
@@ -1648,10 +1695,25 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	if (rc)
 		return rc;
 
-	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, &flx_val);
+	if (rc)
+		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_AN_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+
 	rc = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, flx_val);
+	if (rc)
+		return rc;
+
+	rc = ixgbe_restart_an_internal_phy_x550em(hw);
 	if (rc)
 		return rc;
 
@@ -1666,7 +1728,7 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 				 bool autoneg_wait)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
-	u32 lval, sval;
+	u32 lval, sval, flx_val;
 	s32 rc;
 
 	rc = mac->ops.read_iosf_sb_reg(hw,
@@ -1700,13 +1762,32 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	if (rc)
 		return rc;
 
-	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
 	rc = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
 	if (rc)
 		return rc;
 
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, &flx_val);
+	if (rc)
+		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_AN_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+
+	rc = mac->ops.write_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, flx_val);
+	if (rc)
+		return rc;
+
+	rc = ixgbe_restart_an_internal_phy_x550em(hw);
+
 	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
 }
 
@@ -2024,13 +2105,24 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 	if (speed & IXGBE_LINK_SPEED_1GB_FULL)
 		reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KX;
 
-	/* Restart auto-negotiation. */
-	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
 		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
-	return status;
+	if (status)
+		return status;
+
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
+	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
+	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+
+	status = hw->mac.ops.write_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+
+	return ixgbe_restart_an_internal_phy_x550em(hw);
 }
 
 /**
@@ -2662,6 +2754,55 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 }
 
 /**
+ *  ixgbe_setup_sfi_x550a - Configure the internal PHY for native SFI mode
+ *  @hw: pointer to hardware structure
+ *  @speed: the link speed to force
+ *
+ *  Configures the integrated PHY for native SFI mode. Used to connect the
+ *  internal PHY directly to an SFP cage, without autonegotiation.
+ **/
+STATIC s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 status;
+	u32 reg_val;
+
+	/* Disable all AN and force speed to 10G Serial. */
+	status = mac->ops.read_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+	if (status != IXGBE_SUCCESS)
+		return status;
+
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
+
+	/* Select forced link speed for internal PHY. */
+	switch (*speed) {
+	case IXGBE_LINK_SPEED_10GB_FULL:
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10G;
+		break;
+	case IXGBE_LINK_SPEED_1GB_FULL:
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G;
+		break;
+	default:
+		/* Other link speeds are not supported by internal PHY. */
+		return IXGBE_ERR_LINK_SETUP;
+	}
+
+	status = mac->ops.write_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+
+	/* Toggle port SW reset by AN reset. */
+	status = ixgbe_restart_an_internal_phy_x550em(hw);
+
+	return status;
+}
+
+/**
  *  ixgbe_setup_mac_link_sfp_x550a - Setup internal PHY for SFP
  *  @hw: pointer to hardware structure
  *
@@ -2691,31 +2832,27 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 		return ret_val;
 
 	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP_N) {
-		/* Configure internal PHY for native SFI */
+		/* Configure internal PHY for native SFI based on module type */
 		ret_val = hw->mac.ops.read_iosf_sb_reg(hw,
-			       IXGBE_KRM_AN_CNTL_8(hw->bus.lan_id),
-			       IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_phy_int);
+				   IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				   IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_phy_int);
 
 		if (ret_val != IXGBE_SUCCESS)
 			return ret_val;
 
-		if (setup_linear) {
-			reg_phy_int &= ~IXGBE_KRM_AN_CNTL_8_LIMITING;
-			reg_phy_int |= IXGBE_KRM_AN_CNTL_8_LINEAR;
-		} else {
-			reg_phy_int |= IXGBE_KRM_AN_CNTL_8_LIMITING;
-			reg_phy_int &= ~IXGBE_KRM_AN_CNTL_8_LINEAR;
-		}
+		reg_phy_int &= IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA;
+		if (!setup_linear)
+			reg_phy_int |= IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR;
 
 		ret_val = hw->mac.ops.write_iosf_sb_reg(hw,
-				IXGBE_KRM_AN_CNTL_8(hw->bus.lan_id),
-				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_phy_int);
+				   IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				   IXGBE_SB_IOSF_TARGET_KR_PHY, reg_phy_int);
 
 		if (ret_val != IXGBE_SUCCESS)
 			return ret_val;
 
-		/* Setup XFI/SFI internal link. */
-		ret_val = ixgbe_setup_ixfi_x550em(hw, &speed);
+		/* Setup SFI internal link. */
+		ret_val = ixgbe_setup_sfi_x550a(hw, &speed);
 	} else {
 		/* Configure internal PHY for KR/KX. */
 		ixgbe_setup_kr_speed_x550em(hw, speed);
@@ -2874,15 +3011,7 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	}
 
 	/* Toggle port SW reset by AN reset. */
-	status = mac->ops.read_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
-	if (status != IXGBE_SUCCESS)
-		return status;
-	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	status = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+	status = ixgbe_restart_an_internal_phy_x550em(hw);
 
 	return status;
 }
@@ -4225,7 +4354,7 @@ out:
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 {
 	s32 status = IXGBE_SUCCESS;
-	u32 an_cntl, link_ctrl = 0;
+	u32 an_cntl = 0;
 
 	DEBUGFUNC("ixgbe_setup_fc_backplane_x550em_a");
 
@@ -4299,19 +4428,7 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 				       IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
 
 	/* Restart auto-negotiation. */
-	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_ctrl);
-
-	if (status != IXGBE_SUCCESS) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		return status;
-	}
-
-	link_ctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	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_ctrl);
+	status = ixgbe_restart_an_internal_phy_x550em(hw);
 
 	return status;
 }
@@ -4425,19 +4542,7 @@ s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw)
 					   IXGBE_SB_IOSF_TARGET_KR_PHY, pcs_an);
 
 	/* Restart auto-negotiation. */
-	rc = hw->mac.ops.read_iosf_sb_reg(hw,
-					  IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					  IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
-
-	if (rc) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		return rc;
-	}
-
-	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	rc = hw->mac.ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
+	rc = ixgbe_restart_an_internal_phy_x550em(hw);
 
 	return rc;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 34/39] net/ixgbe/base: add two MAC ops for Hyper-V
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (32 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
                   ` (4 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

This patch adds negotiate_api_version and set_rlpml into mac_ops, with the
introduction of Hyper-V functionality, we can have separate functions to
accommodate different implementations without breaking the other.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 2 ++
 drivers/net/ixgbe/base/ixgbe_vf.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 92c3e24..13c520e 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3854,6 +3854,7 @@ struct ixgbe_mac_operations {
 	void (*init_swfw_sync)(struct ixgbe_hw *);
 	s32 (*prot_autoc_read)(struct ixgbe_hw *, bool *, u32 *);
 	s32 (*prot_autoc_write)(struct ixgbe_hw *, u32, bool);
+	s32 (*negotiate_api_version)(struct ixgbe_hw *hw, int api);
 
 	/* Link */
 	void (*disable_tx_laser)(struct ixgbe_hw *);
@@ -3898,6 +3899,7 @@ struct ixgbe_mac_operations {
 	void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
 	void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
 	s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
+	s32 (*set_rlpml)(struct ixgbe_hw *, u16);
 
 	/* Flow Control */
 	s32 (*fc_enable)(struct ixgbe_hw *);
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 919b975..e9c13f2 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -64,6 +64,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	hw->mac.ops.get_mac_addr = ixgbe_get_mac_addr_vf;
 	hw->mac.ops.stop_adapter = ixgbe_stop_adapter_vf;
 	hw->mac.ops.get_bus_info = NULL;
+	hw->mac.ops.negotiate_api_version = ixgbevf_negotiate_api_version;
 
 	/* Link */
 	hw->mac.ops.setup_link = ixgbe_setup_mac_link_vf;
@@ -80,6 +81,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	hw->mac.ops.disable_mc = NULL;
 	hw->mac.ops.clear_vfta = NULL;
 	hw->mac.ops.set_vfta = ixgbe_set_vfta_vf;
+	hw->mac.ops.set_rlpml = ixgbevf_rlpml_set_vf;
 
 	hw->mac.max_tx_queues = 1;
 	hw->mac.max_rx_queues = 1;
-- 
1.9.3

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

* [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (33 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 34/39] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:08   ` Ferruh Yigit
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 36/39] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
                   ` (3 subsequent siblings)
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

The semaphore is not being held for complete shadow RAM accesses
which could result in corruption. Refactor the code so that it is
possible to hold the semaphore around ixgbe_host_interface_command
by introducing an unlocked form. This patch also eliminates the
function ixgbe_read_ee_hostif_data_X550 in favor of the function
ixgbe_read_ee_hostif_X550 and it now gets both semaphore bits
at once instead of nesting them. The new arrangement is able to
get both the management interface and the EEPROM semaphores at the
same time instead of separately.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 106 ++++++++++++++++++++++------------
 drivers/net/ixgbe/base/ixgbe_common.h |   3 +-
 drivers/net/ixgbe/base/ixgbe_x550.c   |  57 +++++-------------
 drivers/net/ixgbe/base/ixgbe_x550.h   |   2 -
 4 files changed, 88 insertions(+), 80 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 9776ab9..d31fb81 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -1066,7 +1066,7 @@ void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw)
 	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP) {
 		hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_4, &ee_ctrl_4);
 		bus->instance_id = (ee_ctrl_4 & IXGBE_EE_CTRL_4_INST_ID) >>
-			IXGBE_EE_CTRL_4_INST_ID_SHIFT;
+				   IXGBE_EE_CTRL_4_INST_ID_SHIFT;
 	}
 }
 
@@ -2877,7 +2877,7 @@ out:
  *  advertised settings
  **/
 s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
-			      u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
+		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
 {
 	if ((!(adv_reg)) ||  (!(lp_reg))) {
 		ERROR_REPORT3(IXGBE_ERROR_UNSUPPORTED,
@@ -3920,7 +3920,8 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 	vfta_delta = 1 << (vlan % 32);
 	vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx));
 
-	/* vfta_delta represents the difference between the current value
+	/*
+	 * vfta_delta represents the difference between the current value
 	 * of vfta and the value we want in the register.  Since the diff
 	 * is an XOR mask we can just update the vfta using an XOR
 	 */
@@ -3953,7 +3954,7 @@ vfta_update:
  *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
  *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
  *  @vfta_delta: pointer to the difference between the current value of VFTA
- * and the desired value
+ *		 and the desired value
  *  @vfta: the desired value of the VFTA
  *  @vlvf_bypass: boolean flag indicating updating default pool is okay
  *
@@ -3980,6 +3981,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 	 */
 	if (!(IXGBE_READ_REG(hw, IXGBE_VT_CTL) & IXGBE_VT_CTL_VT_ENABLE))
 		return IXGBE_SUCCESS;
+
 	vlvf_index = ixgbe_find_vlvf_slot(hw, vlan, vlvf_bypass);
 	if (vlvf_index < 0)
 		return vlvf_index;
@@ -4009,6 +4011,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 
 		return IXGBE_SUCCESS;
 	}
+
 	/* If there are still bits set in the VLVFB registers
 	 * for the VLAN ID indicated we need to see if the
 	 * caller is requesting that we clear the VFTA entry bit.
@@ -4413,43 +4416,31 @@ u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
 }
 
 /**
- *  ixgbe_host_interface_command - Issue command to manageability block
+ *  ixgbe_hic_unlocked - Issue command to manageability block unlocked
  *  @hw: pointer to the HW structure
- *  @buffer: contains the command to write and where the return status will
- *   be placed
+ *  @buffer: command to write and where the return status will be placed
  *  @length: length of buffer, must be multiple of 4 bytes
  *  @timeout: time in ms to wait for command completion
- *  @return_data: read and return data from the buffer (true) or not (false)
- *   Needed because FW structures are big endian and decoding of
- *   these fields can be 8 bit or 16 bit based on command. Decoding
- *   is not easily understood without making a table of commands.
- *   So we will leave this up to the caller to read back the data
- *   in these cases.
  *
  *  Communicates with the manageability block. On success return IXGBE_SUCCESS
  *  else returns semaphore error when encountering an error acquiring
  *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
+ *
+ *  This function assumes that the IXGBE_GSSR_SW_MNG_SM semaphore is held
+ *  by the caller.
  **/
-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 *hw, u32 *buffer, u32 length,
+		       u32 timeout)
 {
-	u32 hicr, i, bi, fwsts;
-	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
-	u16 buf_len;
+	u32 hicr, i, fwsts;
 	u16 dword_len;
-	s32 status;
 
-	DEBUGFUNC("ixgbe_host_interface_command");
+	DEBUGFUNC("ixgbe_hic_unlocked");
 
-	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
+	if (!length || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
 		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
 		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
 	}
-	/* Take management host interface semaphore */
-	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
-
-	if (status)
-		return status;
 
 	/* Set bit 9 of FWSTS clearing FW reset indication */
 	fwsts = IXGBE_READ_REG(hw, IXGBE_FWSTS);
@@ -4457,17 +4448,15 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 
 	/* Check that the host interface is enabled. */
 	hicr = IXGBE_READ_REG(hw, IXGBE_HICR);
-	if ((hicr & IXGBE_HICR_EN) == 0) {
+	if (!(hicr & IXGBE_HICR_EN)) {
 		DEBUGOUT("IXGBE_HOST_EN bit disabled.\n");
-		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
-		goto rel_out;
+		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
 	}
 
 	/* Calculate length in DWORDs. We must be DWORD aligned */
-	if ((length % (sizeof(u32))) != 0) {
+	if (length % sizeof(u32)) {
 		DEBUGOUT("Buffer length failure, not aligned to dword");
-		status = IXGBE_ERR_INVALID_ARGUMENT;
-		goto rel_out;
+		return IXGBE_ERR_INVALID_ARGUMENT;
 	}
 
 	dword_len = length >> 2;
@@ -4490,14 +4479,59 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	}
 
 	/* Check command completion */
-	if ((timeout != 0 && i == timeout) ||
+	if ((timeout && i == timeout) ||
 	    !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) {
 		ERROR_REPORT1(IXGBE_ERROR_CAUTION,
 			     "Command has failed with no status valid.\n");
-		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
-		goto rel_out;
+		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
+	}
+
+	return IXGBE_SUCCESS;
+}
+
+/**
+ *  ixgbe_host_interface_command - Issue command to manageability block
+ *  @hw: pointer to the HW structure
+ *  @buffer: contains the command to write and where the return status will
+ *   be placed
+ *  @length: length of buffer, must be multiple of 4 bytes
+ *  @timeout: time in ms to wait for command completion
+ *  @return_data: read and return data from the buffer (true) or not (false)
+ *   Needed because FW structures are big endian and decoding of
+ *   these fields can be 8 bit or 16 bit based on command. Decoding
+ *   is not easily understood without making a table of commands.
+ *   So we will leave this up to the caller to read back the data
+ *   in these cases.
+ *
+ *  Communicates with the manageability block. On success return IXGBE_SUCCESS
+ *  else returns semaphore error when encountering an error acquiring
+ *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
+ **/
+s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
+				 u32 length, u32 timeout, bool return_data)
+{
+	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
+	u16 dword_len;
+	u16 buf_len;
+	s32 status;
+	u32 bi;
+
+	DEBUGFUNC("ixgbe_host_interface_command");
+
+	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
+		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
+		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
 	}
 
+	/* Take management host interface semaphore */
+	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
+	if (status)
+		return status;
+
+	status = ixgbe_hic_unlocked(hw, buffer, length, timeout);
+	if (status)
+		goto rel_out;
+
 	if (!return_data)
 		goto rel_out;
 
@@ -4512,7 +4546,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 
 	/* If there is any thing in data position pull it in */
 	buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len;
-	if (buf_len == 0)
+	if (!buf_len)
 		goto rel_out;
 
 	if (length < buf_len + hdr_size) {
diff --git a/drivers/net/ixgbe/base/ixgbe_common.h b/drivers/net/ixgbe/base/ixgbe_common.h
index 0545f85..66dd565 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.h
+++ b/drivers/net/ixgbe/base/ixgbe_common.h
@@ -133,7 +133,7 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
 s32 ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, u8 *addr, u32 vmdq);
 s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
 s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
-			   u32 vind, bool vlan_on, bool vlvf_bypass);
+			 u32 vind, bool vlan_on, bool vlvf_bypass);
 s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 			   bool vlan_on, u32 *vfta_delta, u32 vfta,
 			   bool vlvf_bypass);
@@ -159,6 +159,7 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
 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);
 
 void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 0cc7a3f..6f4dfd9 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -3192,13 +3192,13 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
  *
  *  Reads a 16 bit word from the EEPROM using the hostif.
  **/
-s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
-				   u16 *data)
+s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data)
 {
-	s32 status;
+	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
 	struct ixgbe_hic_read_shadow_ram buffer;
+	s32 status;
 
-	DEBUGFUNC("ixgbe_read_ee_hostif_data_X550");
+	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
 	buffer.hdr.req.cmd = FW_READ_SHADOW_RAM_CMD;
 	buffer.hdr.req.buf_lenh = 0;
 	buffer.hdr.req.buf_lenl = FW_READ_SHADOW_RAM_LEN;
@@ -3209,42 +3209,18 @@ s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
 	/* one word */
 	buffer.length = IXGBE_CPU_TO_BE16(sizeof(u16));
 
-	status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
-					      sizeof(buffer),
-					      IXGBE_HI_COMMAND_TIMEOUT, false);
-
+	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (status)
 		return status;
 
-	*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
-					  FW_NVM_DATA_OFFSET);
-
-	return 0;
-}
-
-/**
- *  ixgbe_read_ee_hostif_X550 - Read EEPROM word using a host interface command
- *  @hw: pointer to hardware structure
- *  @offset: offset of  word in the EEPROM to read
- *  @data: word read from the EEPROM
- *
- *  Reads a 16 bit word from the EEPROM using the hostif.
- **/
-s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
-			      u16 *data)
-{
-	s32 status = IXGBE_SUCCESS;
-
-	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
-
-	if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
-	    IXGBE_SUCCESS) {
-		status = ixgbe_read_ee_hostif_data_X550(hw, offset, data);
-		hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
-	} else {
-		status = IXGBE_ERR_SWFW_SYNC;
+	status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
+				    IXGBE_HI_COMMAND_TIMEOUT);
+	if (!status) {
+		*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
+						  FW_NVM_DATA_OFFSET);
 	}
 
+	hw->mac.ops.release_swfw_sync(hw, mask);
 	return status;
 }
 
@@ -3260,6 +3236,7 @@ s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
 s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 				     u16 offset, u16 words, u16 *data)
 {
+	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
 	struct ixgbe_hic_read_shadow_ram buffer;
 	u32 current_word = 0;
 	u16 words_to_read;
@@ -3269,7 +3246,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 	DEBUGFUNC("ixgbe_read_ee_hostif_buffer_X550");
 
 	/* Take semaphore for the entire operation. */
-	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
+	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (status) {
 		DEBUGOUT("EEPROM read buffer - semaphore failed\n");
 		return status;
@@ -3289,10 +3266,8 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 		buffer.address = IXGBE_CPU_TO_BE32((offset + current_word) * 2);
 		buffer.length = IXGBE_CPU_TO_BE16(words_to_read * 2);
 
-		status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
-						      sizeof(buffer),
-						      IXGBE_HI_COMMAND_TIMEOUT,
-						      false);
+		status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
+					    IXGBE_HI_COMMAND_TIMEOUT);
 
 		if (status) {
 			DEBUGOUT("Host interface command failed\n");
@@ -3317,7 +3292,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 	}
 
 out:
-	hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
+	hw->mac.ops.release_swfw_sync(hw, mask);
 	return status;
 }
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index c7253f0..36b36f6 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -55,8 +55,6 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 				     u16 offset, u16 words, u16 *data);
 s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
 u16				*data);
-s32 ixgbe_read_ee_hostif_data_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);
-- 
1.9.3

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

* [dpdk-dev] [PATCH 36/39] net/ixgbe/base: update X550em_a backplane speed
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (34 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 37/39] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
                   ` (2 subsequent siblings)
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Correct link flow for X550em_a backplane with ALEF.

Report the correct link capabilities:
   SKUs configured for 2.5G only support 2.5G.
   non-10G SKUs can only support 2.5 or 1G.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |  5 +++++
 drivers/net/ixgbe/base/ixgbe_x550.c | 37 +++++++++++++++++++++++++++++--------
 2 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 13c520e..4982e03 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4252,6 +4252,11 @@ struct ixgbe_hw {
 #define IXGBE_NW_MNG_IF_SEL_MDIO_ACT	(1u << 1)
 #define IXGBE_NW_MNG_IF_SEL_MDIO_IF_MODE	(1u << 2)
 #define IXGBE_NW_MNG_IF_SEL_EN_SHARED_MDIO	(1u << 13)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_10M	(1u << 17)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_100M	(1u << 18)
+#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_MDIO_PHY_ADD_SHIFT 3
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 6f4dfd9..8c2479b 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1887,6 +1887,20 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 		case ixgbe_phy_sgmii:
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
 			break;
+		case ixgbe_phy_x550em_kr:
+			if (hw->mac.type == ixgbe_mac_X550EM_a) {
+				/* check different backplane modes */
+				if (hw->phy.nw_mng_if_sel &
+					   IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G) {
+					*speed = IXGBE_LINK_SPEED_2_5GB_FULL;
+					break;
+				} else if (hw->device_id ==
+						   IXGBE_DEV_ID_X550EM_A_KR_L) {
+					*speed = IXGBE_LINK_SPEED_1GB_FULL;
+					break;
+				}
+			}
+			/* fall through */
 		default:
 			*speed = IXGBE_LINK_SPEED_10GB_FULL |
 				 IXGBE_LINK_SPEED_1GB_FULL;
@@ -2109,18 +2123,25 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
-	if (status)
-		return status;
+	if (hw->mac.type == ixgbe_mac_X550EM_a) {
+		/* Set lane mode  to KR auto negotiation */
+		status = hw->mac.ops.read_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 
-	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
-	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
-	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
-	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
-	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+		if (status)
+			return status;
 
-	status = hw->mac.ops.write_iosf_sb_reg(hw,
+		reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
+		reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+		reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+
+		status = hw->mac.ops.write_iosf_sb_reg(hw,
 				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
 				    IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+	}
 
 	return ixgbe_restart_an_internal_phy_x550em(hw);
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH 37/39] net/ixgbe/base: clean code of flow control autoneg
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (35 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 36/39] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 38/39] net/ixgbe/base: do not skip PHY configuration Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief Xiao Wang
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

Support for flow control auto negotiation is defeatured from X550em_a
fiber when connected to speeds lower than 10Gbps. This patch cleans up
the code path which is mostly dead to begin with.

- add device IDs check in ixgbe_device_supports_autoneg_fc().
- ixgbe_fc_autoneg_fiber_x550em_a() is now used only to pass the user
  settings to ixgbe_fc_enable_generic().
- make sure that start_hw does not fail when setup_fc is not implemented.
- small fix in the debug message when ixgbe_device_supports_autoneg_fc()
  returns false.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c |  37 ++--
 drivers/net/ixgbe/base/ixgbe_x550.c   | 307 +++++++---------------------------
 drivers/net/ixgbe/base/ixgbe_x550.h   |   8 +-
 3 files changed, 93 insertions(+), 259 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index d31fb81..3d42a8f 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -168,13 +168,24 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 	switch (hw->phy.media_type) {
 	case ixgbe_media_type_fiber_qsfp:
 	case ixgbe_media_type_fiber:
-		hw->mac.ops.check_link(hw, &speed, &link_up, false);
-		/* if link is down, assume supported */
-		if (link_up)
-			supported = speed == IXGBE_LINK_SPEED_1GB_FULL ?
+		/* flow control autoneg black list */
+		switch (hw->device_id) {
+		case IXGBE_DEV_ID_X550EM_A_SFP:
+		case IXGBE_DEV_ID_X550EM_A_SFP_N:
+		case IXGBE_DEV_ID_X550EM_A_QSFP:
+		case IXGBE_DEV_ID_X550EM_A_QSFP_N:
+			supported = false;
+			break;
+		default:
+			hw->mac.ops.check_link(hw, &speed, &link_up, false);
+			/* if link is down, assume supported */
+			if (link_up)
+				supported = speed == IXGBE_LINK_SPEED_1GB_FULL ?
 				true : false;
-		else
-			supported = true;
+			else
+				supported = true;
+		}
+
 		break;
 	case ixgbe_media_type_backplane:
 		supported = true;
@@ -200,9 +211,10 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 		break;
 	}
 
-	ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
-		      "Device %x does not support flow control autoneg",
-		      hw->device_id);
+	if (!supported)
+		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
+			      "Device %x does not support flow control autoneg",
+			      hw->device_id);
 	return supported;
 }
 
@@ -397,8 +409,8 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 
 	/* Setup flow control */
 	ret_val = ixgbe_setup_fc(hw);
-	if (ret_val != IXGBE_SUCCESS)
-		goto out;
+	if (ret_val != IXGBE_SUCCESS && ret_val != IXGBE_NOT_IMPLEMENTED)
+		return ret_val;
 
 	/* Cache bit indicating need for crosstalk fix */
 	switch (hw->mac.type) {
@@ -419,8 +431,7 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 	/* Clear adapter stopped flag */
 	hw->adapter_stopped = false;
 
-out:
-	return ret_val;
+	return IXGBE_SUCCESS;
 }
 
 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 8c2479b..87d4302 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -660,7 +660,7 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 
 	switch (mac->ops.get_media_type(hw)) {
 	case ixgbe_media_type_fiber:
-		mac->ops.setup_fc = ixgbe_setup_fc_fiber_x550em_a;
+		mac->ops.setup_fc = NULL;
 		mac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a;
 		break;
 	case ixgbe_media_type_backplane:
@@ -906,20 +906,20 @@ STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
 	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);
+					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;
+			    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);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
 		if (status != IXGBE_SUCCESS)
 			return status;
 		break;
@@ -961,8 +961,8 @@ STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
 	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);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
 		if (status != IXGBE_SUCCESS)
 			return status;
 
@@ -973,8 +973,8 @@ STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
 		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);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
 		if (status != IXGBE_SUCCESS)
 			return status;
 		break;
@@ -1012,6 +1012,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
 		    !(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;
@@ -1720,7 +1721,7 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
 }
 
- /**
+/**
  * ixgbe_setup_sgmii_m88 - Set up link for sgmii with Marvell PHYs
  * @hw: pointer to hardware structure
  */
@@ -1812,13 +1813,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
 		mac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber;
 		mac->ops.set_rate_select_speed =
 					ixgbe_set_soft_rate_select_speed;
+
 		if ((hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP_N) ||
 		    (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP))
 			mac->ops.setup_mac_link =
-				ixgbe_setup_mac_link_sfp_x550a;
+						ixgbe_setup_mac_link_sfp_x550a;
 		else
 			mac->ops.setup_mac_link =
-				ixgbe_setup_mac_link_sfp_x550em;
+						ixgbe_setup_mac_link_sfp_x550em;
 		break;
 	case ixgbe_media_type_copper:
 		if (hw->mac.type == ixgbe_mac_X550EM_a) {
@@ -1856,6 +1858,7 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 {
 	DEBUGFUNC("ixgbe_get_link_capabilities_X550em");
 
+
 	/* SFP */
 	if (hw->phy.media_type == ixgbe_media_type_fiber) {
 
@@ -2102,8 +2105,8 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 	u32 reg_val;
 
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status)
 		return status;
 
@@ -2120,8 +2123,8 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 		reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KX;
 
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
 	if (hw->mac.type == ixgbe_mac_X550EM_a) {
 		/* Set lane mode  to KR auto negotiation */
@@ -2426,7 +2429,7 @@ STATIC s32 ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw)
 	    hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_MDIO_ACT) {
 		hw->phy.addr = (hw->phy.nw_mng_if_sel &
 				IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD) >>
-				IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
+			       IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
 	}
 
 	return IXGBE_SUCCESS;
@@ -2830,8 +2833,8 @@ STATIC s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
  *  Configure the the integrated PHY for SFP support.
  **/
 s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
-				   ixgbe_link_speed speed,
-				   bool autoneg_wait_to_complete)
+				    ixgbe_link_speed speed,
+				    bool autoneg_wait_to_complete)
 {
 	s32 ret_val;
 	u16 reg_phy_ext;
@@ -2886,7 +2889,7 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 
 		/* Get external PHY device id */
 		ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_GLOBAL_ID_MSB,
-				       IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
 
 		if (ret_val != IXGBE_SUCCESS)
 			return ret_val;
@@ -2907,7 +2910,7 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 		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);
+					 IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);
 	}
 	return ret_val;
 }
@@ -3150,56 +3153,56 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
 
 	/* Disable AN and force speed to 10G Serial. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
 	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
 	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Set near-end loopback clocks. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B;
 	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Set loopback enable. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_PMD_DFX_BURNIN_TX_RX_KR_LB_MASK;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Training bypass. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_PROTOCOL_BYPASS;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
 	return status;
 }
@@ -3272,6 +3275,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 		DEBUGOUT("EEPROM read buffer - semaphore failed\n");
 		return status;
 	}
+
 	while (words) {
 		if (words > FW_MAX_READ_BUFFER_SIZE / 2)
 			words_to_read = FW_MAX_READ_BUFFER_SIZE / 2;
@@ -4015,19 +4019,19 @@ s32 ixgbe_setup_fc_X550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_KR:
 	case IXGBE_DEV_ID_X550EM_A_KR_L:
 		ret_val = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 		if (ret_val != IXGBE_SUCCESS)
 			goto out;
 		reg_val &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
-			     IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
+			IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
 		if (pause)
 			reg_val |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
 		if (asm_dir)
 			reg_val |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
 		ret_val = hw->mac.ops.write_iosf_sb_reg(hw,
-				       IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
 		/* This device does not fully support AN. */
 		hw->fc.disable_fc_autoneg = true;
@@ -4060,7 +4064,7 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 	 */
 	if (hw->fc.disable_fc_autoneg) {
 		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-			      "Flow control autoneg is disabled");
+			     "Flow control autoneg is disabled");
 		goto out;
 	}
 
@@ -4072,8 +4076,8 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 
 	/* Check at auto-negotiation has completed */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_LINK_S1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
+					IXGBE_KRM_LINK_S1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
 
 	if (status != IXGBE_SUCCESS ||
 	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
@@ -4086,8 +4090,8 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 	 * local flow control settings accordingly
 	 */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl_1);
+				IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl_1);
 
 	if (status != IXGBE_SUCCESS) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
@@ -4095,8 +4099,8 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 	}
 
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-			      IXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id),
-			      IXGBE_SB_IOSF_TARGET_KR_PHY, &lp_an_page_low);
+				IXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &lp_an_page_low);
 
 	if (status != IXGBE_SUCCESS) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
@@ -4119,80 +4123,14 @@ out:
 }
 
 /**
- *  ixgbe_fc_autoneg_fiber_x550em_a - Enable flow control IEEE clause 37
+ *  ixgbe_fc_autoneg_fiber_x550em_a - passthrough FC settings
  *  @hw: pointer to hardware structure
  *
- *  Enable flow control according to IEEE clause 37.
  **/
 void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw)
 {
-	u32 link_s1, pcs_an_lp, pcs_an;
-	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
-	ixgbe_link_speed speed;
-	bool link_up;
-
-	/* AN should have completed when the cable was plugged in.
-	 * Look for reasons to bail out.  Bail out if:
-	 * - FC autoneg is disabled, or if
-	 * - link is not up.
-	 */
-	if (hw->fc.disable_fc_autoneg) {
-		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-			     "Flow control autoneg is disabled");
-		goto out;
-	}
-
-	hw->mac.ops.check_link(hw, &speed, &link_up, false);
-	if (!link_up) {
-		ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
-		goto out;
-	}
-
-	/* Check if auto-negotiation has completed */
-	status = hw->mac.ops.read_iosf_sb_reg(hw,
-					 IXGBE_KRM_LINK_S1(hw->bus.lan_id),
-					 IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
-
-	if (status != IXGBE_SUCCESS ||
-	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
-		goto out;
-	}
-
-	/* Determine advertised flow control */
-	status = hw->mac.ops.read_iosf_sb_reg(hw,
-					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
-
-	if (status != IXGBE_SUCCESS) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		goto out;
-	}
-
-	/* Determine link parter flow control */
-	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				  IXGBE_KRM_PCS_KX_AN_LP(hw->bus.lan_id),
-				  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an_lp);
-
-	if (status != IXGBE_SUCCESS) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		goto out;
-	}
-
-	status = ixgbe_negotiate_fc(hw, pcs_an, pcs_an_lp,
-				    IXGBE_KRM_PCS_KX_AN_SYM_PAUSE,
-				    IXGBE_KRM_PCS_KX_AN_ASM_PAUSE,
-				    IXGBE_KRM_PCS_KX_AN_LP_SYM_PAUSE,
-				    IXGBE_KRM_PCS_KX_AN_LP_ASM_PAUSE);
-
-out:
-	if (status == IXGBE_SUCCESS) {
-		hw->fc.fc_was_autonegged = true;
-	} else {
-		hw->fc.fc_was_autonegged = false;
-		hw->fc.current_mode = hw->fc.requested_mode;
-	}
+	hw->fc.fc_was_autonegged = false;
+	hw->fc.current_mode = hw->fc.requested_mode;
 }
 
 /**
@@ -4357,7 +4295,7 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	/* Validate the requested mode */
 	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
 		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-		      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
 		return IXGBE_ERR_INVALID_LINK_SETTINGS;
 	}
 
@@ -4369,8 +4307,8 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	 * we link at 10G, the 1G advertisement is harmless and vice versa.
 	 */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);
 
 	if (status != IXGBE_SUCCESS) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
@@ -4411,7 +4349,7 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	case ixgbe_fc_full:
 		/* Flow control (both Rx and Tx) is enabled by SW override. */
 		an_cntl |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
-			IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
+			   IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
 		break;
 	default:
 		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
@@ -4420,8 +4358,8 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	}
 
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-				       IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
 
 	/* Restart auto-negotiation. */
 	status = ixgbe_restart_an_internal_phy_x550em(hw);
@@ -4430,120 +4368,6 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 }
 
 /**
- *  ixgbe_setup_fc_fiber_x550em_a - Set up flow control
- *  @hw: pointer to hardware structure
- *
- *  Called at init time to set up flow control.
- **/
-s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw)
-{
-	struct ixgbe_mac_info *mac = &hw->mac;
-	s32 rc = IXGBE_SUCCESS;
-	u32 an_cntl4, lctrl, pcs_an;
-
-	DEBUGFUNC("ixgbe_setup_fc_fiber_x550em_a");
-
-	/* Validate the requested mode */
-	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
-		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
-		return IXGBE_ERR_INVALID_LINK_SETTINGS;
-	}
-
-	/* Enable clause 37 auto-negotiation in KRM_LINK_CTRL_1 */
-	if (hw->fc.requested_mode == ixgbe_fc_default)
-		hw->fc.requested_mode = ixgbe_fc_full;
-
-	rc = mac->ops.read_iosf_sb_reg(hw,
-				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
-	if (rc)
-		return rc;
-
-	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
-	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CLAUSE_37_EN;
-
-	rc = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
-	if (rc)
-		return rc;
-
-	/* Enable clause 37 over 73 in KRM_AN_CNTL_4 */
-	rc = mac->ops.read_iosf_sb_reg(hw,
-				       IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl4);
-	if (rc)
-		return rc;
-
-	an_cntl4 |= IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73;
-
-	rc = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl4);
-	if (rc)
-		return rc;
-
-	rc = hw->mac.ops.read_iosf_sb_reg(hw,
-					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
-
-	if (rc)
-		return rc;
-
-	/* The possible values of fc.requested_mode are:
-	 * 0: Flow control is completely disabled
-	 * 1: Rx flow control is enabled (we can receive pause frames,
-	 *    but not send pause frames).
-	 * 2: Tx flow control is enabled (we can send pause frames but
-	 *    we do not support receiving pause frames).
-	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
-	 * other: Invalid.
-	 */
-	switch (hw->fc.requested_mode) {
-	case ixgbe_fc_none:
-		/* Flow control completely disabled by software override. */
-		pcs_an &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
-			    IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
-		break;
-	case ixgbe_fc_tx_pause:
-		/* Tx Flow control is enabled, and Rx Flow control is
-		 * disabled by software override.
-		 */
-		pcs_an |= IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
-		pcs_an &= ~IXGBE_KRM_PCS_KX_AN_SYM_PAUSE;
-		break;
-	case ixgbe_fc_rx_pause:
-		/* Rx Flow control is enabled and Tx Flow control is
-		 * disabled by software override. Since there really
-		 * isn't a way to advertise that we are capable of RX
-		 * Pause ONLY, we will advertise that we support both
-		 * symmetric and asymmetric Rx PAUSE, as such we fall
-		 * through to the fc_full statement.  Later, we will
-		 * disable the adapter's ability to send PAUSE frames.
-		 */
-	case ixgbe_fc_full:
-		/* Flow control (both Rx and Tx) is enabled by SW override. */
-		pcs_an |= IXGBE_KRM_PCS_KX_AN_SYM_PAUSE |
-			   IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
-		break;
-	default:
-		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
-			      "Flow control param set incorrectly\n");
-		return IXGBE_ERR_CONFIG;
-	}
-
-	rc = hw->mac.ops.write_iosf_sb_reg(hw,
-					   IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-					   IXGBE_SB_IOSF_TARGET_KR_PHY, pcs_an);
-
-	/* Restart auto-negotiation. */
-	rc = ixgbe_restart_an_internal_phy_x550em(hw);
-
-	return rc;
-}
-
-/**
  * ixgbe_set_mux - Set mux for port 1 access with CS4227
  * @hw: pointer to hardware structure
  * @state: set mux if 1, clear if 0
@@ -4671,7 +4495,7 @@ STATIC void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask)
  *  instances.
  **/
 s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			     u32 device_type, u16 *phy_data)
+			       u32 device_type, u16 *phy_data)
 {
 	s32 status;
 	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
@@ -4699,7 +4523,7 @@ s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
  *  The PHY Token is needed since the MDIO is shared between to MAC instances.
  **/
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			      u32 device_type, u16 phy_data)
+				u32 device_type, u16 phy_data)
 {
 	s32 status;
 	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
@@ -4896,4 +4720,3 @@ s32 ixgbe_led_off_t_X550em(struct ixgbe_hw *hw, u32 led_idx)
 
 	return IXGBE_SUCCESS;
 }
-
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 36b36f6..cd4db29 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -99,12 +99,12 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 				    ixgbe_link_speed speed,
 				    bool autoneg_wait_to_complete);
 s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
-				   ixgbe_link_speed speed,
-				   bool autoneg_wait_to_complete);
+				    ixgbe_link_speed speed,
+				    bool autoneg_wait_to_complete);
 s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			     u32 device_type, u16 *phy_data);
+			       u32 device_type, u16 *phy_data);
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			      u32 device_type, u16 phy_data);
+				u32 device_type, u16 phy_data);
 s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_sgmii_x550em_a(struct ixgbe_hw *hw);
-- 
1.9.3

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

* [dpdk-dev] [PATCH 38/39] net/ixgbe/base: do not skip PHY configuration
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (36 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 37/39] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief Xiao Wang
  38 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

By exiting early we could skip the PHY configuration and as such
the driver may not configure the PHY correctly for SFP+.

This patch removes the logic which would previously skip the PHY
configuration in the case where we are already at the requested
speed in ixgbe_setup_mac_link_multispeed_fiber().

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 3d42a8f..cca19ef 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -5063,14 +5063,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 		speedcnt++;
 		highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
 
-		/* If we already have link at this speed, just jump out */
-		status = ixgbe_check_link(hw, &link_speed, &link_up, false);
-		if (status != IXGBE_SUCCESS)
-			return status;
-
-		if ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up)
-			goto out;
-
 		/* Set the module link speed */
 		switch (hw->phy.media_type) {
 		case ixgbe_media_type_fiber:
@@ -5121,14 +5113,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 		if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN)
 			highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
 
-		/* If we already have link at this speed, just jump out */
-		status = ixgbe_check_link(hw, &link_speed, &link_up, false);
-		if (status != IXGBE_SUCCESS)
-			return status;
-
-		if ((link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up)
-			goto out;
-
 		/* Set the module link speed */
 		switch (hw->phy.media_type) {
 		case ixgbe_media_type_fiber:
-- 
1.9.3

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

* [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief
  2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
                   ` (37 preceding siblings ...)
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 38/39] net/ixgbe/base: do not skip PHY configuration Xiao Wang
@ 2016-08-27 15:48 ` Xiao Wang
  2016-09-19 17:08   ` Ferruh Yigit
  38 siblings, 1 reply; 107+ messages in thread
From: Xiao Wang @ 2016-08-27 15:48 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, Xiao Wang

The ixgbe base driver was updated to version
cid-10g-shared-code.2016.04.12.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 doc/guides/rel_notes/release_16_11.rst | 8 ++++++++
 drivers/net/ixgbe/base/README          | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst
index 0b9022d..9bbe65a 100644
--- a/doc/guides/rel_notes/release_16_11.rst
+++ b/doc/guides/rel_notes/release_16_11.rst
@@ -36,6 +36,14 @@ New Features
 
      This section is a comment. Make sure to start the actual text at the margin.
 
+   * **Updated the ixgbe base driver.**
+
+     Updated the ixgbe base driver, including the following changes:
+
+     * add X550em_a 10G PHY support
+     * add VF multicast promiscuous mode support
+     * support flow control auto negotiation for X550em_a 1G PHY
+     * add X550em_a FW ALEF support
 
 Resolved Issues
 ---------------
diff --git a/drivers/net/ixgbe/base/README b/drivers/net/ixgbe/base/README
index 76e7805..6b54c31 100644
--- a/drivers/net/ixgbe/base/README
+++ b/drivers/net/ixgbe/base/README
@@ -34,7 +34,7 @@ Intel® IXGBE driver
 ===================
 
 This directory contains source code of FreeBSD ixgbe driver of version
-cid-10g-shared-code.2016.04.12 released by ND. The sub-directory of base/
+cid-10g-shared-code.2016.08.15 released by ND. The sub-directory of base/
 contains the original source package.
 This driver is valid for the product(s) listed below
 
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
@ 2016-09-19 17:00   ` Ferruh Yigit
  2016-09-22 15:58     ` Wang, Xiao W
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
  1 sibling, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:00 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:47 PM, Xiao Wang wrote:
> The delta value rather than vfta_delta pointer should be checked.
> 
> Fixes: b978f7b38c14 ("net/ixgbe/base: simplify VLAN management")
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_82598.c  | 6 +++---
>  drivers/net/ixgbe/base/ixgbe_api.c    | 7 ++++---
>  drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
>  3 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_82598.c b/drivers/net/ixgbe/base/ixgbe_82598.c
> index db80880..724dcbb 100644
> --- a/drivers/net/ixgbe/base/ixgbe_82598.c
> +++ b/drivers/net/ixgbe/base/ixgbe_82598.c
> @@ -995,19 +995,19 @@ STATIC s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
>   *  @vlan: VLAN id to write to VLAN filter
>   *  @vind: VMDq output index that maps queue to VLAN id in VFTA
>   *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
> - *  @bypass_vlvf: boolean flag - unused
> + *  @vlvf_bypass: boolean flag - unused

bypass_vlvf -> vlvf_bypass belongs to different patch

>   *
>   *  Turn on/off specified VLAN in the VLAN filter table.
>   **/
>  s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
> -			 bool vlan_on, bool bypass_vlvf)
> +			 bool vlan_on, bool vlvf_bypass)
>  {
>  	u32 regindex;
>  	u32 bitindex;
>  	u32 bits;
>  	u32 vftabyte;
>  
> -	UNREFERENCED_1PARAMETER(bypass_vlvf);
> +	UNREFERENCED_1PARAMETER(vlvf_bypass);
>  
>  	DEBUGFUNC("ixgbe_set_vfta_82598");
>  
> diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
> index 1786867..5b721af 100644
> --- a/drivers/net/ixgbe/base/ixgbe_api.c
> +++ b/drivers/net/ixgbe/base/ixgbe_api.c
> @@ -1090,7 +1090,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
>  		   bool vlvf_bypass)
>  {
>  	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
> -				  vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
> +			       vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
>  }
>  
>  /**
> @@ -1100,7 +1100,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
>   *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
>   *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
>   *  @vfta_delta: pointer to the difference between the current value of VFTA
> - *               and the desired value
> + *		 and the desired value
>   *  @vfta: the desired value of the VFTA
>   *  @vlvf_bypass: boolean flag indicating updating the default pool is okay
>   *
> @@ -1110,7 +1110,7 @@ s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
>  		   u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
>  {
>  	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
> -				vlan_on, vfta_delta, vfta, vlvf_bypass),
> +			       vlan_on, vfta_delta, vfta, vlvf_bypass),
>  			       IXGBE_NOT_IMPLEMENTED);
>  }
>  
> @@ -1659,6 +1659,7 @@ void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
>  		hw->mac.ops.init_swfw_sync(hw);
>  }
>  
> +

unrelated whitespace modifications


>  void ixgbe_disable_rx(struct ixgbe_hw *hw)
>  {
>  	if (hw->mac.ops.disable_rx)
> diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
> index 811875a..161bf32 100644
> --- a/drivers/net/ixgbe/base/ixgbe_common.c
> +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> @@ -3967,7 +3967,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
>  		 * we run the risk of stray packets leaking into
>  		 * the PF via the default pool
>  		 */
> -		if (vfta_delta)
> +		if (*vfta_delta)

This seems only update mentioned in patch commit log.

What about extracting all other clean up modifications into a new patch,
other patches also have similar fixes, all can go into that cleanup patch?

>  			IXGBE_WRITE_REG(hw, IXGBE_VFTA(vlan / 32), vfta);
>  
>  		/* disable VLVF and clear remaining bit from pool */
> 

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

* Re: [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data Xiao Wang
@ 2016-09-19 17:01   ` Ferruh Yigit
  2016-09-25  0:36     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:01 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:47 PM, Xiao Wang wrote:
> The latest firmware reverses the endianness of the PHY data read and

Good to add the fw version for future references

> written via host interface command, so make corresponding changes
> to that.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>

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

* Re: [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
@ 2016-09-19 17:01   ` Ferruh Yigit
  0 siblings, 0 replies; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:01 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:47 PM, Xiao Wang wrote:
> This patch removes X550em SFP iXFI setup for the drivers since there
> is no released hardware production with SFP iXFI.

XFI?

> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_x550.c | 57 +++++++------------------------------
>  1 file changed, 11 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
> index aa6e859..b8fdb00 100644
> --- a/drivers/net/ixgbe/base/ixgbe_x550.c
> +++ b/drivers/net/ixgbe/base/ixgbe_x550.c
> @@ -2460,53 +2460,18 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
>  	if (ret_val != IXGBE_SUCCESS)
>  		return ret_val;
>  
> -	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
> -		/* Configure CS4227 LINE side to 10G SR. */
> -		reg_slice = IXGBE_CS4227_LINE_SPARE22_MSB +
> -			    (hw->bus.lan_id << 12);
> -		reg_val = IXGBE_CS4227_SPEED_10G;
> -		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
> -						  reg_val);
> -
> -		reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
> -			    (hw->bus.lan_id << 12);
> +	/* Configure internal PHY for KR/KX. */
> +	ixgbe_setup_kr_speed_x550em(hw, speed);
> +
> +	/* Configure CS4227 LINE side to proper mode. */
> +	reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
> +		    (hw->bus.lan_id << 12);

These lines can join

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

* Re: [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version Xiao Wang
@ 2016-09-19 17:03   ` Ferruh Yigit
  2016-09-23  3:50     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:03 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:47 PM, Xiao Wang wrote:
> This patch will pave the way for the new VF unicast promiscuous
> mode support.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_mbx.h | 5 +++--
>  drivers/net/ixgbe/base/ixgbe_vf.c  | 2 ++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
> index c3e301f..7556a81 100644
> --- a/drivers/net/ixgbe/base/ixgbe_mbx.h
> +++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
> @@ -90,6 +90,7 @@ enum ixgbe_pfvf_api_rev {
>  	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
>  	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
>  	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
> +	ixgbe_mbox_api_13,	/* API version 1.3, linux/freebsd VF driver */
>  	/* This value should always be last */
>  	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
>  };
> @@ -109,8 +110,8 @@ enum ixgbe_pfvf_api_rev {
>  #define IXGBE_VF_GET_QUEUES	0x09 /* get queue configuration */
>  
>  /* mailbox API, version 1.2 VF requests */
> -#define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
> -#define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
> +#define IXGBE_VF_GET_RETA      0x0a    /* VF request for RETA */
> +#define IXGBE_VF_GET_RSS_KEY	0x0b    /* get RSS key */

is this intentional, since breaks tab alignment, and the values are not
changes actually.

>  #define IXGBE_VF_UPDATE_XCAST_MODE	0x0c

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

* Re: [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface Xiao Wang
@ 2016-09-19 17:04   ` Ferruh Yigit
  2016-09-23  5:16     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:04 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> This patch makes sure that we access IOSF registers through the HIC
> (host interface command) for the majority of X550em devices. All devices
> with NVM are capable of using the HIC.
> 
> For consistency all instances where the ixgbe_read/write_iosf_sb_reg_x550
> is called directly are converted to function pointer calls.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_phy.c  |  2 +-
>  drivers/net/ixgbe/base/ixgbe_x550.c | 38 ++++++++++++++++++++++---------------
>  2 files changed, 24 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
> index d33d0f8..ee8618f 100644
> --- a/drivers/net/ixgbe/base/ixgbe_phy.c
> +++ b/drivers/net/ixgbe/base/ixgbe_phy.c
> @@ -741,7 +741,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
>  	DEBUGFUNC("ixgbe_write_phy_reg_generic");
>  
>  	if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) {
> -		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
> +		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,
>  						 phy_data);

Is this IOSF register?

...

> @@ -4504,7 +4512,7 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
>  	DEBUGFUNC("ixgbe_write_phy_reg_x550a");
>  
>  	if (hw->mac.ops.acquire_swfw_sync(hw, mask) == IXGBE_SUCCESS) {
> -		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
> +		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,

same question?

>  						 phy_data);
>  		hw->mac.ops.release_swfw_sync(hw, mask);
>  	} else {
> 

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

* Re: [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous Xiao Wang
@ 2016-09-19 17:05   ` Ferruh Yigit
  2016-09-23  3:35     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:05 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:47 PM, Xiao Wang wrote:
> Currently, VF is limited to 30 multicast addresses. In order to
> accommodate more addresses, this patch adds support for VF multicast
> promiscuous.

It looks like functionality not changed, just
ixgbevf_update_xcast_mode() moved to ixgbe_mac_operations struct.

Is 30 multicast address limitation remains with this patch?

> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_mbx.h  |  2 +-
>  drivers/net/ixgbe/base/ixgbe_type.h |  1 +
>  drivers/net/ixgbe/base/ixgbe_vf.c   | 38 ++++++++++++++++++++++++++++++++
>  drivers/net/ixgbe/base/ixgbe_vf.h   |  1 +
>  drivers/net/ixgbe/ixgbe_ethdev.c    | 43 ++-----------------------------------
>  5 files changed, 43 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
> index d775142..c3e301f 100644
> --- a/drivers/net/ixgbe/base/ixgbe_mbx.h
> +++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
> @@ -111,7 +111,7 @@ enum ixgbe_pfvf_api_rev {
>  /* mailbox API, version 1.2 VF requests */
>  #define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
>  #define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
> -#define IXGBE_VF_UPDATE_XCAST_MODE	0x0C
> +#define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
>  
>  /* GET_QUEUES return data indices within the mailbox */
>  #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
> diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
> index b2fdfcd..96b5cbd 100644
> --- a/drivers/net/ixgbe/base/ixgbe_type.h
> +++ b/drivers/net/ixgbe/base/ixgbe_type.h
> @@ -3883,6 +3883,7 @@ struct ixgbe_mac_operations {
>  	s32 (*init_uta_tables)(struct ixgbe_hw *);
>  	void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
>  	void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
> +	s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
>  
>  	/* Flow Control */
>  	s32 (*fc_enable)(struct ixgbe_hw *);
> diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
> index a75074a..20a739c 100644
> --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> @@ -75,6 +75,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
>  	hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf;
>  	hw->mac.ops.init_rx_addrs = NULL;
>  	hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
> +	hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode;
>  	hw->mac.ops.enable_mc = NULL;
>  	hw->mac.ops.disable_mc = NULL;
>  	hw->mac.ops.clear_vfta = NULL;
> @@ -419,6 +420,43 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
>  }
>  
>  /**
> + *  ixgbevf_update_xcast_mode - Update Multicast mode
> + *  @hw: pointer to the HW structure
> + *  @xcast_mode: new multicast mode
> + *
> + *  Updates the Multicast Mode of VF.
> + **/
> +s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
> +{
> +	struct ixgbe_mbx_info *mbx = &hw->mbx;
> +	u32 msgbuf[2];
> +	s32 err;
> +
> +	switch (hw->api_version) {
> +	case ixgbe_mbox_api_12:
> +		break;
> +	default:
> +		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
> +	}
> +
> +	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
> +	msgbuf[1] = xcast_mode;
> +
> +	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
> +	if (err)
> +		return err;
> +
> +	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
> +	if (err)
> +		return err;
> +
> +	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> +	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))

What if other flags set in msgbuf[0]
Please check 18/39 patch, which fixes something similar to this


> +		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
> +	return IXGBE_SUCCESS;
> +}
> +
> +/**
>   *  ixgbe_set_vfta_vf - Set/Unset vlan filter table address
>   *  @hw: pointer to the HW structure
>   *  @vlan: 12 bit VLAN ID
> diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h b/drivers/net/ixgbe/base/ixgbe_vf.h
> index 8851cb8..624a97d 100644
> --- a/drivers/net/ixgbe/base/ixgbe_vf.h
> +++ b/drivers/net/ixgbe/base/ixgbe_vf.h
> @@ -131,6 +131,7 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr);
>  s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
>  				 u32 mc_addr_count, ixgbe_mc_addr_itr,
>  				 bool clear);
> +s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
>  s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
>  		      bool vlan_on, bool vlvf_bypass);
>  void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index d478a15..7794960 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -7236,51 +7236,12 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
>  	return ret;
>  }
>  
> -/* ixgbevf_update_xcast_mode - Update Multicast mode
> - * @hw: pointer to the HW structure
> - * @netdev: pointer to net device structure
> - * @xcast_mode: new multicast mode
> - *
> - * Updates the Multicast Mode of VF.
> - */
> -static int ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,
> -				     int xcast_mode)
> -{
> -	struct ixgbe_mbx_info *mbx = &hw->mbx;
> -	u32 msgbuf[2];
> -	s32 err;
> -
> -	switch (hw->api_version) {
> -	case ixgbe_mbox_api_12:
> -		break;
> -	default:
> -		return -EOPNOTSUPP;
> -	}
> -
> -	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
> -	msgbuf[1] = xcast_mode;
> -
> -	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
> -	if (err)
> -		return err;
> -
> -	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
> -	if (err)
> -		return err;
> -
> -	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> -	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
> -		return -EPERM;
> -
> -	return 0;
> -}
> -
>  static void
>  ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
>  {
>  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  
> -	ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
> +	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
>  }
>  
>  static void
> @@ -7288,7 +7249,7 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
>  {
>  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>  
> -	ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
> +	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
>  }
>  
>  static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
> 

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

* Re: [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions Xiao Wang
@ 2016-09-19 17:06   ` Ferruh Yigit
  2016-09-22 16:08     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:06 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> Do parameter check to prevent exceptional value being written into
> register.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_common.c | 15 ++++++++++++++-
>  drivers/net/ixgbe/base/ixgbe_x540.c   |  6 ++++++
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
> index 1c7263d..3c3272e 100644
> --- a/drivers/net/ixgbe/base/ixgbe_common.c
> +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> @@ -1133,6 +1133,9 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index)
>  
>  	DEBUGFUNC("ixgbe_led_on_generic");
>  
> +	if (index > 3)

What about using macro for hardcoded value 3.

> +		return IXGBE_ERR_PARAM;
> +
>  	/* To turn on the LED, set mode to ON. */
>  	led_reg &= ~IXGBE_LED_MODE_MASK(index);
>  	led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index);
> @@ -1153,6 +1156,9 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index)
>  
>  	DEBUGFUNC("ixgbe_led_off_generic");
>  
> +	if (index > 3)
> +		return IXGBE_ERR_PARAM;
> +
>  	/* To turn off the LED, set mode to OFF. */
>  	led_reg &= ~IXGBE_LED_MODE_MASK(index);
>  	led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index);
> @@ -3341,7 +3347,7 @@ s32 prot_autoc_write_generic(struct ixgbe_hw *hw, u32 reg_val, bool locked)
>   **/
>  s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw)
>  {
> -	int secrxreg;
> +	u32 secrxreg;

This modification seems unrelated with the patch.

> 

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

* Re: [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK Xiao Wang
@ 2016-09-19 17:07   ` Ferruh Yigit
  2016-09-23  6:05     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:07 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> Previously we checked only msgbuf[0] for

"return buffer" instead of msgbuf[0] ?

> (IXGBE_VF_SET_MACVLAN |  IXGBE_VT_MSGTYPE_NACK), but this would not
> work if index != 0 and as a result NACK will not be detected.

"write buffer is not 0" instead of "index != 0"

> 

Function also starts using ixgbevf_write_msg_read_ack() instead of
separate write and read, is it possible to fix NACK only in this patch,
and do ixgbevf_write_msg_read_ack() switch in patch 27/39.
If prefer to keep in this patch, please mention about this switch in
comment log.

> Fixes: af75078fece3 ("first public release")
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_vf.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
> index c0fedea..f60ff7d 100644
> --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> @@ -529,8 +529,7 @@ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr)
>  
>  s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
>  {
> -	struct ixgbe_mbx_info *mbx = &hw->mbx;
> -	u32 msgbuf[3];
> +	u32 msgbuf[3], msgbuf_chk;
>  	u8 *msg_addr = (u8 *)(&msgbuf[1]);
>  	s32 ret_val;
>  
> @@ -543,18 +542,17 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
>  	 */
>  	msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT;
>  	msgbuf[0] |= IXGBE_VF_SET_MACVLAN;
> +	msgbuf_chk = msgbuf[0];
>  	if (addr)
>  		memcpy(msg_addr, addr, 6);
> -	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
>  
> -	if (!ret_val)
> -		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
> +	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
> +	if (!ret_val) {
> +		msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
>  
> -	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> -
> -	if (!ret_val)
> -		if (msgbuf[0] == (IXGBE_VF_SET_MACVLAN | IXGBE_VT_MSGTYPE_NACK))
> -			ret_val = IXGBE_ERR_OUT_OF_MEM;
> +		if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_NACK))
> +			return IXGBE_ERR_OUT_OF_MEM;

What about following instead of introducing msgbuf_chk:

if ((msgbuf[0] & IXGBE_VF_SET_MACVLAN) &&
	    (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK))

Please check patch 15/39

> +	}
>  
>  	return ret_val;
>  }
> 

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

* Re: [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
@ 2016-09-19 17:07   ` Ferruh Yigit
  2016-09-23  0:59     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:07 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> Make sure ixgbe_device_supports_autoneg_fc() returns true for the device
> IDs of Seabrook and Shady Acres.

Is these IDs official public ones?

> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_common.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
> index bc12bc1..9776ab9 100644
> --- a/drivers/net/ixgbe/base/ixgbe_common.c
> +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> @@ -189,6 +189,8 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
>  		case IXGBE_DEV_ID_X550T1:
>  		case IXGBE_DEV_ID_X550EM_X_10G_T:
>  		case IXGBE_DEV_ID_X550EM_A_10G_T:
> +		case IXGBE_DEV_ID_X550EM_A_1G_T:
> +		case IXGBE_DEV_ID_X550EM_A_1G_T_L:
>  			supported = true;
>  			break;
>  		default:
> 

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

* Re: [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
@ 2016-09-19 17:07   ` Ferruh Yigit
  2016-09-22  2:56     ` Lu, Wenzhuo
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:07 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> This patch adds X550em_a FW ALEF support for B0 per DCR 64. ALEF is

Is it required more information on B0 and ALEF. Is there an official
name for B0?

> the new unified FW. The driver uses the KRM_PMD_RX_FLEX_PORT/
> FLX_MASK_ST20 registers to configure the lane mode.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---

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

* Re: [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
@ 2016-09-19 17:08   ` Ferruh Yigit
  2016-09-23  8:06     ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:08 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> The semaphore is not being held for complete shadow RAM accesses
> which could result in corruption. Refactor the code so that it is
> possible to hold the semaphore around ixgbe_host_interface_command
> by introducing an unlocked form. This patch also eliminates the
> function ixgbe_read_ee_hostif_data_X550 in favor of the function
> ixgbe_read_ee_hostif_X550 and it now gets both semaphore bits
> at once instead of nesting them. The new arrangement is able to
> get both the management interface and the EEPROM semaphores at the
> same time instead of separately.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  drivers/net/ixgbe/base/ixgbe_common.c | 106 ++++++++++++++++++++++------------
>  drivers/net/ixgbe/base/ixgbe_common.h |   3 +-
>  drivers/net/ixgbe/base/ixgbe_x550.c   |  57 +++++-------------
>  drivers/net/ixgbe/base/ixgbe_x550.h   |   2 -
>  4 files changed, 88 insertions(+), 80 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
> index 9776ab9..d31fb81 100644
> --- a/drivers/net/ixgbe/base/ixgbe_common.c
> +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> @@ -1066,7 +1066,7 @@ void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw)
>  	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP) {
>  		hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_4, &ee_ctrl_4);
>  		bus->instance_id = (ee_ctrl_4 & IXGBE_EE_CTRL_4_INST_ID) >>
> -			IXGBE_EE_CTRL_4_INST_ID_SHIFT;
> +				   IXGBE_EE_CTRL_4_INST_ID_SHIFT;
>  	}
>  }
>  
> @@ -2877,7 +2877,7 @@ out:
>   *  advertised settings
>   **/
>  s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
> -			      u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
> +		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
>  {
>  	if ((!(adv_reg)) ||  (!(lp_reg))) {
>  		ERROR_REPORT3(IXGBE_ERROR_UNSUPPORTED,
> @@ -3920,7 +3920,8 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
>  	vfta_delta = 1 << (vlan % 32);
>  	vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx));
>  
> -	/* vfta_delta represents the difference between the current value
> +	/*
> +	 * vfta_delta represents the difference between the current value

These whitespace fixes not belong to this patch.
It is good to make cleanups, but these are making noise for real patch,
there are a few more of these in previous patches, perhaps all can be
merged into a cleanup patch?

>  	 * of vfta and the value we want in the register.  Since the diff
>  	 * is an XOR mask we can just update the vfta using an XOR
>  	 */
> @@ -3953,7 +3954,7 @@ vfta_update:
>   *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
>   *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
>   *  @vfta_delta: pointer to the difference between the current value of VFTA
> - * and the desired value
> + *		 and the desired value
>   *  @vfta: the desired value of the VFTA
>   *  @vlvf_bypass: boolean flag indicating updating default pool is okay
>   *
> @@ -3980,6 +3981,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
>  	 */
>  	if (!(IXGBE_READ_REG(hw, IXGBE_VT_CTL) & IXGBE_VT_CTL_VT_ENABLE))
>  		return IXGBE_SUCCESS;
> +
>  	vlvf_index = ixgbe_find_vlvf_slot(hw, vlan, vlvf_bypass);
>  	if (vlvf_index < 0)
>  		return vlvf_index;
> @@ -4009,6 +4011,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
>  
>  		return IXGBE_SUCCESS;
>  	}
> +
>  	/* If there are still bits set in the VLVFB registers
>  	 * for the VLAN ID indicated we need to see if the
>  	 * caller is requesting that we clear the VFTA entry bit.
> @@ -4413,43 +4416,31 @@ u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
>  }
>  
>  /**
> - *  ixgbe_host_interface_command - Issue command to manageability block
> + *  ixgbe_hic_unlocked - Issue command to manageability block unlocked
>   *  @hw: pointer to the HW structure
> - *  @buffer: contains the command to write and where the return status will
> - *   be placed
> + *  @buffer: command to write and where the return status will be placed
>   *  @length: length of buffer, must be multiple of 4 bytes
>   *  @timeout: time in ms to wait for command completion
> - *  @return_data: read and return data from the buffer (true) or not (false)
> - *   Needed because FW structures are big endian and decoding of
> - *   these fields can be 8 bit or 16 bit based on command. Decoding
> - *   is not easily understood without making a table of commands.
> - *   So we will leave this up to the caller to read back the data
> - *   in these cases.
>   *
>   *  Communicates with the manageability block. On success return IXGBE_SUCCESS
>   *  else returns semaphore error when encountering an error acquiring
>   *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
> + *
> + *  This function assumes that the IXGBE_GSSR_SW_MNG_SM semaphore is held
> + *  by the caller.
>   **/
> -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 *hw, u32 *buffer, u32 length,
> +		       u32 timeout)
>  {
> -	u32 hicr, i, bi, fwsts;
> -	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
> -	u16 buf_len;
> +	u32 hicr, i, fwsts;
>  	u16 dword_len;
> -	s32 status;
>  
> -	DEBUGFUNC("ixgbe_host_interface_command");
> +	DEBUGFUNC("ixgbe_hic_unlocked");
>  
> -	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
> +	if (!length || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
>  		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
>  		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
>  	}
> -	/* Take management host interface semaphore */
> -	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
> -
> -	if (status)
> -		return status;
>  
>  	/* Set bit 9 of FWSTS clearing FW reset indication */
>  	fwsts = IXGBE_READ_REG(hw, IXGBE_FWSTS);
> @@ -4457,17 +4448,15 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
>  
>  	/* Check that the host interface is enabled. */
>  	hicr = IXGBE_READ_REG(hw, IXGBE_HICR);
> -	if ((hicr & IXGBE_HICR_EN) == 0) {
> +	if (!(hicr & IXGBE_HICR_EN)) {
>  		DEBUGOUT("IXGBE_HOST_EN bit disabled.\n");
> -		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
> -		goto rel_out;
> +		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
>  	}
>  
>  	/* Calculate length in DWORDs. We must be DWORD aligned */
> -	if ((length % (sizeof(u32))) != 0) {
> +	if (length % sizeof(u32)) {
>  		DEBUGOUT("Buffer length failure, not aligned to dword");
> -		status = IXGBE_ERR_INVALID_ARGUMENT;
> -		goto rel_out;
> +		return IXGBE_ERR_INVALID_ARGUMENT;
>  	}
>  
>  	dword_len = length >> 2;
> @@ -4490,14 +4479,59 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
>  	}
>  
>  	/* Check command completion */
> -	if ((timeout != 0 && i == timeout) ||
> +	if ((timeout && i == timeout) ||
>  	    !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) {
>  		ERROR_REPORT1(IXGBE_ERROR_CAUTION,
>  			     "Command has failed with no status valid.\n");
> -		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
> -		goto rel_out;
> +		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
> +	}
> +
> +	return IXGBE_SUCCESS;
> +}
> +
> +/**
> + *  ixgbe_host_interface_command - Issue command to manageability block
> + *  @hw: pointer to the HW structure
> + *  @buffer: contains the command to write and where the return status will
> + *   be placed
> + *  @length: length of buffer, must be multiple of 4 bytes
> + *  @timeout: time in ms to wait for command completion
> + *  @return_data: read and return data from the buffer (true) or not (false)
> + *   Needed because FW structures are big endian and decoding of
> + *   these fields can be 8 bit or 16 bit based on command. Decoding
> + *   is not easily understood without making a table of commands.
> + *   So we will leave this up to the caller to read back the data
> + *   in these cases.
> + *
> + *  Communicates with the manageability block. On success return IXGBE_SUCCESS
> + *  else returns semaphore error when encountering an error acquiring
> + *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
> + **/
> +s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
> +				 u32 length, u32 timeout, bool return_data)
> +{
> +	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
> +	u16 dword_len;
> +	u16 buf_len;
> +	s32 status;
> +	u32 bi;
> +
> +	DEBUGFUNC("ixgbe_host_interface_command");
> +
> +	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
> +		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
> +		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
>  	}
>  
> +	/* Take management host interface semaphore */
> +	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
> +	if (status)
> +		return status;
> +
> +	status = ixgbe_hic_unlocked(hw, buffer, length, timeout);
> +	if (status)
> +		goto rel_out;
> +
>  	if (!return_data)
>  		goto rel_out;
>  
> @@ -4512,7 +4546,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
>  
>  	/* If there is any thing in data position pull it in */
>  	buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len;
> -	if (buf_len == 0)
> +	if (!buf_len)
>  		goto rel_out;
>  
>  	if (length < buf_len + hdr_size) {
> diff --git a/drivers/net/ixgbe/base/ixgbe_common.h b/drivers/net/ixgbe/base/ixgbe_common.h
> index 0545f85..66dd565 100644
> --- a/drivers/net/ixgbe/base/ixgbe_common.h
> +++ b/drivers/net/ixgbe/base/ixgbe_common.h
> @@ -133,7 +133,7 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
>  s32 ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, u8 *addr, u32 vmdq);
>  s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
>  s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
> -			   u32 vind, bool vlan_on, bool vlvf_bypass);
> +			 u32 vind, bool vlan_on, bool vlvf_bypass);
>  s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
>  			   bool vlan_on, u32 *vfta_delta, u32 vfta,
>  			   bool vlvf_bypass);
> @@ -159,6 +159,7 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
>  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);
>  
>  void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
>  
> diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
> index 0cc7a3f..6f4dfd9 100644
> --- a/drivers/net/ixgbe/base/ixgbe_x550.c
> +++ b/drivers/net/ixgbe/base/ixgbe_x550.c
> @@ -3192,13 +3192,13 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
>   *
>   *  Reads a 16 bit word from the EEPROM using the hostif.
>   **/
> -s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
> -				   u16 *data)
> +s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data)
>  {
> -	s32 status;
> +	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
>  	struct ixgbe_hic_read_shadow_ram buffer;
> +	s32 status;
>  
> -	DEBUGFUNC("ixgbe_read_ee_hostif_data_X550");
> +	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
>  	buffer.hdr.req.cmd = FW_READ_SHADOW_RAM_CMD;
>  	buffer.hdr.req.buf_lenh = 0;
>  	buffer.hdr.req.buf_lenl = FW_READ_SHADOW_RAM_LEN;
> @@ -3209,42 +3209,18 @@ s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
>  	/* one word */
>  	buffer.length = IXGBE_CPU_TO_BE16(sizeof(u16));
>  
> -	status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
> -					      sizeof(buffer),
> -					      IXGBE_HI_COMMAND_TIMEOUT, false);
> -
> +	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
>  	if (status)
>  		return status;
>  
> -	*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
> -					  FW_NVM_DATA_OFFSET);
> -
> -	return 0;
> -}
> -
> -/**
> - *  ixgbe_read_ee_hostif_X550 - Read EEPROM word using a host interface command
> - *  @hw: pointer to hardware structure
> - *  @offset: offset of  word in the EEPROM to read
> - *  @data: word read from the EEPROM
> - *
> - *  Reads a 16 bit word from the EEPROM using the hostif.
> - **/
> -s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
> -			      u16 *data)
> -{
> -	s32 status = IXGBE_SUCCESS;
> -
> -	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
> -
> -	if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
> -	    IXGBE_SUCCESS) {
> -		status = ixgbe_read_ee_hostif_data_X550(hw, offset, data);
> -		hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
> -	} else {
> -		status = IXGBE_ERR_SWFW_SYNC;
> +	status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
> +				    IXGBE_HI_COMMAND_TIMEOUT);
> +	if (!status) {
> +		*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
> +						  FW_NVM_DATA_OFFSET);
>  	}
>  
> +	hw->mac.ops.release_swfw_sync(hw, mask);
>  	return status;
>  }
>  
> @@ -3260,6 +3236,7 @@ s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
>  s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
>  				     u16 offset, u16 words, u16 *data)
>  {
> +	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
>  	struct ixgbe_hic_read_shadow_ram buffer;
>  	u32 current_word = 0;
>  	u16 words_to_read;
> @@ -3269,7 +3246,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
>  	DEBUGFUNC("ixgbe_read_ee_hostif_buffer_X550");
>  
>  	/* Take semaphore for the entire operation. */
> -	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
> +	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
>  	if (status) {
>  		DEBUGOUT("EEPROM read buffer - semaphore failed\n");
>  		return status;
> @@ -3289,10 +3266,8 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
>  		buffer.address = IXGBE_CPU_TO_BE32((offset + current_word) * 2);
>  		buffer.length = IXGBE_CPU_TO_BE16(words_to_read * 2);
>  
> -		status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
> -						      sizeof(buffer),
> -						      IXGBE_HI_COMMAND_TIMEOUT,
> -						      false);
> +		status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
> +					    IXGBE_HI_COMMAND_TIMEOUT);
>  
>  		if (status) {
>  			DEBUGOUT("Host interface command failed\n");
> @@ -3317,7 +3292,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
>  	}
>  
>  out:
> -	hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
> +	hw->mac.ops.release_swfw_sync(hw, mask);
>  	return status;
>  }
>  
> diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
> index c7253f0..36b36f6 100644
> --- a/drivers/net/ixgbe/base/ixgbe_x550.h
> +++ b/drivers/net/ixgbe/base/ixgbe_x550.h
> @@ -55,8 +55,6 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
>  				     u16 offset, u16 words, u16 *data);
>  s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
>  u16				*data);
> -s32 ixgbe_read_ee_hostif_data_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);
> 

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

* Re: [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief
  2016-08-27 15:48 ` [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief Xiao Wang
@ 2016-09-19 17:08   ` Ferruh Yigit
  2016-09-22  2:55     ` Lu, Wenzhuo
  0 siblings, 1 reply; 107+ messages in thread
From: Ferruh Yigit @ 2016-09-19 17:08 UTC (permalink / raw)
  To: Xiao Wang, wenzhuo.lu; +Cc: dev

On 8/27/2016 4:48 PM, Xiao Wang wrote:
> The ixgbe base driver was updated to version
> cid-10g-shared-code.2016.04.12.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---
>  doc/guides/rel_notes/release_16_11.rst | 8 ++++++++
>  drivers/net/ixgbe/base/README          | 2 +-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst
> index 0b9022d..9bbe65a 100644
> --- a/doc/guides/rel_notes/release_16_11.rst
> +++ b/doc/guides/rel_notes/release_16_11.rst
> @@ -36,6 +36,14 @@ New Features
>  
>       This section is a comment. Make sure to start the actual text at the margin.
>  
> +   * **Updated the ixgbe base driver.**
> +
> +     Updated the ixgbe base driver, including the following changes:
> +
> +     * add X550em_a 10G PHY support
> +     * add VF multicast promiscuous mode support
> +     * support flow control auto negotiation for X550em_a 1G PHY
> +     * add X550em_a FW ALEF support

Does it worth mention following, or these are internal details:

increase mailbox version to ixgbe_mbox_api_13?
mac ops for Hyper-V support?


>  
>  Resolved Issues
>  ---------------
> diff --git a/drivers/net/ixgbe/base/README b/drivers/net/ixgbe/base/README
> index 76e7805..6b54c31 100644
> --- a/drivers/net/ixgbe/base/README
> +++ b/drivers/net/ixgbe/base/README
> @@ -34,7 +34,7 @@ Intel® IXGBE driver
>  ===================
>  
>  This directory contains source code of FreeBSD ixgbe driver of version
> -cid-10g-shared-code.2016.04.12 released by ND. The sub-directory of base/
> +cid-10g-shared-code.2016.08.15 released by ND. The sub-directory of base/
>  contains the original source package.
>  This driver is valid for the product(s) listed below
>  
> 

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

* Re: [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief
  2016-09-19 17:08   ` Ferruh Yigit
@ 2016-09-22  2:55     ` Lu, Wenzhuo
  0 siblings, 0 replies; 107+ messages in thread
From: Lu, Wenzhuo @ 2016-09-22  2:55 UTC (permalink / raw)
  To: Yigit, Ferruh, Wang, Xiao W; +Cc: dev

Hi Xiao, Ferruh,


> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:09 AM
> To: Wang, Xiao W; Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update
> brief
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > The ixgbe base driver was updated to version
> > cid-10g-shared-code.2016.04.12.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  doc/guides/rel_notes/release_16_11.rst | 8 ++++++++
> >  drivers/net/ixgbe/base/README          | 2 +-
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/doc/guides/rel_notes/release_16_11.rst
> > b/doc/guides/rel_notes/release_16_11.rst
> > index 0b9022d..9bbe65a 100644
> > --- a/doc/guides/rel_notes/release_16_11.rst
> > +++ b/doc/guides/rel_notes/release_16_11.rst
> > @@ -36,6 +36,14 @@ New Features
> >
> >       This section is a comment. Make sure to start the actual text at the margin.
> >
> > +   * **Updated the ixgbe base driver.**
> > +
> > +     Updated the ixgbe base driver, including the following changes:
> > +
> > +     * add X550em_a 10G PHY support
> > +     * add VF multicast promiscuous mode support
> > +     * support flow control auto negotiation for X550em_a 1G PHY
> > +     * add X550em_a FW ALEF support
> 
> Does it worth mention following, or these are internal details:
> 
> increase mailbox version to ixgbe_mbox_api_13?
I think it’s worth mentioned. It's the interface between PF and VF.

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

* Re: [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support
  2016-09-19 17:07   ` Ferruh Yigit
@ 2016-09-22  2:56     ` Lu, Wenzhuo
  2016-09-23  6:47       ` Wang, Xiao W
  0 siblings, 1 reply; 107+ messages in thread
From: Lu, Wenzhuo @ 2016-09-22  2:56 UTC (permalink / raw)
  To: Yigit, Ferruh, Wang, Xiao W; +Cc: dev

Hi Xiao,


> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:08 AM
> To: Wang, Xiao W; Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF
> support
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > This patch adds X550em_a FW ALEF support for B0 per DCR 64. ALEF is
> 
> Is it required more information on B0 and ALEF. Is there an official name for B0?
I think we should focus on the change. Users will have no idea about B0.

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

* Re: [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA
  2016-09-19 17:00   ` Ferruh Yigit
@ 2016-09-22 15:58     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-22 15:58 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:01 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for
> setting VFTA
> 
> On 8/27/2016 4:47 PM, Xiao Wang wrote:
> > The delta value rather than vfta_delta pointer should be checked.
> >
> > Fixes: b978f7b38c14 ("net/ixgbe/base: simplify VLAN management")
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_82598.c  | 6 +++---
> >  drivers/net/ixgbe/base/ixgbe_api.c    | 7 ++++---
> >  drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
> >  3 files changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_82598.c
> b/drivers/net/ixgbe/base/ixgbe_82598.c
> > index db80880..724dcbb 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_82598.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_82598.c
> > @@ -995,19 +995,19 @@ STATIC s32 ixgbe_clear_vmdq_82598(struct
> ixgbe_hw *hw, u32 rar, u32 vmdq)
> >   *  @vlan: VLAN id to write to VLAN filter
> >   *  @vind: VMDq output index that maps queue to VLAN id in VFTA
> >   *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
> > - *  @bypass_vlvf: boolean flag - unused
> > + *  @vlvf_bypass: boolean flag - unused
> 
> bypass_vlvf -> vlvf_bypass belongs to different patch
> 
> >   *
> >   *  Turn on/off specified VLAN in the VLAN filter table.
> >   **/
> >  s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
> > -			 bool vlan_on, bool bypass_vlvf)
> > +			 bool vlan_on, bool vlvf_bypass)
> >  {
> >  	u32 regindex;
> >  	u32 bitindex;
> >  	u32 bits;
> >  	u32 vftabyte;
> >
> > -	UNREFERENCED_1PARAMETER(bypass_vlvf);
> > +	UNREFERENCED_1PARAMETER(vlvf_bypass);
> >
> >  	DEBUGFUNC("ixgbe_set_vfta_82598");
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_api.c
> b/drivers/net/ixgbe/base/ixgbe_api.c
> > index 1786867..5b721af 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_api.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_api.c
> > @@ -1090,7 +1090,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan,
> u32 vind, bool vlan_on,
> >  		   bool vlvf_bypass)
> >  {
> >  	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
> > -				  vlan_on, vlvf_bypass),
> IXGBE_NOT_IMPLEMENTED);
> > +			       vlan_on, vlvf_bypass),
> IXGBE_NOT_IMPLEMENTED);
> >  }
> >
> >  /**
> > @@ -1100,7 +1100,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan,
> u32 vind, bool vlan_on,
> >   *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
> >   *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
> >   *  @vfta_delta: pointer to the difference between the current value of VFTA
> > - *               and the desired value
> > + *		 and the desired value
> >   *  @vfta: the desired value of the VFTA
> >   *  @vlvf_bypass: boolean flag indicating updating the default pool is okay
> >   *
> > @@ -1110,7 +1110,7 @@ s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan,
> u32 vind, bool vlan_on,
> >  		   u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
> >  {
> >  	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
> > -				vlan_on, vfta_delta, vfta, vlvf_bypass),
> > +			       vlan_on, vfta_delta, vfta, vlvf_bypass),
> >  			       IXGBE_NOT_IMPLEMENTED);
> >  }
> >
> > @@ -1659,6 +1659,7 @@ void ixgbe_init_swfw_semaphore(struct ixgbe_hw
> *hw)
> >  		hw->mac.ops.init_swfw_sync(hw);
> >  }
> >
> > +
> 
> unrelated whitespace modifications
> 
> 
> >  void ixgbe_disable_rx(struct ixgbe_hw *hw)
> >  {
> >  	if (hw->mac.ops.disable_rx)
> > diff --git a/drivers/net/ixgbe/base/ixgbe_common.c
> b/drivers/net/ixgbe/base/ixgbe_common.c
> > index 811875a..161bf32 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_common.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> > @@ -3967,7 +3967,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw,
> u32 vlan, u32 vind,
> >  		 * we run the risk of stray packets leaking into
> >  		 * the PF via the default pool
> >  		 */
> > -		if (vfta_delta)
> > +		if (*vfta_delta)
> 
> This seems only update mentioned in patch commit log.
> 
> What about extracting all other clean up modifications into a new patch,
> other patches also have similar fixes, all can go into that cleanup patch?

Good advice, I will put all the minor misc modifications into a separate patch.
Thanks.

> 
> >  			IXGBE_WRITE_REG(hw, IXGBE_VFTA(vlan / 32), vfta);
> >
> >  		/* disable VLVF and clear remaining bit from pool */
> >
> 

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

* Re: [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions
  2016-09-19 17:06   ` Ferruh Yigit
@ 2016-09-22 16:08     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-22 16:08 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:07 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED
> functions
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > Do parameter check to prevent exceptional value being written into
> > register.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_common.c | 15 ++++++++++++++-
> >  drivers/net/ixgbe/base/ixgbe_x540.c   |  6 ++++++
> >  2 files changed, 20 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_common.c
> b/drivers/net/ixgbe/base/ixgbe_common.c
> > index 1c7263d..3c3272e 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_common.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> > @@ -1133,6 +1133,9 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw,
> u32 index)
> >
> >  	DEBUGFUNC("ixgbe_led_on_generic");
> >
> > +	if (index > 3)
> 
> What about using macro for hardcoded value 3.

For the base (shared) code update, we'd better to keep DPDK in consistency
with kernel driver.

> 
> > +		return IXGBE_ERR_PARAM;
> > +
> >  	/* To turn on the LED, set mode to ON. */
> >  	led_reg &= ~IXGBE_LED_MODE_MASK(index);
> >  	led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index);
> > @@ -1153,6 +1156,9 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw,
> u32 index)
> >
> >  	DEBUGFUNC("ixgbe_led_off_generic");
> >
> > +	if (index > 3)
> > +		return IXGBE_ERR_PARAM;
> > +
> >  	/* To turn off the LED, set mode to OFF. */
> >  	led_reg &= ~IXGBE_LED_MODE_MASK(index);
> >  	led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index);
> > @@ -3341,7 +3347,7 @@ s32 prot_autoc_write_generic(struct ixgbe_hw
> *hw, u32 reg_val, bool locked)
> >   **/
> >  s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw)
> >  {
> > -	int secrxreg;
> > +	u32 secrxreg;
> 
> This modification seems unrelated with the patch.

Will put such minor change into a cleanup patch.

> 
> >
> 

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

* Re: [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550
  2016-09-19 17:07   ` Ferruh Yigit
@ 2016-09-23  0:59     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  0:59 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:08 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg
> supported for X550
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > Make sure ixgbe_device_supports_autoneg_fc() returns true for the device
> > IDs of Seabrook and Shady Acres.
> 
> Is these IDs official public ones?

I will remove such name in v2.

> 
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_common.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_common.c
> b/drivers/net/ixgbe/base/ixgbe_common.c
> > index bc12bc1..9776ab9 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_common.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> > @@ -189,6 +189,8 @@ bool ixgbe_device_supports_autoneg_fc(struct
> ixgbe_hw *hw)
> >  		case IXGBE_DEV_ID_X550T1:
> >  		case IXGBE_DEV_ID_X550EM_X_10G_T:
> >  		case IXGBE_DEV_ID_X550EM_A_10G_T:
> > +		case IXGBE_DEV_ID_X550EM_A_1G_T:
> > +		case IXGBE_DEV_ID_X550EM_A_1G_T_L:
> >  			supported = true;
> >  			break;
> >  		default:
> >
> 

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

* Re: [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous
  2016-09-19 17:05   ` Ferruh Yigit
@ 2016-09-23  3:35     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  3:35 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:06 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast
> promiscuous
> 
> On 8/27/2016 4:47 PM, Xiao Wang wrote:
> > Currently, VF is limited to 30 multicast addresses. In order to
> > accommodate more addresses, this patch adds support for VF multicast
> > promiscuous.
> 
> It looks like functionality not changed, just
> ixgbevf_update_xcast_mode() moved to ixgbe_mac_operations struct.
> 
> Is 30 multicast address limitation remains with this patch?
> 

You're right, we have supported this feature in ixgbe_ethdev.c before, now shared
code supports it, so it looks like just a function movement patch.
I will rewrite the commit log to avoid misunderstanding.

> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_mbx.h  |  2 +-
> >  drivers/net/ixgbe/base/ixgbe_type.h |  1 +
> >  drivers/net/ixgbe/base/ixgbe_vf.c   | 38
> ++++++++++++++++++++++++++++++++
> >  drivers/net/ixgbe/base/ixgbe_vf.h   |  1 +
> >  drivers/net/ixgbe/ixgbe_ethdev.c    | 43 ++-----------------------------------
> >  5 files changed, 43 insertions(+), 42 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h
> b/drivers/net/ixgbe/base/ixgbe_mbx.h
> > index d775142..c3e301f 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_mbx.h
> > +++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
> > @@ -111,7 +111,7 @@ enum ixgbe_pfvf_api_rev {
> >  /* mailbox API, version 1.2 VF requests */
> >  #define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
> >  #define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
> > -#define IXGBE_VF_UPDATE_XCAST_MODE	0x0C
> > +#define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
> >
> >  /* GET_QUEUES return data indices within the mailbox */
> >  #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues
> supported */
> > diff --git a/drivers/net/ixgbe/base/ixgbe_type.h
> b/drivers/net/ixgbe/base/ixgbe_type.h
> > index b2fdfcd..96b5cbd 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_type.h
> > +++ b/drivers/net/ixgbe/base/ixgbe_type.h
> > @@ -3883,6 +3883,7 @@ struct ixgbe_mac_operations {
> >  	s32 (*init_uta_tables)(struct ixgbe_hw *);
> >  	void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
> >  	void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
> > +	s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
> >
> >  	/* Flow Control */
> >  	s32 (*fc_enable)(struct ixgbe_hw *);
> > diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c
> b/drivers/net/ixgbe/base/ixgbe_vf.c
> > index a75074a..20a739c 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> > @@ -75,6 +75,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
> >  	hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf;
> >  	hw->mac.ops.init_rx_addrs = NULL;
> >  	hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
> > +	hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode;
> >  	hw->mac.ops.enable_mc = NULL;
> >  	hw->mac.ops.disable_mc = NULL;
> >  	hw->mac.ops.clear_vfta = NULL;
> > @@ -419,6 +420,43 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw
> *hw, u8 *mc_addr_list,
> >  }
> >
> >  /**
> > + *  ixgbevf_update_xcast_mode - Update Multicast mode
> > + *  @hw: pointer to the HW structure
> > + *  @xcast_mode: new multicast mode
> > + *
> > + *  Updates the Multicast Mode of VF.
> > + **/
> > +s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
> > +{
> > +	struct ixgbe_mbx_info *mbx = &hw->mbx;
> > +	u32 msgbuf[2];
> > +	s32 err;
> > +
> > +	switch (hw->api_version) {
> > +	case ixgbe_mbox_api_12:
> > +		break;
> > +	default:
> > +		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
> > +	}
> > +
> > +	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
> > +	msgbuf[1] = xcast_mode;
> > +
> > +	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
> > +	if (err)
> > +		return err;
> > +
> > +	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
> > +	if (err)
> > +		return err;
> > +
> > +	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> > +	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE |
> IXGBE_VT_MSGTYPE_NACK))
> 
> What if other flags set in msgbuf[0]
> Please check 18/39 patch, which fixes something similar to this
> 

This condition should be as (msgbuf[0] == original value of msgbuf[0] | NACK ),
It's what the 18/39 patch fixes. No such issue for this function.

Thanks,
Xiao
> 
> > +		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
> > +	return IXGBE_SUCCESS;
> > +}
> > +

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

* Re: [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version
  2016-09-19 17:03   ` Ferruh Yigit
@ 2016-09-23  3:50     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  3:50 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:03 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version
> 
> On 8/27/2016 4:47 PM, Xiao Wang wrote:
> > This patch will pave the way for the new VF unicast promiscuous
> > mode support.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_mbx.h | 5 +++--
> >  drivers/net/ixgbe/base/ixgbe_vf.c  | 2 ++
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h
> b/drivers/net/ixgbe/base/ixgbe_mbx.h
> > index c3e301f..7556a81 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_mbx.h
> > +++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
> > @@ -90,6 +90,7 @@ enum ixgbe_pfvf_api_rev {
> >  	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
> >  	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
> >  	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
> > +	ixgbe_mbox_api_13,	/* API version 1.3, linux/freebsd VF driver */
> >  	/* This value should always be last */
> >  	ixgbe_mbox_api_unknown,	/* indicates that API version is not
> known */
> >  };
> > @@ -109,8 +110,8 @@ enum ixgbe_pfvf_api_rev {
> >  #define IXGBE_VF_GET_QUEUES	0x09 /* get queue configuration */
> >
> >  /* mailbox API, version 1.2 VF requests */
> > -#define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
> > -#define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
> > +#define IXGBE_VF_GET_RETA      0x0a    /* VF request for RETA */
> > +#define IXGBE_VF_GET_RSS_KEY	0x0b    /* get RSS key */
> 
> is this intentional, since breaks tab alignment, and the values are not
> changes actually.
> 

Such minor change is to keep in consistency with kernel base code.
I need to put all such modifications into one cleanup patch.

> >  #define IXGBE_VF_UPDATE_XCAST_MODE	0x0c

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

* Re: [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface
  2016-09-19 17:04   ` Ferruh Yigit
@ 2016-09-23  5:16     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  5:16 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:04 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host
> interface
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > This patch makes sure that we access IOSF registers through the HIC
> > (host interface command) for the majority of X550em devices. All devices
> > with NVM are capable of using the HIC.
> >
> > For consistency all instances where the ixgbe_read/write_iosf_sb_reg_x550
> > is called directly are converted to function pointer calls.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_phy.c  |  2 +-
> >  drivers/net/ixgbe/base/ixgbe_x550.c | 38 ++++++++++++++++++++++----------
> -----
> >  2 files changed, 24 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c
> b/drivers/net/ixgbe/base/ixgbe_phy.c
> > index d33d0f8..ee8618f 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_phy.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_phy.c
> > @@ -741,7 +741,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw
> *hw, u32 reg_addr,
> >  	DEBUGFUNC("ixgbe_write_phy_reg_generic");
> >
> >  	if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) {
> > -		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
> > +		status = hw->phy.ops.write_reg_mdi(hw, reg_addr,
> device_type,
> >  						 phy_data);
> 
> Is this IOSF register?

No, it's not. For consistency this patch converts this function call to function pointer
call.  I will cover this in the v2 commit log.

> 
> ...
> 
> > @@ -4504,7 +4512,7 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw
> *hw, u32 reg_addr,
> >  	DEBUGFUNC("ixgbe_write_phy_reg_x550a");
> >
> >  	if (hw->mac.ops.acquire_swfw_sync(hw, mask) == IXGBE_SUCCESS) {
> > -		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
> > +		status = hw->phy.ops.write_reg_mdi(hw, reg_addr,
> device_type,
> 
> same question?
> 
> >  						 phy_data);
> >  		hw->mac.ops.release_swfw_sync(hw, mask);
> >  	} else {
> >
> 

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

* Re: [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK
  2016-09-19 17:07   ` Ferruh Yigit
@ 2016-09-23  6:05     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  6:05 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:07 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > Previously we checked only msgbuf[0] for
> 
> "return buffer" instead of msgbuf[0] ?
> 

Looks better. Use it in v2.

> > (IXGBE_VF_SET_MACVLAN |  IXGBE_VT_MSGTYPE_NACK), but this would not
> > work if index != 0 and as a result NACK will not be detected.
> 
> "write buffer is not 0" instead of "index != 0"
> 

    msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT;
    msgbuf[0] |= IXGBE_VF_SET_MACVLAN;

"index != 0" has effect on the msgbuf[0], so we should emphasize on "index".
I will change it to "index is not 0" in v2.

> >
> 
> Function also starts using ixgbevf_write_msg_read_ack() instead of
> separate write and read, is it possible to fix NACK only in this patch,
> and do ixgbevf_write_msg_read_ack() switch in patch 27/39.
> If prefer to keep in this patch, please mention about this switch in
> comment log.
> 

Agree. Thanks.

> > Fixes: af75078fece3 ("first public release")
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_vf.c | 18 ++++++++----------
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c
> b/drivers/net/ixgbe/base/ixgbe_vf.c
> > index c0fedea..f60ff7d 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_vf.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_vf.c
> > @@ -529,8 +529,7 @@ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8
> *mac_addr)
> >
> >  s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
> >  {
> > -	struct ixgbe_mbx_info *mbx = &hw->mbx;
> > -	u32 msgbuf[3];
> > +	u32 msgbuf[3], msgbuf_chk;
> >  	u8 *msg_addr = (u8 *)(&msgbuf[1]);
> >  	s32 ret_val;
> >
> > @@ -543,18 +542,17 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw,
> u32 index, u8 *addr)
> >  	 */
> >  	msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT;
> >  	msgbuf[0] |= IXGBE_VF_SET_MACVLAN;
> > +	msgbuf_chk = msgbuf[0];
> >  	if (addr)
> >  		memcpy(msg_addr, addr, 6);
> > -	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
> >
> > -	if (!ret_val)
> > -		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
> > +	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
> > +	if (!ret_val) {
> > +		msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> >
> > -	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
> > -
> > -	if (!ret_val)
> > -		if (msgbuf[0] == (IXGBE_VF_SET_MACVLAN |
> IXGBE_VT_MSGTYPE_NACK))
> > -			ret_val = IXGBE_ERR_OUT_OF_MEM;
> > +		if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_NACK))
> > +			return IXGBE_ERR_OUT_OF_MEM;
> 
> What about following instead of introducing msgbuf_chk:
> 
> if ((msgbuf[0] & IXGBE_VF_SET_MACVLAN) &&
> 	    (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK))
> 
> Please check patch 15/39

It's different from 15/39 where the write buffer is simple,
Here the write buffer msgbuf[0] is more complicated, if we don't
introduce msgbuf_chk, the code will looks bloated. 

> 
> > +	}
> >
> >  	return ret_val;
> >  }
> >
> 
> 

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

* Re: [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support
  2016-09-22  2:56     ` Lu, Wenzhuo
@ 2016-09-23  6:47       ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  6:47 UTC (permalink / raw)
  To: Lu, Wenzhuo, Yigit, Ferruh; +Cc: dev

Hi Wenzhuo,

> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Thursday, September 22, 2016 10:57 AM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF
> support
> 
> Hi Xiao,
> 
> 
> > -----Original Message-----
> > From: Yigit, Ferruh
> > Sent: Tuesday, September 20, 2016 1:08 AM
> > To: Wang, Xiao W; Lu, Wenzhuo
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW
> ALEF
> > support
> >
> > On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > > This patch adds X550em_a FW ALEF support for B0 per DCR 64. ALEF is
> >
> > Is it required more information on B0 and ALEF. Is there an official name for
> B0?
> I think we should focus on the change. Users will have no idea about B0.

OK, I will remove these info.

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

* Re: [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access
  2016-09-19 17:08   ` Ferruh Yigit
@ 2016-09-23  8:06     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-23  8:06 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:08 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for
> shadow RAM access
> 
> On 8/27/2016 4:48 PM, Xiao Wang wrote:
> > The semaphore is not being held for complete shadow RAM accesses
> > which could result in corruption. Refactor the code so that it is
> > possible to hold the semaphore around ixgbe_host_interface_command
> > by introducing an unlocked form. This patch also eliminates the
> > function ixgbe_read_ee_hostif_data_X550 in favor of the function
> > ixgbe_read_ee_hostif_X550 and it now gets both semaphore bits
> > at once instead of nesting them. The new arrangement is able to
> > get both the management interface and the EEPROM semaphores at the
> > same time instead of separately.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  drivers/net/ixgbe/base/ixgbe_common.c | 106 ++++++++++++++++++++++---
> ---------
> >  drivers/net/ixgbe/base/ixgbe_common.h |   3 +-
> >  drivers/net/ixgbe/base/ixgbe_x550.c   |  57 +++++-------------
> >  drivers/net/ixgbe/base/ixgbe_x550.h   |   2 -
> >  4 files changed, 88 insertions(+), 80 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_common.c
> b/drivers/net/ixgbe/base/ixgbe_common.c
> > index 9776ab9..d31fb81 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_common.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> > @@ -1066,7 +1066,7 @@ void ixgbe_set_lan_id_multi_port_pcie(struct
> ixgbe_hw *hw)
> >  	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP) {
> >  		hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_4,
> &ee_ctrl_4);
> >  		bus->instance_id = (ee_ctrl_4 & IXGBE_EE_CTRL_4_INST_ID) >>
> > -			IXGBE_EE_CTRL_4_INST_ID_SHIFT;
> > +				   IXGBE_EE_CTRL_4_INST_ID_SHIFT;
> >  	}
> >  }
> >
> > @@ -2877,7 +2877,7 @@ out:
> >   *  advertised settings
> >   **/
> >  s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
> > -			      u32 adv_sym, u32 adv_asm, u32 lp_sym, u32
> lp_asm)
> > +		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
> >  {
> >  	if ((!(adv_reg)) ||  (!(lp_reg))) {
> >  		ERROR_REPORT3(IXGBE_ERROR_UNSUPPORTED,
> > @@ -3920,7 +3920,8 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw,
> u32 vlan, u32 vind,
> >  	vfta_delta = 1 << (vlan % 32);
> >  	vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx));
> >
> > -	/* vfta_delta represents the difference between the current value
> > +	/*
> > +	 * vfta_delta represents the difference between the current value
> 
> These whitespace fixes not belong to this patch.
> It is good to make cleanups, but these are making noise for real patch,
> there are a few more of these in previous patches, perhaps all can be
> merged into a cleanup patch?
> 

Yes, will merge them into a cleanup patch.

> >  	 * of vfta and the value we want in the register.  Since the diff
> >  	 * is an XOR mask we can just update the vfta using an XOR
> >  	 */
> > @@ -3953,7 +3954,7 @@ vfta_update:
> >   *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
> >   *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
> >   *  @vfta_delta: pointer to the difference between the current value of VFTA
> > - * and the desired value
> > + *		 and the desired value
> >   *  @vfta: the desired value of the VFTA
> >   *  @vlvf_bypass: boolean flag indicating updating default pool is okay
> >   *
> > @@ -3980,6 +3981,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw,
> u32 vlan, u32 vind,
> >  	 */
> >  	if (!(IXGBE_READ_REG(hw, IXGBE_VT_CTL) &
> IXGBE_VT_CTL_VT_ENABLE))
> >  		return IXGBE_SUCCESS;
> > +
> >  	vlvf_index = ixgbe_find_vlvf_slot(hw, vlan, vlvf_bypass);
> >  	if (vlvf_index < 0)
> >  		return vlvf_index;
> > @@ -4009,6 +4011,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw,
> u32 vlan, u32 vind,
> >
> >  		return IXGBE_SUCCESS;
> >  	}
> > +
> >  	/* If there are still bits set in the VLVFB registers
> >  	 * for the VLAN ID indicated we need to see if the
> >  	 * caller is requesting that we clear the VFTA entry bit.
> > @@ -4413,43 +4416,31 @@ u8 ixgbe_calculate_checksum(u8 *buffer, u32
> length)
> >  }
> >
> >  /**
> > - *  ixgbe_host_interface_command - Issue command to manageability block
> > + *  ixgbe_hic_unlocked - Issue command to manageability block unlocked
> >   *  @hw: pointer to the HW structure
> > - *  @buffer: contains the command to write and where the return status will
> > - *   be placed
> > + *  @buffer: command to write and where the return status will be placed
> >   *  @length: length of buffer, must be multiple of 4 bytes
> >   *  @timeout: time in ms to wait for command completion
> > - *  @return_data: read and return data from the buffer (true) or not (false)
> > - *   Needed because FW structures are big endian and decoding of
> > - *   these fields can be 8 bit or 16 bit based on command. Decoding
> > - *   is not easily understood without making a table of commands.
> > - *   So we will leave this up to the caller to read back the data
> > - *   in these cases.
> >   *
> >   *  Communicates with the manageability block. On success return
> IXGBE_SUCCESS
> >   *  else returns semaphore error when encountering an error acquiring
> >   *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when
> command fails.
> > + *
> > + *  This function assumes that the IXGBE_GSSR_SW_MNG_SM semaphore is
> held
> > + *  by the caller.
> >   **/
> > -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 *hw, u32 *buffer, u32 length,
> > +		       u32 timeout)
> >  {
> > -	u32 hicr, i, bi, fwsts;
> > -	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
> > -	u16 buf_len;
> > +	u32 hicr, i, fwsts;
> >  	u16 dword_len;
> > -	s32 status;
> >
> > -	DEBUGFUNC("ixgbe_host_interface_command");
> > +	DEBUGFUNC("ixgbe_hic_unlocked");
> >
> > -	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
> > +	if (!length || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
> >  		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
> >  		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
> >  	}
> > -	/* Take management host interface semaphore */
> > -	status = hw->mac.ops.acquire_swfw_sync(hw,
> IXGBE_GSSR_SW_MNG_SM);
> > -
> > -	if (status)
> > -		return status;
> >
> >  	/* Set bit 9 of FWSTS clearing FW reset indication */
> >  	fwsts = IXGBE_READ_REG(hw, IXGBE_FWSTS);
> > @@ -4457,17 +4448,15 @@ s32 ixgbe_host_interface_command(struct
> ixgbe_hw *hw, u32 *buffer,
> >
> >  	/* Check that the host interface is enabled. */
> >  	hicr = IXGBE_READ_REG(hw, IXGBE_HICR);
> > -	if ((hicr & IXGBE_HICR_EN) == 0) {
> > +	if (!(hicr & IXGBE_HICR_EN)) {
> >  		DEBUGOUT("IXGBE_HOST_EN bit disabled.\n");
> > -		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
> > -		goto rel_out;
> > +		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
> >  	}
> >
> >  	/* Calculate length in DWORDs. We must be DWORD aligned */
> > -	if ((length % (sizeof(u32))) != 0) {
> > +	if (length % sizeof(u32)) {
> >  		DEBUGOUT("Buffer length failure, not aligned to dword");
> > -		status = IXGBE_ERR_INVALID_ARGUMENT;
> > -		goto rel_out;
> > +		return IXGBE_ERR_INVALID_ARGUMENT;
> >  	}
> >
> >  	dword_len = length >> 2;
> > @@ -4490,14 +4479,59 @@ s32 ixgbe_host_interface_command(struct
> ixgbe_hw *hw, u32 *buffer,
> >  	}
> >
> >  	/* Check command completion */
> > -	if ((timeout != 0 && i == timeout) ||
> > +	if ((timeout && i == timeout) ||
> >  	    !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) {
> >  		ERROR_REPORT1(IXGBE_ERROR_CAUTION,
> >  			     "Command has failed with no status valid.\n");
> > -		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
> > -		goto rel_out;
> > +		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
> > +	}
> > +
> > +	return IXGBE_SUCCESS;
> > +}
> > +
> > +/**
> > + *  ixgbe_host_interface_command - Issue command to manageability block
> > + *  @hw: pointer to the HW structure
> > + *  @buffer: contains the command to write and where the return status will
> > + *   be placed
> > + *  @length: length of buffer, must be multiple of 4 bytes
> > + *  @timeout: time in ms to wait for command completion
> > + *  @return_data: read and return data from the buffer (true) or not (false)
> > + *   Needed because FW structures are big endian and decoding of
> > + *   these fields can be 8 bit or 16 bit based on command. Decoding
> > + *   is not easily understood without making a table of commands.
> > + *   So we will leave this up to the caller to read back the data
> > + *   in these cases.
> > + *
> > + *  Communicates with the manageability block. On success return
> IXGBE_SUCCESS
> > + *  else returns semaphore error when encountering an error acquiring
> > + *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when
> command fails.
> > + **/
> > +s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
> > +				 u32 length, u32 timeout, bool return_data)
> > +{
> > +	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
> > +	u16 dword_len;
> > +	u16 buf_len;
> > +	s32 status;
> > +	u32 bi;
> > +
> > +	DEBUGFUNC("ixgbe_host_interface_command");
> > +
> > +	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
> > +		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
> > +		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
> >  	}
> >
> > +	/* Take management host interface semaphore */
> > +	status = hw->mac.ops.acquire_swfw_sync(hw,
> IXGBE_GSSR_SW_MNG_SM);
> > +	if (status)
> > +		return status;
> > +
> > +	status = ixgbe_hic_unlocked(hw, buffer, length, timeout);
> > +	if (status)
> > +		goto rel_out;
> > +
> >  	if (!return_data)
> >  		goto rel_out;
> >
> > @@ -4512,7 +4546,7 @@ s32 ixgbe_host_interface_command(struct
> ixgbe_hw *hw, u32 *buffer,
> >
> >  	/* If there is any thing in data position pull it in */
> >  	buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len;
> > -	if (buf_len == 0)
> > +	if (!buf_len)
> >  		goto rel_out;
> >
> >  	if (length < buf_len + hdr_size) {
> > diff --git a/drivers/net/ixgbe/base/ixgbe_common.h
> b/drivers/net/ixgbe/base/ixgbe_common.h
> > index 0545f85..66dd565 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_common.h
> > +++ b/drivers/net/ixgbe/base/ixgbe_common.h
> > @@ -133,7 +133,7 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw,
> u32 rar, u32 vmdq);
> >  s32 ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, u8 *addr, u32
> vmdq);
> >  s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
> >  s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
> > -			   u32 vind, bool vlan_on, bool vlvf_bypass);
> > +			 u32 vind, bool vlan_on, bool vlvf_bypass);
> >  s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
> >  			   bool vlan_on, u32 *vfta_delta, u32 vfta,
> >  			   bool vlvf_bypass);
> > @@ -159,6 +159,7 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw
> *hw, u8 maj, u8 min,
> >  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);
> >
> >  void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c
> b/drivers/net/ixgbe/base/ixgbe_x550.c
> > index 0cc7a3f..6f4dfd9 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_x550.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_x550.c
> > @@ -3192,13 +3192,13 @@ s32 ixgbe_setup_phy_loopback_x550em(struct
> ixgbe_hw *hw)
> >   *
> >   *  Reads a 16 bit word from the EEPROM using the hostif.
> >   **/
> > -s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
> > -				   u16 *data)
> > +s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data)
> >  {
> > -	s32 status;
> > +	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
> >  	struct ixgbe_hic_read_shadow_ram buffer;
> > +	s32 status;
> >
> > -	DEBUGFUNC("ixgbe_read_ee_hostif_data_X550");
> > +	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
> >  	buffer.hdr.req.cmd = FW_READ_SHADOW_RAM_CMD;
> >  	buffer.hdr.req.buf_lenh = 0;
> >  	buffer.hdr.req.buf_lenl = FW_READ_SHADOW_RAM_LEN;
> > @@ -3209,42 +3209,18 @@ s32 ixgbe_read_ee_hostif_data_X550(struct
> ixgbe_hw *hw, u16 offset,
> >  	/* one word */
> >  	buffer.length = IXGBE_CPU_TO_BE16(sizeof(u16));
> >
> > -	status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
> > -					      sizeof(buffer),
> > -					      IXGBE_HI_COMMAND_TIMEOUT,
> false);
> > -
> > +	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
> >  	if (status)
> >  		return status;
> >
> > -	*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
> > -					  FW_NVM_DATA_OFFSET);
> > -
> > -	return 0;
> > -}
> > -
> > -/**
> > - *  ixgbe_read_ee_hostif_X550 - Read EEPROM word using a host interface
> command
> > - *  @hw: pointer to hardware structure
> > - *  @offset: offset of  word in the EEPROM to read
> > - *  @data: word read from the EEPROM
> > - *
> > - *  Reads a 16 bit word from the EEPROM using the hostif.
> > - **/
> > -s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
> > -			      u16 *data)
> > -{
> > -	s32 status = IXGBE_SUCCESS;
> > -
> > -	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
> > -
> > -	if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
> > -	    IXGBE_SUCCESS) {
> > -		status = ixgbe_read_ee_hostif_data_X550(hw, offset, data);
> > -		hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
> > -	} else {
> > -		status = IXGBE_ERR_SWFW_SYNC;
> > +	status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
> > +				    IXGBE_HI_COMMAND_TIMEOUT);
> > +	if (!status) {
> > +		*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
> > +						  FW_NVM_DATA_OFFSET);
> >  	}
> >
> > +	hw->mac.ops.release_swfw_sync(hw, mask);
> >  	return status;
> >  }
> >
> > @@ -3260,6 +3236,7 @@ s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw
> *hw, u16 offset,
> >  s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
> >  				     u16 offset, u16 words, u16 *data)
> >  {
> > +	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
> >  	struct ixgbe_hic_read_shadow_ram buffer;
> >  	u32 current_word = 0;
> >  	u16 words_to_read;
> > @@ -3269,7 +3246,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct
> ixgbe_hw *hw,
> >  	DEBUGFUNC("ixgbe_read_ee_hostif_buffer_X550");
> >
> >  	/* Take semaphore for the entire operation. */
> > -	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
> > +	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
> >  	if (status) {
> >  		DEBUGOUT("EEPROM read buffer - semaphore failed\n");
> >  		return status;
> > @@ -3289,10 +3266,8 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct
> ixgbe_hw *hw,
> >  		buffer.address = IXGBE_CPU_TO_BE32((offset + current_word)
> * 2);
> >  		buffer.length = IXGBE_CPU_TO_BE16(words_to_read * 2);
> >
> > -		status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
> > -						      sizeof(buffer),
> > -
> IXGBE_HI_COMMAND_TIMEOUT,
> > -						      false);
> > +		status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
> > +					    IXGBE_HI_COMMAND_TIMEOUT);
> >
> >  		if (status) {
> >  			DEBUGOUT("Host interface command failed\n");
> > @@ -3317,7 +3292,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct
> ixgbe_hw *hw,
> >  	}
> >
> >  out:
> > -	hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
> > +	hw->mac.ops.release_swfw_sync(hw, mask);
> >  	return status;
> >  }
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h
> b/drivers/net/ixgbe/base/ixgbe_x550.h
> > index c7253f0..36b36f6 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_x550.h
> > +++ b/drivers/net/ixgbe/base/ixgbe_x550.h
> > @@ -55,8 +55,6 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw
> *hw,
> >  				     u16 offset, u16 words, u16 *data);
> >  s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
> >  u16				*data);
> > -s32 ixgbe_read_ee_hostif_data_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);
> >
> 

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

* Re: [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data
  2016-09-19 17:01   ` Ferruh Yigit
@ 2016-09-25  0:36     ` Wang, Xiao W
  0 siblings, 0 replies; 107+ messages in thread
From: Wang, Xiao W @ 2016-09-25  0:36 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo; +Cc: dev

Hi Ferruh,

> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, September 20, 2016 1:01 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of
> PHY data
> 
> On 8/27/2016 4:47 PM, Xiao Wang wrote:
> > The latest firmware reverses the endianness of the PHY data read and
> 
> Good to add the fw version for future references

I consulted ND author of the this base driver patch and got that it was fw just for x550a.
The fw change has nothing to do with the other devices.
Will emphasize this on the v2 commit log.

> 
> > written via host interface command, so make corresponding changes
> > to that.
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> 

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

* [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update
  2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
  2016-09-19 17:00   ` Ferruh Yigit
@ 2016-09-25  8:59   ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 01/40] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
                       ` (40 more replies)
  1 sibling, 41 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

v2: - Moved minor changes into a cleanup patch.
    - Removed some unofficial names in commit log.
	- Rewrote the commit log of patch 05/40 to describe what the patch
      actually does.
    - Improved the wording of some commit log.

Update ixgbe base driver, including the following changes:

* add X550em_a 10G PHY support
* support flow control auto negotiation for X550em_a 1G PHY
* add X550em_a FW ALEF support
* increase mailbox version to ixgbe_mbox_api_13
* add two MAC ops for Hyper-V support
* some functional fixes

Xiao Wang (40):
  net/ixgbe/base: fix delta check for setting VFTA
  net/ixgbe/base: remove X550em SFP iXFI setup
  net/ixgbe/base: change endianness of PHY data
  net/ixgbe/base: add X550em_a 10G PHY support
  net/ixgbe/base: move vf_update_xcast_mode to base code
  net/ixgbe/base: introduce new ops init functions
  net/ixgbe/base: separate PHY probe code
  net/ixgbe/base: fully initialize X550em_a 1G PHYs
  net/ixgbe/base: add macros for VF promiscuous mode
  net/ixgbe/base: add FC setup for X550em_a fiber
  net/ixgbe/base: add FC autoneg for X550em_a fiber
  net/ixgbe/base: clear page register in error path
  net/ixgbe/base: configure DMAC for 10Mb operation
  net/ixgbe/base: fix function comments about X550
  net/ixgbe/base: report setting LPE register error
  net/ixgbe/base: bump mailbox version
  net/ixgbe/base: access IOSF by host interface
  net/ixgbe/base: fix check on NACK
  net/ixgbe/base: define X550 PCIe serial MAC addr
  net/ixgbe/base: bypass checking link for crosstalk
  net/ixgbe/base: support X550em_a SGMII FC autoneg
  net/ixgbe/base: add macros for GENEVE UDP port
  net/ixgbe/base: add bound check in LED functions
  net/ixgbe/base: use default check link function
  net/ixgbe/base: set default autoneg speed at reset
  net/ixgbe/base: add missing FDIRSCTPM mask setting
  net/ixgbe/base: commonize mailbox write and read
  net/ixgbe/base: reduce delay for SWFW semaphore
  net/ixgbe/base: report autoneg supported for X550
  net/ixgbe/base: remove X550em_a 100Mbps support
  net/ixgbe/base: unify link speed value
  net/ixgbe/base: separate ops init from PHY init
  net/ixgbe/base: add X550em_a FW ALEF support
  net/ixgbe/base: add two MAC ops for Hyper-V
  net/ixgbe/base: hold semaphore for shadow RAM access
  net/ixgbe/base: update X550em_a backplane speed
  net/ixgbe/base: clean code of flow control autoneg
  net/ixgbe/base: do not skip PHY configuration
  net/ixgbe/base: clean up
  net/ixgbe/base: add base driver update brief

 doc/guides/rel_notes/release_16_11.rst |    9 +
 drivers/net/ixgbe/base/README          |    2 +-
 drivers/net/ixgbe/base/ixgbe_82598.c   |    6 +-
 drivers/net/ixgbe/base/ixgbe_82599.c   |   16 +-
 drivers/net/ixgbe/base/ixgbe_api.c     |   11 +-
 drivers/net/ixgbe/base/ixgbe_api.h     |    2 +
 drivers/net/ixgbe/base/ixgbe_common.c  |  258 +++++--
 drivers/net/ixgbe/base/ixgbe_common.h  |    3 +-
 drivers/net/ixgbe/base/ixgbe_mbx.h     |    7 +-
 drivers/net/ixgbe/base/ixgbe_osdep.h   |    1 +
 drivers/net/ixgbe/base/ixgbe_phy.c     |  100 ++-
 drivers/net/ixgbe/base/ixgbe_phy.h     |   71 +-
 drivers/net/ixgbe/base/ixgbe_type.h    |   73 +-
 drivers/net/ixgbe/base/ixgbe_vf.c      |  103 ++-
 drivers/net/ixgbe/base/ixgbe_vf.h      |    3 +-
 drivers/net/ixgbe/base/ixgbe_x540.c    |   10 +-
 drivers/net/ixgbe/base/ixgbe_x550.c    | 1262 +++++++++++++++++++++-----------
 drivers/net/ixgbe/base/ixgbe_x550.h    |   61 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       |   43 +-
 19 files changed, 1360 insertions(+), 681 deletions(-)

-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 01/40] net/ixgbe/base: fix delta check for setting VFTA
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 02/40] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
                       ` (39 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

The delta value rather than vfta_delta pointer should be checked.

Fixes: b978f7b38c14 ("net/ixgbe/base: simplify VLAN management")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed the unrelated minor modifications from this patch.

---
 drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 811875a..161bf32 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -3967,7 +3967,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		 * we run the risk of stray packets leaking into
 		 * the PF via the default pool
 		 */
-		if (vfta_delta)
+		if (*vfta_delta)
 			IXGBE_WRITE_REG(hw, IXGBE_VFTA(vlan / 32), vfta);
 
 		/* disable VLVF and clear remaining bit from pool */
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 02/40] net/ixgbe/base: remove X550em SFP iXFI setup
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 01/40] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 03/40] net/ixgbe/base: change endianness of PHY data Xiao Wang
                       ` (38 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch removes X550em SFP iXFI setup for the drivers since there
is no released hardware production with SFP iXFI.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 57 +++++++------------------------------
 1 file changed, 11 insertions(+), 46 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index aa6e859..b8fdb00 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -2460,53 +2460,18 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 	if (ret_val != IXGBE_SUCCESS)
 		return ret_val;
 
-	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
-		/* Configure CS4227 LINE side to 10G SR. */
-		reg_slice = IXGBE_CS4227_LINE_SPARE22_MSB +
-			    (hw->bus.lan_id << 12);
-		reg_val = IXGBE_CS4227_SPEED_10G;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
-			    (hw->bus.lan_id << 12);
+	/* Configure internal PHY for KR/KX. */
+	ixgbe_setup_kr_speed_x550em(hw, speed);
+
+	/* Configure CS4227 LINE side to proper mode. */
+	reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
+		    (hw->bus.lan_id << 12);
+	if (setup_linear)
+		reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
+	else
 		reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		/* Configure CS4227 for HOST connection rate then type. */
-		reg_slice = IXGBE_CS4227_HOST_SPARE22_MSB +
-			    (hw->bus.lan_id << 12);
-		reg_val = (speed & IXGBE_LINK_SPEED_10GB_FULL) ?
-		IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		reg_slice = IXGBE_CS4227_HOST_SPARE24_LSB +
-			    (hw->bus.lan_id << 12);
-		if (setup_linear)
-			reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
-		else
-			reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-
-		/* Setup XFI internal link. */
-		ret_val = ixgbe_setup_ixfi_x550em(hw, &speed);
-	} else {
-		/* Configure internal PHY for KR/KX. */
-		ixgbe_setup_kr_speed_x550em(hw, speed);
-
-		/* Configure CS4227 LINE side to proper mode. */
-		reg_slice = IXGBE_CS4227_LINE_SPARE24_LSB +
-			    (hw->bus.lan_id << 12);
-		if (setup_linear)
-			reg_val = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1;
-		else
-			reg_val = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1;
-		ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
-						  reg_val);
-	}
+	ret_val = hw->link.ops.write_link(hw, hw->link.addr, reg_slice,
+					  reg_val);
 	return ret_val;
 }
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 03/40] net/ixgbe/base: change endianness of PHY data
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 01/40] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 02/40] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 04/40] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
                       ` (37 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

The x550a related firmware reverses the endianness of the PHY data read
and written via host interface command, so make corresponding changes
to that.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Rewrote the commit log to emphasize that the change is x550a related.

---
 drivers/net/ixgbe/base/ixgbe_osdep.h | 1 +
 drivers/net/ixgbe/base/ixgbe_type.h  | 4 ++--
 drivers/net/ixgbe/base/ixgbe_x550.c  | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_osdep.h b/drivers/net/ixgbe/base/ixgbe_osdep.h
index 06d1ee1..77f0af5 100644
--- a/drivers/net/ixgbe/base/ixgbe_osdep.h
+++ b/drivers/net/ixgbe/base/ixgbe_osdep.h
@@ -100,6 +100,7 @@ enum {
 #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)
+#define IXGBE_BE32_TO_CPU(_i)  rte_be_to_cpu_32(_i)
 
 typedef uint8_t		u8;
 typedef int8_t		s8;
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 83818a9..b2fdfcd 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3136,13 +3136,13 @@ struct ixgbe_hic_internal_phy_req {
 	u8 command_type;
 	__be16 address;
 	u16 rsv1;
-	__le32 write_data;
+	__be32 write_data;
 	u16 pad;
 };
 
 struct ixgbe_hic_internal_phy_resp {
 	struct ixgbe_hic_hdr hdr;
-	__le32 read_data;
+	__be32 read_data;
 };
 
 #ifdef C99
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index b8fdb00..2c80a9b 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1278,7 +1278,7 @@ s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 	write_cmd.port_number = hw->bus.lan_id;
 	write_cmd.command_type = FW_INT_PHY_REQ_WRITE;
 	write_cmd.address = IXGBE_CPU_TO_BE16(reg_addr);
-	write_cmd.write_data = IXGBE_CPU_TO_LE32(data);
+	write_cmd.write_data = IXGBE_CPU_TO_BE32(data);
 
 	status = ixgbe_host_interface_command(hw, (u32 *)&write_cmd,
 					      sizeof(write_cmd),
@@ -1318,7 +1318,7 @@ s32 ixgbe_read_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 					      IXGBE_HI_COMMAND_TIMEOUT, true);
 
 	/* Extract the register value from the response. */
-	*data = IXGBE_LE32_TO_CPU(hic.rsp.read_data);
+	*data = IXGBE_BE32_TO_CPU(hic.rsp.read_data);
 
 	return status;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 04/40] net/ixgbe/base: add X550em_a 10G PHY support
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (2 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 03/40] net/ixgbe/base: change endianness of PHY data Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 05/40] net/ixgbe/base: move vf_update_xcast_mode to base code Xiao Wang
                       ` (36 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch use the shared MDIO functions ixgbe_read_phy_reg_x550a
and ixgbe_write_phy_reg_x550a for X550em_a 10G PHY which supports
flow control auto-negotiation.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 1 +
 drivers/net/ixgbe/base/ixgbe_x550.c   | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 161bf32..e46af23 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -188,6 +188,7 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 		case IXGBE_DEV_ID_X550T:
 		case IXGBE_DEV_ID_X550T1:
 		case IXGBE_DEV_ID_X550EM_X_10G_T:
+		case IXGBE_DEV_ID_X550EM_A_10G_T:
 			supported = true;
 			break;
 		default:
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 2c80a9b..5c09bfe 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -494,9 +494,12 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_KR_L:
 		hw->phy.type = ixgbe_phy_x550em_kr;
 		break;
+	case IXGBE_DEV_ID_X550EM_A_10G_T:
+		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
+		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
+       /* Fallthrough to ixgbe_identify_phy_generic */
 	case IXGBE_DEV_ID_X550EM_X_1G_T:
 	case IXGBE_DEV_ID_X550EM_X_10G_T:
-	case IXGBE_DEV_ID_X550EM_A_10G_T:
 		return ixgbe_identify_phy_generic(hw);
 	case IXGBE_DEV_ID_X550EM_A_1G_T:
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 05/40] net/ixgbe/base: move vf_update_xcast_mode to base code
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (3 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 04/40] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 06/40] net/ixgbe/base: introduce new ops init functions Xiao Wang
                       ` (35 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch adds update_xcast_mode callback in mac ops, and moves
ixgbevf_update_xcast_mode function into base code.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Rewrote the commit log to describe what the patch actually does.

---
 drivers/net/ixgbe/base/ixgbe_mbx.h  |  2 +-
 drivers/net/ixgbe/base/ixgbe_type.h |  1 +
 drivers/net/ixgbe/base/ixgbe_vf.c   | 38 ++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_vf.h   |  1 +
 drivers/net/ixgbe/ixgbe_ethdev.c    | 43 ++-----------------------------------
 5 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
index d775142..c3e301f 100644
--- a/drivers/net/ixgbe/base/ixgbe_mbx.h
+++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
@@ -111,7 +111,7 @@ enum ixgbe_pfvf_api_rev {
 /* mailbox API, version 1.2 VF requests */
 #define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
 #define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
-#define IXGBE_VF_UPDATE_XCAST_MODE	0x0C
+#define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
 
 /* GET_QUEUES return data indices within the mailbox */
 #define IXGBE_VF_TX_QUEUES	1	/* number of Tx queues supported */
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index b2fdfcd..96b5cbd 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3883,6 +3883,7 @@ struct ixgbe_mac_operations {
 	s32 (*init_uta_tables)(struct ixgbe_hw *);
 	void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
 	void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
+	s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
 
 	/* Flow Control */
 	s32 (*fc_enable)(struct ixgbe_hw *);
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index a75074a..20a739c 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -75,6 +75,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	hw->mac.ops.set_uc_addr = ixgbevf_set_uc_addr_vf;
 	hw->mac.ops.init_rx_addrs = NULL;
 	hw->mac.ops.update_mc_addr_list = ixgbe_update_mc_addr_list_vf;
+	hw->mac.ops.update_xcast_mode = ixgbevf_update_xcast_mode;
 	hw->mac.ops.enable_mc = NULL;
 	hw->mac.ops.disable_mc = NULL;
 	hw->mac.ops.clear_vfta = NULL;
@@ -419,6 +420,43 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 }
 
 /**
+ *  ixgbevf_update_xcast_mode - Update Multicast mode
+ *  @hw: pointer to the HW structure
+ *  @xcast_mode: new multicast mode
+ *
+ *  Updates the Multicast Mode of VF.
+ **/
+s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
+{
+	struct ixgbe_mbx_info *mbx = &hw->mbx;
+	u32 msgbuf[2];
+	s32 err;
+
+	switch (hw->api_version) {
+	case ixgbe_mbox_api_12:
+		break;
+	default:
+		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	}
+
+	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
+	msgbuf[1] = xcast_mode;
+
+	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
+	if (err)
+		return err;
+
+	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
+	if (err)
+		return err;
+
+	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
+	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
+		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	return IXGBE_SUCCESS;
+}
+
+/**
  *  ixgbe_set_vfta_vf - Set/Unset vlan filter table address
  *  @hw: pointer to the HW structure
  *  @vlan: 12 bit VLAN ID
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h b/drivers/net/ixgbe/base/ixgbe_vf.h
index 8851cb8..624a97d 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.h
+++ b/drivers/net/ixgbe/base/ixgbe_vf.h
@@ -131,6 +131,7 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr);
 s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 				 u32 mc_addr_count, ixgbe_mc_addr_itr,
 				 bool clear);
+s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		      bool vlan_on, bool vlvf_bypass);
 void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index d478a15..7794960 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -7236,51 +7236,12 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 	return ret;
 }
 
-/* ixgbevf_update_xcast_mode - Update Multicast mode
- * @hw: pointer to the HW structure
- * @netdev: pointer to net device structure
- * @xcast_mode: new multicast mode
- *
- * Updates the Multicast Mode of VF.
- */
-static int ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,
-				     int xcast_mode)
-{
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
-	u32 msgbuf[2];
-	s32 err;
-
-	switch (hw->api_version) {
-	case ixgbe_mbox_api_12:
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
-	msgbuf[1] = xcast_mode;
-
-	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
-	if (err)
-		return err;
-
-	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
-	if (err)
-		return err;
-
-	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
-	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
-		return -EPERM;
-
-	return 0;
-}
-
 static void
 ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_ALLMULTI);
 }
 
 static void
@@ -7288,7 +7249,7 @@ ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-	ixgbevf_update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
 }
 
 static void ixgbevf_mbx_process(struct rte_eth_dev *dev)
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 06/40] net/ixgbe/base: introduce new ops init functions
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (4 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 05/40] net/ixgbe/base: move vf_update_xcast_mode to base code Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 07/40] net/ixgbe/base: separate PHY probe code Xiao Wang
                       ` (34 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch introduces new init_ops functions for X550EM_a and X550EM_x.
This makes it easier to assign function pointers with specific
dependencies (like media type) for each MAC.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_api.c  |  4 +-
 drivers/net/ixgbe/base/ixgbe_api.h  |  2 +
 drivers/net/ixgbe/base/ixgbe_x550.c | 83 ++++++++++++++++++++++++++-----------
 3 files changed, 64 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
index 1786867..12ba093 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.c
+++ b/drivers/net/ixgbe/base/ixgbe_api.c
@@ -106,8 +106,10 @@ s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
 		status = ixgbe_init_ops_X550(hw);
 		break;
 	case ixgbe_mac_X550EM_x:
+		status = ixgbe_init_ops_X550EM_x(hw);
+		break;
 	case ixgbe_mac_X550EM_a:
-		status = ixgbe_init_ops_X550EM(hw);
+		status = ixgbe_init_ops_X550EM_a(hw);
 		break;
 	case ixgbe_mac_82599_vf:
 	case ixgbe_mac_X540_vf:
diff --git a/drivers/net/ixgbe/base/ixgbe_api.h b/drivers/net/ixgbe/base/ixgbe_api.h
index 3aad1da..24c4ae8 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.h
+++ b/drivers/net/ixgbe/base/ixgbe_api.h
@@ -45,6 +45,8 @@ extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw);
+extern s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw);
+extern s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
 
 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw);
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 5c09bfe..db12339 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -604,7 +604,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	struct ixgbe_mac_info *mac = &hw->mac;
 	struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
 	struct ixgbe_phy_info *phy = &hw->phy;
-	struct ixgbe_link_info *link = &hw->link;
 	s32 ret_val;
 
 	DEBUGFUNC("ixgbe_init_ops_X550EM");
@@ -640,25 +639,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	hw->bus.type = ixgbe_bus_type_internal;
 	mac->ops.get_bus_info = ixgbe_get_bus_info_X550em;
 
-	if (hw->mac.type == ixgbe_mac_X550EM_x) {
-		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
-		mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
-		mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
-		link->ops.read_link = ixgbe_read_i2c_combined_generic;
-		link->ops.read_link_unlocked =
-				ixgbe_read_i2c_combined_generic_unlocked;
-		link->ops.write_link = ixgbe_write_i2c_combined_generic;
-		link->ops.write_link_unlocked =
-				ixgbe_write_i2c_combined_generic_unlocked;
-		link->addr = IXGBE_CS4227;
-	}
-	if (hw->mac.type == ixgbe_mac_X550EM_a) {
-		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
-		mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
-		mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	}
 
 	mac->ops.get_media_type = ixgbe_get_media_type_X550em;
 	mac->ops.setup_sfp = ixgbe_setup_sfp_modules_X550em;
@@ -669,10 +649,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 
 	if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper)
 		mac->ops.setup_fc = ixgbe_setup_fc_generic;
-	else if (hw->mac.type == ixgbe_mac_X550EM_a) {
-		mac->ops.setup_fc = ixgbe_setup_fc_x550a;
-		mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
-	}
 	else
 		mac->ops.setup_fc = ixgbe_setup_fc_X550em;
 
@@ -706,6 +682,65 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 }
 
 /**
+*  ixgbe_init_ops_X550EM_a - Inits func ptrs and MAC type
+*  @hw: pointer to hardware structure
+*
+*  Initialize the function pointers and for MAC type X550EM_a.
+*  Does not touch the hardware.
+**/
+s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 ret_val;
+
+	DEBUGFUNC("ixgbe_init_ops_X550EM_a");
+
+	/* Start with generic X550EM init */
+	ret_val = ixgbe_init_ops_X550EM(hw);
+
+	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
+	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
+	mac->ops.setup_fc = ixgbe_setup_fc_x550a;
+	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
+
+	return ret_val;
+}
+
+/**
+*  ixgbe_init_ops_X550EM_x - Inits func ptrs and MAC type
+*  @hw: pointer to hardware structure
+*
+*  Initialize the function pointers and for MAC type X550EM_x.
+*  Does not touch the hardware.
+**/
+s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	struct ixgbe_link_info *link = &hw->link;
+	s32 ret_val;
+
+	DEBUGFUNC("ixgbe_init_ops_X550EM_x");
+
+	/* Start with generic X550EM init */
+	ret_val = ixgbe_init_ops_X550EM(hw);
+
+	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
+	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
+	link->ops.read_link = ixgbe_read_i2c_combined_generic;
+	link->ops.read_link_unlocked = ixgbe_read_i2c_combined_generic_unlocked;
+	link->ops.write_link = ixgbe_write_i2c_combined_generic;
+	link->ops.write_link_unlocked =
+				      ixgbe_write_i2c_combined_generic_unlocked;
+	link->addr = IXGBE_CS4227;
+
+	return ret_val;
+}
+
+/**
  *  ixgbe_dmac_config_X550
  *  @hw: pointer to hardware structure
  *
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 07/40] net/ixgbe/base: separate PHY probe code
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (5 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 06/40] net/ixgbe/base: introduce new ops init functions Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 08/40] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
                       ` (33 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Move the PHY probe code into a separate function so that it can be
reused. A subsequent patch will use it for configurations that
provide the PHY address explicitly.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 58 +++++++++++++++++++++++---------------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index ed1b14f..297a335 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -283,6 +283,39 @@ s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw)
 }
 
 /**
+ * ixgbe_probe_phy - Probe a single address for a PHY
+ * @hw: pointer to hardware structure
+ * @phy_addr: PHY address to probe
+ *
+ * Returns true if PHY found
+ */
+static bool ixgbe_probe_phy(struct ixgbe_hw *hw, u16 phy_addr)
+{
+	u16 ext_ability = 0;
+
+	if (!ixgbe_validate_phy_addr(hw, phy_addr))
+		return false;
+
+	if (ixgbe_get_phy_id(hw))
+		return false;
+
+	hw->phy.type = ixgbe_get_phy_type_from_id(hw->phy.id);
+
+	if (hw->phy.type == ixgbe_phy_unknown) {
+		hw->phy.ops.read_reg(hw, IXGBE_MDIO_PHY_EXT_ABILITY,
+				     IXGBE_MDIO_PMA_PMD_DEV_TYPE, &ext_ability);
+		if (ext_ability &
+		    (IXGBE_MDIO_PHY_10GBASET_ABILITY |
+		     IXGBE_MDIO_PHY_1000BASET_ABILITY))
+			hw->phy.type = ixgbe_phy_cu_unknown;
+		else
+			hw->phy.type = ixgbe_phy_generic;
+	}
+
+	return true;
+}
+
+/**
  *  ixgbe_identify_phy_generic - Get physical layer module
  *  @hw: pointer to hardware structure
  *
@@ -291,8 +324,7 @@ s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw)
 s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 {
 	s32 status = IXGBE_ERR_PHY_ADDR_INVALID;
-	u32 phy_addr;
-	u16 ext_ability = 0;
+	u16 phy_addr;
 
 	DEBUGFUNC("ixgbe_identify_phy_generic");
 
@@ -305,27 +337,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 
 	if (hw->phy.type == ixgbe_phy_unknown) {
 		for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
-			if (ixgbe_validate_phy_addr(hw, phy_addr)) {
-				hw->phy.addr = phy_addr;
-				ixgbe_get_phy_id(hw);
-				hw->phy.type =
-					ixgbe_get_phy_type_from_id(hw->phy.id);
-
-				if (hw->phy.type == ixgbe_phy_unknown) {
-					hw->phy.ops.read_reg(hw,
-						  IXGBE_MDIO_PHY_EXT_ABILITY,
-						  IXGBE_MDIO_PMA_PMD_DEV_TYPE,
-						  &ext_ability);
-					if (ext_ability &
-					    (IXGBE_MDIO_PHY_10GBASET_ABILITY |
-					     IXGBE_MDIO_PHY_1000BASET_ABILITY))
-						hw->phy.type =
-							 ixgbe_phy_cu_unknown;
-					else
-						hw->phy.type =
-							 ixgbe_phy_generic;
-				}
-
+		if (ixgbe_probe_phy(hw, phy_addr)) {
 				status = IXGBE_SUCCESS;
 				break;
 			}
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 08/40] net/ixgbe/base: fully initialize X550em_a 1G PHYs
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (6 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 07/40] net/ixgbe/base: separate PHY probe code Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 09/40] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
                       ` (32 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Fully initialize X550em_a 1G PHYs; move the PHY definitions from
ixgbe_x550.h to ixgbe_phy.h, where they really belong; define
register numbers in decimal because that is how they are in the spec.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c  |  43 +--
 drivers/net/ixgbe/base/ixgbe_phy.h  |  71 ++++-
 drivers/net/ixgbe/base/ixgbe_type.h |  14 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 514 ++++++++++++++++++++++++------------
 drivers/net/ixgbe/base/ixgbe_x550.h |  43 ---
 5 files changed, 454 insertions(+), 231 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index 297a335..d33d0f8 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -335,25 +335,33 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw)
 			hw->phy.phy_semaphore_mask = IXGBE_GSSR_PHY0_SM;
 	}
 
-	if (hw->phy.type == ixgbe_phy_unknown) {
-		for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
-		if (ixgbe_probe_phy(hw, phy_addr)) {
-				status = IXGBE_SUCCESS;
-				break;
-			}
-		}
+	if (hw->phy.type != ixgbe_phy_unknown)
+		return IXGBE_SUCCESS;
 
-		/* Certain media types do not have a phy so an address will not
-		 * be found and the code will take this path.  Caller has to
-		 * decide if it is an error or not.
-		 */
-		if (status != IXGBE_SUCCESS) {
-			hw->phy.addr = 0;
+	if (hw->phy.nw_mng_if_sel) {
+		phy_addr = (hw->phy.nw_mng_if_sel &
+			    IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD) >>
+			   IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
+		if (ixgbe_probe_phy(hw, phy_addr))
+			return IXGBE_SUCCESS;
+		else
+			return IXGBE_ERR_PHY_ADDR_INVALID;
+	}
+
+	for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) {
+		if (ixgbe_probe_phy(hw, phy_addr)) {
+			status = IXGBE_SUCCESS;
+			break;
 		}
-	} else {
-		status = IXGBE_SUCCESS;
 	}
 
+	/* Certain media types do not have a phy so an address will not
+	 * be found and the code will take this path.  Caller has to
+	 * decide if it is an error or not.
+	 */
+	if (status != IXGBE_SUCCESS)
+		hw->phy.addr = 0;
+
 	return status;
 }
 
@@ -464,9 +472,11 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id)
 		phy_type = ixgbe_phy_nl;
 		break;
 	case X557_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:
@@ -894,6 +904,9 @@ s32 ixgbe_setup_phy_link_speed_generic(struct ixgbe_hw *hw,
 	if (speed & IXGBE_LINK_SPEED_100_FULL)
 		hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_100_FULL;
 
+	if (speed & IXGBE_LINK_SPEED_10_FULL)
+		hw->phy.autoneg_advertised |= IXGBE_LINK_SPEED_10_FULL;
+
 	/* Setup link based on the new speed settings */
 	ixgbe_setup_phy_link(hw);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_phy.h b/drivers/net/ixgbe/base/ixgbe_phy.h
index 281f9fa..da14abc 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.h
+++ b/drivers/net/ixgbe/base/ixgbe_phy.h
@@ -92,8 +92,8 @@ 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_CS4223_PHY_ID		0x7003	/* Quad port */
+#define IXGBE_CS4227_PHY_ID		0x3003	/* Dual port */
 #define IXGBE_CS4227_RESET_PENDING	0x1357
 #define IXGBE_CS4227_RESET_COMPLETE	0x5AA5
 #define IXGBE_CS4227_RETRIES		15
@@ -154,6 +154,73 @@ POSSIBILITY OF SUCH DAMAGE.
 /* SFP+ SFF-8472 Compliance */
 #define IXGBE_SFF_SFF_8472_UNSUP	0x00
 
+/* More phy definitions */
+#define IXGBE_M88E1500_COPPER_CTRL		0	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_CTRL_RESET	(1u << 15)
+#define IXGBE_M88E1500_COPPER_CTRL_AN_EN	(1u << 12)
+#define IXGBE_M88E1500_COPPER_CTRL_POWER_DOWN	(1u << 11)
+#define IXGBE_M88E1500_COPPER_CTRL_RESTART_AN	(1u << 9)
+#define IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX	(1u << 8)
+#define IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB	(1u << 6)
+#define IXGBE_M88E1500_COPPER_STATUS		1	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_STATUS_AN_DONE	(1u << 5)
+#define IXGBE_M88E1500_COPPER_AN		4	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_AN_AS_PAUSE	(1u << 11)
+#define IXGBE_M88E1500_COPPER_AN_PAUSE		(1u << 10)
+#define IXGBE_M88E1500_COPPER_AN_T4		(1u << 9)
+#define IXGBE_M88E1500_COPPER_AN_100TX_FD	(1u << 8)
+#define IXGBE_M88E1500_COPPER_AN_100TX_HD	(1u << 7)
+#define IXGBE_M88E1500_COPPER_AN_10TX_FD	(1u << 6)
+#define IXGBE_M88E1500_COPPER_AN_10TX_HD	(1u << 5)
+#define IXGBE_M88E1500_COPPER_AN_LP_ABILITY	5	/* Page 0 reg */
+#define IXGBE_M88E1500_COPPER_AN_LP_AS_PAUSE	(1u << 11)
+#define IXGBE_M88E1500_COPPER_AN_LP_PAUSE	(1u << 10)
+#define IXGBE_M88E1500_1000T_CTRL		9	/* Page 0 reg */
+/* 1=Configure PHY as Master 0=Configure PHY as Slave */
+#define IXGBE_M88E1500_1000T_CTRL_MS_VALUE	(1u << 11)
+#define IXGBE_M88E1500_1000T_CTRL_1G_FD		(1u << 9)
+/* 1=Master/Slave manual config value 0=Automatic Master/Slave config */
+#define IXGBE_M88E1500_1000T_CTRL_MS_ENABLE	(1u << 12)
+#define IXGBE_M88E1500_1000T_CTRL_FULL_DUPLEX	(1u << 9)
+#define IXGBE_M88E1500_1000T_CTRL_HALF_DUPLEX	(1u << 8)
+#define IXGBE_M88E1500_1000T_STATUS		10	/* Page 0 reg */
+#define IXGBE_M88E1500_AUTO_COPPER_SGMII	0x2
+#define IXGBE_M88E1500_AUTO_COPPER_BASEX	0x3
+#define IXGBE_M88E1500_STATUS_LINK		(1u << 2) /* Interface Link Bit */
+#define IXGBE_M88E1500_MAC_CTRL_1		16	/* Page 0 reg */
+#define IXGBE_M88E1500_MAC_CTRL_1_MODE_MASK	0x0380 /* Mode Select */
+#define IXGBE_M88E1500_MAC_CTRL_1_DWN_SHIFT	12
+#define IXGBE_M88E1500_MAC_CTRL_1_DWN_4X	3u
+#define IXGBE_M88E1500_MAC_CTRL_1_ED_SHIFT	8
+#define IXGBE_M88E1500_MAC_CTRL_1_ED_TM		3u
+#define IXGBE_M88E1500_MAC_CTRL_1_MDIX_SHIFT	5
+#define IXGBE_M88E1500_MAC_CTRL_1_MDIX_AUTO	3u
+#define IXGBE_M88E1500_MAC_CTRL_1_POWER_DOWN	(1u << 2)
+#define IXGBE_M88E1500_PHY_SPEC_STATUS		17	/* Page 0 reg */
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT	14
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_MASK	3u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_10		0u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_100	1u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_1000	2u
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX		(1u << 13)
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED		(1u << 11)
+#define IXGBE_M88E1500_PHY_SPEC_STATUS_LINK		(1u << 10)
+#define IXGBE_M88E1500_PAGE_ADDR		22	/* All pages reg */
+#define IXGBE_M88E1500_FIBER_CTRL		0	/* Page 1 reg */
+#define IXGBE_M88E1500_FIBER_CTRL_RESET		(1u << 15)
+#define IXGBE_M88E1500_FIBER_CTRL_SPEED_LSB	(1u << 13)
+#define IXGBE_M88E1500_FIBER_CTRL_AN_EN		(1u << 12)
+#define IXGBE_M88E1500_FIBER_CTRL_POWER_DOWN	(1u << 11)
+#define IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL	(1u << 8)
+#define IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB	(1u << 6)
+#define IXGBE_M88E1500_MAC_SPEC_CTRL		16	/* Page 2 reg */
+#define IXGBE_M88E1500_MAC_SPEC_CTRL_POWER_DOWN	(1u << 3)
+#define IXGBE_M88E1500_EEE_CTRL_1		0	/* Page 18 reg */
+#define IXGBE_M88E1500_EEE_CTRL_1_MS		(1u << 0) /* EEE Master/Slave */
+#define IXGBE_M88E1500_GEN_CTRL			20	/* Page 18 reg */
+#define IXGBE_M88E1500_GEN_CTRL_RESET		(1u << 15)
+#define IXGBE_M88E1500_GEN_CTRL_MODE_SGMII_COPPER	1u /* Mode bits 0-2 */
+
 s32 ixgbe_init_phy_ops_generic(struct ixgbe_hw *hw);
 bool ixgbe_validate_phy_addr(struct ixgbe_hw *hw, u32 phy_addr);
 enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id);
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 96b5cbd..39099d6 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -1644,13 +1644,14 @@ struct ixgbe_dmac_config {
 #define X550_PHY_ID2	0x01540223
 #define X550_PHY_ID3	0x01540221
 #define X557_PHY_ID	0x01540240
+#define X557_PHY_ID2	0x01540250
 #define AQ_FW_REV	0x20
 #define QT2022_PHY_ID	0x0043A400
 #define ATH_PHY_ID	0x03429050
 
 /* PHY Types */
-#define IXGBE_M88E1500_E_PHY_ID		0x01410DD0
-#define IXGBE_M88E1543_E_PHY_ID		0x01410EA0
+#define IXGBE_M88E1500_E_PHY_ID	0x01410DD0
+#define IXGBE_M88E1543_E_PHY_ID	0x01410EA0
 
 /* Special PHY Init Routine */
 #define IXGBE_PHY_INIT_OFFSET_NL	0x002B
@@ -3054,7 +3055,7 @@ enum ixgbe_fdir_pballoc_type {
 #ifdef C99
 #pragma pack(push, 1)
 #else
-#pragma pack(1)
+#pragma pack (1)
 #endif /* C99 */
 
 struct ixgbe_hic_hdr {
@@ -4170,6 +4171,7 @@ struct ixgbe_hw {
 
 #define IXGBE_KRM_AN_CNTL_8_LINEAR			(1 << 0)
 #define IXGBE_KRM_AN_CNTL_8_LIMITING			(1 << 1)
+
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH_SYM_PAUSE		(1 << 10)
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH_ASM_PAUSE		(1 << 11)
 
@@ -4208,11 +4210,13 @@ struct ixgbe_hw {
 #define IXGBE_SB_IOSF_TARGET_KR_PHY	0
 
 #define IXGBE_NW_MNG_IF_SEL		0x00011178
-#define IXGBE_NW_MNG_IF_SEL_MDIO_ACT	(1 << 1)
+#define IXGBE_NW_MNG_IF_SEL_MDIO_ACT	(1u << 1)
+#define IXGBE_NW_MNG_IF_SEL_MDIO_IF_MODE	(1u << 2)
+#define IXGBE_NW_MNG_IF_SEL_EN_SHARED_MDIO	(1u << 13)
 #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_MDIO_PHY_ADD_SHIFT 3
 #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD	\
-		(0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT)
+				(0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT)
 
 #endif /* _IXGBE_TYPE_H_ */
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index db12339..0de9238 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -342,11 +342,10 @@ STATIC s32 ixgbe_read_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
 	UNREFERENCED_1PARAMETER(dev_type);
 
 	/* Setup and write the read command */
-	command = (reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT)  |
-		(reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
-		(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
-		IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_READ |
-		IXGBE_MSCA_MDI_COMMAND;
+	command = (reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
+		  (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
+		  IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_READ_AUTOINC |
+		  IXGBE_MSCA_MDI_COMMAND;
 
 	IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
 
@@ -393,11 +392,10 @@ STATIC s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
 	IXGBE_WRITE_REG(hw, IXGBE_MSRWD, (u32)phy_data);
 
 	/* Setup and write the write command */
-	command = (reg_addr << IXGBE_MSCA_NP_ADDR_SHIFT)  |
-		(reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
-		(hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
-		IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_WRITE |
-		IXGBE_MSCA_MDI_COMMAND;
+	command = (reg_addr << IXGBE_MSCA_DEV_TYPE_SHIFT) |
+		  (hw->phy.addr << IXGBE_MSCA_PHY_ADDR_SHIFT) |
+		  IXGBE_MSCA_OLD_PROTOCOL | IXGBE_MSCA_WRITE |
+		  IXGBE_MSCA_MDI_COMMAND;
 
 	IXGBE_WRITE_REG(hw, IXGBE_MSCA, command);
 
@@ -423,43 +421,6 @@ STATIC s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
 }
 
 /**
- * ixgbe_identify_phy_1g - Get 1g PHY type based on device id
- * @hw: pointer to hardware structure
- *
- * Returns error code
- */
-STATIC s32 ixgbe_identify_phy_1g(struct ixgbe_hw *hw)
-{
-	u32 swfw_mask = hw->phy.phy_semaphore_mask;
-	u16 phy_id_high;
-	u16 phy_id_low;
-	s32 rc;
-
-	rc = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
-	if (rc)
-		return rc;
-
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_MDIO_PHY_ID_HIGH, 0,
-				       &phy_id_high);
-	if (rc)
-		goto rel_out;
-
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_MDIO_PHY_ID_LOW, 0,
-				       &phy_id_low);
-	if (rc)
-		goto rel_out;
-
-	hw->phy.id = (u32)phy_id_high << 16;
-	hw->phy.id |= phy_id_low & IXGBE_PHY_REVISION_MASK;
-	hw->phy.revision = (u32)phy_id_low & ~IXGBE_PHY_REVISION_MASK;
-
-rel_out:
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-
-	return rc;
-}
-
-/**
  * ixgbe_identify_phy_x550em - Get PHY type based on device id
  * @hw: pointer to hardware structure
  *
@@ -498,18 +459,11 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
 		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
        /* Fallthrough to ixgbe_identify_phy_generic */
+	case IXGBE_DEV_ID_X550EM_A_1G_T:
+	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 	case IXGBE_DEV_ID_X550EM_X_1G_T:
 	case IXGBE_DEV_ID_X550EM_X_10G_T:
 		return ixgbe_identify_phy_generic(hw);
-	case IXGBE_DEV_ID_X550EM_A_1G_T:
-	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
-		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
-		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
-		if (hw->bus.lan_id)
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
-		else
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
-		return ixgbe_identify_phy_1g(hw);
 	default:
 		break;
 	}
@@ -1544,7 +1498,6 @@ enum ixgbe_media_type ixgbe_get_media_type_X550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_1G_T:
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 		media_type = ixgbe_media_type_copper;
-		hw->phy.type = ixgbe_phy_m88;
 		break;
 	default:
 		media_type = ixgbe_media_type_unknown;
@@ -1641,12 +1594,11 @@ s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw)
  * @hw: pointer to hardware structure
  */
 STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
-			     bool autoneg_wait_to_complete)
+			     bool autoneg_wait)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
 	u32 lval, sval;
 	s32 rc;
-	UNREFERENCED_2PARAMETER(speed, autoneg_wait_to_complete);
 
 	rc = mac->ops.read_iosf_sb_reg(hw,
 				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
@@ -1683,6 +1635,126 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	rc = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+	if (rc)
+		return rc;
+
+	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
+}
+
+ /**
+ * ixgbe_setup_sgmii_m88 - Set up link for sgmii with Marvell PHYs
+ * @hw: pointer to hardware structure
+ */
+STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
+				 bool autoneg_wait)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	u32 lval, sval;
+	s32 rc;
+
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &lval);
+	if (rc)
+		return rc;
+
+	lval &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
+	lval &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
+	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_SGMII_EN;
+	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CLAUSE_37_EN;
+	lval &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_1G;
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+	if (rc)
+		return rc;
+
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &sval);
+	if (rc)
+		return rc;
+
+	sval &= ~IXGBE_KRM_SGMII_CTRL_MAC_TAR_FORCE_10_D;
+	sval &= ~IXGBE_KRM_SGMII_CTRL_MAC_TAR_FORCE_100_D;
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_SGMII_CTRL(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, sval);
+	if (rc)
+		return rc;
+
+	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+	if (rc)
+		return rc;
+
+	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
+}
+
+/**
+ * ixgbe_check_link_m88 - Poll PHY for link
+ * @hw: pointer to hardware structure
+ * @speed: pointer to link speed
+ * @link_up: true when link is up
+ * @link_up_wait: bool indicating whether to wait for link
+ *
+ * Check that both the MAC and PHY have link.
+ */
+static s32
+ixgbe_check_link_m88(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
+		     bool *link_up, bool link_up_wait)
+{
+	u16 reg;
+	s32 rc;
+	u32 i;
+
+	rc = ixgbe_check_mac_link_generic(hw, speed, link_up, link_up_wait);
+	if (rc || !*link_up)
+		return rc;
+
+	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_PHY_SPEC_STATUS, 0, &reg);
+
+	/* MAC link is up, so check external PHY link */
+	*link_up = !!(reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK);
+
+	if (link_up_wait) {
+		for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
+			if (!rc &&
+			    (reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK)) {
+				*link_up = true;
+				break;
+			}
+			*link_up = false;
+			msec_delay(100);
+			rc = hw->phy.ops.read_reg(hw,
+						 IXGBE_M88E1500_PHY_SPEC_STATUS,
+						 0, &reg);
+		}
+	}
+
+#define M88_SPEED(x) (IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED  | \
+		      IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX     | \
+		      ((IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_##x) <<\
+			IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT))
+
+	reg &= M88_SPEED(MASK);
+	switch (reg) {
+	case M88_SPEED(10):
+		*speed = IXGBE_LINK_SPEED_10_FULL;
+		break;
+	case M88_SPEED(100):
+		*speed = IXGBE_LINK_SPEED_100_FULL;
+		break;
+	case M88_SPEED(1000):
+		*speed = IXGBE_LINK_SPEED_1GB_FULL;
+		break;
+	default:
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
+		break;
+	}
+#undef M88_SPEED
 
 	return rc;
 }
@@ -1717,8 +1789,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
 				ixgbe_setup_mac_link_sfp_x550em;
 		break;
 	case ixgbe_media_type_copper:
-		mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
-		mac->ops.check_link = ixgbe_check_link_t_X550em;
+		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
+		    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
+			mac->ops.setup_link = ixgbe_setup_sgmii_m88;
+			mac->ops.check_link = ixgbe_check_link_m88;
+		} else {
+			mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
+			mac->ops.check_link = ixgbe_check_link_t_X550em;
+		}
 		break;
 	case ixgbe_media_type_backplane:
 		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII ||
@@ -1766,8 +1844,9 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 	} else {
 		switch (hw->phy.type) {
 		case ixgbe_phy_m88:
-			*speed = IXGBE_LINK_SPEED_100_FULL |
-				 IXGBE_LINK_SPEED_1GB_FULL;
+			*speed = IXGBE_LINK_SPEED_1GB_FULL |
+				 IXGBE_LINK_SPEED_100_FULL |
+				 IXGBE_LINK_SPEED_10_FULL;
 			break;
 		case ixgbe_phy_sgmii:
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
@@ -2000,171 +2079,266 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 }
 
 /**
- * ixgbe_set_master_slave_mode - Set up PHY for master/slave mode
+ * ixgbe_setup_m88 - setup m88 PHY
  * @hw: pointer to hardware structure
- *
- * Must be called while holding the PHY semaphore and token
  */
-STATIC s32 ixgbe_set_master_slave_mode(struct ixgbe_hw *hw)
+STATIC s32 ixgbe_setup_m88(struct ixgbe_hw *hw)
 {
-	u16 phy_data;
+	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
+	u16 reg;
 	s32 rc;
 
-	/* Resolve master/slave mode */
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_M88E1500_1000T_CTRL, 0,
-				       &phy_data);
+	if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw))
+		return IXGBE_SUCCESS;
+
+	rc = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (rc)
 		return rc;
 
-	/* load defaults for future use */
-	if (phy_data & IXGBE_M88E1500_1000T_CTRL_MS_ENABLE) {
-		if (phy_data & IXGBE_M88E1500_1000T_CTRL_MS_VALUE)
-			hw->phy.original_ms_type = ixgbe_ms_force_master;
-		else
-			hw->phy.original_ms_type = ixgbe_ms_force_slave;
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+	if (reg & IXGBE_M88E1500_COPPER_CTRL_POWER_DOWN) {
+		reg &= ~IXGBE_M88E1500_COPPER_CTRL_POWER_DOWN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					  reg);
+	}
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_MAC_CTRL_1, 0, &reg);
+	if (rc)
+		goto out;
+	if (reg & IXGBE_M88E1500_MAC_CTRL_1_POWER_DOWN) {
+		reg &= ~IXGBE_M88E1500_MAC_CTRL_1_POWER_DOWN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_MAC_CTRL_1, 0,
+					  reg);
+	}
+
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 2);
+	if (rc)
+		goto out;
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_MAC_SPEC_CTRL, 0,
+				      &reg);
+	if (rc)
+		goto out;
+	if (reg & IXGBE_M88E1500_MAC_SPEC_CTRL_POWER_DOWN) {
+		reg &= ~IXGBE_M88E1500_MAC_SPEC_CTRL_POWER_DOWN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_MAC_SPEC_CTRL, 0,
+					  reg);
+		rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0,
+					       0);
+		if (rc)
+			goto out;
+		rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					      &reg);
+		if (rc)
+			goto out;
+		reg |= IXGBE_M88E1500_COPPER_CTRL_RESET;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					  reg);
+		usec_delay(50);
 	} else {
-		hw->phy.original_ms_type = ixgbe_ms_auto;
+		rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0,
+					       0);
+		if (rc)
+			goto out;
 	}
 
-	switch (hw->phy.ms_type) {
-	case ixgbe_ms_force_master:
-		phy_data |= IXGBE_M88E1500_1000T_CTRL_MS_ENABLE;
-		phy_data |= IXGBE_M88E1500_1000T_CTRL_MS_VALUE;
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+
+	if (!(reg & IXGBE_M88E1500_COPPER_CTRL_AN_EN)) {
+		reg |= IXGBE_M88E1500_COPPER_CTRL_AN_EN;
+		hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
+					  reg);
+	}
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_1000T_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+	reg &= ~IXGBE_M88E1500_1000T_CTRL_HALF_DUPLEX;
+	reg &= ~IXGBE_M88E1500_1000T_CTRL_FULL_DUPLEX;
+	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_1GB_FULL)
+		reg |= IXGBE_M88E1500_1000T_CTRL_FULL_DUPLEX;
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_1000T_CTRL, 0, reg);
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_AN, 0, &reg);
+	if (rc)
+		goto out;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_PAUSE;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_T4;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_FD;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_HD;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_FD;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_HD;
+	switch (hw->fc.current_mode) {
+	case ixgbe_fc_full:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
 		break;
-	case ixgbe_ms_force_slave:
-		phy_data |= IXGBE_M88E1500_1000T_CTRL_MS_ENABLE;
-		phy_data &= ~IXGBE_M88E1500_1000T_CTRL_MS_VALUE;
+	case ixgbe_fc_rx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
 		break;
-	case ixgbe_ms_auto:
-		phy_data &= ~IXGBE_M88E1500_1000T_CTRL_MS_ENABLE;
+	case ixgbe_fc_tx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
 		break;
 	default:
 		break;
 	}
 
-	return ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_1000T_CTRL, 0,
-					  phy_data);
+	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL)
+		reg |= IXGBE_M88E1500_COPPER_AN_100TX_FD;
+	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_10_FULL)
+		reg |= IXGBE_M88E1500_COPPER_AN_10TX_FD;
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_AN, 0, reg);
+
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
+	if (rc)
+		goto out;
+	reg |= IXGBE_M88E1500_COPPER_CTRL_RESTART_AN;
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, reg);
+
+
+	hw->mac.ops.release_swfw_sync(hw, mask);
+	return rc;
+
+out:
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+	hw->mac.ops.release_swfw_sync(hw, mask);
+	return rc;
 }
 
 /**
- * ixgbe_reset_phy_m88_nolock - Reset m88 PHY without locking
+ * ixgbe_reset_phy_m88e1500 - Reset m88e1500 PHY
  * @hw: pointer to hardware structure
  *
- * Must be called while holding the PHY semaphore and token
+ * The PHY token must be held when calling this function.
  */
-STATIC s32 ixgbe_reset_phy_m88_nolock(struct ixgbe_hw *hw)
+static s32 ixgbe_reset_phy_m88e1500(struct ixgbe_hw *hw)
 {
+	u16 reg;
 	s32 rc;
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 1);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
 	if (rc)
 		return rc;
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_FIBER_CTRL, 0,
-					IXGBE_M88E1500_FIBER_CTRL_RESET |
-					IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL |
-					IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB);
+	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, &reg);
 	if (rc)
-		goto res_out;
-
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 18);
-	if (rc)
-		goto res_out;
-
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_GEN_CTRL, 0,
-					IXGBE_M88E1500_GEN_CTRL_RESET |
-					IXGBE_M88E1500_GEN_CTRL_SGMII_COPPER);
-	if (rc)
-		goto res_out;
+		return rc;
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
-	if (rc)
-		goto res_out;
+	reg |= IXGBE_M88E1500_COPPER_CTRL_RESET;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, reg);
 
-	rc = ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_COPPER_CTRL, 0,
-					IXGBE_M88E1500_COPPER_CTRL_RESET |
-					IXGBE_M88E1500_COPPER_CTRL_AN_EN |
-					IXGBE_M88E1500_COPPER_CTRL_RESTART_AN |
-					IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX |
-					IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB);
+	usec_delay(10);
 
-res_out:
-	ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
 	return rc;
 }
 
 /**
+ * ixgbe_reset_phy_m88e1543 - Reset m88e1543 PHY
+ * @hw: pointer to hardware structure
+ *
+ * The PHY token must be held when calling this function.
+ */
+static s32 ixgbe_reset_phy_m88e1543(struct ixgbe_hw *hw)
+{
+	return hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+}
+
+/**
  * ixgbe_reset_phy_m88 - Reset m88 PHY
  * @hw: pointer to hardware structure
  */
 STATIC s32 ixgbe_reset_phy_m88(struct ixgbe_hw *hw)
 {
-	u32 swfw_mask = hw->phy.phy_semaphore_mask;
+	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
+	u16 reg;
 	s32 rc;
 
 	if (hw->phy.reset_disable || ixgbe_check_reset_blocked(hw))
 		return IXGBE_SUCCESS;
 
-	rc = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
+	rc = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (rc)
 		return rc;
 
-	rc = ixgbe_reset_phy_m88_nolock(hw);
+	switch (hw->phy.id) {
+	case IXGBE_M88E1500_E_PHY_ID:
+		rc = ixgbe_reset_phy_m88e1500(hw);
+		break;
+	case IXGBE_M88E1543_E_PHY_ID:
+		rc = ixgbe_reset_phy_m88e1543(hw);
+		break;
+	default:
+		rc = IXGBE_ERR_PHY;
+		break;
+	}
 
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-	return rc;
-}
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 1);
+	if (rc)
+		goto out;
 
-/**
- * ixgbe_setup_m88 - setup m88 PHY
- * @hw: pointer to hardware structure
- */
-STATIC s32 ixgbe_setup_m88(struct ixgbe_hw *hw)
-{
-	u32 swfw_mask = hw->phy.phy_semaphore_mask;
-	struct ixgbe_phy_info *phy = &hw->phy;
-	u16 phy_data;
-	s32 rc;
+	reg = IXGBE_M88E1500_FIBER_CTRL_RESET |
+	      IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL |
+	      IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_FIBER_CTRL, 0, reg);
+	if (rc)
+		goto out;
 
-	if (phy->reset_disable || ixgbe_check_reset_blocked(hw))
-		return IXGBE_SUCCESS;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 18);
+	if (rc)
+		goto out;
 
-	rc = hw->mac.ops.acquire_swfw_sync(hw, swfw_mask);
+	reg = IXGBE_M88E1500_GEN_CTRL_RESET |
+	      IXGBE_M88E1500_GEN_CTRL_MODE_SGMII_COPPER;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_GEN_CTRL, 0, reg);
 	if (rc)
-		return rc;
+		goto out;
 
-	rc = ixgbe_read_phy_reg_mdi_22(hw, IXGBE_M88E1500_PHY_SPEC_CTRL, 0,
-				       &phy_data);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 1);
 	if (rc)
-		goto rel_out;
-
-	/* Enable downshift and setting it to X6 */
-	phy_data &= ~IXGBE_M88E1500_PSCR_DOWNSHIFT_ENABLE;
-	phy_data |= IXGBE_M88E1500_PSCR_DOWNSHIFT_6X;
-	phy_data |= IXGBE_M88E1500_PSCR_DOWNSHIFT_ENABLE;
-	rc = ixgbe_write_phy_reg_mdi_22(hw,
-					IXGBE_M88E1500_PHY_SPEC_CTRL, 0,
-					phy_data);
+		goto out;
+
+	reg = IXGBE_M88E1500_FIBER_CTRL_RESET |
+	      IXGBE_M88E1500_FIBER_CTRL_AN_EN |
+	      IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL |
+	      IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_FIBER_CTRL, 0, reg);
 	if (rc)
-		goto rel_out;
+		goto out;
 
-	ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
+	if (rc)
+		goto out;
 
-	/* Commit the changes */
-	rc = ixgbe_reset_phy_m88_nolock(hw);
-	if (rc) {
-		DEBUGOUT("Error committing the PHY changes\n");
-		goto rel_out;
-	}
+	reg = (IXGBE_M88E1500_MAC_CTRL_1_DWN_4X <<
+	       IXGBE_M88E1500_MAC_CTRL_1_DWN_SHIFT) |
+	      (IXGBE_M88E1500_MAC_CTRL_1_ED_TM <<
+	       IXGBE_M88E1500_MAC_CTRL_1_ED_SHIFT) |
+	      (IXGBE_M88E1500_MAC_CTRL_1_MDIX_AUTO <<
+	       IXGBE_M88E1500_MAC_CTRL_1_MDIX_SHIFT);
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_MAC_CTRL_1, 0, reg);
+	if (rc)
+		goto out;
 
-	rc = ixgbe_set_master_slave_mode(hw);
+	reg = IXGBE_M88E1500_COPPER_CTRL_RESET |
+	      IXGBE_M88E1500_COPPER_CTRL_AN_EN |
+	      IXGBE_M88E1500_COPPER_CTRL_RESTART_AN |
+	      IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX |
+	      IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB;
+	rc = hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_COPPER_CTRL, 0, reg);
+	if (rc)
+		goto out;
 
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-	return rc;
+	hw->mac.ops.release_swfw_sync(hw, mask);
 
-rel_out:
-	ixgbe_write_phy_reg_mdi_22(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
-	hw->mac.ops.release_swfw_sync(hw, swfw_mask);
+	return ixgbe_setup_m88(hw);
+
+out:
+	hw->mac.ops.release_swfw_sync(hw, mask);
 	return rc;
 }
 
@@ -2220,6 +2394,16 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 		phy->ops.identify_sfp = ixgbe_identify_sfp_module_X550em;
 	}
 
+	switch (hw->device_id) {
+	case IXGBE_DEV_ID_X550EM_A_1G_T:
+	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
+		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
+		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
+		break;
+	default:
+		break;
+	}
+
 	/* Identify the PHY or SFP module */
 	ret_val = phy->ops.identify(hw);
 	if (ret_val == IXGBE_ERR_SFP_NOT_SUPPORTED)
@@ -2263,8 +2447,6 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 		break;
 	case ixgbe_phy_m88:
 		phy->ops.setup_link = ixgbe_setup_m88;
-		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
-		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
 		phy->ops.reset = ixgbe_reset_phy_m88;
 		break;
 	default:
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 27d5d02..8a8381f 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -36,49 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "ixgbe_type.h"
 
-/* More phy definitions */
-#define IXGBE_M88E1500_COPPER_CTRL		0x0/* Page 0 reg */
-#define IXGBE_M88E1500_COPPER_CTRL_RESET	0x8000
-#define IXGBE_M88E1500_COPPER_CTRL_AN_EN	0x1000
-#define IXGBE_M88E1500_COPPER_CTRL_RESTART_AN	0x0200
-#define IXGBE_M88E1500_COPPER_CTRL_FULL_DUPLEX	0x0100
-#define IXGBE_M88E1500_COPPER_CTRL_SPEED_MSB	0x0040
-#define IXGBE_M88E1500_1000T_CTRL		0x09 /* 1000Base-T Ctrl Reg */
-/* 1=Configure PHY as Master 0=Configure PHY as Slave */
-#define IXGBE_M88E1500_1000T_CTRL_MS_VALUE	0x0800
-/* 1=Master/Slave manual config value 0=Automatic Master/Slave config */
-#define IXGBE_M88E1500_1000T_CTRL_MS_ENABLE	0x1000
-#define IXGBE_M88E1500_1000T_STATUS		0x0A /* 1000Base-T Status Reg */
-#define IXGBE_M88E1500_AUTO_COPPER_SGMII	0x2
-#define IXGBE_M88E1500_AUTO_COPPER_BASEX	0x3
-#define IXGBE_M88E1500_STATUS_LINK		0x0004 /* Interface Link Bit */
-#define IXGBE_M88E1500_MAC_CTRL_1		0x10
-#define IXGBE_M88E1500_MAC_CTRL_1_MODE_MASK	0x0380 /* Mode Select */
-#define IXGBE_M88E1500_CFG_REG_1		0x0010
-#define IXGBE_M88E1500_CFG_REG_2		0x0011
-#define IXGBE_M88E1500_CFG_REG_3		0x0007
-#define IXGBE_M88E1500_MODE			0x0014
-#define IXGBE_M88E1500_PAGE_ADDR		0x16/* Page Offset reg */
-#define IXGBE_M88E1500_FIBER_CTRL		0x0/* Page 1 reg */
-#define IXGBE_M88E1500_FIBER_CTRL_RESET		0x8000
-#define IXGBE_M88E1500_FIBER_CTRL_SPEED_LSB	0x2000
-#define IXGBE_M88E1500_FIBER_CTRL_POWER_DOWN	0x0800
-#define IXGBE_M88E1500_FIBER_CTRL_DUPLEX_FULL	0x0100
-#define IXGBE_M88E1500_FIBER_CTRL_SPEED_MSB	0x0040
-#define IXGBE_M88E1500_EEE_CTRL_1		0x0/* Page 18 reg */
-#define IXGBE_M88E1500_EEE_CTRL_1_MS		0x0001/* EEE Master/Slave */
-#define IXGBE_M88E1500_GEN_CTRL			0x14/* Page 18 reg */
-#define IXGBE_M88E1500_GEN_CTRL_RESET		0x8000
-#define IXGBE_M88E1500_GEN_CTRL_SGMII_COPPER	0x0001/* Mode bits 0-2 */
-
-/* M88E1500 Specific Registers */
-#define IXGBE_M88E1500_PHY_SPEC_CTRL		0x10 /* PHY Specific Ctrl Reg */
-#define IXGBE_M88E1500_PHY_SPEC_STATUS		0x11 /* PHY Specific Stat Reg */
-
-#define IXGBE_M88E1500_PSCR_DOWNSHIFT_ENABLE	0x0800
-#define IXGBE_M88E1500_PSCR_DOWNSHIFT_MASK	0x7000
-#define IXGBE_M88E1500_PSCR_DOWNSHIFT_6X	0x5000
-
 s32 ixgbe_dmac_config_X550(struct ixgbe_hw *hw);
 s32 ixgbe_dmac_config_tcs_X550(struct ixgbe_hw *hw);
 s32 ixgbe_dmac_update_tcs_X550(struct ixgbe_hw *hw);
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 09/40] net/ixgbe/base: add macros for VF promiscuous mode
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (7 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 08/40] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 10/40] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
                       ` (31 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Add new definitions to support VF unicast promiscuous mode which
will be implemented in a later patch.

Besides, rename definitions of subdevice IDs on SFP LOM to make it
easier to distinguish.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 39099d6..c65d3a3 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -105,11 +105,11 @@ POSSIBILITY OF SUCH DAMAGE.
 #define IXGBE_SUBDEV_ID_82599_560FLR		0x17D0
 #define IXGBE_SUBDEV_ID_82599_ECNA_DP		0x0470
 #define IXGBE_SUBDEV_ID_82599_SP_560FLR		0x211B
-#define IXGBE_SUBDEV_ID_82599_LOM_SFP		0x8976
 #define IXGBE_SUBDEV_ID_82599_LOM_SNAP6		0x2159
 #define IXGBE_SUBDEV_ID_82599_SFP_1OCP		0x000D
 #define IXGBE_SUBDEV_ID_82599_SFP_2OCP		0x0008
-#define IXGBE_SUBDEV_ID_82599_SFP_LOM		0x06EE
+#define IXGBE_SUBDEV_ID_82599_SFP_LOM_OEM1	0x8976
+#define IXGBE_SUBDEV_ID_82599_SFP_LOM_OEM2	0x06EE
 #define IXGBE_DEV_ID_82599_BACKPLANE_FCOE	0x152A
 #define IXGBE_DEV_ID_82599_SFP_FCOE		0x1529
 #define IXGBE_DEV_ID_82599_SFP_EM		0x1507
@@ -1766,6 +1766,8 @@ enum {
 #define IXGBE_VT_CTL_POOL_MASK		(0x3F << IXGBE_VT_CTL_POOL_SHIFT)
 
 /* VMOLR bitmasks */
+#define IXGBE_VMOLR_UPE		0x00400000 /* unicast promiscuous */
+#define IXGBE_VMOLR_VPE		0x00800000 /* VLAN promiscuous */
 #define IXGBE_VMOLR_AUPE	0x01000000 /* accept untagged packets */
 #define IXGBE_VMOLR_ROMPE	0x02000000 /* accept packets in MTA tbl */
 #define IXGBE_VMOLR_ROPE	0x04000000 /* accept packets in UC tbl */
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 10/40] net/ixgbe/base: add FC setup for X550em_a fiber
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (8 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 09/40] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 11/40] net/ixgbe/base: add FC autoneg " Xiao Wang
                       ` (30 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch adds a separate function for setting up FC (flow control)
on X550em_a fiber:

- rename ixgbe_setup_fc_x550a() to ixgbe_setup_fc_backplane_x550em_a().
- create ixgbe_setup_fc_fiber_x550em_a() to configure FC for fiber.
- add definitions for KRM_AN_CNTL_4 and KRM_PCS_KX_AN along with related
  definitions.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |   6 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 144 +++++++++++++++++++++++++++++++++++-
 drivers/net/ixgbe/base/ixgbe_x550.h |   3 +-
 3 files changed, 147 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index c65d3a3..1d38195 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4140,7 +4140,9 @@ struct ixgbe_hw {
 #define IXGBE_KRM_LINK_S1(P)		((P) ? 0x8200 : 0x4200)
 #define IXGBE_KRM_LINK_CTRL_1(P)	((P) ? 0x820C : 0x420C)
 #define IXGBE_KRM_AN_CNTL_1(P)		((P) ? 0x822C : 0x422C)
+#define IXGBE_KRM_AN_CNTL_4(P)		((P) ? 0x8238 : 0x4238)
 #define IXGBE_KRM_AN_CNTL_8(P)		((P) ? 0x8248 : 0x4248)
+#define IXGBE_KRM_PCS_KX_AN(P)		((P) ? 0x9918 : 0x5918)
 #define IXGBE_KRM_SGMII_CTRL(P)		((P) ? 0x82A0 : 0x42A0)
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P)	((P) ? 0x836C : 0x436C)
 #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)	((P) ? 0x8634 : 0x4634)
@@ -4170,7 +4172,9 @@ struct ixgbe_hw {
 
 #define IXGBE_KRM_AN_CNTL_1_SYM_PAUSE			(1 << 28)
 #define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE			(1 << 29)
-
+#define IXGBE_KRM_PCS_KX_AN_SYM_PAUSE			(1 << 1)
+#define IXGBE_KRM_PCS_KX_AN_ASM_PAUSE			(1 << 2)
+#define IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73		(1 << 29)
 #define IXGBE_KRM_AN_CNTL_8_LINEAR			(1 << 0)
 #define IXGBE_KRM_AN_CNTL_8_LIMITING			(1 << 1)
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 0de9238..b0697aa 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -656,9 +656,19 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
 	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
 	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	mac->ops.setup_fc = ixgbe_setup_fc_x550a;
 	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
 
+	switch (mac->ops.get_media_type(hw)) {
+	case ixgbe_media_type_fiber:
+		mac->ops.setup_fc = ixgbe_setup_fc_fiber_x550em_a;
+		break;
+	case ixgbe_media_type_backplane:
+		mac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a;
+		break;
+	default:
+		break;
+	}
+
 	return ret_val;
 }
 
@@ -4025,17 +4035,17 @@ out:
 }
 
 /**
- *  ixgbe_setup_fc_x550em - Set up flow control
+ *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control
  *  @hw: pointer to hardware structure
  *
  *  Called at init time to set up flow control.
  **/
-s32 ixgbe_setup_fc_x550a(struct ixgbe_hw *hw)
+s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 {
 	s32 status = IXGBE_SUCCESS;
 	u32 an_cntl, link_ctrl = 0;
 
-	DEBUGFUNC("ixgbe_setup_fc_x550em");
+	DEBUGFUNC("ixgbe_setup_fc_backplane_x550em_a");
 
 	/* Validate the requested mode */
 	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
@@ -4125,6 +4135,132 @@ s32 ixgbe_setup_fc_x550a(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_setup_fc_fiber_x550em_a - Set up flow control
+ *  @hw: pointer to hardware structure
+ *
+ *  Called at init time to set up flow control.
+ **/
+s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 rc = IXGBE_SUCCESS;
+	u32 an_cntl4, lctrl, pcs_an;
+
+	DEBUGFUNC("ixgbe_setup_fc_fiber_x550em_a");
+
+	/* Validate the requested mode */
+	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+		return IXGBE_ERR_INVALID_LINK_SETTINGS;
+	}
+
+	/* Enable clause 37 auto-negotiation in KRM_LINK_CTRL_1 */
+	if (hw->fc.requested_mode == ixgbe_fc_default)
+		hw->fc.requested_mode = ixgbe_fc_full;
+
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
+	if (rc)
+		return rc;
+
+	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
+	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CLAUSE_37_EN;
+
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
+	if (rc)
+		return rc;
+
+	/* Enable clause 37 over 73 in KRM_AN_CNTL_4 */
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				       IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
+				       IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl4);
+	if (rc)
+		return rc;
+
+	an_cntl4 |= IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73;
+
+	rc = mac->ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl4);
+	if (rc)
+		return rc;
+
+	rc = hw->mac.ops.read_iosf_sb_reg(hw,
+					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
+
+	if (rc)
+		return rc;
+
+	/* The possible values of fc.requested_mode are:
+	 * 0: Flow control is completely disabled
+	 * 1: Rx flow control is enabled (we can receive pause frames,
+	 *    but not send pause frames).
+	 * 2: Tx flow control is enabled (we can send pause frames but
+	 *    we do not support receiving pause frames).
+	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
+	 * other: Invalid.
+	 */
+	switch (hw->fc.requested_mode) {
+	case ixgbe_fc_none:
+		/* Flow control completely disabled by software override. */
+		pcs_an &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
+			    IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
+		break;
+	case ixgbe_fc_tx_pause:
+		/* Tx Flow control is enabled, and Rx Flow control is
+		 * disabled by software override.
+		 */
+		pcs_an |= IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
+		pcs_an &= ~IXGBE_KRM_PCS_KX_AN_SYM_PAUSE;
+		break;
+	case ixgbe_fc_rx_pause:
+		/* Rx Flow control is enabled and Tx Flow control is
+		 * disabled by software override. Since there really
+		 * isn't a way to advertise that we are capable of RX
+		 * Pause ONLY, we will advertise that we support both
+		 * symmetric and asymmetric Rx PAUSE, as such we fall
+		 * through to the fc_full statement.  Later, we will
+		 * disable the adapter's ability to send PAUSE frames.
+		 */
+	case ixgbe_fc_full:
+		/* Flow control (both Rx and Tx) is enabled by SW override. */
+		pcs_an |= IXGBE_KRM_PCS_KX_AN_SYM_PAUSE |
+			   IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
+		break;
+	default:
+		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
+			      "Flow control param set incorrectly\n");
+		return IXGBE_ERR_CONFIG;
+	}
+
+	rc = hw->mac.ops.write_iosf_sb_reg(hw,
+					   IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+					   IXGBE_SB_IOSF_TARGET_KR_PHY, pcs_an);
+
+	/* Restart auto-negotiation. */
+	rc = hw->mac.ops.read_iosf_sb_reg(hw,
+					  IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					  IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
+
+	if (rc) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		return rc;
+	}
+
+	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	rc = hw->mac.ops.write_iosf_sb_reg(hw,
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
+
+	return rc;
+}
+
+/**
  * ixgbe_set_mux - Set mux for port 1 access with CS4227
  * @hw: pointer to hardware structure
  * @state: set mux if 1, clear if 0
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 8a8381f..d8278fa 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -107,7 +107,8 @@ s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			     u32 device_type, u16 *phy_data);
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			      u32 device_type, u16 phy_data);
-s32 ixgbe_setup_fc_x550a(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
 void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw);
 s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 11/40] net/ixgbe/base: add FC autoneg for X550em_a fiber
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (9 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 10/40] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 12/40] net/ixgbe/base: clear page register in error path Xiao Wang
                       ` (29 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch adds a separate function for enabling FC (flow control)
auto-negotiation on X550em_a:

- rename ixgbe_fc_autoneg_x550a() to ixgbe_fc_autoneg_backplane_x550em_a().
- create ixgbe_fc_autoneg_fiber_x550em_a() specifically for fiber.
- add definitions for KRM_PCS_KX_AN_LP register and related bits.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |  3 ++
 drivers/net/ixgbe/base/ixgbe_x550.c | 85 +++++++++++++++++++++++++++++++++++--
 drivers/net/ixgbe/base/ixgbe_x550.h |  3 +-
 3 files changed, 87 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 1d38195..f42ebaf 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4143,6 +4143,7 @@ struct ixgbe_hw {
 #define IXGBE_KRM_AN_CNTL_4(P)		((P) ? 0x8238 : 0x4238)
 #define IXGBE_KRM_AN_CNTL_8(P)		((P) ? 0x8248 : 0x4248)
 #define IXGBE_KRM_PCS_KX_AN(P)		((P) ? 0x9918 : 0x5918)
+#define IXGBE_KRM_PCS_KX_AN_LP(P)	((P) ? 0x991C : 0x591C)
 #define IXGBE_KRM_SGMII_CTRL(P)		((P) ? 0x82A0 : 0x42A0)
 #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P)	((P) ? 0x836C : 0x436C)
 #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)	((P) ? 0x8634 : 0x4634)
@@ -4174,6 +4175,8 @@ struct ixgbe_hw {
 #define IXGBE_KRM_AN_CNTL_1_ASM_PAUSE			(1 << 29)
 #define IXGBE_KRM_PCS_KX_AN_SYM_PAUSE			(1 << 1)
 #define IXGBE_KRM_PCS_KX_AN_ASM_PAUSE			(1 << 2)
+#define IXGBE_KRM_PCS_KX_AN_LP_SYM_PAUSE		(1 << 2)
+#define IXGBE_KRM_PCS_KX_AN_LP_ASM_PAUSE		(1 << 3)
 #define IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73		(1 << 29)
 #define IXGBE_KRM_AN_CNTL_8_LINEAR			(1 << 0)
 #define IXGBE_KRM_AN_CNTL_8_LIMITING			(1 << 1)
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index b0697aa..bf3da10 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -656,13 +656,14 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
 	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
 	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
 
 	switch (mac->ops.get_media_type(hw)) {
 	case ixgbe_media_type_fiber:
 		mac->ops.setup_fc = ixgbe_setup_fc_fiber_x550em_a;
+		mac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a;
 		break;
 	case ixgbe_media_type_backplane:
+		mac->ops.fc_autoneg = ixgbe_fc_autoneg_backplane_x550em_a;
 		mac->ops.setup_fc = ixgbe_setup_fc_backplane_x550em_a;
 		break;
 	default:
@@ -3958,12 +3959,12 @@ out:
 }
 
 /**
- *  ixgbe_fc_autoneg_x550a - Enable flow control IEEE clause 37
+ *  ixgbe_fc_autoneg_backplane_x550em_a - Enable flow control IEEE clause 37
  *  @hw: pointer to hardware structure
  *
  *  Enable flow control according to IEEE clause 37.
  **/
-void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw)
+void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 {
 	u32 link_s1, lp_an_page_low, an_cntl_1;
 	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
@@ -3995,6 +3996,7 @@ void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw)
 	if (status != IXGBE_SUCCESS ||
 	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
+		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
 		goto out;
 	}
 
@@ -4035,6 +4037,83 @@ out:
 }
 
 /**
+ *  ixgbe_fc_autoneg_fiber_x550em_a - Enable flow control IEEE clause 37
+ *  @hw: pointer to hardware structure
+ *
+ *  Enable flow control according to IEEE clause 37.
+ **/
+void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw)
+{
+	u32 link_s1, pcs_an_lp, pcs_an;
+	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+	ixgbe_link_speed speed;
+	bool link_up;
+
+	/* AN should have completed when the cable was plugged in.
+	 * Look for reasons to bail out.  Bail out if:
+	 * - FC autoneg is disabled, or if
+	 * - link is not up.
+	 */
+	if (hw->fc.disable_fc_autoneg) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			     "Flow control autoneg is disabled");
+		goto out;
+	}
+
+	hw->mac.ops.check_link(hw, &speed, &link_up, false);
+	if (!link_up) {
+		ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
+		goto out;
+	}
+
+	/* Check if auto-negotiation has completed */
+	status = hw->mac.ops.read_iosf_sb_reg(hw,
+					 IXGBE_KRM_LINK_S1(hw->bus.lan_id),
+					 IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
+
+	if (status != IXGBE_SUCCESS ||
+	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+		goto out;
+	}
+
+	/* Determine advertised flow control */
+	status = hw->mac.ops.read_iosf_sb_reg(hw,
+					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
+
+	if (status != IXGBE_SUCCESS) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		goto out;
+	}
+
+	/* Determine link parter flow control */
+	status = hw->mac.ops.read_iosf_sb_reg(hw,
+				  IXGBE_KRM_PCS_KX_AN_LP(hw->bus.lan_id),
+				  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an_lp);
+
+	if (status != IXGBE_SUCCESS) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		goto out;
+	}
+
+	status = ixgbe_negotiate_fc(hw, pcs_an, pcs_an_lp,
+				    IXGBE_KRM_PCS_KX_AN_SYM_PAUSE,
+				    IXGBE_KRM_PCS_KX_AN_ASM_PAUSE,
+				    IXGBE_KRM_PCS_KX_AN_LP_SYM_PAUSE,
+				    IXGBE_KRM_PCS_KX_AN_LP_ASM_PAUSE);
+
+out:
+	if (status == IXGBE_SUCCESS) {
+		hw->fc.fc_was_autonegged = true;
+	} else {
+		hw->fc.fc_was_autonegged = false;
+		hw->fc.current_mode = hw->fc.requested_mode;
+	}
+}
+
+/**
  *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control
  *  @hw: pointer to hardware structure
  *
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index d8278fa..db27c84 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -109,7 +109,8 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			      u32 device_type, u16 phy_data);
 s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
-void ixgbe_fc_autoneg_x550a(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw);
 s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 				  ixgbe_link_speed speed,
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 12/40] net/ixgbe/base: clear page register in error path
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (10 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 11/40] net/ixgbe/base: add FC autoneg " Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 13/40] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
                       ` (28 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

The error exit should at least try to set the page register to 0
since other code will assume that state.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index bf3da10..2cd5730 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -2349,6 +2349,7 @@ STATIC s32 ixgbe_reset_phy_m88(struct ixgbe_hw *hw)
 	return ixgbe_setup_m88(hw);
 
 out:
+	hw->phy.ops.write_reg_mdi(hw, IXGBE_M88E1500_PAGE_ADDR, 0, 0);
 	hw->mac.ops.release_swfw_sync(hw, mask);
 	return rc;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 13/40] net/ixgbe/base: configure DMAC for 10Mb operation
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (11 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 12/40] net/ixgbe/base: clear page register in error path Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 14/40] net/ixgbe/base: fix function comments about X550 Xiao Wang
                       ` (27 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Provide a DMA coalescing configuration for 10Mb link speed.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 2cd5730..08886a7 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -768,6 +768,7 @@ s32 ixgbe_dmac_config_tcs_X550(struct ixgbe_hw *hw)
 
 	/* Configure DMA coalescing enabled */
 	switch (hw->mac.dmac_config.link_speed) {
+	case IXGBE_LINK_SPEED_10_FULL:
 	case IXGBE_LINK_SPEED_100_FULL:
 		pb_headroom = IXGBE_DMACRXT_100M;
 		break;
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 14/40] net/ixgbe/base: fix function comments about X550
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (12 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 13/40] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 15/40] net/ixgbe/base: report setting LPE register error Xiao Wang
                       ` (26 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Some function commets are obviously wrong, this patch rewords them.

Fixes: d2e72774e58c ("ixgbe/base: support X550")
Fixes: 0790adeb5675 ("ixgbe/base: support X550em_a device")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 08886a7..ddd1195 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1106,8 +1106,8 @@ STATIC s32 ixgbe_iosf_wait(struct ixgbe_hw *hw, u32 *ctrl)
 }
 
 /**
- *  ixgbe_write_iosf_sb_reg_x550 - Writes a value to specified register of the IOSF
- *  device
+ *  ixgbe_write_iosf_sb_reg_x550 - Writes a value to specified register
+ *  of the IOSF device
  *  @hw: pointer to hardware structure
  *  @reg_addr: 32 bit PHY register to write
  *  @device_type: 3 bit device type
@@ -1153,12 +1153,11 @@ out:
 }
 
 /**
- *  ixgbe_read_iosf_sb_reg_x550 - Writes a value to specified register of the IOSF
- *  device
+ *  ixgbe_read_iosf_sb_reg_x550 - Reads specified register of the IOSF device
  *  @hw: pointer to hardware structure
  *  @reg_addr: 32 bit PHY register to write
  *  @device_type: 3 bit device type
- *  @phy_data: Pointer to read data from the register
+ *  @data: Pointer to read data from the register
  **/
 s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr,
 			   u32 device_type, u32 *data)
@@ -1292,8 +1291,7 @@ s32 ixgbe_write_iosf_sb_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 }
 
 /**
- *  ixgbe_read_iosf_sb_reg_x550a - Writes a value to specified register
- *  of the IOSF device.
+ *  ixgbe_read_iosf_sb_reg_x550a - Reads specified register of the IOSF device
  *  @hw: pointer to hardware structure
  *  @reg_addr: 32 bit PHY register to write
  *  @device_type: 3 bit device type
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 15/40] net/ixgbe/base: report setting LPE register error
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (13 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 14/40] net/ixgbe/base: fix function comments about X550 Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 16/40] net/ixgbe/base: bump mailbox version Xiao Wang
                       ` (25 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Propagate return value when trying to set the maximum packet length. A
PF driver could return a NACK for this request, and the VF driver will
need to know this.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 24 +++++++++++++++++-------
 drivers/net/ixgbe/base/ixgbe_vf.h |  2 +-
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 20a739c..69805f7 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -323,15 +323,16 @@ STATIC s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
 	return vector;
 }
 
-STATIC void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,
-					u32 *msg, u16 size)
+STATIC s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,
+				      u32 *retmsg, u16 size)
 {
 	struct ixgbe_mbx_info *mbx = &hw->mbx;
-	u32 retmsg[IXGBE_VFMAILBOX_SIZE];
 	s32 retval = mbx->ops.write_posted(hw, msg, size, 0);
 
-	if (!retval)
-		mbx->ops.read_posted(hw, retmsg, size, 0);
+	if (retval)
+		return retval;
+
+	return mbx->ops.read_posted(hw, retmsg, size, 0);
 }
 
 /**
@@ -665,13 +666,22 @@ out:
  *  @hw: pointer to the HW structure
  *  @max_size: value to assign to max frame size
  **/
-void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
+s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
 {
 	u32 msgbuf[2];
+	s32 retval;
 
 	msgbuf[0] = IXGBE_VF_SET_LPE;
 	msgbuf[1] = max_size;
-	ixgbevf_write_msg_read_ack(hw, msgbuf, 2);
+
+	retval = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
+	if (retval)
+		return retval;
+	if ((msgbuf[0] & IXGBE_VF_SET_LPE) &&
+	    (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK))
+		return IXGBE_ERR_MBX;
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.h b/drivers/net/ixgbe/base/ixgbe_vf.h
index 624a97d..d288f31 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.h
+++ b/drivers/net/ixgbe/base/ixgbe_vf.h
@@ -134,7 +134,7 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
 s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode);
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		      bool vlan_on, bool vlvf_bypass);
-void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
+s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
 int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
 int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 		       unsigned int *default_tc);
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 16/40] net/ixgbe/base: bump mailbox version
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (14 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 15/40] net/ixgbe/base: report setting LPE register error Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 17/40] net/ixgbe/base: access IOSF by host interface Xiao Wang
                       ` (24 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch will pave the way for the new VF unicast promiscuous
mode support.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed the minor cleanup from this patch.

---
 drivers/net/ixgbe/base/ixgbe_mbx.h | 1 +
 drivers/net/ixgbe/base/ixgbe_vf.c  | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
index c3e301f..cabb062 100644
--- a/drivers/net/ixgbe/base/ixgbe_mbx.h
+++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
@@ -90,6 +90,7 @@ enum ixgbe_pfvf_api_rev {
 	ixgbe_mbox_api_20,	/* API version 2.0, solaris Phase1 VF driver */
 	ixgbe_mbox_api_11,	/* API version 1.1, linux/freebsd VF driver */
 	ixgbe_mbox_api_12,	/* API version 1.2, linux/freebsd VF driver */
+	ixgbe_mbox_api_13,	/* API version 1.3, linux/freebsd VF driver */
 	/* This value should always be last */
 	ixgbe_mbox_api_unknown,	/* indicates that API version is not known */
 };
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 69805f7..c0fedea 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -435,6 +435,7 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
 
 	switch (hw->api_version) {
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
@@ -728,6 +729,7 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 	switch (hw->api_version) {
 	case ixgbe_mbox_api_11:
 	case ixgbe_mbox_api_12:
+	case ixgbe_mbox_api_13:
 		break;
 	default:
 		return 0;
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 17/40] net/ixgbe/base: access IOSF by host interface
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (15 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 16/40] net/ixgbe/base: bump mailbox version Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 18/40] net/ixgbe/base: fix check on NACK Xiao Wang
                       ` (23 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch makes sure that we access IOSF registers through the HIC
(host interface command) for the majority of X550em devices. All devices
with NVM are capable of using the HIC.

For consistency all instances where the ixgbe_write_phy_reg_mdi is called
directly are converted to function pointer calls.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Rewrote the commit log to cover the ixgbe_write_phy_reg_mdi
      convertion.

---
 drivers/net/ixgbe/base/ixgbe_phy.c  |  2 +-
 drivers/net/ixgbe/base/ixgbe_x550.c | 38 ++++++++++++++++++++++---------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index d33d0f8..ee8618f 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -741,7 +741,7 @@ s32 ixgbe_write_phy_reg_generic(struct ixgbe_hw *hw, u32 reg_addr,
 	DEBUGFUNC("ixgbe_write_phy_reg_generic");
 
 	if (hw->mac.ops.acquire_swfw_sync(hw, gssr) == IXGBE_SUCCESS) {
-		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
+		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,
 						 phy_data);
 		hw->mac.ops.release_swfw_sync(hw, gssr);
 	} else {
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index ddd1195..c8873ee 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -652,8 +652,14 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 	/* Start with generic X550EM init */
 	ret_val = ixgbe_init_ops_X550EM(hw);
 
-	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII ||
+	    hw->device_id == IXGBE_DEV_ID_X550EM_A_SGMII_L) {
+		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	} else {
+		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550a;
+		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550a;
+	}
 	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
 	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
 
@@ -2807,24 +2813,25 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
  **/
 STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 {
+	struct ixgbe_mac_info *mac = &hw->mac;
 	s32 status;
 	u32 reg_val;
 
 	/* Disable training protocol FSM. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_CONV_WO_PROTOCOL;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Disable Flex from training TXFFE. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2832,12 +2839,12 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_C0_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_4(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2845,14 +2852,14 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_C0_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CP1_CN1_EN;
 	reg_val &= ~IXGBE_KRM_DSP_TXFFE_STATE_CO_ADAPT_EN;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_DSP_TXFFE_STATE_5(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Enable override for coefficients. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 				IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2861,7 +2868,7 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
 	reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CZERO_EN;
 	reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CPLUS1_OVRRD_EN;
 	reg_val |= IXGBE_KRM_TX_COEFF_CTRL_1_CMINUS1_OVRRD_EN;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 				IXGBE_KRM_TX_COEFF_CTRL_1(hw->bus.lan_id),
 				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	return status;
@@ -2877,11 +2884,12 @@ STATIC s32 ixgbe_setup_ixfi_x550em_x(struct ixgbe_hw *hw)
  **/
 STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 {
+	struct ixgbe_mac_info *mac = &hw->mac;
 	s32 status;
 	u32 reg_val;
 
 	/* Disable AN and force speed to 10G Serial. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2903,7 +2911,7 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 		return IXGBE_ERR_LINK_SETUP;
 	}
 
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
@@ -2917,13 +2925,13 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	}
 
 	/* Toggle port SW reset by AN reset. */
-	status = ixgbe_read_iosf_sb_reg_x550(hw,
+	status = mac->ops.read_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	status = ixgbe_write_iosf_sb_reg_x550(hw,
+	status = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
@@ -4504,7 +4512,7 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 	DEBUGFUNC("ixgbe_write_phy_reg_x550a");
 
 	if (hw->mac.ops.acquire_swfw_sync(hw, mask) == IXGBE_SUCCESS) {
-		status = ixgbe_write_phy_reg_mdi(hw, reg_addr, device_type,
+		status = hw->phy.ops.write_reg_mdi(hw, reg_addr, device_type,
 						 phy_data);
 		hw->mac.ops.release_swfw_sync(hw, mask);
 	} else {
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 18/40] net/ixgbe/base: fix check on NACK
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (16 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 17/40] net/ixgbe/base: access IOSF by host interface Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 19/40] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
                       ` (22 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Previously we checked only return buffer for
(IXGBE_VF_SET_MACVLAN |  IXGBE_VT_MSGTYPE_NACK), but this would not
work if index is not 0 and as a result NACK will not be detected.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Rewrote the commit log.
    - Fixed NACK only in this patch, put ixgbevf_write_msg_read_ack()
      switch in patch 27/40.

---
 drivers/net/ixgbe/base/ixgbe_vf.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index c0fedea..e5f3771 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -530,7 +530,7 @@ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr)
 s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 {
 	struct ixgbe_mbx_info *mbx = &hw->mbx;
-	u32 msgbuf[3];
+	u32 msgbuf[3], msgbuf_chk;
 	u8 *msg_addr = (u8 *)(&msgbuf[1]);
 	s32 ret_val;
 
@@ -543,18 +543,19 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 	 */
 	msgbuf[0] |= index << IXGBE_VT_MSGINFO_SHIFT;
 	msgbuf[0] |= IXGBE_VF_SET_MACVLAN;
+	msgbuf_chk = msgbuf[0];
 	if (addr)
 		memcpy(msg_addr, addr, 6);
 	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
 
 	if (!ret_val)
 		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
+	if (!ret_val) {
+		msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
-	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
-
-	if (!ret_val)
-		if (msgbuf[0] == (IXGBE_VF_SET_MACVLAN | IXGBE_VT_MSGTYPE_NACK))
-			ret_val = IXGBE_ERR_OUT_OF_MEM;
+		if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_NACK))
+			return IXGBE_ERR_OUT_OF_MEM;
+	}
 
 	return ret_val;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 19/40] net/ixgbe/base: define X550 PCIe serial MAC addr
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (17 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 18/40] net/ixgbe/base: fix check on NACK Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 20/40] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
                       ` (21 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Add SERIAL_NUMBER_MAC_ADDR definition for X550.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index f42ebaf..1fc7c02 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -2338,7 +2338,9 @@ enum {
 
 #define IXGBE_SAN_MAC_ADDR_PTR		0x28
 #define IXGBE_DEVICE_CAPS		0x2C
-#define IXGBE_SERIAL_NUMBER_MAC_ADDR	0x11
+#define IXGBE_82599_SERIAL_NUMBER_MAC_ADDR	0x11
+#define IXGBE_X550_SERIAL_NUMBER_MAC_ADDR	0x04
+
 #define IXGBE_PCIE_MSIX_82599_CAPS	0x72
 #define IXGBE_MAX_MSIX_VECTORS_82599	0x40
 #define IXGBE_PCIE_MSIX_82598_CAPS	0x62
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 20/40] net/ixgbe/base: bypass checking link for crosstalk
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (18 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 19/40] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 21/40] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
                       ` (20 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

When HW starts, first read the NVM to see if the crosstalk fix should
be used on the given HW and cache that information in the HW structure.

When we check_link we first see if 1) NVM requests this fix 2) if
we are an SFP+ device 3) see if a module is not in the SFP+ cage.
If all the above are true then don't bother checking the link, just
say it is down.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 72 +++++++++++++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_type.h   |  1 +
 2 files changed, 73 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index e46af23..1c7263d 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -372,6 +372,7 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 {
 	s32 ret_val;
 	u32 ctrl_ext;
+	u16 device_caps;
 
 	DEBUGFUNC("ixgbe_start_hw_generic");
 
@@ -397,6 +398,22 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 	if (ret_val != IXGBE_SUCCESS)
 		goto out;
 
+	/* Cache bit indicating need for crosstalk fix */
+	switch (hw->mac.type) {
+	case ixgbe_mac_82599EB:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
+		hw->mac.ops.get_device_caps(hw, &device_caps);
+		if (device_caps & IXGBE_DEVICE_CAPS_NO_CROSSTALK_WR)
+			hw->need_crosstalk_fix = false;
+		else
+			hw->need_crosstalk_fix = true;
+		break;
+	default:
+		hw->need_crosstalk_fix = false;
+		break;
+	}
+
 	/* Clear adapter stopped flag */
 	hw->adapter_stopped = false;
 
@@ -4026,6 +4043,32 @@ s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw)
 }
 
 /**
+ *  ixgbe_need_crosstalk_fix - Determine if we need to do cross talk fix
+ *  @hw: pointer to hardware structure
+ *
+ *  Contains the logic to identify if we need to verify link for the
+ *  crosstalk fix
+ **/
+static bool ixgbe_need_crosstalk_fix(struct ixgbe_hw *hw)
+{
+
+	/* Does FW say we need the fix */
+	if (!hw->need_crosstalk_fix)
+		return false;
+
+	/* Only consider SFP+ PHYs i.e. media type fiber */
+	switch (hw->mac.ops.get_media_type(hw)) {
+	case ixgbe_media_type_fiber:
+	case ixgbe_media_type_fiber_qsfp:
+		break;
+	default:
+		return false;
+	}
+
+	return true;
+}
+
+/**
  *  ixgbe_check_mac_link_generic - Determine link and speed status
  *  @hw: pointer to hardware structure
  *  @speed: pointer to link speed
@@ -4042,6 +4085,35 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 
 	DEBUGFUNC("ixgbe_check_mac_link_generic");
 
+	/* If Crosstalk fix enabled do the sanity check of making sure
+	 * the SFP+ cage is full.
+	 */
+	if (ixgbe_need_crosstalk_fix(hw)) {
+		u32 sfp_cage_full;
+
+		switch (hw->mac.type) {
+		case ixgbe_mac_82599EB:
+			sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
+					IXGBE_ESDP_SDP2;
+			break;
+		case ixgbe_mac_X550EM_x:
+		case ixgbe_mac_X550EM_a:
+			sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) &
+					IXGBE_ESDP_SDP0;
+			break;
+		default:
+			/* sanity check - No SFP+ devices here */
+			sfp_cage_full = false;
+			break;
+		}
+
+		if (!sfp_cage_full) {
+			*link_up = false;
+			*speed = IXGBE_LINK_SPEED_UNKNOWN;
+			return IXGBE_SUCCESS;
+		}
+	}
+
 	/* clear the old state */
 	links_orig = IXGBE_READ_REG(hw, IXGBE_LINKS);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 1fc7c02..262f656 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4084,6 +4084,7 @@ struct ixgbe_hw {
 	bool force_full_reset;
 	bool allow_unsupported_sfp;
 	bool wol_enabled;
+	bool need_crosstalk_fix;
 };
 
 #define ixgbe_call_func(hw, func, params, error) \
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 21/40] net/ixgbe/base: support X550em_a SGMII FC autoneg
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (19 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 20/40] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 22/40] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
                       ` (19 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Create FC (flow control) setup and enable FC function with code to
configure the PHY registers to advertize FC settings according to the
user requested settings and to negotiate the same with the link partner
and arrive at a negotiated setting (RX and TX enabled, TX only enabled,
FC disabled and RX enabled (which also enables TX) ). Remove the part of
code that performs FC auto-negotiation (AN) in ixgbe_setup_m88 and put it
in a new function to maintain consistency with other FC AN implementations
so far.  Add function pointers to the setup-fc and enable-fc functions so
that they get called during init to perform FC AN.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 172 ++++++++++++++++++++++++++++++++----
 drivers/net/ixgbe/base/ixgbe_x550.h |   2 +
 2 files changed, 158 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index c8873ee..a9f4d2a 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -676,6 +676,12 @@ 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)) {
+		mac->ops.fc_autoneg = ixgbe_fc_autoneg_sgmii_x550em_a;
+		mac->ops.setup_fc = ixgbe_setup_fc_sgmii_x550em_a;
+	}
+
 	return ret_val;
 }
 
@@ -2182,27 +2188,15 @@ STATIC s32 ixgbe_setup_m88(struct ixgbe_hw *hw)
 	rc = hw->phy.ops.read_reg_mdi(hw, IXGBE_M88E1500_COPPER_AN, 0, &reg);
 	if (rc)
 		goto out;
-	reg &= ~IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
-	reg &= ~IXGBE_M88E1500_COPPER_AN_PAUSE;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_T4;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_FD;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_100TX_HD;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_FD;
 	reg &= ~IXGBE_M88E1500_COPPER_AN_10TX_HD;
-	switch (hw->fc.current_mode) {
-	case ixgbe_fc_full:
-		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
-		break;
-	case ixgbe_fc_rx_pause:
-		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
-		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
-		break;
-	case ixgbe_fc_tx_pause:
-		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
-		break;
-	default:
-		break;
-	}
+
+	/* Flow control auto negotiation configuration was moved from here to
+	 * the function ixgbe_setup_fc_sgmii_x550em_a()
+	 */
 
 	if (hw->phy.autoneg_advertised & IXGBE_LINK_SPEED_100_FULL)
 		reg |= IXGBE_M88E1500_COPPER_AN_100TX_FD;
@@ -4122,6 +4116,152 @@ out:
 }
 
 /**
+ *  ixgbe_fc_autoneg_sgmii_x550em_a - Enable flow control IEEE clause 37
+ *  @hw: pointer to hardware structure
+ *
+ *  Enable flow control according to IEEE clause 37.
+ **/
+void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw)
+{
+	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+	u16 reg, pcs_an_lp, pcs_an;
+	ixgbe_link_speed speed;
+	bool link_up;
+
+	/* AN should have completed when the cable was plugged in.
+	 * Look for reasons to bail out.  Bail out if:
+	 * - FC autoneg is disabled, or if
+	 * - link is not up.
+	 */
+	if (hw->fc.disable_fc_autoneg) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			     "Flow control autoneg is disabled");
+		goto out;
+	}
+
+	hw->mac.ops.check_link(hw, &speed, &link_up, false);
+	if (!link_up) {
+		ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
+		goto out;
+	}
+
+	/* Check if auto-negotiation has completed */
+	status = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_STATUS,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg);
+	if (status != IXGBE_SUCCESS ||
+	    (reg & IXGBE_M88E1500_COPPER_STATUS_AN_DONE) == 0) {
+		DEBUGOUT("Auto-Negotiation did not complete\n");
+		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
+		goto out;
+	}
+
+	/* Get the advertized flow control */
+	status = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_AN,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &pcs_an);
+	if (status != IXGBE_SUCCESS)
+		goto out;
+
+	/* Get link partner's flow control */
+	status = hw->phy.ops.read_reg(hw,
+			IXGBE_M88E1500_COPPER_AN_LP_ABILITY,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &pcs_an_lp);
+	if (status != IXGBE_SUCCESS)
+		goto out;
+
+	/* Negotiate the flow control */
+	status = ixgbe_negotiate_fc(hw, (u32)pcs_an, (u32)pcs_an_lp,
+				    IXGBE_M88E1500_COPPER_AN_PAUSE,
+				    IXGBE_M88E1500_COPPER_AN_AS_PAUSE,
+				    IXGBE_M88E1500_COPPER_AN_LP_PAUSE,
+				    IXGBE_M88E1500_COPPER_AN_LP_AS_PAUSE);
+
+out:
+	if (status == IXGBE_SUCCESS) {
+		hw->fc.fc_was_autonegged = true;
+	} else {
+		hw->fc.fc_was_autonegged = false;
+		hw->fc.current_mode = hw->fc.requested_mode;
+	}
+}
+
+/**
+ *  ixgbe_setup_fc_sgmii_x550em_a - Set up flow control
+ *  @hw: pointer to hardware structure
+ *
+ *  Called at init time to set up flow control.
+ **/
+s32 ixgbe_setup_fc_sgmii_x550em_a(struct ixgbe_hw *hw)
+{
+	u16 reg;
+	s32 rc;
+
+	/* Validate the requested mode */
+	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
+		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
+			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+		return IXGBE_ERR_INVALID_LINK_SETTINGS;
+	}
+
+	if (hw->fc.requested_mode == ixgbe_fc_default)
+		hw->fc.requested_mode = ixgbe_fc_full;
+
+	/* Read contents of the Auto-Negotiation register, page 0 reg 4 */
+	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_AN,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg);
+	if (rc)
+		goto out;
+
+	/* Disable all the settings related to Flow control Auto-negotiation */
+	reg &= ~IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+	reg &= ~IXGBE_M88E1500_COPPER_AN_PAUSE;
+
+	/* Configure the Asymmetric and symmetric pause according to the user
+	 * requested mode.
+	 */
+	switch (hw->fc.requested_mode) {
+	case ixgbe_fc_full:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+		break;
+	case ixgbe_fc_rx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_PAUSE;
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+		break;
+	case ixgbe_fc_tx_pause:
+		reg |= IXGBE_M88E1500_COPPER_AN_AS_PAUSE;
+		break;
+	default:
+		break;
+	}
+
+	/* Write back to the Auto-Negotiation register with newly configured
+	 * fields
+	 */
+	hw->phy.ops.write_reg(hw, IXGBE_M88E1500_COPPER_AN,
+					IXGBE_MDIO_ZERO_DEV_TYPE, reg);
+
+	/* In this section of the code we restart Auto-negotiation */
+
+	/* Read the CONTROL register, Page 0 reg 0 */
+	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_COPPER_CTRL,
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg);
+	if (rc)
+		goto out;
+
+	/* Set the bit to restart Auto-Neg. The bit to enable Auto-neg is ON
+	 * by default
+	 */
+	reg |= IXGBE_M88E1500_COPPER_CTRL_RESTART_AN;
+
+	/* write the new values to the register to restart Auto-Negotiation */
+	hw->phy.ops.write_reg(hw, IXGBE_M88E1500_COPPER_CTRL,
+					IXGBE_MDIO_ZERO_DEV_TYPE, reg);
+
+out:
+	return rc;
+}
+
+/**
  *  ixgbe_setup_fc_backplane_x550em_a - Set up flow control
  *  @hw: pointer to hardware structure
  *
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index db27c84..c7253f0 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -109,8 +109,10 @@ s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
 			      u32 device_type, u16 phy_data);
 s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_sgmii_x550em_a(struct ixgbe_hw *hw);
 void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw);
 void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg_sgmii_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw);
 s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw,
 				  ixgbe_link_speed speed,
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 22/40] net/ixgbe/base: add macros for GENEVE UDP port
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (20 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 21/40] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
@ 2016-09-25  8:59     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 23/40] net/ixgbe/base: add bound check in LED functions Xiao Wang
                       ` (18 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  8:59 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

X550em_a adds GENEVE support by using the upper 16 bits of VXLANCTRL
to store the UDP port (VXLANCTRL.GENEVE_UDP_PORT).

This patch adds definitions that can be used to manipulate the ports
depending on which protocol is being configured.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 262f656..70f684c 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -565,6 +565,13 @@ struct ixgbe_thermal_sensor_data {
 #define IXGBE_PROXYFC	0x05F64 /* Proxying Filter Control Register */
 #define IXGBE_VXLANCTRL	0x0000507C /* Rx filter VXLAN UDPPORT Register */
 
+/* masks for accessing VXLAN and GENEVE UDP ports */
+#define IXGBE_VXLANCTRL_VXLAN_UDPPORT_MASK	0x0000ffff /* VXLAN port */
+#define IXGBE_VXLANCTRL_GENEVE_UDPPORT_MASK	0xffff0000 /* GENEVE port */
+#define IXGBE_VXLANCTRL_ALL_UDPPORT_MASK	0xffffffff /* GENEVE/VXLAN */
+
+#define IXGBE_VXLANCTRL_GENEVE_UDPPORT_SHIFT	16
+
 #define IXGBE_FHFT(_n)	(0x09000 + ((_n) * 0x100)) /* Flex host filter table */
 /* Ext Flexible Host Filter Table */
 #define IXGBE_FHFT_EXT(_n)	(0x09800 + ((_n) * 0x100))
@@ -2785,6 +2792,7 @@ enum {
 #define IXGBE_RXDADV_PKTTYPE_UDP	0x00000200 /* UDP hdr present */
 #define IXGBE_RXDADV_PKTTYPE_SCTP	0x00000400 /* SCTP hdr present */
 #define IXGBE_RXDADV_PKTTYPE_NFS	0x00000800 /* NFS hdr present */
+#define IXGBE_RXDADV_PKTTYPE_GENEVE	0x00000800 /* GENEVE hdr present */
 #define IXGBE_RXDADV_PKTTYPE_VXLAN	0x00000800 /* VXLAN hdr present */
 #define IXGBE_RXDADV_PKTTYPE_TUNNEL	0x00010000 /* Tunnel type */
 #define IXGBE_RXDADV_PKTTYPE_IPSEC_ESP	0x00001000 /* IPSec ESP */
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 23/40] net/ixgbe/base: add bound check in LED functions
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (21 preceding siblings ...)
  2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 22/40] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 24/40] net/ixgbe/base: use default check link function Xiao Wang
                       ` (17 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Do parameter check to prevent exceptional value being written into
register.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed variable type change of secrxreg from this patch.

---
 drivers/net/ixgbe/base/ixgbe_common.c | 13 +++++++++++++
 drivers/net/ixgbe/base/ixgbe_x540.c   |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 1c7263d..c01f919 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -1133,6 +1133,9 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_led_on_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/* To turn on the LED, set mode to ON. */
 	led_reg &= ~IXGBE_LED_MODE_MASK(index);
 	led_reg |= IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index);
@@ -1153,6 +1156,9 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_led_off_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/* To turn off the LED, set mode to OFF. */
 	led_reg &= ~IXGBE_LED_MODE_MASK(index);
 	led_reg |= IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index);
@@ -3388,6 +3394,9 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_blink_led_start_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/*
 	 * Link must be up to auto-blink the LEDs;
 	 * Force it if link is down.
@@ -3433,6 +3442,10 @@ s32 ixgbe_blink_led_stop_generic(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_blink_led_stop_generic");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
+
 	ret_val = hw->mac.ops.prot_autoc_read(hw, &locked, &autoc_reg);
 	if (ret_val != IXGBE_SUCCESS)
 		goto out;
diff --git a/drivers/net/ixgbe/base/ixgbe_x540.c b/drivers/net/ixgbe/base/ixgbe_x540.c
index 31dead0..24e9c93 100644
--- a/drivers/net/ixgbe/base/ixgbe_x540.c
+++ b/drivers/net/ixgbe/base/ixgbe_x540.c
@@ -982,6 +982,9 @@ s32 ixgbe_blink_led_start_X540(struct ixgbe_hw *hw, u32 index)
 
 	DEBUGFUNC("ixgbe_blink_led_start_X540");
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	/*
 	 * Link should be up in order for the blink bit in the LED control
 	 * register to work. Force link and speed in the MAC if link is down.
@@ -1016,6 +1019,9 @@ s32 ixgbe_blink_led_stop_X540(struct ixgbe_hw *hw, u32 index)
 	u32 macc_reg;
 	u32 ledctl_reg;
 
+	if (index > 3)
+		return IXGBE_ERR_PARAM;
+
 	DEBUGFUNC("ixgbe_blink_led_stop_X540");
 
 	/* Restore the LED to its default value. */
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 24/40] net/ixgbe/base: use default check link function
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (22 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 23/40] net/ixgbe/base: add bound check in LED functions Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 25/40] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
                       ` (16 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch removes X550em_a specific check link function and use default
ixgbe_check_mac_link_generic for it. It is not necessary to check both the
MAC link register and external PHY registers when checking link.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c |  7 ++++
 drivers/net/ixgbe/base/ixgbe_type.h   |  1 +
 drivers/net/ixgbe/base/ixgbe_x550.c   | 78 ++++-------------------------------
 3 files changed, 16 insertions(+), 70 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index c01f919..985fece 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -4173,6 +4173,13 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
 				*speed = IXGBE_LINK_SPEED_5GB_FULL;
 		}
 		break;
+	case IXGBE_LINKS_SPEED_10_X550EM_A:
+		*speed = IXGBE_LINK_SPEED_UNKNOWN;
+		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
+		    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
+			*speed = IXGBE_LINK_SPEED_10_FULL;
+		}
+		break;
 	default:
 		*speed = IXGBE_LINK_SPEED_UNKNOWN;
 	}
diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 70f684c..f1e4274 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -2213,6 +2213,7 @@ enum {
 #define IXGBE_LINKS_SPEED_10G_82599	0x30000000
 #define IXGBE_LINKS_SPEED_1G_82599	0x20000000
 #define IXGBE_LINKS_SPEED_100_82599	0x10000000
+#define IXGBE_LINKS_SPEED_10_X550EM_A	0x00000000
 #define IXGBE_LINK_UP_TIME		90 /* 9.0 Seconds */
 #define IXGBE_AUTO_NEG_TIME		45 /* 4.5 Seconds */
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index a9f4d2a..3c19326 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1716,72 +1716,6 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 }
 
 /**
- * ixgbe_check_link_m88 - Poll PHY for link
- * @hw: pointer to hardware structure
- * @speed: pointer to link speed
- * @link_up: true when link is up
- * @link_up_wait: bool indicating whether to wait for link
- *
- * Check that both the MAC and PHY have link.
- */
-static s32
-ixgbe_check_link_m88(struct ixgbe_hw *hw, ixgbe_link_speed *speed,
-		     bool *link_up, bool link_up_wait)
-{
-	u16 reg;
-	s32 rc;
-	u32 i;
-
-	rc = ixgbe_check_mac_link_generic(hw, speed, link_up, link_up_wait);
-	if (rc || !*link_up)
-		return rc;
-
-	rc = hw->phy.ops.read_reg(hw, IXGBE_M88E1500_PHY_SPEC_STATUS, 0, &reg);
-
-	/* MAC link is up, so check external PHY link */
-	*link_up = !!(reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK);
-
-	if (link_up_wait) {
-		for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
-			if (!rc &&
-			    (reg & IXGBE_M88E1500_PHY_SPEC_STATUS_LINK)) {
-				*link_up = true;
-				break;
-			}
-			*link_up = false;
-			msec_delay(100);
-			rc = hw->phy.ops.read_reg(hw,
-						 IXGBE_M88E1500_PHY_SPEC_STATUS,
-						 0, &reg);
-		}
-	}
-
-#define M88_SPEED(x) (IXGBE_M88E1500_PHY_SPEC_STATUS_RESOLVED  | \
-		      IXGBE_M88E1500_PHY_SPEC_STATUS_DUPLEX     | \
-		      ((IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_##x) <<\
-			IXGBE_M88E1500_PHY_SPEC_STATUS_SPEED_SHIFT))
-
-	reg &= M88_SPEED(MASK);
-	switch (reg) {
-	case M88_SPEED(10):
-		*speed = IXGBE_LINK_SPEED_10_FULL;
-		break;
-	case M88_SPEED(100):
-		*speed = IXGBE_LINK_SPEED_100_FULL;
-		break;
-	case M88_SPEED(1000):
-		*speed = IXGBE_LINK_SPEED_1GB_FULL;
-		break;
-	default:
-		*speed = IXGBE_LINK_SPEED_UNKNOWN;
-		break;
-	}
-#undef M88_SPEED
-
-	return rc;
-}
-
-/**
  *  ixgbe_init_mac_link_ops_X550em - init mac link function pointers
  *  @hw: pointer to hardware structure
  */
@@ -1811,10 +1745,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
 				ixgbe_setup_mac_link_sfp_x550em;
 		break;
 	case ixgbe_media_type_copper:
-		if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
-		    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
-			mac->ops.setup_link = ixgbe_setup_sgmii_m88;
-			mac->ops.check_link = ixgbe_check_link_m88;
+		if (hw->mac.type == ixgbe_mac_X550EM_a) {
+			if (hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T ||
+			    hw->device_id == IXGBE_DEV_ID_X550EM_A_1G_T_L) {
+				mac->ops.setup_link = ixgbe_setup_sgmii_m88;
+			} else {
+				mac->ops.setup_link =
+						  ixgbe_setup_mac_link_t_X550em;
+			}
 		} else {
 			mac->ops.setup_link = ixgbe_setup_mac_link_t_X550em;
 			mac->ops.check_link = ixgbe_check_link_t_X550em;
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 25/40] net/ixgbe/base: set default autoneg speed at reset
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (23 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 24/40] net/ixgbe/base: use default check link function Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 26/40] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
                       ` (15 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch avoids the situation where we initialize adapter and not
yet set up phy.autoneg_advertised speeds. In that case we could end
up in having no autoneg speeds enabled and get no link until we
reset link and set autoneg speeds correctly.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 3c19326..32759cc 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -2283,6 +2283,12 @@ STATIC s32 ixgbe_reset_phy_m88(struct ixgbe_hw *hw)
 
 	hw->mac.ops.release_swfw_sync(hw, mask);
 
+	/* In case of first reset set advertised speeds to default value */
+	if (!hw->phy.autoneg_advertised)
+		hw->phy.autoneg_advertised = IXGBE_LINK_SPEED_1GB_FULL |
+					     IXGBE_LINK_SPEED_100_FULL |
+					     IXGBE_LINK_SPEED_10_FULL;
+
 	return ixgbe_setup_m88(hw);
 
 out:
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 26/40] net/ixgbe/base: add missing FDIRSCTPM mask setting
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (24 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 25/40] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 27/40] net/ixgbe/base: commonize mailbox write and read Xiao Wang
                       ` (14 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch adds missing FDIRSCTPM mask setting for tunneled packets.
It should be set the same way as FDIRTCPM and FDIRUDPM so that SCTP
packets can be filtered correctly.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_82599.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_82599.c b/drivers/net/ixgbe/base/ixgbe_82599.c
index 5bc7c2b..832242e 100644
--- a/drivers/net/ixgbe/base/ixgbe_82599.c
+++ b/drivers/net/ixgbe/base/ixgbe_82599.c
@@ -1178,6 +1178,7 @@ mac_reset_top:
 	if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
 		/* Save the SAN MAC RAR index */
 		hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
+
 		hw->mac.ops.set_rar(hw, hw->mac.san_mac_rar_index,
 				    hw->mac.san_addr, 0, IXGBE_RAH_AV);
 
@@ -1809,14 +1810,23 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw,
 		}
 		IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIP6M, fdirip6m);
 
-		/* Set all bits in FDIRTCPM, FDIRUDPM, FDIRSIP4M and
-		 * FDIRDIP4M in cloud mode to allow L3/L3 packets to
-		 * tunnel.
+		/* Set all bits in FDIRTCPM, FDIRUDPM, FDIRSCTPM,
+		 * FDIRSIP4M and FDIRDIP4M in cloud mode to allow
+		 * L3/L3 packets to tunnel.
 		 */
 		IXGBE_WRITE_REG(hw, IXGBE_FDIRTCPM, 0xFFFFFFFF);
 		IXGBE_WRITE_REG(hw, IXGBE_FDIRUDPM, 0xFFFFFFFF);
 		IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M, 0xFFFFFFFF);
 		IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRSIP4M, 0xFFFFFFFF);
+		switch (hw->mac.type) {
+		case ixgbe_mac_X550:
+		case ixgbe_mac_X550EM_x:
+		case ixgbe_mac_X550EM_a:
+			IXGBE_WRITE_REG(hw, IXGBE_FDIRSCTPM, 0xFFFFFFFF);
+			break;
+		default:
+			break;
+		}
 	}
 
 	/* Now mask VM pool and destination IPv6 - bits 5 and 2 */
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 27/40] net/ixgbe/base: commonize mailbox write and read
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (25 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 26/40] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 28/40] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
                       ` (13 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

ixgbevf_write_msg_read_ack() is now performing mailbox write and read,
so this patch use this function to commonize mailbox write and read.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_vf.c | 36 ++++++++----------------------------
 1 file changed, 8 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index e5f3771..919b975 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -346,7 +346,6 @@ STATIC s32 ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, u32 *msg,
 s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
 		     u32 enable_addr)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[3];
 	u8 *msg_addr = (u8 *)(&msgbuf[1]);
 	s32 ret_val;
@@ -355,10 +354,7 @@ s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq,
 	memset(msgbuf, 0, 12);
 	msgbuf[0] = IXGBE_VF_SET_MAC_ADDR;
 	memcpy(msg_addr, addr, 6);
-	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
-
-	if (!ret_val)
-		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
+	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
 
 	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
@@ -429,7 +425,6 @@ s32 ixgbe_update_mc_addr_list_vf(struct ixgbe_hw *hw, u8 *mc_addr_list,
  **/
 s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[2];
 	s32 err;
 
@@ -444,11 +439,7 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
 	msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
 	msgbuf[1] = xcast_mode;
 
-	err = mbx->ops.write_posted(hw, msgbuf, 2, 0);
-	if (err)
-		return err;
-
-	err = mbx->ops.read_posted(hw, msgbuf, 2, 0);
+	err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
 	if (err)
 		return err;
 
@@ -465,11 +456,12 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode)
  *  @vind: unused by VF drivers
  *  @vlan_on: if true then set bit, else clear bit
  *  @vlvf_bypass: boolean flag indicating updating default pool is okay
+ *
+ *  Turn on/off specified VLAN in the VLAN filter table.
  **/
 s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 		      bool vlan_on, bool vlvf_bypass)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[2];
 	s32 ret_val;
 	UNREFERENCED_2PARAMETER(vind, vlvf_bypass);
@@ -479,10 +471,7 @@ s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 	/* Setting the 8 bit field MSG INFO to TRUE indicates "add" */
 	msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT;
 
-	ret_val = mbx->ops.write_posted(hw, msgbuf, 2, 0);
-	if (!ret_val)
-		ret_val = mbx->ops.read_posted(hw, msgbuf, 1, 0);
-
+	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2);
 	if (!ret_val && (msgbuf[0] & IXGBE_VT_MSGTYPE_ACK))
 		return IXGBE_SUCCESS;
 
@@ -529,7 +518,6 @@ s32 ixgbe_get_mac_addr_vf(struct ixgbe_hw *hw, u8 *mac_addr)
 
 s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 {
-	struct ixgbe_mbx_info *mbx = &hw->mbx;
 	u32 msgbuf[3], msgbuf_chk;
 	u8 *msg_addr = (u8 *)(&msgbuf[1]);
 	s32 ret_val;
@@ -546,10 +534,8 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
 	msgbuf_chk = msgbuf[0];
 	if (addr)
 		memcpy(msg_addr, addr, 6);
-	ret_val = mbx->ops.write_posted(hw, msgbuf, 3, 0);
 
-	if (!ret_val)
-		ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
+	ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 3);
 	if (!ret_val) {
 		msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
@@ -700,11 +686,8 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api)
 	msg[0] = IXGBE_VF_API_NEGOTIATE;
 	msg[1] = api;
 	msg[2] = 0;
-	err = hw->mbx.ops.write_posted(hw, msg, 3, 0);
-
-	if (!err)
-		err = hw->mbx.ops.read_posted(hw, msg, 3, 0);
 
+	err = ixgbevf_write_msg_read_ack(hw, msg, msg, 3);
 	if (!err) {
 		msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
@@ -739,11 +722,8 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
 	/* Fetch queue configuration from the PF */
 	msg[0] = IXGBE_VF_GET_QUEUES;
 	msg[1] = msg[2] = msg[3] = msg[4] = 0;
-	err = hw->mbx.ops.write_posted(hw, msg, 5, 0);
-
-	if (!err)
-		err = hw->mbx.ops.read_posted(hw, msg, 5, 0);
 
+	err = ixgbevf_write_msg_read_ack(hw, msg, msg, 5);
 	if (!err) {
 		msg[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 28/40] net/ixgbe/base: reduce delay for SWFW semaphore
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (26 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 27/40] net/ixgbe/base: commonize mailbox write and read Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 29/40] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
                       ` (12 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch reduces the SWFW semaphore/PHY Token retry delay.

ixgbe_release_swfw_sync_X540: Reduce 5 ms delay after releasing
semaphore to 2 ms. HW team indicated 1 ms delay would be sufficient
for FW access.

ixgbe_acquire_swfw_sync_X540: Remove 5 ms delay after acquiring
semaphore.

ixgbe_acquire_swfw_sync_X550a: Remove 5 ms delay since there are
two 2 ms delays in the semaphore release flow.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed the unrelated blank line change from this patch.

---
 drivers/net/ixgbe/base/ixgbe_x540.c | 3 +--
 drivers/net/ixgbe/base/ixgbe_x550.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x540.c b/drivers/net/ixgbe/base/ixgbe_x540.c
index 24e9c93..c58f36a 100644
--- a/drivers/net/ixgbe/base/ixgbe_x540.c
+++ b/drivers/net/ixgbe/base/ixgbe_x540.c
@@ -783,7 +783,6 @@ s32 ixgbe_acquire_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
 			IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw),
 					swfw_sync);
 			ixgbe_release_swfw_sync_semaphore(hw);
-			msec_delay(5);
 			return IXGBE_SUCCESS;
 		}
 		/* Firmware currently using resource (fwmask), hardware
@@ -860,7 +859,7 @@ void ixgbe_release_swfw_sync_X540(struct ixgbe_hw *hw, u32 mask)
 	IXGBE_WRITE_REG(hw, IXGBE_SWFW_SYNC_BY_MAC(hw), swfw_sync);
 
 	ixgbe_release_swfw_sync_semaphore(hw);
-	msec_delay(5);
+	msec_delay(2);
 }
 
 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 32759cc..f2e885c 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -4523,7 +4523,6 @@ STATIC s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask)
 			ixgbe_release_swfw_sync_X540(hw, hmask);
 		if (status != IXGBE_ERR_TOKEN_RETRY)
 			return status;
-		msec_delay(FW_PHY_TOKEN_DELAY);
 	}
 
 	return status;
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 29/40] net/ixgbe/base: report autoneg supported for X550
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (27 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 28/40] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 30/40] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
                       ` (11 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Make sure ixgbe_device_supports_autoneg_fc() returns true for the device
IDs of X550EM_A_1G_T and X550EM_A_1G_T_L.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed some internal device names in commit log.

---
 drivers/net/ixgbe/base/ixgbe_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 985fece..4c95f81 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -189,6 +189,8 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 		case IXGBE_DEV_ID_X550T1:
 		case IXGBE_DEV_ID_X550EM_X_10G_T:
 		case IXGBE_DEV_ID_X550EM_A_10G_T:
+		case IXGBE_DEV_ID_X550EM_A_1G_T:
+		case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 			supported = true;
 			break;
 		default:
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 30/40] net/ixgbe/base: remove X550em_a 100Mbps support
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (28 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 29/40] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 31/40] net/ixgbe/base: unify link speed value Xiao Wang
                       ` (10 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

X550em_a only supports 10G/1G link.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_phy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c
index ee8618f..43c55d7 100644
--- a/drivers/net/ixgbe/base/ixgbe_phy.c
+++ b/drivers/net/ixgbe/base/ixgbe_phy.c
@@ -944,6 +944,7 @@ static s32 ixgbe_get_copper_speeds_supported(struct ixgbe_hw *hw)
 		hw->phy.speeds_supported |= IXGBE_LINK_SPEED_5GB_FULL;
 		break;
 	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
 		hw->phy.speeds_supported &= ~IXGBE_LINK_SPEED_100_FULL;
 		break;
 	default:
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 31/40] net/ixgbe/base: unify link speed value
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (29 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 30/40] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 32/40] net/ixgbe/base: separate ops init from PHY init Xiao Wang
                       ` (9 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch changes the value of IXGBE_LINK_SPEED_10_FULL from 4 to 2,
as 4 is reserved to 100Mbit Half Duplex in E1000 shared code.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index f1e4274..a3cc5e2 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3319,7 +3319,7 @@ typedef u32 ixgbe_autoneg_advertised;
 /* Link speed */
 typedef u32 ixgbe_link_speed;
 #define IXGBE_LINK_SPEED_UNKNOWN	0
-#define IXGBE_LINK_SPEED_10_FULL	0x0004
+#define IXGBE_LINK_SPEED_10_FULL	0x0002
 #define IXGBE_LINK_SPEED_100_FULL	0x0008
 #define IXGBE_LINK_SPEED_1GB_FULL	0x0020
 #define IXGBE_LINK_SPEED_2_5GB_FULL	0x0400
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 32/40] net/ixgbe/base: separate ops init from PHY init
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (30 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 31/40] net/ixgbe/base: unify link speed value Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 33/40] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
                       ` (8 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch moves PHY ops pointers initialization to
ixgbe_init_phy_ops_X550em and PHY identifying/initializing
to ixgbe_identify_phy_x550em.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_x550.c | 39 ++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index f2e885c..19a554d 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
 STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed);
 STATIC s32 ixgbe_acquire_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
 STATIC void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *, u32 mask);
+STATIC s32 ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw);
 
 /**
  *  ixgbe_init_ops_X550 - Inits func ptrs and MAC type
@@ -428,18 +429,15 @@ STATIC s32 ixgbe_write_phy_reg_mdi_22(struct ixgbe_hw *hw, u32 reg_addr,
  */
 STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 {
+	hw->mac.ops.set_lan_id(hw);
+
+	ixgbe_read_mng_if_sel_x550em(hw);
+
 	switch (hw->device_id) {
 	case IXGBE_DEV_ID_X550EM_A_SFP:
-		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
-		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
-		if (hw->bus.lan_id)
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
-		else
-			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
 		return ixgbe_identify_module_generic(hw);
 	case IXGBE_DEV_ID_X550EM_X_SFP:
 		/* set up for CS4227 usage */
-		hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
 		ixgbe_setup_mux_ctl(hw);
 		ixgbe_check_cs4227(hw);
 		/* Fallthrough */
@@ -456,9 +454,6 @@ STATIC s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw)
 		hw->phy.type = ixgbe_phy_x550em_kr;
 		break;
 	case IXGBE_DEV_ID_X550EM_A_10G_T:
-		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
-		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
-       /* Fallthrough to ixgbe_identify_phy_generic */
 	case IXGBE_DEV_ID_X550EM_A_1G_T:
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 	case IXGBE_DEV_ID_X550EM_X_1G_T:
@@ -2339,10 +2334,6 @@ 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);
@@ -2354,6 +2345,26 @@ s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_1G_T_L:
 		phy->ops.read_reg_mdi = ixgbe_read_phy_reg_mdi_22;
 		phy->ops.write_reg_mdi = ixgbe_write_phy_reg_mdi_22;
+		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
+		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
+		if (hw->bus.lan_id)
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
+		else
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
+
+		break;
+	case IXGBE_DEV_ID_X550EM_A_10G_T:
+	case IXGBE_DEV_ID_X550EM_A_SFP:
+		hw->phy.ops.read_reg = ixgbe_read_phy_reg_x550a;
+		hw->phy.ops.write_reg = ixgbe_write_phy_reg_x550a;
+		if (hw->bus.lan_id)
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY1_SM;
+		else
+			hw->phy.phy_semaphore_mask |= IXGBE_GSSR_PHY0_SM;
+		break;
+	case IXGBE_DEV_ID_X550EM_X_SFP:
+		/* set up for CS4227 usage */
+		hw->phy.phy_semaphore_mask = IXGBE_GSSR_SHARED_I2C_SM;
 		break;
 	default:
 		break;
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 33/40] net/ixgbe/base: add X550em_a FW ALEF support
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (31 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 32/40] net/ixgbe/base: separate ops init from PHY init Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 34/40] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
                       ` (7 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch adds X550em_a FW ALEF support. ALEF is the new unified FW.
The driver uses the KRM_PMD_RX_FLEX_PORT/FLX_MASK_ST20 registers to
configure the lane mode.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed the term that's only used internally in the commit log.

---
 drivers/net/ixgbe/base/ixgbe_type.h |  16 +++
 drivers/net/ixgbe/base/ixgbe_x550.c | 223 ++++++++++++++++++++++++++----------
 2 files changed, 180 insertions(+), 59 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index a3cc5e2..92c3e24 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4162,9 +4162,25 @@ struct ixgbe_hw {
 #define IXGBE_KRM_DSP_TXFFE_STATE_5(P)	((P) ? 0x8638 : 0x4638)
 #define IXGBE_KRM_RX_TRN_LINKUP_CTRL(P)	((P) ? 0x8B00 : 0x4B00)
 #define IXGBE_KRM_PMD_DFX_BURNIN(P)	((P) ? 0x8E00 : 0x4E00)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20(P)	((P) ? 0x9054 : 0x5054)
 #define IXGBE_KRM_TX_COEFF_CTRL_1(P)	((P) ? 0x9520 : 0x5520)
 #define IXGBE_KRM_RX_ANA_CTL(P)		((P) ? 0x9A00 : 0x5A00)
 
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA		~(0x3 << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR		(1u << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_LR		(0x2 << 20)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN		(1u << 25)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN		(1u << 26)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN		(1u << 27)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10M		~(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_100M		(1u << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G		(0x2 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10G		(0x3 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN		(0x4 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_2_5G		(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK		(0x7 << 28)
+#define IXGBE_KRM_PMD_FLX_MASK_ST20_FW_AN_RESTART	(1u << 31)
+
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B		(1 << 9)
 #define IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS		(1 << 11)
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 19a554d..0cc7a3f 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1607,6 +1607,53 @@ s32 ixgbe_setup_sfp_modules_X550em(struct ixgbe_hw *hw)
 }
 
 /**
+*  ixgbe_restart_an_internal_phy_x550em - restart autonegotiation for the
+*  internal PHY
+*  @hw: pointer to hardware structure
+**/
+STATIC s32 ixgbe_restart_an_internal_phy_x550em(struct ixgbe_hw *hw)
+{
+	s32 status;
+	u32 link_ctrl;
+
+	/* Restart auto-negotiation. */
+	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_ctrl);
+
+	if (status) {
+		DEBUGOUT("Auto-negotiation did not complete\n");
+		return status;
+	}
+
+	link_ctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	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_ctrl);
+
+	if (hw->mac.type == ixgbe_mac_X550EM_a) {
+		u32 flx_mask_st20;
+
+		/* Indicate to FW that AN restart has been asserted */
+		status = hw->mac.ops.read_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &flx_mask_st20);
+
+		if (status) {
+			DEBUGOUT("Auto-negotiation did not complete\n");
+			return status;
+		}
+
+		flx_mask_st20 |= IXGBE_KRM_PMD_FLX_MASK_ST20_FW_AN_RESTART;
+		status = hw->mac.ops.write_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, flx_mask_st20);
+	}
+
+	return status;
+}
+
+/**
  * ixgbe_setup_sgmii - Set up link for sgmii
  * @hw: pointer to hardware structure
  */
@@ -1614,7 +1661,7 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 			     bool autoneg_wait)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
-	u32 lval, sval;
+	u32 lval, sval, flx_val;
 	s32 rc;
 
 	rc = mac->ops.read_iosf_sb_reg(hw,
@@ -1648,10 +1695,25 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	if (rc)
 		return rc;
 
-	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, &flx_val);
+	if (rc)
+		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_AN_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+
 	rc = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, flx_val);
+	if (rc)
+		return rc;
+
+	rc = ixgbe_restart_an_internal_phy_x550em(hw);
 	if (rc)
 		return rc;
 
@@ -1666,7 +1728,7 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 				 bool autoneg_wait)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
-	u32 lval, sval;
+	u32 lval, sval, flx_val;
 	s32 rc;
 
 	rc = mac->ops.read_iosf_sb_reg(hw,
@@ -1700,13 +1762,32 @@ STATIC s32 ixgbe_setup_sgmii_m88(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	if (rc)
 		return rc;
 
-	lval |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
 	rc = mac->ops.write_iosf_sb_reg(hw,
 					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 					IXGBE_SB_IOSF_TARGET_KR_PHY, lval);
 	if (rc)
 		return rc;
 
+	rc = mac->ops.read_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, &flx_val);
+	if (rc)
+		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_AN_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+	flx_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+
+	rc = mac->ops.write_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, flx_val);
+	if (rc)
+		return rc;
+
+	rc = ixgbe_restart_an_internal_phy_x550em(hw);
+
 	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
 }
 
@@ -2024,13 +2105,24 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 	if (speed & IXGBE_LINK_SPEED_1GB_FULL)
 		reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KX;
 
-	/* Restart auto-negotiation. */
-	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
 		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
-	return status;
+	if (status)
+		return status;
+
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
+	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
+	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+
+	status = hw->mac.ops.write_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+
+	return ixgbe_restart_an_internal_phy_x550em(hw);
 }
 
 /**
@@ -2662,6 +2754,55 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 }
 
 /**
+ *  ixgbe_setup_sfi_x550a - Configure the internal PHY for native SFI mode
+ *  @hw: pointer to hardware structure
+ *  @speed: the link speed to force
+ *
+ *  Configures the integrated PHY for native SFI mode. Used to connect the
+ *  internal PHY directly to an SFP cage, without autonegotiation.
+ **/
+STATIC s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 status;
+	u32 reg_val;
+
+	/* Disable all AN and force speed to 10G Serial. */
+	status = mac->ops.read_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+	if (status != IXGBE_SUCCESS)
+		return status;
+
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
+
+	/* Select forced link speed for internal PHY. */
+	switch (*speed) {
+	case IXGBE_LINK_SPEED_10GB_FULL:
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_10G;
+		break;
+	case IXGBE_LINK_SPEED_1GB_FULL:
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_1G;
+		break;
+	default:
+		/* Other link speeds are not supported by internal PHY. */
+		return IXGBE_ERR_LINK_SETUP;
+	}
+
+	status = mac->ops.write_iosf_sb_reg(hw,
+				IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+
+	/* Toggle port SW reset by AN reset. */
+	status = ixgbe_restart_an_internal_phy_x550em(hw);
+
+	return status;
+}
+
+/**
  *  ixgbe_setup_mac_link_sfp_x550a - Setup internal PHY for SFP
  *  @hw: pointer to hardware structure
  *
@@ -2691,31 +2832,27 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 		return ret_val;
 
 	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP_N) {
-		/* Configure internal PHY for native SFI */
+		/* Configure internal PHY for native SFI based on module type */
 		ret_val = hw->mac.ops.read_iosf_sb_reg(hw,
-			       IXGBE_KRM_AN_CNTL_8(hw->bus.lan_id),
-			       IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_phy_int);
+				   IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				   IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_phy_int);
 
 		if (ret_val != IXGBE_SUCCESS)
 			return ret_val;
 
-		if (setup_linear) {
-			reg_phy_int &= ~IXGBE_KRM_AN_CNTL_8_LIMITING;
-			reg_phy_int |= IXGBE_KRM_AN_CNTL_8_LINEAR;
-		} else {
-			reg_phy_int |= IXGBE_KRM_AN_CNTL_8_LIMITING;
-			reg_phy_int &= ~IXGBE_KRM_AN_CNTL_8_LINEAR;
-		}
+		reg_phy_int &= IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA;
+		if (!setup_linear)
+			reg_phy_int |= IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR;
 
 		ret_val = hw->mac.ops.write_iosf_sb_reg(hw,
-				IXGBE_KRM_AN_CNTL_8(hw->bus.lan_id),
-				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_phy_int);
+				   IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				   IXGBE_SB_IOSF_TARGET_KR_PHY, reg_phy_int);
 
 		if (ret_val != IXGBE_SUCCESS)
 			return ret_val;
 
-		/* Setup XFI/SFI internal link. */
-		ret_val = ixgbe_setup_ixfi_x550em(hw, &speed);
+		/* Setup SFI internal link. */
+		ret_val = ixgbe_setup_sfi_x550a(hw, &speed);
 	} else {
 		/* Configure internal PHY for KR/KX. */
 		ixgbe_setup_kr_speed_x550em(hw, speed);
@@ -2874,15 +3011,7 @@ STATIC s32 ixgbe_setup_ixfi_x550em(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
 	}
 
 	/* Toggle port SW reset by AN reset. */
-	status = mac->ops.read_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
-	if (status != IXGBE_SUCCESS)
-		return status;
-	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	status = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+	status = ixgbe_restart_an_internal_phy_x550em(hw);
 
 	return status;
 }
@@ -4225,7 +4354,7 @@ out:
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 {
 	s32 status = IXGBE_SUCCESS;
-	u32 an_cntl, link_ctrl = 0;
+	u32 an_cntl = 0;
 
 	DEBUGFUNC("ixgbe_setup_fc_backplane_x550em_a");
 
@@ -4299,19 +4428,7 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 				       IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
 
 	/* Restart auto-negotiation. */
-	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_ctrl);
-
-	if (status != IXGBE_SUCCESS) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		return status;
-	}
-
-	link_ctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	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_ctrl);
+	status = ixgbe_restart_an_internal_phy_x550em(hw);
 
 	return status;
 }
@@ -4425,19 +4542,7 @@ s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw)
 					   IXGBE_SB_IOSF_TARGET_KR_PHY, pcs_an);
 
 	/* Restart auto-negotiation. */
-	rc = hw->mac.ops.read_iosf_sb_reg(hw,
-					  IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					  IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
-
-	if (rc) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		return rc;
-	}
-
-	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
-	rc = hw->mac.ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
+	rc = ixgbe_restart_an_internal_phy_x550em(hw);
 
 	return rc;
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 34/40] net/ixgbe/base: add two MAC ops for Hyper-V
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (32 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 33/40] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 35/40] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
                       ` (6 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

This patch adds negotiate_api_version and set_rlpml into mac_ops, with the
introduction of Hyper-V functionality, we can have separate functions to
accommodate different implementations without breaking the other.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h | 2 ++
 drivers/net/ixgbe/base/ixgbe_vf.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 92c3e24..13c520e 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -3854,6 +3854,7 @@ struct ixgbe_mac_operations {
 	void (*init_swfw_sync)(struct ixgbe_hw *);
 	s32 (*prot_autoc_read)(struct ixgbe_hw *, bool *, u32 *);
 	s32 (*prot_autoc_write)(struct ixgbe_hw *, u32, bool);
+	s32 (*negotiate_api_version)(struct ixgbe_hw *hw, int api);
 
 	/* Link */
 	void (*disable_tx_laser)(struct ixgbe_hw *);
@@ -3898,6 +3899,7 @@ struct ixgbe_mac_operations {
 	void (*set_mac_anti_spoofing)(struct ixgbe_hw *, bool, int);
 	void (*set_vlan_anti_spoofing)(struct ixgbe_hw *, bool, int);
 	s32 (*update_xcast_mode)(struct ixgbe_hw *, int);
+	s32 (*set_rlpml)(struct ixgbe_hw *, u16);
 
 	/* Flow Control */
 	s32 (*fc_enable)(struct ixgbe_hw *);
diff --git a/drivers/net/ixgbe/base/ixgbe_vf.c b/drivers/net/ixgbe/base/ixgbe_vf.c
index 919b975..e9c13f2 100644
--- a/drivers/net/ixgbe/base/ixgbe_vf.c
+++ b/drivers/net/ixgbe/base/ixgbe_vf.c
@@ -64,6 +64,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	hw->mac.ops.get_mac_addr = ixgbe_get_mac_addr_vf;
 	hw->mac.ops.stop_adapter = ixgbe_stop_adapter_vf;
 	hw->mac.ops.get_bus_info = NULL;
+	hw->mac.ops.negotiate_api_version = ixgbevf_negotiate_api_version;
 
 	/* Link */
 	hw->mac.ops.setup_link = ixgbe_setup_mac_link_vf;
@@ -80,6 +81,7 @@ s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw)
 	hw->mac.ops.disable_mc = NULL;
 	hw->mac.ops.clear_vfta = NULL;
 	hw->mac.ops.set_vfta = ixgbe_set_vfta_vf;
+	hw->mac.ops.set_rlpml = ixgbevf_rlpml_set_vf;
 
 	hw->mac.max_tx_queues = 1;
 	hw->mac.max_rx_queues = 1;
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 35/40] net/ixgbe/base: hold semaphore for shadow RAM access
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (33 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 34/40] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 36/40] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
                       ` (5 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

The semaphore is not being held for complete shadow RAM accesses
which could result in corruption. Refactor the code so that it is
possible to hold the semaphore around ixgbe_host_interface_command
by introducing an unlocked form. This patch also eliminates the
function ixgbe_read_ee_hostif_data_X550 in favor of the function
ixgbe_read_ee_hostif_X550 and it now gets both semaphore bits
at once instead of nesting them. The new arrangement is able to
get both the management interface and the EEPROM semaphores at the
same time instead of separately.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed some whitespace changes to make this patch clean. All minor
      cleanups were put into 39/40 patch.

---
 drivers/net/ixgbe/base/ixgbe_common.c | 95 +++++++++++++++++++++++------------
 drivers/net/ixgbe/base/ixgbe_common.h |  1 +
 drivers/net/ixgbe/base/ixgbe_x550.c   | 57 ++++++---------------
 drivers/net/ixgbe/base/ixgbe_x550.h   |  2 -
 4 files changed, 80 insertions(+), 75 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 4c95f81..0eb2166 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -4413,43 +4413,31 @@ u8 ixgbe_calculate_checksum(u8 *buffer, u32 length)
 }
 
 /**
- *  ixgbe_host_interface_command - Issue command to manageability block
+ *  ixgbe_hic_unlocked - Issue command to manageability block unlocked
  *  @hw: pointer to the HW structure
- *  @buffer: contains the command to write and where the return status will
- *   be placed
+ *  @buffer: command to write and where the return status will be placed
  *  @length: length of buffer, must be multiple of 4 bytes
  *  @timeout: time in ms to wait for command completion
- *  @return_data: read and return data from the buffer (true) or not (false)
- *   Needed because FW structures are big endian and decoding of
- *   these fields can be 8 bit or 16 bit based on command. Decoding
- *   is not easily understood without making a table of commands.
- *   So we will leave this up to the caller to read back the data
- *   in these cases.
  *
  *  Communicates with the manageability block. On success return IXGBE_SUCCESS
  *  else returns semaphore error when encountering an error acquiring
  *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
+ *
+ *  This function assumes that the IXGBE_GSSR_SW_MNG_SM semaphore is held
+ *  by the caller.
  **/
-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 *hw, u32 *buffer, u32 length,
+		       u32 timeout)
 {
-	u32 hicr, i, bi, fwsts;
-	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
-	u16 buf_len;
+	u32 hicr, i, fwsts;
 	u16 dword_len;
-	s32 status;
 
-	DEBUGFUNC("ixgbe_host_interface_command");
+	DEBUGFUNC("ixgbe_hic_unlocked");
 
-	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
+	if (!length || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
 		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
 		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
 	}
-	/* Take management host interface semaphore */
-	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
-
-	if (status)
-		return status;
 
 	/* Set bit 9 of FWSTS clearing FW reset indication */
 	fwsts = IXGBE_READ_REG(hw, IXGBE_FWSTS);
@@ -4457,17 +4445,15 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 
 	/* Check that the host interface is enabled. */
 	hicr = IXGBE_READ_REG(hw, IXGBE_HICR);
-	if ((hicr & IXGBE_HICR_EN) == 0) {
+	if (!(hicr & IXGBE_HICR_EN)) {
 		DEBUGOUT("IXGBE_HOST_EN bit disabled.\n");
-		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
-		goto rel_out;
+		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
 	}
 
 	/* Calculate length in DWORDs. We must be DWORD aligned */
-	if ((length % (sizeof(u32))) != 0) {
+	if (length % sizeof(u32)) {
 		DEBUGOUT("Buffer length failure, not aligned to dword");
-		status = IXGBE_ERR_INVALID_ARGUMENT;
-		goto rel_out;
+		return IXGBE_ERR_INVALID_ARGUMENT;
 	}
 
 	dword_len = length >> 2;
@@ -4490,14 +4476,59 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 	}
 
 	/* Check command completion */
-	if ((timeout != 0 && i == timeout) ||
+	if ((timeout && i == timeout) ||
 	    !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) {
 		ERROR_REPORT1(IXGBE_ERROR_CAUTION,
 			     "Command has failed with no status valid.\n");
-		status = IXGBE_ERR_HOST_INTERFACE_COMMAND;
-		goto rel_out;
+		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
 	}
 
+	return IXGBE_SUCCESS;
+}
+
+/**
+ *  ixgbe_host_interface_command - Issue command to manageability block
+ *  @hw: pointer to the HW structure
+ *  @buffer: contains the command to write and where the return status will
+ *   be placed
+ *  @length: length of buffer, must be multiple of 4 bytes
+ *  @timeout: time in ms to wait for command completion
+ *  @return_data: read and return data from the buffer (true) or not (false)
+ *   Needed because FW structures are big endian and decoding of
+ *   these fields can be 8 bit or 16 bit based on command. Decoding
+ *   is not easily understood without making a table of commands.
+ *   So we will leave this up to the caller to read back the data
+ *   in these cases.
+ *
+ *  Communicates with the manageability block. On success return IXGBE_SUCCESS
+ *  else returns semaphore error when encountering an error acquiring
+ *  semaphore or IXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
+ **/
+s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
+				 u32 length, u32 timeout, bool return_data)
+{
+	u32 hdr_size = sizeof(struct ixgbe_hic_hdr);
+	u16 dword_len;
+	u16 buf_len;
+	s32 status;
+	u32 bi;
+
+	DEBUGFUNC("ixgbe_host_interface_command");
+
+	if (length == 0 || length > IXGBE_HI_MAX_BLOCK_BYTE_LENGTH) {
+		DEBUGOUT1("Buffer length failure buffersize=%d.\n", length);
+		return IXGBE_ERR_HOST_INTERFACE_COMMAND;
+	}
+
+	/* Take management host interface semaphore */
+	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM);
+	if (status)
+		return status;
+
+	status = ixgbe_hic_unlocked(hw, buffer, length, timeout);
+	if (status)
+		goto rel_out;
+
 	if (!return_data)
 		goto rel_out;
 
@@ -4512,7 +4543,7 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer,
 
 	/* If there is any thing in data position pull it in */
 	buf_len = ((struct ixgbe_hic_hdr *)buffer)->buf_len;
-	if (buf_len == 0)
+	if (!buf_len)
 		goto rel_out;
 
 	if (length < buf_len + hdr_size) {
diff --git a/drivers/net/ixgbe/base/ixgbe_common.h b/drivers/net/ixgbe/base/ixgbe_common.h
index 0545f85..cd04237 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.h
+++ b/drivers/net/ixgbe/base/ixgbe_common.h
@@ -159,6 +159,7 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
 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);
 
 void ixgbe_clear_tx_pending(struct ixgbe_hw *hw);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 0cc7a3f..6f4dfd9 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -3192,13 +3192,13 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
  *
  *  Reads a 16 bit word from the EEPROM using the hostif.
  **/
-s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
-				   u16 *data)
+s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data)
 {
-	s32 status;
+	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
 	struct ixgbe_hic_read_shadow_ram buffer;
+	s32 status;
 
-	DEBUGFUNC("ixgbe_read_ee_hostif_data_X550");
+	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
 	buffer.hdr.req.cmd = FW_READ_SHADOW_RAM_CMD;
 	buffer.hdr.req.buf_lenh = 0;
 	buffer.hdr.req.buf_lenl = FW_READ_SHADOW_RAM_LEN;
@@ -3209,42 +3209,18 @@ s32 ixgbe_read_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset,
 	/* one word */
 	buffer.length = IXGBE_CPU_TO_BE16(sizeof(u16));
 
-	status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
-					      sizeof(buffer),
-					      IXGBE_HI_COMMAND_TIMEOUT, false);
-
+	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (status)
 		return status;
 
-	*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
-					  FW_NVM_DATA_OFFSET);
-
-	return 0;
-}
-
-/**
- *  ixgbe_read_ee_hostif_X550 - Read EEPROM word using a host interface command
- *  @hw: pointer to hardware structure
- *  @offset: offset of  word in the EEPROM to read
- *  @data: word read from the EEPROM
- *
- *  Reads a 16 bit word from the EEPROM using the hostif.
- **/
-s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
-			      u16 *data)
-{
-	s32 status = IXGBE_SUCCESS;
-
-	DEBUGFUNC("ixgbe_read_ee_hostif_X550");
-
-	if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM) ==
-	    IXGBE_SUCCESS) {
-		status = ixgbe_read_ee_hostif_data_X550(hw, offset, data);
-		hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
-	} else {
-		status = IXGBE_ERR_SWFW_SYNC;
+	status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
+				    IXGBE_HI_COMMAND_TIMEOUT);
+	if (!status) {
+		*data = (u16)IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG,
+						  FW_NVM_DATA_OFFSET);
 	}
 
+	hw->mac.ops.release_swfw_sync(hw, mask);
 	return status;
 }
 
@@ -3260,6 +3236,7 @@ s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
 s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 				     u16 offset, u16 words, u16 *data)
 {
+	const u32 mask = IXGBE_GSSR_SW_MNG_SM | IXGBE_GSSR_EEP_SM;
 	struct ixgbe_hic_read_shadow_ram buffer;
 	u32 current_word = 0;
 	u16 words_to_read;
@@ -3269,7 +3246,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 	DEBUGFUNC("ixgbe_read_ee_hostif_buffer_X550");
 
 	/* Take semaphore for the entire operation. */
-	status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
+	status = hw->mac.ops.acquire_swfw_sync(hw, mask);
 	if (status) {
 		DEBUGOUT("EEPROM read buffer - semaphore failed\n");
 		return status;
@@ -3289,10 +3266,8 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 		buffer.address = IXGBE_CPU_TO_BE32((offset + current_word) * 2);
 		buffer.length = IXGBE_CPU_TO_BE16(words_to_read * 2);
 
-		status = ixgbe_host_interface_command(hw, (u32 *)&buffer,
-						      sizeof(buffer),
-						      IXGBE_HI_COMMAND_TIMEOUT,
-						      false);
+		status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
+					    IXGBE_HI_COMMAND_TIMEOUT);
 
 		if (status) {
 			DEBUGOUT("Host interface command failed\n");
@@ -3317,7 +3292,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 	}
 
 out:
-	hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
+	hw->mac.ops.release_swfw_sync(hw, mask);
 	return status;
 }
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index c7253f0..36b36f6 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -55,8 +55,6 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 				     u16 offset, u16 words, u16 *data);
 s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset,
 u16				*data);
-s32 ixgbe_read_ee_hostif_data_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);
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 36/40] net/ixgbe/base: update X550em_a backplane speed
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (34 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 35/40] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 37/40] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
                       ` (4 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Correct link flow for X550em_a backplane with ALEF.

Report the correct link capabilities:
   SKUs configured for 2.5G only support 2.5G.
   non-10G SKUs can only support 2.5 or 1G.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_type.h |  5 +++++
 drivers/net/ixgbe/base/ixgbe_x550.c | 37 +++++++++++++++++++++++++++++--------
 2 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h
index 13c520e..4982e03 100644
--- a/drivers/net/ixgbe/base/ixgbe_type.h
+++ b/drivers/net/ixgbe/base/ixgbe_type.h
@@ -4252,6 +4252,11 @@ struct ixgbe_hw {
 #define IXGBE_NW_MNG_IF_SEL_MDIO_ACT	(1u << 1)
 #define IXGBE_NW_MNG_IF_SEL_MDIO_IF_MODE	(1u << 2)
 #define IXGBE_NW_MNG_IF_SEL_EN_SHARED_MDIO	(1u << 13)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_10M	(1u << 17)
+#define IXGBE_NW_MNG_IF_SEL_PHY_SPEED_100M	(1u << 18)
+#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_MDIO_PHY_ADD_SHIFT 3
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 6f4dfd9..8c2479b 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -1887,6 +1887,20 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 		case ixgbe_phy_sgmii:
 			*speed = IXGBE_LINK_SPEED_1GB_FULL;
 			break;
+		case ixgbe_phy_x550em_kr:
+			if (hw->mac.type == ixgbe_mac_X550EM_a) {
+				/* check different backplane modes */
+				if (hw->phy.nw_mng_if_sel &
+					   IXGBE_NW_MNG_IF_SEL_PHY_SPEED_2_5G) {
+					*speed = IXGBE_LINK_SPEED_2_5GB_FULL;
+					break;
+				} else if (hw->device_id ==
+						   IXGBE_DEV_ID_X550EM_A_KR_L) {
+					*speed = IXGBE_LINK_SPEED_1GB_FULL;
+					break;
+				}
+			}
+			/* fall through */
 		default:
 			*speed = IXGBE_LINK_SPEED_10GB_FULL |
 				 IXGBE_LINK_SPEED_1GB_FULL;
@@ -2109,18 +2123,25 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
 		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
-	if (status)
-		return status;
+	if (hw->mac.type == ixgbe_mac_X550EM_a) {
+		/* Set lane mode  to KR auto negotiation */
+		status = hw->mac.ops.read_iosf_sb_reg(hw,
+				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+				    IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 
-	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
-	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
-	reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
-	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
-	reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+		if (status)
+			return status;
 
-	status = hw->mac.ops.write_iosf_sb_reg(hw,
+		reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_MASK;
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_SPEED_AN;
+		reg_val |= IXGBE_KRM_PMD_FLX_MASK_ST20_AN_EN;
+		reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_AN37_EN;
+		reg_val &= ~IXGBE_KRM_PMD_FLX_MASK_ST20_SGMII_EN;
+
+		status = hw->mac.ops.write_iosf_sb_reg(hw,
 				    IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
 				    IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+	}
 
 	return ixgbe_restart_an_internal_phy_x550em(hw);
 }
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 37/40] net/ixgbe/base: clean code of flow control autoneg
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (35 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 36/40] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 38/40] net/ixgbe/base: do not skip PHY configuration Xiao Wang
                       ` (3 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Support for flow control auto negotiation is defeatured from X550em_a
fiber when connected to speeds lower than 10Gbps. This patch cleans up
the code path which is mostly dead to begin with.

- add device IDs check in ixgbe_device_supports_autoneg_fc().
- ixgbe_fc_autoneg_fiber_x550em_a() is now used only to pass the user
  settings to ixgbe_fc_enable_generic().
- make sure that start_hw does not fail when setup_fc is not implemented.
- small fix in the debug message when ixgbe_device_supports_autoneg_fc()
  returns false.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Removed the unrelated minor modifications from this patch.

---
 drivers/net/ixgbe/base/ixgbe_common.c |  37 ++++---
 drivers/net/ixgbe/base/ixgbe_x550.c   | 188 +---------------------------------
 2 files changed, 28 insertions(+), 197 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 0eb2166..e0dc3b5 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -168,13 +168,24 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 	switch (hw->phy.media_type) {
 	case ixgbe_media_type_fiber_qsfp:
 	case ixgbe_media_type_fiber:
-		hw->mac.ops.check_link(hw, &speed, &link_up, false);
-		/* if link is down, assume supported */
-		if (link_up)
-			supported = speed == IXGBE_LINK_SPEED_1GB_FULL ?
+		/* flow control autoneg black list */
+		switch (hw->device_id) {
+		case IXGBE_DEV_ID_X550EM_A_SFP:
+		case IXGBE_DEV_ID_X550EM_A_SFP_N:
+		case IXGBE_DEV_ID_X550EM_A_QSFP:
+		case IXGBE_DEV_ID_X550EM_A_QSFP_N:
+			supported = false;
+			break;
+		default:
+			hw->mac.ops.check_link(hw, &speed, &link_up, false);
+			/* if link is down, assume supported */
+			if (link_up)
+				supported = speed == IXGBE_LINK_SPEED_1GB_FULL ?
 				true : false;
-		else
-			supported = true;
+			else
+				supported = true;
+		}
+
 		break;
 	case ixgbe_media_type_backplane:
 		supported = true;
@@ -200,9 +211,10 @@ bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
 		break;
 	}
 
-	ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
-		      "Device %x does not support flow control autoneg",
-		      hw->device_id);
+	if (!supported)
+		ERROR_REPORT2(IXGBE_ERROR_UNSUPPORTED,
+			      "Device %x does not support flow control autoneg",
+			      hw->device_id);
 	return supported;
 }
 
@@ -397,8 +409,8 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 
 	/* Setup flow control */
 	ret_val = ixgbe_setup_fc(hw);
-	if (ret_val != IXGBE_SUCCESS)
-		goto out;
+	if (ret_val != IXGBE_SUCCESS && ret_val != IXGBE_NOT_IMPLEMENTED)
+		return ret_val;
 
 	/* Cache bit indicating need for crosstalk fix */
 	switch (hw->mac.type) {
@@ -419,8 +431,7 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
 	/* Clear adapter stopped flag */
 	hw->adapter_stopped = false;
 
-out:
-	return ret_val;
+	return IXGBE_SUCCESS;
 }
 
 /**
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 8c2479b..f15449c 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -660,7 +660,7 @@ s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
 
 	switch (mac->ops.get_media_type(hw)) {
 	case ixgbe_media_type_fiber:
-		mac->ops.setup_fc = ixgbe_setup_fc_fiber_x550em_a;
+		mac->ops.setup_fc = NULL;
 		mac->ops.fc_autoneg = ixgbe_fc_autoneg_fiber_x550em_a;
 		break;
 	case ixgbe_media_type_backplane:
@@ -4119,80 +4119,14 @@ out:
 }
 
 /**
- *  ixgbe_fc_autoneg_fiber_x550em_a - Enable flow control IEEE clause 37
+ *  ixgbe_fc_autoneg_fiber_x550em_a - passthrough FC settings
  *  @hw: pointer to hardware structure
  *
- *  Enable flow control according to IEEE clause 37.
  **/
 void ixgbe_fc_autoneg_fiber_x550em_a(struct ixgbe_hw *hw)
 {
-	u32 link_s1, pcs_an_lp, pcs_an;
-	s32 status = IXGBE_ERR_FC_NOT_NEGOTIATED;
-	ixgbe_link_speed speed;
-	bool link_up;
-
-	/* AN should have completed when the cable was plugged in.
-	 * Look for reasons to bail out.  Bail out if:
-	 * - FC autoneg is disabled, or if
-	 * - link is not up.
-	 */
-	if (hw->fc.disable_fc_autoneg) {
-		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-			     "Flow control autoneg is disabled");
-		goto out;
-	}
-
-	hw->mac.ops.check_link(hw, &speed, &link_up, false);
-	if (!link_up) {
-		ERROR_REPORT1(IXGBE_ERROR_SOFTWARE, "The link is down");
-		goto out;
-	}
-
-	/* Check if auto-negotiation has completed */
-	status = hw->mac.ops.read_iosf_sb_reg(hw,
-					 IXGBE_KRM_LINK_S1(hw->bus.lan_id),
-					 IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
-
-	if (status != IXGBE_SUCCESS ||
-	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		status = IXGBE_ERR_FC_NOT_NEGOTIATED;
-		goto out;
-	}
-
-	/* Determine advertised flow control */
-	status = hw->mac.ops.read_iosf_sb_reg(hw,
-					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
-
-	if (status != IXGBE_SUCCESS) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		goto out;
-	}
-
-	/* Determine link parter flow control */
-	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				  IXGBE_KRM_PCS_KX_AN_LP(hw->bus.lan_id),
-				  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an_lp);
-
-	if (status != IXGBE_SUCCESS) {
-		DEBUGOUT("Auto-Negotiation did not complete\n");
-		goto out;
-	}
-
-	status = ixgbe_negotiate_fc(hw, pcs_an, pcs_an_lp,
-				    IXGBE_KRM_PCS_KX_AN_SYM_PAUSE,
-				    IXGBE_KRM_PCS_KX_AN_ASM_PAUSE,
-				    IXGBE_KRM_PCS_KX_AN_LP_SYM_PAUSE,
-				    IXGBE_KRM_PCS_KX_AN_LP_ASM_PAUSE);
-
-out:
-	if (status == IXGBE_SUCCESS) {
-		hw->fc.fc_was_autonegged = true;
-	} else {
-		hw->fc.fc_was_autonegged = false;
-		hw->fc.current_mode = hw->fc.requested_mode;
-	}
+	hw->fc.fc_was_autonegged = false;
+	hw->fc.current_mode = hw->fc.requested_mode;
 }
 
 /**
@@ -4430,120 +4364,6 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 }
 
 /**
- *  ixgbe_setup_fc_fiber_x550em_a - Set up flow control
- *  @hw: pointer to hardware structure
- *
- *  Called at init time to set up flow control.
- **/
-s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw)
-{
-	struct ixgbe_mac_info *mac = &hw->mac;
-	s32 rc = IXGBE_SUCCESS;
-	u32 an_cntl4, lctrl, pcs_an;
-
-	DEBUGFUNC("ixgbe_setup_fc_fiber_x550em_a");
-
-	/* Validate the requested mode */
-	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
-		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
-		return IXGBE_ERR_INVALID_LINK_SETTINGS;
-	}
-
-	/* Enable clause 37 auto-negotiation in KRM_LINK_CTRL_1 */
-	if (hw->fc.requested_mode == ixgbe_fc_default)
-		hw->fc.requested_mode = ixgbe_fc_full;
-
-	rc = mac->ops.read_iosf_sb_reg(hw,
-				       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, &lctrl);
-	if (rc)
-		return rc;
-
-	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
-	lctrl |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CLAUSE_37_EN;
-
-	rc = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, lctrl);
-	if (rc)
-		return rc;
-
-	/* Enable clause 37 over 73 in KRM_AN_CNTL_4 */
-	rc = mac->ops.read_iosf_sb_reg(hw,
-				       IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl4);
-	if (rc)
-		return rc;
-
-	an_cntl4 |= IXGBE_KRM_AN_CNTL_4_ECSR_AN37_OVER_73;
-
-	rc = mac->ops.write_iosf_sb_reg(hw,
-					IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
-					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl4);
-	if (rc)
-		return rc;
-
-	rc = hw->mac.ops.read_iosf_sb_reg(hw,
-					  IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-					  IXGBE_SB_IOSF_TARGET_KR_PHY, &pcs_an);
-
-	if (rc)
-		return rc;
-
-	/* The possible values of fc.requested_mode are:
-	 * 0: Flow control is completely disabled
-	 * 1: Rx flow control is enabled (we can receive pause frames,
-	 *    but not send pause frames).
-	 * 2: Tx flow control is enabled (we can send pause frames but
-	 *    we do not support receiving pause frames).
-	 * 3: Both Rx and Tx flow control (symmetric) are enabled.
-	 * other: Invalid.
-	 */
-	switch (hw->fc.requested_mode) {
-	case ixgbe_fc_none:
-		/* Flow control completely disabled by software override. */
-		pcs_an &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
-			    IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
-		break;
-	case ixgbe_fc_tx_pause:
-		/* Tx Flow control is enabled, and Rx Flow control is
-		 * disabled by software override.
-		 */
-		pcs_an |= IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
-		pcs_an &= ~IXGBE_KRM_PCS_KX_AN_SYM_PAUSE;
-		break;
-	case ixgbe_fc_rx_pause:
-		/* Rx Flow control is enabled and Tx Flow control is
-		 * disabled by software override. Since there really
-		 * isn't a way to advertise that we are capable of RX
-		 * Pause ONLY, we will advertise that we support both
-		 * symmetric and asymmetric Rx PAUSE, as such we fall
-		 * through to the fc_full statement.  Later, we will
-		 * disable the adapter's ability to send PAUSE frames.
-		 */
-	case ixgbe_fc_full:
-		/* Flow control (both Rx and Tx) is enabled by SW override. */
-		pcs_an |= IXGBE_KRM_PCS_KX_AN_SYM_PAUSE |
-			   IXGBE_KRM_PCS_KX_AN_ASM_PAUSE;
-		break;
-	default:
-		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
-			      "Flow control param set incorrectly\n");
-		return IXGBE_ERR_CONFIG;
-	}
-
-	rc = hw->mac.ops.write_iosf_sb_reg(hw,
-					   IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-					   IXGBE_SB_IOSF_TARGET_KR_PHY, pcs_an);
-
-	/* Restart auto-negotiation. */
-	rc = ixgbe_restart_an_internal_phy_x550em(hw);
-
-	return rc;
-}
-
-/**
  * ixgbe_set_mux - Set mux for port 1 access with CS4227
  * @hw: pointer to hardware structure
  * @state: set mux if 1, clear if 0
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 38/40] net/ixgbe/base: do not skip PHY configuration
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (36 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 37/40] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 39/40] net/ixgbe/base: clean up Xiao Wang
                       ` (2 subsequent siblings)
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

By exiting early we could skip the PHY configuration and as such
the driver may not configure the PHY correctly for SFP+.

This patch removes the logic which would previously skip the PHY
configuration in the case where we are already at the requested
speed in ixgbe_setup_mac_link_multispeed_fiber().

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_common.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index e0dc3b5..8230ae1 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -5060,14 +5060,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 		speedcnt++;
 		highest_link_speed = IXGBE_LINK_SPEED_10GB_FULL;
 
-		/* If we already have link at this speed, just jump out */
-		status = ixgbe_check_link(hw, &link_speed, &link_up, false);
-		if (status != IXGBE_SUCCESS)
-			return status;
-
-		if ((link_speed == IXGBE_LINK_SPEED_10GB_FULL) && link_up)
-			goto out;
-
 		/* Set the module link speed */
 		switch (hw->phy.media_type) {
 		case ixgbe_media_type_fiber:
@@ -5118,14 +5110,6 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 		if (highest_link_speed == IXGBE_LINK_SPEED_UNKNOWN)
 			highest_link_speed = IXGBE_LINK_SPEED_1GB_FULL;
 
-		/* If we already have link at this speed, just jump out */
-		status = ixgbe_check_link(hw, &link_speed, &link_up, false);
-		if (status != IXGBE_SUCCESS)
-			return status;
-
-		if ((link_speed == IXGBE_LINK_SPEED_1GB_FULL) && link_up)
-			goto out;
-
 		/* Set the module link speed */
 		switch (hw->phy.media_type) {
 		case ixgbe_media_type_fiber:
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 39/40] net/ixgbe/base: clean up
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (37 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 38/40] net/ixgbe/base: do not skip PHY configuration Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 40/40] net/ixgbe/base: add base driver update brief Xiao Wang
  2016-09-26  2:06     ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Lu, Wenzhuo
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

Change the parameter bypass_vlvf to vlvf_bypass for consistency
with ixgbe_common.c.

Clean up some whitespace and disalignment.

Change variable type of secrxreg from int to u32 as it's used
to store register value.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Added this patch to gather all the minor cleanups.

---
 drivers/net/ixgbe/base/ixgbe_82598.c  |   6 +-
 drivers/net/ixgbe/base/ixgbe_api.c    |   7 +-
 drivers/net/ixgbe/base/ixgbe_common.c |  13 ++--
 drivers/net/ixgbe/base/ixgbe_common.h |   2 +-
 drivers/net/ixgbe/base/ixgbe_mbx.h    |   4 +-
 drivers/net/ixgbe/base/ixgbe_x540.c   |   1 +
 drivers/net/ixgbe/base/ixgbe_x550.c   | 119 +++++++++++++++++-----------------
 drivers/net/ixgbe/base/ixgbe_x550.h   |   8 +--
 8 files changed, 84 insertions(+), 76 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_82598.c b/drivers/net/ixgbe/base/ixgbe_82598.c
index db80880..724dcbb 100644
--- a/drivers/net/ixgbe/base/ixgbe_82598.c
+++ b/drivers/net/ixgbe/base/ixgbe_82598.c
@@ -995,19 +995,19 @@ STATIC s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
  *  @vlan: VLAN id to write to VLAN filter
  *  @vind: VMDq output index that maps queue to VLAN id in VFTA
  *  @vlan_on: boolean flag to turn on/off VLAN in VFTA
- *  @bypass_vlvf: boolean flag - unused
+ *  @vlvf_bypass: boolean flag - unused
  *
  *  Turn on/off specified VLAN in the VLAN filter table.
  **/
 s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind,
-			 bool vlan_on, bool bypass_vlvf)
+			 bool vlan_on, bool vlvf_bypass)
 {
 	u32 regindex;
 	u32 bitindex;
 	u32 bits;
 	u32 vftabyte;
 
-	UNREFERENCED_1PARAMETER(bypass_vlvf);
+	UNREFERENCED_1PARAMETER(vlvf_bypass);
 
 	DEBUGFUNC("ixgbe_set_vfta_82598");
 
diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
index 12ba093..094ee52 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.c
+++ b/drivers/net/ixgbe/base/ixgbe_api.c
@@ -1092,7 +1092,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
 		   bool vlvf_bypass)
 {
 	return ixgbe_call_func(hw, hw->mac.ops.set_vfta, (hw, vlan, vind,
-				  vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
+			       vlan_on, vlvf_bypass), IXGBE_NOT_IMPLEMENTED);
 }
 
 /**
@@ -1102,7 +1102,7 @@ s32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
  *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
  *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
  *  @vfta_delta: pointer to the difference between the current value of VFTA
- *               and the desired value
+ *		 and the desired value
  *  @vfta: the desired value of the VFTA
  *  @vlvf_bypass: boolean flag indicating updating the default pool is okay
  *
@@ -1112,7 +1112,7 @@ s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on,
 		   u32 *vfta_delta, u32 vfta, bool vlvf_bypass)
 {
 	return ixgbe_call_func(hw, hw->mac.ops.set_vlvf, (hw, vlan, vind,
-				vlan_on, vfta_delta, vfta, vlvf_bypass),
+			       vlan_on, vfta_delta, vfta, vlvf_bypass),
 			       IXGBE_NOT_IMPLEMENTED);
 }
 
@@ -1661,6 +1661,7 @@ void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw)
 		hw->mac.ops.init_swfw_sync(hw);
 }
 
+
 void ixgbe_disable_rx(struct ixgbe_hw *hw)
 {
 	if (hw->mac.ops.disable_rx)
diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
index 8230ae1..cca19ef 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.c
+++ b/drivers/net/ixgbe/base/ixgbe_common.c
@@ -1077,7 +1077,7 @@ void ixgbe_set_lan_id_multi_port_pcie(struct ixgbe_hw *hw)
 	if (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP) {
 		hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_4, &ee_ctrl_4);
 		bus->instance_id = (ee_ctrl_4 & IXGBE_EE_CTRL_4_INST_ID) >>
-			IXGBE_EE_CTRL_4_INST_ID_SHIFT;
+				   IXGBE_EE_CTRL_4_INST_ID_SHIFT;
 	}
 }
 
@@ -2888,7 +2888,7 @@ out:
  *  advertised settings
  **/
 s32 ixgbe_negotiate_fc(struct ixgbe_hw *hw, u32 adv_reg, u32 lp_reg,
-			      u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
+		       u32 adv_sym, u32 adv_asm, u32 lp_sym, u32 lp_asm)
 {
 	if ((!(adv_reg)) ||  (!(lp_reg))) {
 		ERROR_REPORT3(IXGBE_ERROR_UNSUPPORTED,
@@ -3360,7 +3360,7 @@ s32 prot_autoc_write_generic(struct ixgbe_hw *hw, u32 reg_val, bool locked)
  **/
 s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw)
 {
-	int secrxreg;
+	u32 secrxreg;
 
 	DEBUGFUNC("ixgbe_enable_sec_rx_path_generic");
 
@@ -3931,7 +3931,8 @@ s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 	vfta_delta = 1 << (vlan % 32);
 	vfta = IXGBE_READ_REG(hw, IXGBE_VFTA(regidx));
 
-	/* vfta_delta represents the difference between the current value
+	/*
+	 * vfta_delta represents the difference between the current value
 	 * of vfta and the value we want in the register.  Since the diff
 	 * is an XOR mask we can just update the vfta using an XOR
 	 */
@@ -3964,7 +3965,7 @@ vfta_update:
  *  @vind: VMDq output index that maps queue to VLAN id in VLVFB
  *  @vlan_on: boolean flag to turn on/off VLAN in VLVF
  *  @vfta_delta: pointer to the difference between the current value of VFTA
- * and the desired value
+ *		 and the desired value
  *  @vfta: the desired value of the VFTA
  *  @vlvf_bypass: boolean flag indicating updating default pool is okay
  *
@@ -3991,6 +3992,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 	 */
 	if (!(IXGBE_READ_REG(hw, IXGBE_VT_CTL) & IXGBE_VT_CTL_VT_ENABLE))
 		return IXGBE_SUCCESS;
+
 	vlvf_index = ixgbe_find_vlvf_slot(hw, vlan, vlvf_bypass);
 	if (vlvf_index < 0)
 		return vlvf_index;
@@ -4020,6 +4022,7 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 
 		return IXGBE_SUCCESS;
 	}
+
 	/* If there are still bits set in the VLVFB registers
 	 * for the VLAN ID indicated we need to see if the
 	 * caller is requesting that we clear the VFTA entry bit.
diff --git a/drivers/net/ixgbe/base/ixgbe_common.h b/drivers/net/ixgbe/base/ixgbe_common.h
index cd04237..66dd565 100644
--- a/drivers/net/ixgbe/base/ixgbe_common.h
+++ b/drivers/net/ixgbe/base/ixgbe_common.h
@@ -133,7 +133,7 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
 s32 ixgbe_insert_mac_addr_generic(struct ixgbe_hw *hw, u8 *addr, u32 vmdq);
 s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
 s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
-			   u32 vind, bool vlan_on, bool vlvf_bypass);
+			 u32 vind, bool vlan_on, bool vlvf_bypass);
 s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind,
 			   bool vlan_on, u32 *vfta_delta, u32 vfta,
 			   bool vlvf_bypass);
diff --git a/drivers/net/ixgbe/base/ixgbe_mbx.h b/drivers/net/ixgbe/base/ixgbe_mbx.h
index cabb062..7556a81 100644
--- a/drivers/net/ixgbe/base/ixgbe_mbx.h
+++ b/drivers/net/ixgbe/base/ixgbe_mbx.h
@@ -110,8 +110,8 @@ enum ixgbe_pfvf_api_rev {
 #define IXGBE_VF_GET_QUEUES	0x09 /* get queue configuration */
 
 /* mailbox API, version 1.2 VF requests */
-#define IXGBE_VF_GET_RETA		0x0a /* VF request for RETA */
-#define IXGBE_VF_GET_RSS_KEY		0x0b /* get RSS key */
+#define IXGBE_VF_GET_RETA      0x0a    /* VF request for RETA */
+#define IXGBE_VF_GET_RSS_KEY	0x0b    /* get RSS key */
 #define IXGBE_VF_UPDATE_XCAST_MODE	0x0c
 
 /* GET_QUEUES return data indices within the mailbox */
diff --git a/drivers/net/ixgbe/base/ixgbe_x540.c b/drivers/net/ixgbe/base/ixgbe_x540.c
index c58f36a..6e778bc 100644
--- a/drivers/net/ixgbe/base/ixgbe_x540.c
+++ b/drivers/net/ixgbe/base/ixgbe_x540.c
@@ -271,6 +271,7 @@ mac_reset_top:
 	if (ixgbe_validate_mac_addr(hw->mac.san_addr) == 0) {
 		/* Save the SAN MAC RAR index */
 		hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
+
 		hw->mac.ops.set_rar(hw, hw->mac.san_mac_rar_index,
 				    hw->mac.san_addr, 0, IXGBE_RAH_AV);
 
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index f15449c..87d4302 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -906,20 +906,20 @@ STATIC s32 ixgbe_enable_eee_x550(struct ixgbe_hw *hw)
 	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);
+					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;
+			    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);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
 		if (status != IXGBE_SUCCESS)
 			return status;
 		break;
@@ -961,8 +961,8 @@ STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
 	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);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &link_reg);
 		if (status != IXGBE_SUCCESS)
 			return status;
 
@@ -973,8 +973,8 @@ STATIC s32 ixgbe_disable_eee_x550(struct ixgbe_hw *hw)
 		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);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, link_reg);
 		if (status != IXGBE_SUCCESS)
 			return status;
 		break;
@@ -1012,6 +1012,7 @@ s32 ixgbe_setup_eee_X550(struct ixgbe_hw *hw, bool enable_eee)
 		    !(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;
@@ -1720,7 +1721,7 @@ STATIC s32 ixgbe_setup_sgmii(struct ixgbe_hw *hw, ixgbe_link_speed speed,
 	return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait);
 }
 
- /**
+/**
  * ixgbe_setup_sgmii_m88 - Set up link for sgmii with Marvell PHYs
  * @hw: pointer to hardware structure
  */
@@ -1812,13 +1813,14 @@ void ixgbe_init_mac_link_ops_X550em(struct ixgbe_hw *hw)
 		mac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber;
 		mac->ops.set_rate_select_speed =
 					ixgbe_set_soft_rate_select_speed;
+
 		if ((hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP_N) ||
 		    (hw->device_id == IXGBE_DEV_ID_X550EM_A_SFP))
 			mac->ops.setup_mac_link =
-				ixgbe_setup_mac_link_sfp_x550a;
+						ixgbe_setup_mac_link_sfp_x550a;
 		else
 			mac->ops.setup_mac_link =
-				ixgbe_setup_mac_link_sfp_x550em;
+						ixgbe_setup_mac_link_sfp_x550em;
 		break;
 	case ixgbe_media_type_copper:
 		if (hw->mac.type == ixgbe_mac_X550EM_a) {
@@ -1856,6 +1858,7 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw,
 {
 	DEBUGFUNC("ixgbe_get_link_capabilities_X550em");
 
+
 	/* SFP */
 	if (hw->phy.media_type == ixgbe_media_type_fiber) {
 
@@ -2102,8 +2105,8 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 	u32 reg_val;
 
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status)
 		return status;
 
@@ -2120,8 +2123,8 @@ STATIC s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *hw,
 		reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_CAP_KX;
 
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
 	if (hw->mac.type == ixgbe_mac_X550EM_a) {
 		/* Set lane mode  to KR auto negotiation */
@@ -2426,7 +2429,7 @@ STATIC s32 ixgbe_read_mng_if_sel_x550em(struct ixgbe_hw *hw)
 	    hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_MDIO_ACT) {
 		hw->phy.addr = (hw->phy.nw_mng_if_sel &
 				IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD) >>
-				IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
+			       IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT;
 	}
 
 	return IXGBE_SUCCESS;
@@ -2830,8 +2833,8 @@ STATIC s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
  *  Configure the the integrated PHY for SFP support.
  **/
 s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
-				   ixgbe_link_speed speed,
-				   bool autoneg_wait_to_complete)
+				    ixgbe_link_speed speed,
+				    bool autoneg_wait_to_complete)
 {
 	s32 ret_val;
 	u16 reg_phy_ext;
@@ -2886,7 +2889,7 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 
 		/* Get external PHY device id */
 		ret_val = hw->phy.ops.read_reg(hw, IXGBE_CS4227_GLOBAL_ID_MSB,
-				       IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
+					IXGBE_MDIO_ZERO_DEV_TYPE, &reg_phy_ext);
 
 		if (ret_val != IXGBE_SUCCESS)
 			return ret_val;
@@ -2907,7 +2910,7 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 		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);
+					 IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext);
 	}
 	return ret_val;
 }
@@ -3150,56 +3153,56 @@ s32 ixgbe_setup_phy_loopback_x550em(struct ixgbe_hw *hw)
 
 	/* Disable AN and force speed to 10G Serial. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_AN_ENABLE;
 	reg_val &= ~IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_MASK;
 	reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_FORCE_SPEED_10G;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+					IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Set near-end loopback clocks. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_32B;
 	reg_val |= IXGBE_KRM_PORT_CAR_GEN_CTRL_NELB_KRPCS;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+				IXGBE_KRM_PORT_CAR_GEN_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Set loopback enable. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_PMD_DFX_BURNIN_TX_RX_KR_LB_MASK;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+				IXGBE_KRM_PMD_DFX_BURNIN(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 
 	/* Training bypass. */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-		      IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
-		      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 	if (status != IXGBE_SUCCESS)
 		return status;
 	reg_val |= IXGBE_KRM_RX_TRN_LINKUP_CTRL_PROTOCOL_BYPASS;
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-		       IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
-		       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+				IXGBE_KRM_RX_TRN_LINKUP_CTRL(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
 	return status;
 }
@@ -3272,6 +3275,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 		DEBUGOUT("EEPROM read buffer - semaphore failed\n");
 		return status;
 	}
+
 	while (words) {
 		if (words > FW_MAX_READ_BUFFER_SIZE / 2)
 			words_to_read = FW_MAX_READ_BUFFER_SIZE / 2;
@@ -4015,19 +4019,19 @@ s32 ixgbe_setup_fc_X550em(struct ixgbe_hw *hw)
 	case IXGBE_DEV_ID_X550EM_A_KR:
 	case IXGBE_DEV_ID_X550EM_A_KR_L:
 		ret_val = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
 		if (ret_val != IXGBE_SUCCESS)
 			goto out;
 		reg_val &= ~(IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
-			     IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
+			IXGBE_KRM_AN_CNTL_1_ASM_PAUSE);
 		if (pause)
 			reg_val |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE;
 		if (asm_dir)
 			reg_val |= IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
 		ret_val = hw->mac.ops.write_iosf_sb_reg(hw,
-				       IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
 
 		/* This device does not fully support AN. */
 		hw->fc.disable_fc_autoneg = true;
@@ -4060,7 +4064,7 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 	 */
 	if (hw->fc.disable_fc_autoneg) {
 		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-			      "Flow control autoneg is disabled");
+			     "Flow control autoneg is disabled");
 		goto out;
 	}
 
@@ -4072,8 +4076,8 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 
 	/* Check at auto-negotiation has completed */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_LINK_S1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
+					IXGBE_KRM_LINK_S1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &link_s1);
 
 	if (status != IXGBE_SUCCESS ||
 	    (link_s1 & IXGBE_KRM_LINK_S1_MAC_AN_COMPLETE) == 0) {
@@ -4086,8 +4090,8 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 	 * local flow control settings accordingly
 	 */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl_1);
+				IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl_1);
 
 	if (status != IXGBE_SUCCESS) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
@@ -4095,8 +4099,8 @@ void ixgbe_fc_autoneg_backplane_x550em_a(struct ixgbe_hw *hw)
 	}
 
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-			      IXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id),
-			      IXGBE_SB_IOSF_TARGET_KR_PHY, &lp_an_page_low);
+				IXGBE_KRM_LP_BASE_PAGE_HIGH(hw->bus.lan_id),
+				IXGBE_SB_IOSF_TARGET_KR_PHY, &lp_an_page_low);
 
 	if (status != IXGBE_SUCCESS) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
@@ -4291,7 +4295,7 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	/* Validate the requested mode */
 	if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
 		ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED,
-		      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+			      "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
 		return IXGBE_ERR_INVALID_LINK_SETTINGS;
 	}
 
@@ -4303,8 +4307,8 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	 * we link at 10G, the 1G advertisement is harmless and vice versa.
 	 */
 	status = hw->mac.ops.read_iosf_sb_reg(hw,
-				      IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				      IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, &an_cntl);
 
 	if (status != IXGBE_SUCCESS) {
 		DEBUGOUT("Auto-Negotiation did not complete\n");
@@ -4345,7 +4349,7 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	case ixgbe_fc_full:
 		/* Flow control (both Rx and Tx) is enabled by SW override. */
 		an_cntl |= IXGBE_KRM_AN_CNTL_1_SYM_PAUSE |
-			IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
+			   IXGBE_KRM_AN_CNTL_1_ASM_PAUSE;
 		break;
 	default:
 		ERROR_REPORT1(IXGBE_ERROR_ARGUMENT,
@@ -4354,8 +4358,8 @@ s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw)
 	}
 
 	status = hw->mac.ops.write_iosf_sb_reg(hw,
-				       IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
-				       IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
+					IXGBE_KRM_AN_CNTL_1(hw->bus.lan_id),
+					IXGBE_SB_IOSF_TARGET_KR_PHY, an_cntl);
 
 	/* Restart auto-negotiation. */
 	status = ixgbe_restart_an_internal_phy_x550em(hw);
@@ -4491,7 +4495,7 @@ STATIC void ixgbe_release_swfw_sync_X550a(struct ixgbe_hw *hw, u32 mask)
  *  instances.
  **/
 s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			     u32 device_type, u16 *phy_data)
+			       u32 device_type, u16 *phy_data)
 {
 	s32 status;
 	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
@@ -4519,7 +4523,7 @@ s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
  *  The PHY Token is needed since the MDIO is shared between to MAC instances.
  **/
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			      u32 device_type, u16 phy_data)
+				u32 device_type, u16 phy_data)
 {
 	s32 status;
 	u32 mask = hw->phy.phy_semaphore_mask | IXGBE_GSSR_TOKEN_SM;
@@ -4716,4 +4720,3 @@ s32 ixgbe_led_off_t_X550em(struct ixgbe_hw *hw, u32 led_idx)
 
 	return IXGBE_SUCCESS;
 }
-
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.h b/drivers/net/ixgbe/base/ixgbe_x550.h
index 36b36f6..cd4db29 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.h
+++ b/drivers/net/ixgbe/base/ixgbe_x550.h
@@ -99,12 +99,12 @@ s32 ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 				    ixgbe_link_speed speed,
 				    bool autoneg_wait_to_complete);
 s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
-				   ixgbe_link_speed speed,
-				   bool autoneg_wait_to_complete);
+				    ixgbe_link_speed speed,
+				    bool autoneg_wait_to_complete);
 s32 ixgbe_read_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			     u32 device_type, u16 *phy_data);
+			       u32 device_type, u16 *phy_data);
 s32 ixgbe_write_phy_reg_x550a(struct ixgbe_hw *hw, u32 reg_addr,
-			      u32 device_type, u16 phy_data);
+				u32 device_type, u16 phy_data);
 s32 ixgbe_setup_fc_fiber_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_backplane_x550em_a(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc_sgmii_x550em_a(struct ixgbe_hw *hw);
-- 
1.9.3

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

* [dpdk-dev] [PATCH v2 40/40] net/ixgbe/base: add base driver update brief
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (38 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 39/40] net/ixgbe/base: clean up Xiao Wang
@ 2016-09-25  9:00     ` Xiao Wang
  2016-09-26  2:06     ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Lu, Wenzhuo
  40 siblings, 0 replies; 107+ messages in thread
From: Xiao Wang @ 2016-09-25  9:00 UTC (permalink / raw)
  To: wenzhuo.lu; +Cc: dev, ferruh.yigit, Xiao Wang

The ixgbe base driver was updated to version
cid-10g-shared-code.2016.04.12.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---

v2: - Added two new items into the shared code update log.
    - Removed the "add VF multicast promiscuous mode support", since we
      already supported it before.

---
 doc/guides/rel_notes/release_16_11.rst | 9 +++++++++
 drivers/net/ixgbe/base/README          | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst
index 0b9022d..b185992 100644
--- a/doc/guides/rel_notes/release_16_11.rst
+++ b/doc/guides/rel_notes/release_16_11.rst
@@ -36,6 +36,15 @@ New Features
 
      This section is a comment. Make sure to start the actual text at the margin.
 
+   * **Updated the ixgbe base driver.**
+
+     Updated the ixgbe base driver, including the following changes:
+
+     * add X550em_a 10G PHY support
+     * support flow control auto negotiation for X550em_a 1G PHY
+     * add X550em_a FW ALEF support
+     * increase mailbox version to ixgbe_mbox_api_13
+     * add two MAC ops for Hyper-V support
 
 Resolved Issues
 ---------------
diff --git a/drivers/net/ixgbe/base/README b/drivers/net/ixgbe/base/README
index 76e7805..6b54c31 100644
--- a/drivers/net/ixgbe/base/README
+++ b/drivers/net/ixgbe/base/README
@@ -34,7 +34,7 @@ Intel® IXGBE driver
 ===================
 
 This directory contains source code of FreeBSD ixgbe driver of version
-cid-10g-shared-code.2016.04.12 released by ND. The sub-directory of base/
+cid-10g-shared-code.2016.08.15 released by ND. The sub-directory of base/
 contains the original source package.
 This driver is valid for the product(s) listed below
 
-- 
1.9.3

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

* Re: [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update
  2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
                       ` (39 preceding siblings ...)
  2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 40/40] net/ixgbe/base: add base driver update brief Xiao Wang
@ 2016-09-26  2:06     ` Lu, Wenzhuo
  2016-09-28 15:31       ` Bruce Richardson
  40 siblings, 1 reply; 107+ messages in thread
From: Lu, Wenzhuo @ 2016-09-26  2:06 UTC (permalink / raw)
  To: Wang, Xiao W; +Cc: dev, Yigit, Ferruh

Hi,


> -----Original Message-----
> From: Wang, Xiao W
> Sent: Sunday, September 25, 2016 5:00 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; Yigit, Ferruh; Wang, Xiao W
> Subject: [PATCH v2 00/40] net/ixgbe: base code update
> 
> v2: - Moved minor changes into a cleanup patch.
>     - Removed some unofficial names in commit log.
> 	- Rewrote the commit log of patch 05/40 to describe what the patch
>       actually does.
>     - Improved the wording of some commit log.
> 
> Update ixgbe base driver, including the following changes:
> 
> * add X550em_a 10G PHY support
> * support flow control auto negotiation for X550em_a 1G PHY
> * add X550em_a FW ALEF support
> * increase mailbox version to ixgbe_mbox_api_13
> * add two MAC ops for Hyper-V support
> * some functional fixes
> 
> Xiao Wang (40):
>   net/ixgbe/base: fix delta check for setting VFTA
>   net/ixgbe/base: remove X550em SFP iXFI setup
>   net/ixgbe/base: change endianness of PHY data
>   net/ixgbe/base: add X550em_a 10G PHY support
>   net/ixgbe/base: move vf_update_xcast_mode to base code
>   net/ixgbe/base: introduce new ops init functions
>   net/ixgbe/base: separate PHY probe code
>   net/ixgbe/base: fully initialize X550em_a 1G PHYs
>   net/ixgbe/base: add macros for VF promiscuous mode
>   net/ixgbe/base: add FC setup for X550em_a fiber
>   net/ixgbe/base: add FC autoneg for X550em_a fiber
>   net/ixgbe/base: clear page register in error path
>   net/ixgbe/base: configure DMAC for 10Mb operation
>   net/ixgbe/base: fix function comments about X550
>   net/ixgbe/base: report setting LPE register error
>   net/ixgbe/base: bump mailbox version
>   net/ixgbe/base: access IOSF by host interface
>   net/ixgbe/base: fix check on NACK
>   net/ixgbe/base: define X550 PCIe serial MAC addr
>   net/ixgbe/base: bypass checking link for crosstalk
>   net/ixgbe/base: support X550em_a SGMII FC autoneg
>   net/ixgbe/base: add macros for GENEVE UDP port
>   net/ixgbe/base: add bound check in LED functions
>   net/ixgbe/base: use default check link function
>   net/ixgbe/base: set default autoneg speed at reset
>   net/ixgbe/base: add missing FDIRSCTPM mask setting
>   net/ixgbe/base: commonize mailbox write and read
>   net/ixgbe/base: reduce delay for SWFW semaphore
>   net/ixgbe/base: report autoneg supported for X550
>   net/ixgbe/base: remove X550em_a 100Mbps support
>   net/ixgbe/base: unify link speed value
>   net/ixgbe/base: separate ops init from PHY init
>   net/ixgbe/base: add X550em_a FW ALEF support
>   net/ixgbe/base: add two MAC ops for Hyper-V
>   net/ixgbe/base: hold semaphore for shadow RAM access
>   net/ixgbe/base: update X550em_a backplane speed
>   net/ixgbe/base: clean code of flow control autoneg
>   net/ixgbe/base: do not skip PHY configuration
>   net/ixgbe/base: clean up
>   net/ixgbe/base: add base driver update brief
> 
>  doc/guides/rel_notes/release_16_11.rst |    9 +
>  drivers/net/ixgbe/base/README          |    2 +-
>  drivers/net/ixgbe/base/ixgbe_82598.c   |    6 +-
>  drivers/net/ixgbe/base/ixgbe_82599.c   |   16 +-
>  drivers/net/ixgbe/base/ixgbe_api.c     |   11 +-
>  drivers/net/ixgbe/base/ixgbe_api.h     |    2 +
>  drivers/net/ixgbe/base/ixgbe_common.c  |  258 +++++--
>  drivers/net/ixgbe/base/ixgbe_common.h  |    3 +-
>  drivers/net/ixgbe/base/ixgbe_mbx.h     |    7 +-
>  drivers/net/ixgbe/base/ixgbe_osdep.h   |    1 +
>  drivers/net/ixgbe/base/ixgbe_phy.c     |  100 ++-
>  drivers/net/ixgbe/base/ixgbe_phy.h     |   71 +-
>  drivers/net/ixgbe/base/ixgbe_type.h    |   73 +-
>  drivers/net/ixgbe/base/ixgbe_vf.c      |  103 ++-
>  drivers/net/ixgbe/base/ixgbe_vf.h      |    3 +-
>  drivers/net/ixgbe/base/ixgbe_x540.c    |   10 +-
>  drivers/net/ixgbe/base/ixgbe_x550.c    | 1262 +++++++++++++++++++++---------
> --
>  drivers/net/ixgbe/base/ixgbe_x550.h    |   61 +-
>  drivers/net/ixgbe/ixgbe_ethdev.c       |   43 +-
>  19 files changed, 1360 insertions(+), 681 deletions(-)
> 
> --
> 1.9.3
Series-Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>

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

* Re: [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update
  2016-09-26  2:06     ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Lu, Wenzhuo
@ 2016-09-28 15:31       ` Bruce Richardson
  0 siblings, 0 replies; 107+ messages in thread
From: Bruce Richardson @ 2016-09-28 15:31 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: Wang, Xiao W, dev, Yigit, Ferruh

On Mon, Sep 26, 2016 at 02:06:17AM +0000, Lu, Wenzhuo wrote:
> Hi,
> 
> 
> > -----Original Message-----
> > From: Wang, Xiao W
> > Sent: Sunday, September 25, 2016 5:00 PM
> > To: Lu, Wenzhuo
> > Cc: dev@dpdk.org; Yigit, Ferruh; Wang, Xiao W
> > Subject: [PATCH v2 00/40] net/ixgbe: base code update
> > 
> > v2: - Moved minor changes into a cleanup patch.
> >     - Removed some unofficial names in commit log.
> > 	- Rewrote the commit log of patch 05/40 to describe what the patch
> >       actually does.
> >     - Improved the wording of some commit log.
> > 
> > Update ixgbe base driver, including the following changes:
> > 
> > * add X550em_a 10G PHY support
> > * support flow control auto negotiation for X550em_a 1G PHY
> > * add X550em_a FW ALEF support
> > * increase mailbox version to ixgbe_mbox_api_13
> > * add two MAC ops for Hyper-V support
> > * some functional fixes
> > 
> > Xiao Wang (40):
> >   net/ixgbe/base: fix delta check for setting VFTA
> >   net/ixgbe/base: remove X550em SFP iXFI setup
> >   net/ixgbe/base: change endianness of PHY data
> >   net/ixgbe/base: add X550em_a 10G PHY support
> >   net/ixgbe/base: move vf_update_xcast_mode to base code
> >   net/ixgbe/base: introduce new ops init functions
> >   net/ixgbe/base: separate PHY probe code
> >   net/ixgbe/base: fully initialize X550em_a 1G PHYs
> >   net/ixgbe/base: add macros for VF promiscuous mode
> >   net/ixgbe/base: add FC setup for X550em_a fiber
> >   net/ixgbe/base: add FC autoneg for X550em_a fiber
> >   net/ixgbe/base: clear page register in error path
> >   net/ixgbe/base: configure DMAC for 10Mb operation
> >   net/ixgbe/base: fix function comments about X550
> >   net/ixgbe/base: report setting LPE register error
> >   net/ixgbe/base: bump mailbox version
> >   net/ixgbe/base: access IOSF by host interface
> >   net/ixgbe/base: fix check on NACK
> >   net/ixgbe/base: define X550 PCIe serial MAC addr
> >   net/ixgbe/base: bypass checking link for crosstalk
> >   net/ixgbe/base: support X550em_a SGMII FC autoneg
> >   net/ixgbe/base: add macros for GENEVE UDP port
> >   net/ixgbe/base: add bound check in LED functions
> >   net/ixgbe/base: use default check link function
> >   net/ixgbe/base: set default autoneg speed at reset
> >   net/ixgbe/base: add missing FDIRSCTPM mask setting
> >   net/ixgbe/base: commonize mailbox write and read
> >   net/ixgbe/base: reduce delay for SWFW semaphore
> >   net/ixgbe/base: report autoneg supported for X550
> >   net/ixgbe/base: remove X550em_a 100Mbps support
> >   net/ixgbe/base: unify link speed value
> >   net/ixgbe/base: separate ops init from PHY init
> >   net/ixgbe/base: add X550em_a FW ALEF support
> >   net/ixgbe/base: add two MAC ops for Hyper-V
> >   net/ixgbe/base: hold semaphore for shadow RAM access
> >   net/ixgbe/base: update X550em_a backplane speed
> >   net/ixgbe/base: clean code of flow control autoneg
> >   net/ixgbe/base: do not skip PHY configuration
> >   net/ixgbe/base: clean up
> >   net/ixgbe/base: add base driver update brief
> > 
> >  doc/guides/rel_notes/release_16_11.rst |    9 +
> >  drivers/net/ixgbe/base/README          |    2 +-
> >  drivers/net/ixgbe/base/ixgbe_82598.c   |    6 +-
> >  drivers/net/ixgbe/base/ixgbe_82599.c   |   16 +-
> >  drivers/net/ixgbe/base/ixgbe_api.c     |   11 +-
> >  drivers/net/ixgbe/base/ixgbe_api.h     |    2 +
> >  drivers/net/ixgbe/base/ixgbe_common.c  |  258 +++++--
> >  drivers/net/ixgbe/base/ixgbe_common.h  |    3 +-
> >  drivers/net/ixgbe/base/ixgbe_mbx.h     |    7 +-
> >  drivers/net/ixgbe/base/ixgbe_osdep.h   |    1 +
> >  drivers/net/ixgbe/base/ixgbe_phy.c     |  100 ++-
> >  drivers/net/ixgbe/base/ixgbe_phy.h     |   71 +-
> >  drivers/net/ixgbe/base/ixgbe_type.h    |   73 +-
> >  drivers/net/ixgbe/base/ixgbe_vf.c      |  103 ++-
> >  drivers/net/ixgbe/base/ixgbe_vf.h      |    3 +-
> >  drivers/net/ixgbe/base/ixgbe_x540.c    |   10 +-
> >  drivers/net/ixgbe/base/ixgbe_x550.c    | 1262 +++++++++++++++++++++---------
> > --
> >  drivers/net/ixgbe/base/ixgbe_x550.h    |   61 +-
> >  drivers/net/ixgbe/ixgbe_ethdev.c       |   43 +-
> >  19 files changed, 1360 insertions(+), 681 deletions(-)
> > 
> > --
> > 1.9.3
> Series-Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
> 

Applied to dpdk-next-net/rel_16_11

Thanks,
/Bruce

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

end of thread, other threads:[~2016-09-28 15:31 UTC | newest]

Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
2016-09-19 17:00   ` Ferruh Yigit
2016-09-22 15:58     ` Wang, Xiao W
2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 01/40] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 02/40] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 03/40] net/ixgbe/base: change endianness of PHY data Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 04/40] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 05/40] net/ixgbe/base: move vf_update_xcast_mode to base code Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 06/40] net/ixgbe/base: introduce new ops init functions Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 07/40] net/ixgbe/base: separate PHY probe code Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 08/40] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 09/40] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 10/40] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 11/40] net/ixgbe/base: add FC autoneg " Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 12/40] net/ixgbe/base: clear page register in error path Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 13/40] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 14/40] net/ixgbe/base: fix function comments about X550 Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 15/40] net/ixgbe/base: report setting LPE register error Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 16/40] net/ixgbe/base: bump mailbox version Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 17/40] net/ixgbe/base: access IOSF by host interface Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 18/40] net/ixgbe/base: fix check on NACK Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 19/40] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 20/40] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 21/40] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 22/40] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 23/40] net/ixgbe/base: add bound check in LED functions Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 24/40] net/ixgbe/base: use default check link function Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 25/40] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 26/40] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 27/40] net/ixgbe/base: commonize mailbox write and read Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 28/40] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 29/40] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 30/40] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 31/40] net/ixgbe/base: unify link speed value Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 32/40] net/ixgbe/base: separate ops init from PHY init Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 33/40] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 34/40] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 35/40] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 36/40] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 37/40] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 38/40] net/ixgbe/base: do not skip PHY configuration Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 39/40] net/ixgbe/base: clean up Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 40/40] net/ixgbe/base: add base driver update brief Xiao Wang
2016-09-26  2:06     ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Lu, Wenzhuo
2016-09-28 15:31       ` Bruce Richardson
2016-08-27 15:47 ` [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
2016-09-19 17:01   ` Ferruh Yigit
2016-08-27 15:47 ` [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data Xiao Wang
2016-09-19 17:01   ` Ferruh Yigit
2016-09-25  0:36     ` Wang, Xiao W
2016-08-27 15:47 ` [dpdk-dev] [PATCH 04/39] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous Xiao Wang
2016-09-19 17:05   ` Ferruh Yigit
2016-09-23  3:35     ` Wang, Xiao W
2016-08-27 15:47 ` [dpdk-dev] [PATCH 06/39] net/ixgbe/base: introduce new ops init functions Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 07/39] net/ixgbe/base: separate PHY probe code Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 08/39] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 09/39] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 10/39] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 11/39] net/ixgbe/base: add FC autoneg " Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 12/39] net/ixgbe/base: clear page register in error path Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 13/39] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 14/39] net/ixgbe/base: fix function comments about X550 Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 15/39] net/ixgbe/base: report setting LPE register error Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version Xiao Wang
2016-09-19 17:03   ` Ferruh Yigit
2016-09-23  3:50     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface Xiao Wang
2016-09-19 17:04   ` Ferruh Yigit
2016-09-23  5:16     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK Xiao Wang
2016-09-19 17:07   ` Ferruh Yigit
2016-09-23  6:05     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 19/39] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 20/39] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 21/39] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 22/39] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions Xiao Wang
2016-09-19 17:06   ` Ferruh Yigit
2016-09-22 16:08     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 24/39] net/ixgbe/base: use default check link function Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 25/39] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 26/39] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 27/39] net/ixgbe/base: commonize mailbox write and read Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 28/39] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
2016-09-19 17:07   ` Ferruh Yigit
2016-09-23  0:59     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 30/39] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 31/39] net/ixgbe/base: unify link speed value Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 32/39] net/ixgbe/base: separate ops init from PHY init Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
2016-09-19 17:07   ` Ferruh Yigit
2016-09-22  2:56     ` Lu, Wenzhuo
2016-09-23  6:47       ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 34/39] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
2016-09-19 17:08   ` Ferruh Yigit
2016-09-23  8:06     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 36/39] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 37/39] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 38/39] net/ixgbe/base: do not skip PHY configuration Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief Xiao Wang
2016-09-19 17:08   ` Ferruh Yigit
2016-09-22  2:55     ` Lu, Wenzhuo

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).