2014-01-12 08:41:18

by Vladimir Kondratiev

[permalink] [raw]
Subject: [PATCH v2 0/3] wil6210 patches

in the previour submission, bug was found by kbuild, see below.
It is about incorrect #include, one I used do not work for the
architectures lacking native prefetch().

Re-submitting all series.

tree: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master
head: 1e2f9295f4c657500111514f92a3d3894d0e05b4
commit: 1cbbcb08c786964a16773c39f2536f1923c73c58 [135/140] wil6210: prefetch head of packet
config: make ARCH=microblaze allyesconfig

All error/warnings:

drivers/net/wireless/ath/wil6210/txrx.c: In function 'wil_vring_reap_rx':
>> drivers/net/wireless/ath/wil6210/txrx.c:381:2: error: implicit declaration of function 'prefetch' [-Werror=implicit-function-declaration]
prefetch(skb->data);
^
cc1: some warnings being treated as errors

vim +/prefetch +381 drivers/net/wireless/ath/wil6210/txrx.c

375 wil_err(wil, "Rx size too large: %d bytes!\n", dmalen);
376 kfree_skb(skb);
377 return NULL;
378 }
379 skb_trim(skb, dmalen);
380
> 381 prefetch(skb->data);
382
383 wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
384 skb->data, skb_headlen(skb), false);

Vladimir Kondratiev (3):
wil6210: interrupt moderation
wil6210: Fix IP version indication for Tx csum offload
wil6210: prefetch head of packet

drivers/net/wireless/ath/wil6210/interrupt.c | 13 +++++++++++++
drivers/net/wireless/ath/wil6210/txrx.c | 8 ++++++--
drivers/net/wireless/ath/wil6210/wil6210.h | 1 +
3 files changed, 20 insertions(+), 2 deletions(-)

--
1.8.3.2



2014-01-12 08:41:21

by Vladimir Kondratiev

[permalink] [raw]
Subject: [PATCH v2 2/3] wil6210: Fix IP version indication for Tx csum offload

Bit DMA_CFG_DESC_TX_OFFLOAD_CFG_L3T_IPV4_POS should be set for IPv4
only. Don't set it for IPv6

Signed-off-by: Vladimir Kondratiev <[email protected]>
---
drivers/net/wireless/ath/wil6210/txrx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index d505b26..18003c0 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -673,9 +673,12 @@ static int wil_tx_desc_offload_cksum_set(struct wil6210_priv *wil,
if (skb->ip_summed != CHECKSUM_PARTIAL)
return 0;

+ d->dma.b11 = ETH_HLEN; /* MAC header length */
+
switch (skb->protocol) {
case cpu_to_be16(ETH_P_IP):
protocol = ip_hdr(skb)->protocol;
+ d->dma.b11 |= BIT(DMA_CFG_DESC_TX_OFFLOAD_CFG_L3T_IPV4_POS);
break;
case cpu_to_be16(ETH_P_IPV6):
protocol = ipv6_hdr(skb)->nexthdr;
@@ -701,8 +704,6 @@ static int wil_tx_desc_offload_cksum_set(struct wil6210_priv *wil,
}

d->dma.ip_length = skb_network_header_len(skb);
- d->dma.b11 = ETH_HLEN; /* MAC header length */
- d->dma.b11 |= BIT(DMA_CFG_DESC_TX_OFFLOAD_CFG_L3T_IPV4_POS);
/* Enable TCP/UDP checksum */
d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_POS);
/* Calculate pseudo-header */
--
1.8.3.2


2014-01-12 08:41:19

by Vladimir Kondratiev

[permalink] [raw]
Subject: [PATCH v2 1/3] wil6210: interrupt moderation

Use hardware capabilities to limit IRQ generation to about 15 per msec
It corresponds to about 7 packets/IRQ when running iperf with default
parameters at 1.3Gbps

Do not enable this feature in the sniffer (monitor) mode, because
interrupt moderation cause timestamp accuracy deterioration.
For the sniffer flow, it is important to get precise timestamp.

Signed-off-by: Vladimir Kondratiev <[email protected]>
---
drivers/net/wireless/ath/wil6210/interrupt.c | 13 +++++++++++++
drivers/net/wireless/ath/wil6210/wil6210.h | 1 +
2 files changed, 14 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index 8205d3e..10919f9 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -156,6 +156,19 @@ void wil6210_enable_irq(struct wil6210_priv *wil)
iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_MISC_ICR) +
offsetof(struct RGF_ICR, ICC));

