Commit 18760f1e74e8dfe8f30d4891e66163d1e6feb893

Authored by Chaitanya Lala
Committed by David S. Miller
1 parent edfea6e641

e1000e: Expose MDI-X status via ethtool change

Ethtool is a standard way of getting information about
ethernet interfaces.  We enhance ethtool kernel interface
& e1000e to make the MDI-X status readable via ethtool in
userspace.

Signed-off-by: Chaitanya Lala <clala@riverbed.com>
Signed-off-by: Arthur Jones <ajones@riverbed.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 16 additions and 1 deletions Side-by-side Diff

drivers/net/e1000e/ethtool.c
... ... @@ -167,6 +167,15 @@
167 167  
168 168 ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
169 169 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
  170 +
  171 + /* MDI-X => 2; MDI =>1; Invalid =>0 */
  172 + if ((hw->phy.media_type == e1000_media_type_copper) &&
  173 + !hw->mac.get_link_status)
  174 + ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X :
  175 + ETH_TP_MDI;
  176 + else
  177 + ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID;
  178 +
170 179 return 0;
171 180 }
172 181  
include/linux/ethtool.h
... ... @@ -30,7 +30,8 @@
30 30 __u32 maxtxpkt; /* Tx pkts before generating tx int */
31 31 __u32 maxrxpkt; /* Rx pkts before generating rx int */
32 32 __u16 speed_hi;
33   - __u16 reserved2;
  33 + __u8 eth_tp_mdix;
  34 + __u8 reserved2;
34 35 __u32 lp_advertising; /* Features the link partner advertises */
35 36 __u32 reserved[2];
36 37 };
... ... @@ -631,6 +632,11 @@
631 632 */
632 633 #define AUTONEG_DISABLE 0x00
633 634 #define AUTONEG_ENABLE 0x01
  635 +
  636 +/* Mode MDI or MDI-X */
  637 +#define ETH_TP_MDI_INVALID 0x00
  638 +#define ETH_TP_MDI 0x01
  639 +#define ETH_TP_MDI_X 0x02
634 640  
635 641 /* Wake-On-Lan options. */
636 642 #define WAKE_PHY (1 << 0)