hostap_80211_tx.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. #include "hostap_80211.h"
  2. #include "hostap_common.h"
  3. #include "hostap_wlan.h"
  4. #include "hostap.h"
  5. #include "hostap_ap.h"
  6. /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
  7. /* Ethernet-II snap header (RFC1042 for most EtherTypes) */
  8. static unsigned char rfc1042_header[] =
  9. { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
  10. /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
  11. static unsigned char bridge_tunnel_header[] =
  12. { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
  13. /* No encapsulation header if EtherType < 0x600 (=length) */
  14. void hostap_dump_tx_80211(const char *name, struct sk_buff *skb)
  15. {
  16. struct ieee80211_hdr_4addr *hdr;
  17. u16 fc;
  18. hdr = (struct ieee80211_hdr_4addr *) skb->data;
  19. printk(KERN_DEBUG "%s: TX len=%d jiffies=%ld\n",
  20. name, skb->len, jiffies);
  21. if (skb->len < 2)
  22. return;
  23. fc = le16_to_cpu(hdr->frame_ctl);
  24. printk(KERN_DEBUG " FC=0x%04x (type=%d:%d)%s%s",
  25. fc, WLAN_FC_GET_TYPE(fc) >> 2, WLAN_FC_GET_STYPE(fc) >> 4,
  26. fc & IEEE80211_FCTL_TODS ? " [ToDS]" : "",
  27. fc & IEEE80211_FCTL_FROMDS ? " [FromDS]" : "");
  28. if (skb->len < IEEE80211_DATA_HDR3_LEN) {
  29. printk("\n");
  30. return;
  31. }
  32. printk(" dur=0x%04x seq=0x%04x\n", le16_to_cpu(hdr->duration_id),
  33. le16_to_cpu(hdr->seq_ctl));
  34. printk(KERN_DEBUG " A1=" MACSTR " A2=" MACSTR " A3=" MACSTR,
  35. MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), MAC2STR(hdr->addr3));
  36. if (skb->len >= 30)
  37. printk(" A4=" MACSTR, MAC2STR(hdr->addr4));
  38. printk("\n");
  39. }
  40. /* hard_start_xmit function for data interfaces (wlan#, wlan#wds#, wlan#sta)
  41. * Convert Ethernet header into a suitable IEEE 802.11 header depending on
  42. * device configuration. */
  43. int hostap_data_start_xmit(struct sk_buff *skb, struct net_device *dev)
  44. {
  45. struct hostap_interface *iface;
  46. local_info_t *local;
  47. int need_headroom, need_tailroom = 0;
  48. struct ieee80211_hdr_4addr hdr;
  49. u16 fc, ethertype = 0;
  50. enum {
  51. WDS_NO = 0, WDS_OWN_FRAME, WDS_COMPLIANT_FRAME
  52. } use_wds = WDS_NO;
  53. u8 *encaps_data;
  54. int hdr_len, encaps_len, skip_header_bytes;
  55. int to_assoc_ap = 0;
  56. struct hostap_skb_tx_data *meta;
  57. iface = netdev_priv(dev);
  58. local = iface->local;
  59. if (skb->len < ETH_HLEN) {
  60. printk(KERN_DEBUG "%s: hostap_data_start_xmit: short skb "
  61. "(len=%d)\n", dev->name, skb->len);
  62. kfree_skb(skb);
  63. return 0;
  64. }
  65. if (local->ddev != dev) {
  66. use_wds = (local->iw_mode == IW_MODE_MASTER &&
  67. !(local->wds_type & HOSTAP_WDS_STANDARD_FRAME)) ?
  68. WDS_OWN_FRAME : WDS_COMPLIANT_FRAME;
  69. if (dev == local->stadev) {
  70. to_assoc_ap = 1;
  71. use_wds = WDS_NO;
  72. } else if (dev == local->apdev) {
  73. printk(KERN_DEBUG "%s: prism2_tx: trying to use "
  74. "AP device with Ethernet net dev\n", dev->name);
  75. kfree_skb(skb);
  76. return 0;
  77. }
  78. } else {
  79. if (local->iw_mode == IW_MODE_REPEAT) {
  80. printk(KERN_DEBUG "%s: prism2_tx: trying to use "
  81. "non-WDS link in Repeater mode\n", dev->name);
  82. kfree_skb(skb);
  83. return 0;
  84. } else if (local->iw_mode == IW_MODE_INFRA &&
  85. (local->wds_type & HOSTAP_WDS_AP_CLIENT) &&
  86. memcmp(skb->data + ETH_ALEN, dev->dev_addr,
  87. ETH_ALEN) != 0) {
  88. /* AP client mode: send frames with foreign src addr
  89. * using 4-addr WDS frames */
  90. use_wds = WDS_COMPLIANT_FRAME;
  91. }
  92. }
  93. /* Incoming skb->data: dst_addr[6], src_addr[6], proto[2], payload
  94. * ==>
  95. * Prism2 TX frame with 802.11 header:
  96. * txdesc (address order depending on used mode; includes dst_addr and
  97. * src_addr), possible encapsulation (RFC1042/Bridge-Tunnel;
  98. * proto[2], payload {, possible addr4[6]} */
  99. ethertype = (skb->data[12] << 8) | skb->data[13];
  100. memset(&hdr, 0, sizeof(hdr));
  101. /* Length of data after IEEE 802.11 header */
  102. encaps_data = NULL;
  103. encaps_len = 0;
  104. skip_header_bytes = ETH_HLEN;
  105. if (ethertype == ETH_P_AARP || ethertype == ETH_P_IPX) {
  106. encaps_data = bridge_tunnel_header;
  107. encaps_len = sizeof(bridge_tunnel_header);
  108. skip_header_bytes -= 2;
  109. } else if (ethertype >= 0x600) {
  110. encaps_data = rfc1042_header;
  111. encaps_len = sizeof(rfc1042_header);
  112. skip_header_bytes -= 2;
  113. }
  114. fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA;
  115. hdr_len = IEEE80211_DATA_HDR3_LEN;
  116. if (use_wds != WDS_NO) {
  117. /* Note! Prism2 station firmware has problems with sending real
  118. * 802.11 frames with four addresses; until these problems can
  119. * be fixed or worked around, 4-addr frames needed for WDS are
  120. * using incompatible format: FromDS flag is not set and the
  121. * fourth address is added after the frame payload; it is
  122. * assumed, that the receiving station knows how to handle this
  123. * frame format */
  124. if (use_wds == WDS_COMPLIANT_FRAME) {
  125. fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS;
  126. /* From&To DS: Addr1 = RA, Addr2 = TA, Addr3 = DA,
  127. * Addr4 = SA */
  128. memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
  129. hdr_len += ETH_ALEN;
  130. } else {
  131. /* bogus 4-addr format to workaround Prism2 station
  132. * f/w bug */
  133. fc |= IEEE80211_FCTL_TODS;
  134. /* From DS: Addr1 = DA (used as RA),
  135. * Addr2 = BSSID (used as TA), Addr3 = SA (used as DA),
  136. */
  137. /* SA from skb->data + ETH_ALEN will be added after
  138. * frame payload; use hdr.addr4 as a temporary buffer
  139. */
  140. memcpy(&hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN);
  141. need_tailroom += ETH_ALEN;
  142. }
  143. /* send broadcast and multicast frames to broadcast RA, if
  144. * configured; otherwise, use unicast RA of the WDS link */
  145. if ((local->wds_type & HOSTAP_WDS_BROADCAST_RA) &&
  146. skb->data[0] & 0x01)
  147. memset(&hdr.addr1, 0xff, ETH_ALEN);
  148. else if (iface->type == HOSTAP_INTERFACE_WDS)
  149. memcpy(&hdr.addr1, iface->u.wds.remote_addr,
  150. ETH_ALEN);
  151. else
  152. memcpy(&hdr.addr1, local->bssid, ETH_ALEN);
  153. memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN);
  154. memcpy(&hdr.addr3, skb->data, ETH_ALEN);
  155. } else if (local->iw_mode == IW_MODE_MASTER && !to_assoc_ap) {
  156. fc |= IEEE80211_FCTL_FROMDS;
  157. /* From DS: Addr1 = DA, Addr2 = BSSID, Addr3 = SA */
  158. memcpy(&hdr.addr1, skb->data, ETH_ALEN);
  159. memcpy(&hdr.addr2, dev->dev_addr, ETH_ALEN);
  160. memcpy(&hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN);
  161. } else if (local->iw_mode == IW_MODE_INFRA || to_assoc_ap) {
  162. fc |= IEEE80211_FCTL_TODS;
  163. /* To DS: Addr1 = BSSID, Addr2 = SA, Addr3 = DA */
  164. memcpy(&hdr.addr1, to_assoc_ap ?
  165. local->assoc_ap_addr : local->bssid, ETH_ALEN);
  166. memcpy(&hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  167. memcpy(&hdr.addr3, skb->data, ETH_ALEN);
  168. } else if (local->iw_mode == IW_MODE_ADHOC) {
  169. /* not From/To DS: Addr1 = DA, Addr2 = SA, Addr3 = BSSID */
  170. memcpy(&hdr.addr1, skb->data, ETH_ALEN);
  171. memcpy(&hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  172. memcpy(&hdr.addr3, local->bssid, ETH_ALEN);
  173. }
  174. hdr.frame_ctl = cpu_to_le16(fc);
  175. skb_pull(skb, skip_header_bytes);
  176. need_headroom = local->func->need_tx_headroom + hdr_len + encaps_len;
  177. if (skb_tailroom(skb) < need_tailroom) {
  178. skb = skb_unshare(skb, GFP_ATOMIC);
  179. if (skb == NULL) {
  180. iface->stats.tx_dropped++;
  181. return 0;
  182. }
  183. if (pskb_expand_head(skb, need_headroom, need_tailroom,
  184. GFP_ATOMIC)) {
  185. kfree_skb(skb);
  186. iface->stats.tx_dropped++;
  187. return 0;
  188. }
  189. } else if (skb_headroom(skb) < need_headroom) {
  190. struct sk_buff *tmp = skb;
  191. skb = skb_realloc_headroom(skb, need_headroom);
  192. kfree_skb(tmp);
  193. if (skb == NULL) {
  194. iface->stats.tx_dropped++;
  195. return 0;
  196. }
  197. } else {
  198. skb = skb_unshare(skb, GFP_ATOMIC);
  199. if (skb == NULL) {
  200. iface->stats.tx_dropped++;
  201. return 0;
  202. }
  203. }
  204. if (encaps_data)
  205. memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len);
  206. memcpy(skb_push(skb, hdr_len), &hdr, hdr_len);
  207. if (use_wds == WDS_OWN_FRAME) {
  208. memcpy(skb_put(skb, ETH_ALEN), &hdr.addr4, ETH_ALEN);
  209. }
  210. iface->stats.tx_packets++;
  211. iface->stats.tx_bytes += skb->len;
  212. skb->mac.raw = skb->data;
  213. meta = (struct hostap_skb_tx_data *) skb->cb;
  214. memset(meta, 0, sizeof(*meta));
  215. meta->magic = HOSTAP_SKB_TX_DATA_MAGIC;
  216. if (use_wds)
  217. meta->flags |= HOSTAP_TX_FLAGS_WDS;
  218. meta->ethertype = ethertype;
  219. meta->iface = iface;
  220. /* Send IEEE 802.11 encapsulated frame using the master radio device */
  221. skb->dev = local->dev;
  222. dev_queue_xmit(skb);
  223. return 0;
  224. }
  225. /* hard_start_xmit function for hostapd wlan#ap interfaces */
  226. int hostap_mgmt_start_xmit(struct sk_buff *skb, struct net_device *dev)
  227. {
  228. struct hostap_interface *iface;
  229. local_info_t *local;
  230. struct hostap_skb_tx_data *meta;
  231. struct ieee80211_hdr_4addr *hdr;
  232. u16 fc;
  233. iface = netdev_priv(dev);
  234. local = iface->local;
  235. if (skb->len < 10) {
  236. printk(KERN_DEBUG "%s: hostap_mgmt_start_xmit: short skb "
  237. "(len=%d)\n", dev->name, skb->len);
  238. kfree_skb(skb);
  239. return 0;
  240. }
  241. iface->stats.tx_packets++;
  242. iface->stats.tx_bytes += skb->len;
  243. meta = (struct hostap_skb_tx_data *) skb->cb;
  244. memset(meta, 0, sizeof(*meta));
  245. meta->magic = HOSTAP_SKB_TX_DATA_MAGIC;
  246. meta->iface = iface;
  247. if (skb->len >= IEEE80211_DATA_HDR3_LEN + sizeof(rfc1042_header) + 2) {
  248. hdr = (struct ieee80211_hdr_4addr *) skb->data;
  249. fc = le16_to_cpu(hdr->frame_ctl);
  250. if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
  251. WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_DATA) {
  252. u8 *pos = &skb->data[IEEE80211_DATA_HDR3_LEN +
  253. sizeof(rfc1042_header)];
  254. meta->ethertype = (pos[0] << 8) | pos[1];
  255. }
  256. }
  257. /* Send IEEE 802.11 encapsulated frame using the master radio device */
  258. skb->dev = local->dev;
  259. dev_queue_xmit(skb);
  260. return 0;
  261. }
  262. /* Called only from software IRQ */
  263. static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
  264. struct ieee80211_crypt_data *crypt)
  265. {
  266. struct hostap_interface *iface;
  267. local_info_t *local;
  268. struct ieee80211_hdr_4addr *hdr;
  269. u16 fc;
  270. int hdr_len, res;
  271. iface = netdev_priv(skb->dev);
  272. local = iface->local;
  273. if (skb->len < IEEE80211_DATA_HDR3_LEN) {
  274. kfree_skb(skb);
  275. return NULL;
  276. }
  277. if (local->tkip_countermeasures &&
  278. strcmp(crypt->ops->name, "TKIP") == 0) {
  279. hdr = (struct ieee80211_hdr_4addr *) skb->data;
  280. if (net_ratelimit()) {
  281. printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
  282. "TX packet to " MACSTR "\n",
  283. local->dev->name, MAC2STR(hdr->addr1));
  284. }
  285. kfree_skb(skb);
  286. return NULL;
  287. }
  288. skb = skb_unshare(skb, GFP_ATOMIC);
  289. if (skb == NULL)
  290. return NULL;
  291. if ((skb_headroom(skb) < crypt->ops->extra_mpdu_prefix_len ||
  292. skb_tailroom(skb) < crypt->ops->extra_mpdu_postfix_len) &&
  293. pskb_expand_head(skb, crypt->ops->extra_mpdu_prefix_len,
  294. crypt->ops->extra_mpdu_postfix_len, GFP_ATOMIC)) {
  295. kfree_skb(skb);
  296. return NULL;
  297. }
  298. hdr = (struct ieee80211_hdr_4addr *) skb->data;
  299. fc = le16_to_cpu(hdr->frame_ctl);
  300. hdr_len = hostap_80211_get_hdrlen(fc);
  301. /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so
  302. * call both MSDU and MPDU encryption functions from here. */
  303. atomic_inc(&crypt->refcnt);
  304. res = 0;
  305. if (crypt->ops->encrypt_msdu)
  306. res = crypt->ops->encrypt_msdu(skb, hdr_len, crypt->priv);
  307. if (res == 0 && crypt->ops->encrypt_mpdu)
  308. res = crypt->ops->encrypt_mpdu(skb, hdr_len, crypt->priv);
  309. atomic_dec(&crypt->refcnt);
  310. if (res < 0) {
  311. kfree_skb(skb);
  312. return NULL;
  313. }
  314. return skb;
  315. }
  316. /* hard_start_xmit function for master radio interface wifi#.
  317. * AP processing (TX rate control, power save buffering, etc.).
  318. * Use hardware TX function to send the frame. */
  319. int hostap_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
  320. {
  321. struct hostap_interface *iface;
  322. local_info_t *local;
  323. int ret = 1;
  324. u16 fc;
  325. struct hostap_tx_data tx;
  326. ap_tx_ret tx_ret;
  327. struct hostap_skb_tx_data *meta;
  328. int no_encrypt = 0;
  329. struct ieee80211_hdr_4addr *hdr;
  330. iface = netdev_priv(dev);
  331. local = iface->local;
  332. tx.skb = skb;
  333. tx.sta_ptr = NULL;
  334. meta = (struct hostap_skb_tx_data *) skb->cb;
  335. if (meta->magic != HOSTAP_SKB_TX_DATA_MAGIC) {
  336. printk(KERN_DEBUG "%s: invalid skb->cb magic (0x%08x, "
  337. "expected 0x%08x)\n",
  338. dev->name, meta->magic, HOSTAP_SKB_TX_DATA_MAGIC);
  339. ret = 0;
  340. iface->stats.tx_dropped++;
  341. goto fail;
  342. }
  343. if (local->host_encrypt) {
  344. /* Set crypt to default algorithm and key; will be replaced in
  345. * AP code if STA has own alg/key */
  346. tx.crypt = local->crypt[local->tx_keyidx];
  347. tx.host_encrypt = 1;
  348. } else {
  349. tx.crypt = NULL;
  350. tx.host_encrypt = 0;
  351. }
  352. if (skb->len < 24) {
  353. printk(KERN_DEBUG "%s: hostap_master_start_xmit: short skb "
  354. "(len=%d)\n", dev->name, skb->len);
  355. ret = 0;
  356. iface->stats.tx_dropped++;
  357. goto fail;
  358. }
  359. /* FIX (?):
  360. * Wi-Fi 802.11b test plan suggests that AP should ignore power save
  361. * bit in authentication and (re)association frames and assume tha
  362. * STA remains awake for the response. */
  363. tx_ret = hostap_handle_sta_tx(local, &tx);
  364. skb = tx.skb;
  365. meta = (struct hostap_skb_tx_data *) skb->cb;
  366. hdr = (struct ieee80211_hdr_4addr *) skb->data;
  367. fc = le16_to_cpu(hdr->frame_ctl);
  368. switch (tx_ret) {
  369. case AP_TX_CONTINUE:
  370. break;
  371. case AP_TX_CONTINUE_NOT_AUTHORIZED:
  372. if (local->ieee_802_1x &&
  373. WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
  374. meta->ethertype != ETH_P_PAE &&
  375. !(meta->flags & HOSTAP_TX_FLAGS_WDS)) {
  376. printk(KERN_DEBUG "%s: dropped frame to unauthorized "
  377. "port (IEEE 802.1X): ethertype=0x%04x\n",
  378. dev->name, meta->ethertype);
  379. hostap_dump_tx_80211(dev->name, skb);
  380. ret = 0; /* drop packet */
  381. iface->stats.tx_dropped++;
  382. goto fail;
  383. }
  384. break;
  385. case AP_TX_DROP:
  386. ret = 0; /* drop packet */
  387. iface->stats.tx_dropped++;
  388. goto fail;
  389. case AP_TX_RETRY:
  390. goto fail;
  391. case AP_TX_BUFFERED:
  392. /* do not free skb here, it will be freed when the
  393. * buffered frame is sent/timed out */
  394. ret = 0;
  395. goto tx_exit;
  396. }
  397. /* Request TX callback if protocol version is 2 in 802.11 header;
  398. * this version 2 is a special case used between hostapd and kernel
  399. * driver */
  400. if (((fc & IEEE80211_FCTL_VERS) == BIT(1)) &&
  401. local->ap && local->ap->tx_callback_idx && meta->tx_cb_idx == 0) {
  402. meta->tx_cb_idx = local->ap->tx_callback_idx;
  403. /* remove special version from the frame header */
  404. fc &= ~IEEE80211_FCTL_VERS;
  405. hdr->frame_ctl = cpu_to_le16(fc);
  406. }
  407. if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_DATA) {
  408. no_encrypt = 1;
  409. tx.crypt = NULL;
  410. }
  411. if (local->ieee_802_1x && meta->ethertype == ETH_P_PAE && tx.crypt &&
  412. !(fc & IEEE80211_FCTL_PROTECTED)) {
  413. no_encrypt = 1;
  414. PDEBUG(DEBUG_EXTRA2, "%s: TX: IEEE 802.1X - passing "
  415. "unencrypted EAPOL frame\n", dev->name);
  416. tx.crypt = NULL; /* no encryption for IEEE 802.1X frames */
  417. }
  418. if (tx.crypt && (!tx.crypt->ops || !tx.crypt->ops->encrypt_mpdu))
  419. tx.crypt = NULL;
  420. else if ((tx.crypt || local->crypt[local->tx_keyidx]) && !no_encrypt) {
  421. /* Add ISWEP flag both for firmware and host based encryption
  422. */
  423. fc |= IEEE80211_FCTL_PROTECTED;
  424. hdr->frame_ctl = cpu_to_le16(fc);
  425. } else if (local->drop_unencrypted &&
  426. WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA &&
  427. meta->ethertype != ETH_P_PAE) {
  428. if (net_ratelimit()) {
  429. printk(KERN_DEBUG "%s: dropped unencrypted TX data "
  430. "frame (drop_unencrypted=1)\n", dev->name);
  431. }
  432. iface->stats.tx_dropped++;
  433. ret = 0;
  434. goto fail;
  435. }
  436. if (tx.crypt) {
  437. skb = hostap_tx_encrypt(skb, tx.crypt);
  438. if (skb == NULL) {
  439. printk(KERN_DEBUG "%s: TX - encryption failed\n",
  440. dev->name);
  441. ret = 0;
  442. goto fail;
  443. }
  444. meta = (struct hostap_skb_tx_data *) skb->cb;
  445. if (meta->magic != HOSTAP_SKB_TX_DATA_MAGIC) {
  446. printk(KERN_DEBUG "%s: invalid skb->cb magic (0x%08x, "
  447. "expected 0x%08x) after hostap_tx_encrypt\n",
  448. dev->name, meta->magic,
  449. HOSTAP_SKB_TX_DATA_MAGIC);
  450. ret = 0;
  451. iface->stats.tx_dropped++;
  452. goto fail;
  453. }
  454. }
  455. if (local->func->tx == NULL || local->func->tx(skb, dev)) {
  456. ret = 0;
  457. iface->stats.tx_dropped++;
  458. } else {
  459. ret = 0;
  460. iface->stats.tx_packets++;
  461. iface->stats.tx_bytes += skb->len;
  462. }
  463. fail:
  464. if (!ret && skb)
  465. dev_kfree_skb(skb);
  466. tx_exit:
  467. if (tx.sta_ptr)
  468. hostap_handle_sta_release(tx.sta_ptr);
  469. return ret;
  470. }
  471. EXPORT_SYMBOL(hostap_dump_tx_80211);
  472. EXPORT_SYMBOL(hostap_master_start_xmit);