+ /* interrupt moderation parameters */
+ if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
+ /* disable interrupt moderation for monitor
+ * to get better timestamp precision
+ */
+ iowrite32(0, wil->csr + HOSTADDR(RGF_DMA_ITR_CNT_CRL));
+ } else {
+ iowrite32(WIL6210_ITR_TRSH,
+ wil->csr + HOSTADDR(RGF_DMA_ITR_CNT_TRSH));
+ iowrite32(BIT_DMA_ITR_CNT_CRL_EN,
+ wil->csr + HOSTADDR(RGF_DMA_ITR_CNT_CRL));
+ }
+
wil6210_unmask_irq_pseudo(wil);
wil6210_unmask_irq_tx(wil);
wil6210_unmask_irq_rx(wil);
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index c4a5163..1f91eaf 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -39,6 +39,7 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
#define WIL6210_MAX_TX_RINGS (24) /* HW limit */
#define WIL6210_MAX_CID (8) /* HW limit */
#define WIL6210_NAPI_BUDGET (16) /* arbitrary */
+#define WIL6210_ITR_TRSH (10000) /* arbitrary - about 15 IRQs/msec */

/* Hardware definitions begin */

--
1.8.3.2


2014-01-12 08:41:22

by Vladimir Kondratiev

[permalink] [raw]
Subject: [PATCH v2 3/3] wil6210: prefetch head of packet

As soon as skb is ready to be reaped, prefetch 1-st cache line.
This accelerates data access that is performed later, during the
packet classification by the driver and IP stack.

Signed-off-by: Vladimir Kondratiev <[email protected]>
---
drivers/net/wireless/ath/wil6210/txrx.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
index 18003c0..0b0975d 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -21,6 +21,7 @@
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <net/ipv6.h>
+#include <linux/prefetch.h>

#include "wil6210.h"
#include "wmi.h"
@@ -377,6 +378,8 @@ static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
}
skb_trim(skb, dmalen);

+ prefetch(skb->data);
+
wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
skb->data, skb_headlen(skb), false);

--
1.8.3.2


2014-01-14 18:17:33

by Vladimir Kondratiev

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] wil6210 patches

On Monday, January 13, 2014 02:49:49 PM John W. Linville wrote:
> I already merged the v1 series. Please submit any new patches on
> top of what has already been merged...
>

OK, doing so.

Thanks, Vladimir

2014-01-13 20:00:14

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] wil6210 patches

I already merged the v1 series. Please submit any new patches on
top of what has already been merged...

On Sun, Jan 12, 2014 at 10:41:01AM +0200, Vladimir Kondratiev wrote:
> in the previour submission, bug was found by kbuild, see below.
> It is about incorrect #include, one I used do not work for the
> architectures lacking native prefetch().
>
> Re-submitting all series.
>
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master
> head: 1e2f9295f4c657500111514f92a3d3894d0e05b4
> commit: 1cbbcb08c786964a16773c39f2536f1923c73c58 [135/140] wil6210: prefetch head of packet
> config: make ARCH=microblaze allyesconfig
>
> All error/warnings:
>
> drivers/net/wireless/ath/wil6210/txrx.c: In function 'wil_vring_reap_rx':
> >> drivers/net/wireless/ath/wil6210/txrx.c:381:2: error: implicit declaration of function 'prefetch' [-Werror=implicit-function-declaration]
> prefetch(skb->data);
> ^
> cc1: some warnings being treated as errors
>
> vim +/prefetch +381 drivers/net/wireless/ath/wil6210/txrx.c
>
> 375 wil_err(wil, "Rx size too large: %d bytes!\n", dmalen);
> 376 kfree_skb(skb);
> 377 return NULL;
> 378 }
> 379 skb_trim(skb, dmalen);
> 380
> > 381 prefetch(skb->data);
> 382
> 383 wil_hex_dump_txrx("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
> 384 skb->data, skb_headlen(skb), false);
>
> Vladimir Kondratiev (3):
> wil6210: interrupt moderation
> wil6210: Fix IP version indication for Tx csum offload
> wil6210: prefetch head of packet
>
> drivers/net/wireless/ath/wil6210/interrupt.c | 13 +++++++++++++
> drivers/net/wireless/ath/wil6210/txrx.c | 8 ++++++--
> drivers/net/wireless/ath/wil6210/wil6210.h | 1 +
> 3 files changed, 20 insertions(+), 2 deletions(-)
>
> --
> 1.8.3.2
>
>

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.