aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2012-02-13 10:20:12 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-13 20:45:06 -0500
commitb28f389d92114ecf1a7c99eb3865438543a1808b (patch)
treebf3d0d881b3fa53529b7b11247c1d80a5e65a961 /drivers
parent422782249927e887a4c032d1d7e1f59de281ecbb (diff)
tg3: Reduce UMP event collision window
The tg3 driver needs to submit a few phy register values to the UMP firmware each time the link state changes. Up until now, the driver would wait for the previous event to complete, then proceed to gather data through a series of phy accesses. Since phy accesses are relatively slow, it is possible for another thread to attempt to submit its own event while the UMP code is still construction its message. This patch seeks to minimize the collision window as much as possible by preloading the phy data. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 67b6d61abfe1..31a8e8a64a6c 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1453,33 +1453,23 @@ static void tg3_wait_for_event_ack(struct tg3 *tp)
1453} 1453}
1454 1454
1455/* tp->lock is held. */ 1455/* tp->lock is held. */
1456static void tg3_ump_link_report(struct tg3 *tp) 1456static void tg3_phy_gather_ump_data(struct tg3 *tp, u32 *data)
1457{ 1457{
1458 u32 reg; 1458 u32 reg, val;
1459 u32 val;
1460
1461 if (!tg3_flag(tp, 5780_CLASS) || !tg3_flag(tp, ENABLE_ASF))
1462 return;
1463
1464 tg3_wait_for_event_ack(tp);
1465
1466 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_LINK_UPDATE);
1467
1468 tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 14);
1469 1459
1470 val = 0; 1460 val = 0;
1471 if (!tg3_readphy(tp, MII_BMCR, &reg)) 1461 if (!tg3_readphy(tp, MII_BMCR, &reg))
1472 val = reg << 16; 1462 val = reg << 16;
1473 if (!tg3_readphy(tp, MII_BMSR, &reg)) 1463 if (!tg3_readphy(tp, MII_BMSR, &reg))
1474 val |= (reg & 0xffff); 1464 val |= (reg & 0xffff);
1475 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX, val); 1465 *data++ = val;
1476 1466
1477 val = 0; 1467 val = 0;
1478 if (!tg3_readphy(tp, MII_ADVERTISE, &reg)) 1468 if (!tg3_readphy(tp, MII_ADVERTISE, &reg))
1479 val = reg << 16; 1469 val = reg << 16;
1480 if (!tg3_readphy(tp, MII_LPA, &reg)) 1470 if (!tg3_readphy(tp, MII_LPA, &reg))
1481 val |= (reg & 0xffff); 1471 val |= (reg & 0xffff);
1482 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 4, val); 1472 *data++ = val;
1483 1473
1484 val = 0; 1474 val = 0;
1485 if (!(tp->phy_flags & TG3_PHYFLG_MII_SERDES)) { 1475 if (!(tp->phy_flags & TG3_PHYFLG_MII_SERDES)) {
@@ -1488,13 +1478,33 @@ static void tg3_ump_link_report(struct tg3 *tp)
1488 if (!tg3_readphy(tp, MII_STAT1000, &reg)) 1478 if (!tg3_readphy(tp, MII_STAT1000, &reg))
1489 val |= (reg & 0xffff); 1479 val |= (reg & 0xffff);
1490 } 1480 }
1491 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 8, val); 1481 *data++ = val;
1492 1482
1493 if (!tg3_readphy(tp, MII_PHYADDR, &reg)) 1483 if (!tg3_readphy(tp, MII_PHYADDR, &reg))
1494 val = reg << 16; 1484 val = reg << 16;
1495 else 1485 else
1496 val = 0; 1486 val = 0;
1497 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 12, val); 1487 *data++ = val;
1488}
1489
1490/* tp->lock is held. */
1491static void tg3_ump_link_report(struct tg3 *tp)
1492{
1493 u32 data[4];
1494
1495 if (!tg3_flag(tp, 5780_CLASS) || !tg3_flag(tp, ENABLE_ASF))
1496 return;
1497
1498 tg3_phy_gather_ump_data(tp, data);
1499
1500 tg3_wait_for_event_ack(tp);
1501
1502 tg3_write_mem(tp, NIC_SRAM_FW_CMD_MBOX, FWCMD_NICDRV_LINK_UPDATE);
1503 tg3_write_mem(tp, NIC_SRAM_FW_CMD_LEN_MBOX, 14);
1504 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0x0, data[0]);
1505 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0x4, data[1]);
1506 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0x8, data[2]);
1507 tg3_write_mem(tp, NIC_SRAM_FW_CMD_DATA_MBOX + 0xc, data[3]);
1498 1508
1499 tg3_generate_fw_event(tp); 1509 tg3_generate_fw_event(tp);
1500} 1510}