net: jme: Replace link-change tasklet with work

The link change tasklet disables the tasklets for tx/rx processing while
upating hw parameters and then enables the tasklets again.

This update can also be pushed into a workqueue where it can be performed
in preemptible context. This allows tasklet_disable() to become sleeping.

Replace the linkch_task tasklet with a work.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210309084242.106288922@linutronix.de
This commit is contained in:
Sebastian Andrzej Siewior 2021-03-09 09:42:11 +01:00 committed by Thomas Gleixner
parent eb2dafbba8
commit c62c38e349
2 changed files with 6 additions and 6 deletions

View File

@ -1265,9 +1265,9 @@ jme_stop_shutdown_timer(struct jme_adapter *jme)
jwrite32f(jme, JME_APMC, apmc); jwrite32f(jme, JME_APMC, apmc);
} }
static void jme_link_change_tasklet(struct tasklet_struct *t) static void jme_link_change_work(struct work_struct *work)
{ {
struct jme_adapter *jme = from_tasklet(jme, t, linkch_task); struct jme_adapter *jme = container_of(work, struct jme_adapter, linkch_task);
struct net_device *netdev = jme->dev; struct net_device *netdev = jme->dev;
int rc; int rc;
@ -1510,7 +1510,7 @@ jme_intr_msi(struct jme_adapter *jme, u32 intrstat)
* all other events are ignored * all other events are ignored
*/ */
jwrite32(jme, JME_IEVE, intrstat); jwrite32(jme, JME_IEVE, intrstat);
tasklet_schedule(&jme->linkch_task); schedule_work(&jme->linkch_task);
goto out_reenable; goto out_reenable;
} }
@ -1832,7 +1832,6 @@ jme_open(struct net_device *netdev)
jme_clear_pm_disable_wol(jme); jme_clear_pm_disable_wol(jme);
JME_NAPI_ENABLE(jme); JME_NAPI_ENABLE(jme);
tasklet_setup(&jme->linkch_task, jme_link_change_tasklet);
tasklet_setup(&jme->txclean_task, jme_tx_clean_tasklet); tasklet_setup(&jme->txclean_task, jme_tx_clean_tasklet);
tasklet_setup(&jme->rxclean_task, jme_rx_clean_tasklet); tasklet_setup(&jme->rxclean_task, jme_rx_clean_tasklet);
tasklet_setup(&jme->rxempty_task, jme_rx_empty_tasklet); tasklet_setup(&jme->rxempty_task, jme_rx_empty_tasklet);
@ -1920,7 +1919,7 @@ jme_close(struct net_device *netdev)
JME_NAPI_DISABLE(jme); JME_NAPI_DISABLE(jme);
tasklet_kill(&jme->linkch_task); cancel_work_sync(&jme->linkch_task);
tasklet_kill(&jme->txclean_task); tasklet_kill(&jme->txclean_task);
tasklet_kill(&jme->rxclean_task); tasklet_kill(&jme->rxclean_task);
tasklet_kill(&jme->rxempty_task); tasklet_kill(&jme->rxempty_task);
@ -3035,6 +3034,7 @@ jme_init_one(struct pci_dev *pdev,
atomic_set(&jme->rx_empty, 1); atomic_set(&jme->rx_empty, 1);
tasklet_setup(&jme->pcc_task, jme_pcc_tasklet); tasklet_setup(&jme->pcc_task, jme_pcc_tasklet);
INIT_WORK(&jme->linkch_task, jme_link_change_work);
jme->dpi.cur = PCC_P1; jme->dpi.cur = PCC_P1;
jme->reg_ghc = 0; jme->reg_ghc = 0;

View File

@ -411,7 +411,7 @@ struct jme_adapter {
struct tasklet_struct rxempty_task; struct tasklet_struct rxempty_task;
struct tasklet_struct rxclean_task; struct tasklet_struct rxclean_task;
struct tasklet_struct txclean_task; struct tasklet_struct txclean_task;
struct tasklet_struct linkch_task; struct work_struct linkch_task;
struct tasklet_struct pcc_task; struct tasklet_struct pcc_task;
unsigned long flags; unsigned long flags;
u32 reg_txcs; u32 reg_txcs;