netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] altera_tse: Correct rx packet length
@ 2015-04-28 22:17 Vlastimil Setka
  2015-04-29 19:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vlastimil Setka @ 2015-04-28 22:17 UTC (permalink / raw)
  To: vbridger, netdev

From: Vlastimil Setka <setka@vsis.cz>

Altera TSE MAC rx DMA transfer starts with the 2 additional bytes for IP
payload alignment. This patch fixes tse_rx() function loop which reads DMA
rx status and extracts packet length from it. Status signalises a whole DMA
transfer length, which is 2 bytes longer than the packet itself.

Signed-off-by: Vlastimil Setka <setka@vsis.cz>
---
 drivers/net/ethernet/altera/altera_tse_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 90a7630..592ef28 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -391,6 +391,12 @@ static int tse_rx(struct altera_tse_private *priv, int limit)
 				   "RCV pktstatus %08X pktlength %08X\n",
 				   pktstatus, pktlength);
 
+		/* DMA trasfer from TSE starts with 2 aditional bytes for
+		 * IP payload alignment. Status returned by get_rx_status()
+		 * contains DMA transfer length. Packet is 2 bytes shorter.
+		 */
+		pktlength -= 2;
+
 		count++;
 		next_entry = (++priv->rx_cons) % priv->rx_ring_size;
 
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] altera_tse: Correct rx packet length
  2015-04-28 22:17 [PATCH] altera_tse: Correct rx packet length Vlastimil Setka
@ 2015-04-29 19:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-04-29 19:20 UTC (permalink / raw)
  To: setka; +Cc: vbridger, netdev

From: Vlastimil Setka <setka@vsis.cz>
Date: Wed, 29 Apr 2015 00:17:11 +0200

> From: Vlastimil Setka <setka@vsis.cz>
> 
> Altera TSE MAC rx DMA transfer starts with the 2 additional bytes for IP
> payload alignment. This patch fixes tse_rx() function loop which reads DMA
> rx status and extracts packet length from it. Status signalises a whole DMA
> transfer length, which is 2 bytes longer than the packet itself.
> 
> Signed-off-by: Vlastimil Setka <setka@vsis.cz>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-29 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 22:17 [PATCH] altera_tse: Correct rx packet length Vlastimil Setka
2015-04-29 19:20 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).