From nobody Thu Dec 21 15:13:35 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Swv8Q5k65z54v5H; Thu, 21 Dec 2023 15:13:42 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Swv8Q3wP5z4gDb; Thu, 21 Dec 2023 15:13:42 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-78101108e3fso53073185a.1; Thu, 21 Dec 2023 07:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703171620; x=1703776420; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Kjg0KDS3OBpoDljwmB4O/qzKq+4xpnq94RgsPMe/kOY=; b=Rxc6csl1hylh/ntd65RoauJ9op5McHbTPEpKIpiMgcWHRnqVefgFUxyMrB3GvNeLpX NRUmJiusIxOIVdygUXAlBaciJgztgMyC1nyH66tNlA6vfgqTYmOyvfSxCeyP4T1cIpu8 lCSdvECuwAU0KZV9FCQLdQecZI9iDHub3+pJdl1jCSK3TNcLbsmoVvBg9Cr5axhqDCPz 0z6q+FtbZXUSNeMU78XIwCooUfHNVWSFaAeaAFZ3vwXvokxTrhMmu7od5BdTLKwlMGm9 aMmi79d4MeRx+2UsLvNpkjCKE/4CqucpwAP300dhai1HjVw0UNZwdxq9LsP4unnAAGdF FufQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703171620; x=1703776420; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kjg0KDS3OBpoDljwmB4O/qzKq+4xpnq94RgsPMe/kOY=; b=KtC9FfZpMR73DRgOFKiYFNAyi9PLIJbR0AlugzZeiQvWF2xkLlXq8UKemT8+Wlqj52 lsBT3XdT23QlZEDX3ls7hZihzSk8WkMctUX4CRbHmj4sKYUuf6n6lnM26L0Pjp0ytqN2 DZIne9vrgyV6HV2Y5HgnKvl0DR/8VTOKeNt8If2zmodDI4483K7YX0Sg2ImOBUV3a4iH rG4Y4lR5H+h9FTuPqML+KaywCfLOPYUh8deaNEiZwHf6f/+GG4JSOc6WHZ3VBC/b3XkG 5aBqe5xuaCR8lb+vx5ptmmGXnnTWL4NeaZt0Qlj7HWriN4d3+ctieWw9Pt3HICn8Isua jqBw== X-Gm-Message-State: AOJu0Yy776fNWH5ZgcTRVpAt7SS+tIFrUwq1SpaApQmTOewfvQviifBR GeNI0+TM9yCfNtTzRTLaLimG7iHviGktpw== X-Google-Smtp-Source: AGHT+IHbW9Sd737yCyZk4snfoHCpgun8Eobz7zqQ8atEH+ba6icoTmumbKP9d4F5ma4eCCSQ8GqoZQ== X-Received: by 2002:a05:620a:600b:b0:781:15f2:9c55 with SMTP id dw11-20020a05620a600b00b0078115f29c55mr3033025qkb.140.1703171620140; Thu, 21 Dec 2023 07:13:40 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id a39-20020a05620a43a700b0078108a4a7cdsm709827qkp.108.2023.12.21.07.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 07:13:38 -0800 (PST) Date: Thu, 21 Dec 2023 10:13:35 -0500 From: Mark Johnston To: Warner Losh Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9e6d11ce9a51 - main - vtnet: Adjust rx buffer so IP header 32-bit aligned Message-ID: References: <202312210421.3BL4Lb9T036317@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202312210421.3BL4Lb9T036317@gitrepo.freebsd.org> X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4Swv8Q3wP5z4gDb On Thu, Dec 21, 2023 at 04:21:37AM +0000, Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9e6d11ce9a51d75ed6a94e180f2fb4e9188a2ba4 > > commit 9e6d11ce9a51d75ed6a94e180f2fb4e9188a2ba4 > Author: Warner Losh > AuthorDate: 2023-12-20 19:09:09 +0000 > Commit: Warner Losh > CommitDate: 2023-12-21 04:16:45 +0000 > > vtnet: Adjust rx buffer so IP header 32-bit aligned > > Call madj(m, ETHER_ALIGN) to offset rx buffers when allocating them. > This improves performance everywhere, and allows armv7 to work at all. > > PR: 271288 (PR had a different fix than I wound up with) > MFC After: 3 days > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D43136 > --- > sys/dev/virtio/network/if_vtnet.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c > index 287af7751066..360176e4f845 100644 > --- a/sys/dev/virtio/network/if_vtnet.c > +++ b/sys/dev/virtio/network/if_vtnet.c > @@ -1532,8 +1532,8 @@ vtnet_rx_alloc_buf(struct vtnet_softc *sc, int nbufs, struct mbuf **m_tailp) > m_freem(m_head); > return (NULL); > } > - > m->m_len = size; > + m_adj(m, ETHER_ALIGN); The driver is expecting to get a cluster of size sc->vtnet_rx_clustersz, but now it's getting one of size sc->vtnet_rx_clustersz - 2. I don't see how this change can be sufficient on its own: what prevents virtio from writing sc->vtnet_rx_clustersz bytes and thereby overwriting the two bytes following the cluster? > if (m_head != NULL) { > m_tail->m_next = m; > m_tail = m;