1 /*
2  * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18 
19 #include "txrx.h"
20 
21 static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
22 {
23 	return 100 - ((bd->phy_stat0 >> 24) & 0xff);
24 }
25 
26 struct wcn36xx_rate {
27 	u16 bitrate;
28 	u16 mcs_or_legacy_index;
29 	enum mac80211_rx_encoding encoding;
30 	enum mac80211_rx_encoding_flags encoding_flags;
31 	enum rate_info_bw bw;
32 };
33 
34 static const struct wcn36xx_rate wcn36xx_rate_table[] = {
35 	/* 11b rates */
36 	{  10, 0, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
37 	{  20, 1, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
38 	{  55, 2, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
39 	{ 110, 3, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
40 
41 	/* 11b SP (short preamble) */
42 	{  10, 0, RX_ENC_LEGACY, RX_ENC_FLAG_SHORTPRE, RATE_INFO_BW_20 },
43 	{  20, 1, RX_ENC_LEGACY, RX_ENC_FLAG_SHORTPRE, RATE_INFO_BW_20 },
44 	{  55, 2, RX_ENC_LEGACY, RX_ENC_FLAG_SHORTPRE, RATE_INFO_BW_20 },
45 	{ 110, 3, RX_ENC_LEGACY, RX_ENC_FLAG_SHORTPRE, RATE_INFO_BW_20 },
46 
47 	/* 11ag */
48 	{  60, 4, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
49 	{  90, 5, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
50 	{ 120, 6, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
51 	{ 180, 7, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
52 	{ 240, 8, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
53 	{ 360, 9, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
54 	{ 480, 10, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
55 	{ 540, 11, RX_ENC_LEGACY, 0, RATE_INFO_BW_20 },
56 
57 	/* 11n */
58 	{  65, 0, RX_ENC_HT, 0, RATE_INFO_BW_20 },
59 	{ 130, 1, RX_ENC_HT, 0, RATE_INFO_BW_20 },
60 	{ 195, 2, RX_ENC_HT, 0, RATE_INFO_BW_20 },
61 	{ 260, 3, RX_ENC_HT, 0, RATE_INFO_BW_20 },
62 	{ 390, 4, RX_ENC_HT, 0, RATE_INFO_BW_20 },
63 	{ 520, 5, RX_ENC_HT, 0, RATE_INFO_BW_20 },
64 	{ 585, 6, RX_ENC_HT, 0, RATE_INFO_BW_20 },
65 	{ 650, 7, RX_ENC_HT, 0, RATE_INFO_BW_20 },
66 
67 	/* 11n SGI */
68 	{  72, 0, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
69 	{ 144, 1, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
70 	{ 217, 2, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
71 	{ 289, 3, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
72 	{ 434, 4, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
73 	{ 578, 5, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
74 	{ 650, 6, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
75 	{ 722, 7, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_20 },
76 
77 	/* 11n GF (greenfield) */
78 	{  65, 0, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
79 	{ 130, 1, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
80 	{ 195, 2, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
81 	{ 260, 3, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
82 	{ 390, 4, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
83 	{ 520, 5, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
84 	{ 585, 6, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
85 	{ 650, 7, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_20 },
86 
87 	/* 11n CB (channel bonding) */
88 	{ 135, 0, RX_ENC_HT, 0, RATE_INFO_BW_40 },
89 	{ 270, 1, RX_ENC_HT, 0, RATE_INFO_BW_40 },
90 	{ 405, 2, RX_ENC_HT, 0, RATE_INFO_BW_40 },
91 	{ 540, 3, RX_ENC_HT, 0, RATE_INFO_BW_40 },
92 	{ 810, 4, RX_ENC_HT, 0, RATE_INFO_BW_40 },
93 	{ 1080, 5, RX_ENC_HT, 0, RATE_INFO_BW_40 },
94 	{ 1215, 6, RX_ENC_HT, 0, RATE_INFO_BW_40 },
95 	{ 1350, 7, RX_ENC_HT, 0, RATE_INFO_BW_40 },
96 
97 	/* 11n CB + SGI */
98 	{ 150, 0, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
99 	{ 300, 1, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
100 	{ 450, 2, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
101 	{ 600, 3, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
102 	{ 900, 4, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
103 	{ 1200, 5, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
104 	{ 1350, 6, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
105 	{ 1500, 7, RX_ENC_HT, RX_ENC_FLAG_SHORT_GI, RATE_INFO_BW_40 },
106 
107 	/* 11n GF + CB */
108 	{ 135, 0, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
109 	{ 270, 1, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
110 	{ 405, 2, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
111 	{ 540, 3, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
112 	{ 810, 4, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
113 	{ 1080, 5, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
114 	{ 1215, 6, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
115 	{ 1350, 7, RX_ENC_HT, RX_ENC_FLAG_HT_GF, RATE_INFO_BW_40 },
116 
117 	/* TODO: AC rates */
118 };
119 
120 int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
121 {
122 	struct ieee80211_rx_status status;
123 	const struct wcn36xx_rate *rate;
124 	struct ieee80211_hdr *hdr;
125 	struct wcn36xx_rx_bd *bd;
126 	u16 fc, sn;
127 
128 	/*
129 	 * All fields must be 0, otherwise it can lead to
130 	 * unexpected consequences.
131 	 */
132 	memset(&status, 0, sizeof(status));
133 
134 	bd = (struct wcn36xx_rx_bd *)skb->data;
135 	buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
136 	wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP,
137 			 "BD   <<< ", (char *)bd,
138 			 sizeof(struct wcn36xx_rx_bd));
139 
140 	skb_put(skb, bd->pdu.mpdu_header_off + bd->pdu.mpdu_len);
141 	skb_pull(skb, bd->pdu.mpdu_header_off);
142 
143 	hdr = (struct ieee80211_hdr *) skb->data;
144 	fc = __le16_to_cpu(hdr->frame_control);
145 	sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl));
146 
147 	/* When scanning associate beacons to this */
148 	if (ieee80211_is_beacon(hdr->frame_control) && wcn->scan_freq) {
149 		status.freq = wcn->scan_freq;
150 		status.band = wcn->scan_band;
151 	} else {
152 		status.freq = WCN36XX_CENTER_FREQ(wcn);
153 		status.band = WCN36XX_BAND(wcn);
154 	}
155 
156 	status.mactime = 10;
157 	status.signal = -get_rssi0(bd);
158 	status.antenna = 1;
159 	status.flag = 0;
160 	status.rx_flags = 0;
161 	status.flag |= RX_FLAG_IV_STRIPPED |
162 		       RX_FLAG_MMIC_STRIPPED |
163 		       RX_FLAG_DECRYPTED;
164 
165 	wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=%x\n", status.flag);
166 
167 	if (bd->rate_id < ARRAY_SIZE(wcn36xx_rate_table)) {
168 		rate = &wcn36xx_rate_table[bd->rate_id];
169 		status.encoding = rate->encoding;
170 		status.enc_flags = rate->encoding_flags;
171 		status.bw = rate->bw;
172 		status.rate_idx = rate->mcs_or_legacy_index;
173 	} else {
174 		status.encoding = 0;
175 		status.bw = 0;
176 		status.enc_flags = 0;
177 		status.rate_idx = 0;
178 	}
179 
180 	memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
181 
182 	if (ieee80211_is_beacon(hdr->frame_control)) {
183 		wcn36xx_dbg(WCN36XX_DBG_BEACON, "beacon skb %p len %d fc %04x sn %d\n",
184 			    skb, skb->len, fc, sn);
185 		wcn36xx_dbg_dump(WCN36XX_DBG_BEACON_DUMP, "SKB <<< ",
186 				 (char *)skb->data, skb->len);
187 	} else {
188 		wcn36xx_dbg(WCN36XX_DBG_RX, "rx skb %p len %d fc %04x sn %d\n",
189 			    skb, skb->len, fc, sn);
190 		wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP, "SKB <<< ",
191 				 (char *)skb->data, skb->len);
192 	}
193 
194 	ieee80211_rx_irqsafe(wcn->hw, skb);
195 
196 	return 0;
197 }
198 
199 static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd,
200 			       u32 mpdu_header_len,
201 			       u32 len,
202 			       u16 tid)
203 {
204 	bd->pdu.mpdu_header_len = mpdu_header_len;
205 	bd->pdu.mpdu_header_off = sizeof(*bd);
206 	bd->pdu.mpdu_data_off = bd->pdu.mpdu_header_len +
207 		bd->pdu.mpdu_header_off;
208 	bd->pdu.mpdu_len = len;
209 	bd->pdu.tid = tid;
210 	/* Use seq number generated by mac80211 */
211 	bd->pdu.bd_ssn = WCN36XX_TXBD_SSN_FILL_HOST;
212 }
213 
214 static inline struct wcn36xx_vif *get_vif_by_addr(struct wcn36xx *wcn,
215 						  u8 *addr)
216 {
217 	struct wcn36xx_vif *vif_priv = NULL;
218 	struct ieee80211_vif *vif = NULL;
219 	list_for_each_entry(vif_priv, &wcn->vif_list, list) {
220 			vif = wcn36xx_priv_to_vif(vif_priv);
221 			if (memcmp(vif->addr, addr, ETH_ALEN) == 0)
222 				return vif_priv;
223 	}
224 	wcn36xx_warn("vif %pM not found\n", addr);
225 	return NULL;
226 }
227 
228 static void wcn36xx_tx_start_ampdu(struct wcn36xx *wcn,
229 				   struct wcn36xx_sta *sta_priv,
230 				   struct sk_buff *skb)
231 {
232 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
233 	struct ieee80211_sta *sta;
234 	u8 *qc, tid;
235 
236 	if (!conf_is_ht(&wcn->hw->conf))
237 		return;
238 
239 	sta = wcn36xx_priv_to_sta(sta_priv);
240 
241 	if (WARN_ON(!ieee80211_is_data_qos(hdr->frame_control)))
242 		return;
243 
244 	if (skb_get_queue_mapping(skb) == IEEE80211_AC_VO)
245 		return;
246 
247 	qc = ieee80211_get_qos_ctl(hdr);
248 	tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
249 
250 	spin_lock(&sta_priv->ampdu_lock);
251 	if (sta_priv->ampdu_state[tid] != WCN36XX_AMPDU_NONE)
252 		goto out_unlock;
253 
254 	if (sta_priv->non_agg_frame_ct++ >= WCN36XX_AMPDU_START_THRESH) {
255 		sta_priv->ampdu_state[tid] = WCN36XX_AMPDU_START;
256 		sta_priv->non_agg_frame_ct = 0;
257 		ieee80211_start_tx_ba_session(sta, tid, 0);
258 	}
259 out_unlock:
260 	spin_unlock(&sta_priv->ampdu_lock);
261 }
262 
263 static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,
264 				struct wcn36xx *wcn,
265 				struct wcn36xx_vif **vif_priv,
266 				struct wcn36xx_sta *sta_priv,
267 				struct sk_buff *skb,
268 				bool bcast)
269 {
270 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
271 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
272 	struct ieee80211_vif *vif = NULL;
273 	struct wcn36xx_vif *__vif_priv = NULL;
274 	bool is_data_qos = ieee80211_is_data_qos(hdr->frame_control);
275 	u16 tid = 0;
276 
277 	bd->bd_rate = WCN36XX_BD_RATE_DATA;
278 
279 	/*
280 	 * For not unicast frames mac80211 will not set sta pointer so use
281 	 * self_sta_index instead.
282 	 */
283 	if (sta_priv) {
284 		__vif_priv = sta_priv->vif;
285 		vif = wcn36xx_priv_to_vif(__vif_priv);
286 
287 		bd->dpu_sign = sta_priv->ucast_dpu_sign;
288 		if (vif->type == NL80211_IFTYPE_STATION) {
289 			bd->sta_index = sta_priv->bss_sta_index;
290 			bd->dpu_desc_idx = sta_priv->bss_dpu_desc_index;
291 		} else if (vif->type == NL80211_IFTYPE_AP ||
292 			   vif->type == NL80211_IFTYPE_ADHOC ||
293 			   vif->type == NL80211_IFTYPE_MESH_POINT) {
294 			bd->sta_index = sta_priv->sta_index;
295 			bd->dpu_desc_idx = sta_priv->dpu_desc_index;
296 		}
297 	} else {
298 		__vif_priv = get_vif_by_addr(wcn, hdr->addr2);
299 		bd->sta_index = __vif_priv->self_sta_index;
300 		bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index;
301 		bd->dpu_sign = __vif_priv->self_ucast_dpu_sign;
302 	}
303 
304 	if (is_data_qos) {
305 		tid = ieee80211_get_tid(hdr);
306 		/* TID->QID is one-to-one mapping */
307 		bd->queue_id = tid;
308 	}
309 
310 	if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT ||
311 	    (sta_priv && !sta_priv->is_data_encrypted)) {
312 		bd->dpu_ne = 1;
313 	}
314 
315 	if (ieee80211_is_any_nullfunc(hdr->frame_control)) {
316 		/* Don't use a regular queue for null packet (no ampdu) */
317 		bd->queue_id = WCN36XX_TX_U_WQ_ID;
318 	}
319 
320 	if (bcast) {
321 		bd->ub = 1;
322 		bd->ack_policy = 1;
323 	}
324 	*vif_priv = __vif_priv;
325 
326 	wcn36xx_set_tx_pdu(bd,
327 			   is_data_qos ?
328 			   sizeof(struct ieee80211_qos_hdr) :
329 			   sizeof(struct ieee80211_hdr_3addr),
330 			   skb->len, tid);
331 
332 	if (sta_priv && is_data_qos)
333 		wcn36xx_tx_start_ampdu(wcn, sta_priv, skb);
334 }
335 
336 static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
337 				struct wcn36xx *wcn,
338 				struct wcn36xx_vif **vif_priv,
339 				struct sk_buff *skb,
340 				bool bcast)
341 {
342 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
343 	struct wcn36xx_vif *__vif_priv =
344 		get_vif_by_addr(wcn, hdr->addr2);
345 	bd->sta_index = __vif_priv->self_sta_index;
346 	bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index;
347 	bd->dpu_ne = 1;
348 
349 	/* default rate for unicast */
350 	if (ieee80211_is_mgmt(hdr->frame_control))
351 		bd->bd_rate = (WCN36XX_BAND(wcn) == NL80211_BAND_5GHZ) ?
352 			WCN36XX_BD_RATE_CTRL :
353 			WCN36XX_BD_RATE_MGMT;
354 	else if (ieee80211_is_ctl(hdr->frame_control))
355 		bd->bd_rate = WCN36XX_BD_RATE_CTRL;
356 	else
357 		wcn36xx_warn("frame control type unknown\n");
358 
359 	/*
360 	 * In joining state trick hardware that probe is sent as
361 	 * unicast even if address is broadcast.
362 	 */
363 	if (__vif_priv->is_joining &&
364 	    ieee80211_is_probe_req(hdr->frame_control))
365 		bcast = false;
366 
367 	if (bcast) {
368 		/* broadcast */
369 		bd->ub = 1;
370 		/* No ack needed not unicast */
371 		bd->ack_policy = 1;
372 		bd->queue_id = WCN36XX_TX_B_WQ_ID;
373 	} else
374 		bd->queue_id = WCN36XX_TX_U_WQ_ID;
375 	*vif_priv = __vif_priv;
376 
377 	wcn36xx_set_tx_pdu(bd,
378 			   ieee80211_is_data_qos(hdr->frame_control) ?
379 			   sizeof(struct ieee80211_qos_hdr) :
380 			   sizeof(struct ieee80211_hdr_3addr),
381 			   skb->len, WCN36XX_TID);
382 }
383 
384 int wcn36xx_start_tx(struct wcn36xx *wcn,
385 		     struct wcn36xx_sta *sta_priv,
386 		     struct sk_buff *skb)
387 {
388 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
389 	struct wcn36xx_vif *vif_priv = NULL;
390 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
391 	unsigned long flags;
392 	bool is_low = ieee80211_is_data(hdr->frame_control);
393 	bool bcast = is_broadcast_ether_addr(hdr->addr1) ||
394 		is_multicast_ether_addr(hdr->addr1);
395 	struct wcn36xx_tx_bd bd;
396 	int ret;
397 
398 	memset(&bd, 0, sizeof(bd));
399 
400 	wcn36xx_dbg(WCN36XX_DBG_TX,
401 		    "tx skb %p len %d fc %04x sn %d %s %s\n",
402 		    skb, skb->len, __le16_to_cpu(hdr->frame_control),
403 		    IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)),
404 		    is_low ? "low" : "high", bcast ? "bcast" : "ucast");
405 
406 	wcn36xx_dbg_dump(WCN36XX_DBG_TX_DUMP, "", skb->data, skb->len);
407 
408 	bd.dpu_rf = WCN36XX_BMU_WQ_TX;
409 
410 	if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
411 		wcn36xx_dbg(WCN36XX_DBG_DXE, "TX_ACK status requested\n");
412 
413 		spin_lock_irqsave(&wcn->dxe_lock, flags);
414 		if (wcn->tx_ack_skb) {
415 			spin_unlock_irqrestore(&wcn->dxe_lock, flags);
416 			wcn36xx_warn("tx_ack_skb already set\n");
417 			return -EINVAL;
418 		}
419 
420 		wcn->tx_ack_skb = skb;
421 		spin_unlock_irqrestore(&wcn->dxe_lock, flags);
422 
423 		/* Only one at a time is supported by fw. Stop the TX queues
424 		 * until the ack status gets back.
425 		 */
426 		ieee80211_stop_queues(wcn->hw);
427 
428 		/* TX watchdog if no TX irq or ack indication received  */
429 		mod_timer(&wcn->tx_ack_timer, jiffies + HZ / 10);
430 
431 		/* Request ack indication from the firmware */
432 		if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
433 			bd.tx_comp = 1;
434 	}
435 
436 	/* Data frames served first*/
437 	if (is_low)
438 		wcn36xx_set_tx_data(&bd, wcn, &vif_priv, sta_priv, skb, bcast);
439 	else
440 		/* MGMT and CTRL frames are handeld here*/
441 		wcn36xx_set_tx_mgmt(&bd, wcn, &vif_priv, skb, bcast);
442 
443 	buff_to_be((u32 *)&bd, sizeof(bd)/sizeof(u32));
444 	bd.tx_bd_sign = 0xbdbdbdbd;
445 
446 	ret = wcn36xx_dxe_tx_frame(wcn, vif_priv, &bd, skb, is_low);
447 	if (ret && (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
448 		/* If the skb has not been transmitted,
449 		 * don't keep a reference to it.
450 		 */
451 		spin_lock_irqsave(&wcn->dxe_lock, flags);
452 		wcn->tx_ack_skb = NULL;
453 		spin_unlock_irqrestore(&wcn->dxe_lock, flags);
454 
455 		ieee80211_wake_queues(wcn->hw);
456 	}
457 
458 	return ret;
459 }
460