aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210/txrx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/txrx.c')
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 79d4e3271b00..797024507c71 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -191,8 +191,7 @@ static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
191 * - Phy info 191 * - Phy info
192 */ 192 */
193static void wil_rx_add_radiotap_header(struct wil6210_priv *wil, 193static void wil_rx_add_radiotap_header(struct wil6210_priv *wil,
194 struct sk_buff *skb, 194 struct sk_buff *skb)
195 volatile struct vring_rx_desc *d)
196{ 195{
197 struct wireless_dev *wdev = wil->wdev; 196 struct wireless_dev *wdev = wil->wdev;
198 struct wil6210_rtap { 197 struct wil6210_rtap {
@@ -216,6 +215,7 @@ static void wil_rx_add_radiotap_header(struct wil6210_priv *wil,
216 __le16 vendor_skip; 215 __le16 vendor_skip;
217 u8 vendor_data[0]; 216 u8 vendor_data[0];
218 } __packed; 217 } __packed;
218 struct vring_rx_desc *d = wil_skb_rxdesc(skb);
219 struct wil6210_rtap_vendor *rtap_vendor; 219 struct wil6210_rtap_vendor *rtap_vendor;
220 int rtap_len = sizeof(struct wil6210_rtap); 220 int rtap_len = sizeof(struct wil6210_rtap);
221 int phy_length = 0; /* phy info header size, bytes */ 221 int phy_length = 0; /* phy info header size, bytes */
@@ -312,6 +312,8 @@ static void wil_swap_ethaddr(void *data)
312/** 312/**
313 * reap 1 frame from @swhead 313 * reap 1 frame from @swhead
314 * 314 *
315 * Rx descriptor copied to skb->cb
316 *
315 * Safe to call from IRQ 317 * Safe to call from IRQ
316 */ 318 */
317static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil, 319static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
@@ -320,12 +322,15 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
320 struct device *dev = wil_to_dev(wil); 322 struct device *dev = wil_to_dev(wil);
321 struct net_device *ndev = wil_to_ndev(wil); 323 struct net_device *ndev = wil_to_ndev(wil);
322 volatile struct vring_rx_desc *d; 324 volatile struct vring_rx_desc *d;
325 struct vring_rx_desc *d1;
323 struct sk_buff *skb; 326 struct sk_buff *skb;
324 dma_addr_t pa; 327 dma_addr_t pa;
325 unsigned int sz = RX_BUF_LEN; 328 unsigned int sz = RX_BUF_LEN;
326 u8 ftype; 329 u8 ftype;
327 u8 ds_bits; 330 u8 ds_bits;
328 331
332 BUILD_BUG_ON(sizeof(struct vring_rx_desc) > sizeof(skb->cb));
333
329 if (wil_vring_is_empty(vring)) 334 if (wil_vring_is_empty(vring))
330 return NULL; 335 return NULL;
331 336
@@ -340,11 +345,14 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
340 dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE); 345 dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE);
341 skb_trim(skb, d->dma.length); 346 skb_trim(skb, d->dma.length);
342 347
343 wil->stats.last_mcs_rx = wil_rxdesc_mcs(d); 348 d1 = wil_skb_rxdesc(skb);
349 *d1 = *d;
350
351 wil->stats.last_mcs_rx = wil_rxdesc_mcs(d1);
344 352
345 /* use radiotap header only if required */ 353 /* use radiotap header only if required */
346 if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) 354 if (ndev->type == ARPHRD_IEEE80211_RADIOTAP)
347 wil_rx_add_radiotap_header(wil, skb, d); 355 wil_rx_add_radiotap_header(wil, skb);
348 356
349 wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length); 357 wil_dbg_txrx(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length);
350 wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4, 358 wil_hex_dump_txrx("Rx ", DUMP_PREFIX_NONE, 32, 4,
@@ -360,7 +368,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
360 * Driver should recognize it by frame type, that is found 368 * Driver should recognize it by frame type, that is found
361 * in Rx descriptor. If type is not data, it is 802.11 frame as is 369 * in Rx descriptor. If type is not data, it is 802.11 frame as is
362 */ 370 */
363 ftype = wil_rxdesc_ftype(d) << 2; 371 ftype = wil_rxdesc_ftype(d1) << 2;
364 if (ftype != IEEE80211_FTYPE_DATA) { 372 if (ftype != IEEE80211_FTYPE_DATA) {
365 wil_dbg_txrx(wil, "Non-data frame ftype 0x%08x\n", ftype); 373 wil_dbg_txrx(wil, "Non-data frame ftype 0x%08x\n", ftype);
366 /* TODO: process it */ 374 /* TODO: process it */
@@ -375,7 +383,7 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
375 return NULL; 383 return NULL;
376 } 384 }
377 385
378 ds_bits = wil_rxdesc_ds_bits(d); 386 ds_bits = wil_rxdesc_ds_bits(d1);
379 if (ds_bits == 1) { 387 if (ds_bits == 1) {
380 /* 388 /*
381 * HW bug - in ToDS mode, i.e. Rx on AP side, 389 * HW bug - in ToDS mode, i.e. Rx on AP side,
@@ -517,6 +525,7 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
517 .vring_cfg = { 525 .vring_cfg = {
518 .tx_sw_ring = { 526 .tx_sw_ring = {
519 .max_mpdu_size = cpu_to_le16(TX_BUF_LEN), 527 .max_mpdu_size = cpu_to_le16(TX_BUF_LEN),
528 .ring_size = cpu_to_le16(size),
520 }, 529 },
521 .ringid = id, 530 .ringid = id,
522 .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4), 531 .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4),
@@ -548,7 +557,6 @@ int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
548 goto out; 557 goto out;
549 558
550 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); 559 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
551 cmd.vring_cfg.tx_sw_ring.ring_size = cpu_to_le16(vring->size);
552 560
553 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, &cmd, sizeof(cmd), 561 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, &cmd, sizeof(cmd),
554 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100); 562 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100);
@@ -779,9 +787,14 @@ void wil_tx_complete(struct wil6210_priv *wil, int ringid)
779 wil_dbg_txrx(wil, "%s(%d)\n", __func__, ringid); 787 wil_dbg_txrx(wil, "%s(%d)\n", __func__, ringid);
780 788
781 while (!wil_vring_is_empty(vring)) { 789 while (!wil_vring_is_empty(vring)) {
782 volatile struct vring_tx_desc *d = &vring->va[vring->swtail].tx; 790 volatile struct vring_tx_desc *d1 =
791 &vring->va[vring->swtail].tx;
792 struct vring_tx_desc dd, *d = &dd;
783 dma_addr_t pa; 793 dma_addr_t pa;
784 struct sk_buff *skb; 794 struct sk_buff *skb;
795
796 dd = *d1;
797
785 if (!(d->dma.status & TX_DMA_STATUS_DU)) 798 if (!(d->dma.status & TX_DMA_STATUS_DU))
786 break; 799 break;
787 800