agg-rx.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * HT handling
  4. *
  5. * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
  6. * Copyright 2002-2005, Instant802 Networks, Inc.
  7. * Copyright 2005-2006, Devicescape Software, Inc.
  8. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  9. * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  10. * Copyright 2007-2010, Intel Corporation
  11. * Copyright(c) 2015-2017 Intel Deutschland GmbH
  12. * Copyright (C) 2018-2021 Intel Corporation
  13. */
  14. /**
  15. * DOC: RX A-MPDU aggregation
  16. *
  17. * Aggregation on the RX side requires only implementing the
  18. * @ampdu_action callback that is invoked to start/stop any
  19. * block-ack sessions for RX aggregation.
  20. *
  21. * When RX aggregation is started by the peer, the driver is
  22. * notified via @ampdu_action function, with the
  23. * %IEEE80211_AMPDU_RX_START action, and may reject the request
  24. * in which case a negative response is sent to the peer, if it
  25. * accepts it a positive response is sent.
  26. *
  27. * While the session is active, the device/driver are required
  28. * to de-aggregate frames and pass them up one by one to mac80211,
  29. * which will handle the reorder buffer.
  30. *
  31. * When the aggregation session is stopped again by the peer or
  32. * ourselves, the driver's @ampdu_action function will be called
  33. * with the action %IEEE80211_AMPDU_RX_STOP. In this case, the
  34. * call must not fail.
  35. */
  36. #include <linux/ieee80211.h>
  37. #include <linux/slab.h>
  38. #include <linux/export.h>
  39. #include <net/mac80211.h>
  40. #include "ieee80211_i.h"
  41. #include "driver-ops.h"
  42. static void ieee80211_free_tid_rx(struct rcu_head *h)
  43. {
  44. struct tid_ampdu_rx *tid_rx =
  45. container_of(h, struct tid_ampdu_rx, rcu_head);
  46. int i;
  47. for (i = 0; i < tid_rx->buf_size; i++)
  48. __skb_queue_purge(&tid_rx->reorder_buf[i]);
  49. kfree(tid_rx->reorder_buf);
  50. kfree(tid_rx->reorder_time);
  51. kfree(tid_rx);
  52. }
  53. void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
  54. u16 initiator, u16 reason, bool tx)
  55. {
  56. struct ieee80211_local *local = sta->local;
  57. struct tid_ampdu_rx *tid_rx;
  58. struct ieee80211_ampdu_params params = {
  59. .sta = &sta->sta,
  60. .action = IEEE80211_AMPDU_RX_STOP,
  61. .tid = tid,
  62. .amsdu = false,
  63. .timeout = 0,
  64. .ssn = 0,
  65. };
  66. lockdep_assert_held(&sta->ampdu_mlme.mtx);
  67. tid_rx = rcu_dereference_protected(sta->ampdu_mlme.tid_rx[tid],
  68. lockdep_is_held(&sta->ampdu_mlme.mtx));
  69. if (!test_bit(tid, sta->ampdu_mlme.agg_session_valid))
  70. return;
  71. RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL);
  72. __clear_bit(tid, sta->ampdu_mlme.agg_session_valid);
  73. ht_dbg(sta->sdata,
  74. "Rx BA session stop requested for %pM tid %u %s reason: %d\n",
  75. sta->sta.addr, tid,
  76. initiator == WLAN_BACK_RECIPIENT ? "recipient" : "initiator",
  77. (int)reason);
  78. if (drv_ampdu_action(local, sta->sdata, &params))
  79. sdata_info(sta->sdata,
  80. "HW problem - can not stop rx aggregation for %pM tid %d\n",
  81. sta->sta.addr, tid);
  82. /* check if this is a self generated aggregation halt */
  83. if (initiator == WLAN_BACK_RECIPIENT && tx)
  84. ieee80211_send_delba(sta->sdata, sta->sta.addr,
  85. tid, WLAN_BACK_RECIPIENT, reason);
  86. /*
  87. * return here in case tid_rx is not assigned - which will happen if
  88. * IEEE80211_HW_SUPPORTS_REORDERING_BUFFER is set.
  89. */
  90. if (!tid_rx)
  91. return;
  92. del_timer_sync(&tid_rx->session_timer);
  93. /* make sure ieee80211_sta_reorder_release() doesn't re-arm the timer */
  94. spin_lock_bh(&tid_rx->reorder_lock);
  95. tid_rx->removed = true;
  96. spin_unlock_bh(&tid_rx->reorder_lock);
  97. del_timer_sync(&tid_rx->reorder_timer);
  98. call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx);
  99. }
  100. void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
  101. u16 initiator, u16 reason, bool tx)
  102. {
  103. mutex_lock(&sta->ampdu_mlme.mtx);
  104. ___ieee80211_stop_rx_ba_session(sta, tid, initiator, reason, tx);
  105. mutex_unlock(&sta->ampdu_mlme.mtx);
  106. }
  107. void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
  108. const u8 *addr)
  109. {
  110. struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  111. struct sta_info *sta;
  112. int i;
  113. rcu_read_lock();
  114. sta = sta_info_get_bss(sdata, addr);
  115. if (!sta) {
  116. rcu_read_unlock();
  117. return;
  118. }
  119. for (i = 0; i < IEEE80211_NUM_TIDS; i++)
  120. if (ba_rx_bitmap & BIT(i))
  121. set_bit(i, sta->ampdu_mlme.tid_rx_stop_requested);
  122. ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
  123. rcu_read_unlock();
  124. }
  125. EXPORT_SYMBOL(ieee80211_stop_rx_ba_session);
  126. /*
  127. * After accepting the AddBA Request we activated a timer,
  128. * resetting it after each frame that arrives from the originator.
  129. */
  130. static void sta_rx_agg_session_timer_expired(struct timer_list *t)
  131. {
  132. struct tid_ampdu_rx *tid_rx = from_timer(tid_rx, t, session_timer);
  133. struct sta_info *sta = tid_rx->sta;
  134. u8 tid = tid_rx->tid;
  135. unsigned long timeout;
  136. timeout = tid_rx->last_rx + TU_TO_JIFFIES(tid_rx->timeout);
  137. if (time_is_after_jiffies(timeout)) {
  138. mod_timer(&tid_rx->session_timer, timeout);
  139. return;
  140. }
  141. ht_dbg(sta->sdata, "RX session timer expired on %pM tid %d\n",
  142. sta->sta.addr, tid);
  143. set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired);
  144. ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
  145. }
  146. static void sta_rx_agg_reorder_timer_expired(struct timer_list *t)
  147. {
  148. struct tid_ampdu_rx *tid_rx = from_timer(tid_rx, t, reorder_timer);
  149. rcu_read_lock();
  150. ieee80211_release_reorder_timeout(tid_rx->sta, tid_rx->tid);
  151. rcu_read_unlock();
  152. }
  153. static void ieee80211_add_addbaext(struct ieee80211_sub_if_data *sdata,
  154. struct sk_buff *skb,
  155. const struct ieee80211_addba_ext_ie *req)
  156. {
  157. struct ieee80211_supported_band *sband;
  158. struct ieee80211_addba_ext_ie *resp;
  159. const struct ieee80211_sta_he_cap *he_cap;
  160. u8 frag_level, cap_frag_level;
  161. u8 *pos;
  162. sband = ieee80211_get_sband(sdata);
  163. if (!sband)
  164. return;
  165. he_cap = ieee80211_get_he_iftype_cap(sband,
  166. ieee80211_vif_type_p2p(&sdata->vif));
  167. if (!he_cap)
  168. return;
  169. pos = skb_put_zero(skb, 2 + sizeof(struct ieee80211_addba_ext_ie));
  170. *pos++ = WLAN_EID_ADDBA_EXT;
  171. *pos++ = sizeof(struct ieee80211_addba_ext_ie);
  172. resp = (struct ieee80211_addba_ext_ie *)pos;
  173. resp->data = req->data & IEEE80211_ADDBA_EXT_NO_FRAG;
  174. frag_level = u32_get_bits(req->data,
  175. IEEE80211_ADDBA_EXT_FRAG_LEVEL_MASK);
  176. cap_frag_level = u32_get_bits(he_cap->he_cap_elem.mac_cap_info[0],
  177. IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_MASK);
  178. if (frag_level > cap_frag_level)
  179. frag_level = cap_frag_level;
  180. resp->data |= u8_encode_bits(frag_level,
  181. IEEE80211_ADDBA_EXT_FRAG_LEVEL_MASK);
  182. }
  183. static void ieee80211_send_addba_resp(struct sta_info *sta, u8 *da, u16 tid,
  184. u8 dialog_token, u16 status, u16 policy,
  185. u16 buf_size, u16 timeout,
  186. const struct ieee80211_addba_ext_ie *addbaext)
  187. {
  188. struct ieee80211_sub_if_data *sdata = sta->sdata;
  189. struct ieee80211_local *local = sdata->local;
  190. struct sk_buff *skb;
  191. struct ieee80211_mgmt *mgmt;
  192. bool amsdu = ieee80211_hw_check(&local->hw, SUPPORTS_AMSDU_IN_AMPDU);
  193. u16 capab;
  194. skb = dev_alloc_skb(sizeof(*mgmt) +
  195. 2 + sizeof(struct ieee80211_addba_ext_ie) +
  196. local->hw.extra_tx_headroom);
  197. if (!skb)
  198. return;
  199. skb_reserve(skb, local->hw.extra_tx_headroom);
  200. mgmt = skb_put_zero(skb, 24);
  201. memcpy(mgmt->da, da, ETH_ALEN);
  202. memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
  203. if (sdata->vif.type == NL80211_IFTYPE_AP ||
  204. sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
  205. sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
  206. memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
  207. else if (sdata->vif.type == NL80211_IFTYPE_STATION)
  208. memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
  209. else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
  210. memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
  211. mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  212. IEEE80211_STYPE_ACTION);
  213. skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp));
  214. mgmt->u.action.category = WLAN_CATEGORY_BACK;
  215. mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP;
  216. mgmt->u.action.u.addba_resp.dialog_token = dialog_token;
  217. capab = (u16)(amsdu << 0); /* bit 0 A-MSDU support */
  218. capab |= (u16)(policy << 1); /* bit 1 aggregation policy */
  219. capab |= (u16)(tid << 2); /* bit 5:2 TID number */
  220. capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggregation */
  221. mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab);
  222. mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout);
  223. mgmt->u.action.u.addba_resp.status = cpu_to_le16(status);
  224. if (sta->sta.he_cap.has_he && addbaext)
  225. ieee80211_add_addbaext(sdata, skb, addbaext);
  226. ieee80211_tx_skb(sdata, skb);
  227. }
  228. void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
  229. u8 dialog_token, u16 timeout,
  230. u16 start_seq_num, u16 ba_policy, u16 tid,
  231. u16 buf_size, bool tx, bool auto_seq,
  232. const struct ieee80211_addba_ext_ie *addbaext)
  233. {
  234. struct ieee80211_local *local = sta->sdata->local;
  235. struct tid_ampdu_rx *tid_agg_rx;
  236. struct ieee80211_ampdu_params params = {
  237. .sta = &sta->sta,
  238. .action = IEEE80211_AMPDU_RX_START,
  239. .tid = tid,
  240. .amsdu = false,
  241. .timeout = timeout,
  242. .ssn = start_seq_num,
  243. };
  244. int i, ret = -EOPNOTSUPP;
  245. u16 status = WLAN_STATUS_REQUEST_DECLINED;
  246. u16 max_buf_size;
  247. if (tid >= IEEE80211_FIRST_TSPEC_TSID) {
  248. ht_dbg(sta->sdata,
  249. "STA %pM requests BA session on unsupported tid %d\n",
  250. sta->sta.addr, tid);
  251. goto end;
  252. }
  253. if (!sta->sta.ht_cap.ht_supported &&
  254. sta->sdata->vif.bss_conf.chandef.chan->band != NL80211_BAND_6GHZ) {
  255. ht_dbg(sta->sdata,
  256. "STA %pM erroneously requests BA session on tid %d w/o QoS\n",
  257. sta->sta.addr, tid);
  258. /* send a response anyway, it's an error case if we get here */
  259. goto end;
  260. }
  261. if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
  262. ht_dbg(sta->sdata,
  263. "Suspend in progress - Denying ADDBA request (%pM tid %d)\n",
  264. sta->sta.addr, tid);
  265. goto end;
  266. }
  267. if (sta->sta.he_cap.has_he)
  268. max_buf_size = IEEE80211_MAX_AMPDU_BUF;
  269. else
  270. max_buf_size = IEEE80211_MAX_AMPDU_BUF_HT;
  271. /* sanity check for incoming parameters:
  272. * check if configuration can support the BA policy
  273. * and if buffer size does not exceeds max value */
  274. /* XXX: check own ht delayed BA capability?? */
  275. if (((ba_policy != 1) &&
  276. (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) ||
  277. (buf_size > max_buf_size)) {
  278. status = WLAN_STATUS_INVALID_QOS_PARAM;
  279. ht_dbg_ratelimited(sta->sdata,
  280. "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n",
  281. sta->sta.addr, tid, ba_policy, buf_size);
  282. goto end;
  283. }
  284. /* determine default buffer size */
  285. if (buf_size == 0)
  286. buf_size = max_buf_size;
  287. /* make sure the size doesn't exceed the maximum supported by the hw */
  288. if (buf_size > sta->sta.max_rx_aggregation_subframes)
  289. buf_size = sta->sta.max_rx_aggregation_subframes;
  290. params.buf_size = buf_size;
  291. ht_dbg(sta->sdata, "AddBA Req buf_size=%d for %pM\n",
  292. buf_size, sta->sta.addr);
  293. /* examine state machine */
  294. lockdep_assert_held(&sta->ampdu_mlme.mtx);
  295. if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) {
  296. if (sta->ampdu_mlme.tid_rx_token[tid] == dialog_token) {
  297. struct tid_ampdu_rx *tid_rx;
  298. ht_dbg_ratelimited(sta->sdata,
  299. "updated AddBA Req from %pM on tid %u\n",
  300. sta->sta.addr, tid);
  301. /* We have no API to update the timeout value in the
  302. * driver so reject the timeout update if the timeout
  303. * changed. If it did not change, i.e., no real update,
  304. * just reply with success.
  305. */
  306. rcu_read_lock();
  307. tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
  308. if (tid_rx && tid_rx->timeout == timeout)
  309. status = WLAN_STATUS_SUCCESS;
  310. else
  311. status = WLAN_STATUS_REQUEST_DECLINED;
  312. rcu_read_unlock();
  313. goto end;
  314. }
  315. ht_dbg_ratelimited(sta->sdata,
  316. "unexpected AddBA Req from %pM on tid %u\n",
  317. sta->sta.addr, tid);
  318. /* delete existing Rx BA session on the same tid */
  319. ___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT,
  320. WLAN_STATUS_UNSPECIFIED_QOS,
  321. false);
  322. }
  323. if (ieee80211_hw_check(&local->hw, SUPPORTS_REORDERING_BUFFER)) {
  324. ret = drv_ampdu_action(local, sta->sdata, &params);
  325. ht_dbg(sta->sdata,
  326. "Rx A-MPDU request on %pM tid %d result %d\n",
  327. sta->sta.addr, tid, ret);
  328. if (!ret)
  329. status = WLAN_STATUS_SUCCESS;
  330. goto end;
  331. }
  332. /* prepare A-MPDU MLME for Rx aggregation */
  333. tid_agg_rx = kzalloc(sizeof(*tid_agg_rx), GFP_KERNEL);
  334. if (!tid_agg_rx)
  335. goto end;
  336. spin_lock_init(&tid_agg_rx->reorder_lock);
  337. /* rx timer */
  338. timer_setup(&tid_agg_rx->session_timer,
  339. sta_rx_agg_session_timer_expired, TIMER_DEFERRABLE);
  340. /* rx reorder timer */
  341. timer_setup(&tid_agg_rx->reorder_timer,
  342. sta_rx_agg_reorder_timer_expired, 0);
  343. /* prepare reordering buffer */
  344. tid_agg_rx->reorder_buf =
  345. kcalloc(buf_size, sizeof(struct sk_buff_head), GFP_KERNEL);
  346. tid_agg_rx->reorder_time =
  347. kcalloc(buf_size, sizeof(unsigned long), GFP_KERNEL);
  348. if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) {
  349. kfree(tid_agg_rx->reorder_buf);
  350. kfree(tid_agg_rx->reorder_time);
  351. kfree(tid_agg_rx);
  352. goto end;
  353. }
  354. for (i = 0; i < buf_size; i++)
  355. __skb_queue_head_init(&tid_agg_rx->reorder_buf[i]);
  356. ret = drv_ampdu_action(local, sta->sdata, &params);
  357. ht_dbg(sta->sdata, "Rx A-MPDU request on %pM tid %d result %d\n",
  358. sta->sta.addr, tid, ret);
  359. if (ret) {
  360. kfree(tid_agg_rx->reorder_buf);
  361. kfree(tid_agg_rx->reorder_time);
  362. kfree(tid_agg_rx);
  363. goto end;
  364. }
  365. /* update data */
  366. tid_agg_rx->ssn = start_seq_num;
  367. tid_agg_rx->head_seq_num = start_seq_num;
  368. tid_agg_rx->buf_size = buf_size;
  369. tid_agg_rx->timeout = timeout;
  370. tid_agg_rx->stored_mpdu_num = 0;
  371. tid_agg_rx->auto_seq = auto_seq;
  372. tid_agg_rx->started = false;
  373. tid_agg_rx->reorder_buf_filtered = 0;
  374. tid_agg_rx->tid = tid;
  375. tid_agg_rx->sta = sta;
  376. status = WLAN_STATUS_SUCCESS;
  377. /* activate it for RX */
  378. rcu_assign_pointer(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx);
  379. if (timeout) {
  380. mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout));
  381. tid_agg_rx->last_rx = jiffies;
  382. }
  383. end:
  384. if (status == WLAN_STATUS_SUCCESS) {
  385. __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
  386. __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
  387. sta->ampdu_mlme.tid_rx_token[tid] = dialog_token;
  388. }
  389. if (tx)
  390. ieee80211_send_addba_resp(sta, sta->sta.addr, tid,
  391. dialog_token, status, 1, buf_size,
  392. timeout, addbaext);
  393. }
  394. static void __ieee80211_start_rx_ba_session(struct sta_info *sta,
  395. u8 dialog_token, u16 timeout,
  396. u16 start_seq_num, u16 ba_policy,
  397. u16 tid, u16 buf_size, bool tx,
  398. bool auto_seq,
  399. const struct ieee80211_addba_ext_ie *addbaext)
  400. {
  401. mutex_lock(&sta->ampdu_mlme.mtx);
  402. ___ieee80211_start_rx_ba_session(sta, dialog_token, timeout,
  403. start_seq_num, ba_policy, tid,
  404. buf_size, tx, auto_seq, addbaext);
  405. mutex_unlock(&sta->ampdu_mlme.mtx);
  406. }
  407. void ieee80211_process_addba_request(struct ieee80211_local *local,
  408. struct sta_info *sta,
  409. struct ieee80211_mgmt *mgmt,
  410. size_t len)
  411. {
  412. u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num;
  413. struct ieee802_11_elems elems = { };
  414. u8 dialog_token;
  415. int ies_len;
  416. /* extract session parameters from addba request frame */
  417. dialog_token = mgmt->u.action.u.addba_req.dialog_token;
  418. timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout);
  419. start_seq_num =
  420. le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4;
  421. capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab);
  422. ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1;
  423. tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
  424. buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  425. ies_len = len - offsetof(struct ieee80211_mgmt,
  426. u.action.u.addba_req.variable);
  427. if (ies_len) {
  428. ieee802_11_parse_elems(mgmt->u.action.u.addba_req.variable,
  429. ies_len, true, &elems, mgmt->bssid, NULL);
  430. if (elems.parse_error)
  431. return;
  432. }
  433. __ieee80211_start_rx_ba_session(sta, dialog_token, timeout,
  434. start_seq_num, ba_policy, tid,
  435. buf_size, true, false,
  436. elems.addba_ext_ie);
  437. }
  438. void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif,
  439. const u8 *addr, unsigned int tid)
  440. {
  441. struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  442. struct ieee80211_local *local = sdata->local;
  443. struct sta_info *sta;
  444. rcu_read_lock();
  445. sta = sta_info_get_bss(sdata, addr);
  446. if (!sta)
  447. goto unlock;
  448. set_bit(tid, sta->ampdu_mlme.tid_rx_manage_offl);
  449. ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
  450. unlock:
  451. rcu_read_unlock();
  452. }
  453. EXPORT_SYMBOL(ieee80211_manage_rx_ba_offl);
  454. void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
  455. const u8 *addr, unsigned int tid)
  456. {
  457. struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  458. struct ieee80211_local *local = sdata->local;
  459. struct sta_info *sta;
  460. rcu_read_lock();
  461. sta = sta_info_get_bss(sdata, addr);
  462. if (!sta)
  463. goto unlock;
  464. set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired);
  465. ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work);
  466. unlock:
  467. rcu_read_unlock();
  468. }
  469. EXPORT_SYMBOL(ieee80211_rx_ba_timer_expired);