From 307ba63f9985311d8ba032ca73dfe6dead8f78fd Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Thu, 27 Feb 2025 09:17:07 -0600 Subject: [PATCH] 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 --- lib/rfnoc/xport_sv/eth_ipv4_chdr_adapter.sv | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rfnoc/xport_sv/eth_ipv4_chdr_adapter.sv b/lib/rfnoc/xport_sv/eth_ipv4_chdr_adapter.sv index c90f766..87623e9 100644 --- a/lib/rfnoc/xport_sv/eth_ipv4_chdr_adapter.sv +++ b/lib/rfnoc/xport_sv/eth_ipv4_chdr_adapter.sv @@ -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