diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index c002b9f97cdf..9b8d8a227281 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -101,7 +101,7 @@ | |||
101 | #define TG3_DEF_RX_RING_PENDING 200 | 101 | #define TG3_DEF_RX_RING_PENDING 200 |
102 | #define TG3_RX_JUMBO_RING_SIZE 256 | 102 | #define TG3_RX_JUMBO_RING_SIZE 256 |
103 | #define TG3_DEF_RX_JUMBO_RING_PENDING 100 | 103 | #define TG3_DEF_RX_JUMBO_RING_PENDING 100 |
104 | #define TG3_RSS_INDIR_TBL_SIZE 128 | 104 | #define TG3_RSS_INDIR_TBL_SIZE 128 |
105 | 105 | ||
106 | /* Do not place this n-ring entries value into the tp struct itself, | 106 | /* Do not place this n-ring entries value into the tp struct itself, |
107 | * we really want to expose these constants to GCC so that modulo et | 107 | * we really want to expose these constants to GCC so that modulo et |
@@ -142,6 +142,8 @@ | |||
142 | #define TG3_RX_JMB_BUFF_RING_SIZE \ | 142 | #define TG3_RX_JMB_BUFF_RING_SIZE \ |
143 | (sizeof(struct ring_info) * TG3_RX_JUMBO_RING_SIZE) | 143 | (sizeof(struct ring_info) * TG3_RX_JUMBO_RING_SIZE) |
144 | 144 | ||
145 | #define TG3_RSS_MIN_NUM_MSIX_VECS 2 | ||
146 | |||
145 | /* minimum number of free TX descriptors required to wake up TX process */ | 147 | /* minimum number of free TX descriptors required to wake up TX process */ |
146 | #define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4) | 148 | #define TG3_TX_WAKEUP_THRESH(tnapi) ((tnapi)->tx_pending / 4) |
147 | 149 | ||
@@ -152,6 +154,8 @@ | |||
152 | 154 | ||
153 | #define TG3_NUM_TEST 6 | 155 | #define TG3_NUM_TEST 6 |
154 | 156 | ||
157 | #define TG3_FW_UPDATE_TIMEOUT_SEC 5 | ||
158 | |||
155 | #define FIRMWARE_TG3 "tigon/tg3.bin" | 159 | #define FIRMWARE_TG3 "tigon/tg3.bin" |
156 | #define FIRMWARE_TG3TSO "tigon/tg3_tso.bin" | 160 | #define FIRMWARE_TG3TSO "tigon/tg3_tso.bin" |
157 | #define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin" | 161 | #define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin" |
@@ -167,8 +171,6 @@ MODULE_FIRMWARE(FIRMWARE_TG3); | |||
167 | MODULE_FIRMWARE(FIRMWARE_TG3TSO); | 171 | MODULE_FIRMWARE(FIRMWARE_TG3TSO); |
168 | MODULE_FIRMWARE(FIRMWARE_TG3TSO5); | 172 | MODULE_FIRMWARE(FIRMWARE_TG3TSO5); |
169 | 173 | ||
170 | #define TG3_RSS_MIN_NUM_MSIX_VECS 2 | ||
171 | |||
172 | static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */ | 174 | static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */ |
173 | module_param(tg3_debug, int, 0); | 175 | module_param(tg3_debug, int, 0); |
174 | MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value"); | 176 | MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value"); |
@@ -496,16 +498,16 @@ static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val) | |||
496 | writel(val, tp->regs + off + GRCMBOX_BASE); | 498 | writel(val, tp->regs + off + GRCMBOX_BASE); |
497 | } | 499 | } |
498 | 500 | ||
499 | #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) | 501 | #define tw32_mailbox(reg, val) tp->write32_mbox(tp, reg, val) |
500 | #define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) | 502 | #define tw32_mailbox_f(reg, val) tw32_mailbox_flush(tp, (reg), (val)) |
501 | #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) | 503 | #define tw32_rx_mbox(reg, val) tp->write32_rx_mbox(tp, reg, val) |
502 | #define tw32_tx_mbox(reg, val) tp->write32_tx_mbox(tp, reg, val) | 504 | #define tw32_tx_mbox(reg, val) tp->write32_tx_mbox(tp, reg, val) |
503 | #define tr32_mailbox(reg) tp->read32_mbox(tp, reg) | 505 | #define tr32_mailbox(reg) tp->read32_mbox(tp, reg) |
504 | 506 | ||
505 | #define tw32(reg,val) tp->write32(tp, reg, val) | 507 | #define tw32(reg, val) tp->write32(tp, reg, val) |
506 | #define tw32_f(reg,val) _tw32_flush(tp,(reg),(val), 0) | 508 | #define tw32_f(reg, val) _tw32_flush(tp, (reg), (val), 0) |
507 | #define tw32_wait_f(reg,val,us) _tw32_flush(tp,(reg),(val), (us)) | 509 | #define tw32_wait_f(reg, val, us) _tw32_flush(tp, (reg), (val), (us)) |
508 | #define tr32(reg) tp->read32(tp, reg) | 510 | #define tr32(reg) tp->read32(tp, reg) |
509 | 511 | ||
510 | static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) | 512 | static void tg3_write_mem(struct tg3 *tp, u32 off, u32 val) |
511 | { | 513 | { |
@@ -651,6 +653,7 @@ static void tg3_enable_ints(struct tg3 *tp) | |||
651 | tp->coal_now = tp->coalesce_mode | HOSTCC_MODE_ENABLE; | 653 | tp->coal_now = tp->coalesce_mode | HOSTCC_MODE_ENABLE; |
652 | for (i = 0; i < tp->irq_cnt; i++) { | 654 | for (i = 0; i < tp->irq_cnt; i++) { |
653 | struct tg3_napi *tnapi = &tp->napi[i]; | 655 | struct tg3_napi *tnapi = &tp->napi[i]; |
656 | |||
654 | tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); | 657 | tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); |
655 | if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) | 658 | if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) |
656 | tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); | 659 | tw32_mailbox_f(tnapi->int_mbox, tnapi->last_tag << 24); |
@@ -1437,7 +1440,7 @@ static void tg3_adjust_link(struct net_device *dev) | |||
1437 | phydev->speed != tp->link_config.active_speed || | 1440 | phydev->speed != tp->link_config.active_speed || |
1438 | phydev->duplex != tp->link_config.active_duplex || | 1441 | phydev->duplex != tp->link_config.active_duplex || |
1439 | oldflowctrl != tp->link_config.active_flowctrl) | 1442 | oldflowctrl != tp->link_config.active_flowctrl) |
1440 | linkmesg = 1; | 1443 | linkmesg = 1; |
1441 | 1444 | ||
1442 | tp->link_config.active_speed = phydev->speed; | 1445 | tp->link_config.active_speed = phydev->speed; |
1443 | tp->link_config.active_duplex = phydev->duplex; | 1446 | tp->link_config.active_duplex = phydev->duplex; |
@@ -2007,8 +2010,8 @@ out: | |||
2007 | u32 phy_reg; | 2010 | u32 phy_reg; |
2008 | 2011 | ||
2009 | if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &phy_reg)) | 2012 | if (!tg3_readphy(tp, MII_TG3_EXT_CTRL, &phy_reg)) |
2010 | tg3_writephy(tp, MII_TG3_EXT_CTRL, | 2013 | tg3_writephy(tp, MII_TG3_EXT_CTRL, |
2011 | phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC); | 2014 | phy_reg | MII_TG3_EXT_CTRL_FIFO_ELASTIC); |
2012 | } | 2015 | } |
2013 | 2016 | ||
2014 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { | 2017 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) { |
@@ -4211,6 +4214,7 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp) | |||
4211 | tp->serdes_counter--; | 4214 | tp->serdes_counter--; |
4212 | return; | 4215 | return; |
4213 | } | 4216 | } |
4217 | |||
4214 | if (!netif_carrier_ok(tp->dev) && | 4218 | if (!netif_carrier_ok(tp->dev) && |
4215 | (tp->link_config.autoneg == AUTONEG_ENABLE)) { | 4219 | (tp->link_config.autoneg == AUTONEG_ENABLE)) { |
4216 | u32 bmcr; | 4220 | u32 bmcr; |
@@ -4519,8 +4523,8 @@ static void tg3_recycle_rx(struct tg3_napi *tnapi, | |||
4519 | struct tg3 *tp = tnapi->tp; | 4523 | struct tg3 *tp = tnapi->tp; |
4520 | struct tg3_rx_buffer_desc *src_desc, *dest_desc; | 4524 | struct tg3_rx_buffer_desc *src_desc, *dest_desc; |
4521 | struct ring_info *src_map, *dest_map; | 4525 | struct ring_info *src_map, *dest_map; |
4522 | int dest_idx; | ||
4523 | struct tg3_rx_prodring_set *spr = &tp->prodring[0]; | 4526 | struct tg3_rx_prodring_set *spr = &tp->prodring[0]; |
4527 | int dest_idx; | ||
4524 | 4528 | ||
4525 | switch (opaque_key) { | 4529 | switch (opaque_key) { |
4526 | case RXD_OPAQUE_RING_STD: | 4530 | case RXD_OPAQUE_RING_STD: |
@@ -4981,7 +4985,7 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget) | |||
4981 | if (unlikely(work_done >= budget)) | 4985 | if (unlikely(work_done >= budget)) |
4982 | break; | 4986 | break; |
4983 | 4987 | ||
4984 | /* tp->last_tag is used in tg3_restart_ints() below | 4988 | /* tp->last_tag is used in tg3_int_reenable() below |
4985 | * to tell the hw how much work has been processed, | 4989 | * to tell the hw how much work has been processed, |
4986 | * so we must read it before checking for more work. | 4990 | * so we must read it before checking for more work. |
4987 | */ | 4991 | */ |
@@ -5496,7 +5500,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, | |||
5496 | struct netdev_queue *txq; | 5500 | struct netdev_queue *txq; |
5497 | unsigned int i, last; | 5501 | unsigned int i, last; |
5498 | 5502 | ||
5499 | |||
5500 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); | 5503 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); |
5501 | tnapi = &tp->napi[skb_get_queue_mapping(skb)]; | 5504 | tnapi = &tp->napi[skb_get_queue_mapping(skb)]; |
5502 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) | 5505 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) |
@@ -5700,7 +5703,6 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb, | |||
5700 | struct netdev_queue *txq; | 5703 | struct netdev_queue *txq; |
5701 | unsigned int i, last; | 5704 | unsigned int i, last; |
5702 | 5705 | ||
5703 | |||
5704 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); | 5706 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); |
5705 | tnapi = &tp->napi[skb_get_queue_mapping(skb)]; | 5707 | tnapi = &tp->napi[skb_get_queue_mapping(skb)]; |
5706 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) | 5708 | if (tp->tg3_flags3 & TG3_FLG3_ENABLE_TSS) |
@@ -6013,7 +6015,7 @@ static void tg3_rx_prodring_free(struct tg3 *tp, | |||
6013 | } | 6015 | } |
6014 | } | 6016 | } |
6015 | 6017 | ||
6016 | /* Initialize tx/rx rings for packet processing. | 6018 | /* Initialize rx rings for packet processing. |
6017 | * | 6019 | * |
6018 | * The chip has been shut down and the driver detached from | 6020 | * The chip has been shut down and the driver detached from |
6019 | * the networking, so no interrupts or new tx packets will | 6021 | * the networking, so no interrupts or new tx packets will |
@@ -8491,8 +8493,8 @@ static void tg3_timer(unsigned long __opaque) | |||
8491 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, | 8493 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, |
8492 | FWCMD_NICDRV_ALIVE3); | 8494 | FWCMD_NICDRV_ALIVE3); |
8493 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); | 8495 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 4); |
8494 | /* 5 seconds timeout */ | 8496 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, |
8495 | tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, 5); | 8497 | TG3_FW_UPDATE_TIMEOUT_SEC); |
8496 | 8498 | ||
8497 | tg3_generate_fw_event(tp); | 8499 | tg3_generate_fw_event(tp); |
8498 | } | 8500 | } |
@@ -9634,7 +9636,7 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
9634 | memcpy(data, ((char*)&val) + b_offset, b_count); | 9636 | memcpy(data, ((char*)&val) + b_offset, b_count); |
9635 | len -= b_count; | 9637 | len -= b_count; |
9636 | offset += b_count; | 9638 | offset += b_count; |
9637 | eeprom->len += b_count; | 9639 | eeprom->len += b_count; |
9638 | } | 9640 | } |
9639 | 9641 | ||
9640 | /* read bytes upto the last 4 byte boundary */ | 9642 | /* read bytes upto the last 4 byte boundary */ |
@@ -10182,8 +10184,8 @@ static int tg3_set_rx_csum(struct net_device *dev, u32 data) | |||
10182 | if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { | 10184 | if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { |
10183 | if (data != 0) | 10185 | if (data != 0) |
10184 | return -EINVAL; | 10186 | return -EINVAL; |
10185 | return 0; | 10187 | return 0; |
10186 | } | 10188 | } |
10187 | 10189 | ||
10188 | spin_lock_bh(&tp->lock); | 10190 | spin_lock_bh(&tp->lock); |
10189 | if (data) | 10191 | if (data) |
@@ -10202,8 +10204,8 @@ static int tg3_set_tx_csum(struct net_device *dev, u32 data) | |||
10202 | if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { | 10204 | if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) { |
10203 | if (data != 0) | 10205 | if (data != 0) |
10204 | return -EINVAL; | 10206 | return -EINVAL; |
10205 | return 0; | 10207 | return 0; |
10206 | } | 10208 | } |
10207 | 10209 | ||
10208 | if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS) | 10210 | if (tp->tg3_flags3 & TG3_FLG3_5755_PLUS) |
10209 | ethtool_op_set_tx_ipv6_csum(dev, data); | 10211 | ethtool_op_set_tx_ipv6_csum(dev, data); |
@@ -10477,7 +10479,7 @@ static int tg3_test_registers(struct tg3 *tp) | |||
10477 | { MAC_ADDR_0_HIGH, 0x0000, | 10479 | { MAC_ADDR_0_HIGH, 0x0000, |
10478 | 0x00000000, 0x0000ffff }, | 10480 | 0x00000000, 0x0000ffff }, |
10479 | { MAC_ADDR_0_LOW, 0x0000, | 10481 | { MAC_ADDR_0_LOW, 0x0000, |
10480 | 0x00000000, 0xffffffff }, | 10482 | 0x00000000, 0xffffffff }, |
10481 | { MAC_RX_MTU_SIZE, 0x0000, | 10483 | { MAC_RX_MTU_SIZE, 0x0000, |
10482 | 0x00000000, 0x0000ffff }, | 10484 | 0x00000000, 0x0000ffff }, |
10483 | { MAC_TX_MODE, 0x0000, | 10485 | { MAC_TX_MODE, 0x0000, |
@@ -11913,7 +11915,7 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
11913 | if (ret) | 11915 | if (ret) |
11914 | break; | 11916 | break; |
11915 | 11917 | ||
11916 | page_off = offset & pagemask; | 11918 | page_off = offset & pagemask; |
11917 | size = pagesize; | 11919 | size = pagesize; |
11918 | if (len < size) | 11920 | if (len < size) |
11919 | size = len; | 11921 | size = len; |
@@ -11941,7 +11943,7 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
11941 | nvram_cmd = NVRAM_CMD_GO | NVRAM_CMD_DONE | NVRAM_CMD_WR | | 11943 | nvram_cmd = NVRAM_CMD_GO | NVRAM_CMD_DONE | NVRAM_CMD_WR | |
11942 | NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_ERASE; | 11944 | NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_ERASE; |
11943 | 11945 | ||
11944 | if (tg3_nvram_exec_cmd(tp, nvram_cmd)) | 11946 | if (tg3_nvram_exec_cmd(tp, nvram_cmd)) |
11945 | break; | 11947 | break; |
11946 | 11948 | ||
11947 | /* Issue another write enable to start the write. */ | 11949 | /* Issue another write enable to start the write. */ |
@@ -11995,7 +11997,7 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len, | |||
11995 | memcpy(&data, buf + i, 4); | 11997 | memcpy(&data, buf + i, 4); |
11996 | tw32(NVRAM_WRDATA, be32_to_cpu(data)); | 11998 | tw32(NVRAM_WRDATA, be32_to_cpu(data)); |
11997 | 11999 | ||
11998 | page_off = offset % tp->nvram_pagesize; | 12000 | page_off = offset % tp->nvram_pagesize; |
11999 | 12001 | ||
12000 | phy_addr = tg3_nvram_phys_addr(tp, offset); | 12002 | phy_addr = tg3_nvram_phys_addr(tp, offset); |
12001 | 12003 | ||
@@ -12003,7 +12005,7 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len, | |||
12003 | 12005 | ||
12004 | nvram_cmd = NVRAM_CMD_GO | NVRAM_CMD_DONE | NVRAM_CMD_WR; | 12006 | nvram_cmd = NVRAM_CMD_GO | NVRAM_CMD_DONE | NVRAM_CMD_WR; |
12005 | 12007 | ||
12006 | if ((page_off == 0) || (i == 0)) | 12008 | if (page_off == 0 || i == 0) |
12007 | nvram_cmd |= NVRAM_CMD_FIRST; | 12009 | nvram_cmd |= NVRAM_CMD_FIRST; |
12008 | if (page_off == (tp->nvram_pagesize - 4)) | 12010 | if (page_off == (tp->nvram_pagesize - 4)) |
12009 | nvram_cmd |= NVRAM_CMD_LAST; | 12011 | nvram_cmd |= NVRAM_CMD_LAST; |
@@ -12949,9 +12951,9 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
12949 | { | 12951 | { |
12950 | static struct pci_device_id write_reorder_chipsets[] = { | 12952 | static struct pci_device_id write_reorder_chipsets[] = { |
12951 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, | 12953 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, |
12952 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, | 12954 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, |
12953 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, | 12955 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, |
12954 | PCI_DEVICE_ID_AMD_8131_BRIDGE) }, | 12956 | PCI_DEVICE_ID_AMD_8131_BRIDGE) }, |
12955 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, | 12957 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, |
12956 | PCI_DEVICE_ID_VIA_8385_0) }, | 12958 | PCI_DEVICE_ID_VIA_8385_0) }, |
12957 | { }, | 12959 | { }, |
@@ -13240,8 +13242,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13240 | tp->tg3_flags3 |= TG3_FLG3_USE_JUMBO_BDFLAG; | 13242 | tp->tg3_flags3 |= TG3_FLG3_USE_JUMBO_BDFLAG; |
13241 | 13243 | ||
13242 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) || | 13244 | if (!(tp->tg3_flags2 & TG3_FLG2_5705_PLUS) || |
13243 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || | 13245 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || |
13244 | (tp->tg3_flags3 & TG3_FLG3_USE_JUMBO_BDFLAG)) | 13246 | (tp->tg3_flags3 & TG3_FLG3_USE_JUMBO_BDFLAG)) |
13245 | tp->tg3_flags |= TG3_FLAG_JUMBO_CAPABLE; | 13247 | tp->tg3_flags |= TG3_FLAG_JUMBO_CAPABLE; |
13246 | 13248 | ||
13247 | pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, | 13249 | pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, |