diff --git a/mt7603_main.c b/mt7603_main.c index de7a2e36..bea62c4e 100644 --- a/mt7603_main.c +++ b/mt7603_main.c @@ -260,6 +260,8 @@ mt7603_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, for (i = 0; i < ARRAY_SIZE(sta->txq); i++) mt76_txq_remove(&dev->mt76, sta->txq[i]); + mt76_wcid_free(dev->wcid_mask, idx); + mutex_unlock(&dev->mutex); return 0; diff --git a/mt76x2_main.c b/mt76x2_main.c index 1bb39d9e..a05feb9d 100644 --- a/mt76x2_main.c +++ b/mt76x2_main.c @@ -270,7 +270,7 @@ mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, for (i = 0; i < ARRAY_SIZE(sta->txq); i++) mt76_txq_remove(&dev->mt76, sta->txq[i]); mt76_set(dev, MT_WCID_DROP(idx), MT_WCID_DROP_MASK(idx)); - dev->wcid_mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG); + mt76_wcid_free(dev->wcid_mask, idx); mt76x2_mac_wcid_setup(dev, idx, 0, NULL); mutex_unlock(&dev->mutex); diff --git a/util.h b/util.h index e4b9840f..ccee8047 100644 --- a/util.h +++ b/util.h @@ -84,6 +84,12 @@ int mt76_insert_hdr_pad(struct sk_buff *skb); void mt76_remove_hdr_pad(struct sk_buff *skb); int mt76_wcid_alloc(unsigned long *mask, int size); +static inline void +mt76_wcid_free(unsigned long *mask, int idx) +{ + mask[idx / BITS_PER_LONG] &= ~BIT(idx % BITS_PER_LONG); +} + static inline void mt76_skb_set_moredata(struct sk_buff *skb, bool enable) {