Ping-Ke Shih <pkshih@xxxxxxxxxxx> wrote: > Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > > > +/** > > > + * ieee80211_purge_tx_queue - purge TX skb queue > > > + * @hw: the hardware > > > + * @skbs: the skbs > > > + * > > > + * Free a set of transmit skbs. Use this function when device is going to stop > > > + * but some transmit skbs without TX status are still queued. > > > + */ > > > +void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, > > > + struct sk_buff_head *skbs); > > > > Unlike skb_queue_purge()/skb_queue_purge_reason(), this doesn't take the > > lock, that seems important to note here? > > Thanks. I wasn't aware of lock, and rtw88 needs a lock version because > its TX work isn't stopped yet while calling ieee80211_purge_tx_queue(). > > I have three candidate options: > > 1. add spin_lock by driver before calling ieee80211_purge_tx_queue(). > > 2. move original ieee80211_purge_tx_queue() to __ieee80211_purge_tx_queue(), > and add an new lock version of ieee80211_purge_tx_queue(). > > 3. change rtw88 deinit flow to ensure stopping TX work before calling > ieee80211_purge_tx_queue() > > I prefer option 3. But want your opinion if option 2 is worth to do? > I have chosen option 3, so just export ieee80211_purge_tx_queue() and no need to touch ieee80211_purge_tx_queue() further. Sent v2 along with suggested comments.