Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6421
b: refs/heads/master
c: cd339a0
h: refs/heads/master
i:
  6419: 4ce0ebb
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Aug 29, 2005
1 parent 5e0fc6e commit 28114bf
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: afdc08b9f9a7174d7912a160f657f39d46379b5e
refs/heads/master: cd339a0ed61097d92ce03b6d1042b1e4d58535e7
52 changes: 40 additions & 12 deletions trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,19 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
bnx2_write_phy(bp, MII_ADVERTISE, new_adv);
bnx2_write_phy(bp, MII_BMCR, bmcr | BMCR_ANRESTART |
BMCR_ANENABLE);
bp->serdes_an_pending = SERDES_AN_TIMEOUT / bp->timer_interval;
if (CHIP_NUM(bp) == CHIP_NUM_5706) {
/* Speed up link-up time when the link partner
* does not autonegotiate which is very common
* in blade servers. Some blade servers use
* IPMI for kerboard input and it's important
* to minimize link disruptions. Autoneg. involves
* exchanging base pages plus 3 next pages and
* normally completes in about 120 msec.
*/
bp->current_interval = SERDES_AN_TIMEOUT;
bp->serdes_an_pending = 1;
mod_timer(&bp->timer, jiffies + bp->current_interval);
}
}

return 0;
Expand Down Expand Up @@ -3800,6 +3812,9 @@ bnx2_timer(unsigned long data)
struct bnx2 *bp = (struct bnx2 *) data;
u32 msg;

if (!netif_running(bp->dev))
return;

if (atomic_read(&bp->intr_sem) != 0)
goto bnx2_restart_timer;

Expand All @@ -3817,6 +3832,8 @@ bnx2_timer(unsigned long data)
else if ((bp->link_up == 0) && (bp->autoneg & AUTONEG_SPEED)) {
u32 bmcr;

bp->current_interval = bp->timer_interval;

bnx2_read_phy(bp, MII_BMCR, &bmcr);

if (bmcr & BMCR_ANENABLE) {
Expand Down Expand Up @@ -3859,14 +3876,14 @@ bnx2_timer(unsigned long data)

}
}
else
bp->current_interval = bp->timer_interval;

spin_unlock_irqrestore(&bp->phy_lock, flags);
}

bnx2_restart_timer:
bp->timer.expires = RUN_AT(bp->timer_interval);

add_timer(&bp->timer);
mod_timer(&bp->timer, jiffies + bp->current_interval);
}

/* Called with rtnl_lock */
Expand Down Expand Up @@ -3919,12 +3936,7 @@ bnx2_open(struct net_device *dev)
return rc;
}

init_timer(&bp->timer);

bp->timer.expires = RUN_AT(bp->timer_interval);
bp->timer.data = (unsigned long) bp;
bp->timer.function = bnx2_timer;
add_timer(&bp->timer);
mod_timer(&bp->timer, jiffies + bp->current_interval);

atomic_set(&bp->intr_sem, 0);

Expand Down Expand Up @@ -4485,8 +4497,9 @@ bnx2_nway_reset(struct net_device *dev)

spin_lock_irq(&bp->phy_lock);
if (CHIP_NUM(bp) == CHIP_NUM_5706) {
bp->serdes_an_pending = SERDES_AN_TIMEOUT /
bp->timer_interval;
bp->current_interval = SERDES_AN_TIMEOUT;
bp->serdes_an_pending = 1;
mod_timer(&bp->timer, jiffies + bp->current_interval);
}
}

Expand Down Expand Up @@ -5315,6 +5328,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
bp->stats_ticks = 1000000 & 0xffff00;

bp->timer_interval = HZ;
bp->current_interval = HZ;

/* Disable WOL support if we are running on a SERDES chip. */
if (CHIP_BOND_ID(bp) & CHIP_BOND_ID_SERDES_BIT) {
Expand All @@ -5338,13 +5352,27 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
bp->req_line_speed = 0;
if (bp->phy_flags & PHY_SERDES_FLAG) {
bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg;

reg = REG_RD_IND(bp, HOST_VIEW_SHMEM_BASE +
BNX2_PORT_HW_CFG_CONFIG);
reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK;
if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) {
bp->autoneg = 0;
bp->req_line_speed = bp->line_speed = SPEED_1000;
bp->req_duplex = DUPLEX_FULL;
}
}
else {
bp->advertising = ETHTOOL_ALL_COPPER_SPEED | ADVERTISED_Autoneg;
}

bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;

init_timer(&bp->timer);
bp->timer.expires = RUN_AT(bp->timer_interval);
bp->timer.data = (unsigned long) bp;
bp->timer.function = bnx2_timer;

return 0;

err_out_unmap:
Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/net/bnx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3872,6 +3872,7 @@ struct bnx2 {
char *name;

int timer_interval;
int current_interval;
struct timer_list timer;
struct work_struct reset_task;
int in_reset_task;
Expand Down Expand Up @@ -3986,7 +3987,7 @@ struct bnx2 {
#define PHY_LOOPBACK 2

u8 serdes_an_pending;
#define SERDES_AN_TIMEOUT (2 * HZ)
#define SERDES_AN_TIMEOUT (HZ / 3)

u8 mac_addr[8];

Expand Down Expand Up @@ -4172,6 +4173,9 @@ struct fw_info {

#define BNX2_PORT_HW_CFG_MAC_LOWER 0x00000054
#define BNX2_PORT_HW_CFG_CONFIG 0x00000058
#define BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK 0x001f0000
#define BNX2_PORT_HW_CFG_CFG_DFLT_LINK_AN 0x00000000
#define BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G 0x00030000

#define BNX2_PORT_HW_CFG_IMD_MAC_A_UPPER 0x00000068
#define BNX2_PORT_HW_CFG_IMD_MAC_A_LOWER 0x0000006c
Expand Down

0 comments on commit 28114bf

Please sign in to comment.