tx.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. /*
  2. * Intel Wireless Multicomm 3200 WiFi driver
  3. *
  4. * Copyright (C) 2009 Intel Corporation. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in
  14. * the documentation and/or other materials provided with the
  15. * distribution.
  16. * * Neither the name of Intel Corporation nor the names of its
  17. * contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. *
  33. * Intel Corporation <ilw@linux.intel.com>
  34. * Samuel Ortiz <samuel.ortiz@intel.com>
  35. * Zhu Yi <yi.zhu@intel.com>
  36. *
  37. */
  38. /*
  39. * iwm Tx theory of operation:
  40. *
  41. * 1) We receive a 802.3 frame from the stack
  42. * 2) We convert it to a 802.11 frame [iwm_xmit_frame]
  43. * 3) We queue it to its corresponding tx queue [iwm_xmit_frame]
  44. * 4) We schedule the tx worker. There is one worker per tx
  45. * queue. [iwm_xmit_frame]
  46. * 5) The tx worker is scheduled
  47. * 6) We go through every queued skb on the tx queue, and for each
  48. * and every one of them: [iwm_tx_worker]
  49. * a) We check if we have enough Tx credits (see below for a Tx
  50. * credits description) for the frame length. [iwm_tx_worker]
  51. * b) If we do, we aggregate the Tx frame into a UDMA one, by
  52. * concatenating one REPLY_TX command per Tx frame. [iwm_tx_worker]
  53. * c) When we run out of credits, or when we reach the maximum
  54. * concatenation size, we actually send the concatenated UDMA
  55. * frame. [iwm_tx_worker]
  56. *
  57. * When we run out of Tx credits, the skbs are filling the tx queue,
  58. * and eventually we will stop the netdev queue. [iwm_tx_worker]
  59. * The tx queue is emptied as we're getting new tx credits, by
  60. * scheduling the tx_worker. [iwm_tx_credit_inc]
  61. * The netdev queue is started again when we have enough tx credits,
  62. * and when our tx queue has some reasonable amout of space available
  63. * (i.e. half of the max size). [iwm_tx_worker]
  64. */
  65. #include <linux/slab.h>
  66. #include <linux/skbuff.h>
  67. #include <linux/netdevice.h>
  68. #include <linux/ieee80211.h>
  69. #include "iwm.h"
  70. #include "debug.h"
  71. #include "commands.h"
  72. #include "hal.h"
  73. #include "umac.h"
  74. #include "bus.h"
  75. #define IWM_UMAC_PAGE_ALLOC_WRAP 0xffff
  76. #define BYTES_TO_PAGES(n) (1 + ((n) >> ilog2(IWM_UMAC_PAGE_SIZE)) - \
  77. (((n) & (IWM_UMAC_PAGE_SIZE - 1)) == 0))
  78. #define pool_id_to_queue(id) ((id < IWM_TX_CMD_QUEUE) ? id : id - 1)
  79. #define queue_to_pool_id(q) ((q < IWM_TX_CMD_QUEUE) ? q : q + 1)
  80. /* require to hold tx_credit lock */
  81. static int iwm_tx_credit_get(struct iwm_tx_credit *tx_credit, int id)
  82. {
  83. struct pool_entry *pool = &tx_credit->pools[id];
  84. struct spool_entry *spool = &tx_credit->spools[pool->sid];
  85. int spool_pages;
  86. /* number of pages can be taken from spool by this pool */
  87. spool_pages = spool->max_pages - spool->alloc_pages +
  88. max(pool->min_pages - pool->alloc_pages, 0);
  89. return min(pool->max_pages - pool->alloc_pages, spool_pages);
  90. }
  91. static bool iwm_tx_credit_ok(struct iwm_priv *iwm, int id, int nb)
  92. {
  93. u32 npages = BYTES_TO_PAGES(nb);
  94. if (npages <= iwm_tx_credit_get(&iwm->tx_credit, id))
  95. return 1;
  96. set_bit(id, &iwm->tx_credit.full_pools_map);
  97. IWM_DBG_TX(iwm, DBG, "LINK: stop txq[%d], available credit: %d\n",
  98. pool_id_to_queue(id),
  99. iwm_tx_credit_get(&iwm->tx_credit, id));
  100. return 0;
  101. }
  102. void iwm_tx_credit_inc(struct iwm_priv *iwm, int id, int total_freed_pages)
  103. {
  104. struct pool_entry *pool;
  105. struct spool_entry *spool;
  106. int freed_pages;
  107. int queue;
  108. BUG_ON(id >= IWM_MACS_OUT_GROUPS);
  109. pool = &iwm->tx_credit.pools[id];
  110. spool = &iwm->tx_credit.spools[pool->sid];
  111. freed_pages = total_freed_pages - pool->total_freed_pages;
  112. IWM_DBG_TX(iwm, DBG, "Free %d pages for pool[%d]\n", freed_pages, id);
  113. if (!freed_pages) {
  114. IWM_DBG_TX(iwm, DBG, "No pages are freed by UMAC\n");
  115. return;
  116. } else if (freed_pages < 0)
  117. freed_pages += IWM_UMAC_PAGE_ALLOC_WRAP + 1;
  118. if (pool->alloc_pages > pool->min_pages) {
  119. int spool_pages = pool->alloc_pages - pool->min_pages;
  120. spool_pages = min(spool_pages, freed_pages);
  121. spool->alloc_pages -= spool_pages;
  122. }
  123. pool->alloc_pages -= freed_pages;
  124. pool->total_freed_pages = total_freed_pages;
  125. IWM_DBG_TX(iwm, DBG, "Pool[%d] pages alloc: %d, total_freed: %d, "
  126. "Spool[%d] pages alloc: %d\n", id, pool->alloc_pages,
  127. pool->total_freed_pages, pool->sid, spool->alloc_pages);
  128. if (test_bit(id, &iwm->tx_credit.full_pools_map) &&
  129. (pool->alloc_pages < pool->max_pages / 2)) {
  130. clear_bit(id, &iwm->tx_credit.full_pools_map);
  131. queue = pool_id_to_queue(id);
  132. IWM_DBG_TX(iwm, DBG, "LINK: start txq[%d], available "
  133. "credit: %d\n", queue,
  134. iwm_tx_credit_get(&iwm->tx_credit, id));
  135. queue_work(iwm->txq[queue].wq, &iwm->txq[queue].worker);
  136. }
  137. }
  138. static void iwm_tx_credit_dec(struct iwm_priv *iwm, int id, int alloc_pages)
  139. {
  140. struct pool_entry *pool;
  141. struct spool_entry *spool;
  142. int spool_pages;
  143. IWM_DBG_TX(iwm, DBG, "Allocate %d pages for pool[%d]\n",
  144. alloc_pages, id);
  145. BUG_ON(id >= IWM_MACS_OUT_GROUPS);
  146. pool = &iwm->tx_credit.pools[id];
  147. spool = &iwm->tx_credit.spools[pool->sid];
  148. spool_pages = pool->alloc_pages + alloc_pages - pool->min_pages;
  149. if (pool->alloc_pages >= pool->min_pages)
  150. spool->alloc_pages += alloc_pages;
  151. else if (spool_pages > 0)
  152. spool->alloc_pages += spool_pages;
  153. pool->alloc_pages += alloc_pages;
  154. IWM_DBG_TX(iwm, DBG, "Pool[%d] pages alloc: %d, total_freed: %d, "
  155. "Spool[%d] pages alloc: %d\n", id, pool->alloc_pages,
  156. pool->total_freed_pages, pool->sid, spool->alloc_pages);
  157. }
  158. int iwm_tx_credit_alloc(struct iwm_priv *iwm, int id, int nb)
  159. {
  160. u32 npages = BYTES_TO_PAGES(nb);
  161. int ret = 0;
  162. spin_lock(&iwm->tx_credit.lock);
  163. if (!iwm_tx_credit_ok(iwm, id, nb)) {
  164. IWM_DBG_TX(iwm, DBG, "No credit available for pool[%d]\n", id);
  165. ret = -ENOSPC;
  166. goto out;
  167. }
  168. iwm_tx_credit_dec(iwm, id, npages);
  169. out:
  170. spin_unlock(&iwm->tx_credit.lock);
  171. return ret;
  172. }
  173. /*
  174. * Since we're on an SDIO or USB bus, we are not sharing memory
  175. * for storing to be transmitted frames. The host needs to push
  176. * them upstream. As a consequence there needs to be a way for
  177. * the target to let us know if it can actually take more TX frames
  178. * or not. This is what Tx credits are for.
  179. *
  180. * For each Tx HW queue, we have a Tx pool, and then we have one
  181. * unique super pool (spool), which is actually a global pool of
  182. * all the UMAC pages.
  183. * For each Tx pool we have a min_pages, a max_pages fields, and a
  184. * alloc_pages fields. The alloc_pages tracks the number of pages
  185. * currently allocated from the tx pool.
  186. * Here are the rules to check if given a tx frame we have enough
  187. * tx credits for it:
  188. * 1) We translate the frame length into a number of UMAC pages.
  189. * Let's call them n_pages.
  190. * 2) For the corresponding tx pool, we check if n_pages +
  191. * pool->alloc_pages is higher than pool->min_pages. min_pages
  192. * represent a set of pre-allocated pages on the tx pool. If
  193. * that's the case, then we need to allocate those pages from
  194. * the spool. We can do so until we reach spool->max_pages.
  195. * 3) Each tx pool is not allowed to allocate more than pool->max_pages
  196. * from the spool, so once we're over min_pages, we can allocate
  197. * pages from the spool, but not more than max_pages.
  198. *
  199. * When the tx code path needs to send a tx frame, it checks first
  200. * if it has enough tx credits, following those rules. [iwm_tx_credit_get]
  201. * If it does, it then updates the pool and spool counters and
  202. * then send the frame. [iwm_tx_credit_alloc and iwm_tx_credit_dec]
  203. * On the other side, when the UMAC is done transmitting frames, it
  204. * will send a credit update notification to the host. This is when
  205. * the pool and spool counters gets to be decreased. [iwm_tx_credit_inc,
  206. * called from rx.c:iwm_ntf_tx_credit_update]
  207. *
  208. */
  209. void iwm_tx_credit_init_pools(struct iwm_priv *iwm,
  210. struct iwm_umac_notif_alive *alive)
  211. {
  212. int i, sid, pool_pages;
  213. spin_lock(&iwm->tx_credit.lock);
  214. iwm->tx_credit.pool_nr = le16_to_cpu(alive->page_grp_count);
  215. iwm->tx_credit.full_pools_map = 0;
  216. memset(&iwm->tx_credit.spools[0], 0, sizeof(struct spool_entry));
  217. IWM_DBG_TX(iwm, DBG, "Pools number is %d\n", iwm->tx_credit.pool_nr);
  218. for (i = 0; i < iwm->tx_credit.pool_nr; i++) {
  219. __le32 page_grp_state = alive->page_grp_state[i];
  220. iwm->tx_credit.pools[i].id = GET_VAL32(page_grp_state,
  221. UMAC_ALIVE_PAGE_STS_GRP_NUM);
  222. iwm->tx_credit.pools[i].sid = GET_VAL32(page_grp_state,
  223. UMAC_ALIVE_PAGE_STS_SGRP_NUM);
  224. iwm->tx_credit.pools[i].min_pages = GET_VAL32(page_grp_state,
  225. UMAC_ALIVE_PAGE_STS_GRP_MIN_SIZE);
  226. iwm->tx_credit.pools[i].max_pages = GET_VAL32(page_grp_state,
  227. UMAC_ALIVE_PAGE_STS_GRP_MAX_SIZE);
  228. iwm->tx_credit.pools[i].alloc_pages = 0;
  229. iwm->tx_credit.pools[i].total_freed_pages = 0;
  230. sid = iwm->tx_credit.pools[i].sid;
  231. pool_pages = iwm->tx_credit.pools[i].min_pages;
  232. if (iwm->tx_credit.spools[sid].max_pages == 0) {
  233. iwm->tx_credit.spools[sid].id = sid;
  234. iwm->tx_credit.spools[sid].max_pages =
  235. GET_VAL32(page_grp_state,
  236. UMAC_ALIVE_PAGE_STS_SGRP_MAX_SIZE);
  237. iwm->tx_credit.spools[sid].alloc_pages = 0;
  238. }
  239. iwm->tx_credit.spools[sid].alloc_pages += pool_pages;
  240. IWM_DBG_TX(iwm, DBG, "Pool idx: %d, id: %d, sid: %d, capacity "
  241. "min: %d, max: %d, pool alloc: %d, total_free: %d, "
  242. "super poll alloc: %d\n",
  243. i, iwm->tx_credit.pools[i].id,
  244. iwm->tx_credit.pools[i].sid,
  245. iwm->tx_credit.pools[i].min_pages,
  246. iwm->tx_credit.pools[i].max_pages,
  247. iwm->tx_credit.pools[i].alloc_pages,
  248. iwm->tx_credit.pools[i].total_freed_pages,
  249. iwm->tx_credit.spools[sid].alloc_pages);
  250. }
  251. spin_unlock(&iwm->tx_credit.lock);
  252. }
  253. #define IWM_UDMA_HDR_LEN sizeof(struct iwm_umac_wifi_out_hdr)
  254. static __le16 iwm_tx_build_packet(struct iwm_priv *iwm, struct sk_buff *skb,
  255. int pool_id, u8 *buf)
  256. {
  257. struct iwm_umac_wifi_out_hdr *hdr = (struct iwm_umac_wifi_out_hdr *)buf;
  258. struct iwm_udma_wifi_cmd udma_cmd;
  259. struct iwm_umac_cmd umac_cmd;
  260. struct iwm_tx_info *tx_info = skb_to_tx_info(skb);
  261. udma_cmd.count = cpu_to_le16(skb->len +
  262. sizeof(struct iwm_umac_fw_cmd_hdr));
  263. /* set EOP to 0 here. iwm_udma_wifi_hdr_set_eop() will be
  264. * called later to set EOP for the last packet. */
  265. udma_cmd.eop = 0;
  266. udma_cmd.credit_group = pool_id;
  267. udma_cmd.ra_tid = tx_info->sta << 4 | tx_info->tid;
  268. udma_cmd.lmac_offset = 0;
  269. umac_cmd.id = REPLY_TX;
  270. umac_cmd.count = cpu_to_le16(skb->len);
  271. umac_cmd.color = tx_info->color;
  272. umac_cmd.resp = 0;
  273. umac_cmd.seq_num = cpu_to_le16(iwm_alloc_wifi_cmd_seq(iwm));
  274. iwm_build_udma_wifi_hdr(iwm, &hdr->hw_hdr, &udma_cmd);
  275. iwm_build_umac_hdr(iwm, &hdr->sw_hdr, &umac_cmd);
  276. memcpy(buf + sizeof(*hdr), skb->data, skb->len);
  277. return umac_cmd.seq_num;
  278. }
  279. static int iwm_tx_send_concat_packets(struct iwm_priv *iwm,
  280. struct iwm_tx_queue *txq)
  281. {
  282. int ret;
  283. if (!txq->concat_count)
  284. return 0;
  285. IWM_DBG_TX(iwm, DBG, "Send concatenated Tx: queue %d, %d bytes\n",
  286. txq->id, txq->concat_count);
  287. /* mark EOP for the last packet */
  288. iwm_udma_wifi_hdr_set_eop(iwm, txq->concat_ptr, 1);
  289. trace_iwm_tx_packets(iwm, txq->concat_buf, txq->concat_count);
  290. ret = iwm_bus_send_chunk(iwm, txq->concat_buf, txq->concat_count);
  291. txq->concat_count = 0;
  292. txq->concat_ptr = txq->concat_buf;
  293. return ret;
  294. }
  295. void iwm_tx_worker(struct work_struct *work)
  296. {
  297. struct iwm_priv *iwm;
  298. struct iwm_tx_info *tx_info = NULL;
  299. struct sk_buff *skb;
  300. struct iwm_tx_queue *txq;
  301. struct iwm_sta_info *sta_info;
  302. struct iwm_tid_info *tid_info;
  303. int cmdlen, ret, pool_id;
  304. txq = container_of(work, struct iwm_tx_queue, worker);
  305. iwm = container_of(txq, struct iwm_priv, txq[txq->id]);
  306. pool_id = queue_to_pool_id(txq->id);
  307. while (!test_bit(pool_id, &iwm->tx_credit.full_pools_map) &&
  308. !skb_queue_empty(&txq->queue)) {
  309. spin_lock_bh(&txq->lock);
  310. skb = skb_dequeue(&txq->queue);
  311. spin_unlock_bh(&txq->lock);
  312. tx_info = skb_to_tx_info(skb);
  313. sta_info = &iwm->sta_table[tx_info->sta];
  314. if (!sta_info->valid) {
  315. IWM_ERR(iwm, "Trying to send a frame to unknown STA\n");
  316. kfree_skb(skb);
  317. continue;
  318. }
  319. tid_info = &sta_info->tid_info[tx_info->tid];
  320. mutex_lock(&tid_info->mutex);
  321. /*
  322. * If the RAxTID is stopped, we queue the skb to the stopped
  323. * queue.
  324. * Whenever we'll get a UMAC notification to resume the tx flow
  325. * for this RAxTID, we'll merge back the stopped queue into the
  326. * regular queue. See iwm_ntf_stop_resume_tx() from rx.c.
  327. */
  328. if (tid_info->stopped) {
  329. IWM_DBG_TX(iwm, DBG, "%dx%d stopped\n",
  330. tx_info->sta, tx_info->tid);
  331. spin_lock_bh(&txq->lock);
  332. skb_queue_tail(&txq->stopped_queue, skb);
  333. spin_unlock_bh(&txq->lock);
  334. mutex_unlock(&tid_info->mutex);
  335. continue;
  336. }
  337. cmdlen = IWM_UDMA_HDR_LEN + skb->len;
  338. IWM_DBG_TX(iwm, DBG, "Tx frame on queue %d: skb: 0x%p, sta: "
  339. "%d, color: %d\n", txq->id, skb, tx_info->sta,
  340. tx_info->color);
  341. if (txq->concat_count + cmdlen > IWM_HAL_CONCATENATE_BUF_SIZE)
  342. iwm_tx_send_concat_packets(iwm, txq);
  343. ret = iwm_tx_credit_alloc(iwm, pool_id, cmdlen);
  344. if (ret) {
  345. IWM_DBG_TX(iwm, DBG, "not enough tx_credit for queue "
  346. "%d, Tx worker stopped\n", txq->id);
  347. spin_lock_bh(&txq->lock);
  348. skb_queue_head(&txq->queue, skb);
  349. spin_unlock_bh(&txq->lock);
  350. mutex_unlock(&tid_info->mutex);
  351. break;
  352. }
  353. txq->concat_ptr = txq->concat_buf + txq->concat_count;
  354. tid_info->last_seq_num =
  355. iwm_tx_build_packet(iwm, skb, pool_id, txq->concat_ptr);
  356. txq->concat_count += ALIGN(cmdlen, 16);
  357. mutex_unlock(&tid_info->mutex);
  358. kfree_skb(skb);
  359. }
  360. iwm_tx_send_concat_packets(iwm, txq);
  361. if (__netif_subqueue_stopped(iwm_to_ndev(iwm), txq->id) &&
  362. !test_bit(pool_id, &iwm->tx_credit.full_pools_map) &&
  363. (skb_queue_len(&txq->queue) < IWM_TX_LIST_SIZE / 2)) {
  364. IWM_DBG_TX(iwm, DBG, "LINK: start netif_subqueue[%d]", txq->id);
  365. netif_wake_subqueue(iwm_to_ndev(iwm), txq->id);
  366. }
  367. }
  368. int iwm_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
  369. {
  370. struct iwm_priv *iwm = ndev_to_iwm(netdev);
  371. struct wireless_dev *wdev = iwm_to_wdev(iwm);
  372. struct iwm_tx_info *tx_info;
  373. struct iwm_tx_queue *txq;
  374. struct iwm_sta_info *sta_info;
  375. u8 *dst_addr, sta_id;
  376. u16 queue;
  377. int ret;
  378. if (!test_bit(IWM_STATUS_ASSOCIATED, &iwm->status)) {
  379. IWM_DBG_TX(iwm, DBG, "LINK: stop netif_all_queues: "
  380. "not associated\n");
  381. netif_tx_stop_all_queues(netdev);
  382. goto drop;
  383. }
  384. queue = skb_get_queue_mapping(skb);
  385. BUG_ON(queue >= IWM_TX_DATA_QUEUES); /* no iPAN yet */
  386. txq = &iwm->txq[queue];
  387. /* No free space for Tx, tx_worker is too slow */
  388. if ((skb_queue_len(&txq->queue) > IWM_TX_LIST_SIZE) ||
  389. (skb_queue_len(&txq->stopped_queue) > IWM_TX_LIST_SIZE)) {
  390. IWM_DBG_TX(iwm, DBG, "LINK: stop netif_subqueue[%d]\n", queue);
  391. netif_stop_subqueue(netdev, queue);
  392. return NETDEV_TX_BUSY;
  393. }
  394. ret = ieee80211_data_from_8023(skb, netdev->dev_addr, wdev->iftype,
  395. iwm->bssid, 0);
  396. if (ret) {
  397. IWM_ERR(iwm, "build wifi header failed\n");
  398. goto drop;
  399. }
  400. dst_addr = ((struct ieee80211_hdr *)(skb->data))->addr1;
  401. for (sta_id = 0; sta_id < IWM_STA_TABLE_NUM; sta_id++) {
  402. sta_info = &iwm->sta_table[sta_id];
  403. if (sta_info->valid &&
  404. !memcmp(dst_addr, sta_info->addr, ETH_ALEN))
  405. break;
  406. }
  407. if (sta_id == IWM_STA_TABLE_NUM) {
  408. IWM_ERR(iwm, "STA %pM not found in sta_table, Tx ignored\n",
  409. dst_addr);
  410. goto drop;
  411. }
  412. tx_info = skb_to_tx_info(skb);
  413. tx_info->sta = sta_id;
  414. tx_info->color = sta_info->color;
  415. /* UMAC uses TID 8 (vs. 0) for non QoS packets */
  416. if (sta_info->qos)
  417. tx_info->tid = skb->priority;
  418. else
  419. tx_info->tid = IWM_UMAC_MGMT_TID;
  420. spin_lock_bh(&iwm->txq[queue].lock);
  421. skb_queue_tail(&iwm->txq[queue].queue, skb);
  422. spin_unlock_bh(&iwm->txq[queue].lock);
  423. queue_work(iwm->txq[queue].wq, &iwm->txq[queue].worker);
  424. netdev->stats.tx_packets++;
  425. netdev->stats.tx_bytes += skb->len;
  426. return NETDEV_TX_OK;
  427. drop:
  428. netdev->stats.tx_dropped++;
  429. dev_kfree_skb_any(skb);
  430. return NETDEV_TX_OK;
  431. }