Commit 7be08a72 authored by Ariel Elior's avatar Ariel Elior Committed by David S. Miller

bnx2x: Renaming the "reset_task" to "sp_rtnl_task"

Renaming the "reset_task" to a more general purpose name,
 "sp_rtnl_task", as it is already used for another purpose
 other than reset which is parity recovery, and since I
 plan to add a third operation for this task, updating the
 priority to traffic class and traffic class to transmission
 queues mappings after dcbx negotiation takes place.
Signed-off-by: default avatarAriel Elior <ariele@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39770653
...@@ -1046,6 +1046,12 @@ struct bnx2x_fw_stats_data { ...@@ -1046,6 +1046,12 @@ struct bnx2x_fw_stats_data {
struct per_queue_stats queue_stats[1]; struct per_queue_stats queue_stats[1];
}; };
/* Public slow path states */
enum {
BNX2X_SP_RTNL_TX_TIMEOUT,
};
struct bnx2x { struct bnx2x {
/* Fields used in the tx and intr/napi performance paths /* Fields used in the tx and intr/napi performance paths
* are grouped together in the beginning of the structure * are grouped together in the beginning of the structure
...@@ -1159,7 +1165,7 @@ struct bnx2x { ...@@ -1159,7 +1165,7 @@ struct bnx2x {
int mrrs; int mrrs;
struct delayed_work sp_task; struct delayed_work sp_task;
struct delayed_work reset_task; struct delayed_work sp_rtnl_task;
struct delayed_work period_task; struct delayed_work period_task;
struct timer_list timer; struct timer_list timer;
...@@ -1403,6 +1409,9 @@ struct bnx2x { ...@@ -1403,6 +1409,9 @@ struct bnx2x {
unsigned long sp_state; unsigned long sp_state;
/* operation indication for the sp_rtnl task */
unsigned long sp_rtnl_state;
/* DCBX Negotation results */ /* DCBX Negotation results */
struct dcbx_features dcbx_local_feat; struct dcbx_features dcbx_local_feat;
u32 dcbx_error; u32 dcbx_error;
......
...@@ -3233,8 +3233,13 @@ void bnx2x_tx_timeout(struct net_device *dev) ...@@ -3233,8 +3233,13 @@ void bnx2x_tx_timeout(struct net_device *dev)
if (!bp->panic) if (!bp->panic)
bnx2x_panic(); bnx2x_panic();
#endif #endif
smp_mb__before_clear_bit();
set_bit(BNX2X_SP_RTNL_TX_TIMEOUT, &bp->sp_rtnl_state);
smp_mb__after_clear_bit();
/* This allows the netif to be shutdown gracefully before resetting */ /* This allows the netif to be shutdown gracefully before resetting */
schedule_delayed_work(&bp->reset_task, 0); schedule_delayed_work(&bp->sp_rtnl_task, 0);
} }
int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state) int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
......
...@@ -4020,7 +4020,7 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted) ...@@ -4020,7 +4020,7 @@ static void bnx2x_attn_int_deasserted(struct bnx2x *bp, u32 deasserted)
if (bnx2x_chk_parity_attn(bp, &global, true)) { if (bnx2x_chk_parity_attn(bp, &global, true)) {
#ifndef BNX2X_STOP_ON_ERROR #ifndef BNX2X_STOP_ON_ERROR
bp->recovery_state = BNX2X_RECOVERY_INIT; bp->recovery_state = BNX2X_RECOVERY_INIT;
schedule_delayed_work(&bp->reset_task, 0); schedule_delayed_work(&bp->sp_rtnl_task, 0);
/* Disable HW interrupts */ /* Disable HW interrupts */
bnx2x_int_disable(bp); bnx2x_int_disable(bp);
/* In case of parity errors don't handle attentions so that /* In case of parity errors don't handle attentions so that
...@@ -7963,7 +7963,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp) ...@@ -7963,7 +7963,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
/* Wait until all other functions get /* Wait until all other functions get
* down. * down.
*/ */
schedule_delayed_work(&bp->reset_task, schedule_delayed_work(&bp->sp_rtnl_task,
HZ/10); HZ/10);
return; return;
} else { } else {
...@@ -8000,7 +8000,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp) ...@@ -8000,7 +8000,7 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
break; break;
} }
schedule_delayed_work(&bp->reset_task, schedule_delayed_work(&bp->sp_rtnl_task,
HZ/10); HZ/10);
return; return;
...@@ -8011,7 +8011,8 @@ static void bnx2x_parity_recover(struct bnx2x *bp) ...@@ -8011,7 +8011,8 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
*/ */
if (bnx2x_reset_is_global(bp)) { if (bnx2x_reset_is_global(bp)) {
schedule_delayed_work( schedule_delayed_work(
&bp->reset_task, HZ/10); &bp->sp_rtnl_task,
HZ/10);
return; return;
} }
...@@ -8035,30 +8036,39 @@ static void bnx2x_parity_recover(struct bnx2x *bp) ...@@ -8035,30 +8036,39 @@ static void bnx2x_parity_recover(struct bnx2x *bp)
/* bnx2x_nic_unload() flushes the bnx2x_wq, thus reset task is /* bnx2x_nic_unload() flushes the bnx2x_wq, thus reset task is
* scheduled on a general queue in order to prevent a dead lock. * scheduled on a general queue in order to prevent a dead lock.
*/ */
static void bnx2x_reset_task(struct work_struct *work) static void bnx2x_sp_rtnl_task(struct work_struct *work)
{ {
struct bnx2x *bp = container_of(work, struct bnx2x, reset_task.work); struct bnx2x *bp = container_of(work, struct bnx2x, sp_rtnl_task.work);
#ifdef BNX2X_STOP_ON_ERROR
BNX2X_ERR("reset task called but STOP_ON_ERROR defined"
" so reset not done to allow debug dump,\n"
KERN_ERR " you will need to reboot when done\n");
return;
#endif
rtnl_lock(); rtnl_lock();
if (!netif_running(bp->dev)) if (!netif_running(bp->dev))
goto reset_task_exit; goto sp_rtnl_exit;
if (unlikely(bp->recovery_state != BNX2X_RECOVERY_DONE)) /* if stop on error is defined no recovery flows should be executed */
#ifdef BNX2X_STOP_ON_ERROR
BNX2X_ERR("recovery flow called but STOP_ON_ERROR defined "
"so reset not done to allow debug dump,\n"
"you will need to reboot when done\n");
goto sp_rtnl_exit;
#endif
if (unlikely(bp->recovery_state != BNX2X_RECOVERY_DONE)) {
/*
* Clear TX_TIMEOUT bit as we are going to reset the function
* anyway.
*/
smp_mb__before_clear_bit();
clear_bit(BNX2X_SP_RTNL_TX_TIMEOUT, &bp->sp_rtnl_state);
smp_mb__after_clear_bit();
bnx2x_parity_recover(bp); bnx2x_parity_recover(bp);
else { } else if (test_and_clear_bit(BNX2X_SP_RTNL_TX_TIMEOUT,
&bp->sp_rtnl_state)){
bnx2x_nic_unload(bp, UNLOAD_NORMAL); bnx2x_nic_unload(bp, UNLOAD_NORMAL);
bnx2x_nic_load(bp, LOAD_NORMAL); bnx2x_nic_load(bp, LOAD_NORMAL);
} }
reset_task_exit: sp_rtnl_exit:
rtnl_unlock(); rtnl_unlock();
} }
...@@ -9291,7 +9301,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) ...@@ -9291,7 +9301,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
#endif #endif
INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
INIT_DELAYED_WORK(&bp->reset_task, bnx2x_reset_task); INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task);
INIT_DELAYED_WORK(&bp->period_task, bnx2x_period_task); INIT_DELAYED_WORK(&bp->period_task, bnx2x_period_task);
rc = bnx2x_get_hwinfo(bp); rc = bnx2x_get_hwinfo(bp);
if (rc) if (rc)
...@@ -10342,7 +10352,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev) ...@@ -10342,7 +10352,7 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev)
bnx2x_set_power_state(bp, PCI_D3hot); bnx2x_set_power_state(bp, PCI_D3hot);
/* Make sure RESET task is not scheduled before continuing */ /* Make sure RESET task is not scheduled before continuing */
cancel_delayed_work_sync(&bp->reset_task); cancel_delayed_work_sync(&bp->sp_rtnl_task);
if (bp->regview) if (bp->regview)
iounmap(bp->regview); iounmap(bp->regview);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment