e6db1048496f474c9ef0e178b1c74e7ff60f3ca5
[openwrt.git] / package / mac80211 / patches / 527-mac80211_use_ieee80211_free_txskb.patch
1 --- a/net/mac80211/tx.c
2 +++ b/net/mac80211/tx.c
3 @@ -354,7 +354,7 @@ static void purge_old_ps_buffers(struct 
4                         total += skb_queue_len(&sta->ps_tx_buf[ac]);
5                         if (skb) {
6                                 purged++;
7 -                               dev_kfree_skb(skb);
8 +                               ieee80211_free_txskb(&local->hw, skb);
9                                 break;
10                         }
11                 }
12 @@ -466,7 +466,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
13                         ps_dbg(tx->sdata,
14                                "STA %pM TX buffer for AC %d full - dropping oldest frame\n",
15                                sta->sta.addr, ac);
16 -                       dev_kfree_skb(old);
17 +                       ieee80211_free_txskb(&local->hw, old);
18                 } else
19                         tx->local->total_ps_buffered++;
20  
21 @@ -1103,7 +1103,7 @@ static bool ieee80211_tx_prep_agg(struct
22                 spin_unlock(&tx->sta->lock);
23  
24                 if (purge_skb)
25 -                       dev_kfree_skb(purge_skb);
26 +                       ieee80211_free_txskb(&tx->local->hw, purge_skb);
27         }
28  
29         /* reset session timer */
30 @@ -1214,7 +1214,7 @@ static bool ieee80211_tx_frags(struct ie
31  #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
32                 if (WARN_ON_ONCE(q >= local->hw.queues)) {
33                         __skb_unlink(skb, skbs);
34 -                       dev_kfree_skb(skb);
35 +                       ieee80211_free_txskb(&local->hw, skb);
36                         continue;
37                 }
38  #endif
39 @@ -1356,7 +1356,7 @@ static int invoke_tx_handlers(struct iee
40         if (unlikely(res == TX_DROP)) {
41                 I802_DEBUG_INC(tx->local->tx_handlers_drop);
42                 if (tx->skb)
43 -                       dev_kfree_skb(tx->skb);
44 +                       ieee80211_free_txskb(&tx->local->hw, tx->skb);
45                 else
46                         __skb_queue_purge(&tx->skbs);
47                 return -1;
48 @@ -1393,7 +1393,7 @@ static bool ieee80211_tx(struct ieee8021
49         res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
50  
51         if (unlikely(res_prepare == TX_DROP)) {
52 -               dev_kfree_skb(skb);
53 +               ieee80211_free_txskb(&local->hw, skb);
54                 goto out;
55         } else if (unlikely(res_prepare == TX_QUEUED)) {
56                 goto out;
57 @@ -1465,7 +1465,7 @@ void ieee80211_xmit(struct ieee80211_sub
58         headroom = max_t(int, 0, headroom);
59  
60         if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) {
61 -               dev_kfree_skb(skb);
62 +               ieee80211_free_txskb(&local->hw, skb);
63                 rcu_read_unlock();
64                 return;
65         }
66 @@ -2056,8 +2056,10 @@ netdev_tx_t ieee80211_subif_start_xmit(s
67                 head_need += IEEE80211_ENCRYPT_HEADROOM;
68                 head_need += local->tx_headroom;
69                 head_need = max_t(int, 0, head_need);
70 -               if (ieee80211_skb_resize(sdata, skb, head_need, true))
71 -                       goto fail;
72 +               if (ieee80211_skb_resize(sdata, skb, head_need, true)) {
73 +                       ieee80211_free_txskb(&local->hw, skb);
74 +                       return NETDEV_TX_OK;
75 +               }
76         }
77  
78         if (encaps_data) {
79 @@ -2190,7 +2192,7 @@ void ieee80211_tx_pending(unsigned long 
80                         struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
81  
82                         if (WARN_ON(!info->control.vif)) {
83 -                               kfree_skb(skb);
84 +                               ieee80211_free_txskb(&local->hw, skb);
85                                 continue;
86                         }
87  
88 --- a/net/mac80211/status.c
89 +++ b/net/mac80211/status.c
90 @@ -34,7 +34,7 @@ void ieee80211_tx_status_irqsafe(struct 
91                 skb_queue_len(&local->skb_queue_unreliable);
92         while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT &&
93                (skb = skb_dequeue(&local->skb_queue_unreliable))) {
94 -               dev_kfree_skb_irq(skb);
95 +               ieee80211_free_txskb(hw, skb);
96                 tmp--;
97                 I802_DEBUG_INC(local->tx_status_drop);
98         }
99 @@ -159,7 +159,7 @@ static void ieee80211_handle_filtered_fr
100                            "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n",
101                            skb_queue_len(&sta->tx_filtered[ac]),
102                            !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies);
103 -       dev_kfree_skb(skb);
104 +       ieee80211_free_txskb(&local->hw, skb);
105  }
106  
107  static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid)