From: Vlastimil Setka Date: Tue, 28 Apr 2015 22:17:11 +0000 (+0200) Subject: altera_tse: Correct rx packet length X-Git-Tag: v5.15~15833^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48734994ac268eb391a66dca4cde7d08a08aba08;p=platform%2Fkernel%2Flinux-starfive.git altera_tse: Correct rx packet length 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c index 0533c05..da48e66 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;