On 9/14/26 3:34 PM, Zhuoying Cai wrote:
> The virtio-net device used a fixed header size that did not account for
> the num_buffers field used in VirtIO 1.0.
>
> Use dynamic header sizing: 10 bytes for legacy mode and 12 bytes for
> VirtIO 1.0. This ensures correct packet handling across different
> VirtIO configurations.
>
> The VirtioNetHdr and VirtioNetHdrMrgRxbuf structures replicate the
> same field layout as struct virtio_net_hdr and struct
> virtio_net_hdr_mrg_rxbuf defined in inux/uapi/linux/virtio_net.h.
Path needs to be fixed above.
[...]
>
> +struct VirtioNetHdrMrgRxbuf {
> + struct VirtioNetHdr hdr;
> + uint16_t num_buffers; /* Only with VIRTIO_NET_F_MRG_RXBUF or VIRTIO1 */
> +};
> +typedef struct VirtioNetHdrMrgRxbuf VirtioNetHdrMrgRxbuf;
Thanks for changing to match the uapi.
Shouldn't you now remove the commented out instance of num_buffers in
VirtioNetHdr? VirtioNetHdrMrgRxbuf should be used in that case.
With these minor changes:
Reviewed-by: Matthew Rosato <[email protected]>