Commit b6f40988 authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/jkirsher/net-next-2.6

parents 23624935 6493d24f
...@@ -364,6 +364,7 @@ struct e1000_adapter { ...@@ -364,6 +364,7 @@ struct e1000_adapter {
/* structs defined in e1000_hw.h */ /* structs defined in e1000_hw.h */
struct e1000_hw hw; struct e1000_hw hw;
spinlock_t stats64_lock;
struct e1000_hw_stats stats; struct e1000_hw_stats stats;
struct e1000_phy_info phy_info; struct e1000_phy_info phy_info;
struct e1000_phy_stats phy_stats; struct e1000_phy_stats phy_stats;
...@@ -494,7 +495,9 @@ extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter); ...@@ -494,7 +495,9 @@ extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter);
extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter); extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
extern void e1000e_free_rx_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_free_tx_resources(struct e1000_adapter *adapter);
extern void e1000e_update_stats(struct e1000_adapter *adapter); extern struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64
*stats);
extern void e1000e_set_interrupt_capability(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_reset_interrupt_capability(struct e1000_adapter *adapter);
extern void e1000e_get_hw_control(struct e1000_adapter *adapter); extern void e1000e_get_hw_control(struct e1000_adapter *adapter);
......
...@@ -46,15 +46,15 @@ struct e1000_stats { ...@@ -46,15 +46,15 @@ struct e1000_stats {
}; };
#define E1000_STAT(str, m) { \ #define E1000_STAT(str, m) { \
.stat_string = str, \ .stat_string = str, \
.type = E1000_STATS, \ .type = E1000_STATS, \
.sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \ .sizeof_stat = sizeof(((struct e1000_adapter *)0)->m), \
.stat_offset = offsetof(struct e1000_adapter, m) } .stat_offset = offsetof(struct e1000_adapter, m) }
#define E1000_NETDEV_STAT(str, m) { \ #define E1000_NETDEV_STAT(str, m) { \
.stat_string = str, \ .stat_string = str, \
.type = NETDEV_STATS, \ .type = NETDEV_STATS, \
.sizeof_stat = sizeof(((struct net_device *)0)->m), \ .sizeof_stat = sizeof(((struct rtnl_link_stats64 *)0)->m), \
.stat_offset = offsetof(struct net_device, m) } .stat_offset = offsetof(struct rtnl_link_stats64, m) }
static const struct e1000_stats e1000_gstrings_stats[] = { static const struct e1000_stats e1000_gstrings_stats[] = {
E1000_STAT("rx_packets", stats.gprc), E1000_STAT("rx_packets", stats.gprc),
...@@ -65,21 +65,21 @@ static const struct e1000_stats e1000_gstrings_stats[] = { ...@@ -65,21 +65,21 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
E1000_STAT("tx_broadcast", stats.bptc), E1000_STAT("tx_broadcast", stats.bptc),
E1000_STAT("rx_multicast", stats.mprc), E1000_STAT("rx_multicast", stats.mprc),
E1000_STAT("tx_multicast", stats.mptc), E1000_STAT("tx_multicast", stats.mptc),
E1000_NETDEV_STAT("rx_errors", stats.rx_errors), E1000_NETDEV_STAT("rx_errors", rx_errors),
E1000_NETDEV_STAT("tx_errors", stats.tx_errors), E1000_NETDEV_STAT("tx_errors", tx_errors),
E1000_NETDEV_STAT("tx_dropped", stats.tx_dropped), E1000_NETDEV_STAT("tx_dropped", tx_dropped),
E1000_STAT("multicast", stats.mprc), E1000_STAT("multicast", stats.mprc),
E1000_STAT("collisions", stats.colc), E1000_STAT("collisions", stats.colc),
E1000_NETDEV_STAT("rx_length_errors", stats.rx_length_errors), E1000_NETDEV_STAT("rx_length_errors", rx_length_errors),
E1000_NETDEV_STAT("rx_over_errors", stats.rx_over_errors), E1000_NETDEV_STAT("rx_over_errors", rx_over_errors),
E1000_STAT("rx_crc_errors", stats.crcerrs), E1000_STAT("rx_crc_errors", stats.crcerrs),
E1000_NETDEV_STAT("rx_frame_errors", stats.rx_frame_errors), E1000_NETDEV_STAT("rx_frame_errors", rx_frame_errors),
E1000_STAT("rx_no_buffer_count", stats.rnbc), E1000_STAT("rx_no_buffer_count", stats.rnbc),
E1000_STAT("rx_missed_errors", stats.mpc), E1000_STAT("rx_missed_errors", stats.mpc),
E1000_STAT("tx_aborted_errors", stats.ecol), E1000_STAT("tx_aborted_errors", stats.ecol),
E1000_STAT("tx_carrier_errors", stats.tncrs), E1000_STAT("tx_carrier_errors", stats.tncrs),
E1000_NETDEV_STAT("tx_fifo_errors", stats.tx_fifo_errors), E1000_NETDEV_STAT("tx_fifo_errors", tx_fifo_errors),
E1000_NETDEV_STAT("tx_heartbeat_errors", stats.tx_heartbeat_errors), E1000_NETDEV_STAT("tx_heartbeat_errors", tx_heartbeat_errors),
E1000_STAT("tx_window_errors", stats.latecol), E1000_STAT("tx_window_errors", stats.latecol),
E1000_STAT("tx_abort_late_coll", stats.latecol), E1000_STAT("tx_abort_late_coll", stats.latecol),
E1000_STAT("tx_deferred_ok", stats.dc), E1000_STAT("tx_deferred_ok", stats.dc),
...@@ -684,20 +684,13 @@ static int e1000_set_ringparam(struct net_device *netdev, ...@@ -684,20 +684,13 @@ static int e1000_set_ringparam(struct net_device *netdev,
rx_old = adapter->rx_ring; rx_old = adapter->rx_ring;
err = -ENOMEM; err = -ENOMEM;
tx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); tx_ring = kmemdup(tx_old, sizeof(struct e1000_ring), GFP_KERNEL);
if (!tx_ring) if (!tx_ring)
goto err_alloc_tx; goto err_alloc_tx;
/*
* use a memcpy to save any previously configured
* items like napi structs from having to be
* reinitialized
*/
memcpy(tx_ring, tx_old, sizeof(struct e1000_ring));
rx_ring = kzalloc(sizeof(struct e1000_ring), GFP_KERNEL); rx_ring = kmemdup(rx_old, sizeof(struct e1000_ring), GFP_KERNEL);
if (!rx_ring) if (!rx_ring)
goto err_alloc_rx; goto err_alloc_rx;
memcpy(rx_ring, rx_old, sizeof(struct e1000_ring));
adapter->tx_ring = tx_ring; adapter->tx_ring = tx_ring;
adapter->rx_ring = rx_ring; adapter->rx_ring = rx_ring;
...@@ -1255,7 +1248,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) ...@@ -1255,7 +1248,6 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 ctrl_reg = 0; u32 ctrl_reg = 0;
u32 stat_reg = 0;
u16 phy_reg = 0; u16 phy_reg = 0;
s32 ret_val = 0; s32 ret_val = 0;
...@@ -1363,8 +1355,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter) ...@@ -1363,8 +1355,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
* Set the ILOS bit on the fiber Nic if half duplex link is * Set the ILOS bit on the fiber Nic if half duplex link is
* detected. * detected.
*/ */
stat_reg = er32(STATUS); if ((er32(STATUS) & E1000_STATUS_FD) == 0)
if ((stat_reg & E1000_STATUS_FD) == 0)
ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU); ctrl_reg |= (E1000_CTRL_ILOS | E1000_CTRL_SLU);
} }
...@@ -1982,14 +1973,15 @@ static void e1000_get_ethtool_stats(struct net_device *netdev, ...@@ -1982,14 +1973,15 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
u64 *data) u64 *data)
{ {
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct rtnl_link_stats64 net_stats;
int i; int i;
char *p = NULL; char *p = NULL;
e1000e_update_stats(adapter); e1000e_get_stats64(netdev, &net_stats);
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
switch (e1000_gstrings_stats[i].type) { switch (e1000_gstrings_stats[i].type) {
case NETDEV_STATS: case NETDEV_STATS:
p = (char *) netdev + p = (char *) &net_stats +
e1000_gstrings_stats[i].stat_offset; e1000_gstrings_stats[i].stat_offset;
break; break;
case E1000_STATS: case E1000_STATS:
......
...@@ -2104,7 +2104,6 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) ...@@ -2104,7 +2104,6 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
{ {
union ich8_hws_flash_status hsfsts; union ich8_hws_flash_status hsfsts;
s32 ret_val = -E1000_ERR_NVM; s32 ret_val = -E1000_ERR_NVM;
s32 i = 0;
hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
...@@ -2140,6 +2139,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw) ...@@ -2140,6 +2139,8 @@ static s32 e1000_flash_cycle_init_ich8lan(struct e1000_hw *hw)
ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval); ew16flash(ICH_FLASH_HSFSTS, hsfsts.regval);
ret_val = 0; ret_val = 0;
} else { } else {
s32 i = 0;
/* /*
* Otherwise poll for sometime so the current * Otherwise poll for sometime so the current
* cycle has a chance to end before giving up. * cycle has a chance to end before giving up.
......
...@@ -1978,15 +1978,15 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw) ...@@ -1978,15 +1978,15 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
{ {
struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_nvm_info *nvm = &hw->nvm;
u32 eecd = er32(EECD); u32 eecd = er32(EECD);
u16 timeout = 0;
u8 spi_stat_reg; u8 spi_stat_reg;
if (nvm->type == e1000_nvm_eeprom_spi) { if (nvm->type == e1000_nvm_eeprom_spi) {
u16 timeout = NVM_MAX_RETRY_SPI;
/* Clear SK and CS */ /* Clear SK and CS */
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
ew32(EECD, eecd); ew32(EECD, eecd);
udelay(1); udelay(1);
timeout = NVM_MAX_RETRY_SPI;
/* /*
* Read "Status Register" repeatedly until the LSB is cleared. * Read "Status Register" repeatedly until the LSB is cleared.
......
...@@ -900,8 +900,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, ...@@ -900,8 +900,6 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
adapter->total_rx_bytes += total_rx_bytes; adapter->total_rx_bytes += total_rx_bytes;
adapter->total_rx_packets += total_rx_packets; adapter->total_rx_packets += total_rx_packets;
netdev->stats.rx_bytes += total_rx_bytes;
netdev->stats.rx_packets += total_rx_packets;
return cleaned; return cleaned;
} }
...@@ -1057,8 +1055,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) ...@@ -1057,8 +1055,6 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
} }
adapter->total_tx_bytes += total_tx_bytes; adapter->total_tx_bytes += total_tx_bytes;
adapter->total_tx_packets += total_tx_packets; adapter->total_tx_packets += total_tx_packets;
netdev->stats.tx_bytes += total_tx_bytes;
netdev->stats.tx_packets += total_tx_packets;
return count < tx_ring->count; return count < tx_ring->count;
} }
...@@ -1245,8 +1241,6 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, ...@@ -1245,8 +1241,6 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
adapter->total_rx_bytes += total_rx_bytes; adapter->total_rx_bytes += total_rx_bytes;
adapter->total_rx_packets += total_rx_packets; adapter->total_rx_packets += total_rx_packets;
netdev->stats.rx_bytes += total_rx_bytes;
netdev->stats.rx_packets += total_rx_packets;
return cleaned; return cleaned;
} }
...@@ -1426,8 +1420,6 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, ...@@ -1426,8 +1420,6 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
adapter->total_rx_bytes += total_rx_bytes; adapter->total_rx_bytes += total_rx_bytes;
adapter->total_rx_packets += total_rx_packets; adapter->total_rx_packets += total_rx_packets;
netdev->stats.rx_bytes += total_rx_bytes;
netdev->stats.rx_packets += total_rx_packets;
return cleaned; return cleaned;
} }
...@@ -2728,7 +2720,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) ...@@ -2728,7 +2720,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 rctl, rfctl; u32 rctl, rfctl;
u32 psrctl = 0;
u32 pages = 0; u32 pages = 0;
/* Workaround Si errata on 82579 - configure jumbo frame flow */ /* Workaround Si errata on 82579 - configure jumbo frame flow */
...@@ -2827,6 +2818,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) ...@@ -2827,6 +2818,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
adapter->rx_ps_pages = 0; adapter->rx_ps_pages = 0;
if (adapter->rx_ps_pages) { if (adapter->rx_ps_pages) {
u32 psrctl = 0;
/* Configure extra packet-split registers */ /* Configure extra packet-split registers */
rfctl = er32(RFCTL); rfctl = er32(RFCTL);
rfctl |= E1000_RFCTL_EXTEN; rfctl |= E1000_RFCTL_EXTEN;
...@@ -3028,7 +3021,6 @@ static void e1000_set_multi(struct net_device *netdev) ...@@ -3028,7 +3021,6 @@ static void e1000_set_multi(struct net_device *netdev)
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u8 *mta_list; u8 *mta_list;
u32 rctl; u32 rctl;
int i;
/* Check for Promiscuous and All Multicast modes */ /* Check for Promiscuous and All Multicast modes */
...@@ -3051,12 +3043,13 @@ static void e1000_set_multi(struct net_device *netdev) ...@@ -3051,12 +3043,13 @@ static void e1000_set_multi(struct net_device *netdev)
ew32(RCTL, rctl); ew32(RCTL, rctl);
if (!netdev_mc_empty(netdev)) { if (!netdev_mc_empty(netdev)) {
int i = 0;
mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
if (!mta_list) if (!mta_list)
return; return;
/* prepare a packed array of only addresses. */ /* prepare a packed array of only addresses. */
i = 0;
netdev_for_each_mc_addr(ha, netdev) netdev_for_each_mc_addr(ha, netdev)
memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN); memcpy(mta_list + (i++ * ETH_ALEN), ha->addr, ETH_ALEN);
...@@ -3338,6 +3331,8 @@ int e1000e_up(struct e1000_adapter *adapter) ...@@ -3338,6 +3331,8 @@ int e1000e_up(struct e1000_adapter *adapter)
return 0; return 0;
} }
static void e1000e_update_stats(struct e1000_adapter *adapter);
void e1000e_down(struct e1000_adapter *adapter) void e1000e_down(struct e1000_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
...@@ -3372,6 +3367,11 @@ void e1000e_down(struct e1000_adapter *adapter) ...@@ -3372,6 +3367,11 @@ void e1000e_down(struct e1000_adapter *adapter)
del_timer_sync(&adapter->phy_info_timer); del_timer_sync(&adapter->phy_info_timer);
netif_carrier_off(netdev); netif_carrier_off(netdev);
spin_lock(&adapter->stats64_lock);
e1000e_update_stats(adapter);
spin_unlock(&adapter->stats64_lock);
adapter->link_speed = 0; adapter->link_speed = 0;
adapter->link_duplex = 0; adapter->link_duplex = 0;
...@@ -3413,6 +3413,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter) ...@@ -3413,6 +3413,8 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
spin_lock_init(&adapter->stats64_lock);
e1000e_set_interrupt_capability(adapter); e1000e_set_interrupt_capability(adapter);
if (e1000_alloc_queues(adapter)) if (e1000_alloc_queues(adapter))
...@@ -3886,7 +3888,7 @@ static void e1000e_update_phy_stats(struct e1000_adapter *adapter) ...@@ -3886,7 +3888,7 @@ static void e1000e_update_phy_stats(struct e1000_adapter *adapter)
* e1000e_update_stats - Update the board statistics counters * e1000e_update_stats - Update the board statistics counters
* @adapter: board private structure * @adapter: board private structure
**/ **/
void e1000e_update_stats(struct e1000_adapter *adapter) static void e1000e_update_stats(struct e1000_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
...@@ -3998,10 +4000,11 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter) ...@@ -3998,10 +4000,11 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct e1000_phy_regs *phy = &adapter->phy_regs; struct e1000_phy_regs *phy = &adapter->phy_regs;
int ret_val;
if ((er32(STATUS) & E1000_STATUS_LU) && if ((er32(STATUS) & E1000_STATUS_LU) &&
(adapter->hw.phy.media_type == e1000_media_type_copper)) { (adapter->hw.phy.media_type == e1000_media_type_copper)) {
int ret_val;
ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr); ret_val = e1e_rphy(hw, PHY_CONTROL, &phy->bmcr);
ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr); ret_val |= e1e_rphy(hw, PHY_STATUS, &phy->bmsr);
ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise); ret_val |= e1e_rphy(hw, PHY_AUTONEG_ADV, &phy->advertise);
...@@ -4147,7 +4150,6 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -4147,7 +4150,6 @@ static void e1000_watchdog_task(struct work_struct *work)
struct e1000_ring *tx_ring = adapter->tx_ring; struct e1000_ring *tx_ring = adapter->tx_ring;
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 link, tctl; u32 link, tctl;
int tx_pending = 0;
link = e1000e_has_link(adapter); link = e1000e_has_link(adapter);
if ((netif_carrier_ok(netdev)) && link) { if ((netif_carrier_ok(netdev)) && link) {
...@@ -4285,7 +4287,9 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -4285,7 +4287,9 @@ static void e1000_watchdog_task(struct work_struct *work)
} }
link_up: link_up:
spin_lock(&adapter->stats64_lock);
e1000e_update_stats(adapter); e1000e_update_stats(adapter);
spin_unlock(&adapter->stats64_lock);
mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old; mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
adapter->tpt_old = adapter->stats.tpt; adapter->tpt_old = adapter->stats.tpt;
...@@ -4299,21 +4303,18 @@ static void e1000_watchdog_task(struct work_struct *work) ...@@ -4299,21 +4303,18 @@ static void e1000_watchdog_task(struct work_struct *work)
e1000e_update_adaptive(&adapter->hw); e1000e_update_adaptive(&adapter->hw);
if (!netif_carrier_ok(netdev)) { if (!netif_carrier_ok(netdev) &&
tx_pending = (e1000_desc_unused(tx_ring) + 1 < (e1000_desc_unused(tx_ring) + 1 < tx_ring->count)) {
tx_ring->count); /*
if (tx_pending) { * We've lost link, so the controller stops DMA,
/* * but we've got queued Tx work that's never going
* We've lost link, so the controller stops DMA, * to get done, so reset controller to flush Tx.
* but we've got queued Tx work that's never going * (Do the reset outside of interrupt context).
* to get done, so reset controller to flush Tx. */
* (Do the reset outside of interrupt context). adapter->tx_timeout_count++;
*/ schedule_work(&adapter->reset_task);
adapter->tx_timeout_count++; /* return immediately since reset is imminent */
schedule_work(&adapter->reset_task); return;
/* return immediately since reset is imminent */
return;
}
} }
/* Simple mode for Interrupt Throttle Rate (ITR) */ /* Simple mode for Interrupt Throttle Rate (ITR) */
...@@ -4384,13 +4385,13 @@ static int e1000_tso(struct e1000_adapter *adapter, ...@@ -4384,13 +4385,13 @@ static int e1000_tso(struct e1000_adapter *adapter,
u32 cmd_length = 0; u32 cmd_length = 0;
u16 ipcse = 0, tucse, mss; u16 ipcse = 0, tucse, mss;
u8 ipcss, ipcso, tucss, tucso, hdr_len; u8 ipcss, ipcso, tucss, tucso, hdr_len;
int err;
if (!skb_is_gso(skb)) if (!skb_is_gso(skb))
return 0; return 0;
if (skb_header_cloned(skb)) { if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); int err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (err) if (err)
return err; return err;
} }
...@@ -4897,16 +4898,55 @@ static void e1000_reset_task(struct work_struct *work) ...@@ -4897,16 +4898,55 @@ static void e1000_reset_task(struct work_struct *work)
} }
/** /**
* e1000_get_stats - Get System Network Statistics * e1000_get_stats64 - Get System Network Statistics
* @netdev: network interface device structure * @netdev: network interface device structure
* @stats: rtnl_link_stats64 pointer
* *
* Returns the address of the device statistics structure. * Returns the address of the device statistics structure.
* The statistics are actually updated from the timer callback.
**/ **/
static struct net_device_stats *e1000_get_stats(struct net_device *netdev) struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *stats)
{ {
/* only return the current stats */ struct e1000_adapter *adapter = netdev_priv(netdev);
return &netdev->stats;
memset(stats, 0, sizeof(struct rtnl_link_stats64));
spin_lock(&adapter->stats64_lock);
e1000e_update_stats(adapter);
/* Fill out the OS statistics structure */
stats->rx_bytes = adapter->stats.gorc;
stats->rx_packets = adapter->stats.gprc;
stats->tx_bytes = adapter->stats.gotc;
stats->tx_packets = adapter->stats.gptc;
stats->multicast = adapter->stats.mprc;
stats->collisions = adapter->stats.colc;
/* Rx Errors */
/*
* RLEC on some newer hardware can be incorrect so build
* our own version based on RUC and ROC
*/
stats->rx_errors = adapter->stats.rxerrc +
adapter->stats.crcerrs + adapter->stats.algnerrc +
adapter->stats.ruc + adapter->stats.roc +
adapter->stats.cexterr;
stats->rx_length_errors = adapter->stats.ruc +
adapter->stats.roc;
stats->rx_crc_errors = adapter->stats.crcerrs;
stats->rx_frame_errors = adapter->stats.algnerrc;
stats->rx_missed_errors = adapter->stats.mpc;
/* Tx Errors */
stats->tx_errors = adapter->stats.ecol +
adapter->stats.latecol;
stats->tx_aborted_errors = adapter->stats.ecol;
stats->tx_window_errors = adapter->stats.latecol;
stats->tx_carrier_errors = adapter->stats.tncrs;
/* Tx Dropped needs to be maintained elsewhere */
spin_unlock(&adapter->stats64_lock);
return stats;
} }
/** /**
...@@ -5476,9 +5516,10 @@ static irqreturn_t e1000_intr_msix(int irq, void *data) ...@@ -5476,9 +5516,10 @@ static irqreturn_t e1000_intr_msix(int irq, void *data)
{ {
struct net_device *netdev = data; struct net_device *netdev = data;
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
int vector, msix_irq;
if (adapter->msix_entries) { if (adapter->msix_entries) {
int vector, msix_irq;
vector = 0; vector = 0;
msix_irq = adapter->msix_entries[vector].vector; msix_irq = adapter->msix_entries[vector].vector;
disable_irq(msix_irq); disable_irq(msix_irq);
...@@ -5675,7 +5716,7 @@ static const struct net_device_ops e1000e_netdev_ops = { ...@@ -5675,7 +5716,7 @@ static const struct net_device_ops e1000e_netdev_ops = {
.ndo_open = e1000_open, .ndo_open = e1000_open,
.ndo_stop = e1000_close, .ndo_stop = e1000_close,
.ndo_start_xmit = e1000_xmit_frame, .ndo_start_xmit = e1000_xmit_frame,
.ndo_get_stats = e1000_get_stats, .ndo_get_stats64 = e1000e_get_stats64,
.ndo_set_multicast_list = e1000_set_multi, .ndo_set_multicast_list = e1000_set_multi,
.ndo_set_mac_address = e1000_set_mac, .ndo_set_mac_address = e1000_set_mac,
.ndo_change_mtu = e1000_change_mtu, .ndo_change_mtu = e1000_change_mtu,
......
...@@ -2409,9 +2409,7 @@ static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg) ...@@ -2409,9 +2409,7 @@ static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg)
s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
{ {
s32 ret_val; s32 ret_val;
u32 page_select = 0;
u32 page = offset >> IGP_PAGE_SHIFT; u32 page = offset >> IGP_PAGE_SHIFT;
u32 page_shift = 0;
ret_val = hw->phy.ops.acquire(hw); ret_val = hw->phy.ops.acquire(hw);
if (ret_val) if (ret_val)
...@@ -2427,6 +2425,8 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) ...@@ -2427,6 +2425,8 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
u32 page_shift, page_select;
/* /*
* Page select is register 31 for phy address 1 and 22 for * Page select is register 31 for phy address 1 and 22 for
* phy address 2 and 3. Page select is shifted only for * phy address 2 and 3. Page select is shifted only for
...@@ -2468,9 +2468,7 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data) ...@@ -2468,9 +2468,7 @@ s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data)
s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
{ {
s32 ret_val; s32 ret_val;
u32 page_select = 0;
u32 page = offset >> IGP_PAGE_SHIFT; u32 page = offset >> IGP_PAGE_SHIFT;
u32 page_shift = 0;
ret_val = hw->phy.ops.acquire(hw); ret_val = hw->phy.ops.acquire(hw);
if (ret_val) if (ret_val)
...@@ -2486,6 +2484,8 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data) ...@@ -2486,6 +2484,8 @@ s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data)
hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset); hw->phy.addr = e1000_get_phy_addr_for_bm_page(page, offset);
if (offset > MAX_PHY_MULTI_PAGE_REG) { if (offset > MAX_PHY_MULTI_PAGE_REG) {
u32 page_shift, page_select;
/* /*
* Page select is register 31 for phy address 1 and 22 for * Page select is register 31 for phy address 1 and 22 for
* phy address 2 and 3. Page select is shifted only for * phy address 2 and 3. Page select is shifted only for
......
...@@ -129,6 +129,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) ...@@ -129,6 +129,7 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
break; break;
case E1000_DEV_ID_82580_COPPER: case E1000_DEV_ID_82580_COPPER:
case E1000_DEV_ID_82580_FIBER: case E1000_DEV_ID_82580_FIBER:
case E1000_DEV_ID_82580_QUAD_FIBER:
case E1000_DEV_ID_82580_SERDES: case E1000_DEV_ID_82580_SERDES:
case E1000_DEV_ID_82580_SGMII: case E1000_DEV_ID_82580_SGMII:
case E1000_DEV_ID_82580_COPPER_DUAL: case E1000_DEV_ID_82580_COPPER_DUAL:
......
...@@ -54,6 +54,7 @@ struct e1000_hw; ...@@ -54,6 +54,7 @@ struct e1000_hw;
#define E1000_DEV_ID_82580_SERDES 0x1510 #define E1000_DEV_ID_82580_SERDES 0x1510
#define E1000_DEV_ID_82580_SGMII 0x1511 #define E1000_DEV_ID_82580_SGMII 0x1511
#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516 #define E1000_DEV_ID_82580_COPPER_DUAL 0x1516
#define E1000_DEV_ID_82580_QUAD_FIBER 0x1527
#define E1000_DEV_ID_DH89XXCC_SGMII 0x0438 #define E1000_DEV_ID_DH89XXCC_SGMII 0x0438
#define E1000_DEV_ID_DH89XXCC_SERDES 0x043A #define E1000_DEV_ID_DH89XXCC_SERDES 0x043A
#define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C #define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C
......
...@@ -68,6 +68,7 @@ static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = { ...@@ -68,6 +68,7 @@ static DEFINE_PCI_DEVICE_TABLE(igb_pci_tbl) = {
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SGMII), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_I350_SGMII), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_FIBER), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_QUAD_FIBER), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SERDES), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SERDES), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SGMII), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_SGMII), board_82575 },
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_82580_COPPER_DUAL), board_82575 },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment