1 | #include <machine/rtems-bsd-kernel-space.h> |
---|
2 | |
---|
3 | /* $OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $ */ |
---|
4 | |
---|
5 | /*- |
---|
6 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> |
---|
7 | * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org> |
---|
8 | * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org> |
---|
9 | * |
---|
10 | * Permission to use, copy, modify, and distribute this software for any |
---|
11 | * purpose with or without fee is hereby granted, provided that the above |
---|
12 | * copyright notice and this permission notice appear in all copies. |
---|
13 | * |
---|
14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
15 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
16 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
17 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
19 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
20 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
21 | */ |
---|
22 | |
---|
23 | #include <sys/cdefs.h> |
---|
24 | __FBSDID("$FreeBSD$"); |
---|
25 | |
---|
26 | #include <rtems/bsd/local/opt_wlan.h> |
---|
27 | |
---|
28 | #include <rtems/bsd/sys/param.h> |
---|
29 | #include <rtems/bsd/sys/lock.h> |
---|
30 | #include <sys/mutex.h> |
---|
31 | #include <sys/mbuf.h> |
---|
32 | #include <sys/kernel.h> |
---|
33 | #include <sys/socket.h> |
---|
34 | #include <sys/systm.h> |
---|
35 | #include <sys/malloc.h> |
---|
36 | #include <sys/queue.h> |
---|
37 | #include <sys/taskqueue.h> |
---|
38 | #include <sys/bus.h> |
---|
39 | #include <sys/endian.h> |
---|
40 | #include <sys/linker.h> |
---|
41 | |
---|
42 | #include <net/if.h> |
---|
43 | #include <net/ethernet.h> |
---|
44 | #include <net/if_media.h> |
---|
45 | |
---|
46 | #include <net80211/ieee80211_var.h> |
---|
47 | #include <net80211/ieee80211_radiotap.h> |
---|
48 | |
---|
49 | #include <dev/rtwn/if_rtwnreg.h> |
---|
50 | #include <dev/rtwn/if_rtwnvar.h> |
---|
51 | |
---|
52 | #include <dev/rtwn/if_rtwn_ridx.h> |
---|
53 | #include <dev/rtwn/if_rtwn_tx.h> |
---|
54 | |
---|
55 | #include <dev/rtwn/rtl8192c/r92c.h> |
---|
56 | #include <dev/rtwn/rtl8192c/r92c_var.h> |
---|
57 | #include <dev/rtwn/rtl8192c/r92c_tx_desc.h> |
---|
58 | |
---|
59 | |
---|
60 | static int |
---|
61 | r92c_tx_get_sco(struct rtwn_softc *sc, struct ieee80211_channel *c) |
---|
62 | { |
---|
63 | if (IEEE80211_IS_CHAN_HT40U(c)) |
---|
64 | return (R92C_TXDW4_SCO_SCA); |
---|
65 | else |
---|
66 | return (R92C_TXDW4_SCO_SCB); |
---|
67 | } |
---|
68 | |
---|
69 | static void |
---|
70 | r92c_tx_set_ht40(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni) |
---|
71 | { |
---|
72 | struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf; |
---|
73 | |
---|
74 | if (ni->ni_chan != IEEE80211_CHAN_ANYC && |
---|
75 | IEEE80211_IS_CHAN_HT40(ni->ni_chan)) { |
---|
76 | int extc_offset; |
---|
77 | |
---|
78 | extc_offset = r92c_tx_get_sco(sc, ni->ni_chan); |
---|
79 | txd->txdw4 |= htole32(R92C_TXDW4_DATA_BW40); |
---|
80 | txd->txdw4 |= htole32(SM(R92C_TXDW4_DATA_SCO, extc_offset)); |
---|
81 | } |
---|
82 | } |
---|
83 | |
---|
84 | static void |
---|
85 | r92c_tx_protection(struct rtwn_softc *sc, struct r92c_tx_desc *txd, |
---|
86 | enum ieee80211_protmode mode, uint8_t ridx) |
---|
87 | { |
---|
88 | struct ieee80211com *ic = &sc->sc_ic; |
---|
89 | uint8_t rate; |
---|
90 | |
---|
91 | switch (mode) { |
---|
92 | case IEEE80211_PROT_CTSONLY: |
---|
93 | txd->txdw4 |= htole32(R92C_TXDW4_CTS2SELF); |
---|
94 | break; |
---|
95 | case IEEE80211_PROT_RTSCTS: |
---|
96 | txd->txdw4 |= htole32(R92C_TXDW4_RTSEN); |
---|
97 | break; |
---|
98 | default: |
---|
99 | break; |
---|
100 | } |
---|
101 | |
---|
102 | if (mode == IEEE80211_PROT_CTSONLY || |
---|
103 | mode == IEEE80211_PROT_RTSCTS) { |
---|
104 | if (ridx >= RTWN_RIDX_MCS(0)) |
---|
105 | rate = rtwn_ctl_mcsrate(ic->ic_rt, ridx); |
---|
106 | else |
---|
107 | rate = ieee80211_ctl_rate(ic->ic_rt, ridx2rate[ridx]); |
---|
108 | ridx = rate2ridx(rate); |
---|
109 | |
---|
110 | txd->txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, ridx)); |
---|
111 | /* RTS rate fallback limit (max). */ |
---|
112 | txd->txdw5 |= htole32(SM(R92C_TXDW5_RTSRATE_FB_LMT, 0xf)); |
---|
113 | |
---|
114 | if (RTWN_RATE_IS_CCK(ridx) && ridx != RTWN_RIDX_CCK1 && |
---|
115 | (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) |
---|
116 | txd->txdw4 |= htole32(R92C_TXDW4_RTS_SHORT); |
---|
117 | } |
---|
118 | } |
---|
119 | |
---|
120 | static void |
---|
121 | r92c_tx_raid(struct rtwn_softc *sc, struct r92c_tx_desc *txd, |
---|
122 | struct ieee80211_node *ni, int ismcast) |
---|
123 | { |
---|
124 | struct ieee80211com *ic = &sc->sc_ic; |
---|
125 | struct ieee80211vap *vap = ni->ni_vap; |
---|
126 | struct ieee80211_channel *chan; |
---|
127 | enum ieee80211_phymode mode; |
---|
128 | uint8_t raid; |
---|
129 | |
---|
130 | chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ? |
---|
131 | ni->ni_chan : ic->ic_curchan; |
---|
132 | mode = ieee80211_chan2mode(chan); |
---|
133 | |
---|
134 | /* NB: group addressed frames are done at 11bg rates for now */ |
---|
135 | if (ismcast || !(ni->ni_flags & IEEE80211_NODE_HT)) { |
---|
136 | switch (mode) { |
---|
137 | case IEEE80211_MODE_11B: |
---|
138 | case IEEE80211_MODE_11G: |
---|
139 | break; |
---|
140 | case IEEE80211_MODE_11NG: |
---|
141 | mode = IEEE80211_MODE_11G; |
---|
142 | break; |
---|
143 | default: |
---|
144 | device_printf(sc->sc_dev, "unknown mode(1) %d!\n", |
---|
145 | ic->ic_curmode); |
---|
146 | return; |
---|
147 | } |
---|
148 | } |
---|
149 | |
---|
150 | switch (mode) { |
---|
151 | case IEEE80211_MODE_11B: |
---|
152 | raid = R92C_RAID_11B; |
---|
153 | break; |
---|
154 | case IEEE80211_MODE_11G: |
---|
155 | if (vap->iv_flags & IEEE80211_F_PUREG) |
---|
156 | raid = R92C_RAID_11G; |
---|
157 | else |
---|
158 | raid = R92C_RAID_11BG; |
---|
159 | break; |
---|
160 | case IEEE80211_MODE_11NG: |
---|
161 | if (vap->iv_flags_ht & IEEE80211_FHT_PUREN) |
---|
162 | raid = R92C_RAID_11N; |
---|
163 | else |
---|
164 | raid = R92C_RAID_11BGN; |
---|
165 | break; |
---|
166 | default: |
---|
167 | device_printf(sc->sc_dev, "unknown mode(2) %d!\n", mode); |
---|
168 | return; |
---|
169 | } |
---|
170 | |
---|
171 | txd->txdw1 |= htole32(SM(R92C_TXDW1_RAID, raid)); |
---|
172 | } |
---|
173 | |
---|
174 | /* XXX move to device-independent layer */ |
---|
175 | static void |
---|
176 | r92c_tx_set_sgi(struct rtwn_softc *sc, void *buf, struct ieee80211_node *ni) |
---|
177 | { |
---|
178 | struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf; |
---|
179 | struct ieee80211vap *vap = ni->ni_vap; |
---|
180 | |
---|
181 | if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) && /* HT20 */ |
---|
182 | (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20)) |
---|
183 | txd->txdw5 |= htole32(R92C_TXDW5_SGI); |
---|
184 | else if (ni->ni_chan != IEEE80211_CHAN_ANYC && /* HT40 */ |
---|
185 | IEEE80211_IS_CHAN_HT40(ni->ni_chan) && |
---|
186 | (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI40) && |
---|
187 | (vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40)) |
---|
188 | txd->txdw5 |= htole32(R92C_TXDW5_SGI); |
---|
189 | } |
---|
190 | |
---|
191 | void |
---|
192 | r92c_tx_enable_ampdu(void *buf, int enable) |
---|
193 | { |
---|
194 | struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf; |
---|
195 | |
---|
196 | if (enable) |
---|
197 | txd->txdw1 |= htole32(R92C_TXDW1_AGGEN); |
---|
198 | else |
---|
199 | txd->txdw1 |= htole32(R92C_TXDW1_AGGBK); |
---|
200 | } |
---|
201 | |
---|
202 | void |
---|
203 | r92c_tx_setup_hwseq(void *buf) |
---|
204 | { |
---|
205 | struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf; |
---|
206 | |
---|
207 | txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ_EN); |
---|
208 | } |
---|
209 | |
---|
210 | void |
---|
211 | r92c_tx_setup_macid(void *buf, int id) |
---|
212 | { |
---|
213 | struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf; |
---|
214 | |
---|
215 | txd->txdw1 |= htole32(SM(R92C_TXDW1_MACID, id)); |
---|
216 | } |
---|
217 | |
---|
218 | void |
---|
219 | r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, |
---|
220 | struct mbuf *m, void *buf, uint8_t ridx, int maxretry) |
---|
221 | { |
---|
222 | #ifndef RTWN_WITHOUT_UCODE |
---|
223 | struct r92c_softc *rs = sc->sc_priv; |
---|
224 | #endif |
---|
225 | struct ieee80211com *ic = &sc->sc_ic; |
---|
226 | struct ieee80211vap *vap = ni->ni_vap; |
---|
227 | struct rtwn_vap *uvp = RTWN_VAP(vap); |
---|
228 | struct ieee80211_frame *wh; |
---|
229 | struct r92c_tx_desc *txd; |
---|
230 | enum ieee80211_protmode prot; |
---|
231 | uint8_t type, tid, qos, qsel; |
---|
232 | int hasqos, ismcast, macid; |
---|
233 | |
---|
234 | wh = mtod(m, struct ieee80211_frame *); |
---|
235 | type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; |
---|
236 | hasqos = IEEE80211_QOS_HAS_SEQ(wh); |
---|
237 | ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); |
---|
238 | |
---|
239 | /* Select TX ring for this frame. */ |
---|
240 | if (hasqos) { |
---|
241 | qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; |
---|
242 | tid = qos & IEEE80211_QOS_TID; |
---|
243 | } else { |
---|
244 | qos = 0; |
---|
245 | tid = 0; |
---|
246 | } |
---|
247 | |
---|
248 | /* Fill Tx descriptor. */ |
---|
249 | txd = (struct r92c_tx_desc *)buf; |
---|
250 | txd->flags0 |= R92C_FLAGS0_LSG | R92C_FLAGS0_FSG; |
---|
251 | if (ismcast) |
---|
252 | txd->flags0 |= R92C_FLAGS0_BMCAST; |
---|
253 | |
---|
254 | if (!ismcast) { |
---|
255 | /* Unicast frame, check if an ACK is expected. */ |
---|
256 | if (!qos || (qos & IEEE80211_QOS_ACKPOLICY) != |
---|
257 | IEEE80211_QOS_ACKPOLICY_NOACK) { |
---|
258 | txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA); |
---|
259 | txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT, |
---|
260 | maxretry)); |
---|
261 | } |
---|
262 | |
---|
263 | struct rtwn_node *un = RTWN_NODE(ni); |
---|
264 | macid = un->id; |
---|
265 | |
---|
266 | if (type == IEEE80211_FC0_TYPE_DATA) { |
---|
267 | qsel = tid % RTWN_MAX_TID; |
---|
268 | |
---|
269 | rtwn_r92c_tx_enable_ampdu(sc, buf, |
---|
270 | (m->m_flags & M_AMPDU_MPDU) != 0); |
---|
271 | if (m->m_flags & M_AMPDU_MPDU) { |
---|
272 | txd->txdw2 |= htole32(SM(R92C_TXDW2_AMPDU_DEN, |
---|
273 | vap->iv_ampdu_density)); |
---|
274 | txd->txdw6 |= htole32(SM(R92C_TXDW6_MAX_AGG, |
---|
275 | 0x1f)); /* XXX */ |
---|
276 | } |
---|
277 | if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { |
---|
278 | txd->txdw2 |= htole32(R92C_TXDW2_CCX_RPT); |
---|
279 | sc->sc_tx_n_active++; |
---|
280 | #ifndef RTWN_WITHOUT_UCODE |
---|
281 | rs->rs_c2h_pending++; |
---|
282 | #endif |
---|
283 | } |
---|
284 | |
---|
285 | if (RTWN_RATE_IS_CCK(ridx) && ridx != RTWN_RIDX_CCK1 && |
---|
286 | (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) |
---|
287 | txd->txdw4 |= htole32(R92C_TXDW4_DATA_SHPRE); |
---|
288 | |
---|
289 | prot = IEEE80211_PROT_NONE; |
---|
290 | if (ridx >= RTWN_RIDX_MCS(0)) { |
---|
291 | r92c_tx_set_ht40(sc, txd, ni); |
---|
292 | r92c_tx_set_sgi(sc, txd, ni); |
---|
293 | prot = ic->ic_htprotmode; |
---|
294 | } else if (ic->ic_flags & IEEE80211_F_USEPROT) |
---|
295 | prot = ic->ic_protmode; |
---|
296 | |
---|
297 | /* XXX fix last comparison for A-MSDU (in net80211) */ |
---|
298 | /* XXX A-MPDU? */ |
---|
299 | if (m->m_pkthdr.len + IEEE80211_CRC_LEN > |
---|
300 | vap->iv_rtsthreshold && |
---|
301 | vap->iv_rtsthreshold != IEEE80211_RTS_MAX) |
---|
302 | prot = IEEE80211_PROT_RTSCTS; |
---|
303 | |
---|
304 | /* NB: checks for ht40 / short bits (set above). */ |
---|
305 | if (prot != IEEE80211_PROT_NONE) |
---|
306 | r92c_tx_protection(sc, txd, prot, ridx); |
---|
307 | } else /* IEEE80211_FC0_TYPE_MGT */ |
---|
308 | qsel = R92C_TXDW1_QSEL_MGNT; |
---|
309 | } else { |
---|
310 | macid = RTWN_MACID_BC; |
---|
311 | qsel = R92C_TXDW1_QSEL_MGNT; |
---|
312 | } |
---|
313 | |
---|
314 | txd->txdw1 |= htole32(SM(R92C_TXDW1_QSEL, qsel)); |
---|
315 | |
---|
316 | rtwn_r92c_tx_setup_macid(sc, txd, macid); |
---|
317 | txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, ridx)); |
---|
318 | /* Data rate fallback limit (max). */ |
---|
319 | txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE_FB_LMT, 0x1f)); |
---|
320 | txd->txdw4 |= htole32(SM(R92C_TXDW4_PORT_ID, uvp->id)); |
---|
321 | r92c_tx_raid(sc, txd, ni, ismcast); |
---|
322 | |
---|
323 | /* Force this rate if needed. */ |
---|
324 | if (sc->sc_ratectl != RTWN_RATECTL_FW) |
---|
325 | txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); |
---|
326 | |
---|
327 | if (!hasqos) { |
---|
328 | /* Use HW sequence numbering for non-QoS frames. */ |
---|
329 | rtwn_r92c_tx_setup_hwseq(sc, txd); |
---|
330 | txd->txdw4 |= htole32(SM(R92C_TXDW4_SEQ_SEL, uvp->id)); |
---|
331 | } else { |
---|
332 | uint16_t seqno; |
---|
333 | |
---|
334 | if (m->m_flags & M_AMPDU_MPDU) { |
---|
335 | seqno = ni->ni_txseqs[tid]; |
---|
336 | /* NB: clear Fragment Number field. */ |
---|
337 | *(uint16_t *)wh->i_seq = 0; |
---|
338 | ni->ni_txseqs[tid]++; |
---|
339 | } else |
---|
340 | seqno = M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE; |
---|
341 | |
---|
342 | /* Set sequence number. */ |
---|
343 | txd->txdseq = htole16(seqno); |
---|
344 | } |
---|
345 | } |
---|
346 | |
---|
347 | void |
---|
348 | r92c_fill_tx_desc_raw(struct rtwn_softc *sc, struct ieee80211_node *ni, |
---|
349 | struct mbuf *m, void *buf, const struct ieee80211_bpf_params *params) |
---|
350 | { |
---|
351 | struct ieee80211vap *vap = ni->ni_vap; |
---|
352 | struct rtwn_vap *uvp = RTWN_VAP(vap); |
---|
353 | struct ieee80211_frame *wh; |
---|
354 | struct r92c_tx_desc *txd; |
---|
355 | uint8_t ridx; |
---|
356 | int ismcast; |
---|
357 | |
---|
358 | /* XXX TODO: 11n checks, matching r92c_fill_tx_desc() */ |
---|
359 | |
---|
360 | wh = mtod(m, struct ieee80211_frame *); |
---|
361 | ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); |
---|
362 | ridx = rate2ridx(params->ibp_rate0); |
---|
363 | |
---|
364 | /* Fill Tx descriptor. */ |
---|
365 | txd = (struct r92c_tx_desc *)buf; |
---|
366 | txd->flags0 |= R92C_FLAGS0_LSG | R92C_FLAGS0_FSG; |
---|
367 | if (ismcast) |
---|
368 | txd->flags0 |= R92C_FLAGS0_BMCAST; |
---|
369 | |
---|
370 | if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) { |
---|
371 | txd->txdw5 |= htole32(R92C_TXDW5_RTY_LMT_ENA); |
---|
372 | txd->txdw5 |= htole32(SM(R92C_TXDW5_RTY_LMT, |
---|
373 | params->ibp_try0)); |
---|
374 | } |
---|
375 | if (params->ibp_flags & IEEE80211_BPF_RTS) |
---|
376 | r92c_tx_protection(sc, txd, IEEE80211_PROT_RTSCTS, ridx); |
---|
377 | if (params->ibp_flags & IEEE80211_BPF_CTS) |
---|
378 | r92c_tx_protection(sc, txd, IEEE80211_PROT_CTSONLY, ridx); |
---|
379 | |
---|
380 | rtwn_r92c_tx_setup_macid(sc, txd, RTWN_MACID_BC); |
---|
381 | txd->txdw1 |= htole32(SM(R92C_TXDW1_QSEL, R92C_TXDW1_QSEL_MGNT)); |
---|
382 | |
---|
383 | /* Set TX rate index. */ |
---|
384 | txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, ridx)); |
---|
385 | txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE_FB_LMT, 0x1f)); |
---|
386 | txd->txdw4 |= htole32(SM(R92C_TXDW4_PORT_ID, uvp->id)); |
---|
387 | txd->txdw4 |= htole32(R92C_TXDW4_DRVRATE); |
---|
388 | r92c_tx_raid(sc, txd, ni, ismcast); |
---|
389 | |
---|
390 | if (!IEEE80211_QOS_HAS_SEQ(wh)) { |
---|
391 | /* Use HW sequence numbering for non-QoS frames. */ |
---|
392 | rtwn_r92c_tx_setup_hwseq(sc, txd); |
---|
393 | txd->txdw4 |= htole32(SM(R92C_TXDW4_SEQ_SEL, uvp->id)); |
---|
394 | } else { |
---|
395 | /* Set sequence number. */ |
---|
396 | txd->txdseq |= htole16(M_SEQNO_GET(m) % IEEE80211_SEQ_RANGE); |
---|
397 | } |
---|
398 | } |
---|
399 | |
---|
400 | void |
---|
401 | r92c_fill_tx_desc_null(struct rtwn_softc *sc, void *buf, int is11b, |
---|
402 | int qos, int id) |
---|
403 | { |
---|
404 | struct r92c_tx_desc *txd = (struct r92c_tx_desc *)buf; |
---|
405 | |
---|
406 | txd->flags0 = R92C_FLAGS0_FSG | R92C_FLAGS0_LSG | R92C_FLAGS0_OWN; |
---|
407 | txd->txdw1 = htole32( |
---|
408 | SM(R92C_TXDW1_QSEL, R92C_TXDW1_QSEL_MGNT)); |
---|
409 | |
---|
410 | txd->txdw4 = htole32(R92C_TXDW4_DRVRATE); |
---|
411 | txd->txdw4 |= htole32(SM(R92C_TXDW4_PORT_ID, id)); |
---|
412 | if (is11b) { |
---|
413 | txd->txdw5 = htole32(SM(R92C_TXDW5_DATARATE, |
---|
414 | RTWN_RIDX_CCK1)); |
---|
415 | } else { |
---|
416 | txd->txdw5 = htole32(SM(R92C_TXDW5_DATARATE, |
---|
417 | RTWN_RIDX_OFDM6)); |
---|
418 | } |
---|
419 | |
---|
420 | if (!qos) { |
---|
421 | rtwn_r92c_tx_setup_hwseq(sc, txd); |
---|
422 | txd->txdw4 |= htole32(SM(R92C_TXDW4_SEQ_SEL, id)); |
---|
423 | } |
---|
424 | } |
---|
425 | |
---|
426 | uint8_t |
---|
427 | r92c_tx_radiotap_flags(const void *buf) |
---|
428 | { |
---|
429 | const struct r92c_tx_desc *txd = buf; |
---|
430 | uint8_t flags; |
---|
431 | |
---|
432 | flags = 0; |
---|
433 | if (txd->txdw4 & htole32(R92C_TXDW4_DATA_SHPRE)) |
---|
434 | flags |= IEEE80211_RADIOTAP_F_SHORTPRE; |
---|
435 | if (txd->txdw5 & htole32(R92C_TXDW5_SGI)) |
---|
436 | flags |= IEEE80211_RADIOTAP_F_SHORTGI; |
---|
437 | return (flags); |
---|
438 | } |
---|