From owner-svn-src-head@freebsd.org Sun Jun 14 20:56:07 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 A12A03449D6 for ; Sun, 14 Jun 2020 20:56:07 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49lRZZ6LDmz4s9B for ; Sun, 14 Jun 2020 20:56:06 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f65.google.com with SMTP id y20so12844424wmi.2 for ; Sun, 14 Jun 2020 13:56:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=cNwu/trXfmxkiH6gJQxC/Bp9+cfnTgp6P0B/RjqV4t4=; b=I4CJZdyUo5kywOJQEhM5l9N6z9b/aKoJE6kbm3o1o9fjUJSEd4w29mDh1sOgYT611l 3fqLriWOeEx1J8n1W3Td/JIxgvsxhXfmtWV+2UG14cacDGed/VrKlqw5c2jyl2khFinp mAZ2qO+ngBPd2T4OEciguvIefa7Gpz6mkxJFQ5fukUNJhSLIvfnCBeGoQa4/Ioqy9RyU hf2DHNNx+mBmrxhtHZAdWBMaZ/jbxlrZp4WzQRswJHhuVlyE6nCHOKT9F8DMqy1vx1o8 mxCdbVelNw3wIeisPsxi7lyZKep7FDGDP7AyLeHd+s6nmVW1R4p/24T3v7/r9Ou6gXkQ /gXg== X-Gm-Message-State: AOAM532sW3JXjmbvAWXfv3NJBriGtsadN6+P9Wj96fazzQpY8pY1PIxF AcLz+b7ZDsyk77OxxPBdFkh2Nw== X-Google-Smtp-Source: ABdhPJyMlnKzKgmfWVFlF1szl7fKzGPVr6Gfh93KH/1O9lwU2fC7WhSajQJIY2+2hPlvQ3ytFiN6dw== X-Received: by 2002:a1c:a444:: with SMTP id n65mr9194019wme.99.1592168165139; Sun, 14 Jun 2020 13:56:05 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id t8sm19175249wmi.46.2020.06.14.13.56.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jun 2020 13:56:04 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r361944 - in head/sys/dev/virtio: . network From: Jessica Clarke In-Reply-To: <20200614195126.GB68578@tom-desk.erg.abdn.ac.uk> Date: Sun, 14 Jun 2020 21:56:03 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <97EEF019-16A4-4626-A484-A00979B52A74@freebsd.org> References: <202006082151.058LpabU003001@repo.freebsd.org> <20200614195126.GB68578@tom-desk.erg.abdn.ac.uk> To: Tom Jones X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49lRZZ6LDmz4s9B X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.65 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-1.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.05)[-1.047]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.17)[-0.168]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.65:from]; NEURAL_HAM_MEDIUM(-0.99)[-0.989]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.65:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_TLS_ALL(0.00)[] 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 20:56:07 -0000 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 >>=20 >> Log: >> virtio: Support non-legacy network device and queue >>=20 >> 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. >>=20 >> Reviewed by: br, brooks (mentor), jhb (mentor) >> Approved by: br, brooks (mentor), jhb (mentor) >> Differential Revision: https://reviews.freebsd.org/D25132 >>=20 >> 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 >>=20 >=20 > Hi Jessica, >=20 > 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. >=20 > If I capture on the tap interface for the vm I see arp requests and = arp > replies, however kern.msgbuf is full of:=20 >=20 > <5>arp: short packet received on vtnet0 >=20 > and netstat does not see any replies to arp requests: >=20 > 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 >=20 > 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.=20 >=20 > 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 >=20 > The line >=20 > 7 with data size < data length >=20 > makes me think that vtnet is truncating packets.=20 >=20 > markj pointed me at this bug in irc which might also be related: >=20 > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D247242 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 =3D 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 +=3D VTNET_RX_HEADER_PAD; + len +=3D adjsz - sc->vtnet_hdr_size; } else { mhdr =3D mtod(m, struct virtio_net_hdr_mrg_rxbuf *); nbufs =3D mhdr->num_buffers;