Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
This commit is contained in:
@ -57,8 +57,8 @@
|
||||
#include "bnx2x.h"
|
||||
#include "bnx2x_init.h"
|
||||
|
||||
#define DRV_MODULE_VERSION "1.45.24"
|
||||
#define DRV_MODULE_RELDATE "2009/01/14"
|
||||
#define DRV_MODULE_VERSION "1.45.26"
|
||||
#define DRV_MODULE_RELDATE "2009/01/26"
|
||||
#define BNX2X_BC_VER 0x040200
|
||||
|
||||
/* Time in jiffies before concluding the transmitter is hung */
|
||||
@ -740,8 +740,15 @@ static inline int bnx2x_has_tx_work(struct bnx2x_fastpath *fp)
|
||||
/* Tell compiler that status block fields can change */
|
||||
barrier();
|
||||
tx_cons_sb = le16_to_cpu(*fp->tx_cons_sb);
|
||||
return ((fp->tx_pkt_prod != tx_cons_sb) ||
|
||||
(fp->tx_pkt_prod != fp->tx_pkt_cons));
|
||||
return (fp->tx_pkt_cons != tx_cons_sb);
|
||||
}
|
||||
|
||||
static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp)
|
||||
{
|
||||
/* Tell compiler that consumer and producer can change */
|
||||
barrier();
|
||||
return (fp->tx_pkt_prod != fp->tx_pkt_cons);
|
||||
|
||||
}
|
||||
|
||||
/* free skb in the packet ring at pos idx
|
||||
@ -5148,12 +5155,21 @@ static void enable_blocks_attention(struct bnx2x *bp)
|
||||
}
|
||||
|
||||
|
||||
static void bnx2x_reset_common(struct bnx2x *bp)
|
||||
{
|
||||
/* reset_common */
|
||||
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR,
|
||||
0xd3ffff7f);
|
||||
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 0x1403);
|
||||
}
|
||||
|
||||
static int bnx2x_init_common(struct bnx2x *bp)
|
||||
{
|
||||
u32 val, i;
|
||||
|
||||
DP(BNX2X_MSG_MCP, "starting common init func %d\n", BP_FUNC(bp));
|
||||
|
||||
bnx2x_reset_common(bp);
|
||||
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 0xffffffff);
|
||||
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, 0xfffc);
|
||||
|
||||
@ -6134,8 +6150,8 @@ static void bnx2x_netif_start(struct bnx2x *bp)
|
||||
static void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw)
|
||||
{
|
||||
bnx2x_int_disable_sync(bp, disable_hw);
|
||||
bnx2x_napi_disable(bp);
|
||||
if (netif_running(bp->dev)) {
|
||||
bnx2x_napi_disable(bp);
|
||||
netif_tx_disable(bp->dev);
|
||||
bp->dev->trans_start = jiffies; /* prevent tx timeout */
|
||||
}
|
||||
@ -6319,7 +6335,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev);
|
||||
static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
{
|
||||
u32 load_code;
|
||||
int i, rc;
|
||||
int i, rc = 0;
|
||||
#ifdef BNX2X_STOP_ON_ERROR
|
||||
if (unlikely(bp->panic))
|
||||
return -EPERM;
|
||||
@ -6327,6 +6343,77 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
|
||||
bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
|
||||
|
||||
if (use_inta) {
|
||||
bp->num_queues = 1;
|
||||
|
||||
} else {
|
||||
if ((use_multi > 1) && (use_multi <= BP_MAX_QUEUES(bp)))
|
||||
/* user requested number */
|
||||
bp->num_queues = use_multi;
|
||||
|
||||
else if (use_multi)
|
||||
bp->num_queues = min_t(u32, num_online_cpus(),
|
||||
BP_MAX_QUEUES(bp));
|
||||
else
|
||||
bp->num_queues = 1;
|
||||
|
||||
DP(NETIF_MSG_IFUP,
|
||||
"set number of queues to %d\n", bp->num_queues);
|
||||
|
||||
/* if we can't use MSI-X we only need one fp,
|
||||
* so try to enable MSI-X with the requested number of fp's
|
||||
* and fallback to MSI or legacy INTx with one fp
|
||||
*/
|
||||
rc = bnx2x_enable_msix(bp);
|
||||
if (rc) {
|
||||
/* failed to enable MSI-X */
|
||||
bp->num_queues = 1;
|
||||
if (use_multi)
|
||||
BNX2X_ERR("Multi requested but failed"
|
||||
" to enable MSI-X\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (bnx2x_alloc_mem(bp))
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_queue(bp, i)
|
||||
bnx2x_fp(bp, i, disable_tpa) =
|
||||
((bp->flags & TPA_ENABLE_FLAG) == 0);
|
||||
|
||||
for_each_queue(bp, i)
|
||||
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
|
||||
bnx2x_poll, 128);
|
||||
|
||||
#ifdef BNX2X_STOP_ON_ERROR
|
||||
for_each_queue(bp, i) {
|
||||
struct bnx2x_fastpath *fp = &bp->fp[i];
|
||||
|
||||
fp->poll_no_work = 0;
|
||||
fp->poll_calls = 0;
|
||||
fp->poll_max_calls = 0;
|
||||
fp->poll_complete = 0;
|
||||
fp->poll_exit = 0;
|
||||
}
|
||||
#endif
|
||||
bnx2x_napi_enable(bp);
|
||||
|
||||
if (bp->flags & USING_MSIX_FLAG) {
|
||||
rc = bnx2x_req_msix_irqs(bp);
|
||||
if (rc) {
|
||||
pci_disable_msix(bp->pdev);
|
||||
goto load_error1;
|
||||
}
|
||||
printk(KERN_INFO PFX "%s: using MSI-X\n", bp->dev->name);
|
||||
} else {
|
||||
bnx2x_ack_int(bp);
|
||||
rc = bnx2x_req_irq(bp);
|
||||
if (rc) {
|
||||
BNX2X_ERR("IRQ request failed rc %d, aborting\n", rc);
|
||||
goto load_error1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send LOAD_REQUEST command to MCP
|
||||
Returns the type of LOAD command:
|
||||
if it is the first port to be initialized
|
||||
@ -6336,10 +6423,13 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ);
|
||||
if (!load_code) {
|
||||
BNX2X_ERR("MCP response failure, aborting\n");
|
||||
return -EBUSY;
|
||||
rc = -EBUSY;
|
||||
goto load_error2;
|
||||
}
|
||||
if (load_code == FW_MSG_CODE_DRV_LOAD_REFUSED) {
|
||||
rc = -EBUSY; /* other port in diagnostic mode */
|
||||
goto load_error2;
|
||||
}
|
||||
if (load_code == FW_MSG_CODE_DRV_LOAD_REFUSED)
|
||||
return -EBUSY; /* other port in diagnostic mode */
|
||||
|
||||
} else {
|
||||
int port = BP_PORT(bp);
|
||||
@ -6365,66 +6455,11 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
bp->port.pmf = 0;
|
||||
DP(NETIF_MSG_LINK, "pmf %d\n", bp->port.pmf);
|
||||
|
||||
/* if we can't use MSI-X we only need one fp,
|
||||
* so try to enable MSI-X with the requested number of fp's
|
||||
* and fallback to inta with one fp
|
||||
*/
|
||||
if (use_inta) {
|
||||
bp->num_queues = 1;
|
||||
|
||||
} else {
|
||||
if ((use_multi > 1) && (use_multi <= BP_MAX_QUEUES(bp)))
|
||||
/* user requested number */
|
||||
bp->num_queues = use_multi;
|
||||
|
||||
else if (use_multi)
|
||||
bp->num_queues = min_t(u32, num_online_cpus(),
|
||||
BP_MAX_QUEUES(bp));
|
||||
else
|
||||
bp->num_queues = 1;
|
||||
|
||||
if (bnx2x_enable_msix(bp)) {
|
||||
/* failed to enable MSI-X */
|
||||
bp->num_queues = 1;
|
||||
if (use_multi)
|
||||
BNX2X_ERR("Multi requested but failed"
|
||||
" to enable MSI-X\n");
|
||||
}
|
||||
}
|
||||
DP(NETIF_MSG_IFUP,
|
||||
"set number of queues to %d\n", bp->num_queues);
|
||||
|
||||
if (bnx2x_alloc_mem(bp))
|
||||
return -ENOMEM;
|
||||
|
||||
for_each_queue(bp, i)
|
||||
bnx2x_fp(bp, i, disable_tpa) =
|
||||
((bp->flags & TPA_ENABLE_FLAG) == 0);
|
||||
|
||||
if (bp->flags & USING_MSIX_FLAG) {
|
||||
rc = bnx2x_req_msix_irqs(bp);
|
||||
if (rc) {
|
||||
pci_disable_msix(bp->pdev);
|
||||
goto load_error;
|
||||
}
|
||||
} else {
|
||||
bnx2x_ack_int(bp);
|
||||
rc = bnx2x_req_irq(bp);
|
||||
if (rc) {
|
||||
BNX2X_ERR("IRQ request failed, aborting\n");
|
||||
goto load_error;
|
||||
}
|
||||
}
|
||||
|
||||
for_each_queue(bp, i)
|
||||
netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
|
||||
bnx2x_poll, 128);
|
||||
|
||||
/* Initialize HW */
|
||||
rc = bnx2x_init_hw(bp, load_code);
|
||||
if (rc) {
|
||||
BNX2X_ERR("HW init failed, aborting\n");
|
||||
goto load_int_disable;
|
||||
goto load_error2;
|
||||
}
|
||||
|
||||
/* Setup NIC internals and enable interrupts */
|
||||
@ -6436,7 +6471,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
if (!load_code) {
|
||||
BNX2X_ERR("MCP response failure, aborting\n");
|
||||
rc = -EBUSY;
|
||||
goto load_rings_free;
|
||||
goto load_error3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6445,7 +6480,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
rc = bnx2x_setup_leading(bp);
|
||||
if (rc) {
|
||||
BNX2X_ERR("Setup leading failed!\n");
|
||||
goto load_netif_stop;
|
||||
goto load_error3;
|
||||
}
|
||||
|
||||
if (CHIP_IS_E1H(bp))
|
||||
@ -6458,7 +6493,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
for_each_nondefault_queue(bp, i) {
|
||||
rc = bnx2x_setup_multi(bp, i);
|
||||
if (rc)
|
||||
goto load_netif_stop;
|
||||
goto load_error3;
|
||||
}
|
||||
|
||||
if (CHIP_IS_E1(bp))
|
||||
@ -6474,18 +6509,18 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
case LOAD_NORMAL:
|
||||
/* Tx queue should be only reenabled */
|
||||
netif_wake_queue(bp->dev);
|
||||
/* Initialize the receive filter. */
|
||||
bnx2x_set_rx_mode(bp->dev);
|
||||
break;
|
||||
|
||||
case LOAD_OPEN:
|
||||
netif_start_queue(bp->dev);
|
||||
/* Initialize the receive filter. */
|
||||
bnx2x_set_rx_mode(bp->dev);
|
||||
if (bp->flags & USING_MSIX_FLAG)
|
||||
printk(KERN_INFO PFX "%s: using MSI-X\n",
|
||||
bp->dev->name);
|
||||
break;
|
||||
|
||||
case LOAD_DIAG:
|
||||
/* Initialize the receive filter. */
|
||||
bnx2x_set_rx_mode(bp->dev);
|
||||
bp->state = BNX2X_STATE_DIAG;
|
||||
break;
|
||||
@ -6503,20 +6538,25 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
|
||||
|
||||
return 0;
|
||||
|
||||
load_netif_stop:
|
||||
bnx2x_napi_disable(bp);
|
||||
load_rings_free:
|
||||
load_error3:
|
||||
bnx2x_int_disable_sync(bp, 1);
|
||||
if (!BP_NOMCP(bp)) {
|
||||
bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP);
|
||||
bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
|
||||
}
|
||||
bp->port.pmf = 0;
|
||||
/* Free SKBs, SGEs, TPA pool and driver internals */
|
||||
bnx2x_free_skbs(bp);
|
||||
for_each_queue(bp, i)
|
||||
bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
|
||||
load_int_disable:
|
||||
bnx2x_int_disable_sync(bp, 1);
|
||||
load_error2:
|
||||
/* Release IRQs */
|
||||
bnx2x_free_irq(bp);
|
||||
load_error:
|
||||
load_error1:
|
||||
bnx2x_napi_disable(bp);
|
||||
for_each_queue(bp, i)
|
||||
netif_napi_del(&bnx2x_fp(bp, i, napi));
|
||||
bnx2x_free_mem(bp);
|
||||
bp->port.pmf = 0;
|
||||
|
||||
/* TBD we really need to reset the chip
|
||||
if we want to recover from this */
|
||||
@ -6589,6 +6629,7 @@ static int bnx2x_stop_leading(struct bnx2x *bp)
|
||||
}
|
||||
cnt--;
|
||||
msleep(1);
|
||||
rmb(); /* Refresh the dsb_sp_prod */
|
||||
}
|
||||
bp->state = BNX2X_STATE_CLOSING_WAIT4_UNLOAD;
|
||||
bp->fp[0].state = BNX2X_FP_STATE_CLOSED;
|
||||
@ -6640,14 +6681,6 @@ static void bnx2x_reset_port(struct bnx2x *bp)
|
||||
/* TODO: Close Doorbell port? */
|
||||
}
|
||||
|
||||
static void bnx2x_reset_common(struct bnx2x *bp)
|
||||
{
|
||||
/* reset_common */
|
||||
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR,
|
||||
0xd3ffff7f);
|
||||
REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, 0x1403);
|
||||
}
|
||||
|
||||
static void bnx2x_reset_chip(struct bnx2x *bp, u32 reset_code)
|
||||
{
|
||||
DP(BNX2X_MSG_MCP, "function %d reset_code %x\n",
|
||||
@ -6688,8 +6721,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
|
||||
bnx2x_set_storm_rx_mode(bp);
|
||||
|
||||
bnx2x_netif_stop(bp, 1);
|
||||
if (!netif_running(bp->dev))
|
||||
bnx2x_napi_disable(bp);
|
||||
|
||||
del_timer_sync(&bp->timer);
|
||||
SHMEM_WR(bp, func_mb[BP_FUNC(bp)].drv_pulse_mb,
|
||||
(DRV_PULSE_ALWAYS_ALIVE | bp->fw_drv_pulse_wr_seq));
|
||||
@ -6704,7 +6736,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
|
||||
|
||||
cnt = 1000;
|
||||
smp_rmb();
|
||||
while (bnx2x_has_tx_work(fp)) {
|
||||
while (bnx2x_has_tx_work_unload(fp)) {
|
||||
|
||||
bnx2x_tx_int(fp, 1000);
|
||||
if (!cnt) {
|
||||
@ -6833,6 +6865,8 @@ unload_error:
|
||||
bnx2x_free_skbs(bp);
|
||||
for_each_queue(bp, i)
|
||||
bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
|
||||
for_each_queue(bp, i)
|
||||
netif_napi_del(&bnx2x_fp(bp, i, napi));
|
||||
bnx2x_free_mem(bp);
|
||||
|
||||
bp->state = BNX2X_STATE_CLOSED;
|
||||
@ -8723,18 +8757,17 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
|
||||
|
||||
if (loopback_mode == BNX2X_MAC_LOOPBACK) {
|
||||
bp->link_params.loopback_mode = LOOPBACK_BMAC;
|
||||
bnx2x_acquire_phy_lock(bp);
|
||||
bnx2x_phy_init(&bp->link_params, &bp->link_vars);
|
||||
bnx2x_release_phy_lock(bp);
|
||||
|
||||
} else if (loopback_mode == BNX2X_PHY_LOOPBACK) {
|
||||
u16 cnt = 1000;
|
||||
bp->link_params.loopback_mode = LOOPBACK_XGXS_10;
|
||||
bnx2x_acquire_phy_lock(bp);
|
||||
bnx2x_phy_init(&bp->link_params, &bp->link_vars);
|
||||
bnx2x_release_phy_lock(bp);
|
||||
/* wait until link state is restored */
|
||||
bnx2x_wait_for_link(bp, link_up);
|
||||
|
||||
if (link_up)
|
||||
while (cnt-- && bnx2x_test_link(&bp->link_params,
|
||||
&bp->link_vars))
|
||||
msleep(10);
|
||||
} else
|
||||
return -EINVAL;
|
||||
|
||||
@ -8840,6 +8873,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
|
||||
return BNX2X_LOOPBACK_FAILED;
|
||||
|
||||
bnx2x_netif_stop(bp, 1);
|
||||
bnx2x_acquire_phy_lock(bp);
|
||||
|
||||
if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) {
|
||||
DP(NETIF_MSG_PROBE, "MAC loopback failed\n");
|
||||
@ -8851,6 +8885,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
|
||||
rc |= BNX2X_PHY_LOOPBACK_FAILED;
|
||||
}
|
||||
|
||||
bnx2x_release_phy_lock(bp);
|
||||
bnx2x_netif_start(bp);
|
||||
|
||||
return rc;
|
||||
@ -9805,6 +9840,8 @@ static int bnx2x_open(struct net_device *dev)
|
||||
{
|
||||
struct bnx2x *bp = netdev_priv(dev);
|
||||
|
||||
netif_carrier_off(dev);
|
||||
|
||||
bnx2x_set_power_state(bp, PCI_D0);
|
||||
|
||||
return bnx2x_nic_load(bp, LOAD_OPEN);
|
||||
@ -10310,8 +10347,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
|
||||
goto init_one_exit;
|
||||
}
|
||||
|
||||
netif_carrier_off(dev);
|
||||
|
||||
bp->common.name = board_info[ent->driver_data].name;
|
||||
printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
|
||||
" IRQ %d, ", dev->name, bp->common.name,
|
||||
@ -10459,6 +10494,8 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
|
||||
bnx2x_free_skbs(bp);
|
||||
for_each_queue(bp, i)
|
||||
bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
|
||||
for_each_queue(bp, i)
|
||||
netif_napi_del(&bnx2x_fp(bp, i, napi));
|
||||
bnx2x_free_mem(bp);
|
||||
|
||||
bp->state = BNX2X_STATE_CLOSED;
|
||||
|
Reference in New Issue
Block a user