Commit 55e11ee7 authored by Sekhar Nori's avatar Sekhar Nori Committed by Kevin Hilman

ARM: DaVinci: EMAC: Fix alignment traps on packet reception

The skb data allocated for packet data received is 4 byte aligned.

Unfortunately, this causes non-32bit aligned accesses in IP stack because
the MAC header is non-word aligned (14 bytes).

The result can be observed by looking at /proc/cpu/alignment while the
device is over network.

Doing an skb_reserve(NET_IP_ALIGN) as other driver do fixed the issue.

A quick performance test over lab network using iperf on DM6446 EVM showed
an increase in bandwidth from 60Mbits/s to 70Mbits/s.
Signed-off-by: default avatarSteve Chen <schen@mvista.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 061fb851
......@@ -1558,6 +1558,7 @@ static void *emac_net_alloc_rx_buf(struct emac_priv *priv, int buf_size,
/* set device pointer in skb and reserve space for extra bytes */
p_skb->dev = ndev;
skb_reserve(p_skb, NET_IP_ALIGN);
*data_token = (void *) p_skb;
EMAC_CACHE_WRITEBACK_INVALIDATE((unsigned long)p_skb->data, buf_size);
return p_skb->data;
......@@ -1986,8 +1987,7 @@ static int emac_rx_bdproc(struct emac_priv *priv, u32 ch, u32 budget,
((frame_status & EMAC_CPPI_OWNERSHIP_BIT) == 0) &&
(pkts_processed < budget)) {
new_buffer = emac_net_alloc_rx_buf(priv,
EMAC_DEF_MAX_FRAME_SIZE,
new_buffer = emac_net_alloc_rx_buf(priv, rxch->buf_size,
&new_buf_token, EMAC_DEF_RX_CH);
if (unlikely(NULL == new_buffer)) {
++rxch->out_of_rx_buffers;
......@@ -2408,7 +2408,7 @@ static int emac_dev_open(struct net_device *ndev)
ndev->dev_addr[cnt] = priv->mac_addr[cnt];
/* Configuration items */
priv->rx_buf_size = EMAC_DEF_MAX_FRAME_SIZE;
priv->rx_buf_size = EMAC_DEF_MAX_FRAME_SIZE + NET_IP_ALIGN;
/* Clear basic hardware */
for (ch = 0; ch < EMAC_MAX_TXRX_CHANNELS; ch++) {
......
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