Skip to contentSkip to conversation

davinci emac dcache ops on buffers

PATCH In review Karl Beldan 5 participants 11 messages Aug 15, 2016 – Aug 23, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

v2 cover 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(-)
Signature · 1 line
2.9.2
#1 lore raw

PATCH v2 1/2 net: davinci_emac: Round up top tx buffer boundaries for dcache ops

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

---
 drivers/net/davinci_emac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/davinci_emac.c +1 -1
index 947bfab..62b7a1d 100644
@@ -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);
Signature · 1 line
2.9.2
#2 lore raw

PATCH v2 1/2 net: davinci_emac: Round up top tx buffer boundaries for dcache ops

Quoted 8 lines · Karl Beldan

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

#3 lore raw

PATCH v2 1/2 net: davinci_emac: Round up top tx buffer boundaries for dcache ops

In reply to Karl Beldan
Quoted 8 lines · Karl Beldan

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

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160815/08a03255/attachment.sig>
#4 lore raw

PATCH v2 1/2 net: davinci_emac: Round up top tx buffer boundaries for dcache ops

In reply to Karl Beldan
Quoted 8 lines · Karl Beldan

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

Regards
Mugunthan V N

#6 lore raw

PATCH v2 2/2 net: davinci_emac: Invalidate only the received portion of a buffer

In reply to Karl Beldan

ATM when receiving a packet the whole buffer is invalidated, this change optimizes this behaviour.

---
 drivers/net/davinci_emac.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/davinci_emac.c +5 -5
index 62b7a1d..f43130a 100644
@@ -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 */
Signature · 1 line
2.9.2
#8 lore raw

PATCH v2 2/2 net: davinci_emac: Invalidate only the received portion of a buffer

In reply to Karl Beldan
Quoted 4 lines · Karl Beldan

ATM when receiving a packet the whole buffer is invalidated, this change optimizes this behaviour.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160815/8807feb7/attachment.sig>