Author: jrtc27
Date: Sun Jun 14 22:39:34 2020
New Revision: 362186
URL: https://svnweb.freebsd.org/changeset/base/362186

Log:
  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

Modified:
  head/sys/dev/virtio/network/if_vtnet.c

Modified: head/sys/dev/virtio/network/if_vtnet.c
==============================================================================
--- head/sys/dev/virtio/network/if_vtnet.c      Sun Jun 14 21:07:12 2020        
(r362185)
+++ head/sys/dev/virtio/network/if_vtnet.c      Sun Jun 14 22:39:34 2020        
(r362186)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to