From nobody Wed Nov 27 16:54:50 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697739748; cv=none; d=zohomail.com; s=zohoarc; b=kuPzZgoeDvY2sXGipbtz3YOBt8Kv+pmnya/R6Lh7pO7jBC29WsPhignC0CbiOaBrIYwVk7yzQ3D2W+iCIVY/n9IFkp3SIOUoK3C/zudNhuPkfmUTxV+BvIO++scaVzhVRYAxYYf01XjSP9+Qa4IH8lc4yome+OnVMc558dl9iv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697739748; h=Content-Type: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=UQlj+8sgMBKeSBER7AOYNOJcGiMheAyQ6KzKwKB4ADc=; b=aXBTA1sDv1qji1s5PJ7jG4rhiHZLxbkYYoSUordIDMZnJ/dRgmCxYRzBKzeRJG+5MeWdllMGl1FQqYef3DzWE0gxaBjxN/JDdQmn9ksiuom8TCSoYJqwL7CnXe/g4e0uB6hnyEd36qd/YOVUjB2txVonePUV4VlH9lrpdNkKUWA= 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 1697739747883443.43107436696266; Thu, 19 Oct 2023 11:22:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtXei-0005lZ-Du; Thu, 19 Oct 2023 14:22:01 -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 1qtXeV-0005gI-9H for qemu-devel@nongnu.org; Thu, 19 Oct 2023 14:21:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtXeT-0000eE-Fv for qemu-devel@nongnu.org; Thu, 19 Oct 2023 14:21:47 -0400 Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-39-9GcsIBKxOMOrCaFIXZJgKw-1; Thu, 19 Oct 2023 14:21:24 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c2845cc163so80048791fa.2 for ; Thu, 19 Oct 2023 11:21:22 -0700 (PDT) Received: from redhat.com ([2a06:c701:73d2:bf00:e379:826:5137:6b23]) by smtp.gmail.com with ESMTPSA id l23-20020a1c7917000000b004063cced50bsm206860wme.23.2023.10.19.11.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697739703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UQlj+8sgMBKeSBER7AOYNOJcGiMheAyQ6KzKwKB4ADc=; b=fnwx6ZIHSY9kumKrOYoxmJeRMgxCulb6B3jmBFSqaOUjvHTsVV3KmMwCY2t8C1Z1hORAre j0dgXCk6Cx3SWUQjGdHmlY+iNjk9uiqhBD8BY+Q31tA8h9oN4I5Z9aJzfY3hj7yj+hmTbh kPsEQ199PEtpnMRkvkyaoox+TY3sUus= X-MC-Unique: 9GcsIBKxOMOrCaFIXZJgKw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697739680; x=1698344480; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UQlj+8sgMBKeSBER7AOYNOJcGiMheAyQ6KzKwKB4ADc=; b=digY9YL53F2zIT459IBvpBxJ2cXQACBqhPp4vjzDnU2X/Y+xeYg1T0HOJo0G9gfQDJ x/Op15UyrnxDtapw7NmHzvRd1TQjW03OSVxOvMGYJGzK/KaZM6KYEf9TCtaQl6hNlC4X 3OnryxqXvjBckE3WcpBeojBNfsSTcVbsdZxc0EK6zYz2bZKTDXwYc5gNaPYoaQnLLVWS 8bsB8fwlfWIobN6Ro6OKFoWDOeITMglvmCSmJaZSpEnS3EPoU2t0M0eRKtjYO3dM7sqm RicXWO8XqjJpnAA0ZbV+hYLTxZmheC7z6cFCINKqWkfuTPLu+D9E4leJ8OFOhcbYDfFL Ed5w== X-Gm-Message-State: AOJu0Yyt3IqX0FV3zuoW3n7pg6jLggAsIJcoyJQDOFIQLf7cWgEseJm2 0jpfGRUH/Ge3Lom5lSFfkAV/NgiVh2hP9Fsu+3H9SPh0uA4VbpE8mnKEigrth6EE2y9daAIfgs8 Sj1OoVOKJzI1oOPVPyuzpWv6XWm+aGdikQjYHHGjeBqiDXCaW+ep9EJEKPw8ve7C09Bg0 X-Received: by 2002:a2e:8ecc:0:b0:2c5:b23:1314 with SMTP id e12-20020a2e8ecc000000b002c50b231314mr2068480ljl.41.1697739680146; Thu, 19 Oct 2023 11:21:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHs7iwqFffihsYWIuci6d9qxE+/h1gnsvSmyoQgsATaIEQmxMBj8vTt9++qoI2cvtYmdm+0Jw== X-Received: by 2002:a2e:8ecc:0:b0:2c5:b23:1314 with SMTP id e12-20020a2e8ecc000000b002c50b231314mr2068465ljl.41.1697739679834; Thu, 19 Oct 2023 11:21:19 -0700 (PDT) Date: Thu, 19 Oct 2023 14:21:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hawkins Jiawei , Eugenio =?utf-8?B?UMOpcmV6?= , Jason Wang Subject: [PULL v2 02/78] vdpa: Avoid using vhost_vdpa_net_load_*() outside vhost_vdpa_net_load() Message-ID: <327dedb8df91f57ef917ab5b5db519146ee6f08b.1697739629.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @redhat.com) X-ZM-MESSAGEID: 1697739748642100001 From: Hawkins Jiawei Next patches in this series will refactor vhost_vdpa_net_load_cmd() to iterate through the control commands shadow buffers, allowing QEMU to send CVQ state load commands in parallel at device startup. Considering that QEMU always forwards the CVQ command serialized outside of vhost_vdpa_net_load(), it is more elegant to send the CVQ commands directly without invoking vhost_vdpa_net_load_*() helpers. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio P=C3=A9rez Message-Id: <254f0618efde7af7229ba4fdada667bb9d318991.1697165821.git.yin311= 49@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 618758596a..86b8d31244 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -1114,12 +1114,14 @@ static NetClientInfo net_vhost_vdpa_cvq_info =3D { */ static int vhost_vdpa_net_excessive_mac_filter_cvq_add(VhostVDPAState *s, VirtQueueElement *e= lem, - struct iovec *out) + struct iovec *out, + const struct iovec = *in) { struct virtio_net_ctrl_mac mac_data, *mac_ptr; struct virtio_net_ctrl_hdr *hdr_ptr; uint32_t cursor; ssize_t r; + uint8_t on =3D 1; =20 /* parse the non-multicast MAC address entries from CVQ command */ cursor =3D sizeof(*hdr_ptr); @@ -1167,7 +1169,13 @@ static int vhost_vdpa_net_excessive_mac_filter_cvq_a= dd(VhostVDPAState *s, * filter table to the vdpa device, it should send the * VIRTIO_NET_CTRL_RX_PROMISC CVQ command to enable promiscuous mode */ - r =3D vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_PROMISC, 1); + hdr_ptr =3D out->iov_base; + out->iov_len =3D sizeof(*hdr_ptr) + sizeof(on); + + hdr_ptr->class =3D VIRTIO_NET_CTRL_RX; + hdr_ptr->cmd =3D VIRTIO_NET_CTRL_RX_PROMISC; + iov_from_buf(out, 1, sizeof(*hdr_ptr), &on, sizeof(on)); + r =3D vhost_vdpa_net_cvq_add(s, out, 1, in, 1); if (unlikely(r < 0)) { return r; } @@ -1285,7 +1293,7 @@ static int vhost_vdpa_net_handle_ctrl_avail(VhostShad= owVirtqueue *svq, * the CVQ command directly. */ dev_written =3D vhost_vdpa_net_excessive_mac_filter_cvq_add(s, ele= m, - &out); + &out, &vdpa_in= ); if (unlikely(dev_written < 0)) { goto out; } --=20 MST