Skip to content

Commit

Permalink
ionic: drain the work queue
Browse files Browse the repository at this point in the history
Check through our work list for additional items.  This normally
will only have one item, but occasionally may have another
job waiting.  There really is no need reschedule ourself here.

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shannon Nelson authored and David S. Miller committed Oct 2, 2020
1 parent 9576a36 commit 52733cf
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions drivers/net/ethernet/pensando/ionic/ionic_lif.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ static void ionic_lif_deferred_work(struct work_struct *work)
struct ionic_deferred *def = &lif->deferred;
struct ionic_deferred_work *w = NULL;

spin_lock_bh(&def->lock);
if (!list_empty(&def->list)) {
w = list_first_entry(&def->list,
struct ionic_deferred_work, list);
list_del(&w->list);
}
spin_unlock_bh(&def->lock);
do {
spin_lock_bh(&def->lock);
if (!list_empty(&def->list)) {
w = list_first_entry(&def->list,
struct ionic_deferred_work, list);
list_del(&w->list);
}
spin_unlock_bh(&def->lock);

if (!w)
break;

if (w) {
switch (w->type) {
case IONIC_DW_TYPE_RX_MODE:
ionic_lif_rx_mode(lif, w->rx_mode);
Expand All @@ -94,8 +97,8 @@ static void ionic_lif_deferred_work(struct work_struct *work)
break;
}
kfree(w);
schedule_work(&def->work);
}
w = NULL;
} while (true);
}

void ionic_lif_deferred_enqueue(struct ionic_deferred *def,
Expand Down

0 comments on commit 52733cf

Please sign in to comment.