]> git.sur5r.net Git - u-boot/commitdiff
net: davinci_emac: Invalidate only the received portion of a buffer
authorkarl beldan <karl.beldan@gmail.com>
Mon, 15 Aug 2016 17:23:01 +0000 (17:23 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 22 Aug 2016 19:21:13 +0000 (14:21 -0500)
ATM when receiving a packet the whole buffer is invalidated, this change
optimizes this behaviour.

Signed-off-by: Karl Beldan <karl.beldan+oss@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
drivers/net/davinci_emac.c

index 187137c8b477692dec2970047d2585e93885fb78..62834877082214b38360ee39111656187511e4a7 100644 (file)
@@ -681,12 +681,12 @@ static int davinci_eth_rcv_packet (struct eth_device *dev)
                        printf ("WARN: emac_rcv_pkt: Error in packet\n");
                } else {
                        unsigned long tmp = (unsigned long)rx_curr_desc->buffer;
+                       unsigned short len =
+                               rx_curr_desc->buff_off_len & 0xffff;
 
-                       invalidate_dcache_range(tmp, tmp + EMAC_RXBUF_SIZE);
-                       net_process_received_packet(
-                               rx_curr_desc->buffer,
-                               rx_curr_desc->buff_off_len & 0xffff);
-                       ret = rx_curr_desc->buff_off_len & 0xffff;
+                       invalidate_dcache_range(tmp, tmp + ALIGN(len, PKTALIGN));
+                       net_process_received_packet(rx_curr_desc->buffer, len);
+                       ret = len;
                }
 
                /* Ack received packet descriptor */