ixgbe: Revise populating few registers and macro definitions
authorPreethi Banala <preethi.banala@intel.com>
Thu, 21 Apr 2016 18:40:35 +0000 (11:40 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 4 May 2016 07:24:31 +0000 (00:24 -0700)
Revise populating few registers in ixgbe_get_regs() and macro
definitions.
Before applying patch:
$ du -k objs/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
8572    objs/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
After applying patch:
$ du -k objs/drivers/net/ethernet/intel/ixgbe/ixgbe.ko
8568    objs/drivers/net/ethernet/intel/ixgbe/ixgbe.ko

Signed-off-by: Preethi Banala <preethi.banala@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

index a696192..59b771b 100644 (file)
@@ -533,10 +533,8 @@ static void ixgbe_get_regs(struct net_device *netdev,
 
        /* Flow Control */
        regs_buff[30] = IXGBE_READ_REG(hw, IXGBE_PFCTOP);
-       regs_buff[31] = IXGBE_READ_REG(hw, IXGBE_FCTTV(0));
-       regs_buff[32] = IXGBE_READ_REG(hw, IXGBE_FCTTV(1));
-       regs_buff[33] = IXGBE_READ_REG(hw, IXGBE_FCTTV(2));
-       regs_buff[34] = IXGBE_READ_REG(hw, IXGBE_FCTTV(3));
+       for (i = 0; i < 4; i++)
+               regs_buff[31 + i] = IXGBE_READ_REG(hw, IXGBE_FCTTV(i));
        for (i = 0; i < 8; i++) {
                switch (hw->mac.type) {
                case ixgbe_mac_82598EB:
@@ -806,15 +804,11 @@ static void ixgbe_get_regs(struct net_device *netdev,
                regs_buff[1096 + i] = IXGBE_READ_REG(hw, IXGBE_TIC_DW(i));
        regs_buff[1100] = IXGBE_READ_REG(hw, IXGBE_TDPROBE);
        regs_buff[1101] = IXGBE_READ_REG(hw, IXGBE_TXBUFCTRL);
-       regs_buff[1102] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA0);
-       regs_buff[1103] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA1);
-       regs_buff[1104] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA2);
-       regs_buff[1105] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA3);
+       for (i = 0; i < 4; i++)
+               regs_buff[1102 + i] = IXGBE_READ_REG(hw, IXGBE_TXBUFDATA(i));
        regs_buff[1106] = IXGBE_READ_REG(hw, IXGBE_RXBUFCTRL);
-       regs_buff[1107] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA0);
-       regs_buff[1108] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA1);
-       regs_buff[1109] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA2);
-       regs_buff[1110] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA3);
+       for (i = 0; i < 4; i++)
+               regs_buff[1107 + i] = IXGBE_READ_REG(hw, IXGBE_RXBUFDATA(i));
        for (i = 0; i < 8; i++)
                regs_buff[1111 + i] = IXGBE_READ_REG(hw, IXGBE_PCIE_DIAG(i));
        regs_buff[1119] = IXGBE_READ_REG(hw, IXGBE_RFVAL);
index 1912f7e..cd6c1dd 100644 (file)
@@ -1060,15 +1060,9 @@ struct ixgbe_thermal_sensor_data {
 #define IXGBE_TIC_DW2(_i) (0x082B0 + ((_i) * 4))
 #define IXGBE_TDPROBE     0x07F20
 #define IXGBE_TXBUFCTRL   0x0C600
-#define IXGBE_TXBUFDATA0  0x0C610
-#define IXGBE_TXBUFDATA1  0x0C614
-#define IXGBE_TXBUFDATA2  0x0C618
-#define IXGBE_TXBUFDATA3  0x0C61C
+#define IXGBE_TXBUFDATA(_i) (0x0C610 + ((_i) * 4)) /* 4 of these (0-3) */
 #define IXGBE_RXBUFCTRL   0x03600
-#define IXGBE_RXBUFDATA0  0x03610
-#define IXGBE_RXBUFDATA1  0x03614
-#define IXGBE_RXBUFDATA2  0x03618
-#define IXGBE_RXBUFDATA3  0x0361C
+#define IXGBE_RXBUFDATA(_i) (0x03610 + ((_i) * 4)) /* 4 of these (0-3) */
 #define IXGBE_PCIE_DIAG(_i)     (0x11090 + ((_i) * 4)) /* 8 of these */
 #define IXGBE_RFVAL     0x050A4
 #define IXGBE_MDFTC1    0x042B8