From owner-svn-src-head@freebsd.org Sun Jun 14 21:09:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D767F345666; Sun, 14 Jun 2020 21:09:19 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49lRsq5HZHz4tlS; Sun, 14 Jun 2020 21:09:19 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id AB429200A4; Sun, 14 Jun 2020 21:09:19 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-qt1-f175.google.com with SMTP id g18so11113184qtu.13; Sun, 14 Jun 2020 14:09:19 -0700 (PDT) X-Gm-Message-State: AOAM5318rtRGvrCdS+0Wgqe3ab5bjcLQSZ8nwpRB3H7NSNi6dn4XuqMB aGtmXBwItRBdcwyECJSlioO/WeaElqiJlbLjTfg= X-Google-Smtp-Source: ABdhPJyQpogVILVqiowmZfnC0UqTf85YtfR36gdjNySzbMjXDmPd6aafjPjax2W0aFvFjc6oBkomHWsUWq3SZ2kwkGI= X-Received: by 2002:aed:3c58:: with SMTP id u24mr12543080qte.309.1592168959239; Sun, 14 Jun 2020 14:09:19 -0700 (PDT) MIME-Version: 1.0 References: <202006082151.058LpabU003001@repo.freebsd.org> <20200614195126.GB68578@tom-desk.erg.abdn.ac.uk> <97EEF019-16A4-4626-A484-A00979B52A74@freebsd.org> In-Reply-To: <97EEF019-16A4-4626-A484-A00979B52A74@freebsd.org> From: Vincenzo Maffione Date: Sun, 14 Jun 2020 23:09:07 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361944 - in head/sys/dev/virtio: . network To: Jessica Clarke Cc: Tom Jones , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2020 21:09:19 -0000 You may already know that, but FreeBSD-CURRENT supports mergeable rx buffers as of r358180. Cheers, Vincenzo Il giorno dom 14 giu 2020 alle ore 22:56 Jessica Clarke ha scritto: > On 14 Jun 2020, at 20:51, Tom Jones wrote: > > On Mon, Jun 08, 2020 at 09:51:36PM +0000, Jessica Clarke wrote: > >> Author: jrtc27 > >> Date: Mon Jun 8 21:51:36 2020 > >> New Revision: 361944 > >> URL: https://svnweb.freebsd.org/changeset/base/361944 > >> > >> Log: > >> virtio: Support non-legacy network device and queue > >> > >> The non-legacy interface always defines num_buffers in the header, > >> regardless of whether VIRTIO_NET_F_MRG_RXBUF, just leaving it unused. > We > >> also need to ensure our virtqueue doesn't filter out VIRTIO_F_VERSION_1 > >> during negotiation, as it supports non-legacy transports just fine. > This > >> fixes network packet transmission on TinyEMU. > >> > >> Reviewed by: br, brooks (mentor), jhb (mentor) > >> Approved by: br, brooks (mentor), jhb (mentor) > >> Differential Revision: https://reviews.freebsd.org/D25132 > >> > >> Modified: > >> head/sys/dev/virtio/network/if_vtnet.c > >> head/sys/dev/virtio/network/if_vtnetvar.h > >> head/sys/dev/virtio/virtio.c > >> head/sys/dev/virtio/virtqueue.c > >> > > > > Hi Jessica, > > > > After updating my current bhyve vm today (on a 12.1 host), networking no > longer > > works. Reverting this commit seems to resolve the issue. I think vtnet > is not > > passing enough data up to the ip layer. > > > > If I capture on the tap interface for the vm I see arp requests and arp > > replies, however kern.msgbuf is full of: > > > > <5>arp: short packet received on vtnet0 > > > > and netstat does not see any replies to arp requests: > > > > root@freebsd-current:~ # netstat -s -p arp > > arp: > > 11 ARP requests sent > > 0 ARP requests failed to sent > > 0 ARP replies sent > > 0 ARP requests received > > 0 ARP replies received > > 0 ARP packets received > > 24 total packets dropped due to no ARP entry > > 2 ARP entrys timed out > > 0 Duplicate IPs seen > > > > If I set up an arp entry manually I can see ICMP echo requests and > responses on > > the tap interface, but the vm does not see the responses. > > > > root@freebsd-current:~ # netstat -s -p ip > > ip: > > 7 total packets received > > 0 bad header checksums > > 0 with size smaller than minimum > > 7 with data size < data length > > 0 with ip length > max ip packet size > > 0 with header length < data size > > 0 with data length < header length > > > > The line > > > > 7 with data size < data length > > > > makes me think that vtnet is truncating packets. > > > > markj pointed me at this bug in irc which might also be related: > > > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247242 > > Hi Tom, > Sorry about that; it seems bhyve hits the "legacy and no MrgRxBuf" > case. Could you please try the patch below? > > Jess > > diff --git a/sys/dev/virtio/network/if_vtnet.c > b/sys/dev/virtio/network/if_vtnet.c > index 7a0859cc0eb1..7e10b75f7f66 100644 > --- a/sys/dev/virtio/network/if_vtnet.c > +++ b/sys/dev/virtio/network/if_vtnet.c > @@ -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; > >