Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 203117
b: refs/heads/master
c: 0c6bdb3
h: refs/heads/master
i:
  203115: eb0c0a5
v: v3
  • Loading branch information
Bruce Allan authored and David S. Miller committed Jun 23, 2010
1 parent 0c04393 commit aa6e274
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69ad78208ecf4c392f3d323ed050423847c24104
refs/heads/master: 0c6bdb3084d015221270b418190b630553a38cf8
1 change: 0 additions & 1 deletion trunk/drivers/net/e1000e/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
extern void e1000e_update_stats(struct e1000_adapter *adapter);
extern bool e1000e_has_link(struct e1000_adapter *adapter);
extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
extern void e1000e_disable_aspm(struct pci_dev *pdev, u16 state);
Expand Down
54 changes: 28 additions & 26 deletions trunk/drivers/net/e1000e/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ static int e1000_get_settings(struct net_device *netdev,
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 status;

if (hw->phy.media_type == e1000_media_type_copper) {

Expand Down Expand Up @@ -156,30 +155,37 @@ static int e1000_get_settings(struct net_device *netdev,
ecmd->transceiver = XCVR_EXTERNAL;
}

status = er32(STATUS);
if (status & E1000_STATUS_LU) {
if (status & E1000_STATUS_SPEED_1000)
ecmd->speed = 1000;
else if (status & E1000_STATUS_SPEED_100)
ecmd->speed = 100;
else
ecmd->speed = 10;
ecmd->speed = -1;
ecmd->duplex = -1;

if (status & E1000_STATUS_FD)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
if (netif_running(netdev)) {
if (netif_carrier_ok(netdev)) {
ecmd->speed = adapter->link_speed;
ecmd->duplex = adapter->link_duplex - 1;
}
} else {
ecmd->speed = -1;
ecmd->duplex = -1;
u32 status = er32(STATUS);
if (status & E1000_STATUS_LU) {
if (status & E1000_STATUS_SPEED_1000)
ecmd->speed = 1000;
else if (status & E1000_STATUS_SPEED_100)
ecmd->speed = 100;
else
ecmd->speed = 10;

if (status & E1000_STATUS_FD)
ecmd->duplex = DUPLEX_FULL;
else
ecmd->duplex = DUPLEX_HALF;
}
}

ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;

/* MDI-X => 2; MDI =>1; Invalid =>0 */
if ((hw->phy.media_type == e1000_media_type_copper) &&
!hw->mac.get_link_status)
netif_carrier_ok(netdev))
ecmd->eth_tp_mdix = hw->phy.is_mdix ? ETH_TP_MDI_X :
ETH_TP_MDI;
else
Expand All @@ -191,19 +197,15 @@ static int e1000_get_settings(struct net_device *netdev,
static u32 e1000_get_link(struct net_device *netdev)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_mac_info *mac = &adapter->hw.mac;
struct e1000_hw *hw = &adapter->hw;

/*
* If the link is not reported up to netdev, interrupts are disabled,
* and so the physical link state may have changed since we last
* looked. Set get_link_status to make sure that the true link
* state is interrogated, rather than pulling a cached and possibly
* stale link state from the driver.
* Avoid touching hardware registers when possible, otherwise
* link negotiation can get messed up when user-level scripts
* are rapidly polling the driver to see if link is up.
*/
if (!netif_carrier_ok(netdev))
mac->get_link_status = 1;

return e1000e_has_link(adapter);
return netif_running(netdev) ? netif_carrier_ok(netdev) :
!!(er32(STATUS) & E1000_STATUS_LU);
}

static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3964,7 +3964,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" )));
}

bool e1000e_has_link(struct e1000_adapter *adapter)
static bool e1000e_has_link(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
bool link_active = 0;
Expand Down

0 comments on commit aa6e274

Please sign in to comment.