vtnet: Fix regression introduced in r361944

For legacy devices that don't support MrgRxBuf (such as bhyve pre-r358180),
r361944 failed to update the receive handler to account for the additional
padding introduced by the unused num_buffers field that is now always present
in struct vtnet_rx_header. Thus, calculate the padding dynamically based on
vtnet_hdr_size.

PR:		247242
Reported by:	thj
Tested by:	thj
This commit is contained in:
Jessica Clarke 2020-06-14 22:39:34 +00:00
parent 0a182b4c63
commit 576b099a5f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362186

View File

@ -1819,9 +1819,10 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq)
adjsz = sizeof(struct vtnet_rx_header);
/*
* Account for our pad inserted between the header
* and the actual start of the frame.
* and the actual start of the frame. This includes
* the unused num_buffers when using a legacy device.
*/
len += VTNET_RX_HEADER_PAD;
len += adjsz - sc->vtnet_hdr_size;
} else {
mhdr = mtod(m, struct virtio_net_hdr_mrg_rxbuf *);
nbufs = mhdr->num_buffers;