Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170708
b: refs/heads/master
c: f34d28e
h: refs/heads/master
v: v3
  • Loading branch information
Eilon Greenstein authored and David S. Miller committed Oct 15, 2009
1 parent 7c11d18 commit 1bb388b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 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: 52a7a12fb560f22dd093ca74f3a768d51b044a40
refs/heads/master: f34d28ea0174df63253dc20a95de0b48e3d8145a
2 changes: 1 addition & 1 deletion trunk/drivers/net/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ struct bnx2x {
#define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG)
#define HW_VLAN_TX_FLAG 0x400
#define HW_VLAN_RX_FLAG 0x800
#define MF_FUNC_DIS 0x1000

int func;
#define BP_PORT(bp) (bp->func % PORT_MAX)
Expand Down Expand Up @@ -965,7 +966,6 @@ struct bnx2x {
#define BNX2X_STATE_CLOSING_WAIT4_HALT 0x4000
#define BNX2X_STATE_CLOSING_WAIT4_DELETE 0x5000
#define BNX2X_STATE_CLOSING_WAIT4_UNLOAD 0x6000
#define BNX2X_STATE_DISABLED 0xd000
#define BNX2X_STATE_DIAG 0xe000
#define BNX2X_STATE_ERROR 0xf000

Expand Down
34 changes: 19 additions & 15 deletions trunk/drivers/net/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ static void bnx2x_sp_event(struct bnx2x_fastpath *fp,
break;

case (RAMROD_CMD_ID_ETH_SET_MAC | BNX2X_STATE_CLOSING_WAIT4_HALT):
case (RAMROD_CMD_ID_ETH_SET_MAC | BNX2X_STATE_DISABLED):
DP(NETIF_MSG_IFDOWN, "got (un)set mac ramrod\n");
bp->set_mac_pending--;
smp_wmb();
Expand Down Expand Up @@ -2157,7 +2156,7 @@ static void bnx2x_calc_fc_adv(struct bnx2x *bp)

static void bnx2x_link_report(struct bnx2x *bp)
{
if (bp->state == BNX2X_STATE_DISABLED) {
if (bp->flags & MF_FUNC_DIS) {
netif_carrier_off(bp->dev);
printk(KERN_ERR PFX "%s NIC Link is Down\n", bp->dev->name);
return;
Expand Down Expand Up @@ -2437,8 +2436,7 @@ static void bnx2x_link_attn(struct bnx2x *bp)
memset(&(pstats->mac_stx[0]), 0,
sizeof(struct mac_stx));
}
if ((bp->state == BNX2X_STATE_OPEN) ||
(bp->state == BNX2X_STATE_DISABLED))
if (bp->state == BNX2X_STATE_OPEN)
bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
}

Expand Down Expand Up @@ -2481,9 +2479,7 @@ static void bnx2x_link_attn(struct bnx2x *bp)

static void bnx2x__link_status_update(struct bnx2x *bp)
{
int func = BP_FUNC(bp);

if (bp->state != BNX2X_STATE_OPEN)
if ((bp->state != BNX2X_STATE_OPEN) || (bp->flags & MF_FUNC_DIS))
return;

bnx2x_link_status_update(&bp->link_params, &bp->link_vars);
Expand Down Expand Up @@ -2640,14 +2636,19 @@ static void bnx2x_dcc_event(struct bnx2x *bp, u32 dcc_event)

if (dcc_event & DRV_STATUS_DCC_DISABLE_ENABLE_PF) {

/*
* This is the only place besides the function initialization
* where the bp->flags can change so it is done without any
* locks
*/
if (bp->mf_config & FUNC_MF_CFG_FUNC_DISABLED) {
DP(NETIF_MSG_IFDOWN, "mf_cfg function disabled\n");
bp->state = BNX2X_STATE_DISABLED;
bp->flags |= MF_FUNC_DIS;

bnx2x_e1h_disable(bp);
} else {
DP(NETIF_MSG_IFUP, "mf_cfg function enabled\n");
bp->state = BNX2X_STATE_OPEN;
bp->flags &= ~MF_FUNC_DIS;

bnx2x_e1h_enable(bp);
}
Expand Down Expand Up @@ -4695,8 +4696,7 @@ static void bnx2x_timer(unsigned long data)
}
}

if ((bp->state == BNX2X_STATE_OPEN) ||
(bp->state == BNX2X_STATE_DISABLED))
if (bp->state == BNX2X_STATE_OPEN)
bnx2x_stats_handle(bp, STATS_EVENT_UPDATE);

timer_restart:
Expand Down Expand Up @@ -7629,7 +7629,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
if (CHIP_IS_E1H(bp))
if (bp->mf_config & FUNC_MF_CFG_FUNC_DISABLED) {
DP(NETIF_MSG_IFUP, "mf_cfg function disabled\n");
bp->state = BNX2X_STATE_DISABLED;
bp->flags |= MF_FUNC_DIS;
}

if (bp->state == BNX2X_STATE_OPEN) {
Expand Down Expand Up @@ -9034,7 +9034,9 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cmd->supported = bp->port.supported;
cmd->advertising = bp->port.advertising;

if (netif_carrier_ok(dev)) {
if ((bp->state == BNX2X_STATE_OPEN) &&
!(bp->flags & MF_FUNC_DIS) &&
(bp->link_vars.link_up)) {
cmd->speed = bp->link_vars.line_speed;
cmd->duplex = bp->link_vars.duplex;
if (IS_E1HMF(bp)) {
Expand Down Expand Up @@ -9433,6 +9435,9 @@ static u32 bnx2x_get_link(struct net_device *dev)
{
struct bnx2x *bp = netdev_priv(dev);

if (bp->flags & MF_FUNC_DIS)
return 0;

return bp->link_vars.link_up;
}

Expand Down Expand Up @@ -9837,8 +9842,7 @@ static int bnx2x_set_eeprom(struct net_device *dev,

} else if (eeprom->magic == 0x50485952) {
/* 'PHYR' (0x50485952): re-init link after FW upgrade */
if ((bp->state == BNX2X_STATE_OPEN) ||
(bp->state == BNX2X_STATE_DISABLED)) {
if (bp->state == BNX2X_STATE_OPEN) {
bnx2x_acquire_phy_lock(bp);
rc |= bnx2x_link_reset(&bp->link_params,
&bp->link_vars, 1);
Expand Down

0 comments on commit 1bb388b

Please sign in to comment.