From patchwork Thu Jun 1 08:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 1788865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=VC9/fW6s; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX0Dj5XDvz20QJ for ; Thu, 1 Jun 2023 18:49:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4dz4-0001wl-Ke; Thu, 01 Jun 2023 04:48: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 1q4dz0-0001w6-Md for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:34 -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 1q4dyz-0006F4-31 for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:34 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1b04706c974so4998355ad.2 for ; Thu, 01 Jun 2023 01:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685609311; x=1688201311; 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=XG/vGXSzD1X2DKFaeuOHuABz/AWh01w+UQ5wuAYsDFc=; b=VC9/fW6sc/V8UYBRccGkdo2wq/3jzaM/E/RrUDdIf7EpSClpNSHBYrXvpXMM2y6RX6 3Ci2U8qKoeIZpsKViSqn0YPKg1GqLpwQXVPOrxZxAd+8nwJMf3OoHR+ym3rbiSLWhljG zYOuyCZ1vuKCMfvILBQfA4KHpdiDJWR3LUpGnvtnIL3seMC86esIwnuJZxYscjlPQx65 5pB3Dyl0fPHlV1rW3bZi842WDBsci0cqN107TCr4NpazCFJ/cfwP7WLVy2HxbQ9oMBOv YGTvJwbErdUjEqN5HjLQB4kn3U2fq2nUoAY8kFgIRpu8IZVxJmSfTFqmxMpAFEQ91NJh rt5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685609311; x=1688201311; 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=XG/vGXSzD1X2DKFaeuOHuABz/AWh01w+UQ5wuAYsDFc=; b=P0DDJ83f0J292hM7lLNik9XH2Ceozpnh38R922SWp/ovX4hlFf0+ejPNM0DeLQcZgh jw3q0QIbwPzUJU6c9w9NBdA1AYBI84XUvlz65wHGOyB/036PmophRI68QFurf4GG1B19 8sVVbukIyMS4tTKeVnqoPYNOrP3h6nFRBXzp+27LU5tsB8SAe4FpExm5F6Ajm7CoSZTy Gpu/sUbiIzpzSwJSPaELRFcodBO0iLHuqsvpf7MhrvemPN3kqUgLhNH3TlOlkVeQLUhN Ow4x+2pzmx+Jk4MJj1mj/lgMTEKeUywTz273NZvBtXiYzQ3fRbFe3ej9M3u9M9W2NNsa bhgQ== X-Gm-Message-State: AC+VfDyxNIIuD1ElL0iozc7KkFfaVutxV13BqjDT1j3f/nHcOg+3iJ54 5r1TFIVl+xcHt8HboV3VKYk= X-Google-Smtp-Source: ACHHUZ48Wulsp0cKE6Q4Rl1n34wjHUCaQ2eb8l+xpUqERNXWzbdT29U0hehdL6AqF44M23ILwe9yXA== X-Received: by 2002:a17:902:b10a:b0:1af:d812:d27 with SMTP id q10-20020a170902b10a00b001afd8120d27mr6775204plr.9.1685609311360; Thu, 01 Jun 2023 01:48:31 -0700 (PDT) Received: from localhost ([117.136.38.170]) by smtp.gmail.com with ESMTPSA id b21-20020a170902d31500b001a221d14179sm2824091plc.302.2023.06.01.01.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 01:48:30 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com Subject: [PATCH v2 1/6] include/hw/virtio: make some VirtIODevice const Date: Thu, 1 Jun 2023 16:48:15 +0800 Message-Id: <194d91a57682c661d3550a9d12006033adc8b803.1685584543.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 --- 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 Thu Jun 1 08:48: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: 1788869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=MOtkfrMT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX0FN2Ggvz20QB for ; Thu, 1 Jun 2023 18:50:00 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4dz8-0001xx-3a; Thu, 01 Jun 2023 04:48:42 -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 1q4dz6-0001xm-Sx for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:40 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4dz5-0006Fx-Fk for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:40 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5289cf35eeaso1419256a12.1 for ; Thu, 01 Jun 2023 01:48:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685609318; x=1688201318; 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=lB4+H7dHId7zALwS3Cq9afyCMbzCC+JyaNMHxJm0Ij8=; b=MOtkfrMTy/Z4XMPzEXHzeTWMxYPd7QrD+syDHkTQ+SxtlW4YmTUXde2MpWnRGbIieH g/J1p2gg8ZDcu+D0gqkSAHxenoi4FMpqtU2E54j1Ic71xF0cuw915yyxH+eKbemgrNlB fbG1kmFJdQ9JmBv/2j8rQUFncXYCVw/o5Di/0oiwymkMZ6mO/VQ+sk8tIj2R/+qcbvN0 La6bJPtOwN4BEbBqeGZM6bTzXCOcjgZhHzShw1vlSRbmh+YzhTIvvo74t6j6JcLf05zb ieS9xxxcz/w43AiDXQqxVcozpEgss8FONlglce8IOFs2zCwlEJoEDZqlNT9WgMQHtKR4 G3Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685609318; x=1688201318; 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=lB4+H7dHId7zALwS3Cq9afyCMbzCC+JyaNMHxJm0Ij8=; b=LFMhRgfZRfAtUqPNqAt9YGE4aDQwvREkhoE9QBrdNjngD8mEV630WD4btcEje1/GZu 0Jk1jY0EDF1LC9F3AMMwcUUxhOUJix2TV3iI7wMeweAvnmBSudn0JL+Rmi5f+/mSGWcy CMqKcDEyDMKi2vB1UbdOIVdbeL9NkjXA/oUo44H0b9f9tQYVnY/tCf0MmR2l9D1RwUMQ v1fNvGTyYXNGjwyOM1owNGlr0hODKkD9ByTKvlELo1p0PUGIEErUgPKFD6N2LZie6dTH owBE9KoTNqVELmCjEiH1kJ0ML2SFe523jR2FCKBgOL4mRsIPj1RRqQcP8jf0eCYpqtkC VLRQ== X-Gm-Message-State: AC+VfDx6zhf6j86Mq6JBgOrRkFSN3ZqLO+avoLCivat+KNIaFjhLzvJh VirGeEAgYQnsKoWC1J5NGRX/qAqSNYDpv423nes= X-Google-Smtp-Source: ACHHUZ4+V9UAYGrNKpXIH4+q5Izi5FZeMHsPlZT8Qe4qaVT48ypFXmEspcAPZDr4U5+e0TM99qlDrw== X-Received: by 2002:a17:902:ea0b:b0:1b0:7cc:982a with SMTP id s11-20020a170902ea0b00b001b007cc982amr1651271plg.5.1685609317767; Thu, 01 Jun 2023 01:48:37 -0700 (PDT) Received: from localhost ([117.136.38.170]) by smtp.gmail.com with ESMTPSA id jh22-20020a170903329600b001b03a1a3151sm2884858plb.70.2023.06.01.01.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 01:48:37 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com Subject: [PATCH v2 2/6] vdpa: reuse virtio_vdev_has_feature() Date: Thu, 1 Jun 2023 16:48:16 +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::535; envelope-from=yin31149@gmail.com; helo=mail-pg1-x535.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We can use virtio_vdev_has_feature() instead of manually accessing the features. Signed-off-by: Hawkins Jiawei --- 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 Thu Jun 1 08:48: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: 1788866 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=XWOrALI3; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX0Dj5fM5z20Wc for ; Thu, 1 Jun 2023 18:49:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4dzK-00027I-J9; Thu, 01 Jun 2023 04:48:54 -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 1q4dzE-00024T-L3 for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:52 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4dzC-0006HM-W4 for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:48 -0400 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-39a55e5cfc0so463483b6e.3 for ; Thu, 01 Jun 2023 01:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685609325; x=1688201325; 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=xeSLdi9yuZuMrDKTknXLipIRbAeJX5rbyOelk6PqFnI=; b=XWOrALI3R6C1a2Y9H8JTtP5naJ0BpcPp/LnylSFYjKtHaAgCTP9ud0WKU6CY1SLWaW 9ueTc3MocRdNp7X0AdFd6+Sg7/N/NIi78QR1pO6+/NgAi6pMKhVVoLZ9NfQmZpw/WO+p 4kFUefiUQoLlXGIUsoyTo4Ji92VZQCDoEpYW7K2x0M7MGwDkKJfLDihvR7JHNNqwCW2j rQ5vLSVRy/zrAQylZPIXWVWVKXQiA7zToMq0ys4ZlIdyC0Of0EHiolKTOztogOYgkFX2 chegX/c5cUffpQmUMgkZwmNqcqqesg+h96lfqprzzKzoTekhduzChd8O/k1/29BuBfkO r6nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685609325; x=1688201325; 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=xeSLdi9yuZuMrDKTknXLipIRbAeJX5rbyOelk6PqFnI=; b=dQ9GXEN8R52/RLu4+bzUceVzK43y6JXGmNgwi9PCGsQ7DL+vNKPK7+5bW3u8PTUXSD 1v1ne2+9Cd3d3eAZZyHEItEHfPjnN5aA11qhXkZKcV7ieDU6l2RUG2TTCzZdsU4D3ooI 7UNhbzVC7nUYrvjluk4Pn0aqy/LZGpHygW8tHXmvGxNR09zNnJ9FEPMXiEepC7y6S+YY P5ALpsgzsUFcJBsV+XMGr/MZ4H5IkcN1DDZibyM4RmGOo79UWhNfe32ySIu1UCnWc5ae yTPT5dlabglDMhxxL7LFtS4yzNNKLUf9B4cJYgql9AcracT8yucSsxT1vx9G33PRZNe6 tqww== X-Gm-Message-State: AC+VfDwfGP02HfrsENLpiRe21kuQeWS6V+BAMn5CFA3U+49tqU93CG9R 8W4Ij/LDjZgS/MmsBTndBhU= X-Google-Smtp-Source: ACHHUZ6lya269BlkEHUmJI42qAKkOVzuHlaYjYo0dSWaQEusKeG6r5EReG3xhZzRzRGi3+Upgj2bOA== X-Received: by 2002:a05:6808:1792:b0:38d:ed6f:536 with SMTP id bg18-20020a056808179200b0038ded6f0536mr8230521oib.42.1685609325374; Thu, 01 Jun 2023 01:48:45 -0700 (PDT) Received: from localhost ([117.136.38.170]) by smtp.gmail.com with ESMTPSA id 23-20020aa79157000000b0063799398eaesm4613494pfi.51.2023.06.01.01.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 01:48:45 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com Subject: [PATCH v2 3/6] hw/net/virtio-net: make some VirtIONet const Date: Thu, 1 Jun 2023 16:48:17 +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::229; envelope-from=yin31149@gmail.com; helo=mail-oi1-x229.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 --- 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 Thu Jun 1 08:48:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 1788867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=IhPpzNH3; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX0Dl0lqJz20QB for ; Thu, 1 Jun 2023 18:49:27 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4dzP-0002Id-AW; Thu, 01 Jun 2023 04:48:59 -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 1q4dzK-00027p-HU for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:54 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4dzI-0006Ht-U7 for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:48:54 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-256e1d87998so396537a91.3 for ; Thu, 01 Jun 2023 01:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685609331; x=1688201331; 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=SJGeDeGczfa76jgBf9PpER+RGPnyoyqgrid4pktCwr0=; b=IhPpzNH3wfOeOYgenT2JqejnrQF/kJjaBY9nSdCxFMogBxBoV82ySyPcICTx5VqBPg n8BCECrKYufENJFovaDNWmrDylsJOn7PxOP3Fd24R3BYJPmzcKrCyJjXeK4Ie4Ch+OGf wC2IMrlALblaFusCRxTQlX+TvaDjUAx90JJruMqcPv8jNMpVBFPNsO3ol+qYsLYA9mJ0 E6XEhzNGejNKygTD0X1hNA9ztwXkr1v+MjDvr6v96ttTaefpzDe9CResNpYMHQK+XpGJ VNYski0151C4Fw2SmON32/3uYDH0s6FepYLwNrNZKeeMXlsRYWg3eVPARb9czx7fvlLG PG3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685609331; x=1688201331; 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=SJGeDeGczfa76jgBf9PpER+RGPnyoyqgrid4pktCwr0=; b=N6or2qKEUhQ5blNnqLEhElDCn7sBvUexDBPap441JPr0WsFxCDsyES3ONvNQnxgH9/ xYyc9WU8If+j8yHh/0Qiesu2GwkuqvNmasNGhRsXNgIN7s04amjvrYEl3iY+EaBN9e3b X22d8EWBQWXiOAEOEyjXPw3yVP1xTlmngbnWL5P+YjOxMDNjsJ4nX9EEQUcfJtk07+tJ LxV2AxniF1QsvxXrbzAJTdRNoVKrU6FnG2o/gDFrxw1/BAGqS+t898xueS9sucLuAuAy o8I0NI7W99JE3yRt5sHPZVgYe0zlsl5Bsd07m7l7oTfmMkUKD302tPwvPlYORczn22Fv cv1Q== X-Gm-Message-State: AC+VfDw5J6kj07Vkp9Xmfsav+wjwvX/4ws9LT3ySynm3rOEoTLdBvQAL VhPW2LjBeq4qcHMBtGVHovHZpE2z5GHkFM+5VUM= X-Google-Smtp-Source: ACHHUZ4XiEPKhhpkgetie8AKTYEjV6t0A+aNOK5iUVzKhLcnU7j210SEHdX5VoN/J9oGhHiYQ10CEg== X-Received: by 2002:a17:903:2641:b0:1ae:43a8:2759 with SMTP id je1-20020a170903264100b001ae43a82759mr7959164plb.58.1685609331234; Thu, 01 Jun 2023 01:48:51 -0700 (PDT) Received: from localhost ([117.136.38.170]) by smtp.gmail.com with ESMTPSA id jd21-20020a170903261500b001b045c9abd2sm2840856plb.143.2023.06.01.01.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 01:48:50 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com Subject: [PATCH v2 4/6] virtio-net: expose virtio_net_supported_guest_offloads() Date: Thu, 1 Jun 2023 16:48:18 +0800 Message-Id: <39fddc462ad4c7619843a4cd7cba92e0bbc48c45.1685584543.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::102b; envelope-from=yin31149@gmail.com; helo=mail-pj1-x102b.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To support restoring offloads state in vdpa, need to expose the function virtio_net_supported_guest_offloads(), then vdpa uses this function to get the guest supported offloads. 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 Thu Jun 1 08:48:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 1788868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=I4D0laUO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX0F64dfMz20QB for ; Thu, 1 Jun 2023 18:49:46 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4dzb-0002Y4-Ig; Thu, 01 Jun 2023 04:49:11 -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 1q4dzQ-0002Qp-Hl for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:49:00 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4dzO-0006II-Qj for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:49:00 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2562cc85d3dso392007a91.1 for ; Thu, 01 Jun 2023 01:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685609337; x=1688201337; 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=ued2PGntEbVyYE+XZjWv3o98NO0iI/oUAsMZR1ODtOU=; b=I4D0laUO/QcxW5eeovEw4NoWI5cXqNZwHZgrWkH5OshUvD6zpoLG3nOdaMWMG61h4U EjK/XPUWBWTRNY98r6rx7XZ0E47SL2b1kwDYWRpkQXuPt1e/FP//5EhPWhJTE4Ue1+qB 3qIcFw2SvUmM1/EbQFN9VQ06cEktbwC2jXBZNDk4ZObTiENp6FiVHy6m9CaMkshSMIPe iJwSg7FR2sg2wgL07R+2b/sxO7ImiSUHtnuPf+52/vegyKat9WL+LTmsdKykRgdk5GYL egBWYkhtPezt3B2syh4ALPOA1r4W8eMWd3zZPcxTMGwN08xHHux2bq3wqRV8aB1hD/lf +gOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685609337; x=1688201337; 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=ued2PGntEbVyYE+XZjWv3o98NO0iI/oUAsMZR1ODtOU=; b=NTxbJzWuwV3uPfXUKmw3kdBnQ5KKfv5fA5u2Wt34LCkx/FlSAjBec2+vQG+3DXS2up a6vZjjFxfN5C6+2kyxjFjfbYW7D4UD820Dd0MlJCeZMGnUHp5chU4UDuBoGl7HN2AS4O 8LJlfXdLr0UZT/GIfrmEE6Gpfk5K54NYkMx8GEYYX+qW0VjW4LuADdZxu0YwgMUb/7WJ Bamss9TvBaAZySXIiSu54mp0zOlMHE8ReZMoQOBSyR7U0vJbnMbewEK+mwg3Cw3zV9A3 Nss9Z90iGKO8VBGMuAgYH7guuJ7ygxw1IP5+lv3hrmMqI1PalGgB4mpLb/sd/9l9Mom3 g7cQ== X-Gm-Message-State: AC+VfDzQWQSUwG6p7U+AW6AtnwfOa93Te0huE7w6oXhNOx9uxjMcyGms bp2S9/Qy0MARqkjGFzjqUce1UHT0BfJkxRYI89A= X-Google-Smtp-Source: ACHHUZ5FFc6VCsvQ12WtnSqk6cuUcw02N+21njFkA9pxkKYkWO+1VKGsSDQlZ6o3bIMBxdKCpLejjw== X-Received: by 2002:a17:90b:4f85:b0:256:87f4:432a with SMTP id qe5-20020a17090b4f8500b0025687f4432amr7625270pjb.18.1685609336753; Thu, 01 Jun 2023 01:48:56 -0700 (PDT) Received: from localhost ([117.136.38.170]) by smtp.gmail.com with ESMTPSA id g129-20020a636b87000000b0051f14839bf3sm2681038pgc.34.2023.06.01.01.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 01:48:56 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com Subject: [PATCH v2 5/6] vdpa: Add vhost_vdpa_net_load_offloads() Date: Thu, 1 Jun 2023 16:48:19 +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::102f; envelope-from=yin31149@gmail.com; helo=mail-pj1-x102f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index e907a3c792..0e647886d1 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -678,6 +678,40 @@ 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; + } + + offloads = cpu_to_le64(n->curr_guest_offloads); + + if (offloads == virtio_net_supported_guest_offloads(n)) { + /* + * According to VirtIO standard, "Upon feature negotiation + * corresponding offload gets enabled to preserve + * backward compatibility." + * So we do not need to send this CVQ command if the guest + * also enables all supported offloads. + */ + return 0; + } + + 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 +734,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 Thu Jun 1 08:48:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hawkins Jiawei X-Patchwork-Id: 1788870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=FNICpp+q; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX0FP1pD5z20QB for ; Thu, 1 Jun 2023 18:50:01 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4dzi-0002iR-QR; Thu, 01 Jun 2023 04:49:18 -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 1q4dzW-0002Si-JH for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:49:10 -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 1q4dzU-0006Im-Sq for qemu-devel@nongnu.org; Thu, 01 Jun 2023 04:49:06 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-650a9ba426fso214075b3a.1 for ; Thu, 01 Jun 2023 01:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685609342; x=1688201342; 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=njzkDyjtwOWFxOUUDhj3QrAL+aWZx2wnp3b8e3dX67o=; b=FNICpp+q5w25/yegSycQ90SYITNYvLVxuPQf9/KttmMawIHoYFQdRTVTKcVzxkSrgR KZIIei0dV01G765T5MKTXrcaZXmM/Wj9omrsQ9t1tuN7ZaGWo5u5Tt/FKGnI1e/bTlNV nta0cHIjHcMqljZGaXWDbHcGHSD/282t20eCsP2dNolxhLkXtB4vuXhs1SnFoCoUFyCU hTtDoGZ0+XWXLgXR6Mu+TeGhaC2k3XZu5QVnOqLm1g9i/Z51ZOswJ972e7aU6NH8KUH1 XDSN/cAuCzy6GYHDLQReh6Yn8m8nrSltanFYDN3JZtBbaPvElpQ2I4haiC+wEwr/TAgk Cmhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685609342; x=1688201342; 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=njzkDyjtwOWFxOUUDhj3QrAL+aWZx2wnp3b8e3dX67o=; b=huYQ5ZkpeQjnYCLe4NFTrO851iHNgScaBlHqY8JaKopM+Wl2LvsyVQjfpzXFZ16pgH MCA2a+1XWclmY/dCixTHWq8xqPFTKpYmlKDoUUOSjy9LJ+QBAsJA81fqwfRM3275Z50Y 8+cQj+gjE6L6qlYgvecvgv8Cf1ZpBS06P6MYx/T5HzTtEyM5b2fpK4hQ7PWUYusd/ldG Wa7N/QLDrBaT8oAsFnJ+gtS89IruGvNNhLf7AscDg8LYapXGsUTdRiGoGwAChF9n2iuh Cc0cYxK7MKnMtUYPPtLwmuVWlhIaZ0I9SPV3LSp9y7J3L2fBQP8yaGIR2OFTaxqamwED 8VGQ== X-Gm-Message-State: AC+VfDxlBl6uRWcDdS7gKldd1htJ2CQlfHP08hpbnvYvrnOTHiOI655D OmptPumykqEOI3D79BDepyL69/5FfM4SxAHZwI4= X-Google-Smtp-Source: ACHHUZ4EnTJUSyBwlmBNUMgHM2FYZV7l2fiIfr2tx7GGyXBYjgMGLGn1iOQf/EFiQhhscmkiUvxl1g== X-Received: by 2002:a05:6a20:a1a0:b0:103:ef39:a829 with SMTP id r32-20020a056a20a1a000b00103ef39a829mr6930646pzk.26.1685609342257; Thu, 01 Jun 2023 01:49:02 -0700 (PDT) Received: from localhost ([117.136.38.170]) by smtp.gmail.com with ESMTPSA id u10-20020a17090341ca00b001a2104d706fsm2846418ple.225.2023.06.01.01.49.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 01:49:01 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com Subject: [PATCH v2 6/6] vdpa: Allow VIRTIO_NET_F_CTRL_GUEST_OFFLOADS in SVQ Date: Thu, 1 Jun 2023 16:48:20 +0800 Message-Id: <2b88df2f2daedbec4541841d64ef528065adff0d.1685584543.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Enable SVQ with VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature. Signed-off-by: Hawkins Jiawei Acked-by: Jason Wang --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 0e647886d1..4cc24a2997 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) |