300-pending_work.patch 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. --- a/drivers/net/wireless/ath/ath9k/common.h
  2. +++ b/drivers/net/wireless/ath/ath9k/common.h
  3. @@ -27,7 +27,7 @@
  4. #define WME_MAX_BA WME_BA_BMP_SIZE
  5. #define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
  6. -#define ATH_RSSI_DUMMY_MARKER 0x127
  7. +#define ATH_RSSI_DUMMY_MARKER 127
  8. #define ATH_RSSI_LPF_LEN 10
  9. #define RSSI_LPF_THRESHOLD -20
  10. #define ATH_RSSI_EP_MULTIPLIER (1<<7)
  11. --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
  12. +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
  13. @@ -1067,15 +1067,19 @@ static bool ath9k_rx_prepare(struct ath9
  14. last_rssi = priv->rx.last_rssi;
  15. - if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
  16. - rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi,
  17. - ATH_RSSI_EP_MULTIPLIER);
  18. + if (ieee80211_is_beacon(hdr->frame_control) &&
  19. + !is_zero_ether_addr(common->curbssid) &&
  20. + ether_addr_equal(hdr->addr3, common->curbssid)) {
  21. + s8 rssi = rxbuf->rxstatus.rs_rssi;
  22. - if (rxbuf->rxstatus.rs_rssi < 0)
  23. - rxbuf->rxstatus.rs_rssi = 0;
  24. + if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
  25. + rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
  26. - if (ieee80211_is_beacon(fc))
  27. - priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
  28. + if (rssi < 0)
  29. + rssi = 0;
  30. +
  31. + priv->ah->stats.avgbrssi = rssi;
  32. + }
  33. rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
  34. rx_status->band = hw->conf.channel->band;
  35. --- a/include/linux/ieee80211.h
  36. +++ b/include/linux/ieee80211.h
  37. @@ -185,7 +185,7 @@ struct ieee80211_hdr {
  38. u8 addr3[6];
  39. __le16 seq_ctrl;
  40. u8 addr4[6];
  41. -} __packed;
  42. +} __packed __aligned(2);
  43. struct ieee80211_hdr_3addr {
  44. __le16 frame_control;
  45. @@ -194,7 +194,7 @@ struct ieee80211_hdr_3addr {
  46. u8 addr2[6];
  47. u8 addr3[6];
  48. __le16 seq_ctrl;
  49. -} __packed;
  50. +} __packed __aligned(2);
  51. struct ieee80211_qos_hdr {
  52. __le16 frame_control;
  53. @@ -204,7 +204,7 @@ struct ieee80211_qos_hdr {
  54. u8 addr3[6];
  55. __le16 seq_ctrl;
  56. __le16 qos_ctrl;
  57. -} __packed;
  58. +} __packed __aligned(2);
  59. /**
  60. * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
  61. @@ -581,7 +581,7 @@ struct ieee80211s_hdr {
  62. __le32 seqnum;
  63. u8 eaddr1[6];
  64. u8 eaddr2[6];
  65. -} __packed;
  66. +} __packed __aligned(2);
  67. /* Mesh flags */
  68. #define MESH_FLAGS_AE_A4 0x1
  69. @@ -875,7 +875,7 @@ struct ieee80211_mgmt {
  70. } u;
  71. } __packed action;
  72. } u;
  73. -} __packed;
  74. +} __packed __aligned(2);
  75. /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
  76. #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
  77. @@ -906,20 +906,20 @@ struct ieee80211_rts {
  78. __le16 duration;
  79. u8 ra[6];
  80. u8 ta[6];
  81. -} __packed;
  82. +} __packed __aligned(2);
  83. struct ieee80211_cts {
  84. __le16 frame_control;
  85. __le16 duration;
  86. u8 ra[6];
  87. -} __packed;
  88. +} __packed __aligned(2);
  89. struct ieee80211_pspoll {
  90. __le16 frame_control;
  91. __le16 aid;
  92. u8 bssid[6];
  93. u8 ta[6];
  94. -} __packed;
  95. +} __packed __aligned(2);
  96. /* TDLS */
  97. --- a/net/mac80211/agg-rx.c
  98. +++ b/net/mac80211/agg-rx.c
  99. @@ -204,6 +204,8 @@ static void ieee80211_send_addba_resp(st
  100. memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
  101. else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
  102. memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
  103. + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
  104. + memcpy(mgmt->bssid, da, ETH_ALEN);
  105. mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
  106. IEEE80211_STYPE_ACTION);
  107. --- a/net/mac80211/agg-tx.c
  108. +++ b/net/mac80211/agg-tx.c
  109. @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
  110. memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
  111. if (sdata->vif.type == NL80211_IFTYPE_AP ||
  112. sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
  113. - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
  114. + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
  115. + sdata->vif.type == NL80211_IFTYPE_WDS)
  116. memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
  117. else if (sdata->vif.type == NL80211_IFTYPE_STATION)
  118. memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
  119. @@ -527,6 +528,7 @@ int ieee80211_start_tx_ba_session(struct
  120. sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  121. sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  122. sdata->vif.type != NL80211_IFTYPE_AP &&
  123. + sdata->vif.type != NL80211_IFTYPE_WDS &&
  124. sdata->vif.type != NL80211_IFTYPE_ADHOC)
  125. return -EINVAL;
  126. --- a/net/mac80211/debugfs_sta.c
  127. +++ b/net/mac80211/debugfs_sta.c
  128. @@ -65,11 +65,11 @@ static ssize_t sta_flags_read(struct fil
  129. test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
  130. int res = scnprintf(buf, sizeof(buf),
  131. - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  132. + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  133. TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
  134. TEST(PS_DRIVER), TEST(AUTHORIZED),
  135. TEST(SHORT_PREAMBLE),
  136. - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
  137. + TEST(WME), TEST(CLEAR_PS_FILT),
  138. TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
  139. TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
  140. TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
  141. --- a/net/mac80211/iface.c
  142. +++ b/net/mac80211/iface.c
  143. @@ -436,7 +436,6 @@ int ieee80211_do_open(struct wireless_de
  144. struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
  145. struct net_device *dev = wdev->netdev;
  146. struct ieee80211_local *local = sdata->local;
  147. - struct sta_info *sta;
  148. u32 changed = 0;
  149. int res;
  150. u32 hw_reconf_flags = 0;
  151. @@ -595,30 +594,8 @@ int ieee80211_do_open(struct wireless_de
  152. set_bit(SDATA_STATE_RUNNING, &sdata->state);
  153. - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
  154. - /* Create STA entry for the WDS peer */
  155. - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
  156. - GFP_KERNEL);
  157. - if (!sta) {
  158. - res = -ENOMEM;
  159. - goto err_del_interface;
  160. - }
  161. -
  162. - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
  163. - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
  164. - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  165. -
  166. - res = sta_info_insert(sta);
  167. - if (res) {
  168. - /* STA has been freed */
  169. - goto err_del_interface;
  170. - }
  171. -
  172. - rate_control_rate_init(sta);
  173. - netif_carrier_on(dev);
  174. - } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) {
  175. + if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
  176. rcu_assign_pointer(local->p2p_sdata, sdata);
  177. - }
  178. /*
  179. * set_multicast_list will be invoked by the networking core
  180. @@ -1022,6 +999,72 @@ static void ieee80211_if_setup(struct ne
  181. dev->destructor = free_netdev;
  182. }
  183. +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  184. + struct sk_buff *skb)
  185. +{
  186. + struct ieee80211_local *local = sdata->local;
  187. + struct ieee80211_rx_status *rx_status;
  188. + struct ieee802_11_elems elems;
  189. + struct ieee80211_mgmt *mgmt;
  190. + struct sta_info *sta;
  191. + size_t baselen;
  192. + u32 rates = 0;
  193. + u16 stype;
  194. + bool new = false;
  195. + enum ieee80211_band band = local->hw.conf.channel->band;
  196. + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
  197. +
  198. + rx_status = IEEE80211_SKB_RXCB(skb);
  199. + mgmt = (struct ieee80211_mgmt *) skb->data;
  200. + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
  201. +
  202. + if (stype != IEEE80211_STYPE_BEACON)
  203. + return;
  204. +
  205. + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
  206. + if (baselen > skb->len)
  207. + return;
  208. +
  209. + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
  210. + skb->len - baselen, &elems);
  211. +
  212. + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
  213. +
  214. + rcu_read_lock();
  215. +
  216. + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
  217. +
  218. + if (!sta) {
  219. + rcu_read_unlock();
  220. + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
  221. + GFP_KERNEL);
  222. + if (!sta)
  223. + return;
  224. +
  225. + new = true;
  226. + }
  227. +
  228. + sta->last_rx = jiffies;
  229. + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
  230. +
  231. + if (elems.ht_cap_elem)
  232. + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
  233. + elems.ht_cap_elem, sta);
  234. +
  235. + if (elems.wmm_param)
  236. + set_sta_flag(sta, WLAN_STA_WME);
  237. +
  238. + if (new) {
  239. + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
  240. + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
  241. + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  242. + rate_control_rate_init(sta);
  243. + sta_info_insert_rcu(sta);
  244. + }
  245. +
  246. + rcu_read_unlock();
  247. +}
  248. +
  249. static void ieee80211_iface_work(struct work_struct *work)
  250. {
  251. struct ieee80211_sub_if_data *sdata =
  252. @@ -1126,6 +1169,9 @@ static void ieee80211_iface_work(struct
  253. break;
  254. ieee80211_mesh_rx_queued_mgmt(sdata, skb);
  255. break;
  256. + case NL80211_IFTYPE_WDS:
  257. + ieee80211_wds_rx_queued_mgmt(sdata, skb);
  258. + break;
  259. default:
  260. WARN(1, "frame for unexpected interface type");
  261. break;
  262. --- a/net/mac80211/rx.c
  263. +++ b/net/mac80211/rx.c
  264. @@ -2365,6 +2365,7 @@ ieee80211_rx_h_action(struct ieee80211_r
  265. sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
  266. sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
  267. sdata->vif.type != NL80211_IFTYPE_AP &&
  268. + sdata->vif.type != NL80211_IFTYPE_WDS &&
  269. sdata->vif.type != NL80211_IFTYPE_ADHOC)
  270. break;
  271. @@ -2692,14 +2693,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
  272. if (!ieee80211_vif_is_mesh(&sdata->vif) &&
  273. sdata->vif.type != NL80211_IFTYPE_ADHOC &&
  274. - sdata->vif.type != NL80211_IFTYPE_STATION)
  275. + sdata->vif.type != NL80211_IFTYPE_STATION &&
  276. + sdata->vif.type != NL80211_IFTYPE_WDS)
  277. return RX_DROP_MONITOR;
  278. switch (stype) {
  279. case cpu_to_le16(IEEE80211_STYPE_AUTH):
  280. case cpu_to_le16(IEEE80211_STYPE_BEACON):
  281. case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
  282. - /* process for all: mesh, mlme, ibss */
  283. + /* process for all: mesh, mlme, ibss, wds */
  284. break;
  285. case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
  286. case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
  287. @@ -3028,10 +3030,16 @@ static int prepare_for_handlers(struct i
  288. }
  289. break;
  290. case NL80211_IFTYPE_WDS:
  291. - if (bssid || !ieee80211_is_data(hdr->frame_control))
  292. - return 0;
  293. if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
  294. return 0;
  295. +
  296. + if (ieee80211_is_data(hdr->frame_control) ||
  297. + ieee80211_is_action(hdr->frame_control)) {
  298. + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
  299. + return 0;
  300. + } else if (!ieee80211_is_beacon(hdr->frame_control))
  301. + return 0;
  302. +
  303. break;
  304. case NL80211_IFTYPE_P2P_DEVICE:
  305. if (!ieee80211_is_public_action(hdr, skb->len) &&
  306. --- a/net/mac80211/sta_info.h
  307. +++ b/net/mac80211/sta_info.h
  308. @@ -32,7 +32,6 @@
  309. * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
  310. * frames.
  311. * @WLAN_STA_WME: Station is a QoS-STA.
  312. - * @WLAN_STA_WDS: Station is one of our WDS peers.
  313. * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
  314. * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
  315. * frame to this station is transmitted.
  316. @@ -66,7 +65,6 @@ enum ieee80211_sta_info_flags {
  317. WLAN_STA_AUTHORIZED,
  318. WLAN_STA_SHORT_PREAMBLE,
  319. WLAN_STA_WME,
  320. - WLAN_STA_WDS,
  321. WLAN_STA_CLEAR_PS_FILT,
  322. WLAN_STA_MFP,
  323. WLAN_STA_BLOCK_BA,
  324. --- a/net/mac80211/tx.c
  325. +++ b/net/mac80211/tx.c
  326. @@ -1848,9 +1848,24 @@ netdev_tx_t ieee80211_subif_start_xmit(s
  327. }
  328. if (!is_multicast_ether_addr(skb->data)) {
  329. + struct sta_info *next_hop;
  330. + bool mpp_lookup = true;
  331. +
  332. mpath = mesh_path_lookup(sdata, skb->data);
  333. - if (!mpath)
  334. + if (mpath) {
  335. + mpp_lookup = false;
  336. + next_hop = rcu_dereference(mpath->next_hop);
  337. + if (!next_hop ||
  338. + !(mpath->flags & (MESH_PATH_ACTIVE |
  339. + MESH_PATH_RESOLVING)))
  340. + mpp_lookup = true;
  341. + }
  342. +
  343. + if (mpp_lookup)
  344. mppath = mpp_path_lookup(sdata, skb->data);
  345. +
  346. + if (mppath && mpath)
  347. + mesh_path_del(mpath->sdata, mpath->dst);
  348. }
  349. /*
  350. --- a/net/wireless/nl80211.c
  351. +++ b/net/wireless/nl80211.c
  352. @@ -554,16 +554,9 @@ static int nl80211_msg_put_channel(struc
  353. if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
  354. nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IBSS))
  355. goto nla_put_failure;
  356. - if (chan->flags & IEEE80211_CHAN_RADAR) {
  357. - u32 time = elapsed_jiffies_msecs(chan->dfs_state_entered);
  358. - if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
  359. - goto nla_put_failure;
  360. - if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_STATE,
  361. - chan->dfs_state))
  362. - goto nla_put_failure;
  363. - if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_TIME, time))
  364. - goto nla_put_failure;
  365. - }
  366. + if ((chan->flags & IEEE80211_CHAN_RADAR) &&
  367. + nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
  368. + goto nla_put_failure;
  369. if ((chan->flags & IEEE80211_CHAN_NO_HT40MINUS) &&
  370. nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS))
  371. goto nla_put_failure;
  372. @@ -900,9 +893,6 @@ static int nl80211_put_iface_combination
  373. nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM,
  374. c->max_interfaces))
  375. goto nla_put_failure;
  376. - if (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
  377. - c->radar_detect_widths))
  378. - goto nla_put_failure;
  379. nla_nest_end(msg, nl_combi);
  380. }
  381. @@ -914,48 +904,6 @@ nla_put_failure:
  382. return -ENOBUFS;
  383. }
  384. -#ifdef CONFIG_PM
  385. -static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev,
  386. - struct sk_buff *msg)
  387. -{
  388. - const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan.tcp;
  389. - struct nlattr *nl_tcp;
  390. -
  391. - if (!tcp)
  392. - return 0;
  393. -
  394. - nl_tcp = nla_nest_start(msg, NL80211_WOWLAN_TRIG_TCP_CONNECTION);
  395. - if (!nl_tcp)
  396. - return -ENOBUFS;
  397. -
  398. - if (nla_put_u32(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD,
  399. - tcp->data_payload_max))
  400. - return -ENOBUFS;
  401. -
  402. - if (nla_put_u32(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD,
  403. - tcp->data_payload_max))
  404. - return -ENOBUFS;
  405. -
  406. - if (tcp->seq && nla_put_flag(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ))
  407. - return -ENOBUFS;
  408. -
  409. - if (tcp->tok && nla_put(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
  410. - sizeof(*tcp->tok), tcp->tok))
  411. - return -ENOBUFS;
  412. -
  413. - if (nla_put_u32(msg, NL80211_WOWLAN_TCP_DATA_INTERVAL,
  414. - tcp->data_interval_max))
  415. - return -ENOBUFS;
  416. -
  417. - if (nla_put_u32(msg, NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
  418. - tcp->wake_payload_max))
  419. - return -ENOBUFS;
  420. -
  421. - nla_nest_end(msg, nl_tcp);
  422. - return 0;
  423. -}
  424. -#endif
  425. -
  426. static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flags,
  427. struct cfg80211_registered_device *dev)
  428. {
  429. @@ -1330,9 +1278,6 @@ static int nl80211_send_wiphy(struct sk_
  430. goto nla_put_failure;
  431. }
  432. - if (nl80211_send_wowlan_tcp_caps(dev, msg))
  433. - goto nla_put_failure;
  434. -
  435. nla_nest_end(msg, nl_wowlan);
  436. }
  437. #endif