Skip to contentSkip to conversation

ixgbe: add array of MAC type dependent values

PATCH New Don Skidmore 3 participants 4 messages May 18, 2015 – May 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: add array of MAC type dependent values

Some of the register addresses and format where unfortunately changed between MAC types. To get around this we add a const u32 *mvals pointer to the ixgbe_hw struct to point to an array of mac-type-dependent values. These can include register offsets, masks, whatever can be in a u32. When the ixgbe_hw struct is initialized, a pointer to the appropriate array must be set.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c   |    1 
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c   |    7 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c  |   59 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.h  |    2 
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |    6 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |   43 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c     |   44 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h    |  246 ++++++++++++++++++----
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c    |   41 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c    |   12 +
 10 files changed, 328 insertions(+), 133 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +1 -0
index 824a7ab..3f63065 100644
@@ -1234,4 +1234,5 @@ struct ixgbe_info ixgbe_82598_info = {
 	.mac_ops		= &mac_ops_82598,
 	.eeprom_ops		= &eeprom_ops_82598,
 	.phy_ops		= &phy_ops_82598,
+	.mvals			= ixgbe_mvals_8259X,
 };
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c +4 -3
index de83b6f..b1e364d 100644
@@ -71,7 +71,7 @@ bool ixgbe_mng_enabled(struct ixgbe_hw *hw)
 {
 	u32 fwsm, manc, factps;
 
-	fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM);
+	fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw));
 	if ((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT)
 		return false;
 
@@ -79,7 +79,7 @@ bool ixgbe_mng_enabled(struct ixgbe_hw *hw)
 	if (!(manc & IXGBE_MANC_RCV_TCO_EN))
 		return false;
 
-	factps = IXGBE_READ_REG(hw, IXGBE_FACTPS);
+	factps = IXGBE_READ_REG(hw, IXGBE_FACTPS(hw));
 	if (factps & IXGBE_FACTPS_MNGCG)
 		return false;
 
@@ -510,7 +510,7 @@ static void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw)
 	hw->eeprom.ops.read(hw, IXGBE_EEPROM_CTRL_2, &ee_ctrl_2);
 
 	/* Check to see if MNG FW could be enabled */
