diff options
author | John W. Linville <linville@tuxdriver.com> | 2013-04-24 10:54:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-04-24 10:54:20 -0400 |
commit | 6ed0e321a0aef14a894e26658108bf7e895c36a6 (patch) | |
tree | f49428d68ebcb1beb757296ea1559079210babbe /drivers/net/wireless/ath/wil6210 | |
parent | 3dec2246c2ff11beb24ca1950f074b2bcbc85953 (diff) | |
parent | b006ed545cbadf1ebd4683719554742d20dbcede (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Diffstat (limited to 'drivers/net/wireless/ath/wil6210')
-rw-r--r-- | drivers/net/wireless/ath/wil6210/txrx.c | 29 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/txrx.h | 49 |
2 files changed, 63 insertions, 15 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 | */ |
193 | static void wil_rx_add_radiotap_header(struct wil6210_priv *wil, | 193 | static 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 | */ |
317 | static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil, | 319 | static 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 = ⅆ | ||
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 | ||
diff --git a/drivers/net/wireless/ath/wil6210/txrx.h b/drivers/net/wireless/ath/wil6210/txrx.h index 45a61f597c5c..adef12fb2aee 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.h +++ b/drivers/net/wireless/ath/wil6210/txrx.h | |||
@@ -339,24 +339,59 @@ union vring_desc { | |||
339 | struct vring_rx_desc rx; | 339 | struct vring_rx_desc rx; |
340 | } __packed; | 340 | } __packed; |
341 | 341 | ||
342 | static inline int wil_rxdesc_phy_length(volatile struct vring_rx_desc *d) | 342 | static inline int wil_rxdesc_tid(struct vring_rx_desc *d) |
343 | { | 343 | { |
344 | return WIL_GET_BITS(d->dma.d0, 16, 29); | 344 | return WIL_GET_BITS(d->mac.d0, 0, 3); |
345 | } | 345 | } |
346 | 346 | ||
347 | static inline int wil_rxdesc_mcs(volatile struct vring_rx_desc *d) | 347 | static inline int wil_rxdesc_cid(struct vring_rx_desc *d) |
348 | { | 348 | { |
349 | return WIL_GET_BITS(d->mac.d1, 21, 24); | 349 | return WIL_GET_BITS(d->mac.d0, 4, 6); |
350 | } | 350 | } |
351 | 351 | ||
352 | static inline int wil_rxdesc_ds_bits(volatile struct vring_rx_desc *d) | 352 | static inline int wil_rxdesc_mid(struct vring_rx_desc *d) |
353 | { | 353 | { |
354 | return WIL_GET_BITS(d->mac.d1, 8, 9); | 354 | return WIL_GET_BITS(d->mac.d0, 8, 9); |
355 | } | 355 | } |
356 | 356 | ||
357 | static inline int wil_rxdesc_ftype(volatile struct vring_rx_desc *d) | 357 | static inline int wil_rxdesc_ftype(struct vring_rx_desc *d) |
358 | { | 358 | { |
359 | return WIL_GET_BITS(d->mac.d0, 10, 11); | 359 | return WIL_GET_BITS(d->mac.d0, 10, 11); |
360 | } | 360 | } |
361 | 361 | ||
362 | static inline int wil_rxdesc_subtype(struct vring_rx_desc *d) | ||
363 | { | ||
364 | return WIL_GET_BITS(d->mac.d0, 12, 15); | ||
365 | } | ||
366 | |||
367 | static inline int wil_rxdesc_seq(struct vring_rx_desc *d) | ||
368 | { | ||
369 | return WIL_GET_BITS(d->mac.d0, 16, 27); | ||
370 | } | ||
371 | |||
372 | static inline int wil_rxdesc_ext_subtype(struct vring_rx_desc *d) | ||
373 | { | ||
374 | return WIL_GET_BITS(d->mac.d0, 28, 31); | ||
375 | } | ||
376 | |||
377 | static inline int wil_rxdesc_ds_bits(struct vring_rx_desc *d) | ||
378 | { | ||
379 | return WIL_GET_BITS(d->mac.d1, 8, 9); | ||
380 | } | ||
381 | |||
382 | static inline int wil_rxdesc_mcs(struct vring_rx_desc *d) | ||
383 | { | ||
384 | return WIL_GET_BITS(d->mac.d1, 21, 24); | ||
385 | } | ||
386 | |||
387 | static inline int wil_rxdesc_phy_length(struct vring_rx_desc *d) | ||
388 | { | ||
389 | return WIL_GET_BITS(d->dma.d0, 16, 29); | ||
390 | } | ||
391 | |||
392 | static inline struct vring_rx_desc *wil_skb_rxdesc(struct sk_buff *skb) | ||
393 | { | ||
394 | return (void *)skb->cb; | ||
395 | } | ||
396 | |||
362 | #endif /* WIL6210_TXRX_H */ | 397 | #endif /* WIL6210_TXRX_H */ |