b9069ef9b8ce939f281794c49f5b1e355f65a48a
[openwrt/staging/neocturne.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 17 Aug 2020 13:35:32 +0200
3 Subject: [PATCH] mac80211: swap NEED_TXPROCESSING and HW_80211_ENCAP tx
4 flags
5
6 In order to unify the tx status path, the hw 802.11 encapsulation flag
7 needs to survive the trip to the tx status call.
8 Since we don't have any free bits in info->flags, we need to move one.
9 IEEE80211_TX_INTFL_NEED_TXPROCESSING is only used internally in mac80211,
10 and only before the call into the driver.
11
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 ---
14
15 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c
16 +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
17 @@ -14,7 +14,7 @@ ath11k_dp_tx_get_encap_type(struct ath11
18 {
19 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
20
21 - if (tx_info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP)
22 + if (tx_info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)
23 return HAL_TCL_ENCAP_TYPE_ETHERNET;
24
25 return HAL_TCL_ENCAP_TYPE_NATIVE_WIFI;
26 @@ -93,7 +93,7 @@ int ath11k_dp_tx(struct ath11k *ar, stru
27 if (test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags))
28 return -ESHUTDOWN;
29
30 - if (!(info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP) &&
31 + if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
32 !ieee80211_is_data(hdr->frame_control))
33 return -ENOTSUPP;
34
35 --- a/drivers/net/wireless/ath/ath11k/mac.c
36 +++ b/drivers/net/wireless/ath/ath11k/mac.c
37 @@ -3749,7 +3749,7 @@ static int ath11k_mac_mgmt_tx_wmi(struct
38 return -ENOSPC;
39
40 info = IEEE80211_SKB_CB(skb);
41 - if (!(info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP)) {
42 + if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) {
43 if ((ieee80211_is_action(hdr->frame_control) ||
44 ieee80211_is_deauth(hdr->frame_control) ||
45 ieee80211_is_disassoc(hdr->frame_control)) &&
46 @@ -3876,7 +3876,7 @@ static void ath11k_mac_op_tx(struct ieee
47 bool is_prb_rsp;
48 int ret;
49
50 - if (info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP) {
51 + if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
52 skb_cb->flags |= ATH11K_SKB_HW_80211_ENCAP;
53 } else if (ieee80211_is_mgmt(hdr->frame_control)) {
54 is_prb_rsp = ieee80211_is_probe_resp(hdr->frame_control);
55 --- a/include/net/mac80211.h
56 +++ b/include/net/mac80211.h
57 @@ -720,9 +720,8 @@ struct ieee80211_bss_conf {
58 * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate
59 * that a frame can be transmitted while the queues are stopped for
60 * off-channel operation.
61 - * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
62 - * used to indicate that a pending frame requires TX processing before
63 - * it can be sent out.
64 + * @IEEE80211_TX_CTL_HW_80211_ENCAP: This frame uses hardware encapsulation
65 + * (header conversion)
66 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
67 * used to indicate that a frame was already retried due to PS
68 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
69 @@ -791,7 +790,7 @@ enum mac80211_tx_info_flags {
70 IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11),
71 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
72 IEEE80211_TX_INTFL_OFFCHAN_TX_OK = BIT(13),
73 - IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
74 + IEEE80211_TX_CTL_HW_80211_ENCAP = BIT(14),
75 IEEE80211_TX_INTFL_RETRIED = BIT(15),
76 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
77 IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
78 @@ -823,8 +822,9 @@ enum mac80211_tx_info_flags {
79 * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
80 * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path
81 * @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup
82 - * @IEEE80211_TX_CTRL_HW_80211_ENCAP: This frame uses hardware encapsulation
83 - * (header conversion)
84 + * @IEEE80211_TX_INTCFL_NEED_TXPROCESSING: completely internal to mac80211,
85 + * used to indicate that a pending frame requires TX processing before
86 + * it can be sent out.
87 *
88 * These flags are used in tx_info->control.flags.
89 */
90 @@ -835,7 +835,7 @@ enum mac80211_tx_control_flags {
91 IEEE80211_TX_CTRL_AMSDU = BIT(3),
92 IEEE80211_TX_CTRL_FAST_XMIT = BIT(4),
93 IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP = BIT(5),
94 - IEEE80211_TX_CTRL_HW_80211_ENCAP = BIT(6),
95 + IEEE80211_TX_INTCFL_NEED_TXPROCESSING = BIT(6),
96 };
97
98 /*
99 --- a/net/mac80211/mesh_hwmp.c
100 +++ b/net/mac80211/mesh_hwmp.c
101 @@ -212,7 +212,7 @@ static void prepare_frame_for_deferred_t
102 skb->priority = 7;
103
104 info->control.vif = &sdata->vif;
105 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
106 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
107 ieee80211_set_qos_hdr(sdata, skb);
108 ieee80211_mps_set_frame_flags(sdata, NULL, hdr);
109 }
110 @@ -1163,7 +1163,7 @@ int mesh_nexthop_resolve(struct ieee8021
111 if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN)
112 skb_to_free = skb_dequeue(&mpath->frame_queue);
113
114 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
115 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
116 ieee80211_set_qos_hdr(sdata, skb);
117 skb_queue_tail(&mpath->frame_queue, skb);
118 if (skb_to_free)
119 --- a/net/mac80211/mesh_ps.c
120 +++ b/net/mac80211/mesh_ps.c
121 @@ -432,7 +432,7 @@ static void mpsp_qos_null_append(struct
122
123 info = IEEE80211_SKB_CB(new_skb);
124 info->control.vif = &sdata->vif;
125 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
126 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
127
128 __skb_queue_tail(frames, new_skb);
129 }
130 --- a/net/mac80211/rx.c
131 +++ b/net/mac80211/rx.c
132 @@ -2896,7 +2896,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
133 fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY);
134 info = IEEE80211_SKB_CB(fwd_skb);
135 memset(info, 0, sizeof(*info));
136 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
137 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
138 info->control.vif = &rx->sdata->vif;
139 info->control.jiffies = jiffies;
140 if (is_multicast_ether_addr(fwd_hdr->addr1)) {
141 --- a/net/mac80211/status.c
142 +++ b/net/mac80211/status.c
143 @@ -66,8 +66,8 @@ static void ieee80211_handle_filtered_fr
144
145 info->control.jiffies = jiffies;
146 info->control.vif = &sta->sdata->vif;
147 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING |
148 - IEEE80211_TX_INTFL_RETRANSMISSION;
149 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
150 + info->flags |= IEEE80211_TX_INTFL_RETRANSMISSION;
151 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;
152
153 sta->status_stats.filtered++;
154 --- a/net/mac80211/tx.c
155 +++ b/net/mac80211/tx.c
156 @@ -530,7 +530,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
157
158 info->control.jiffies = jiffies;
159 info->control.vif = &tx->sdata->vif;
160 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
161 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
162 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;
163 skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb);
164 spin_unlock(&sta->ps_lock);
165 @@ -1132,7 +1132,7 @@ static bool ieee80211_tx_prep_agg(struct
166 tx->sta->sta.addr, tx->sta->sta.aid);
167 }
168 info->control.vif = &tx->sdata->vif;
169 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
170 + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
171 info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS;
172 __skb_queue_tail(&tid_tx->pending, skb);
173 if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER)
174 @@ -1177,7 +1177,7 @@ ieee80211_tx_prepare(struct ieee80211_su
175 * we are doing the needed processing, so remove the flag
176 * now.
177 */
178 - info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
179 + info->control.flags &= ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
180
181 hdr = (struct ieee80211_hdr *) skb->data;
182
183 @@ -1256,7 +1256,7 @@ static struct txq_info *ieee80211_get_tx
184 (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
185 return NULL;
186
187 - if (!(info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP) &&
188 + if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
189 unlikely(!ieee80211_is_data_present(hdr->frame_control))) {
190 if ((!ieee80211_is_mgmt(hdr->frame_control) ||
191 ieee80211_is_bufferable_mmpdu(hdr->frame_control) ||
192 @@ -3640,7 +3640,7 @@ begin:
193 else
194 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
195
196 - if (info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP)
197 + if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)
198 goto encap_out;
199
200 if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) {
201 @@ -4230,7 +4230,7 @@ static void ieee80211_8023_xmit(struct i
202 sdata = container_of(sdata->bss,
203 struct ieee80211_sub_if_data, u.ap);
204
205 - info->control.flags |= IEEE80211_TX_CTRL_HW_80211_ENCAP;
206 + info->flags |= IEEE80211_TX_CTL_HW_80211_ENCAP;
207 info->control.vif = &sdata->vif;
208
209 if (key)
210 @@ -4355,7 +4355,7 @@ static bool ieee80211_tx_pending_skb(str
211
212 sdata = vif_to_sdata(info->control.vif);
213
214 - if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) {
215 + if (info->control.flags & IEEE80211_TX_INTCFL_NEED_TXPROCESSING) {
216 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
217 if (unlikely(!chanctx_conf)) {
218 dev_kfree_skb(skb);
219 @@ -4363,7 +4363,7 @@ static bool ieee80211_tx_pending_skb(str
220 }
221 info->band = chanctx_conf->def.chan->band;
222 result = ieee80211_tx(sdata, NULL, skb, true, 0);
223 - } else if (info->control.flags & IEEE80211_TX_CTRL_HW_80211_ENCAP) {
224 + } else if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
225 if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) {
226 dev_kfree_skb(skb);
227 return true;