aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/b44.c12
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.c117
-rw-r--r--drivers/net/ethernet/broadcom/bnx2.c9
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h11
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c18
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c22
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c25
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c80
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c30
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c149
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h7
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c4
-rw-r--r--drivers/net/ethernet/broadcom/cnic_if.h4
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c154
-rw-r--r--drivers/net/ethernet/broadcom/tg3.h3
17 files changed, 397 insertions, 251 deletions
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 9b017d9c58e9..079a597fa20c 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -596,6 +596,7 @@ static void b44_timer(unsigned long __opaque)
596static void b44_tx(struct b44 *bp) 596static void b44_tx(struct b44 *bp)
597{ 597{
598 u32 cur, cons; 598 u32 cur, cons;
599 unsigned bytes_compl = 0, pkts_compl = 0;
599 600
600 cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK; 601 cur = br32(bp, B44_DMATX_STAT) & DMATX_STAT_CDMASK;
601 cur /= sizeof(struct dma_desc); 602 cur /= sizeof(struct dma_desc);
@@ -612,9 +613,14 @@ static void b44_tx(struct b44 *bp)
612 skb->len, 613 skb->len,
613 DMA_TO_DEVICE); 614 DMA_TO_DEVICE);
614 rp->skb = NULL; 615 rp->skb = NULL;
616
617 bytes_compl += skb->len;
618 pkts_compl++;
619
615 dev_kfree_skb_irq(skb); 620 dev_kfree_skb_irq(skb);
616 } 621 }
617 622
623 netdev_completed_queue(bp->dev, pkts_compl, bytes_compl);
618 bp->tx_cons = cons; 624 bp->tx_cons = cons;
619 if (netif_queue_stopped(bp->dev) && 625 if (netif_queue_stopped(bp->dev) &&
620 TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH) 626 TX_BUFFS_AVAIL(bp) > B44_TX_WAKEUP_THRESH)
@@ -1018,6 +1024,8 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
1018 if (bp->flags & B44_FLAG_REORDER_BUG) 1024 if (bp->flags & B44_FLAG_REORDER_BUG)
1019 br32(bp, B44_DMATX_PTR); 1025 br32(bp, B44_DMATX_PTR);
1020 1026
1027 netdev_sent_queue(dev, skb->len);
1028
1021 if (TX_BUFFS_AVAIL(bp) < 1) 1029 if (TX_BUFFS_AVAIL(bp) < 1)
1022 netif_stop_queue(dev); 1030 netif_stop_queue(dev);
1023 1031
@@ -1416,6 +1424,8 @@ static void b44_init_hw(struct b44 *bp, int reset_kind)
1416 1424
1417 val = br32(bp, B44_ENET_CTRL); 1425 val = br32(bp, B44_ENET_CTRL);
1418 bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); 1426 bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
1427
1428 netdev_reset_queue(bp->dev);
1419} 1429}
1420 1430
1421static int b44_open(struct net_device *dev) 1431static int b44_open(struct net_device *dev)
@@ -2101,7 +2111,7 @@ static int b44_get_invariants(struct b44 *bp)
2101 * valid PHY address. */ 2111 * valid PHY address. */
2102 bp->phy_addr &= 0x1F; 2112 bp->phy_addr &= 0x1F;
2103 2113
2104 memcpy(bp->dev->dev_addr, addr, 6); 2114 memcpy(bp->dev->dev_addr, addr, ETH_ALEN);
2105 2115
2106 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ 2116 if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){
2107 pr_err("Invalid MAC address found in EEPROM\n"); 2117 pr_err("Invalid MAC address found in EEPROM\n");
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 9e8a3e024e01..e2aa09ce6af7 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -149,6 +149,8 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
149 dma_desc->ctl0 = cpu_to_le32(ctl0); 149 dma_desc->ctl0 = cpu_to_le32(ctl0);
150 dma_desc->ctl1 = cpu_to_le32(ctl1); 150 dma_desc->ctl1 = cpu_to_le32(ctl1);
151 151
152 netdev_sent_queue(net_dev, skb->len);
153
152 wmb(); 154 wmb();
153 155
154 /* Increase ring->end to point empty slot. We tell hardware the first 156 /* Increase ring->end to point empty slot. We tell hardware the first
@@ -178,6 +180,7 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
178 struct device *dma_dev = bgmac->core->dma_dev; 180 struct device *dma_dev = bgmac->core->dma_dev;
179 int empty_slot; 181 int empty_slot;
180 bool freed = false; 182 bool freed = false;
183 unsigned bytes_compl = 0, pkts_compl = 0;
181 184
182 /* The last slot that hardware didn't consume yet */ 185 /* The last slot that hardware didn't consume yet */
183 empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS); 186 empty_slot = bgmac_read(bgmac, ring->mmio_base + BGMAC_DMA_TX_STATUS);
@@ -195,6 +198,9 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
195 slot->skb->len, DMA_TO_DEVICE); 198 slot->skb->len, DMA_TO_DEVICE);
196 slot->dma_addr = 0; 199 slot->dma_addr = 0;
197 200
201 bytes_compl += slot->skb->len;
202 pkts_compl++;
203
198 /* Free memory! :) */ 204 /* Free memory! :) */
199 dev_kfree_skb(slot->skb); 205 dev_kfree_skb(slot->skb);
200 slot->skb = NULL; 206 slot->skb = NULL;
@@ -208,6 +214,8 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
208 freed = true; 214 freed = true;
209 } 215 }
210 216
217 netdev_completed_queue(bgmac->net_dev, pkts_compl, bytes_compl);
218
211 if (freed && netif_queue_stopped(bgmac->net_dev)) 219 if (freed && netif_queue_stopped(bgmac->net_dev))
212 netif_wake_queue(bgmac->net_dev); 220 netif_wake_queue(bgmac->net_dev);
213} 221}
@@ -277,6 +285,26 @@ static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
277 return 0; 285 return 0;
278} 286}
279 287
288static void bgmac_dma_rx_setup_desc(struct bgmac *bgmac,
289 struct bgmac_dma_ring *ring, int desc_idx)
290{
291 struct bgmac_dma_desc *dma_desc = ring->cpu_base + desc_idx;
292 u32 ctl0 = 0, ctl1 = 0;
293
294 if (desc_idx == ring->num_slots - 1)
295 ctl0 |= BGMAC_DESC_CTL0_EOT;
296 ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN;
297 /* Is there any BGMAC device that requires extension? */
298 /* ctl1 |= (addrext << B43_DMA64_DCTL1_ADDREXT_SHIFT) &
299 * B43_DMA64_DCTL1_ADDREXT_MASK;
300 */
301
302 dma_desc->addr_low = cpu_to_le32(lower_32_bits(ring->slots[desc_idx].dma_addr));
303 dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[desc_idx].dma_addr));
304 dma_desc->ctl0 = cpu_to_le32(ctl0);
305 dma_desc->ctl1 = cpu_to_le32(ctl1);
306}
307
280static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, 308static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
281 int weight) 309 int weight)
282{ 310{
@@ -295,7 +323,6 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
295 struct device *dma_dev = bgmac->core->dma_dev; 323 struct device *dma_dev = bgmac->core->dma_dev;
296 struct bgmac_slot_info *slot = &ring->slots[ring->start]; 324 struct bgmac_slot_info *slot = &ring->slots[ring->start];
297 struct sk_buff *skb = slot->skb; 325 struct sk_buff *skb = slot->skb;
298 struct sk_buff *new_skb;
299 struct bgmac_rx_header *rx; 326 struct bgmac_rx_header *rx;
300 u16 len, flags; 327 u16 len, flags;
301 328
@@ -308,38 +335,51 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
308 len = le16_to_cpu(rx->len); 335 len = le16_to_cpu(rx->len);
309 flags = le16_to_cpu(rx->flags); 336 flags = le16_to_cpu(rx->flags);
310 337
311 /* Check for poison and drop or pass the packet */ 338 do {
312 if (len == 0xdead && flags == 0xbeef) { 339 dma_addr_t old_dma_addr = slot->dma_addr;
313 bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n", 340 int err;
314 ring->start); 341
315 } else { 342 /* Check for poison and drop or pass the packet */
343 if (len == 0xdead && flags == 0xbeef) {
344 bgmac_err(bgmac, "Found poisoned packet at slot %d, DMA issue!\n",
345 ring->start);
346 dma_sync_single_for_device(dma_dev,
347 slot->dma_addr,
348 BGMAC_RX_BUF_SIZE,
349 DMA_FROM_DEVICE);
350 break;
351 }
352
316 /* Omit CRC. */ 353 /* Omit CRC. */
317 len -= ETH_FCS_LEN; 354 len -= ETH_FCS_LEN;
318 355
319 new_skb = netdev_alloc_skb_ip_align(bgmac->net_dev, len); 356 /* Prepare new skb as replacement */
320 if (new_skb) { 357 err = bgmac_dma_rx_skb_for_slot(bgmac, slot);
321 skb_put(new_skb, len); 358 if (err) {
322 skb_copy_from_linear_data_offset(skb, BGMAC_RX_FRAME_OFFSET, 359 /* Poison the old skb */
323 new_skb->data, 360 rx->len = cpu_to_le16(0xdead);
324 len); 361 rx->flags = cpu_to_le16(0xbeef);
325 skb_checksum_none_assert(skb); 362
326 new_skb->protocol = 363 dma_sync_single_for_device(dma_dev,
327 eth_type_trans(new_skb, bgmac->net_dev); 364 slot->dma_addr,
328 netif_receive_skb(new_skb); 365 BGMAC_RX_BUF_SIZE,
329 handled++; 366 DMA_FROM_DEVICE);
330 } else { 367 break;
331 bgmac->net_dev->stats.rx_dropped++;
332 bgmac_err(bgmac, "Allocation of skb for copying packet failed!\n");
333 } 368 }
369 bgmac_dma_rx_setup_desc(bgmac, ring, ring->start);
334 370
335 /* Poison the old skb */ 371 /* Unmap old skb, we'll pass it to the netfif */
336 rx->len = cpu_to_le16(0xdead); 372 dma_unmap_single(dma_dev, old_dma_addr,
337 rx->flags = cpu_to_le16(0xbeef); 373 BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE);
338 }
339 374
340 /* Make it back accessible to the hardware */ 375 skb_put(skb, BGMAC_RX_FRAME_OFFSET + len);
341 dma_sync_single_for_device(dma_dev, slot->dma_addr, 376 skb_pull(skb, BGMAC_RX_FRAME_OFFSET);
342 BGMAC_RX_BUF_SIZE, DMA_FROM_DEVICE); 377
378 skb_checksum_none_assert(skb);
379 skb->protocol = eth_type_trans(skb, bgmac->net_dev);
380 netif_receive_skb(skb);
381 handled++;
382 } while (0);
343 383
344 if (++ring->start >= BGMAC_RX_RING_SLOTS) 384 if (++ring->start >= BGMAC_RX_RING_SLOTS)
345 ring->start = 0; 385 ring->start = 0;
@@ -503,8 +543,6 @@ err_dma_free:
503static void bgmac_dma_init(struct bgmac *bgmac) 543static void bgmac_dma_init(struct bgmac *bgmac)
504{ 544{
505 struct bgmac_dma_ring *ring; 545 struct bgmac_dma_ring *ring;
506 struct bgmac_dma_desc *dma_desc;
507 u32 ctl0, ctl1;
508 int i; 546 int i;
509 547
510 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { 548 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) {
@@ -537,23 +575,8 @@ static void bgmac_dma_init(struct bgmac *bgmac)
537 if (ring->unaligned) 575 if (ring->unaligned)
538 bgmac_dma_rx_enable(bgmac, ring); 576 bgmac_dma_rx_enable(bgmac, ring);
539 577
540 for (j = 0, dma_desc = ring->cpu_base; j < ring->num_slots; 578 for (j = 0; j < ring->num_slots; j++)
541 j++, dma_desc++) { 579 bgmac_dma_rx_setup_desc(bgmac, ring, j);
542 ctl0 = ctl1 = 0;
543
544 if (j == ring->num_slots - 1)
545 ctl0 |= BGMAC_DESC_CTL0_EOT;
546 ctl1 |= BGMAC_RX_BUF_SIZE & BGMAC_DESC_CTL1_LEN;
547 /* Is there any BGMAC device that requires extension? */
548 /* ctl1 |= (addrext << B43_DMA64_DCTL1_ADDREXT_SHIFT) &
549 * B43_DMA64_DCTL1_ADDREXT_MASK;
550 */
551
552 dma_desc->addr_low = cpu_to_le32(lower_32_bits(ring->slots[j].dma_addr));
553 dma_desc->addr_high = cpu_to_le32(upper_32_bits(ring->slots[j].dma_addr));
554 dma_desc->ctl0 = cpu_to_le32(ctl0);
555 dma_desc->ctl1 = cpu_to_le32(ctl1);
556 }
557 580
558 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX, 581 bgmac_write(bgmac, ring->mmio_base + BGMAC_DMA_RX_INDEX,
559 ring->index_base + 582 ring->index_base +
@@ -996,6 +1019,8 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
996 bgmac_miiconfig(bgmac); 1019 bgmac_miiconfig(bgmac);
997 bgmac_phy_init(bgmac); 1020 bgmac_phy_init(bgmac);
998 1021
1022 netdev_reset_queue(bgmac->net_dev);
1023
999 bgmac->int_status = 0; 1024 bgmac->int_status = 0;
1000} 1025}
1001 1026
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index e838a3f74b69..d9980ad00b4b 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -5761,8 +5761,8 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
5761 if (!skb) 5761 if (!skb)
5762 return -ENOMEM; 5762 return -ENOMEM;
5763 packet = skb_put(skb, pkt_size); 5763 packet = skb_put(skb, pkt_size);
5764 memcpy(packet, bp->dev->dev_addr, 6); 5764 memcpy(packet, bp->dev->dev_addr, ETH_ALEN);
5765 memset(packet + 6, 0x0, 8); 5765 memset(packet + ETH_ALEN, 0x0, 8);
5766 for (i = 14; i < pkt_size; i++) 5766 for (i = 14; i < pkt_size; i++)
5767 packet[i] = (unsigned char) (i & 0xff); 5767 packet[i] = (unsigned char) (i & 0xff);
5768 5768
@@ -8413,7 +8413,6 @@ err_out_release:
8413 8413
8414err_out_disable: 8414err_out_disable:
8415 pci_disable_device(pdev); 8415 pci_disable_device(pdev);
8416 pci_set_drvdata(pdev, NULL);
8417 8416
8418err_out: 8417err_out:
8419 return rc; 8418 return rc;
@@ -8514,7 +8513,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8514 8513
8515 pci_set_drvdata(pdev, dev); 8514 pci_set_drvdata(pdev, dev);
8516 8515
8517 memcpy(dev->dev_addr, bp->mac_addr, 6); 8516 memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN);
8518 8517
8519 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | 8518 dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
8520 NETIF_F_TSO | NETIF_F_TSO_ECN | 8519 NETIF_F_TSO | NETIF_F_TSO_ECN |
@@ -8546,7 +8545,6 @@ error:
8546 pci_iounmap(pdev, bp->regview); 8545 pci_iounmap(pdev, bp->regview);
8547 pci_release_regions(pdev); 8546 pci_release_regions(pdev);
8548 pci_disable_device(pdev); 8547 pci_disable_device(pdev);
8549 pci_set_drvdata(pdev, NULL);
8550err_free: 8548err_free:
8551 free_netdev(dev); 8549 free_netdev(dev);
8552 return rc; 8550 return rc;
@@ -8578,7 +8576,6 @@ bnx2_remove_one(struct pci_dev *pdev)
8578 8576
8579 pci_release_regions(pdev); 8577 pci_release_regions(pdev);
8580 pci_disable_device(pdev); 8578 pci_disable_device(pdev);
8581 pci_set_drvdata(pdev, NULL);
8582} 8579}
8583 8580
8584static int 8581static int
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index c5e375ddd6c0..4e01c57d8c8d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1546,6 +1546,7 @@ struct bnx2x {
1546#define IS_VF_FLAG (1 << 22) 1546#define IS_VF_FLAG (1 << 22)
1547#define INTERRUPTS_ENABLED_FLAG (1 << 23) 1547#define INTERRUPTS_ENABLED_FLAG (1 << 23)
1548#define BC_SUPPORTS_RMMOD_CMD (1 << 24) 1548#define BC_SUPPORTS_RMMOD_CMD (1 << 24)
1549#define HAS_PHYS_PORT_ID (1 << 25)
1549 1550
1550#define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) 1551#define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG)
1551 1552
@@ -1876,6 +1877,8 @@ struct bnx2x {
1876 u32 dump_preset_idx; 1877 u32 dump_preset_idx;
1877 bool stats_started; 1878 bool stats_started;
1878 struct semaphore stats_sema; 1879 struct semaphore stats_sema;
1880
1881 u8 phys_port_id[ETH_ALEN];
1879}; 1882};
1880 1883
1881/* Tx queues may be less or equal to Rx queues */ 1884/* Tx queues may be less or equal to Rx queues */
@@ -2232,7 +2235,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
2232#define BNX2X_NUM_TESTS_SF 7 2235#define BNX2X_NUM_TESTS_SF 7
2233#define BNX2X_NUM_TESTS_MF 3 2236#define BNX2X_NUM_TESTS_MF 3
2234#define BNX2X_NUM_TESTS(bp) (IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \ 2237#define BNX2X_NUM_TESTS(bp) (IS_MF(bp) ? BNX2X_NUM_TESTS_MF : \
2235 BNX2X_NUM_TESTS_SF) 2238 IS_VF(bp) ? 0 : BNX2X_NUM_TESTS_SF)
2236 2239
2237#define BNX2X_PHY_LOOPBACK 0 2240#define BNX2X_PHY_LOOPBACK 0
2238#define BNX2X_MAC_LOOPBACK 1 2241#define BNX2X_MAC_LOOPBACK 1
@@ -2492,12 +2495,6 @@ enum {
2492 2495
2493#define NUM_MACS 8 2496#define NUM_MACS 8
2494 2497
2495enum bnx2x_pci_bus_speed {
2496 BNX2X_PCI_LINK_SPEED_2500 = 2500,
2497 BNX2X_PCI_LINK_SPEED_5000 = 5000,
2498 BNX2X_PCI_LINK_SPEED_8000 = 8000
2499};
2500
2501void bnx2x_set_local_cmng(struct bnx2x *bp); 2498void bnx2x_set_local_cmng(struct bnx2x *bp);
2502 2499
2503#define MCPR_SCRATCH_BASE(bp) \ 2500#define MCPR_SCRATCH_BASE(bp) \
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 74d6486fccfd..dcafbda3e5be 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3256,14 +3256,16 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
3256 if (prot == IPPROTO_TCP) 3256 if (prot == IPPROTO_TCP)
3257 rc |= XMIT_CSUM_TCP; 3257 rc |= XMIT_CSUM_TCP;
3258 3258
3259 if (skb_is_gso_v6(skb)) { 3259 if (skb_is_gso(skb)) {
3260 rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP); 3260 if (skb_is_gso_v6(skb)) {
3261 if (rc & XMIT_CSUM_ENC) 3261 rc |= (XMIT_GSO_V6 | XMIT_CSUM_TCP);
3262 rc |= XMIT_GSO_ENC_V6; 3262 if (rc & XMIT_CSUM_ENC)
3263 } else if (skb_is_gso(skb)) { 3263 rc |= XMIT_GSO_ENC_V6;
3264 rc |= (XMIT_GSO_V4 | XMIT_CSUM_TCP); 3264 } else {
3265 if (rc & XMIT_CSUM_ENC) 3265 rc |= (XMIT_GSO_V4 | XMIT_CSUM_TCP);
3266 rc |= XMIT_GSO_ENC_V4; 3266 if (rc & XMIT_CSUM_ENC)
3267 rc |= XMIT_GSO_ENC_V4;
3268 }
3267 } 3269 }
3268 3270
3269 return rc; 3271 return rc;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index e8efa1c93ffe..32d0f1435fb4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -639,6 +639,9 @@ static int bnx2x_get_regs_len(struct net_device *dev)
639 struct bnx2x *bp = netdev_priv(dev); 639 struct bnx2x *bp = netdev_priv(dev);
640 int regdump_len = 0; 640 int regdump_len = 0;
641 641
642 if (IS_VF(bp))
643 return 0;
644
642 regdump_len = __bnx2x_get_regs_len(bp); 645 regdump_len = __bnx2x_get_regs_len(bp);
643 regdump_len *= 4; 646 regdump_len *= 4;
644 regdump_len += sizeof(struct dump_header); 647 regdump_len += sizeof(struct dump_header);
@@ -2864,9 +2867,16 @@ static void bnx2x_self_test(struct net_device *dev,
2864 2867
2865 memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS(bp)); 2868 memset(buf, 0, sizeof(u64) * BNX2X_NUM_TESTS(bp));
2866 2869
2870 if (bnx2x_test_nvram(bp) != 0) {
2871 if (!IS_MF(bp))
2872 buf[4] = 1;
2873 else
2874 buf[0] = 1;
2875 etest->flags |= ETH_TEST_FL_FAILED;
2876 }
2877
2867 if (!netif_running(dev)) { 2878 if (!netif_running(dev)) {
2868 DP(BNX2X_MSG_ETHTOOL, 2879 DP(BNX2X_MSG_ETHTOOL, "Interface is down\n");
2869 "Can't perform self-test when interface is down\n");
2870 return; 2880 return;
2871 } 2881 }
2872 2882
@@ -2928,13 +2938,7 @@ static void bnx2x_self_test(struct net_device *dev,
2928 /* wait until link state is restored */ 2938 /* wait until link state is restored */
2929 bnx2x_wait_for_link(bp, link_up, is_serdes); 2939 bnx2x_wait_for_link(bp, link_up, is_serdes);
2930 } 2940 }
2931 if (bnx2x_test_nvram(bp) != 0) { 2941
2932 if (!IS_MF(bp))
2933 buf[4] = 1;
2934 else
2935 buf[0] = 1;
2936 etest->flags |= ETH_TEST_FL_FAILED;
2937 }
2938 if (bnx2x_test_intr(bp) != 0) { 2942 if (bnx2x_test_intr(bp) != 0) {
2939 if (!IS_MF(bp)) 2943 if (!IS_MF(bp))
2940 buf[5] = 1; 2944 buf[5] = 1;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
index 32767f6aa33f..cf1df8b62e2c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h
@@ -172,6 +172,7 @@ struct shared_hw_cfg { /* NVRAM Offset */
172 #define SHARED_HW_CFG_LED_MAC4 0x000c0000 172 #define SHARED_HW_CFG_LED_MAC4 0x000c0000
173 #define SHARED_HW_CFG_LED_PHY8 0x000d0000 173 #define SHARED_HW_CFG_LED_PHY8 0x000d0000
174 #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000 174 #define SHARED_HW_CFG_LED_EXTPHY1 0x000e0000
175 #define SHARED_HW_CFG_LED_EXTPHY2 0x000f0000
175 176
176 177
177 #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000 178 #define SHARED_HW_CFG_AN_ENABLE_MASK 0x3f000000
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 51468227bf3b..20dcc02431ca 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -3122,7 +3122,7 @@ static void bnx2x_bsc_module_sel(struct link_params *params)
3122} 3122}
3123 3123
3124static int bnx2x_bsc_read(struct link_params *params, 3124static int bnx2x_bsc_read(struct link_params *params,
3125 struct bnx2x_phy *phy, 3125 struct bnx2x *bp,
3126 u8 sl_devid, 3126 u8 sl_devid,
3127 u16 sl_addr, 3127 u16 sl_addr,
3128 u8 lc_addr, 3128 u8 lc_addr,
@@ -3131,7 +3131,6 @@ static int bnx2x_bsc_read(struct link_params *params,
3131{ 3131{
3132 u32 val, i; 3132 u32 val, i;
3133 int rc = 0; 3133 int rc = 0;
3134 struct bnx2x *bp = params->bp;
3135 3134
3136 if (xfer_cnt > 16) { 3135 if (xfer_cnt > 16) {
3137 DP(NETIF_MSG_LINK, "invalid xfer_cnt %d. Max is 16 bytes\n", 3136 DP(NETIF_MSG_LINK, "invalid xfer_cnt %d. Max is 16 bytes\n",
@@ -6371,9 +6370,15 @@ int bnx2x_set_led(struct link_params *params,
6371 * intended override. 6370 * intended override.
6372 */ 6371 */
6373 break; 6372 break;
6374 } else 6373 } else {
6374 u32 nig_led_mode = ((params->hw_led_mode <<
6375 SHARED_HW_CFG_LED_MODE_SHIFT) ==
6376 SHARED_HW_CFG_LED_EXTPHY2) ?
6377 (SHARED_HW_CFG_LED_PHY1 >>
6378 SHARED_HW_CFG_LED_MODE_SHIFT) : hw_led_mode;
6375 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 6379 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4,
6376 hw_led_mode); 6380 nig_led_mode);
6381 }
6377 6382
6378 REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0); 6383 REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0);
6379 /* Set blinking rate to ~15.9Hz */ 6384 /* Set blinking rate to ~15.9Hz */
@@ -7917,7 +7922,7 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7917 usleep_range(1000, 2000); 7922 usleep_range(1000, 2000);
7918 bnx2x_warpcore_power_module(params, 1); 7923 bnx2x_warpcore_power_module(params, 1);
7919 } 7924 }
7920 rc = bnx2x_bsc_read(params, phy, dev_addr, addr32, 0, byte_cnt, 7925 rc = bnx2x_bsc_read(params, bp, dev_addr, addr32, 0, byte_cnt,
7921 data_array); 7926 data_array);
7922 } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); 7927 } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT));
7923 7928
@@ -10653,10 +10658,18 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy,
10653 0x40); 10658 0x40);
10654 10659
10655 } else { 10660 } else {
10661 /* EXTPHY2 LED mode indicate that the 100M/1G/10G LED
10662 * sources are all wired through LED1, rather than only
10663 * 10G in other modes.
10664 */
10665 val = ((params->hw_led_mode <<
10666 SHARED_HW_CFG_LED_MODE_SHIFT) ==
10667 SHARED_HW_CFG_LED_EXTPHY2) ? 0x98 : 0x80;
10668
10656 bnx2x_cl45_write(bp, phy, 10669 bnx2x_cl45_write(bp, phy,
10657 MDIO_PMA_DEVAD, 10670 MDIO_PMA_DEVAD,
10658 MDIO_PMA_REG_8481_LED1_MASK, 10671 MDIO_PMA_REG_8481_LED1_MASK,
10659 0x80); 10672 val);
10660 10673
10661 /* Tell LED3 to blink on source */ 10674 /* Tell LED3 to blink on source */
10662 bnx2x_cl45_read(bp, phy, 10675 bnx2x_cl45_read(bp, phy,
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index b42f89ce02ef..bb2f20291509 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9916,7 +9916,7 @@ static int bnx2x_prev_path_mark_eeh(struct bnx2x *bp)
9916static bool bnx2x_prev_is_path_marked(struct bnx2x *bp) 9916static bool bnx2x_prev_is_path_marked(struct bnx2x *bp)
9917{ 9917{
9918 struct bnx2x_prev_path_list *tmp_list; 9918 struct bnx2x_prev_path_list *tmp_list;
9919 int rc = false; 9919 bool rc = false;
9920 9920
9921 if (down_trylock(&bnx2x_prev_sem)) 9921 if (down_trylock(&bnx2x_prev_sem))
9922 return false; 9922 return false;
@@ -11186,6 +11186,14 @@ static void bnx2x_get_mac_hwinfo(struct bnx2x *bp)
11186 bnx2x_get_cnic_mac_hwinfo(bp); 11186 bnx2x_get_cnic_mac_hwinfo(bp);
11187 } 11187 }
11188 11188
11189 if (!BP_NOMCP(bp)) {
11190 /* Read physical port identifier from shmem */
11191 val2 = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_upper);
11192 val = SHMEM_RD(bp, dev_info.port_hw_config[port].mac_lower);
11193 bnx2x_set_mac_buf(bp->phys_port_id, val, val2);
11194 bp->flags |= HAS_PHYS_PORT_ID;
11195 }
11196
11189 memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN); 11197 memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN);
11190 11198
11191 if (!bnx2x_is_valid_ether_addr(bp, bp->dev->dev_addr)) 11199 if (!bnx2x_is_valid_ether_addr(bp, bp->dev->dev_addr))
@@ -11784,7 +11792,7 @@ static int bnx2x_open(struct net_device *dev)
11784 rc = bnx2x_nic_load(bp, LOAD_OPEN); 11792 rc = bnx2x_nic_load(bp, LOAD_OPEN);
11785 if (rc) 11793 if (rc)
11786 return rc; 11794 return rc;
11787 return bnx2x_open_epilog(bp); 11795 return 0;
11788} 11796}
11789 11797
11790/* called with rtnl_lock */ 11798/* called with rtnl_lock */
@@ -12082,6 +12090,20 @@ static int bnx2x_validate_addr(struct net_device *dev)
12082 return 0; 12090 return 0;
12083} 12091}
12084 12092
12093static int bnx2x_get_phys_port_id(struct net_device *netdev,
12094 struct netdev_phys_port_id *ppid)
12095{
12096 struct bnx2x *bp = netdev_priv(netdev);
12097
12098 if (!(bp->flags & HAS_PHYS_PORT_ID))
12099 return -EOPNOTSUPP;
12100
12101 ppid->id_len = sizeof(bp->phys_port_id);
12102 memcpy(ppid->id, bp->phys_port_id, ppid->id_len);
12103
12104 return 0;
12105}
12106
12085static const struct net_device_ops bnx2x_netdev_ops = { 12107static const struct net_device_ops bnx2x_netdev_ops = {
12086 .ndo_open = bnx2x_open, 12108 .ndo_open = bnx2x_open,
12087 .ndo_stop = bnx2x_close, 12109 .ndo_stop = bnx2x_close,
@@ -12111,6 +12133,7 @@ static const struct net_device_ops bnx2x_netdev_ops = {
12111#ifdef CONFIG_NET_RX_BUSY_POLL 12133#ifdef CONFIG_NET_RX_BUSY_POLL
12112 .ndo_busy_poll = bnx2x_low_latency_recv, 12134 .ndo_busy_poll = bnx2x_low_latency_recv,
12113#endif 12135#endif
12136 .ndo_get_phys_port_id = bnx2x_get_phys_port_id,
12114}; 12137};
12115 12138
12116static int bnx2x_set_coherency_mask(struct bnx2x *bp) 12139static int bnx2x_set_coherency_mask(struct bnx2x *bp)
@@ -12274,10 +12297,13 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
12274 NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | 12297 NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO |
12275 NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; 12298 NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX;
12276 if (!CHIP_IS_E1x(bp)) { 12299 if (!CHIP_IS_E1x(bp)) {
12277 dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL; 12300 dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL |
12301 NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT;
12278 dev->hw_enc_features = 12302 dev->hw_enc_features =
12279 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG | 12303 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
12280 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | 12304 NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
12305 NETIF_F_GSO_IPIP |
12306 NETIF_F_GSO_SIT |
12281 NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL; 12307 NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL;
12282 } 12308 }
12283 12309
@@ -12310,34 +12336,11 @@ err_out_release:
12310 12336
12311err_out_disable: 12337err_out_disable:
12312 pci_disable_device(pdev); 12338 pci_disable_device(pdev);
12313 pci_set_drvdata(pdev, NULL);
12314 12339
12315err_out: 12340err_out:
12316 return rc; 12341 return rc;
12317} 12342}
12318 12343
12319static void bnx2x_get_pcie_width_speed(struct bnx2x *bp, int *width,
12320 enum bnx2x_pci_bus_speed *speed)
12321{
12322 u32 link_speed, val = 0;
12323
12324 pci_read_config_dword(bp->pdev, PCICFG_LINK_CONTROL, &val);
12325 *width = (val & PCICFG_LINK_WIDTH) >> PCICFG_LINK_WIDTH_SHIFT;
12326
12327 link_speed = (val & PCICFG_LINK_SPEED) >> PCICFG_LINK_SPEED_SHIFT;
12328
12329 switch (link_speed) {
12330 case 3:
12331 *speed = BNX2X_PCI_LINK_SPEED_8000;
12332 break;
12333 case 2:
12334 *speed = BNX2X_PCI_LINK_SPEED_5000;
12335 break;
12336 default:
12337 *speed = BNX2X_PCI_LINK_SPEED_2500;
12338 }
12339}
12340
12341static int bnx2x_check_firmware(struct bnx2x *bp) 12344static int bnx2x_check_firmware(struct bnx2x *bp)
12342{ 12345{
12343 const struct firmware *firmware = bp->firmware; 12346 const struct firmware *firmware = bp->firmware;
@@ -12694,8 +12697,8 @@ static int bnx2x_init_one(struct pci_dev *pdev,
12694{ 12697{
12695 struct net_device *dev = NULL; 12698 struct net_device *dev = NULL;
12696 struct bnx2x *bp; 12699 struct bnx2x *bp;
12697 int pcie_width; 12700 enum pcie_link_width pcie_width;
12698 enum bnx2x_pci_bus_speed pcie_speed; 12701 enum pci_bus_speed pcie_speed;
12699 int rc, max_non_def_sbs; 12702 int rc, max_non_def_sbs;
12700 int rx_count, tx_count, rss_count, doorbell_size; 12703 int rx_count, tx_count, rss_count, doorbell_size;
12701 int max_cos_est; 12704 int max_cos_est;
@@ -12844,18 +12847,19 @@ static int bnx2x_init_one(struct pci_dev *pdev,
12844 dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN); 12847 dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN);
12845 rtnl_unlock(); 12848 rtnl_unlock();
12846 } 12849 }
12847 12850 if (pcie_get_minimum_link(bp->pdev, &pcie_speed, &pcie_width) ||
12848 bnx2x_get_pcie_width_speed(bp, &pcie_width, &pcie_speed); 12851 pcie_speed == PCI_SPEED_UNKNOWN ||
12849 BNX2X_DEV_INFO("got pcie width %d and speed %d\n", 12852 pcie_width == PCIE_LNK_WIDTH_UNKNOWN)
12850 pcie_width, pcie_speed); 12853 BNX2X_DEV_INFO("Failed to determine PCI Express Bandwidth\n");
12851 12854 else
12852 BNX2X_DEV_INFO("%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n", 12855 BNX2X_DEV_INFO(
12856 "%s (%c%d) PCI-E x%d %s found at mem %lx, IRQ %d, node addr %pM\n",
12853 board_info[ent->driver_data].name, 12857 board_info[ent->driver_data].name,
12854 (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4), 12858 (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
12855 pcie_width, 12859 pcie_width,
12856 pcie_speed == BNX2X_PCI_LINK_SPEED_2500 ? "2.5GHz" : 12860 pcie_speed == PCIE_SPEED_2_5GT ? "2.5GHz" :
12857 pcie_speed == BNX2X_PCI_LINK_SPEED_5000 ? "5.0GHz" : 12861 pcie_speed == PCIE_SPEED_5_0GT ? "5.0GHz" :
12858 pcie_speed == BNX2X_PCI_LINK_SPEED_8000 ? "8.0GHz" : 12862 pcie_speed == PCIE_SPEED_8_0GT ? "8.0GHz" :
12859 "Unknown", 12863 "Unknown",
12860 dev->base_addr, bp->pdev->irq, dev->dev_addr); 12864 dev->base_addr, bp->pdev->irq, dev->dev_addr);
12861 12865
@@ -12874,7 +12878,6 @@ init_one_exit:
12874 pci_release_regions(pdev); 12878 pci_release_regions(pdev);
12875 12879
12876 pci_disable_device(pdev); 12880 pci_disable_device(pdev);
12877 pci_set_drvdata(pdev, NULL);
12878 12881
12879 return rc; 12882 return rc;
12880} 12883}
@@ -12957,7 +12960,6 @@ static void __bnx2x_remove(struct pci_dev *pdev,
12957 pci_release_regions(pdev); 12960 pci_release_regions(pdev);
12958 12961
12959 pci_disable_device(pdev); 12962 pci_disable_device(pdev);
12960 pci_set_drvdata(pdev, NULL);
12961} 12963}
12962 12964
12963static void bnx2x_remove_one(struct pci_dev *pdev) 12965static void bnx2x_remove_one(struct pci_dev *pdev)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 5e07efb6ec13..0216d592d0ce 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -2816,7 +2816,7 @@ struct set_vf_state_cookie {
2816 u8 state; 2816 u8 state;
2817}; 2817};
2818 2818
2819void bnx2x_set_vf_state(void *cookie) 2819static void bnx2x_set_vf_state(void *cookie)
2820{ 2820{
2821 struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie; 2821 struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie;
2822 2822
@@ -3239,8 +3239,9 @@ void bnx2x_disable_sriov(struct bnx2x *bp)
3239 pci_disable_sriov(bp->pdev); 3239 pci_disable_sriov(bp->pdev);
3240} 3240}
3241 3241
3242int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf, 3242static int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx,
3243 struct pf_vf_bulletin_content **bulletin) 3243 struct bnx2x_virtf **vf,
3244 struct pf_vf_bulletin_content **bulletin)
3244{ 3245{
3245 if (bp->state != BNX2X_STATE_OPEN) { 3246 if (bp->state != BNX2X_STATE_OPEN) {
3246 BNX2X_ERR("vf ndo called though PF is down\n"); 3247 BNX2X_ERR("vf ndo called though PF is down\n");
@@ -3656,29 +3657,6 @@ alloc_mem_err:
3656 return -ENOMEM; 3657 return -ENOMEM;
3657} 3658}
3658 3659
3659int bnx2x_open_epilog(struct bnx2x *bp)
3660{
3661 /* Enable sriov via delayed work. This must be done via delayed work
3662 * because it causes the probe of the vf devices to be run, which invoke
3663 * register_netdevice which must have rtnl lock taken. As we are holding
3664 * the lock right now, that could only work if the probe would not take
3665 * the lock. However, as the probe of the vf may be called from other
3666 * contexts as well (such as passthrough to vm fails) it can't assume
3667 * the lock is being held for it. Using delayed work here allows the
3668 * probe code to simply take the lock (i.e. wait for it to be released
3669 * if it is being held). We only want to do this if the number of VFs
3670 * was set before PF driver was loaded.
3671 */
3672 if (IS_SRIOV(bp) && BNX2X_NR_VIRTFN(bp)) {
3673 smp_mb__before_clear_bit();
3674 set_bit(BNX2X_SP_RTNL_ENABLE_SRIOV, &bp->sp_rtnl_state);
3675 smp_mb__after_clear_bit();
3676 schedule_delayed_work(&bp->sp_rtnl_task, 0);
3677 }
3678
3679 return 0;
3680}
3681
3682void bnx2x_iov_channel_down(struct bnx2x *bp) 3660void bnx2x_iov_channel_down(struct bnx2x *bp)
3683{ 3661{
3684 int vf_idx; 3662 int vf_idx;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
index 059f0d460af2..1ff6a9366629 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
@@ -782,7 +782,6 @@ static inline int bnx2x_vf_headroom(struct bnx2x *bp)
782void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp); 782void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp);
783int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs); 783int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs);
784void bnx2x_iov_channel_down(struct bnx2x *bp); 784void bnx2x_iov_channel_down(struct bnx2x *bp);
785int bnx2x_open_epilog(struct bnx2x *bp);
786 785
787#else /* CONFIG_BNX2X_SRIOV */ 786#else /* CONFIG_BNX2X_SRIOV */
788 787
@@ -842,7 +841,6 @@ static inline int bnx2x_vf_pci_alloc(struct bnx2x *bp) {return 0; }
842static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {} 841static inline void bnx2x_pf_set_vfs_vlan(struct bnx2x *bp) {}
843static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; } 842static inline int bnx2x_sriov_configure(struct pci_dev *dev, int num_vfs) {return 0; }
844static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {} 843static inline void bnx2x_iov_channel_down(struct bnx2x *bp) {}
845static inline int bnx2x_open_epilog(struct bnx2x *bp) {return 0; }
846 844
847#endif /* CONFIG_BNX2X_SRIOV */ 845#endif /* CONFIG_BNX2X_SRIOV */
848#endif /* bnx2x_sriov.h */ 846#endif /* bnx2x_sriov.h */
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index 28757dfacf0d..9199adf32d33 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -60,6 +60,30 @@ void bnx2x_vfpf_finalize(struct bnx2x *bp, struct vfpf_first_tlv *first_tlv)
60 mutex_unlock(&bp->vf2pf_mutex); 60 mutex_unlock(&bp->vf2pf_mutex);
61} 61}
62 62
63/* Finds a TLV by type in a TLV buffer; If found, returns pointer to the TLV */
64static void *bnx2x_search_tlv_list(struct bnx2x *bp, void *tlvs_list,
65 enum channel_tlvs req_tlv)
66{
67 struct channel_tlv *tlv = (struct channel_tlv *)tlvs_list;
68
69 do {
70 if (tlv->type == req_tlv)
71 return tlv;
72
73 if (!tlv->length) {
74 BNX2X_ERR("Found TLV with length 0\n");
75 return NULL;
76 }
77
78 tlvs_list += tlv->length;
79 tlv = (struct channel_tlv *)tlvs_list;
80 } while (tlv->type != CHANNEL_TLV_LIST_END);
81
82 DP(BNX2X_MSG_IOV, "TLV list does not contain %d TLV\n", req_tlv);
83
84 return NULL;
85}
86
63/* list the types and lengths of the tlvs on the buffer */ 87/* list the types and lengths of the tlvs on the buffer */
64void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list) 88void bnx2x_dp_tlv_list(struct bnx2x *bp, void *tlvs_list)
65{ 89{
@@ -196,6 +220,7 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
196 int rc = 0, attempts = 0; 220 int rc = 0, attempts = 0;
197 struct vfpf_acquire_tlv *req = &bp->vf2pf_mbox->req.acquire; 221 struct vfpf_acquire_tlv *req = &bp->vf2pf_mbox->req.acquire;
198 struct pfvf_acquire_resp_tlv *resp = &bp->vf2pf_mbox->resp.acquire_resp; 222 struct pfvf_acquire_resp_tlv *resp = &bp->vf2pf_mbox->resp.acquire_resp;
223 struct vfpf_port_phys_id_resp_tlv *phys_port_resp;
199 u32 vf_id; 224 u32 vf_id;
200 bool resources_acquired = false; 225 bool resources_acquired = false;
201 226
@@ -219,8 +244,14 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
219 /* pf 2 vf bulletin board address */ 244 /* pf 2 vf bulletin board address */
220 req->bulletin_addr = bp->pf2vf_bulletin_mapping; 245 req->bulletin_addr = bp->pf2vf_bulletin_mapping;
221 246
247 /* Request physical port identifier */
248 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length,
249 CHANNEL_TLV_PHYS_PORT_ID, sizeof(struct channel_tlv));
250
222 /* add list termination tlv */ 251 /* add list termination tlv */
223 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, 252 bnx2x_add_tlv(bp, req,
253 req->first_tlv.tl.length + sizeof(struct channel_tlv),
254 CHANNEL_TLV_LIST_END,
224 sizeof(struct channel_list_end_tlv)); 255 sizeof(struct channel_list_end_tlv));
225 256
226 /* output tlvs list */ 257 /* output tlvs list */
@@ -287,6 +318,15 @@ int bnx2x_vfpf_acquire(struct bnx2x *bp, u8 tx_count, u8 rx_count)
287 } 318 }
288 } 319 }
289 320
321 /* Retrieve physical port id (if possible) */
322 phys_port_resp = (struct vfpf_port_phys_id_resp_tlv *)
323 bnx2x_search_tlv_list(bp, resp,
324 CHANNEL_TLV_PHYS_PORT_ID);
325 if (phys_port_resp) {
326 memcpy(bp->phys_port_id, phys_port_resp->id, ETH_ALEN);
327 bp->flags |= HAS_PHYS_PORT_ID;
328 }
329
290 /* get HW info */ 330 /* get HW info */
291 bp->common.chip_id |= (bp->acquire_resp.pfdev_info.chip_num & 0xffff); 331 bp->common.chip_id |= (bp->acquire_resp.pfdev_info.chip_num & 0xffff);
292 bp->link_params.chip_id = bp->common.chip_id; 332 bp->link_params.chip_id = bp->common.chip_id;
@@ -983,53 +1023,59 @@ static int bnx2x_copy32_vf_dmae(struct bnx2x *bp, u8 from_vf,
983 return bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp)); 1023 return bnx2x_issue_dmae_with_comp(bp, &dmae, bnx2x_sp(bp, wb_comp));
984} 1024}
985 1025
986static void bnx2x_vf_mbx_resp(struct bnx2x *bp, struct bnx2x_virtf *vf) 1026static void bnx2x_vf_mbx_resp_single_tlv(struct bnx2x *bp,
1027 struct bnx2x_virtf *vf)
987{ 1028{
988 struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf->index); 1029 struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf->index);
989 u64 vf_addr;
990 dma_addr_t pf_addr;
991 u16 length, type; 1030 u16 length, type;
992 int rc;
993 struct pfvf_general_resp_tlv *resp = &mbx->msg->resp.general_resp;
994 1031
995 /* prepare response */ 1032 /* prepare response */
996 type = mbx->first_tlv.tl.type; 1033 type = mbx->first_tlv.tl.type;
997 length = type == CHANNEL_TLV_ACQUIRE ? 1034 length = type == CHANNEL_TLV_ACQUIRE ?
998 sizeof(struct pfvf_acquire_resp_tlv) : 1035 sizeof(struct pfvf_acquire_resp_tlv) :
999 sizeof(struct pfvf_general_resp_tlv); 1036 sizeof(struct pfvf_general_resp_tlv);
1000 bnx2x_add_tlv(bp, resp, 0, type, length); 1037 bnx2x_add_tlv(bp, &mbx->msg->resp, 0, type, length);
1001 resp->hdr.status = bnx2x_pfvf_status_codes(vf->op_rc); 1038 bnx2x_add_tlv(bp, &mbx->msg->resp, length, CHANNEL_TLV_LIST_END,
1002 bnx2x_add_tlv(bp, resp, length, CHANNEL_TLV_LIST_END,
1003 sizeof(struct channel_list_end_tlv)); 1039 sizeof(struct channel_list_end_tlv));
1040}
1041
1042static void bnx2x_vf_mbx_resp_send_msg(struct bnx2x *bp,
1043 struct bnx2x_virtf *vf)
1044{
1045 struct bnx2x_vf_mbx *mbx = BP_VF_MBX(bp, vf->index);
1046 struct pfvf_general_resp_tlv *resp = &mbx->msg->resp.general_resp;
1047 dma_addr_t pf_addr;
1048 u64 vf_addr;
1049 int rc;
1050
1004 bnx2x_dp_tlv_list(bp, resp); 1051 bnx2x_dp_tlv_list(bp, resp);
1005 DP(BNX2X_MSG_IOV, "mailbox vf address hi 0x%x, lo 0x%x, offset 0x%x\n", 1052 DP(BNX2X_MSG_IOV, "mailbox vf address hi 0x%x, lo 0x%x, offset 0x%x\n",
1006 mbx->vf_addr_hi, mbx->vf_addr_lo, mbx->first_tlv.resp_msg_offset); 1053 mbx->vf_addr_hi, mbx->vf_addr_lo, mbx->first_tlv.resp_msg_offset);
1007 1054
1055 resp->hdr.status = bnx2x_pfvf_status_codes(vf->op_rc);
1056
1008 /* send response */ 1057 /* send response */
1009 vf_addr = HILO_U64(mbx->vf_addr_hi, mbx->vf_addr_lo) + 1058 vf_addr = HILO_U64(mbx->vf_addr_hi, mbx->vf_addr_lo) +
1010 mbx->first_tlv.resp_msg_offset; 1059 mbx->first_tlv.resp_msg_offset;
1011 pf_addr = mbx->msg_mapping + 1060 pf_addr = mbx->msg_mapping +
1012 offsetof(struct bnx2x_vf_mbx_msg, resp); 1061 offsetof(struct bnx2x_vf_mbx_msg, resp);
1013 1062
1014 /* copy the response body, if there is one, before the header, as the vf 1063 /* Copy the response buffer. The first u64 is written afterwards, as
1015 * is sensitive to the header being written 1064 * the vf is sensitive to the header being written
1016 */ 1065 */
1017 if (resp->hdr.tl.length > sizeof(u64)) { 1066 vf_addr += sizeof(u64);
1018 length = resp->hdr.tl.length - sizeof(u64); 1067 pf_addr += sizeof(u64);
1019 vf_addr += sizeof(u64); 1068 rc = bnx2x_copy32_vf_dmae(bp, false, pf_addr, vf->abs_vfid,
1020 pf_addr += sizeof(u64); 1069 U64_HI(vf_addr),
1021 rc = bnx2x_copy32_vf_dmae(bp, false, pf_addr, vf->abs_vfid, 1070 U64_LO(vf_addr),
1022 U64_HI(vf_addr), 1071 (sizeof(union pfvf_tlvs) - sizeof(u64))/4);
1023 U64_LO(vf_addr), 1072 if (rc) {
1024 length/4); 1073 BNX2X_ERR("Failed to copy response body to VF %d\n",
1025 if (rc) { 1074 vf->abs_vfid);
1026 BNX2X_ERR("Failed to copy response body to VF %d\n", 1075 goto mbx_error;
1027 vf->abs_vfid);
1028 goto mbx_error;
1029 }
1030 vf_addr -= sizeof(u64);
1031 pf_addr -= sizeof(u64);
1032 } 1076 }
1077 vf_addr -= sizeof(u64);
1078 pf_addr -= sizeof(u64);
1033 1079
1034 /* ack the FW */ 1080 /* ack the FW */
1035 storm_memset_vf_mbx_ack(bp, vf->abs_vfid); 1081 storm_memset_vf_mbx_ack(bp, vf->abs_vfid);
@@ -1060,6 +1106,36 @@ mbx_error:
1060 bnx2x_vf_release(bp, vf, false); /* non blocking */ 1106 bnx2x_vf_release(bp, vf, false); /* non blocking */
1061} 1107}
1062 1108
1109static void bnx2x_vf_mbx_resp(struct bnx2x *bp,
1110 struct bnx2x_virtf *vf)
1111{
1112 bnx2x_vf_mbx_resp_single_tlv(bp, vf);
1113 bnx2x_vf_mbx_resp_send_msg(bp, vf);
1114}
1115
1116static void bnx2x_vf_mbx_resp_phys_port(struct bnx2x *bp,
1117 struct bnx2x_virtf *vf,
1118 void *buffer,
1119 u16 *offset)
1120{
1121 struct vfpf_port_phys_id_resp_tlv *port_id;
1122
1123 if (!(bp->flags & HAS_PHYS_PORT_ID))
1124 return;
1125
1126 bnx2x_add_tlv(bp, buffer, *offset, CHANNEL_TLV_PHYS_PORT_ID,
1127 sizeof(struct vfpf_port_phys_id_resp_tlv));
1128
1129 port_id = (struct vfpf_port_phys_id_resp_tlv *)
1130 (((u8 *)buffer) + *offset);
1131 memcpy(port_id->id, bp->phys_port_id, ETH_ALEN);
1132
1133 /* Offset should continue representing the offset to the tail
1134 * of TLV data (outside this function scope)
1135 */
1136 *offset += sizeof(struct vfpf_port_phys_id_resp_tlv);
1137}
1138
1063static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf, 1139static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf,
1064 struct bnx2x_vf_mbx *mbx, int vfop_status) 1140 struct bnx2x_vf_mbx *mbx, int vfop_status)
1065{ 1141{
@@ -1067,6 +1143,7 @@ static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf,
1067 struct pfvf_acquire_resp_tlv *resp = &mbx->msg->resp.acquire_resp; 1143 struct pfvf_acquire_resp_tlv *resp = &mbx->msg->resp.acquire_resp;
1068 struct pf_vf_resc *resc = &resp->resc; 1144 struct pf_vf_resc *resc = &resp->resc;
1069 u8 status = bnx2x_pfvf_status_codes(vfop_status); 1145 u8 status = bnx2x_pfvf_status_codes(vfop_status);
1146 u16 length;
1070 1147
1071 memset(resp, 0, sizeof(*resp)); 1148 memset(resp, 0, sizeof(*resp));
1072 1149
@@ -1140,9 +1217,24 @@ static void bnx2x_vf_mbx_acquire_resp(struct bnx2x *bp, struct bnx2x_virtf *vf,
1140 resc->hw_sbs[i].sb_qid); 1217 resc->hw_sbs[i].sb_qid);
1141 DP_CONT(BNX2X_MSG_IOV, "]\n"); 1218 DP_CONT(BNX2X_MSG_IOV, "]\n");
1142 1219
1220 /* prepare response */
1221 length = sizeof(struct pfvf_acquire_resp_tlv);
1222 bnx2x_add_tlv(bp, &mbx->msg->resp, 0, CHANNEL_TLV_ACQUIRE, length);
1223
1224 /* Handle possible VF requests for physical port identifiers.
1225 * 'length' should continue to indicate the offset of the first empty
1226 * place in the buffer (i.e., where next TLV should be inserted)
1227 */
1228 if (bnx2x_search_tlv_list(bp, &mbx->msg->req,
1229 CHANNEL_TLV_PHYS_PORT_ID))
1230 bnx2x_vf_mbx_resp_phys_port(bp, vf, &mbx->msg->resp, &length);
1231
1232 bnx2x_add_tlv(bp, &mbx->msg->resp, length, CHANNEL_TLV_LIST_END,
1233 sizeof(struct channel_list_end_tlv));
1234
1143 /* send the response */ 1235 /* send the response */
1144 vf->op_rc = vfop_status; 1236 vf->op_rc = vfop_status;
1145 bnx2x_vf_mbx_resp(bp, vf); 1237 bnx2x_vf_mbx_resp_send_msg(bp, vf);
1146} 1238}
1147 1239
1148static void bnx2x_vf_mbx_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf, 1240static void bnx2x_vf_mbx_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
@@ -1874,6 +1966,9 @@ void bnx2x_vf_mbx(struct bnx2x *bp, struct vf_pf_event_data *vfpf_event)
1874 /* process the VF message header */ 1966 /* process the VF message header */
1875 mbx->first_tlv = mbx->msg->req.first_tlv; 1967 mbx->first_tlv = mbx->msg->req.first_tlv;
1876 1968
1969 /* Clean response buffer to refrain from falsely seeing chains */
1970 memset(&mbx->msg->resp, 0, sizeof(union pfvf_tlvs));
1971
1877 /* dispatch the request (will prepare the response) */ 1972 /* dispatch the request (will prepare the response) */
1878 bnx2x_vf_mbx_request(bp, vf, mbx); 1973 bnx2x_vf_mbx_request(bp, vf, mbx);
1879 goto mbx_done; 1974 goto mbx_done;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h
index 1179fe06d0c7..208568bc7a71 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h
@@ -188,6 +188,12 @@ struct pfvf_acquire_resp_tlv {
188 } resc; 188 } resc;
189}; 189};
190 190
191struct vfpf_port_phys_id_resp_tlv {
192 struct channel_tlv tl;
193 u8 id[ETH_ALEN];
194 u8 padding[2];
195};
196
191#define VFPF_INIT_FLG_STATS_COALESCE (1 << 0) /* when set the VFs queues 197#define VFPF_INIT_FLG_STATS_COALESCE (1 << 0) /* when set the VFs queues
192 * stats will be coalesced on 198 * stats will be coalesced on
193 * the leading RSS queue 199 * the leading RSS queue
@@ -398,6 +404,7 @@ enum channel_tlvs {
398 CHANNEL_TLV_PF_SET_MAC, 404 CHANNEL_TLV_PF_SET_MAC,
399 CHANNEL_TLV_PF_SET_VLAN, 405 CHANNEL_TLV_PF_SET_VLAN,
400 CHANNEL_TLV_UPDATE_RSS, 406 CHANNEL_TLV_UPDATE_RSS,
407 CHANNEL_TLV_PHYS_PORT_ID,
401 CHANNEL_TLV_MAX 408 CHANNEL_TLV_MAX
402}; 409};
403 410
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 99394bd49a13..f58a8b80302d 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -393,7 +393,7 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
393 393
394 csk->vlan_id = path_resp->vlan_id; 394 csk->vlan_id = path_resp->vlan_id;
395 395
396 memcpy(csk->ha, path_resp->mac_addr, 6); 396 memcpy(csk->ha, path_resp->mac_addr, ETH_ALEN);
397 if (test_bit(SK_F_IPV6, &csk->flags)) 397 if (test_bit(SK_F_IPV6, &csk->flags))
398 memcpy(&csk->src_ip[0], &path_resp->src.v6_addr, 398 memcpy(&csk->src_ip[0], &path_resp->src.v6_addr,
399 sizeof(struct in6_addr)); 399 sizeof(struct in6_addr));
@@ -5572,7 +5572,7 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)
5572 if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS) 5572 if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
5573 cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS; 5573 cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
5574 5574
5575 memcpy(cdev->mac_addr, ethdev->iscsi_mac, 6); 5575 memcpy(cdev->mac_addr, ethdev->iscsi_mac, ETH_ALEN);
5576 5576
5577 cp->cnic_ops = &cnic_bnx2x_ops; 5577 cp->cnic_ops = &cnic_bnx2x_ops;
5578 cp->start_hw = cnic_start_bnx2x_hw; 5578 cp->start_hw = cnic_start_bnx2x_hw;
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h b/drivers/net/ethernet/broadcom/cnic_if.h
index 0658b43e148c..ebbfe25acaa6 100644
--- a/drivers/net/ethernet/broadcom/cnic_if.h
+++ b/drivers/net/ethernet/broadcom/cnic_if.h
@@ -353,8 +353,8 @@ struct cnic_ulp_ops {
353 atomic_t ref_count; 353 atomic_t ref_count;
354}; 354};
355 355
356extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); 356int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops);
357 357
358extern int cnic_unregister_driver(int ulp_type); 358int cnic_unregister_driver(int ulp_type);
359 359
360#endif 360#endif
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 12d961c4ebca..00c5be8c55b8 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
94 94
95#define DRV_MODULE_NAME "tg3" 95#define DRV_MODULE_NAME "tg3"
96#define TG3_MAJ_NUM 3 96#define TG3_MAJ_NUM 3
97#define TG3_MIN_NUM 133 97#define TG3_MIN_NUM 134
98#define DRV_MODULE_VERSION \ 98#define DRV_MODULE_VERSION \
99 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) 99 __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
100#define DRV_MODULE_RELDATE "Jul 29, 2013" 100#define DRV_MODULE_RELDATE "Sep 16, 2013"
101 101
102#define RESET_KIND_SHUTDOWN 0 102#define RESET_KIND_SHUTDOWN 0
103#define RESET_KIND_INIT 1 103#define RESET_KIND_INIT 1
@@ -337,6 +337,11 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = {
337 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)}, 337 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)},
338 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)}, 338 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)},
339 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)}, 339 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)},
340 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57764)},
341 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57767)},
342 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57787)},
343 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57782)},
344 {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57786)},
340 {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, 345 {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
341 {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, 346 {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
342 {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, 347 {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
@@ -1326,6 +1331,12 @@ static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable)
1326 return err; 1331 return err;
1327} 1332}
1328 1333
1334static int tg3_phy_shdw_write(struct tg3 *tp, int reg, u32 val)
1335{
1336 return tg3_writephy(tp, MII_TG3_MISC_SHDW,
1337 reg | val | MII_TG3_MISC_SHDW_WREN);
1338}
1339
1329static int tg3_bmcr_reset(struct tg3 *tp) 1340static int tg3_bmcr_reset(struct tg3 *tp)
1330{ 1341{
1331 u32 phy_control; 1342 u32 phy_control;
@@ -1364,7 +1375,7 @@ static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg)
1364 1375
1365 spin_lock_bh(&tp->lock); 1376 spin_lock_bh(&tp->lock);
1366 1377
1367 if (tg3_readphy(tp, reg, &val)) 1378 if (__tg3_readphy(tp, mii_id, reg, &val))
1368 val = -EIO; 1379 val = -EIO;
1369 1380
1370 spin_unlock_bh(&tp->lock); 1381 spin_unlock_bh(&tp->lock);
@@ -1379,7 +1390,7 @@ static int tg3_mdio_write(struct mii_bus *bp, int mii_id, int reg, u16 val)
1379 1390
1380 spin_lock_bh(&tp->lock); 1391 spin_lock_bh(&tp->lock);
1381 1392
1382 if (tg3_writephy(tp, reg, val)) 1393 if (__tg3_writephy(tp, mii_id, reg, val))
1383 ret = -EIO; 1394 ret = -EIO;
1384 1395
1385 spin_unlock_bh(&tp->lock); 1396 spin_unlock_bh(&tp->lock);
@@ -1397,7 +1408,7 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
1397 u32 val; 1408 u32 val;
1398 struct phy_device *phydev; 1409 struct phy_device *phydev;
1399 1410
1400 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 1411 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
1401 switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { 1412 switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
1402 case PHY_ID_BCM50610: 1413 case PHY_ID_BCM50610:
1403 case PHY_ID_BCM50610M: 1414 case PHY_ID_BCM50610M:
@@ -1502,6 +1513,13 @@ static int tg3_mdio_init(struct tg3 *tp)
1502 TG3_CPMU_PHY_STRAP_IS_SERDES; 1513 TG3_CPMU_PHY_STRAP_IS_SERDES;
1503 if (is_serdes) 1514 if (is_serdes)
1504 tp->phy_addr += 7; 1515 tp->phy_addr += 7;
1516 } else if (tg3_flag(tp, IS_SSB_CORE) && tg3_flag(tp, ROBOSWITCH)) {
1517 int addr;
1518
1519 addr = ssb_gige_get_phyaddr(tp->pdev);
1520 if (addr < 0)
1521 return addr;
1522 tp->phy_addr = addr;
1505 } else 1523 } else
1506 tp->phy_addr = TG3_PHY_MII_ADDR; 1524 tp->phy_addr = TG3_PHY_MII_ADDR;
1507 1525
@@ -1522,7 +1540,7 @@ static int tg3_mdio_init(struct tg3 *tp)
1522 tp->mdio_bus->read = &tg3_mdio_read; 1540 tp->mdio_bus->read = &tg3_mdio_read;
1523 tp->mdio_bus->write = &tg3_mdio_write; 1541 tp->mdio_bus->write = &tg3_mdio_write;
1524 tp->mdio_bus->reset = &tg3_mdio_reset; 1542 tp->mdio_bus->reset = &tg3_mdio_reset;
1525 tp->mdio_bus->phy_mask = ~(1 << TG3_PHY_MII_ADDR); 1543 tp->mdio_bus->phy_mask = ~(1 << tp->phy_addr);
1526 tp->mdio_bus->irq = &tp->mdio_irq[0]; 1544 tp->mdio_bus->irq = &tp->mdio_irq[0];
1527 1545
1528 for (i = 0; i < PHY_MAX_ADDR; i++) 1546 for (i = 0; i < PHY_MAX_ADDR; i++)
@@ -1543,7 +1561,7 @@ static int tg3_mdio_init(struct tg3 *tp)
1543 return i; 1561 return i;
1544 } 1562 }
1545 1563
1546 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 1564 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
1547 1565
1548 if (!phydev || !phydev->drv) { 1566 if (!phydev || !phydev->drv) {
1549 dev_warn(&tp->pdev->dev, "No PHY devices\n"); 1567 dev_warn(&tp->pdev->dev, "No PHY devices\n");
@@ -1953,7 +1971,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv)
1953 u32 old_tx_mode = tp->tx_mode; 1971 u32 old_tx_mode = tp->tx_mode;
1954 1972
1955 if (tg3_flag(tp, USE_PHYLIB)) 1973 if (tg3_flag(tp, USE_PHYLIB))
1956 autoneg = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]->autoneg; 1974 autoneg = tp->mdio_bus->phy_map[tp->phy_addr]->autoneg;
1957 else 1975 else
1958 autoneg = tp->link_config.autoneg; 1976 autoneg = tp->link_config.autoneg;
1959 1977
@@ -1989,7 +2007,7 @@ static void tg3_adjust_link(struct net_device *dev)
1989 u8 oldflowctrl, linkmesg = 0; 2007 u8 oldflowctrl, linkmesg = 0;
1990 u32 mac_mode, lcl_adv, rmt_adv; 2008 u32 mac_mode, lcl_adv, rmt_adv;
1991 struct tg3 *tp = netdev_priv(dev); 2009 struct tg3 *tp = netdev_priv(dev);
1992 struct phy_device *phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 2010 struct phy_device *phydev = tp->mdio_bus->phy_map[tp->phy_addr];
1993 2011
1994 spin_lock_bh(&tp->lock); 2012 spin_lock_bh(&tp->lock);
1995 2013
@@ -2078,7 +2096,7 @@ static int tg3_phy_init(struct tg3 *tp)
2078 /* Bring the PHY back to a known state. */ 2096 /* Bring the PHY back to a known state. */
2079 tg3_bmcr_reset(tp); 2097 tg3_bmcr_reset(tp);
2080 2098
2081 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 2099 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
2082 2100
2083 /* Attach the MAC to the PHY. */ 2101 /* Attach the MAC to the PHY. */
2084 phydev = phy_connect(tp->dev, dev_name(&phydev->dev), 2102 phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
@@ -2105,7 +2123,7 @@ static int tg3_phy_init(struct tg3 *tp)
2105 SUPPORTED_Asym_Pause); 2123 SUPPORTED_Asym_Pause);
2106 break; 2124 break;
2107 default: 2125 default:
2108 phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 2126 phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]);
2109 return -EINVAL; 2127 return -EINVAL;
2110 } 2128 }
2111 2129
@@ -2123,7 +2141,7 @@ static void tg3_phy_start(struct tg3 *tp)
2123 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) 2141 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
2124 return; 2142 return;
2125 2143
2126 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 2144 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
2127 2145
2128 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) { 2146 if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) {
2129 tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER; 2147 tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER;
@@ -2143,13 +2161,13 @@ static void tg3_phy_stop(struct tg3 *tp)
2143 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) 2161 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
2144 return; 2162 return;
2145 2163
2146 phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 2164 phy_stop(tp->mdio_bus->phy_map[tp->phy_addr]);
2147} 2165}
2148 2166
2149static void tg3_phy_fini(struct tg3 *tp) 2167static void tg3_phy_fini(struct tg3 *tp)
2150{ 2168{
2151 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) { 2169 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
2152 phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 2170 phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]);
2153 tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED; 2171 tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED;
2154 } 2172 }
2155} 2173}
@@ -2218,25 +2236,21 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable)
2218 return; 2236 return;
2219 } 2237 }
2220 2238
2221 reg = MII_TG3_MISC_SHDW_WREN | 2239 reg = MII_TG3_MISC_SHDW_SCR5_LPED |
2222 MII_TG3_MISC_SHDW_SCR5_SEL |
2223 MII_TG3_MISC_SHDW_SCR5_LPED |
2224 MII_TG3_MISC_SHDW_SCR5_DLPTLM | 2240 MII_TG3_MISC_SHDW_SCR5_DLPTLM |
2225 MII_TG3_MISC_SHDW_SCR5_SDTL | 2241 MII_TG3_MISC_SHDW_SCR5_SDTL |
2226 MII_TG3_MISC_SHDW_SCR5_C125OE; 2242 MII_TG3_MISC_SHDW_SCR5_C125OE;
2227 if (tg3_asic_rev(tp) != ASIC_REV_5784 || !enable) 2243 if (tg3_asic_rev(tp) != ASIC_REV_5784 || !enable)
2228 reg |= MII_TG3_MISC_SHDW_SCR5_DLLAPD; 2244 reg |= MII_TG3_MISC_SHDW_SCR5_DLLAPD;
2229 2245
2230 tg3_writephy(tp, MII_TG3_MISC_SHDW, reg); 2246 tg3_phy_shdw_write(tp, MII_TG3_MISC_SHDW_SCR5_SEL, reg);
2231 2247
2232 2248
2233 reg = MII_TG3_MISC_SHDW_WREN | 2249 reg = MII_TG3_MISC_SHDW_APD_WKTM_84MS;
2234 MII_TG3_MISC_SHDW_APD_SEL |
2235 MII_TG3_MISC_SHDW_APD_WKTM_84MS;
2236 if (enable) 2250 if (enable)
2237 reg |= MII_TG3_MISC_SHDW_APD_ENABLE; 2251 reg |= MII_TG3_MISC_SHDW_APD_ENABLE;
2238 2252
2239 tg3_writephy(tp, MII_TG3_MISC_SHDW, reg); 2253 tg3_phy_shdw_write(tp, MII_TG3_MISC_SHDW_APD_SEL, reg);
2240} 2254}
2241 2255
2242static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable) 2256static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable)
@@ -4027,7 +4041,7 @@ static int tg3_power_down_prepare(struct tg3 *tp)
4027 struct phy_device *phydev; 4041 struct phy_device *phydev;
4028 u32 phyid, advertising; 4042 u32 phyid, advertising;
4029 4043
4030 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 4044 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
4031 4045
4032 tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER; 4046 tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER;
4033 4047
@@ -6848,12 +6862,6 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
6848 pci_unmap_single(tp->pdev, dma_addr, skb_size, 6862 pci_unmap_single(tp->pdev, dma_addr, skb_size,
6849 PCI_DMA_FROMDEVICE); 6863 PCI_DMA_FROMDEVICE);
6850 6864
6851 skb = build_skb(data, frag_size);
6852 if (!skb) {
6853 tg3_frag_free(frag_size != 0, data);
6854 goto drop_it_no_recycle;
6855 }
6856 skb_reserve(skb, TG3_RX_OFFSET(tp));
6857 /* Ensure that the update to the data happens 6865 /* Ensure that the update to the data happens
6858 * after the usage of the old DMA mapping. 6866 * after the usage of the old DMA mapping.
6859 */ 6867 */
@@ -6861,6 +6869,12 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
6861 6869
6862 ri->data = NULL; 6870 ri->data = NULL;
6863 6871
6872 skb = build_skb(data, frag_size);
6873 if (!skb) {
6874 tg3_frag_free(frag_size != 0, data);
6875 goto drop_it_no_recycle;
6876 }
6877 skb_reserve(skb, TG3_RX_OFFSET(tp));
6864 } else { 6878 } else {
6865 tg3_recycle_rx(tnapi, tpr, opaque_key, 6879 tg3_recycle_rx(tnapi, tpr, opaque_key,
6866 desc_idx, *post_ptr); 6880 desc_idx, *post_ptr);
@@ -9196,10 +9210,7 @@ static int tg3_halt(struct tg3 *tp, int kind, bool silent)
9196 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); 9210 memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
9197 } 9211 }
9198 9212
9199 if (err) 9213 return err;
9200 return err;
9201
9202 return 0;
9203} 9214}
9204 9215
9205static int tg3_set_mac_addr(struct net_device *dev, void *p) 9216static int tg3_set_mac_addr(struct net_device *dev, void *p)
@@ -11035,7 +11046,18 @@ static int tg3_request_irq(struct tg3 *tp, int irq_num)
11035 name = tp->dev->name; 11046 name = tp->dev->name;
11036 else { 11047 else {
11037 name = &tnapi->irq_lbl[0]; 11048 name = &tnapi->irq_lbl[0];
11038 snprintf(name, IFNAMSIZ, "%s-%d", tp->dev->name, irq_num); 11049 if (tnapi->tx_buffers && tnapi->rx_rcb)
11050 snprintf(name, IFNAMSIZ,
11051 "%s-txrx-%d", tp->dev->name, irq_num);
11052 else if (tnapi->tx_buffers)
11053 snprintf(name, IFNAMSIZ,
11054 "%s-tx-%d", tp->dev->name, irq_num);
11055 else if (tnapi->rx_rcb)
11056 snprintf(name, IFNAMSIZ,
11057 "%s-rx-%d", tp->dev->name, irq_num);
11058 else
11059 snprintf(name, IFNAMSIZ,
11060 "%s-%d", tp->dev->name, irq_num);
11039 name[IFNAMSIZ-1] = 0; 11061 name[IFNAMSIZ-1] = 0;
11040 } 11062 }
11041 11063
@@ -11907,7 +11929,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
11907 struct phy_device *phydev; 11929 struct phy_device *phydev;
11908 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) 11930 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
11909 return -EAGAIN; 11931 return -EAGAIN;
11910 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 11932 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
11911 return phy_ethtool_gset(phydev, cmd); 11933 return phy_ethtool_gset(phydev, cmd);
11912 } 11934 }
11913 11935
@@ -11974,7 +11996,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
11974 struct phy_device *phydev; 11996 struct phy_device *phydev;
11975 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) 11997 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
11976 return -EAGAIN; 11998 return -EAGAIN;
11977 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 11999 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
11978 return phy_ethtool_sset(phydev, cmd); 12000 return phy_ethtool_sset(phydev, cmd);
11979 } 12001 }
11980 12002
@@ -12093,12 +12115,10 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
12093 12115
12094 device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC); 12116 device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC);
12095 12117
12096 spin_lock_bh(&tp->lock);
12097 if (device_may_wakeup(dp)) 12118 if (device_may_wakeup(dp))
12098 tg3_flag_set(tp, WOL_ENABLE); 12119 tg3_flag_set(tp, WOL_ENABLE);
12099 else 12120 else
12100 tg3_flag_clear(tp, WOL_ENABLE); 12121 tg3_flag_clear(tp, WOL_ENABLE);
12101 spin_unlock_bh(&tp->lock);
12102 12122
12103 return 0; 12123 return 0;
12104} 12124}
@@ -12131,7 +12151,7 @@ static int tg3_nway_reset(struct net_device *dev)
12131 if (tg3_flag(tp, USE_PHYLIB)) { 12151 if (tg3_flag(tp, USE_PHYLIB)) {
12132 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) 12152 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
12133 return -EAGAIN; 12153 return -EAGAIN;
12134 r = phy_start_aneg(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); 12154 r = phy_start_aneg(tp->mdio_bus->phy_map[tp->phy_addr]);
12135 } else { 12155 } else {
12136 u32 bmcr; 12156 u32 bmcr;
12137 12157
@@ -12247,7 +12267,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam
12247 u32 newadv; 12267 u32 newadv;
12248 struct phy_device *phydev; 12268 struct phy_device *phydev;
12249 12269
12250 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 12270 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
12251 12271
12252 if (!(phydev->supported & SUPPORTED_Pause) || 12272 if (!(phydev->supported & SUPPORTED_Pause) ||
12253 (!(phydev->supported & SUPPORTED_Asym_Pause) && 12273 (!(phydev->supported & SUPPORTED_Asym_Pause) &&
@@ -13194,8 +13214,8 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback)
13194 return -ENOMEM; 13214 return -ENOMEM;
13195 13215
13196 tx_data = skb_put(skb, tx_len); 13216 tx_data = skb_put(skb, tx_len);
13197 memcpy(tx_data, tp->dev->dev_addr, 6); 13217 memcpy(tx_data, tp->dev->dev_addr, ETH_ALEN);
13198 memset(tx_data + 6, 0x0, 8); 13218 memset(tx_data + ETH_ALEN, 0x0, 8);
13199 13219
13200 tw32(MAC_RX_MTU_SIZE, tx_len + ETH_FCS_LEN); 13220 tw32(MAC_RX_MTU_SIZE, tx_len + ETH_FCS_LEN);
13201 13221
@@ -13683,7 +13703,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
13683 struct phy_device *phydev; 13703 struct phy_device *phydev;
13684 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) 13704 if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED))
13685 return -EAGAIN; 13705 return -EAGAIN;
13686 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 13706 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
13687 return phy_mii_ioctl(phydev, ifr, cmd); 13707 return phy_mii_ioctl(phydev, ifr, cmd);
13688 } 13708 }
13689 13709
@@ -14921,6 +14941,12 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
14921 tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1) 14941 tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1)
14922 tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 | 14942 tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 |
14923 LED_CTRL_MODE_PHY_2); 14943 LED_CTRL_MODE_PHY_2);
14944
14945 if (tg3_flag(tp, 5717_PLUS) ||
14946 tg3_asic_rev(tp) == ASIC_REV_5762)
14947 tp->led_ctrl |= LED_CTRL_BLINK_RATE_OVERRIDE |
14948 LED_CTRL_BLINK_RATE_MASK;
14949
14924 break; 14950 break;
14925 14951
14926 case SHASTA_EXT_LED_MAC: 14952 case SHASTA_EXT_LED_MAC:
@@ -15759,9 +15785,12 @@ static void tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg)
15759 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || 15785 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
15760 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || 15786 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
15761 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || 15787 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 ||
15788 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 ||
15789 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 ||
15762 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || 15790 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 ||
15763 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || 15791 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 ||
15764 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) 15792 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 ||
15793 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787)
15765 reg = TG3PCI_GEN2_PRODID_ASICREV; 15794 reg = TG3PCI_GEN2_PRODID_ASICREV;
15766 else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 || 15795 else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 ||
15767 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 || 15796 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
@@ -16632,8 +16661,8 @@ static int tg3_get_macaddr_sparc(struct tg3 *tp)
16632 int len; 16661 int len;
16633 16662
16634 addr = of_get_property(dp, "local-mac-address", &len); 16663 addr = of_get_property(dp, "local-mac-address", &len);
16635 if (addr && len == 6) { 16664 if (addr && len == ETH_ALEN) {
16636 memcpy(dev->dev_addr, addr, 6); 16665 memcpy(dev->dev_addr, addr, ETH_ALEN);
16637 return 0; 16666 return 0;
16638 } 16667 }
16639 return -ENODEV; 16668 return -ENODEV;
@@ -16643,7 +16672,7 @@ static int tg3_get_default_macaddr_sparc(struct tg3 *tp)
16643{ 16672{
16644 struct net_device *dev = tp->dev; 16673 struct net_device *dev = tp->dev;
16645 16674
16646 memcpy(dev->dev_addr, idprom->id_ethaddr, 6); 16675 memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN);
16647 return 0; 16676 return 0;
16648} 16677}
16649#endif 16678#endif
@@ -17052,10 +17081,6 @@ static int tg3_test_dma(struct tg3 *tp)
17052 17081
17053 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); 17082 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
17054 17083
17055#if 0
17056 /* Unneeded, already done by tg3_get_invariants. */
17057 tg3_switch_clocks(tp);
17058#endif
17059 17084
17060 if (tg3_asic_rev(tp) != ASIC_REV_5700 && 17085 if (tg3_asic_rev(tp) != ASIC_REV_5700 &&
17061 tg3_asic_rev(tp) != ASIC_REV_5701) 17086 tg3_asic_rev(tp) != ASIC_REV_5701)
@@ -17083,20 +17108,6 @@ static int tg3_test_dma(struct tg3 *tp)
17083 break; 17108 break;
17084 } 17109 }
17085 17110
17086#if 0
17087 /* validate data reached card RAM correctly. */
17088 for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) {
17089 u32 val;
17090 tg3_read_mem(tp, 0x2100 + (i*4), &val);
17091 if (le32_to_cpu(val) != p[i]) {
17092 dev_err(&tp->pdev->dev,
17093 "%s: Buffer corrupted on device! "
17094 "(%d != %d)\n", __func__, val, i);
17095 /* ret = -ENODEV here? */
17096 }
17097 p[i] = 0;
17098 }
17099#endif
17100 /* Now read it back. */ 17111 /* Now read it back. */
17101 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false); 17112 ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false);
17102 if (ret) { 17113 if (ret) {
@@ -17362,8 +17373,10 @@ static int tg3_init_one(struct pci_dev *pdev,
17362 tg3_flag_set(tp, FLUSH_POSTED_WRITES); 17373 tg3_flag_set(tp, FLUSH_POSTED_WRITES);
17363 if (ssb_gige_one_dma_at_once(pdev)) 17374 if (ssb_gige_one_dma_at_once(pdev))
17364 tg3_flag_set(tp, ONE_DMA_AT_ONCE); 17375 tg3_flag_set(tp, ONE_DMA_AT_ONCE);
17365 if (ssb_gige_have_roboswitch(pdev)) 17376 if (ssb_gige_have_roboswitch(pdev)) {
17377 tg3_flag_set(tp, USE_PHYLIB);
17366 tg3_flag_set(tp, ROBOSWITCH); 17378 tg3_flag_set(tp, ROBOSWITCH);
17379 }
17367 if (ssb_gige_is_rgmii(pdev)) 17380 if (ssb_gige_is_rgmii(pdev))
17368 tg3_flag_set(tp, RGMII_MODE); 17381 tg3_flag_set(tp, RGMII_MODE);
17369 } 17382 }
@@ -17409,9 +17422,12 @@ static int tg3_init_one(struct pci_dev *pdev,
17409 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || 17422 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
17410 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || 17423 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
17411 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || 17424 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 ||
17425 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 ||
17426 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 ||
17412 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || 17427 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 ||
17413 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || 17428 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 ||
17414 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) { 17429 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 ||
17430 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) {
17415 tg3_flag_set(tp, ENABLE_APE); 17431 tg3_flag_set(tp, ENABLE_APE);
17416 tp->aperegs = pci_ioremap_bar(pdev, BAR_2); 17432 tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
17417 if (!tp->aperegs) { 17433 if (!tp->aperegs) {
@@ -17628,7 +17644,7 @@ static int tg3_init_one(struct pci_dev *pdev,
17628 17644
17629 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) { 17645 if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) {
17630 struct phy_device *phydev; 17646 struct phy_device *phydev;
17631 phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; 17647 phydev = tp->mdio_bus->phy_map[tp->phy_addr];
17632 netdev_info(dev, 17648 netdev_info(dev,
17633 "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", 17649 "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n",
17634 phydev->drv->name, dev_name(&phydev->dev)); 17650 phydev->drv->name, dev_name(&phydev->dev));
@@ -17685,7 +17701,6 @@ err_out_free_res:
17685err_out_disable_pdev: 17701err_out_disable_pdev:
17686 if (pci_is_enabled(pdev)) 17702 if (pci_is_enabled(pdev))
17687 pci_disable_device(pdev); 17703 pci_disable_device(pdev);
17688 pci_set_drvdata(pdev, NULL);
17689 return err; 17704 return err;
17690} 17705}
17691 17706
@@ -17717,7 +17732,6 @@ static void tg3_remove_one(struct pci_dev *pdev)
17717 free_netdev(dev); 17732 free_netdev(dev);
17718 pci_release_regions(pdev); 17733 pci_release_regions(pdev);
17719 pci_disable_device(pdev); 17734 pci_disable_device(pdev);
17720 pci_set_drvdata(pdev, NULL);
17721 } 17735 }
17722} 17736}
17723 17737
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index 70257808aa37..5c3835aa1e1b 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -68,6 +68,9 @@
68#define TG3PCI_DEVICE_TIGON3_5762 0x1687 68#define TG3PCI_DEVICE_TIGON3_5762 0x1687
69#define TG3PCI_DEVICE_TIGON3_5725 0x1643 69#define TG3PCI_DEVICE_TIGON3_5725 0x1643
70#define TG3PCI_DEVICE_TIGON3_5727 0x16f3 70#define TG3PCI_DEVICE_TIGON3_5727 0x16f3
71#define TG3PCI_DEVICE_TIGON3_57764 0x1642
72#define TG3PCI_DEVICE_TIGON3_57767 0x1683
73#define TG3PCI_DEVICE_TIGON3_57787 0x1641
71/* 0x04 --> 0x2c unused */ 74/* 0x04 --> 0x2c unused */
72#define TG3PCI_SUBVENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM 75#define TG3PCI_SUBVENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM
73#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6 0x1644 76#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6 0x1644