2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/etherdevice.h>
18 #include <net/ieee80211_radiotap.h>
19 #include <linux/if_arp.h>
20 #include <linux/moduleparam.h>
26 static bool rtap_include_phy_info;
27 module_param(rtap_include_phy_info, bool, S_IRUGO);
28 MODULE_PARM_DESC(rtap_include_phy_info,
29 " Include PHY info in the radiotap header, default - no");
31 static inline int wil_vring_is_empty(struct vring *vring)
33 return vring->swhead == vring->swtail;
36 static inline u32 wil_vring_next_tail(struct vring *vring)
38 return (vring->swtail + 1) % vring->size;
41 static inline void wil_vring_advance_head(struct vring *vring, int n)
43 vring->swhead = (vring->swhead + n) % vring->size;
46 static inline int wil_vring_is_full(struct vring *vring)
48 return wil_vring_next_tail(vring) == vring->swhead;
51 * Available space in Tx Vring
53 static inline int wil_vring_avail_tx(struct vring *vring)
55 u32 swhead = vring->swhead;
56 u32 swtail = vring->swtail;
57 int used = (vring->size + swhead - swtail) % vring->size;
59 return vring->size - used - 1;
62 static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
64 struct device *dev = wil_to_dev(wil);
65 size_t sz = vring->size * sizeof(vring->va[0]);
68 BUILD_BUG_ON(sizeof(vring->va[0]) != 32);
72 vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL);
78 * vring->va should be aligned on its size rounded up to power of 2
79 * This is granted by the dma_alloc_coherent
81 vring->va = dma_alloc_coherent(dev, sz, &vring->pa, GFP_KERNEL);
83 wil_err(wil, "vring_alloc [%d] failed to alloc DMA mem\n",
89 /* initially, all descriptors are SW owned
90 * For Tx and Rx, ownership bit is at the same location, thus
93 for (i = 0; i < vring->size; i++) {
94 volatile struct vring_tx_desc *d = &(vring->va[i].tx);
95 d->dma.status = TX_DMA_STATUS_DU;
98 wil_dbg_misc(wil, "vring[%d] 0x%p:0x%016llx 0x%p\n", vring->size,
99 vring->va, (unsigned long long)vring->pa, vring->ctx);
104 static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring,
107 struct device *dev = wil_to_dev(wil);
108 size_t sz = vring->size * sizeof(vring->va[0]);
110 while (!wil_vring_is_empty(vring)) {
112 volatile struct vring_tx_desc *d =
113 &vring->va[vring->swtail].tx;
114 dma_addr_t pa = d->dma.addr_low |
115 ((u64)d->dma.addr_high << 32);
116 struct sk_buff *skb = vring->ctx[vring->swtail];
118 dma_unmap_single(dev, pa, d->dma.length,
120 dev_kfree_skb_any(skb);
121 vring->ctx[vring->swtail] = NULL;
123 dma_unmap_page(dev, pa, d->dma.length,
126 vring->swtail = wil_vring_next_tail(vring);
128 volatile struct vring_rx_desc *d =
129 &vring->va[vring->swtail].rx;
130 dma_addr_t pa = d->dma.addr_low |
131 ((u64)d->dma.addr_high << 32);
132 struct sk_buff *skb = vring->ctx[vring->swhead];
133 dma_unmap_single(dev, pa, d->dma.length,
136 wil_vring_advance_head(vring, 1);
139 dma_free_coherent(dev, sz, (void *)vring->va, vring->pa);
147 * Allocate one skb for Rx VRING
149 * Safe to call from IRQ
151 static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
154 struct device *dev = wil_to_dev(wil);
155 unsigned int sz = RX_BUF_LEN;
156 volatile struct vring_rx_desc *d = &(vring->va[i].rx);
160 struct sk_buff *skb = dev_alloc_skb(sz + headroom);
164 skb_reserve(skb, headroom);
167 pa = dma_map_single(dev, skb->data, skb->len, DMA_FROM_DEVICE);
168 if (unlikely(dma_mapping_error(dev, pa))) {
173 d->dma.d0 = BIT(9) | RX_DMA_D0_CMD_DMA_IT;
174 d->dma.addr_low = lower_32_bits(pa);
175 d->dma.addr_high = (u16)upper_32_bits(pa);
176 /* ip_length don't care */
178 /* error don't care */
179 d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
187 * Adds radiotap header
189 * Any error indicated as "Bad FCS"
191 * Vendor data for 04:ce:14-1 (Wilocity-1) consists of:
192 * - Rx descriptor: 32 bytes
195 static void wil_rx_add_radiotap_header(struct wil6210_priv *wil,
197 volatile struct vring_rx_desc *d)
199 struct wireless_dev *wdev = wil->wdev;
200 struct wil6210_rtap {
201 struct ieee80211_radiotap_header rthdr;
202 /* fields should be in the order of bits in rthdr.it_present */
206 __le16 chnl_freq __aligned(2);
213 struct wil6210_rtap_vendor {
214 struct wil6210_rtap rtap;
216 u8 vendor_oui[3] __aligned(2);
221 struct wil6210_rtap_vendor *rtap_vendor;
222 int rtap_len = sizeof(struct wil6210_rtap);
223 int phy_length = 0; /* phy info header size, bytes */
224 static char phy_data[128];
225 struct ieee80211_channel *ch = wdev->preset_chandef.chan;
227 if (rtap_include_phy_info) {
228 rtap_len = sizeof(*rtap_vendor) + sizeof(*d);
229 /* calculate additional length */
230 if (d->dma.status & RX_DMA_STATUS_PHY_INFO) {
232 * PHY info starts from 8-byte boundary
233 * there are 8-byte lines, last line may be partially
234 * written (HW bug), thus FW configures for last line
235 * to be excessive. Driver skips this last line.
237 int len = min_t(int, 8 + sizeof(phy_data),
238 wil_rxdesc_phy_length(d));
240 void *p = skb_tail_pointer(skb);
241 void *pa = PTR_ALIGN(p, 8);
242 if (skb_tailroom(skb) >= len + (pa - p)) {
243 phy_length = len - 8;
244 memcpy(phy_data, pa, phy_length);
248 rtap_len += phy_length;
251 if (skb_headroom(skb) < rtap_len &&
252 pskb_expand_head(skb, rtap_len, 0, GFP_ATOMIC)) {
253 wil_err(wil, "Unable to expand headrom to %d\n", rtap_len);
257 rtap_vendor = (void *)skb_push(skb, rtap_len);
258 memset(rtap_vendor, 0, rtap_len);
260 rtap_vendor->rtap.rthdr.it_version = PKTHDR_RADIOTAP_VERSION;
261 rtap_vendor->rtap.rthdr.it_len = cpu_to_le16(rtap_len);
262 rtap_vendor->rtap.rthdr.it_present = cpu_to_le32(
263 (1 << IEEE80211_RADIOTAP_FLAGS) |
264 (1 << IEEE80211_RADIOTAP_CHANNEL) |
265 (1 << IEEE80211_RADIOTAP_MCS));
266 if (d->dma.status & RX_DMA_STATUS_ERROR)
267 rtap_vendor->rtap.flags |= IEEE80211_RADIOTAP_F_BADFCS;
269 rtap_vendor->rtap.chnl_freq = cpu_to_le16(ch ? ch->center_freq : 58320);
270 rtap_vendor->rtap.chnl_flags = cpu_to_le16(0);
272 rtap_vendor->rtap.mcs_present = IEEE80211_RADIOTAP_MCS_HAVE_MCS;
273 rtap_vendor->rtap.mcs_flags = 0;
274 rtap_vendor->rtap.mcs_index = wil_rxdesc_mcs(d);
276 if (rtap_include_phy_info) {
277 rtap_vendor->rtap.rthdr.it_present |= cpu_to_le32(1 <<
278 IEEE80211_RADIOTAP_VENDOR_NAMESPACE);
279 /* OUI for Wilocity 04:ce:14 */
280 rtap_vendor->vendor_oui[0] = 0x04;
281 rtap_vendor->vendor_oui[1] = 0xce;
282 rtap_vendor->vendor_oui[2] = 0x14;
283 rtap_vendor->vendor_ns = 1;
284 /* Rx descriptor + PHY data */
285 rtap_vendor->vendor_skip = cpu_to_le16(sizeof(*d) +
287 memcpy(rtap_vendor->vendor_data, (void *)d, sizeof(*d));
288 memcpy(rtap_vendor->vendor_data + sizeof(*d), phy_data,
294 * Fast swap in place between 2 registers
296 static void wil_swap_u16(u16 *a, u16 *b)
303 static void wil_swap_ethaddr(void *data)
305 struct ethhdr *eth = data;
306 u16 *s = (u16 *)eth->h_source;
307 u16 *d = (u16 *)eth->h_dest;
309 wil_swap_u16(s++, d++);
310 wil_swap_u16(s++, d++);
315 * reap 1 frame from @swhead
317 * Safe to call from IRQ
319 static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
322 struct device *dev = wil_to_dev(wil);
323 struct net_device *ndev = wil_to_ndev(wil);
324 volatile struct vring_rx_desc *d;
327 unsigned int sz = RX_BUF_LEN;
331 if (wil_vring_is_empty(vring))
334 d = &(vring->va[vring->swhead].rx);
335 if (!(d->dma.status & RX_DMA_STATUS_DU)) {
336 /* it is not error, we just reached end of Rx done area */
340 pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
341 skb = vring->ctx[vring->swhead];
342 dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE);
343 skb_trim(skb, d->dma.length);
345 wil->stats.last_mcs_rx = wil_rxdesc_mcs(d);
347 /* use radiotap header only if required */
348 if (ndev->type == ARPHRD_IEEE80211_RADIOTAP)
349 wil_rx_add_radiotap_header(wil, skb, d);
351 wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length);
352 wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4,
353 (const void *)d, sizeof(*d), false);
355 wil_vring_advance_head(vring, 1);
357 /* no extra checks if in sniffer mode */
358 if (ndev->type != ARPHRD_ETHER)
361 * Non-data frames may be delivered through Rx DMA channel (ex: BAR)
362 * Driver should recognize it by frame type, that is found
363 * in Rx descriptor. If type is not data, it is 802.11 frame as is
365 ftype = wil_rxdesc_ftype(d) << 2;
366 if (ftype != IEEE80211_FTYPE_DATA) {
367 wil_dbg_txrx(wil, "Non-data frame ftype 0x%08x\n", ftype);
368 /* TODO: process it */
373 if (skb->len < ETH_HLEN) {
374 wil_err(wil, "Short frame, len = %d\n", skb->len);
375 /* TODO: process it (i.e. BAR) */
380 ds_bits = wil_rxdesc_ds_bits(d);
383 * HW bug - in ToDS mode, i.e. Rx on AP side,
384 * addresses get swapped
386 wil_swap_ethaddr(skb->data);
393 * allocate and fill up to @count buffers in rx ring
394 * buffers posted at @swtail
396 static int wil_rx_refill(struct wil6210_priv *wil, int count)
398 struct net_device *ndev = wil_to_ndev(wil);
399 struct vring *v = &wil->vring_rx;
402 int headroom = ndev->type == ARPHRD_IEEE80211_RADIOTAP ?
403 WIL6210_RTAP_SIZE : 0;
405 for (; next_tail = wil_vring_next_tail(v),
406 (next_tail != v->swhead) && (count-- > 0);
407 v->swtail = next_tail) {
408 rc = wil_vring_alloc_skb(wil, v, v->swtail, headroom);
410 wil_err(wil, "Error %d in wil_rx_refill[%d]\n",
415 iowrite32(v->swtail, wil->csr + HOSTADDR(v->hwtail));
421 * Pass Rx packet to the netif. Update statistics.
423 static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
426 unsigned int len = skb->len;
433 rc = netif_rx_ni(skb);
435 if (likely(rc == NET_RX_SUCCESS)) {
436 ndev->stats.rx_packets++;
437 ndev->stats.rx_bytes += len;
440 ndev->stats.rx_dropped++;
445 * Proceed all completed skb's from Rx VRING
447 * Safe to call from IRQ
449 void wil_rx_handle(struct wil6210_priv *wil)
451 struct net_device *ndev = wil_to_ndev(wil);
452 struct vring *v = &wil->vring_rx;
456 wil_err(wil, "Rx IRQ while Rx not yet initialized\n");
459 wil_dbg_txrx(wil, "%s()\n", __func__);
460 while (NULL != (skb = wil_vring_reap_rx(wil, v))) {
461 wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
462 skb->data, skb_headlen(skb), false);
464 if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
466 skb_reset_mac_header(skb);
467 skb->ip_summed = CHECKSUM_UNNECESSARY;
468 skb->pkt_type = PACKET_OTHERHOST;
469 skb->protocol = htons(ETH_P_802_2);
472 skb->protocol = eth_type_trans(skb, ndev);
475 wil_netif_rx_any(skb, ndev);
477 wil_rx_refill(wil, v->size);
480 int wil_rx_init(struct wil6210_priv *wil)
482 struct vring *vring = &wil->vring_rx;
485 vring->size = WIL6210_RX_RING_SIZE;
486 rc = wil_vring_alloc(wil, vring);
490 rc = wmi_rx_chain_add(wil, vring);
494 rc = wil_rx_refill(wil, vring->size);
500 wil_vring_free(wil, vring, 0);
505 void wil_rx_fini(struct wil6210_priv *wil)
507 struct vring *vring = &wil->vring_rx;
510 wil_vring_free(wil, vring, 0);
513 int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
517 struct wmi_vring_cfg_cmd cmd = {
518 .action = cpu_to_le32(WMI_VRING_CMD_ADD),
521 .max_mpdu_size = cpu_to_le16(TX_BUF_LEN),
524 .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4),
525 .encap_trans_type = WMI_VRING_ENC_TYPE_802_3,
530 .priority = cpu_to_le16(0),
531 .timeslot_us = cpu_to_le16(0xfff),
536 struct wil6210_mbox_hdr_wmi wmi;
537 struct wmi_vring_cfg_done_event cmd;
539 struct vring *vring = &wil->vring_tx[id];
542 wil_err(wil, "Tx ring [%d] already allocated\n", id);
548 rc = wil_vring_alloc(wil, vring);
552 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
553 cmd.vring_cfg.tx_sw_ring.ring_size = cpu_to_le16(vring->size);
555 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, &cmd, sizeof(cmd),
556 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100);
560 if (reply.cmd.status != WMI_VRING_CFG_SUCCESS) {
561 wil_err(wil, "Tx config failed, status 0x%02x\n",
566 vring->hwtail = le32_to_cpu(reply.cmd.tx_vring_tail_ptr);
570 wil_vring_free(wil, vring, 1);
576 void wil_vring_fini_tx(struct wil6210_priv *wil, int id)
578 struct vring *vring = &wil->vring_tx[id];
583 wil_vring_free(wil, vring, 1);
586 static struct vring *wil_find_tx_vring(struct wil6210_priv *wil,
589 struct vring *v = &wil->vring_tx[0];
597 static int wil_tx_desc_map(volatile struct vring_tx_desc *d,
598 dma_addr_t pa, u32 len)
600 d->dma.addr_low = lower_32_bits(pa);
601 d->dma.addr_high = (u16)upper_32_bits(pa);
602 d->dma.ip_length = 0;
603 /* 0..6: mac_length; 7:ip_version 0-IP6 1-IP4*/
604 d->dma.b11 = 0/*14 | BIT(7)*/;
606 d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
612 d->mac.ucode_cmd = 0;
613 /* use dst index 0 */
614 d->mac.d[1] |= BIT(MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS) |
615 (0 << MAC_CFG_DESC_TX_1_DST_INDEX_POS);
616 /* translation type: 0 - bypass; 1 - 802.3; 2 - native wifi */
617 d->mac.d[2] = BIT(MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS) |
618 (1 << MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS);
623 static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
626 struct device *dev = wil_to_dev(wil);
627 volatile struct vring_tx_desc *d;
628 u32 swhead = vring->swhead;
629 int avail = wil_vring_avail_tx(vring);
630 int nr_frags = skb_shinfo(skb)->nr_frags;
632 int vring_index = vring - wil->vring_tx;
636 wil_dbg_txrx(wil, "%s()\n", __func__);
638 if (avail < vring->size/8)
639 netif_tx_stop_all_queues(wil_to_ndev(wil));
640 if (avail < 1 + nr_frags) {
641 wil_err(wil, "Tx ring full. No space for %d fragments\n",
645 d = &(vring->va[i].tx);
647 /* FIXME FW can accept only unicast frames for the peer */
648 memcpy(skb->data, wil->dst_addr[vring_index], ETH_ALEN);
650 pa = dma_map_single(dev, skb->data,
651 skb_headlen(skb), DMA_TO_DEVICE);
653 wil_dbg_txrx(wil, "Tx skb %d bytes %p -> %#08llx\n", skb_headlen(skb),
654 skb->data, (unsigned long long)pa);
655 wil_hex_dump_txrx("Tx ", DUMP_PREFIX_OFFSET, 16, 1,
656 skb->data, skb_headlen(skb), false);
658 if (unlikely(dma_mapping_error(dev, pa)))
661 wil_tx_desc_map(d, pa, skb_headlen(skb));
662 d->mac.d[2] |= ((nr_frags + 1) <<
663 MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS);
664 /* middle segments */
665 for (f = 0; f < nr_frags; f++) {
666 const struct skb_frag_struct *frag =
667 &skb_shinfo(skb)->frags[f];
668 int len = skb_frag_size(frag);
669 i = (swhead + f + 1) % vring->size;
670 d = &(vring->va[i].tx);
671 pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
673 if (unlikely(dma_mapping_error(dev, pa)))
675 wil_tx_desc_map(d, pa, len);
676 vring->ctx[i] = NULL;
678 /* for the last seg only */
679 d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_EOP_POS);
680 d->dma.d0 |= BIT(9); /* BUG: undocumented bit */
681 d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS);
682 d->dma.d0 |= (vring_index << DMA_CFG_DESC_TX_0_QID_POS);
684 wil_hex_dump_txrx("Tx ", DUMP_PREFIX_NONE, 32, 4,
685 (const void *)d, sizeof(*d), false);
688 wil_vring_advance_head(vring, nr_frags + 1);
689 wil_dbg_txrx(wil, "Tx swhead %d -> %d\n", swhead, vring->swhead);
690 iowrite32(vring->swhead, wil->csr + HOSTADDR(vring->hwtail));
691 /* hold reference to skb
692 * to prevent skb release before accounting
693 * in case of immediate "tx done"
695 vring->ctx[i] = skb_get(skb);
699 /* unmap what we have mapped */
700 /* Note: increment @f to operate with positive index */
701 for (f++; f > 0; f--) {
702 i = (swhead + f) % vring->size;
703 d = &(vring->va[i].tx);
704 d->dma.status = TX_DMA_STATUS_DU;
705 pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
707 dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE);
709 dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE);
716 netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
718 struct wil6210_priv *wil = ndev_to_wil(ndev);
722 wil_dbg_txrx(wil, "%s()\n", __func__);
723 if (!test_bit(wil_status_fwready, &wil->status)) {
724 wil_err(wil, "FW not ready\n");
727 if (!test_bit(wil_status_fwconnected, &wil->status)) {
728 wil_err(wil, "FW not connected\n");
731 if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
732 wil_err(wil, "Xmit in monitor mode not supported\n");
735 if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
736 rc = wmi_tx_eapol(wil, skb);
739 vring = wil_find_tx_vring(wil, skb);
741 wil_err(wil, "No Tx VRING available\n");
744 /* set up vring entry */
745 rc = wil_tx_vring(wil, vring, skb);
749 /* statistics will be updated on the tx_complete */
750 dev_kfree_skb_any(skb);
753 return NETDEV_TX_BUSY;
755 break; /* goto drop; */
758 netif_tx_stop_all_queues(ndev);
759 ndev->stats.tx_dropped++;
760 dev_kfree_skb_any(skb);
762 return NET_XMIT_DROP;
766 * Clean up transmitted skb's from the Tx VRING
768 * Safe to call from IRQ
770 void wil_tx_complete(struct wil6210_priv *wil, int ringid)
772 struct net_device *ndev = wil_to_ndev(wil);
773 struct device *dev = wil_to_dev(wil);
774 struct vring *vring = &wil->vring_tx[ringid];
777 wil_err(wil, "Tx irq[%d]: vring not initialized\n", ringid);
781 wil_dbg_txrx(wil, "%s(%d)\n", __func__, ringid);
783 while (!wil_vring_is_empty(vring)) {
784 volatile struct vring_tx_desc *d = &vring->va[vring->swtail].tx;
787 if (!(d->dma.status & TX_DMA_STATUS_DU))
791 "Tx[%3d] : %d bytes, status 0x%02x err 0x%02x\n",
792 vring->swtail, d->dma.length, d->dma.status,
794 wil_hex_dump_txrx("TxC ", DUMP_PREFIX_NONE, 32, 4,
795 (const void *)d, sizeof(*d), false);
797 pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
798 skb = vring->ctx[vring->swtail];
800 if (d->dma.error == 0) {
801 ndev->stats.tx_packets++;
802 ndev->stats.tx_bytes += skb->len;
804 ndev->stats.tx_errors++;
807 dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE);
808 dev_kfree_skb_any(skb);
809 vring->ctx[vring->swtail] = NULL;
811 dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE);
814 d->dma.addr_high = 0;
816 d->dma.status = TX_DMA_STATUS_DU;
817 vring->swtail = wil_vring_next_tail(vring);
819 if (wil_vring_avail_tx(vring) > vring->size/4)
820 netif_tx_wake_all_queues(wil_to_ndev(wil));