diff options
author | Joakim Zhang <qiangqing.zhang@nxp.com> | 2021-02-25 17:01:13 +0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-02-26 15:17:11 -0800 |
commit | 396e13e11577b614db77db0bbb6fca935b94eb1b (patch) | |
tree | 2d7bc6cea29c9fea17b0758a224f96e26321f5a7 /drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | |
parent | bfaf91ca848e758ed7be99b61fd936d03819fa56 (diff) | |
download | lwn-396e13e11577b614db77db0bbb6fca935b94eb1b.tar.gz lwn-396e13e11577b614db77db0bbb6fca935b94eb1b.zip |
net: stmmac: fix wrongly set buffer2 valid when sph unsupport
In current driver, buffer2 available only when hardware supports split
header. Wrongly set buffer2 valid in stmmac_rx_refill when refill buffer
address. You can see that desc3 is 0x81000000 after initialization, but
turn out to be 0x83000000 after refill.
Fixes: 67afd6d1cfdf ("net: stmmac: Add Split Header support and enable it in XGMAC cores")
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index ee87811b0ca5..cbf4429fb1d2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c @@ -533,10 +533,15 @@ static void dwmac4_get_rx_header_len(struct dma_desc *p, unsigned int *len) *len = le32_to_cpu(p->des2) & RDES2_HL; } -static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr) +static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool buf2_valid) { p->des2 = cpu_to_le32(lower_32_bits(addr)); - p->des3 = cpu_to_le32(upper_32_bits(addr) | RDES3_BUFFER2_VALID_ADDR); + p->des3 = cpu_to_le32(upper_32_bits(addr)); + + if (buf2_valid) + p->des3 |= cpu_to_le32(RDES3_BUFFER2_VALID_ADDR); + else + p->des3 &= cpu_to_le32(~RDES3_BUFFER2_VALID_ADDR); } static void dwmac4_set_tbs(struct dma_edesc *p, u32 sec, u32 nsec) |