[U-Boot] [PATCH v2 0/2] davinci emac dcache ops on buffers

Changes from v1:
- Prefer dcache_op(base, base + ALIGN(len, PKTALIGN)) to dcache_op(base, round_up(base + len, ARCH_DMA_MINALIGN)) as suggested by Tom and Joe.
- In v2_1/2, explicitly align the top tx buffers only since the rx top ones are obviously already properly aligned.
Karl Beldan (2): net: davinci_emac: Round up top tx buffer boundaries for dcache ops net: davinci_emac: Invalidate only the received portion of a buffer
drivers/net/davinci_emac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)

check_cache_range() warns that the top boundaries are not properly aligned when flushing or invalidating the buffers and make these operations fail.
This gets rid of the remaining warnings: CACHE: Misaligned operation at range
Signed-off-by: Karl Beldan karl.beldan+oss@gmail.com --- drivers/net/davinci_emac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 947bfab..62b7a1d 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -632,7 +632,7 @@ static int davinci_eth_send_packet (struct eth_device *dev, EMAC_CPPI_EOP_BIT);
flush_dcache_range((unsigned long)packet, - (unsigned long)packet + length); + (unsigned long)packet + ALIGN(length, PKTALIGN));
/* Send the packet */ writel(BD_TO_HW((unsigned long)emac_tx_desc), &adap_emac->TX0HDP);

On Mon, Aug 15, 2016 at 12:23 PM, Karl Beldan karl.beldan@gmail.com wrote:
check_cache_range() warns that the top boundaries are not properly aligned when flushing or invalidating the buffers and make these operations fail.
This gets rid of the remaining warnings: CACHE: Misaligned operation at range
Signed-off-by: Karl Beldan karl.beldan+oss@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

On Mon, Aug 15, 2016 at 05:23:00PM +0000, Karl Beldan wrote:
check_cache_range() warns that the top boundaries are not properly aligned when flushing or invalidating the buffers and make these operations fail.
This gets rid of the remaining warnings: CACHE: Misaligned operation at range
Signed-off-by: Karl Beldan karl.beldan+oss@gmail.com
Reviewed-by: Tom Rini trini@konsulko.com

On Monday 15 August 2016 10:53 PM, Karl Beldan wrote:
check_cache_range() warns that the top boundaries are not properly aligned when flushing or invalidating the buffers and make these operations fail.
This gets rid of the remaining warnings: CACHE: Misaligned operation at range
Signed-off-by: Karl Beldan karl.beldan+oss@gmail.com
Reviewed-by: Mugunthan V N mugunthanvnm@ti.com
Regards Mugunthan V N


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 --- drivers/net/davinci_emac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 62b7a1d..f43130a 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -676,12 +676,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 */

On Mon, Aug 15, 2016 at 12:23 PM, Karl Beldan karl.beldan@gmail.com wrote:
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

On Mon, Aug 15, 2016 at 05:23:01PM +0000, Karl Beldan wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com

On Monday 15 August 2016 10:53 PM, Karl Beldan wrote:
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
Reviewed-by: Mugunthan V N mugunthanvnm@ti.com
Regards Mugunthan V N

participants (5)
-
Joe Hershberger
-
Joe Hershberger
-
Karl Beldan
-
Mugunthan V N
-
Tom Rini