From patchwork Fri Jun 2 11:52:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13265166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 24246C7EE29 for ; Fri, 2 Jun 2023 11:53:48 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q53KZ-00087i-90; Fri, 02 Jun 2023 07:52:31 -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 1q53KY-00085O-5L for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:30 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q53KW-0007Et-IP for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:29 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1b04782fe07so10669195ad.3 for ; Fri, 02 Jun 2023 04:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685706747; x=1688298747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Tfdwdo9EGbsNiJTfLy+KhuY6lhHyln8G6IJjnc2Afnw=; b=cWfXOQU2YhIGZsMj82/COrOTmeBBd6U6GlyzADl8OUu7PZqtF7NrIpQnPd1LLZTd+q k2ZVVaKoN8n4GtVzqy0/UIzCB+qUI9yE0NkD700SJH3taVyUuhk2lgIfMdxxCGeH654X 6rdoVFjB9nFufcNBR+dxWgr6U2mLULwz+xNtjr2s/5lv3ocTLMCyYiZxsY1t9bJ6VBUf B2gKtjH/uAlbWg7MbCxlW5EapL/IpBnOoy8YTQwA5JhQaaDoBpgt7ngDP9p61pttE72X 5HpPS1h1NhKjuKu/B/k3Xu3z+USYebQKchXW7RZTeFXozX+8M5teOMbZXPxLVArsvXZG SPMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685706747; x=1688298747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tfdwdo9EGbsNiJTfLy+KhuY6lhHyln8G6IJjnc2Afnw=; b=J5iZoKsPoF25AF+H3TC7gvVIvkrlz354R1nOeDvyLzjipPmSedHzejfHiK92qxT28k ris4Rfwdls+bFt/VLhtz08WxdFcQxZKe7Q+Qy6XboazDaG/CC1dbsR+xzfHTr9Vs/XaC wh6M9sD4TwXl23eGT/UMjRuzjqmQJkPUV0nRd9cjhmGHS6fwNBYO1gaSybKcB05Uii4T KAEnKZaiZ/cDoq0Mf3CQ0U/Nf/2ECMN4092Qmcx9MdeLYTlmkQanjKtzN9bPRC1yxEn5 tG7G0i/O5Puhsv2VFzPaux5YYix4bEJ4PZLc4vUwckcs/A/U9q6bv0nA7jo6/pPkvOND sJ1w== X-Gm-Message-State: AC+VfDznofFOwFe9c9J972FzrUDuxHIUuiz44rbMm8qMQ8RrAjQAEKzL H9MWl/w9c0rEDL/BRxa6zBI= X-Google-Smtp-Source: ACHHUZ4HRSpWSlwD9a3iktO23cNwRfTQD0RhdhkKT7hmDRNv6e0jXpfRDDHkOUjAxTcj0FVzxcGwZg== X-Received: by 2002:a17:902:d894:b0:1ab:eee:c5d7 with SMTP id b20-20020a170902d89400b001ab0eeec5d7mr1181610plz.48.1685706746864; Fri, 02 Jun 2023 04:52:26 -0700 (PDT) Received: from localhost ([159.226.94.115]) by smtp.gmail.com with ESMTPSA id ju11-20020a170903428b00b001a9b29b6759sm1181585plb.183.2023.06.02.04.52.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 04:52:26 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 1/6] include/hw/virtio: make some VirtIODevice const Date: Fri, 2 Jun 2023 19:52:13 +0800 Message-Id: <16c0561b921310a32c240a4fb6e8cee3ffee16fe.1685704856.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=yin31149@gmail.com; helo=mail-pl1-x62c.google.com 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The VirtIODevice structure is not modified in virtio_vdev_has_feature(). Therefore, make it const to allow this function to accept const variables. Signed-off-by: Hawkins Jiawei Reviewed-by: Eugenio Pérez Martin --- include/hw/virtio/virtio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index af86ed7249..0492d26900 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -402,7 +402,7 @@ static inline bool virtio_has_feature(uint64_t features, unsigned int fbit) return !!(features & (1ULL << fbit)); } -static inline bool virtio_vdev_has_feature(VirtIODevice *vdev, +static inline bool virtio_vdev_has_feature(const VirtIODevice *vdev, unsigned int fbit) { return virtio_has_feature(vdev->guest_features, fbit); From patchwork Fri Jun 2 11:52:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13265162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BDE3C7EE29 for ; Fri, 2 Jun 2023 11:53:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q53Kc-0008I6-Ss; Fri, 02 Jun 2023 07:52:34 -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 1q53Ka-0008AK-Vw for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:33 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q53KZ-0007FV-3d for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:32 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2562cc85d3dso1527260a91.1 for ; Fri, 02 Jun 2023 04:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685706750; x=1688298750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PdZEvGS5pKAdDP2r/hDEuoCh9mnMaQgfKyqI6O8cGcY=; b=p8LJ9BDno+yEuj5xP028CMjuuna28eKkdocFl1RLW18K95ELqDpPyytuxtnoCpKeSv P75U36//icEGoFnZwB01gVh7HrUIBWLxHEzfl0HB/iTVLMutEEmQXgrN+FhG4n96KbuG urTGsJ7cetA0SkIy0Tv7eP+Actmg2+HpDA/8htlFei2SC7j9E6J95OvV8GjpvRU7s+Y2 khQB8sehnCgzn6testzH+VtT1F0C3SizbgO6RPjUAOYgrccuoZVa4+U/chnWToIbuk85 46y+CuydHaK3OUyGrK9y0dMzDYSMqu7bMAv0Q3mrRRK8rsRZmaYj71hI2RfmVsHVjLsC XGNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685706750; x=1688298750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PdZEvGS5pKAdDP2r/hDEuoCh9mnMaQgfKyqI6O8cGcY=; b=fDIUn+CppJFzVicN3Tpd4lssRZu30ebbmAZ02nIwZwKHTYd5XH0VyF92kna0zzBYSJ iK8uWkV2GozEM4HFgoynbSESnbJwg2yGVRcjj4/PUmHI5AlOSGtzCFdKCfxR0nW2OZnG C9COoB0BNQM1De/w6bcHBsviYTZV2COm6xi0s4iWSExz25DGw9w7dFzqc/yNdnBLIlD2 gyYs8AROfRDKJfyXG6ebSvx04HOow42+wj2sFrj22BLxwlcU8alZ4QUW56lLmHWHoXUJ lzI/xMiDFvxo0kXExKuv+BYM2sqPUk3u2AQ5Et9YSRc/ZsUUS3XoRo88nkn4uijXhoTV 8l8A== X-Gm-Message-State: AC+VfDxuZn13TMkd85XZ7t4rGIr9VG7pf+zHxQo2Lo8VTTq1zwVta/L0 KEZMOTWZy1teZkgStQLABoo= X-Google-Smtp-Source: ACHHUZ5DbV/YPQ279tFs5KMUnqA5JgQy43eEChxP5EkaS1sjIXYBQMHjZ0IzwuaXvQj8grFFnhLT6A== X-Received: by 2002:a17:90b:f0a:b0:255:afdd:2e7 with SMTP id br10-20020a17090b0f0a00b00255afdd02e7mr2215045pjb.7.1685706749628; Fri, 02 Jun 2023 04:52:29 -0700 (PDT) Received: from localhost ([159.226.94.115]) by smtp.gmail.com with ESMTPSA id 27-20020a17090a031b00b002567501040csm3112275pje.42.2023.06.02.04.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 04:52:29 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 2/6] vdpa: reuse virtio_vdev_has_feature() Date: Fri, 2 Jun 2023 19:52:14 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=yin31149@gmail.com; helo=mail-pj1-x102d.google.com 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We can use virtio_vdev_has_feature() instead of manually accessing the features. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez --- net/vhost-vdpa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 37cdc84562..e907a3c792 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -643,8 +643,7 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class, static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n) { - uint64_t features = n->parent_obj.guest_features; - if (features & BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR)) { + if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_MAC_ADDR)) { ssize_t dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_MAC, VIRTIO_NET_CTRL_MAC_ADDR_SET, n->mac, sizeof(n->mac)); @@ -662,10 +661,9 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, const VirtIONet *n) { struct virtio_net_ctrl_mq mq; - uint64_t features = n->parent_obj.guest_features; ssize_t dev_written; - if (!(features & BIT_ULL(VIRTIO_NET_F_MQ))) { + if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_MQ)) { return 0; } From patchwork Fri Jun 2 11:52:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13265168 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA3B5C7EE24 for ; Fri, 2 Jun 2023 11:53:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q53Ke-0008JV-SD; Fri, 02 Jun 2023 07:52:36 -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 1q53Kd-0008IJ-4j for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:35 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q53Kb-0007G9-L9 for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:34 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-64f47448aeaso1307804b3a.0 for ; Fri, 02 Jun 2023 04:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685706752; x=1688298752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PR8gVp6AayIwlrOZ5rFXSJfbCB9/dT2f8XhiwNsNRww=; b=ixUqMJq7lMbyHcVcQtZZhKMPlD67/eSpqX+oz7WNXEl1ci5foffYb7ukeDa3ot2TLI mjiS9hujPhekZTmwQp2YC4RsKiubvGvqAzoGkNOAwp/sq/0ayr9WiSKak/LsEvFvQYsi 2Xh6kiFWni2gqkFt7QfkRoU1NyZuFJVwbHw3b7zI3qLXAaIFyoMOujoZaqMLFoIh2TBv kBMLUjLtJFhtecyJv/WRTLsC9rHiLSqMDELSwdq9tmrZf9GgW2hIS0XWdC7khgpnHk54 UF7QC5E7KiN/LxVUFSAsIDUEzE3YpQEEwIL9HvLlpIcEOUjkOZUSWIw9IzXjZQ0U7W+r B5YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685706752; x=1688298752; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PR8gVp6AayIwlrOZ5rFXSJfbCB9/dT2f8XhiwNsNRww=; b=Ca4TtTeyamN4Icqp67Zf3atEAjzxrdaPiVWOWiKg89Rb06OBrpma42oJ0lQcHfMB3Q nkxvpSqTk0nK6ooZFX0Ceo9K6TUQdGmu9ICX76eHIiw/YM0B/3RdXp66DUHnU11Axj5F taPKD0y7hF0yFM+WUkIYue2GVGos1uY4onBdl044MJBda9fmHDjdhMYBD0U4BYwGJYaf fpbIQ2nWUJgBSrAkJroLznN5hZp6VtRapHUyCnUGl3Off5j7yTrAMu7MUUiZrfFu8mOU Wpt5k4Td0yqk+kGVXsjylJMpHsqWqXvf8PMcdYYrY5t59GaqFu05eBCsiN8y66TuThK2 hoOg== X-Gm-Message-State: AC+VfDxd8Ve6POFIglElzvm3ZQr3EvaphhZpPRg0Wi5UreF8eRZ4AgOF 6FJgDcqs7n5HRPsoLck6/cY= X-Google-Smtp-Source: ACHHUZ5OaLaJXDakvssJWFlAYaAPFK7vdEzWRQGMD/p+4D0n8oSzyJmupi0GDZWZEYqGLkGNRxd70A== X-Received: by 2002:a05:6a20:a5a9:b0:10c:67c9:e5ea with SMTP id bc41-20020a056a20a5a900b0010c67c9e5eamr8467201pzb.31.1685706751932; Fri, 02 Jun 2023 04:52:31 -0700 (PDT) Received: from localhost ([159.226.94.115]) by smtp.gmail.com with ESMTPSA id e21-20020a170902d39500b001aaf2172418sm1190659pld.95.2023.06.02.04.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 04:52:31 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 3/6] hw/net/virtio-net: make some VirtIONet const Date: Fri, 2 Jun 2023 19:52:15 +0800 Message-Id: <489b09c3998ac09b9135e57a7dd8c56a4be8cdf9.1685704856.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=yin31149@gmail.com; helo=mail-pf1-x42d.google.com 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The VirtIONet structure is not modified in virtio_net_supported_guest_offloads(). Therefore, make it const to allow this function to accept const variables. Signed-off-by: Hawkins Jiawei Reviewed-by: Eugenio Pérez --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6df6b7329d..7b27dad6c4 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -874,7 +874,7 @@ static uint64_t virtio_net_guest_offloads_by_features(uint32_t features) return guest_offloads_mask & features; } -static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n) +static inline uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n) { VirtIODevice *vdev = VIRTIO_DEVICE(n); return virtio_net_guest_offloads_by_features(vdev->guest_features); From patchwork Fri Jun 2 11:52:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13265163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 156C8C7EE2C for ; Fri, 2 Jun 2023 11:53:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q53Kg-0008Jy-Bg; Fri, 02 Jun 2023 07:52:38 -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 1q53Kf-0008Jn-7D for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:37 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q53Kd-0007GX-ME for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:36 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1b026657a6fso17264905ad.0 for ; Fri, 02 Jun 2023 04:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685706754; x=1688298754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VAms4dm3KCeYAKXoZpA5YggmskcWUP006Xt8FZqxidk=; b=S/qkFZYC2wSNSt+GCcqvwdxlG8IA+7ME0ZRyaJ5cNN4nTdniALxHFilkPiiQHaXCPg 6j2KRa+LQdCgh+kFVRf3Ny8j2HDKgrBxZD0FxeeQzbhxQPed80Q03BhaJWrIVEcDlHlE cYvrrMV6tk0KCVKQZsXbyAJIcb2w2TliZy50qZWpY1IA8la7xVKRB52LsytX85QnYoBD Cg1mPzDamleiEiC3hXl+a1q9jNPwAUQiawzlw6M+uYbGvzHYZfEzkYBHMMjN887Zg6Ze X0PdGcfpUhpv09SZDMSQy1kgb9DRWR/X5xHxFhy+Lr1kCoS2v7duQE5pWVNSVUNpOa64 QIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685706754; x=1688298754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VAms4dm3KCeYAKXoZpA5YggmskcWUP006Xt8FZqxidk=; b=DGCmpmLC3tpEVbkAFE7MiE4wtJr55QxPK00oSUgaKNq782iUCXmNiMm+4X/700Dx79 l1idD53wjxzZCnQ9tHacyu78sZeoSOumW7JxvW0wp3I+IswdgbeUKQ192kv0HGWPoWLz Zu7ATT3u+oWmYAX5t91aPRoMmuyuU+nNLswIBlg7v/oz6jYp6H9Fi21Fa2CieOh3uyOO Eu7iG7eYFplIt59RcAekuGaRpC7snDPGcdprUhbYvKxt/Jcw0uMvuLRPI7bir+X+KCLF Ue1XTFuhsttKVmT4NaF9QL+lw28Q2PlIIxvioRbzka7P6p7LnsGOIqeOXDx6qIRK6IEK nmww== X-Gm-Message-State: AC+VfDzsu7pL2oxbWa+r5U5DbnW6ZMPA8PkOPtX4z5ll75DXQJQ2fboT Eu2kDJvSQDyNh/kN9upk7kU= X-Google-Smtp-Source: ACHHUZ4eLUD4sr+T1pioYM4U0o4IYg4bJfsIArHF3+eFF8gN1qvX/RF4qjqbsj+RRC+/kvD4IDAvPw== X-Received: by 2002:a17:902:f7d4:b0:1b0:2f15:e0b3 with SMTP id h20-20020a170902f7d400b001b02f15e0b3mr2096535plw.50.1685706754276; Fri, 02 Jun 2023 04:52:34 -0700 (PDT) Received: from localhost ([159.226.94.115]) by smtp.gmail.com with ESMTPSA id n13-20020a170902e54d00b001ae4d4d2676sm1163536plf.269.2023.06.02.04.52.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 04:52:33 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 4/6] virtio-net: expose virtio_net_supported_guest_offloads() Date: Fri, 2 Jun 2023 19:52:16 +0800 Message-Id: <43679506f3f039a7aa2bdd5b49785107b5dfd7d4.1685704856.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=yin31149@gmail.com; helo=mail-pl1-x636.google.com 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To support restoring offloads state in vdpa, it is necessary to expose the function virtio_net_supported_guest_offloads(). According to VirtIO standard, "Upon feature negotiation corresponding offload gets enabled to preserve backward compatibility.". Therefore, QEMU uses this function to get the device supported offloads. This allows QEMU to know the device's defaults and skip the control message sending if these defaults align with the driver's configuration. Note that the device's defaults can mismatch the driver's configuration only at live migration. Signed-off-by: Hawkins Jiawei --- hw/net/virtio-net.c | 2 +- include/hw/virtio/virtio-net.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7b27dad6c4..7e8897a8bc 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -874,7 +874,7 @@ static uint64_t virtio_net_guest_offloads_by_features(uint32_t features) return guest_offloads_mask & features; } -static inline uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n) +uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n) { VirtIODevice *vdev = VIRTIO_DEVICE(n); return virtio_net_guest_offloads_by_features(vdev->guest_features); diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index ef234ffe7e..5f5dcb4572 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -227,5 +227,6 @@ size_t virtio_net_handle_ctrl_iov(VirtIODevice *vdev, unsigned out_num); void virtio_net_set_netclient_name(VirtIONet *n, const char *name, const char *type); +uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n); #endif From patchwork Fri Jun 2 11:52:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13265164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19C9AC7EE29 for ; Fri, 2 Jun 2023 11:53:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q53Kj-0008L0-Ta; Fri, 02 Jun 2023 07:52:41 -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 1q53Ki-0008KU-5Y for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:40 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q53Kg-0007Gy-Is for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:39 -0400 Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-2565a896d07so872618a91.2 for ; Fri, 02 Jun 2023 04:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685706757; x=1688298757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0qcxgCXtqBx5DBEK6YoQwk5QCMI9bRJjdZFLaUSr1gU=; b=Nxr2+7qVUpB5uF7RnTyKkmmC94rXebELBQKlIfU5AyiBxdEXE2neKFJcvqaJlfrDzw lqglVSI9APADRVlkMK79V3+MUC3FmghqaB5IB5BY6LmzwkRE3xzQHyV7HkT14zDjPLPJ XGlwe1Rcohux46KiATwMOQJxrqnBF6vB/16hZv/OF05Yuo4jAqBJHvq/MUkDuaSbx+hF 4DK7qEfxGqjI0dqXHn+WqdRMwS0tyxDWppEyX7UVfGQRkmCcabLTSDayzL+2Vre4DgjW T/Hf+3yTqRbL87DhIPVfra6ZuJr6TAIrH7jUolumTv3qOEX3YZWUkZH0LH6rSHF2bUrl UBHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685706757; x=1688298757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0qcxgCXtqBx5DBEK6YoQwk5QCMI9bRJjdZFLaUSr1gU=; b=bepoclif0lAfxhTW1VBg7NGZBeZweLm2gLOnDAUd+xivK1Krobzr0GmtTlzrbtAMLD /2lpm+1pj3+xIzoTMyJOpjCJWydUphOmL9uRmaFozmHXv47zcSL55kLX1DiT6S7wa3nd vciX8lonk7RC7sJ7VhQA2uPRB3SwJL+Y2FKgpeRu3GIGOU5Mi2cBcpBAJhPsX10Yy5Fy YVKC8kBBW7JdT785IR/tpcW+qgLvT71pTzg+R/mS9SRSbfhcrtRC8yD75l4o+M1sAr3d z0MQzJJH72VjsDuYLwGHI7kFnoY5a4bxcOjmz/CNy3kqcoECP3KGckP9CcMPhLHAUUw2 qXDw== X-Gm-Message-State: AC+VfDzBHMY//9XG7Elns8mxVpDSWRJcjYN2DVLbA/GS0JBfZPc1HU9k c60rCfD7zQG+qk5AjeULmN0= X-Google-Smtp-Source: ACHHUZ5BCxtdpuzf5wM99YT0OO+7im0id+W2mxzMcX4PZm+Xyh3Ln2pWeORzikcA/T2xZm0uJgT+cg== X-Received: by 2002:a17:90a:3b0b:b0:256:4246:d94d with SMTP id d11-20020a17090a3b0b00b002564246d94dmr1161051pjc.3.1685706757026; Fri, 02 Jun 2023 04:52:37 -0700 (PDT) Received: from localhost ([159.226.94.115]) by smtp.gmail.com with ESMTPSA id g13-20020a17090a290d00b00256799877ffsm1123319pjd.47.2023.06.02.04.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 04:52:36 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 5/6] vdpa: Add vhost_vdpa_net_load_offloads() Date: Fri, 2 Jun 2023 19:52:17 +0800 Message-Id: <7e2b5cad9c48c917df53d80dec27dbfeb513e1a3.1685704856.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=yin31149@gmail.com; helo=mail-pj1-x1036.google.com 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch introduces vhost_vdpa_net_load_offloads() to restore offloads state at device's startup. Signed-off-by: Hawkins Jiawei --- net/vhost-vdpa.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index e907a3c792..1a295af51d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -678,6 +678,44 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, return *s->status != VIRTIO_NET_OK; } +static int vhost_vdpa_net_load_offloads(VhostVDPAState *s, + const VirtIONet *n) +{ + uint64_t offloads; + ssize_t dev_written; + + if (!virtio_vdev_has_feature(&n->parent_obj, + VIRTIO_NET_F_CTRL_GUEST_OFFLOADS)) { + return 0; + } + + if (n->curr_guest_offloads == virtio_net_supported_guest_offloads(n)) { + /* + * According to VirtIO standard, "Upon feature negotiation + * corresponding offload gets enabled to preserve + * backward compatibility.". + * + * Therefore, there is no need to send this CVQ command if the + * driver also enables all supported offloads, which aligns with + * the device's defaults. + * + * Note that the device's defaults can mismatch the driver's configuration + * only at live migration. + */ + return 0; + } + + offloads = cpu_to_le64(n->curr_guest_offloads); + dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_GUEST_OFFLOADS, + VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET, + &offloads, sizeof(offloads)); + if (unlikely(dev_written < 0)) { + return dev_written; + } + + return *s->status != VIRTIO_NET_OK; +} + static int vhost_vdpa_net_load(NetClientState *nc) { VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc); @@ -700,6 +738,10 @@ static int vhost_vdpa_net_load(NetClientState *nc) if (unlikely(r)) { return r; } + r = vhost_vdpa_net_load_offloads(s, n); + if (unlikely(r)) { + return r; + } return 0; } From patchwork Fri Jun 2 11:52:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 13265165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BF2EC7EE24 for ; Fri, 2 Jun 2023 11:53:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q53Kl-0008LU-Ev; Fri, 02 Jun 2023 07:52:43 -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 1q53Kk-0008L9-EC for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:42 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q53Ki-0007HE-TL for qemu-devel@nongnu.org; Fri, 02 Jun 2023 07:52:42 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-652328c18d5so814504b3a.1 for ; Fri, 02 Jun 2023 04:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685706759; x=1688298759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iSlNPZFePKdQEbEASdUB2CHWXuLAoQ8iKDnQOm/+zKI=; b=V/aLzWX9C3sGodHjt03sHEQDYuEqp9b9/rALEjN9AldjvsKQsj3/fPtQxqdqPppk3r N6D2Hje2wGx9BtuPItvJvXlTsKYTYNOM7ZmiIeNImz/IH3QAezUNOTor7AN9s7vETZXk yhnqRH+13sjKiZIP6pXKNO0vRqveanN/ZuQTVBgZmk2wFK1GS8qj9mG5+KOqE1JVAvhe PnTzdfMrc48dUtX9j9dBeUMKUC50L1fTU+PxOXnLQTxAz9iNhie9SqTbjEm7tY42XqGN IHp6xnCWoWES6cNEKb5dNKNS1ubDfhuuFN5HRksphTAUVFFERrUZ2CmFj+/AoiHmYzv3 p2XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685706759; x=1688298759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iSlNPZFePKdQEbEASdUB2CHWXuLAoQ8iKDnQOm/+zKI=; b=aLEzF0klcfeHwvu4oZEv5toAn4hWOscqzN04+nMk35a+uxcGe0nJConaQInvxxYtMi jyxr0cqnEMObsbxBUjhx17XlW9jjIs35IDU64Xus3veLtbwQ3fvnimPK6PBlj9Y3rCBS E4jQR/R+hVYibdlviyhKce6xGmqXoqPr6sGll+M9Vb83MXb33NSTZIAg/eMgio34hqgh iHoX2Xzv46p5dJFX8EWlpt+kZUxA8bLOKlTML3e8y7PwzG6TwyBScEuSvpCIJ1teMk3m A+aMYI1pKH8wUHVKx0YGi469WgI91/kvdEZh30FdhY5JcEBcFu6gyYEFpe2EsQ4YuIPn nvrg== X-Gm-Message-State: AC+VfDzkKt4YskIj+U+6UpZa2QxT/slXvl6NxjfecivhnYQu3L6BbBs3 MtxJEbvPajUpTGgYAJBidq4= X-Google-Smtp-Source: ACHHUZ5SZQB3siTx5GSYGp3q6o7bdm5wiPddcQvhZIyvUXPQXi64GNNtLcc22zkCTdasUCvN8A0yCQ== X-Received: by 2002:a05:6a20:9389:b0:10f:1d52:93c2 with SMTP id x9-20020a056a20938900b0010f1d5293c2mr9384958pzh.28.1685706759415; Fri, 02 Jun 2023 04:52:39 -0700 (PDT) Received: from localhost ([159.226.94.115]) by smtp.gmail.com with ESMTPSA id l17-20020a170902f69100b001a96d295f15sm1155751plg.284.2023.06.02.04.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 04:52:39 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 6/6] vdpa: Allow VIRTIO_NET_F_CTRL_GUEST_OFFLOADS in SVQ Date: Fri, 2 Jun 2023 19:52:18 +0800 Message-Id: <778d642ecae6deed8a218b0e6232e4d7bb96b439.1685704856.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=yin31149@gmail.com; helo=mail-pf1-x42f.google.com 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Enable SVQ with VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature. Signed-off-by: Hawkins Jiawei Acked-by: Jason Wang Acked-by: Eugenio Pérez --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 1a295af51d..5a72204899 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -85,6 +85,7 @@ const int vdpa_feature_bits[] = { static const uint64_t vdpa_svq_device_features = BIT_ULL(VIRTIO_NET_F_CSUM) | BIT_ULL(VIRTIO_NET_F_GUEST_CSUM) | + BIT_ULL(VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) | BIT_ULL(VIRTIO_NET_F_MTU) | BIT_ULL(VIRTIO_NET_F_MAC) | BIT_ULL(VIRTIO_NET_F_GUEST_TSO4) |