staging/ks7010: replace SME taslet with work

Tasklets have long been deprecated as being too heavy on the system
by running in irq context - and this is not a performance critical
path. If a higher priority process wants to run, it must wait for
the tasklet to finish before doing so.

The execution of the SME event will now occur in task context. There
are, however, changes in concurrency. Workqueues, unlike tasklets,
are not serialized among themselves and can run concurrently
updating sme_i.qhead. However, the current code is already exposed
in same ways, regardless of the deferral mechanism, in that
hostif_sme_enqueue() does unserialized enqueues updating sme_i.qtail.

Also get rid of the bogus (power save) tasklet enabling, as it
is never disabled to begin with.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-5-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Davidlohr Bueso 2022-04-11 08:16:18 -07:00 committed by Greg Kroah-Hartman
parent 9442e81d7e
commit a2b0b41619
2 changed files with 11 additions and 12 deletions

View File

@ -84,10 +84,6 @@ static void ks_wlan_hw_wakeup_task(struct work_struct *work)
return;
}
}
/* power save */
if (atomic_read(&priv->sme_task.count) > 0)
tasklet_enable(&priv->sme_task);
}
static void ks_wlan_do_power_save(struct ks_wlan_private *priv)
@ -2200,10 +2196,13 @@ static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
}
}
static
void hostif_sme_task(struct tasklet_struct *t)
static void hostif_sme_work(struct work_struct *work)
{
struct ks_wlan_private *priv = from_tasklet(priv, t, sme_task);
struct ks_wlan_private *priv;
priv = container_of(work, struct ks_wlan_private, sme_work);
if (!priv)
return;
if (priv->dev_state < DEVICE_STATE_BOOT)
return;
@ -2214,7 +2213,7 @@ void hostif_sme_task(struct tasklet_struct *t)
hostif_sme_execute(priv, priv->sme_i.event_buff[priv->sme_i.qhead]);
inc_smeqhead(priv);
if (cnt_smeqbody(priv) > 0)
tasklet_schedule(&priv->sme_task);
schedule_work(&priv->sme_work);
}
/* send to Station Management Entity module */
@ -2229,7 +2228,7 @@ void hostif_sme_enqueue(struct ks_wlan_private *priv, u16 event)
netdev_err(priv->net_dev, "sme queue buffer overflow\n");
}
tasklet_schedule(&priv->sme_task);
schedule_work(&priv->sme_work);
}
static inline void hostif_aplist_init(struct ks_wlan_private *priv)
@ -2254,7 +2253,7 @@ static inline void hostif_sme_init(struct ks_wlan_private *priv)
priv->sme_i.qtail = 0;
spin_lock_init(&priv->sme_i.sme_spin);
priv->sme_i.sme_flag = 0;
tasklet_setup(&priv->sme_task, hostif_sme_task);
INIT_WORK(&priv->sme_work, hostif_sme_work);
}
static inline void hostif_wpa_init(struct ks_wlan_private *priv)
@ -2312,5 +2311,5 @@ int hostif_init(struct ks_wlan_private *priv)
void hostif_exit(struct ks_wlan_private *priv)
{
tasklet_kill(&priv->sme_task);
cancel_work_sync(&priv->sme_work);
}

View File

@ -449,7 +449,7 @@ struct ks_wlan_private {
struct sme_info sme_i;
u8 *rxp;
unsigned int rx_size;
struct tasklet_struct sme_task;
struct work_struct sme_work;
struct work_struct wakeup_work;
int scan_ind_count;