From: Sekhar Nori <[email protected]> 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: Steve Chen <[email protected]> Signed-off-by: Sekhar Nori <[email protected]> --- This patch depends on the "EMAC: remove "extra" bytes provision in rx buffer" patch submitted earlier drivers/net/davinci_emac.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 36a9aba..a766066 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -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++) { -- 1.6.0.3 _______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
