Commit 89de8706 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.davemloft.net:/disk1/BK/tg3-2.6

into kernel.bkbits.net:/home/davem/tg3-2.6
parents 51f17423 d6918859
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.4" #define DRV_MODULE_VERSION "3.5"
#define DRV_MODULE_RELDATE "May 14, 2004" #define DRV_MODULE_RELDATE "May 25, 2004"
#define TG3_DEF_MAC_MODE 0 #define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0 #define TG3_DEF_RX_MODE 0
...@@ -128,7 +128,8 @@ ...@@ -128,7 +128,8 @@
/* minimum number of free TX descriptors required to wake up TX process */ /* minimum number of free TX descriptors required to wake up TX process */
#define TG3_TX_WAKEUP_THRESH (TG3_TX_RING_SIZE / 4) #define TG3_TX_WAKEUP_THRESH (TG3_TX_RING_SIZE / 4)
#define TG3_NUM_STATS 25 /* number of ETHTOOL_GSTATS u64's */ /* number of ETHTOOL_GSTATS u64's */
#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64))
static char version[] __devinitdata = static char version[] __devinitdata =
DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
...@@ -216,10 +217,13 @@ MODULE_DEVICE_TABLE(pci, tg3_pci_tbl); ...@@ -216,10 +217,13 @@ MODULE_DEVICE_TABLE(pci, tg3_pci_tbl);
struct { struct {
char string[ETH_GSTRING_LEN]; char string[ETH_GSTRING_LEN];
} ethtool_stats_keys[TG3_NUM_STATS] = { } ethtool_stats_keys[TG3_NUM_STATS] = {
{ "rx_octets" },
{ "rx_fragments" }, { "rx_fragments" },
{ "rx_ucast_packets" }, { "rx_ucast_packets" },
{ "rx_mcast_packets" },
{ "rx_bcast_packets" }, { "rx_bcast_packets" },
{ "rx_fcs_errors" }, { "rx_fcs_errors" },
{ "rx_align_errors" },
{ "rx_xon_pause_rcvd" }, { "rx_xon_pause_rcvd" },
{ "rx_xoff_pause_rcvd" }, { "rx_xoff_pause_rcvd" },
{ "rx_mac_ctrl_rcvd" }, { "rx_mac_ctrl_rcvd" },
...@@ -229,6 +233,19 @@ struct { ...@@ -229,6 +233,19 @@ struct {
{ "rx_undersize_packets" }, { "rx_undersize_packets" },
{ "rx_in_length_errors" }, { "rx_in_length_errors" },
{ "rx_out_length_errors" }, { "rx_out_length_errors" },
{ "rx_64_or_less_octet_packets" },
{ "rx_65_to_127_octet_packets" },
{ "rx_128_to_255_octet_packets" },
{ "rx_256_to_511_octet_packets" },
{ "rx_512_to_1023_octet_packets" },
{ "rx_1024_to_1522_octet_packets" },
{ "rx_1523_to_2047_octet_packets" },
{ "rx_2048_to_4095_octet_packets" },
{ "rx_4096_to_8191_octet_packets" },
{ "rx_8192_to_9022_octet_packets" },
{ "tx_octets" },
{ "tx_collisions" },
{ "tx_xon_sent" }, { "tx_xon_sent" },
{ "tx_xoff_sent" }, { "tx_xoff_sent" },
...@@ -239,9 +256,43 @@ struct { ...@@ -239,9 +256,43 @@ struct {
{ "tx_deferred" }, { "tx_deferred" },
{ "tx_excessive_collisions" }, { "tx_excessive_collisions" },
{ "tx_late_collisions" }, { "tx_late_collisions" },
{ "tx_collide_2times" },
{ "tx_collide_3times" },
{ "tx_collide_4times" },
{ "tx_collide_5times" },
{ "tx_collide_6times" },
{ "tx_collide_7times" },
{ "tx_collide_8times" },
{ "tx_collide_9times" },
{ "tx_collide_10times" },
{ "tx_collide_11times" },
{ "tx_collide_12times" },
{ "tx_collide_13times" },
{ "tx_collide_14times" },
{ "tx_collide_15times" },
{ "tx_ucast_packets" }, { "tx_ucast_packets" },
{ "tx_mcast_packets" }, { "tx_mcast_packets" },
{ "tx_bcast_packets" } { "tx_bcast_packets" },
{ "tx_carrier_sense_errors" },
{ "tx_discards" },
{ "tx_errors" },
{ "dma_writeq_full" },
{ "dma_write_prioq_full" },
{ "rxbds_empty" },
{ "rx_discards" },
{ "rx_errors" },
{ "rx_threshold_hit" },
{ "dma_readq_full" },
{ "dma_read_prioq_full" },
{ "tx_comp_queue_full" },
{ "ring_set_send_prod_index" },
{ "ring_status_update" },
{ "nic_irqs" },
{ "nic_avoided_irqs" },
{ "nic_tx_threshold_hit" }
}; };
static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val) static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
...@@ -1053,6 +1104,8 @@ static void tg3_link_report(struct tg3 *tp) ...@@ -1053,6 +1104,8 @@ static void tg3_link_report(struct tg3 *tp)
static void tg3_setup_flow_control(struct tg3 *tp, u32 local_adv, u32 remote_adv) static void tg3_setup_flow_control(struct tg3 *tp, u32 local_adv, u32 remote_adv)
{ {
u32 new_tg3_flags = 0; u32 new_tg3_flags = 0;
u32 old_rx_mode = tp->rx_mode;
u32 old_tx_mode = tp->tx_mode;
if (local_adv & ADVERTISE_PAUSE_CAP) { if (local_adv & ADVERTISE_PAUSE_CAP) {
if (local_adv & ADVERTISE_PAUSE_ASYM) { if (local_adv & ADVERTISE_PAUSE_ASYM) {
...@@ -1083,10 +1136,18 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 local_adv, u32 remote_adv ...@@ -1083,10 +1136,18 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 local_adv, u32 remote_adv
else else
tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE; tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE;
if (old_rx_mode != tp->rx_mode) {
tw32_f(MAC_RX_MODE, tp->rx_mode);
}
if (new_tg3_flags & TG3_FLAG_TX_PAUSE) if (new_tg3_flags & TG3_FLAG_TX_PAUSE)
tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE; tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE;
else else
tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE; tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE;
if (old_tx_mode != tp->tx_mode) {
tw32_f(MAC_TX_MODE, tp->tx_mode);
}
} }
static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex) static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex)
...@@ -2472,7 +2533,7 @@ static int tg3_rx(struct tg3 *tp, int budget) ...@@ -2472,7 +2533,7 @@ static int tg3_rx(struct tg3 *tp, int budget)
static int tg3_poll(struct net_device *netdev, int *budget) static int tg3_poll(struct net_device *netdev, int *budget)
{ {
struct tg3 *tp = netdev->priv; struct tg3 *tp = netdev_priv(netdev);
struct tg3_hw_status *sblk = tp->hw_status; struct tg3_hw_status *sblk = tp->hw_status;
unsigned long flags; unsigned long flags;
int done; int done;
...@@ -2554,7 +2615,7 @@ static inline unsigned int tg3_has_work(struct net_device *dev, struct tg3 *tp) ...@@ -2554,7 +2615,7 @@ static inline unsigned int tg3_has_work(struct net_device *dev, struct tg3 *tp)
static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
struct net_device *dev = dev_id; struct net_device *dev = dev_id;
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
struct tg3_hw_status *sblk = tp->hw_status; struct tg3_hw_status *sblk = tp->hw_status;
unsigned long flags; unsigned long flags;
unsigned int handled = 1; unsigned int handled = 1;
...@@ -2634,7 +2695,7 @@ static void tg3_reset_task(void *_data) ...@@ -2634,7 +2695,7 @@ static void tg3_reset_task(void *_data)
static void tg3_tx_timeout(struct net_device *dev) static void tg3_tx_timeout(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
printk(KERN_ERR PFX "%s: transmit timed out, resetting\n", printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
dev->name); dev->name);
...@@ -2750,7 +2811,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) ...@@ -2750,7 +2811,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len)
static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev) static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
dma_addr_t mapping; dma_addr_t mapping;
unsigned int i; unsigned int i;
u32 len, entry, base_flags, mss; u32 len, entry, base_flags, mss;
...@@ -2954,7 +3015,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev) ...@@ -2954,7 +3015,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
dma_addr_t mapping; dma_addr_t mapping;
u32 len, entry, base_flags, mss; u32 len, entry, base_flags, mss;
unsigned long flags; unsigned long flags;
...@@ -3124,7 +3185,7 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp, ...@@ -3124,7 +3185,7 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
static int tg3_change_mtu(struct net_device *dev, int new_mtu) static int tg3_change_mtu(struct net_device *dev, int new_mtu)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp)) if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp))
return -EINVAL; return -EINVAL;
...@@ -4741,7 +4802,7 @@ static void __tg3_set_mac_addr(struct tg3 *tp) ...@@ -4741,7 +4802,7 @@ static void __tg3_set_mac_addr(struct tg3 *tp)
static int tg3_set_mac_addr(struct net_device *dev, void *p) static int tg3_set_mac_addr(struct net_device *dev, void *p)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
...@@ -5533,7 +5594,7 @@ static void tg3_timer(unsigned long __opaque) ...@@ -5533,7 +5594,7 @@ static void tg3_timer(unsigned long __opaque)
static int tg3_open(struct net_device *dev) static int tg3_open(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
...@@ -5836,7 +5897,7 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *); ...@@ -5836,7 +5897,7 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *);
static int tg3_close(struct net_device *dev) static int tg3_close(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
netif_stop_queue(dev); netif_stop_queue(dev);
...@@ -5921,10 +5982,13 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) ...@@ -5921,10 +5982,13 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
if (!hw_stats) if (!hw_stats)
return old_estats; return old_estats;
ESTAT_ADD(rx_octets);
ESTAT_ADD(rx_fragments); ESTAT_ADD(rx_fragments);
ESTAT_ADD(rx_ucast_packets); ESTAT_ADD(rx_ucast_packets);
ESTAT_ADD(rx_mcast_packets);
ESTAT_ADD(rx_bcast_packets); ESTAT_ADD(rx_bcast_packets);
ESTAT_ADD(rx_fcs_errors); ESTAT_ADD(rx_fcs_errors);
ESTAT_ADD(rx_align_errors);
ESTAT_ADD(rx_xon_pause_rcvd); ESTAT_ADD(rx_xon_pause_rcvd);
ESTAT_ADD(rx_xoff_pause_rcvd); ESTAT_ADD(rx_xoff_pause_rcvd);
ESTAT_ADD(rx_mac_ctrl_rcvd); ESTAT_ADD(rx_mac_ctrl_rcvd);
...@@ -5934,7 +5998,19 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) ...@@ -5934,7 +5998,19 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
ESTAT_ADD(rx_undersize_packets); ESTAT_ADD(rx_undersize_packets);
ESTAT_ADD(rx_in_length_errors); ESTAT_ADD(rx_in_length_errors);
ESTAT_ADD(rx_out_length_errors); ESTAT_ADD(rx_out_length_errors);
ESTAT_ADD(rx_64_or_less_octet_packets);
ESTAT_ADD(rx_65_to_127_octet_packets);
ESTAT_ADD(rx_128_to_255_octet_packets);
ESTAT_ADD(rx_256_to_511_octet_packets);
ESTAT_ADD(rx_512_to_1023_octet_packets);
ESTAT_ADD(rx_1024_to_1522_octet_packets);
ESTAT_ADD(rx_1523_to_2047_octet_packets);
ESTAT_ADD(rx_2048_to_4095_octet_packets);
ESTAT_ADD(rx_4096_to_8191_octet_packets);
ESTAT_ADD(rx_8192_to_9022_octet_packets);
ESTAT_ADD(tx_octets);
ESTAT_ADD(tx_collisions);
ESTAT_ADD(tx_xon_sent); ESTAT_ADD(tx_xon_sent);
ESTAT_ADD(tx_xoff_sent); ESTAT_ADD(tx_xoff_sent);
ESTAT_ADD(tx_flow_control); ESTAT_ADD(tx_flow_control);
...@@ -5944,16 +6020,50 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) ...@@ -5944,16 +6020,50 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp)
ESTAT_ADD(tx_deferred); ESTAT_ADD(tx_deferred);
ESTAT_ADD(tx_excessive_collisions); ESTAT_ADD(tx_excessive_collisions);
ESTAT_ADD(tx_late_collisions); ESTAT_ADD(tx_late_collisions);
ESTAT_ADD(tx_collide_2times);
ESTAT_ADD(tx_collide_3times);
ESTAT_ADD(tx_collide_4times);
ESTAT_ADD(tx_collide_5times);
ESTAT_ADD(tx_collide_6times);
ESTAT_ADD(tx_collide_7times);
ESTAT_ADD(tx_collide_8times);
ESTAT_ADD(tx_collide_9times);
ESTAT_ADD(tx_collide_10times);
ESTAT_ADD(tx_collide_11times);
ESTAT_ADD(tx_collide_12times);
ESTAT_ADD(tx_collide_13times);
ESTAT_ADD(tx_collide_14times);
ESTAT_ADD(tx_collide_15times);
ESTAT_ADD(tx_ucast_packets); ESTAT_ADD(tx_ucast_packets);
ESTAT_ADD(tx_mcast_packets); ESTAT_ADD(tx_mcast_packets);
ESTAT_ADD(tx_bcast_packets); ESTAT_ADD(tx_bcast_packets);
ESTAT_ADD(tx_carrier_sense_errors);
ESTAT_ADD(tx_discards);
ESTAT_ADD(tx_errors);
ESTAT_ADD(dma_writeq_full);
ESTAT_ADD(dma_write_prioq_full);
ESTAT_ADD(rxbds_empty);
ESTAT_ADD(rx_discards);
ESTAT_ADD(rx_errors);
ESTAT_ADD(rx_threshold_hit);
ESTAT_ADD(dma_readq_full);
ESTAT_ADD(dma_read_prioq_full);
ESTAT_ADD(tx_comp_queue_full);
ESTAT_ADD(ring_set_send_prod_index);
ESTAT_ADD(ring_status_update);
ESTAT_ADD(nic_irqs);
ESTAT_ADD(nic_avoided_irqs);
ESTAT_ADD(nic_tx_threshold_hit);
return estats; return estats;
} }
static struct net_device_stats *tg3_get_stats(struct net_device *dev) static struct net_device_stats *tg3_get_stats(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
struct net_device_stats *stats = &tp->net_stats; struct net_device_stats *stats = &tp->net_stats;
struct net_device_stats *old_stats = &tp->net_stats_prev; struct net_device_stats *old_stats = &tp->net_stats_prev;
struct tg3_hw_stats *hw_stats = tp->hw_stats; struct tg3_hw_stats *hw_stats = tp->hw_stats;
...@@ -5977,7 +6087,8 @@ static struct net_device_stats *tg3_get_stats(struct net_device *dev) ...@@ -5977,7 +6087,8 @@ static struct net_device_stats *tg3_get_stats(struct net_device *dev)
get_stat64(&hw_stats->tx_octets); get_stat64(&hw_stats->tx_octets);
stats->rx_errors = old_stats->rx_errors + stats->rx_errors = old_stats->rx_errors +
get_stat64(&hw_stats->rx_errors); get_stat64(&hw_stats->rx_errors) +
get_stat64(&hw_stats->rx_discards);
stats->tx_errors = old_stats->tx_errors + stats->tx_errors = old_stats->tx_errors +
get_stat64(&hw_stats->tx_errors) + get_stat64(&hw_stats->tx_errors) +
get_stat64(&hw_stats->tx_mac_errors) + get_stat64(&hw_stats->tx_mac_errors) +
...@@ -6044,7 +6155,7 @@ static void tg3_set_multi(struct tg3 *tp, unsigned int accept_all) ...@@ -6044,7 +6155,7 @@ static void tg3_set_multi(struct tg3 *tp, unsigned int accept_all)
static void __tg3_set_rx_mode(struct net_device *dev) static void __tg3_set_rx_mode(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
u32 rx_mode; u32 rx_mode;
rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC | rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC |
...@@ -6108,7 +6219,7 @@ static void __tg3_set_rx_mode(struct net_device *dev) ...@@ -6108,7 +6219,7 @@ static void __tg3_set_rx_mode(struct net_device *dev)
static void tg3_set_rx_mode(struct net_device *dev) static void tg3_set_rx_mode(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
__tg3_set_rx_mode(dev); __tg3_set_rx_mode(dev);
...@@ -6126,7 +6237,7 @@ static void tg3_get_regs(struct net_device *dev, ...@@ -6126,7 +6237,7 @@ static void tg3_get_regs(struct net_device *dev,
struct ethtool_regs *regs, void *_p) struct ethtool_regs *regs, void *_p)
{ {
u32 *p = _p; u32 *p = _p;
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
u8 *orig_p = _p; u8 *orig_p = _p;
int i; int i;
...@@ -6257,7 +6368,7 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, ...@@ -6257,7 +6368,7 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) || if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
tp->link_config.phy_is_low_power) tp->link_config.phy_is_low_power)
...@@ -6292,7 +6403,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6292,7 +6403,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) || if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
tp->link_config.phy_is_low_power) tp->link_config.phy_is_low_power)
...@@ -6331,7 +6442,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -6331,7 +6442,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
strcpy(info->driver, DRV_MODULE_NAME); strcpy(info->driver, DRV_MODULE_NAME);
strcpy(info->version, DRV_MODULE_VERSION); strcpy(info->version, DRV_MODULE_VERSION);
...@@ -6340,7 +6451,7 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info ...@@ -6340,7 +6451,7 @@ static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
wol->supported = WAKE_MAGIC; wol->supported = WAKE_MAGIC;
wol->wolopts = 0; wol->wolopts = 0;
...@@ -6351,7 +6462,7 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -6351,7 +6462,7 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (wol->wolopts & ~WAKE_MAGIC) if (wol->wolopts & ~WAKE_MAGIC)
return -EINVAL; return -EINVAL;
...@@ -6372,20 +6483,20 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -6372,20 +6483,20 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
static u32 tg3_get_msglevel(struct net_device *dev) static u32 tg3_get_msglevel(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
return tp->msg_enable; return tp->msg_enable;
} }
static void tg3_set_msglevel(struct net_device *dev, u32 value) static void tg3_set_msglevel(struct net_device *dev, u32 value)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
tp->msg_enable = value; tp->msg_enable = value;
} }
#if TG3_TSO_SUPPORT != 0 #if TG3_TSO_SUPPORT != 0
static int tg3_set_tso(struct net_device *dev, u32 value) static int tg3_set_tso(struct net_device *dev, u32 value)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) { if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
if (value) if (value)
...@@ -6398,7 +6509,7 @@ static int tg3_set_tso(struct net_device *dev, u32 value) ...@@ -6398,7 +6509,7 @@ static int tg3_set_tso(struct net_device *dev, u32 value)
static int tg3_nway_reset(struct net_device *dev) static int tg3_nway_reset(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
u32 bmcr; u32 bmcr;
int r; int r;
...@@ -6417,7 +6528,7 @@ static int tg3_nway_reset(struct net_device *dev) ...@@ -6417,7 +6528,7 @@ static int tg3_nway_reset(struct net_device *dev)
static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
ering->rx_max_pending = TG3_RX_RING_SIZE - 1; ering->rx_max_pending = TG3_RX_RING_SIZE - 1;
ering->rx_mini_max_pending = 0; ering->rx_mini_max_pending = 0;
...@@ -6431,7 +6542,7 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam * ...@@ -6431,7 +6542,7 @@ static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *
static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) || if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
(ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) || (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
...@@ -6462,7 +6573,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e ...@@ -6462,7 +6573,7 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e
static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0; epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0;
epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0; epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0;
...@@ -6471,7 +6582,7 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam ...@@ -6471,7 +6582,7 @@ static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam
static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
tg3_netif_stop(tp); tg3_netif_stop(tp);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
...@@ -6499,13 +6610,13 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam ...@@ -6499,13 +6610,13 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
static u32 tg3_get_rx_csum(struct net_device *dev) static u32 tg3_get_rx_csum(struct net_device *dev)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
return (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0; return (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0;
} }
static int tg3_set_rx_csum(struct net_device *dev, u32 data) static int tg3_set_rx_csum(struct net_device *dev, u32 data)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
if (data != 0) if (data != 0)
...@@ -6525,7 +6636,7 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data) ...@@ -6525,7 +6636,7 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data)
static int tg3_set_tx_csum(struct net_device *dev, u32 data) static int tg3_set_tx_csum(struct net_device *dev, u32 data)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
if (data != 0) if (data != 0)
...@@ -6562,13 +6673,13 @@ static void tg3_get_ethtool_stats (struct net_device *dev, ...@@ -6562,13 +6673,13 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
struct ethtool_stats *estats, u64 *tmp_stats) struct ethtool_stats *estats, u64 *tmp_stats)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = dev->priv;
memcpy(tmp_stats, &tp->estats, sizeof(tp->estats)); memcpy(tmp_stats, tg3_get_estats(tp), sizeof(tp->estats));
} }
static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data; struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
switch(cmd) { switch(cmd) {
...@@ -6608,7 +6719,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -6608,7 +6719,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
#if TG3_VLAN_TAG_USED #if TG3_VLAN_TAG_USED
static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock); spin_lock(&tp->tx_lock);
...@@ -6624,7 +6735,7 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) ...@@ -6624,7 +6735,7 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
{ {
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock); spin_lock(&tp->tx_lock);
...@@ -8047,7 +8158,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, ...@@ -8047,7 +8158,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid; dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid;
#endif #endif
tp = dev->priv; tp = netdev_priv(dev);
tp->pdev = pdev; tp->pdev = pdev;
tp->dev = dev; tp->dev = dev;
tp->pm_cap = pm_cap; tp->pm_cap = pm_cap;
...@@ -8268,8 +8379,10 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) ...@@ -8268,8 +8379,10 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
if (dev) { if (dev) {
struct tg3 *tp = netdev_priv(dev);
unregister_netdev(dev); unregister_netdev(dev);
iounmap((void *) ((struct tg3 *)(dev->priv))->regs); iounmap((void *)tp->regs);
free_netdev(dev); free_netdev(dev);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
...@@ -8280,7 +8393,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev) ...@@ -8280,7 +8393,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
static int tg3_suspend(struct pci_dev *pdev, u32 state) static int tg3_suspend(struct pci_dev *pdev, u32 state)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
if (!netif_running(dev)) if (!netif_running(dev))
...@@ -8327,7 +8440,7 @@ static int tg3_suspend(struct pci_dev *pdev, u32 state) ...@@ -8327,7 +8440,7 @@ static int tg3_suspend(struct pci_dev *pdev, u32 state)
static int tg3_resume(struct pci_dev *pdev) static int tg3_resume(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct tg3 *tp = dev->priv; struct tg3 *tp = netdev_priv(dev);
int err; int err;
if (!netif_running(dev)) if (!netif_running(dev))
......
...@@ -1845,10 +1845,13 @@ struct tg3_bufmgr_config { ...@@ -1845,10 +1845,13 @@ struct tg3_bufmgr_config {
struct tg3_ethtool_stats { struct tg3_ethtool_stats {
/* Statistics maintained by Receive MAC. */ /* Statistics maintained by Receive MAC. */
u64 rx_octets;
u64 rx_fragments; u64 rx_fragments;
u64 rx_ucast_packets; u64 rx_ucast_packets;
u64 rx_mcast_packets;
u64 rx_bcast_packets; u64 rx_bcast_packets;
u64 rx_fcs_errors; u64 rx_fcs_errors;
u64 rx_align_errors;
u64 rx_xon_pause_rcvd; u64 rx_xon_pause_rcvd;
u64 rx_xoff_pause_rcvd; u64 rx_xoff_pause_rcvd;
u64 rx_mac_ctrl_rcvd; u64 rx_mac_ctrl_rcvd;
...@@ -1858,8 +1861,20 @@ struct tg3_ethtool_stats { ...@@ -1858,8 +1861,20 @@ struct tg3_ethtool_stats {
u64 rx_undersize_packets; u64 rx_undersize_packets;
u64 rx_in_length_errors; u64 rx_in_length_errors;
u64 rx_out_length_errors; u64 rx_out_length_errors;
u64 rx_64_or_less_octet_packets;
u64 rx_65_to_127_octet_packets;
u64 rx_128_to_255_octet_packets;
u64 rx_256_to_511_octet_packets;
u64 rx_512_to_1023_octet_packets;
u64 rx_1024_to_1522_octet_packets;
u64 rx_1523_to_2047_octet_packets;
u64 rx_2048_to_4095_octet_packets;
u64 rx_4096_to_8191_octet_packets;
u64 rx_8192_to_9022_octet_packets;
/* Statistics maintained by Transmit MAC. */ /* Statistics maintained by Transmit MAC. */
u64 tx_octets;
u64 tx_collisions;
u64 tx_xon_sent; u64 tx_xon_sent;
u64 tx_xoff_sent; u64 tx_xoff_sent;
u64 tx_flow_control; u64 tx_flow_control;
...@@ -1869,9 +1884,46 @@ struct tg3_ethtool_stats { ...@@ -1869,9 +1884,46 @@ struct tg3_ethtool_stats {
u64 tx_deferred; u64 tx_deferred;
u64 tx_excessive_collisions; u64 tx_excessive_collisions;
u64 tx_late_collisions; u64 tx_late_collisions;
u64 tx_collide_2times;
u64 tx_collide_3times;
u64 tx_collide_4times;
u64 tx_collide_5times;
u64 tx_collide_6times;
u64 tx_collide_7times;
u64 tx_collide_8times;
u64 tx_collide_9times;
u64 tx_collide_10times;
u64 tx_collide_11times;
u64 tx_collide_12times;
u64 tx_collide_13times;
u64 tx_collide_14times;
u64 tx_collide_15times;
u64 tx_ucast_packets; u64 tx_ucast_packets;
u64 tx_mcast_packets; u64 tx_mcast_packets;
u64 tx_bcast_packets; u64 tx_bcast_packets;
u64 tx_carrier_sense_errors;
u64 tx_discards;
u64 tx_errors;
/* Statistics maintained by Receive List Placement. */
u64 dma_writeq_full;
u64 dma_write_prioq_full;
u64 rxbds_empty;
u64 rx_discards;
u64 rx_errors;
u64 rx_threshold_hit;
/* Statistics maintained by Send Data Initiator. */
u64 dma_readq_full;
u64 dma_read_prioq_full;
u64 tx_comp_queue_full;
/* Statistics maintained by Host Coalescing. */
u64 ring_set_send_prod_index;
u64 ring_status_update;
u64 nic_irqs;
u64 nic_avoided_irqs;
u64 nic_tx_threshold_hit;
}; };
struct tg3 { struct tg3 {
......
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