Re: [PATCH wireless-next v2 12/31] wifi: mm81x: add mac.c

From: Johannes Berg

Date: Fri Jun 05 2026 - 03:46:11 EST


On Fri, 2026-06-05 at 16:26 +1000, Lachlan Hodges wrote:
> Hi Johannes, just having a think about how to do this:
>
> On Thu, Jun 04, 2026 at 01:46:32PM +0200, Johannes Berg wrote:
> >
> > > +static void mm81x_mac_ops_flush(struct ieee80211_hw *hw,
> > > + struct ieee80211_vif *vif, u32 queues,
> > > + bool drop)
> > > +{
> > > + struct mm81x *mors = hw->priv;
> > > +
> > > + /* We don't support IEEE80211_HW_QUEUE_CONTROL so flush all queues */
> > > + if (drop) {
> > > + /*
> > > + * No need to call mm81x_skbq_stop_tx_queues as mac80211
> > > + * has already cancelled each queue prior to calling .flush()
> > > + */
> > > + mm81x_skbq_data_traffic_pause(mors);
> > > +
> > > + flush_work(&mors->hif_work);
> > > + flush_work(&mors->tx_stale_work);
> > > +
> > > + mm81x_hif_clear_events(mors);
> > > + mm81x_hif_flush_tx_data(mors);
> > > + mm81x_hif_flush_cmds(mors);
> > > +
> > > + /* Reenable data, not that there will be any */
> > > + mm81x_skbq_data_traffic_resume(mors);
> > > + }
> > > +}
> >
> > Doing nothing in the !drop case seems questionable - mac80211 uses this
> > sometimes to e.g. make sure a deauth frame really went out before
> > shutting down the hardware.
>
> What is the consensus 

No idea ;-)

> (or I guess your opinion) on using
> read_poll_timeout() with a function that isn't really doing any real
> I/O but rather just reading software queue state?

[snip]

> It is fairly easy to opencode something similar, but this looks nice :)
> though I can't see many examples of using it like this so I am
> a bit cautious.

I think the more common way to do this would be to have an explicit
waitq so you don't have to poll, and trigger that whenever the queues
become empty.

With hardware you often don't have a signal so you have to poll, though
in some cases if you have an interrupt you'd prefer that too.

johannes