fpga: lib: Fix trailing bytes in eth_ipv4_chdr_adapter

On the CPU to Ethernet path (c2e) in some configurations the trailing
bytes length was not being properly set in TUSER. This can lead to
extra bytes being added onto packets. Most of the time this is fine,
since the extra bytes would be ignored by the underlying protocols.
But when the packet was near the MTU size, it could lead to an
oversized packet that would get dropped by the network or host
computer.


Original-commit: 00d9a228f58b384798f0a1346fbab8f40b017a9c
This commit is contained in:
Wade Fife
2025-03-03 09:02:29 -06:00
parent 4eb1279423
commit 307ba63f99
@@ -385,6 +385,11 @@ module eth_ipv4_chdr_adapter #(
end else begin : gen_c2e_width_match
always_comb begin : c2e1_assign
`AXI4S_ASSIGN(c2e1,c2eD)
// c2e1 uses trailing bytes in tuser instead of tkeep, so do the
// conversion here, if necessary.
if (!c2eD.TUSER) begin
c2e1.tuser = c2eD.keep2trailing(c2eD.tkeep);
end
end
end