hw/net/e1000e_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
The FCS append condition checks desc_offset before it is updated with
the payload copied into the current descriptor. This causes FCS bytes
to be placed in a separate descriptor even when the current buffer has
enough space.
With KEEP_CRC enabled, the DPDK em non-scattered receive path subtracts
four bytes from the first descriptor's length, truncating a 98-byte
ICMP frame to 94 bytes.
Include desc_size in both the FCS append condition and the remaining
length calculation so that FCS is appended to the current descriptor
when space permits.
Signed-off-by: Chengbo Gao <gaochengbo@bosc.ac.cn>
---
hw/net/e1000e_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index b87a9f167a..6a01481e22 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -1601,7 +1601,8 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
}
if (rx_desc_buf_size &&
- desc_offset >= size && desc_offset < total_size) {
+ desc_offset + desc_size >= size &&
+ desc_offset + desc_size < total_size) {
/*
* We are in the last 4 bytes corresponding to the FCS checksum.
* We only ever write zeroes here (unlike the hardware).
@@ -1609,7 +1610,7 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
static const uint32_t fcs_pad;
/* Amount of space for the trailing checksum */
size_t fcs_len = MIN(rx_desc_buf_size,
- total_size - desc_offset);
+ total_size - (desc_offset + desc_size));
e1000e_write_payload_frag_to_rx_buffers(core, ba, &bastate,
(const char *)&fcs_pad,
fcs_len);
--
2.43.0
On Tue, Nov 17, 2026 at 9:41 AM Chengbo Gao <gaochengbo@bosc.ac.cn> wrote:
>
> The FCS append condition checks desc_offset before it is updated with
> the payload copied into the current descriptor. This causes FCS bytes
> to be placed in a separate descriptor even when the current buffer has
> enough space.
>
> With KEEP_CRC enabled, the DPDK em non-scattered receive path subtracts
> four bytes from the first descriptor's length, truncating a 98-byte
> ICMP frame to 94 bytes.
>
> Include desc_size in both the FCS append condition and the remaining
> length calculation so that FCS is appended to the current descriptor
> when space permits.
>
> Signed-off-by: Chengbo Gao <gaochengbo@bosc.ac.cn>
> ---
> hw/net/e1000e_core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index b87a9f167a..6a01481e22 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -1601,7 +1601,8 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
> }
>
> if (rx_desc_buf_size &&
> - desc_offset >= size && desc_offset < total_size) {
> + desc_offset + desc_size >= size &&
> + desc_offset + desc_size < total_size) {
> /*
> * We are in the last 4 bytes corresponding to the FCS checksum.
> * We only ever write zeroes here (unlike the hardware).
> @@ -1609,7 +1610,7 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
> static const uint32_t fcs_pad;
> /* Amount of space for the trailing checksum */
> size_t fcs_len = MIN(rx_desc_buf_size,
> - total_size - desc_offset);
> + total_size - (desc_offset + desc_size));
> e1000e_write_payload_frag_to_rx_buffers(core, ba, &bastate,
> (const char *)&fcs_pad,
> fcs_len);
> --
> 2.43.0
>
Queued.
Thanks
© 2016 - 2026 Red Hat, Inc.