Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275074
b: refs/heads/master
c: db21997
h: refs/heads/master
v: v3
  • Loading branch information
Matt Carlson authored and David S. Miller committed Nov 4, 2011
1 parent 7f0c743 commit 3040f78
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 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: 9dc5e342703948ea7b086d063c85c0e79dac8149
refs/heads/master: db21997379906fe7657d360674e1106d80b020a4
33 changes: 24 additions & 9 deletions trunk/drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -5929,6 +5929,18 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget)
return work_done;
}

static inline void tg3_reset_task_schedule(struct tg3 *tp)
{
if (!test_and_set_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags))
schedule_work(&tp->reset_task);
}

static inline void tg3_reset_task_cancel(struct tg3 *tp)
{
cancel_work_sync(&tp->reset_task);
tg3_flag_clear(tp, RESET_TASK_PENDING);
}

static int tg3_poll_msix(struct napi_struct *napi, int budget)
{
struct tg3_napi *tnapi = container_of(napi, struct tg3_napi, napi);
Expand Down Expand Up @@ -5969,7 +5981,7 @@ static int tg3_poll_msix(struct napi_struct *napi, int budget)
tx_recovery:
/* work_done is guaranteed to be less than budget. */
napi_complete(napi);
schedule_work(&tp->reset_task);
tg3_reset_task_schedule(tp);
return work_done;
}

Expand Down Expand Up @@ -6004,7 +6016,7 @@ static void tg3_process_error(struct tg3 *tp)
tg3_dump_state(tp);

tg3_flag_set(tp, ERROR_PROCESSED);
schedule_work(&tp->reset_task);
tg3_reset_task_schedule(tp);
}

static int tg3_poll(struct napi_struct *napi, int budget)
Expand Down Expand Up @@ -6051,7 +6063,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
tx_recovery:
/* work_done is guaranteed to be less than budget. */
napi_complete(napi);
schedule_work(&tp->reset_task);
tg3_reset_task_schedule(tp);
return work_done;
}

Expand Down Expand Up @@ -6345,6 +6357,7 @@ static void tg3_reset_task(struct work_struct *work)
tg3_full_lock(tp, 0);

if (!netif_running(tp->dev)) {
tg3_flag_clear(tp, RESET_TASK_PENDING);
tg3_full_unlock(tp);
return;
}
Expand Down Expand Up @@ -6382,6 +6395,8 @@ static void tg3_reset_task(struct work_struct *work)

if (!err)
tg3_phy_start(tp);

tg3_flag_clear(tp, RESET_TASK_PENDING);
}

static void tg3_tx_timeout(struct net_device *dev)
Expand All @@ -6393,7 +6408,7 @@ static void tg3_tx_timeout(struct net_device *dev)
tg3_dump_state(tp);
}

schedule_work(&tp->reset_task);
tg3_reset_task_schedule(tp);
}

/* Test for DMA buffers crossing any 4GB boundaries: 4G, 8G, etc */
Expand Down Expand Up @@ -9228,7 +9243,7 @@ static void tg3_timer(unsigned long __opaque)
if (!(tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
tg3_flag_set(tp, RESTART_TIMER);
spin_unlock(&tp->lock);
schedule_work(&tp->reset_task);
tg3_reset_task_schedule(tp);
return;
}
}
Expand Down Expand Up @@ -9785,7 +9800,7 @@ static int tg3_close(struct net_device *dev)
struct tg3 *tp = netdev_priv(dev);

tg3_napi_disable(tp);
cancel_work_sync(&tp->reset_task);
tg3_reset_task_cancel(tp);

netif_tx_stop_all_queues(dev);

Expand Down Expand Up @@ -15685,7 +15700,7 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
if (tp->fw)
release_firmware(tp->fw);

cancel_work_sync(&tp->reset_task);
tg3_reset_task_cancel(tp);

if (tg3_flag(tp, USE_PHYLIB)) {
tg3_phy_fini(tp);
Expand Down Expand Up @@ -15719,7 +15734,7 @@ static int tg3_suspend(struct device *device)
if (!netif_running(dev))
return 0;

flush_work_sync(&tp->reset_task);
tg3_reset_task_cancel(tp);
tg3_phy_stop(tp);
tg3_netif_stop(tp);

Expand Down Expand Up @@ -15835,7 +15850,7 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
tg3_flag_clear(tp, RESTART_TIMER);

/* Want to make sure that the reset task doesn't run */
cancel_work_sync(&tp->reset_task);
tg3_reset_task_cancel(tp);
tg3_flag_clear(tp, TX_RECOVERY_PENDING);
tg3_flag_clear(tp, RESTART_TIMER);

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/broadcom/tg3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2922,6 +2922,7 @@ enum TG3_FLAGS {
TG3_FLAG_APE_HAS_NCSI,
TG3_FLAG_5717_PLUS,
TG3_FLAG_4K_FIFO_LIMIT,
TG3_FLAG_RESET_TASK_PENDING,

/* Add new flags before this comment and TG3_FLAG_NUMBER_OF_FLAGS */
TG3_FLAG_NUMBER_OF_FLAGS, /* Last entry in enum TG3_FLAGS */
Expand Down

0 comments on commit 3040f78

Please sign in to comment.