From nobody Sat Nov 15 14:13:27 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1751547473; cv=none; d=zohomail.com; s=zohoarc; b=lO3vhf1bTK4H7PdGynZzW3+g9Jbyj4oinPGMJfmaaQq0tjveO3p216Ya75uQ4qiDXRDPw71KL2AoqVPhCcDvvAVk2CASL3Zbr4lUDwAX1/sDRT4jBnHcsSRa2Zc91CSKFt8eaj9w4evP05VJlmfKcWBR9e0GptoxZbo+LwfNKmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751547473; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K1guSZvgPSyqTL8nJpBNAWLbXMO659zzSoxEpeUp2kw=; b=avWqAJp3VDE0u+v01+SKBu0Hs2pzMTjYuBEMWmk4EKqR5w9iwnh2TGjBlSj0uo9LicF3F5IxkEl7CDwYheYgmfPBG2mUJcDeOLm1Q7dAtdMtOWgDUZ1kWCGRv0/jDkobxfGQ48TP8vUGb4Sv4sLzeL5fTyaKlEI9TpRo1h2acwY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751547473170665.2221862345568; Thu, 3 Jul 2025 05:57:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uXJNP-0007Vi-NW; Thu, 03 Jul 2025 08:49:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLk-0005fo-IA; Thu, 03 Jul 2025 08:47:36 -0400 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uXJLc-0006o2-Kn; Thu, 03 Jul 2025 08:47:35 -0400 Received: from mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net [IPv6:2a02:6b8:c10:4a1:0:640:2691:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id D835A60CAF; Thu, 3 Jul 2025 15:47:20 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:73d::1:28]) by mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id HlbMgQ0FgSw0-4uj2EH2p; Thu, 03 Jul 2025 15:47:20 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1751546840; bh=K1guSZvgPSyqTL8nJpBNAWLbXMO659zzSoxEpeUp2kw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=oT0rtWYc1KEms+cwhH746I/KLz3WIwZ9MO27cx6K4WnY8/m2n8+VCbjCfnAgTtXas J0xlK7WTViqAd7CKudxWXv5/9LsuqH104Svanj9SGG+RSxxjm4ntH+6lmhzN4BGWzy kMy/6kK8a3F8ziiQtjsXx3OhUua0ZFC1I/1u3cfg= Authentication-Results: mail-nwsmtp-smtp-corp-canary-81.sas.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, mst@redhat.com Cc: qemu-block@nongnu.org, fam@euphon.net, pbonzini@redhat.com, jasowang@redhat.com, hreitz@redhat.com, kwolf@redhat.com, sgarzare@redhat.com, raphael@enfabrica.net, Vladimir Sementsov-Ogievskiy Subject: [PATCH 3/4] vhost_net: stop use backend_features Date: Thu, 3 Jul 2025 15:47:11 +0300 Message-ID: <20250703124713.2530079-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250703124713.2530079-1-vsementsov@yandex-team.ru> References: <20250703124713.2530079-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.237, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1751547474204116600 Content-Type: text/plain; charset="utf-8" We are going to drop backend_features variable as an extra one. Call to qemu_has_vnet_hdr() is cheap. Signed-off-by: Vladimir Sementsov-Ogievskiy --- hw/net/vhost_net.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 891f235a0a6..38cbc6caa14 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -139,7 +139,8 @@ int vhost_net_set_config(struct vhost_net *net, const u= int8_t *data, =20 void vhost_net_ack_features(struct vhost_net *net, uint64_t features) { - net->dev.acked_features =3D net->dev.backend_features; + net->dev.acked_features =3D qemu_has_vnet_hdr(net->nc) + ? 0 : (1ULL << VHOST_NET_F_VIRTIO_NET_HDR); vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), feature= s); } =20 @@ -338,12 +339,9 @@ struct vhost_net *vhost_net_init(VhostNetOptions *opti= ons) if (r < 0) { goto fail; } - net->dev.backend_features =3D qemu_has_vnet_hdr(options->net_backe= nd) - ? 0 : (1ULL << VHOST_NET_F_VIRTIO_NET_HDR); net->backend =3D r; net->dev.protocol_features =3D 0; } else { - net->dev.backend_features =3D 0; net->dev.protocol_features =3D 0; net->backend =3D -1; =20 @@ -363,10 +361,10 @@ struct vhost_net *vhost_net_init(VhostNetOptions *opt= ions) sizeof(struct virtio_net_hdr_mrg_rxbuf))) { net->dev.features &=3D ~(1ULL << VIRTIO_NET_F_MRG_RXBUF); } - if (~net->dev.features & net->dev.backend_features) { - fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64 - " for backend\n", - (uint64_t)(~net->dev.features & net->dev.backend_featur= es)); + if (!qemu_has_vnet_hdr(options->net_backend) && + (~net->dev.features & (1ULL << VHOST_NET_F_VIRTIO_NET_HDR))) { + fprintf(stderr, "vhost lacks feature mask 0x%llx for backend\n= ", + ~net->dev.features & (1ULL << VHOST_NET_F_VIRTIO_NET_H= DR)); goto fail; } } --=20 2.48.1