Commit 6c1394f3 authored by David S. Miller's avatar David S. Miller

Merge branch 'fec-align'

Eric Nelson says:

====================
net: fec: updates to align IP header

This patch series is the outcome of investigation into very high
numbers of alignment faults on kernel 4.1.33 from the linux-fslc
tree:
    https://github.com/freescale/linux-fslc/tree/4.1-1.0.x-imx

The first two patches remove support for the receive accelerator (RACC) from
the i.MX25 and i.MX27 SoCs which don't support the function.

The third patch enables hardware alignment of the ethernet packet payload
(and especially the IP header) to prevent alignment faults in the IP stack.

Testing on i.MX6UL on the 4.1.33 kernel showed that this patch removed
on the order of 70k alignment faults during a 100MiB transfer using
wget.

Testing on an i.MX6Q (SABRE Lite) board on net-next (4.8.0-rc7) showed
a much more modest improvement from 10's of faults, and it's not clear
why that's the case.
====================
Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2cf75070 3ac72b7b
...@@ -89,10 +89,10 @@ static struct platform_device_id fec_devtype[] = { ...@@ -89,10 +89,10 @@ static struct platform_device_id fec_devtype[] = {
.driver_data = 0, .driver_data = 0,
}, { }, {
.name = "imx25-fec", .name = "imx25-fec",
.driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_HAS_RACC, .driver_data = FEC_QUIRK_USE_GASKET,
}, { }, {
.name = "imx27-fec", .name = "imx27-fec",
.driver_data = FEC_QUIRK_HAS_RACC, .driver_data = 0,
}, { }, {
.name = "imx28-fec", .name = "imx28-fec",
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
...@@ -180,6 +180,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address"); ...@@ -180,6 +180,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
/* FEC receive acceleration */ /* FEC receive acceleration */
#define FEC_RACC_IPDIS (1 << 1) #define FEC_RACC_IPDIS (1 << 1)
#define FEC_RACC_PRODIS (1 << 2) #define FEC_RACC_PRODIS (1 << 2)
#define FEC_RACC_SHIFT16 BIT(7)
#define FEC_RACC_OPTIONS (FEC_RACC_IPDIS | FEC_RACC_PRODIS) #define FEC_RACC_OPTIONS (FEC_RACC_IPDIS | FEC_RACC_PRODIS)
/* /*
...@@ -945,9 +946,11 @@ fec_restart(struct net_device *ndev) ...@@ -945,9 +946,11 @@ fec_restart(struct net_device *ndev)
#if !defined(CONFIG_M5272) #if !defined(CONFIG_M5272)
if (fep->quirks & FEC_QUIRK_HAS_RACC) { if (fep->quirks & FEC_QUIRK_HAS_RACC) {
/* set RX checksum */
val = readl(fep->hwp + FEC_RACC); val = readl(fep->hwp + FEC_RACC);
/* align IP header */
val |= FEC_RACC_SHIFT16;
if (fep->csum_flags & FLAG_RX_CSUM_ENABLED) if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
/* set RX checksum */
val |= FEC_RACC_OPTIONS; val |= FEC_RACC_OPTIONS;
else else
val &= ~FEC_RACC_OPTIONS; val &= ~FEC_RACC_OPTIONS;
...@@ -1428,6 +1431,12 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) ...@@ -1428,6 +1431,12 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
prefetch(skb->data - NET_IP_ALIGN); prefetch(skb->data - NET_IP_ALIGN);
skb_put(skb, pkt_len - 4); skb_put(skb, pkt_len - 4);
data = skb->data; data = skb->data;
#if !defined(CONFIG_M5272)
if (fep->quirks & FEC_QUIRK_HAS_RACC)
data = skb_pull_inline(skb, 2);
#endif
if (!is_copybreak && need_swap) if (!is_copybreak && need_swap)
swap_buffer(data, pkt_len); swap_buffer(data, pkt_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment