]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: stmmac: xgmac: Only get SPH header len if available
authorJose Abreu <Jose.Abreu@synopsys.com>
Wed, 6 Nov 2019 15:02:58 +0000 (16:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Nov 2019 05:22:55 +0000 (21:22 -0800)
Split Header length is only available when L34T == 0. Fix this by
correctly checking if L34T is zero before trying to get Header length.

Fixes: 3e4d2632676a ("net: stmmac: Add Split Header support and enable it in XGMAC cores")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c

index ae48154f933cb1bd3e192874d77f76866478e566..bd5838ce1e8a9d8343e735cb30502010b780ce7c 100644 (file)
@@ -288,7 +288,8 @@ static int dwxgmac2_get_rx_hash(struct dma_desc *p, u32 *hash,
 
 static int dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len)
 {
-       *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL;
+       if (le32_to_cpu(p->des3) & XGMAC_RDES3_L34T)
+               *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL;
        return 0;
 }