-	fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM);
+	fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw));
 
 	if (((fwsm & IXGBE_FWSM_MODE_MASK) != IXGBE_FWSM_FW_MODE_PT) &&
 	    !hw->wol_enabled &&
@@ -2376,4 +2376,5 @@ struct ixgbe_info ixgbe_82599_info = {
 	.eeprom_ops             = &eeprom_ops_82599,
 	.phy_ops                = &phy_ops_82599,
 	.mbx_ops                = &mbx_ops_generic,
+	.mvals			= ixgbe_mvals_8259X,
 };
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +32 -27

204 lines not on this page · raw message

drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +2 -0
index f21f8a1..ec015fe 100644
@@ -118,6 +118,8 @@ bool ixgbe_mng_enabled(struct ixgbe_hw *hw);
 void ixgbe_set_rxpba_generic(struct ixgbe_hw *hw, int num_pb,
 			     u32 headroom, int strategy);
 
+extern const u32 ixgbe_mvals_8259X[IXGBE_MVALS_IDX_LIMIT];
+
 #define IXGBE_I2C_THERMAL_SENSOR_ADDR	0xF8
 #define IXGBE_EMC_INTERNAL_DATA		0x00
 #define IXGBE_EMC_INTERNAL_THERM_LIMIT	0x20
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +3 -3
index 0f1bff3..1701a3b 100644
@@ -470,16 +470,16 @@ static void ixgbe_get_regs(struct net_device *netdev,
 	regs_buff[7] = IXGBE_READ_REG(hw, IXGBE_TCPTIMER);
 
 	/* NVM Register */
-	regs_buff[8] = IXGBE_READ_REG(hw, IXGBE_EEC);
+	regs_buff[8] = IXGBE_READ_REG(hw, IXGBE_EEC(hw));
 	regs_buff[9] = IXGBE_READ_REG(hw, IXGBE_EERD);
-	regs_buff[10] = IXGBE_READ_REG(hw, IXGBE_FLA);
+	regs_buff[10] = IXGBE_READ_REG(hw, IXGBE_FLA(hw));
 	regs_buff[11] = IXGBE_READ_REG(hw, IXGBE_EEMNGCTL);
 	regs_buff[12] = IXGBE_READ_REG(hw, IXGBE_EEMNGDATA);
 	regs_buff[13] = IXGBE_READ_REG(hw, IXGBE_FLMNGCTL);
 	regs_buff[14] = IXGBE_READ_REG(hw, IXGBE_FLMNGDATA);
 	regs_buff[15] = IXGBE_READ_REG(hw, IXGBE_FLMNGCNT);
 	regs_buff[16] = IXGBE_READ_REG(hw, IXGBE_FLOP);
-	regs_buff[17] = IXGBE_READ_REG(hw, IXGBE_GRC);
+	regs_buff[17] = IXGBE_READ_REG(hw, IXGBE_GRC(hw));
 
 	/* Interrupt */
 	/* don't read EICR because it can clear interrupt causes, instead
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +24 -19

137 lines not on this page · raw message

drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +22 -22

135 lines not on this page · raw message

drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +206 -40

343 lines not on this page · raw message

drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c +23 -18

125 lines not on this page · raw message

drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +11 -1
index b023698..aaf5d1a 100644
@@ -90,7 +90,7 @@ static s32 ixgbe_init_eeprom_params_X550(struct ixgbe_hw *hw)
 		eeprom->semaphore_delay = 10;
 		eeprom->type = ixgbe_flash;
 
-		eec = IXGBE_READ_REG(hw, IXGBE_EEC);
+		eec = IXGBE_READ_REG(hw, IXGBE_EEC(hw));
 		eeprom_size = (u16)((eec & IXGBE_EEC_SIZE) >>
 				    IXGBE_EEC_SIZE_SHIFT);
 		eeprom->word_size = 1 << (eeprom_size +
@@ -1541,6 +1541,14 @@ static struct ixgbe_phy_operations phy_ops_X550EM_x = {
 	.setup_link		= NULL, /* defined later */
 };
 
+static const u32 ixgbe_mvals_X550[IXGBE_MVALS_IDX_LIMIT] = {
+	IXGBE_MVALS_INIT(X550)
+};
+
+static const u32 ixgbe_mvals_X550EM_x[IXGBE_MVALS_IDX_LIMIT] = {
+	IXGBE_MVALS_INIT(X550EM_x)
+};
+
 struct ixgbe_info ixgbe_X550_info = {
 	.mac			= ixgbe_mac_X550,
 	.get_invariants		= &ixgbe_get_invariants_X540,
@@ -1548,6 +1556,7 @@ struct ixgbe_info ixgbe_X550_info = {
 	.eeprom_ops		= &eeprom_ops_X550,
 	.phy_ops		= &phy_ops_X550,
 	.mbx_ops		= &mbx_ops_generic,
+	.mvals			= ixgbe_mvals_X550,
 };
 
 struct ixgbe_info ixgbe_X550EM_x_info = {
@@ -1557,4 +1566,5 @@ struct ixgbe_info ixgbe_X550EM_x_info = {
 	.eeprom_ops		= &eeprom_ops_X550EM_x,
 	.phy_ops		= &phy_ops_X550EM_x,
 	.mbx_ops		= &mbx_ops_generic,
+	.mvals			= ixgbe_mvals_X550EM_x,
 };
#1 lore raw

PATCH 1/1 ixgbe: add array of MAC type dependent values

Quoted 9 lines · Don Skidmore

Some of the register addresses and format where unfortunately changed between MAC types. To get around this we add a const u32 *mvals pointer
to the ixgbe_hw struct to point to an array of mac-type-dependent values. These can include register offsets, masks, whatever can be in a u32. When the ixgbe_hw struct is initialized, a pointer to the appropriate array must be set.

Quoted 13 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c   |    1 
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c   |    7 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c  |   59 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.h  |    2 
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |    6 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |   43 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c     |   44 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h    |  246
++++++++++++++++++----
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c    |   41 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c    |   12 +
 10 files changed, 328 insertions(+), 133 deletions(-)

Not sure if there is a difference between this patch and the one you
send later today, so I am dropping this patch and will be looking to
apply your patch you sent later today. :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150518/8452b02e/attachment.asc>

#2 lore raw

PATCH 1/1 ixgbe: add array of MAC type dependent values

Quoted 31 lines

-----Original Message-----
From: Kirsher, Jeffrey T
Sent: Monday, May 18, 2015 3:52 PM
To: Skidmore, Donald C
Cc: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [net-next PATCH 2] ixgbe: add array of MAC type dependent values

Quoted 8 lines · Don Skidmore

Some of the register addresses and format where unfortunately changed between MAC types. To get around this we add a const u32 *mvals pointer to the ixgbe_hw struct to point to an array of mac-type-dependent values. These can include register offsets, masks, whatever can be in a u32. When the ixgbe_hw struct is initialized, a pointer to the appropriate array must be set.

Quoted 13 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c   |    1
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c   |    7 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c  |   59 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.h  |    2
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |    6 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |   43 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c     |   44 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h    |  246
++++++++++++++++++----
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c    |   41 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c    |   12 +
 10 files changed, 328 insertions(+), 133 deletions(-)
Quoted 3 lines

Not sure if there is a difference between this patch and the one you send later today, so I am dropping this patch and will be looking to apply your patch you sent later today. :-)

Sorry the earlier one wasn't up to date with you tree. I ended up not having to make any changes so I wasn't sure I should bump the version.

Thanks for cleaning it up.

#3 lore raw

PATCH 1/1 ixgbe: add array of MAC type dependent values

In reply to Jeff Kirsher
Quoted 34 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jeff Kirsher
Sent: Monday, May 18, 2015 3:52 PM
To: Skidmore, Donald C
Cc: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [net-next PATCH 2] ixgbe: add array of MAC type dependent values

Quoted 8 lines · Don Skidmore

Some of the register addresses and format where unfortunately changed between MAC types. To get around this we add a const u32 *mvals pointer to the ixgbe_hw struct to point to an array of mac-type-dependent values. These can include register offsets, masks, whatever can be in a u32. When the ixgbe_hw struct is initialized, a pointer to the appropriate array must be set.

Quoted 13 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c   |    1
 drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c   |    7 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c  |   59 +++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.h  |    2
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |    6 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c    |   43 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c     |   44 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_type.h    |  246
++++++++++++++++++----
 drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c    |   41 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c    |   12 +
 10 files changed, 328 insertions(+), 133 deletions(-)
Quoted 3 lines

Not sure if there is a difference between this patch and the one you send later today, so I am dropping this patch and will be looking to apply your patch you sent later today. :-)

Failing patch.
With patch applied, attempting to load ixgbe fails with:

[    3.277824] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 4.0.1-k
[    3.278207] ixgbe: Copyright (c) 1999-2014 Intel Corporation.
[   37.573935] ixgbe 0000:03:00.0 0000:03:00.0 (uninitialized): eeprom read at offset 40 failed
[   37.574324] ixgbe 0000:03:00.0 0000:03:00.0 (uninitialized): eeprom read at offset 39 failed
[   37.574711] ixgbe 0000:03:00.0: The EEPROM Checksum Is Not Valid
[   37.575023] ixgbe: probe of 0000:03:00.0 failed with error -5
[   71.864405] ixgbe 0000:03:00.1 0000:03:00.1 (uninitialized): eeprom read at offset 40 failed
[   71.864792] ixgbe 0000:03:00.1 0000:03:00.1 (uninitialized): eeprom read at offset 39 failed
[   71.865178] ixgbe 0000:03:00.1: The EEPROM Checksum Is Not Valid
[   71.865476] ixgbe: probe of 0000:03:00.1 failed with error -5

Thanks,
Phil