Skip to content

Commit 8ac0c24

Browse files
aakoskindavem330
authored andcommitted
net: stmmac: fix dropping of multi-descriptor RX frames
Packets without the last descriptor set should be dropped early. If we receive a frame larger than the DMA buffer, the HW will continue using the next descriptor. Driver mistakes these as individual frames, and sometimes a truncated frame (without the LD set) may look like a valid packet. This fixes a strange issue where the system replies to 4098-byte ping although the MTU/DMA buffer size is set to 4096, and yet at the same time it's logging an oversized packet. Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1b746ce commit 8ac0c24

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/enh_desc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
201201
if (unlikely(rdes0 & RDES0_OWN))
202202
return dma_own;
203203

204+
if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
205+
stats->rx_length_errors++;
206+
return discard_frame;
207+
}
208+
204209
if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) {
205210
if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) {
206211
x->rx_desc++;

0 commit comments

Comments
 (0)