Commit c34f1005 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: substitute sk_buff_head status_list with spinlock_t status_lock

Substitute sk_buff_head status_list with spinlock_t status_lock since we
just need it for locking

Tested-by: mrkiko.rs@gmail.com
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent c02f86ee
...@@ -543,9 +543,9 @@ mt76_alloc_device(struct device *pdev, unsigned int size, ...@@ -543,9 +543,9 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
spin_lock_init(&dev->rx_lock); spin_lock_init(&dev->rx_lock);
spin_lock_init(&dev->lock); spin_lock_init(&dev->lock);
spin_lock_init(&dev->cc_lock); spin_lock_init(&dev->cc_lock);
spin_lock_init(&dev->status_lock);
mutex_init(&dev->mutex); mutex_init(&dev->mutex);
init_waitqueue_head(&dev->tx_wait); init_waitqueue_head(&dev->tx_wait);
skb_queue_head_init(&dev->status_list);
skb_queue_head_init(&dev->mcu.res_q); skb_queue_head_init(&dev->mcu.res_q);
init_waitqueue_head(&dev->mcu.wait); init_waitqueue_head(&dev->mcu.wait);
......
...@@ -693,7 +693,8 @@ struct mt76_dev { ...@@ -693,7 +693,8 @@ struct mt76_dev {
int token_count; int token_count;
wait_queue_head_t tx_wait; wait_queue_head_t tx_wait;
struct sk_buff_head status_list; /* spinclock used to protect wcid pktid linked list */
spinlock_t status_lock;
u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)]; u32 wcid_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)]; u32 wcid_phy_mask[DIV_ROUND_UP(MT76_N_WCIDS, 32)];
...@@ -1097,9 +1098,9 @@ void mt76_wcid_key_setup(struct mt76_dev *dev, struct mt76_wcid *wcid, ...@@ -1097,9 +1098,9 @@ void mt76_wcid_key_setup(struct mt76_dev *dev, struct mt76_wcid *wcid,
struct ieee80211_key_conf *key); struct ieee80211_key_conf *key);
void mt76_tx_status_lock(struct mt76_dev *dev, struct sk_buff_head *list) void mt76_tx_status_lock(struct mt76_dev *dev, struct sk_buff_head *list)
__acquires(&dev->status_list.lock); __acquires(&dev->status_lock);
void mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list) void mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
__releases(&dev->status_list.lock); __releases(&dev->status_lock);
int mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid, int mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
struct sk_buff *skb); struct sk_buff *skb);
......
...@@ -38,21 +38,21 @@ EXPORT_SYMBOL_GPL(mt76_tx_check_agg_ssn); ...@@ -38,21 +38,21 @@ EXPORT_SYMBOL_GPL(mt76_tx_check_agg_ssn);
void void
mt76_tx_status_lock(struct mt76_dev *dev, struct sk_buff_head *list) mt76_tx_status_lock(struct mt76_dev *dev, struct sk_buff_head *list)
__acquires(&dev->status_list.lock) __acquires(&dev->status_lock)
{ {
__skb_queue_head_init(list); __skb_queue_head_init(list);
spin_lock_bh(&dev->status_list.lock); spin_lock_bh(&dev->status_lock);
} }
EXPORT_SYMBOL_GPL(mt76_tx_status_lock); EXPORT_SYMBOL_GPL(mt76_tx_status_lock);
void void
mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list) mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
__releases(&dev->status_list.lock) __releases(&dev->status_lock)
{ {
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct sk_buff *skb; struct sk_buff *skb;
spin_unlock_bh(&dev->status_list.lock); spin_unlock_bh(&dev->status_lock);
rcu_read_lock(); rcu_read_lock();
while ((skb = __skb_dequeue(list)) != NULL) { while ((skb = __skb_dequeue(list)) != NULL) {
...@@ -130,7 +130,7 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid, ...@@ -130,7 +130,7 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
IEEE80211_TX_CTL_RATE_CTRL_PROBE))) IEEE80211_TX_CTL_RATE_CTRL_PROBE)))
return MT_PACKET_ID_NO_SKB; return MT_PACKET_ID_NO_SKB;
spin_lock_bh(&dev->status_list.lock); spin_lock_bh(&dev->status_lock);
pid = idr_alloc(&wcid->pktid, skb, MT_PACKET_ID_FIRST, pid = idr_alloc(&wcid->pktid, skb, MT_PACKET_ID_FIRST,
MT_PACKET_ID_MASK, GFP_ATOMIC); MT_PACKET_ID_MASK, GFP_ATOMIC);
...@@ -147,7 +147,7 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid, ...@@ -147,7 +147,7 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
list_add_tail(&wcid->list, &dev->wcid_list); list_add_tail(&wcid->list, &dev->wcid_list);
out: out:
spin_unlock_bh(&dev->status_list.lock); spin_unlock_bh(&dev->status_lock);
return pid; return pid;
} }
...@@ -160,7 +160,7 @@ mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid, ...@@ -160,7 +160,7 @@ mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid,
struct sk_buff *skb; struct sk_buff *skb;
int id; int id;
lockdep_assert_held(&dev->status_list.lock); lockdep_assert_held(&dev->status_lock);
skb = idr_remove(&wcid->pktid, pktid); skb = idr_remove(&wcid->pktid, pktid);
if (skb) if (skb)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment