From nobody Tue Dec 16 09:08:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1748580004; cv=none; d=zohomail.com; s=zohoarc; b=RNUDiywsyTGIsPKvwQKTcdVWsTXyTpaGyGAEeHiwUwZknUqf4WXcoWijUvsCwXlK+i3iDCVKkiIE9eriURv2FgidcXyEvCswJRBd3ttFowsLeUp3Yeosem2GoYAkbdoCZR5Dr5UdXXfJni1n2ElEL/mJoPsP/93lZSwIogTOZkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748580004; 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=N6IK2pONLYRna/BS0SsNNCt2yzso/grhSPTpd+N4Xjg=; b=JwogfD8p53aMOQdTnpmMZ/CWGJvRucxZY0RAjFJsBBXnPL6N9LHKQmsAb9ACa4/BDN8TewmUVVHfKM3ayc6EIppo5xzpcW6su+LmAYxm4bxcYpSFNY1nNPwob/hVaQ8s1iI7yU2WI2BaKgSZJWwswpot5bV0NuvRmI0sttz8hmc= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748580004895224.4162020053824; Thu, 29 May 2025 21:40:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKrWc-0006r0-W1; Fri, 30 May 2025 00:39:23 -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 1uKrWY-0006q1-FL for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:20 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKrWW-0006po-FN for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:18 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-234d3261631so11992945ad.1 for ; Thu, 29 May 2025 21:39:16 -0700 (PDT) Received: from localhost ([157.82.128.1]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-23506d14a85sm19959765ad.232.2025.05.29.21.39.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 May 2025 21:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1748579955; x=1749184755; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=N6IK2pONLYRna/BS0SsNNCt2yzso/grhSPTpd+N4Xjg=; b=LwodDReZPI/lZpSiLg7KV2CQV/yjkJ33ZicfXvh2ffbUy0yxAIPHUUsqfWZ02sl7MD FnGe89SciH9j/RLwuA8vmLRCaGHNDmguUrCgnrfAonp6skeikJP5iuRJcSOkiHw/1HR0 Xo3wDPu1lyC3ysfA6Y4McRiV5Y24t2Jk/VgiBBZeXK+XMiNhsq3CAcmklSnEXZsaap4J X+u1opekaGC0M5+kPkXvdZ83Bf7YWetd3o83por97oGHEcR5aUtvxxfyc4HexaDeuuHG ABC9bSWRWCWsi9oujvvmpH7Nk8XdbXaKshpWyXakTNXLAYVPdOdp1lIRU5tvmm/sD+d/ 10ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748579955; x=1749184755; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N6IK2pONLYRna/BS0SsNNCt2yzso/grhSPTpd+N4Xjg=; b=svZYJ8KP1YbO7rz8NLlVp2Z/eCMVSsJzUP4wKmnhSPPvGfcCcJ8QiWsoe7HTNKg4YX QrNFK29mv+lYJgmOQHbF7s1EVN9Z95AUe+FkrDeV1iNXgit1OlmBfgplfIN21ohewxf/ 5QIetmM+N0iub55vMEJKzSnckAJvCcknIwgZT5k7xakGQFNJOaeq5dWbFQfylSrlTsEV Y/7yk2Dr7TBzr1VAa8eQ1eDwuOuX35Qbgur75Yd5o+kIieVX720cggWgsTRCGg1EFKG9 or7HgCGlXs7Wk5+wYMmywZVlXiS9A+kmxp0iQbJ/AZuTx/S9eD4GoCXoBlIbmkuxMKQ9 LTpw== X-Gm-Message-State: AOJu0YyIWgmh1fm4ryqawOQAePtIqHvbLANfHsxHl0pVyrT3hfAxBzQD avp2m6DxUG2aB6fxAU0LTERr7MX9a439ndsWzuZtp9fLNIPLoGE5m+86jFP2afCId9g= X-Gm-Gg: ASbGncsUP5sfmJX+kku1W/E4agGAxh01l6pUQmKLgmD+UeNI+WEwM09gNUO+ZtOZ/FC 1n7TBEZIApgj1zNu4k1Luze6B0cHJ78wTMuSQb/Jqmd/7iNNrZ2l4p/PXc9qEKKafXOMqdL1j7I 08787oV7OtJ477GVgIYAqzsz7qqXIAeRIRwDw1QeHmDTktsPRCD64NPP7yBA6QWn7ghRtj48qmY HnV7Gz3YNJ6aY2yL+DYgD9eXEeRaW95ALHrD09OFtfoG10qltSv3IeIvD0rdSiS7Swc7zyRGC6C g44ZmIpe9THpa8fDBYLB4UI5NHCEwE4U/xuA5nurLy7U+8V0hpTv X-Google-Smtp-Source: AGHT+IF5CvUiLOyNy2RKylSeG3aoiGUK/tMYfL0zCHlei3sjy5QtYyNGm7WV0M/wg+Mh+gPLahJvcw== X-Received: by 2002:a17:903:234f:b0:234:f15b:f158 with SMTP id d9443c01a7336-235390e1736mr11540765ad.13.1748579955029; Thu, 29 May 2025 21:39:15 -0700 (PDT) From: Akihiko Odaki Date: Fri, 30 May 2025 13:39:09 +0900 Subject: [PATCH RFC v5 1/5] net: Allow configuring virtio hashing MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250530-hash-v5-1-343d7d7a8200@daynix.com> References: <20250530-hash-v5-0-343d7d7a8200@daynix.com> In-Reply-To: <20250530-hash-v5-0-343d7d7a8200@daynix.com> To: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Paolo Abeni , devel@daynix.com Cc: Akihiko Odaki X-Mailer: b4 0.15-dev-edae6 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=2607:f8b0:4864:20::632; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x632.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1748580007096116600 This adds functions to configure virtio hashing and implements it for Linux's tap. vDPA will have empty functions as configuring virtio hashing is done with the load(). Signed-off-by: Akihiko Odaki Tested-by: Lei Yang --- include/net/net.h | 13 +++++++++++++ net/tap-linux.h | 3 +++ net/tap_int.h | 3 +++ net/net.c | 11 +++++++++++ net/tap-bsd.c | 10 ++++++++++ net/tap-linux.c | 11 +++++++++++ net/tap-solaris.c | 10 ++++++++++ net/tap-stub.c | 10 ++++++++++ net/tap.c | 15 +++++++++++++++ net/vhost-vdpa.c | 13 +++++++++++++ 10 files changed, 99 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 545f4339cec8..779cee7f4a22 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -35,6 +35,12 @@ typedef struct NICConf { int32_t bootindex; } NICConf; =20 +typedef struct NetVnetRss { + uint32_t hash_types; + uint16_t indirection_table_mask; + uint16_t unclassified_queue; +} NetVnetRss; + #define DEFINE_NIC_PROPERTIES(_state, _conf) \ DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ DEFINE_PROP_NETDEV("netdev", _state, _conf.peers) @@ -61,6 +67,8 @@ typedef void (SetOffload)(NetClientState *, int, int, int= , int, int, int, int); typedef int (GetVnetHdrLen)(NetClientState *); typedef void (SetVnetHdrLen)(NetClientState *, int); typedef bool (GetVnetHashSupportedTypes)(NetClientState *, uint32_t *); +typedef void (SetVnetAutomq)(NetClientState *, uint32_t); +typedef void (SetVnetRss)(NetClientState *, const NetVnetRss *, bool); typedef int (SetVnetLE)(NetClientState *, bool); typedef int (SetVnetBE)(NetClientState *, bool); typedef struct SocketReadState SocketReadState; @@ -91,6 +99,8 @@ typedef struct NetClientInfo { SetVnetLE *set_vnet_le; SetVnetBE *set_vnet_be; GetVnetHashSupportedTypes *get_vnet_hash_supported_types; + SetVnetAutomq *set_vnet_automq; + SetVnetRss *set_vnet_rss; NetAnnounce *announce; SetSteeringEBPF *set_steering_ebpf; NetCheckPeerType *check_peer_type; @@ -192,6 +202,9 @@ void qemu_set_offload(NetClientState *nc, int csum, int= tso4, int tso6, int qemu_get_vnet_hdr_len(NetClientState *nc); void qemu_set_vnet_hdr_len(NetClientState *nc, int len); bool qemu_get_vnet_hash_supported_types(NetClientState *nc, uint32_t *type= s); +void qemu_set_vnet_automq(NetClientState *nc, uint32_t hash_types); +void qemu_set_vnet_rss(NetClientState *nc, const NetVnetRss *rss, + bool hash_report); int qemu_set_vnet_le(NetClientState *nc, bool is_le); int qemu_set_vnet_be(NetClientState *nc, bool is_be); void qemu_macaddr_default_if_unset(MACAddr *macaddr); diff --git a/net/tap-linux.h b/net/tap-linux.h index 9a58cecb7f47..5bca6cab1867 100644 --- a/net/tap-linux.h +++ b/net/tap-linux.h @@ -32,6 +32,9 @@ #define TUNSETVNETLE _IOW('T', 220, int) #define TUNSETVNETBE _IOW('T', 222, int) #define TUNSETSTEERINGEBPF _IOR('T', 224, int) +#define TUNSETVNETREPORTINGAUTOMQ _IOR('T', 229, __u32) +#define TUNSETVNETREPORTINGRSS _IOR('T', 230, NetVnetRss) +#define TUNSETVNETRSS _IOR('T', 231, struct NetVnetRss) =20 #endif =20 diff --git a/net/tap_int.h b/net/tap_int.h index 8857ff299d22..248d1efa51a0 100644 --- a/net/tap_int.h +++ b/net/tap_int.h @@ -27,6 +27,7 @@ #define NET_TAP_INT_H =20 #include "qapi/qapi-types-net.h" +#include "net/net.h" =20 int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required, int mq_required, Error **errp); @@ -40,6 +41,8 @@ int tap_probe_has_uso(int fd); void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int= ufo, int uso4, int uso6); void tap_fd_set_vnet_hdr_len(int fd, int len); +void tap_fd_set_vnet_automq(int fd, uint32_t hash_types); +void tap_fd_set_vnet_rss(int fd, const NetVnetRss *rss, bool hash_report); int tap_fd_set_vnet_le(int fd, int vnet_is_le); int tap_fd_set_vnet_be(int fd, int vnet_is_be); int tap_fd_enable(int fd); diff --git a/net/net.c b/net/net.c index d0ae3db0d864..7e21e1a373ab 100644 --- a/net/net.c +++ b/net/net.c @@ -582,6 +582,17 @@ bool qemu_get_vnet_hash_supported_types(NetClientState= *nc, uint32_t *types) return nc->info->get_vnet_hash_supported_types(nc, types); } =20 +void qemu_set_vnet_automq(NetClientState *nc, uint32_t hash_types) +{ + nc->info->set_vnet_automq(nc, hash_types); +} + +void qemu_set_vnet_rss(NetClientState *nc, const NetVnetRss *rss, + bool hash_report) +{ + nc->info->set_vnet_rss(nc, rss, hash_report); +} + int qemu_set_vnet_le(NetClientState *nc, bool is_le) { #if HOST_BIG_ENDIAN diff --git a/net/tap-bsd.c b/net/tap-bsd.c index b4c84441ba8b..8ed384f02c5b 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -221,6 +221,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) { } =20 +void tap_fd_set_vnet_automq(int fd, uint32_t hash_types) +{ + g_assert_not_reached(); +} + +void tap_fd_set_vnet_rss(int fd, const NetVnetRss *rss, bool hash_report) +{ + g_assert_not_reached(); +} + int tap_fd_set_vnet_le(int fd, int is_le) { return -EINVAL; diff --git a/net/tap-linux.c b/net/tap-linux.c index 22ec2f45d2b7..d0adb168e977 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -205,6 +205,17 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) } } =20 +void tap_fd_set_vnet_automq(int fd, uint32_t hash_types) +{ + assert(!ioctl(fd, TUNSETVNETREPORTINGAUTOMQ, &hash_types)); +} + +void tap_fd_set_vnet_rss(int fd, const NetVnetRss *rss, bool hash_report) +{ + unsigned int cmd =3D hash_report ? TUNSETVNETREPORTINGRSS : TUNSETVNET= RSS; + assert(!ioctl(fd, cmd, rss)); +} + int tap_fd_set_vnet_le(int fd, int is_le) { int arg =3D is_le ? 1 : 0; diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 51b7830bef1d..bc76a030e7f9 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -225,6 +225,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) { } =20 +void tap_fd_set_vnet_automq(int fd, uint32_t hash_types) +{ + g_assert_not_reached(); +} + +void tap_fd_set_vnet_rss(int fd, const NetVnetRss *rss, bool hash_report) +{ + g_assert_not_reached(); +} + int tap_fd_set_vnet_le(int fd, int is_le) { return -EINVAL; diff --git a/net/tap-stub.c b/net/tap-stub.c index 38673434cbd6..511ddfc707eb 100644 --- a/net/tap-stub.c +++ b/net/tap-stub.c @@ -56,6 +56,16 @@ void tap_fd_set_vnet_hdr_len(int fd, int len) { } =20 +void tap_fd_set_vnet_automq(int fd, uint32_t hash_types) +{ + g_assert_not_reached(); +} + +void tap_fd_set_vnet_rss(int fd, const NetVnetRss *rss, bool hash_report) +{ + g_assert_not_reached(); +} + int tap_fd_set_vnet_le(int fd, int is_le) { return -EINVAL; diff --git a/net/tap.c b/net/tap.c index ae1c7e398321..e93f5f951057 100644 --- a/net/tap.c +++ b/net/tap.c @@ -248,6 +248,19 @@ static void tap_set_vnet_hdr_len(NetClientState *nc, i= nt len) s->using_vnet_hdr =3D true; } =20 +static void tap_set_vnet_automq(NetClientState *nc, uint32_t hash_types) +{ + TAPState *s =3D DO_UPCAST(TAPState, nc, nc); + return tap_fd_set_vnet_automq(s->fd, hash_types); +} + +static void tap_set_vnet_rss(NetClientState *nc, const NetVnetRss *rss, + bool hash_report) +{ + TAPState *s =3D DO_UPCAST(TAPState, nc, nc); + return tap_fd_set_vnet_rss(s->fd, rss, hash_report); +} + static int tap_set_vnet_le(NetClientState *nc, bool is_le) { TAPState *s =3D DO_UPCAST(TAPState, nc, nc); @@ -344,6 +357,8 @@ static NetClientInfo net_tap_info =3D { .has_vnet_hdr_len =3D tap_has_vnet_hdr_len, .set_offload =3D tap_set_offload, .set_vnet_hdr_len =3D tap_set_vnet_hdr_len, + .set_vnet_automq =3D tap_set_vnet_automq, + .set_vnet_rss =3D tap_set_vnet_rss, .set_vnet_le =3D tap_set_vnet_le, .set_vnet_be =3D tap_set_vnet_be, .set_steering_ebpf =3D tap_set_steering_ebpf, diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 149c0f7f1766..43822f1f79da 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -271,6 +271,15 @@ static bool vhost_vdpa_get_vnet_hash_supported_types(N= etClientState *nc, return true; } =20 +static void vhost_vdpa_set_vnet_automq(NetClientState *nc, uint32_t hash_t= ypes) +{ +} + +static void vhost_vdpa_set_vnet_rss(NetClientState *nc, const NetVnetRss *= rss, + bool hash_report) +{ +} + static bool vhost_vdpa_has_ufo(NetClientState *nc) { assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VDPA); @@ -461,6 +470,8 @@ static NetClientInfo net_vhost_vdpa_info =3D { .cleanup =3D vhost_vdpa_cleanup, .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, .get_vnet_hash_supported_types =3D vhost_vdpa_get_vnet_hash_suppor= ted_types, + .set_vnet_automq =3D vhost_vdpa_set_vnet_automq, + .set_vnet_rss =3D vhost_vdpa_set_vnet_rss, .has_ufo =3D vhost_vdpa_has_ufo, .set_vnet_le =3D vhost_vdpa_set_vnet_le, .check_peer_type =3D vhost_vdpa_check_peer_type, @@ -1335,6 +1346,8 @@ static NetClientInfo net_vhost_vdpa_cvq_info =3D { .cleanup =3D vhost_vdpa_cleanup, .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, .get_vnet_hash_supported_types =3D vhost_vdpa_get_vnet_hash_supported_= types, + .set_vnet_automq =3D vhost_vdpa_set_vnet_automq, + .set_vnet_rss =3D vhost_vdpa_set_vnet_rss, .has_ufo =3D vhost_vdpa_has_ufo, .check_peer_type =3D vhost_vdpa_check_peer_type, }; --=20 2.49.0 From nobody Tue Dec 16 09:08:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1748579973; cv=none; d=zohomail.com; s=zohoarc; b=RLv//iGPpjhJSCTrBsCTV8j0ytJlHqOnY571YUEVR03beecOcynJbF9Pscil2aZa7aJooVGlM3MqPWyo0ZLbGBXCkTWOtiwb+qs66yBExikaaEW9GJBtjp/BzBxc6UrT5Dg7gQP0hghqkVP/gWXi8zumUAt090xStiAMkr6eGYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748579973; 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=tQBzKuduCWcv6douWsbSGAxa5Fec63h7Sr3QTsoSHc4=; b=QJVZKx39Aed6mREg8EzjqkpJDV/lwhyuhbSbvB8nnY9jKFZc/XlniKXcOeC1B063DCc9rCN0JbfytGzFLv5DtqLBdSNnLYJmDyaTBnrXGekCUcT4/5EzEPm/SxJEnDyzpZDVwfe2/hzrQ+aMd++Toxa4h4EI2yFLWzujYvzYr3Y= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748579973412939.8818876454291; Thu, 29 May 2025 21:39:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKrWe-0006r4-82; Fri, 30 May 2025 00:39:25 -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 1uKrWb-0006qQ-5f for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:21 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKrWZ-0006q9-7h for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:20 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-73972a54919so1409640b3a.3 for ; Thu, 29 May 2025 21:39:18 -0700 (PDT) Received: from localhost ([157.82.128.1]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-747afe96474sm2166809b3a.22.2025.05.29.21.39.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 May 2025 21:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1748579958; x=1749184758; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tQBzKuduCWcv6douWsbSGAxa5Fec63h7Sr3QTsoSHc4=; b=O+5tXOPE6PlpmoiS6qAIqgs8fSpwxH3nLWUsSj20tMExgZoL9KSFb5V7+J+WMOheob B4S26hfUyNU5fJYJF8Mk2EaT1xH27Xfv4+65c3iJXVSYs4Vvr82wbLxdMNowwtZ+EUGu uyAGUWEjnE4Wx/Lfuz48erPVlTuwh+1LNf1sdduSLTDuCM0AHiDn06/Rt8Lv4PxrmRFG 8yIjyJQ2Uk4KXaY20TXQDlR76oWfD73YVIdvQMytW5RghAHYwO2eAYqejuQViEWRqEyh 4NjBG9EsUMFudjUM01HmAHeJxAfLGjSfaanV8hSkb3NQarSUJAdovg2O7fXIAXIzIH71 4AiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748579958; x=1749184758; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tQBzKuduCWcv6douWsbSGAxa5Fec63h7Sr3QTsoSHc4=; b=XPYPHA43pisQPYSwCcXYEwou51qyjSRvzRsx6bnbV4xOYuCs8aLnVh2eGzSCdZFpvz 2LYQcx0HyxWH2JwIgES/Lx4ODlWd8aOkaB/lH+vWGKC6ht4lO/EthCw2yMgOyI7EoPhD dTVuj5egOhScS6NxyAqjxA8f7pJgEG096Zqx1v1Qu0gR/uL7ypFdcru03TmF2N34ilxQ 9zVOzYpYSNv0CDncJYNZvRpubhpClJgeKzSLkEG7enH/TIa8MqPnTuyzxFspC33OU+0S C4cncNitYl79hQKj63SK3ne/YGoBzpgi5o2KP2jG3QPxo5r6iPAE1p8xW+xWW5LjFyX8 s9DQ== X-Gm-Message-State: AOJu0YxBc2KUEBE1ZWF7kijRdDSN+NDt2zoh9SmV3jub+0w2eoaDEnED 1F6sCmtXWA1+sKBtimQjN2qMw4JeLPPD1q0nF++lWZzVi43RefZQtrmQ5tU4KFcQedw= X-Gm-Gg: ASbGncsY/sl6jQx7frmUeaH+NAfnDYXUJBrSHBqRly2cNnA87L/fao7GptPELkLsyAo HjcCiwvaQBEgvmaXbAwh3nc56dwaajp3g3XkfXS3bWZLJ5l43C80r+2OYCbf+gDzVYmjbFaPFDe AzihmPBTdeESvBAm80YWj8awIIOMvrrSpWIO7gsUJecyEstQFHJk+KCaWK4vsGYmAffU3wtKFvC hdiV3t81R1Y+13IiSxBIeSvsCkaNrDVJt67sDUHBP8CELahRffcxs5Ee2CKJ7usL7czb+CJYnn+ WyB1R+5wYothIy7PCf/nwH36vXq4U55OvxeV0L4N3eQvlkn4oySB X-Google-Smtp-Source: AGHT+IHqRAmp46ed22bvl6PfckJl/SS19VJhqfp+c8yVJteQJydudop/co7IlYAXsvRSdgOAbKJ2cg== X-Received: by 2002:a05:6a00:3a24:b0:742:da7c:3f28 with SMTP id d2e1a72fcca58-747bda19b11mr2731167b3a.21.1748579957661; Thu, 29 May 2025 21:39:17 -0700 (PDT) From: Akihiko Odaki Date: Fri, 30 May 2025 13:39:10 +0900 Subject: [PATCH RFC v5 2/5] virtio-net: Offload hashing to peer MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250530-hash-v5-2-343d7d7a8200@daynix.com> References: <20250530-hash-v5-0-343d7d7a8200@daynix.com> In-Reply-To: <20250530-hash-v5-0-343d7d7a8200@daynix.com> To: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Paolo Abeni , devel@daynix.com Cc: Akihiko Odaki X-Mailer: b4 0.15-dev-edae6 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=2607:f8b0:4864:20::435; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x435.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1748579974719116600 This allows offloading hash reporting and RSS to tap. Signed-off-by: Akihiko Odaki Tested-by: Lei Yang --- hw/net/virtio-net.c | 69 +++++++++++++++++++++++++++++++++++++++++++------= ---- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 52fe404b3431..0a333d560d7b 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1213,20 +1213,58 @@ static void virtio_net_detach_ebpf_rss(VirtIONet *n) =20 static void virtio_net_commit_rss_config(VirtIONet *n) { - if (n->rss_data.peer_hash_available) { - return; - } - if (n->rss_data.enabled) { - n->rss_data.enabled_software_rss =3D n->rss_data.populate_hash; - if (n->rss_data.populate_hash) { - virtio_net_detach_ebpf_rss(n); - } else if (!virtio_net_attach_ebpf_rss(n)) { - if (get_vhost_net(qemu_get_queue(n->nic)->peer)) { - warn_report("Can't load eBPF RSS for vhost"); + if (n->rss_data.peer_hash_available && + (n->rss_data.peer_hash_types & n->rss_data.runtime_hash_types)= =3D=3D + n->rss_data.runtime_hash_types) { + if (n->rss_data.redirect) { + size_t indirection_table_size =3D + n->rss_data.indirections_len * + sizeof(*n->rss_data.indirections_table); + + size_t hash_size =3D sizeof(NetVnetRss) + + indirection_table_size + + sizeof(n->rss_data.key); + + g_autofree struct { + NetVnetRss hdr; + uint8_t footer[]; + } *rss =3D g_malloc(hash_size); + + rss->hdr.hash_types =3D n->rss_data.runtime_hash_types; + rss->hdr.indirection_table_mask =3D + n->rss_data.indirections_len - 1; + rss->hdr.unclassified_queue =3D n->rss_data.default_queue; + + memcpy(rss->footer, n->rss_data.indirections_table, + indirection_table_size); + + memcpy(rss->footer + indirection_table_size, n->rss_data.k= ey, + sizeof(n->rss_data.key)); + + qemu_set_vnet_rss(qemu_get_queue(n->nic)->peer, &rss->hdr, + n->rss_data.populate_hash); } else { - warn_report("Can't load eBPF RSS - fallback to software RS= S"); - n->rss_data.enabled_software_rss =3D true; + qemu_set_vnet_automq(qemu_get_queue(n->nic)->peer, + n->rss_data.runtime_hash_types); + } + + n->rss_data.enabled_software_rss =3D false; + } else { + if (n->rss_data.peer_hash_available) { + qemu_set_vnet_automq(qemu_get_queue(n->nic)->peer, 0); + } + + n->rss_data.enabled_software_rss =3D n->rss_data.populate_hash; + if (n->rss_data.populate_hash) { + virtio_net_detach_ebpf_rss(n); + } else if (!virtio_net_attach_ebpf_rss(n)) { + if (get_vhost_net(qemu_get_queue(n->nic)->peer)) { + warn_report("Can't load eBPF RSS for vhost"); + } else { + warn_report("Can't load eBPF RSS - fallback to softwar= e RSS"); + n->rss_data.enabled_software_rss =3D true; + } } } =20 @@ -1235,7 +1273,12 @@ static void virtio_net_commit_rss_config(VirtIONet *= n) n->rss_data.indirections_len, sizeof(n->rss_data.key)); } else { - virtio_net_detach_ebpf_rss(n); + if (n->rss_data.peer_hash_available) { + qemu_set_vnet_automq(qemu_get_queue(n->nic)->peer, 0); + } else { + virtio_net_detach_ebpf_rss(n); + } + trace_virtio_net_rss_disable(n); } } --=20 2.49.0 From nobody Tue Dec 16 09:08:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1748580022; cv=none; d=zohomail.com; s=zohoarc; b=HW9IGXyetmZhS07AUOqKtZ3dUIfyeO0z/xy1UMgPW1NQBFqb+LF5ALtmm4O+oRPNQqnz7EsZr9+9/ZCCcgflOJmfxptMU6Eg1HBHm8/wX8MpBe3tQxyQWQjiGc5ZzeWDBwwyLVgUDzmxT/xqrO5+KUWnVL8kUrj6i3TtzPkx/Zk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748580022; 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=v9JDnq6XeGtOR9OFG+ek3d5CCEoi428rIOkuRtKIBFc=; b=iKC3BPowxwfiWiY+DLVIhYmAFPaM/ma4flxRFQXm7UujTv7+lMMoZqzp8B+V66WcAFlbVHQhaE/M6XFMUYmO5t8zu5jMtjHy/E8jhlQx4i3ae6niG9PFkGn67tL1V6kJ8hEl2uEtTnhNq9CmSMhfxeLJiPfmeip93ip9L5/ZTQo= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748580022733653.4619260020478; Thu, 29 May 2025 21:40:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKrWh-0006si-Qu; Fri, 30 May 2025 00:39:27 -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 1uKrWe-0006r5-5Y for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:25 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKrWb-0006qb-If for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:23 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-b26c5fd40a9so2170036a12.1 for ; Thu, 29 May 2025 21:39:21 -0700 (PDT) Received: from localhost ([157.82.128.1]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-3124e30cbe6sm358543a91.39.2025.05.29.21.39.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 May 2025 21:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1748579960; x=1749184760; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=v9JDnq6XeGtOR9OFG+ek3d5CCEoi428rIOkuRtKIBFc=; b=bPtWgWbq21TVEqzRVc3YvP4fIYoCI7VDohRYTEDVcVPqtTTsHZg3cf6gnPpeANwT38 QVYFhU0fhFWT6UbMYXOrZyXjYlD03f+BUUrkOkfWR1QRlnPsQt/i9cgqo95zpcA9Kapv v891lZum/EBekSBGVnrLxm8t705JhgH27p2kBYfAAB8D2hRM01XC0IvMc0okMX9rnxdQ o5Dt4rJhi0TOT/Yamsl/Q1WAlBvvp1P+8Yn26o18m1CR+5e5ZK1oyZ9Yd71HtNX218hx zHOWi4o9M0fRgON/5DsKkSTp3A9li2LYlCCgdhdx8kaQbfgHhbZVTasnr87odjzyXuBO He6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748579960; x=1749184760; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v9JDnq6XeGtOR9OFG+ek3d5CCEoi428rIOkuRtKIBFc=; b=EnblMshBTLjruopI3f6yKGSXxpN6MF9WQ2x6vAR73VHQihJltPE2ZJCja4kHaeumwH fmbSS0nvw+rLCjTCRQa8c5Qn/3GZhAj7XlT4hjKku5Im2NA8ZhPLsAe3Q19m0Encxj2Z /MdKw6Cwgg2JW/aCC2n+P1L2kBWxBXcUJ9EJaDLc3q5v4dW/z0Wwtpv+DSpsPixR84yg TTVA7BtNm9ixtjtDKLa4V9m/uhDKI3A3a0+aOnbCJJ5tA2AdgsoP6NJx55znSBhqAdgI TK+gvTNj5gxykXNhpgZ3ihhcSkOSlW7PXamWdTf2dvVQTwXPHrZNnPfbHaaTJxcwmaxq sq0w== X-Gm-Message-State: AOJu0YzxkMD3Q3mqkZYJI/btA1zvTbWeRqrjOkQTVp8m7uV32oXgggk1 oapRcrmDyk1h+BJrq9uqcygu5n2Rb+jg3jD5SNE0nilgEzU7WNH5/sp8UuR0y9+e0u5ErxMqGOW 4zmxd X-Gm-Gg: ASbGncuRPzAOq6Khfx5gYWSVK443L6VyohNcE8Fo1AqXSX+qSxiK8SoLjrPyox0Dp1O ZEBwW1BT2CVwqfo1nUCkhM3pQML5tSN7IMC6cSOs3aDKSLSE+hI2nc6LbwJOBOzvI6oJhYQVPn/ 1Jvo5+em0wNg2q7Jw0RmPL0x4CF9TBeNUWta8tmY6KkOTyAkRPE8S8Rw+c3zrgDG86Kum1/EM/E IlONEqM5wMVKs+38QVsIH2l4ULsGXXZbXjRoITjx46fLKfR9RbyMT+jORneVuX+exiIsJ171ojh 18D8M4kMzEzqkQE71QsnajsLCJKLv1uSYjDJSbpc2dkJFQ982Zce X-Google-Smtp-Source: AGHT+IFs5vC5Nq3LNSNzI9RojaD2Dz2a5p6cDsBfBOey3yt76JwcBgP7aWW2aXcKVpLgbIbusYRF5w== X-Received: by 2002:a17:90b:2f03:b0:30a:9feb:1e15 with SMTP id 98e67ed59e1d1-31214e2efabmr10456036a91.8.1748579960146; Thu, 29 May 2025 21:39:20 -0700 (PDT) From: Akihiko Odaki Date: Fri, 30 May 2025 13:39:11 +0900 Subject: [PATCH RFC v5 3/5] virtio-net: Offload hashing without vhost MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250530-hash-v5-3-343d7d7a8200@daynix.com> References: <20250530-hash-v5-0-343d7d7a8200@daynix.com> In-Reply-To: <20250530-hash-v5-0-343d7d7a8200@daynix.com> To: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Paolo Abeni , devel@daynix.com Cc: Akihiko Odaki X-Mailer: b4 0.15-dev-edae6 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=2607:f8b0:4864:20::52d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52d.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1748580023439116600 This is necessary to offload hashing to tap. Signed-off-by: Akihiko Odaki Tested-by: Lei Yang --- hw/net/virtio-net.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 0a333d560d7b..3469c211b13a 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1968,7 +1968,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState = *nc, const uint8_t *buf, } =20 receive_header(n, sg, elem->in_num, buf, size); - if (n->rss_data.populate_hash) { + if (n->rss_data.enabled_software_rss && + n->rss_data.populate_hash) { offset =3D offsetof(typeof(extra_hdr), hash_value); iov_from_buf(sg, elem->in_num, offset, (char *)&extra_hdr + offset, @@ -3099,11 +3100,13 @@ static uint64_t virtio_net_get_features(VirtIODevic= e *vdev, uint64_t features, } =20 if (!get_vhost_net(nc->peer)) { - if (!use_own_hash) { - virtio_clear_feature(&features, VIRTIO_NET_F_HASH_REPORT); - virtio_clear_feature(&features, VIRTIO_NET_F_RSS); - } else if (virtio_has_feature(features, VIRTIO_NET_F_RSS)) { - virtio_net_load_ebpf(n, errp); + if (!use_peer_hash) { + if (!use_own_hash) { + virtio_clear_feature(&features, VIRTIO_NET_F_HASH_REPORT); + virtio_clear_feature(&features, VIRTIO_NET_F_RSS); + } else if (virtio_has_feature(features, VIRTIO_NET_F_RSS)) { + virtio_net_load_ebpf(n, errp); + } } =20 return features; --=20 2.49.0 From nobody Tue Dec 16 09:08:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1748580009; cv=none; d=zohomail.com; s=zohoarc; b=M7PgGt64cyZbWV76M5WrUu5SM5JXraDBZO0R5H2HSNMJOomZUZY8FvL2U+KzFLaRsDr/0BSCgJbPdAw37SSn5rbAjBHPK9tuqWxKmXQgcbI61eYPjJUnrNajLghuM9AV0lJxxr83+CnEfe9DZf9e8JWDtbJjBtn+TmGWJ/vfaRg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748580009; 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=Mx7zGASuywiR+Ti11wYezZ6qGVfJB8X9zlwy+2u3tYU=; b=EiwMs9wwE4kXxK8FoCOuT76O9QN1bUocMqoSxZ997EQh9UzfJsgpJqwB+e9tBwBWg3fLstTh0+iOffIj4OI8vXC3d6XNOxNGEUG53W1xI5umM9Jp0DxcKv/0Ei0oW1Ibm6gv5nW8jjK97/odxVUiDn9ECuP+cPPXUvsTIPke2Ks= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748580009262415.07049489996973; Thu, 29 May 2025 21:40:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKrWh-0006sq-Vw; Fri, 30 May 2025 00:39:28 -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 1uKrWg-0006s5-A0 for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:26 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKrWe-0006rQ-DN for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:25 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-b2c41acd479so1186167a12.2 for ; Thu, 29 May 2025 21:39:24 -0700 (PDT) Received: from localhost ([157.82.128.1]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-3124e2e9c9fsm359092a91.30.2025.05.29.21.39.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 May 2025 21:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1748579963; x=1749184763; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Mx7zGASuywiR+Ti11wYezZ6qGVfJB8X9zlwy+2u3tYU=; b=VQl/1Ir4TSMDpxodTk/0CLfl7ewkvIOAhpVAliNO6H2b7FEjsIE/L4Ukbu46gMQe0D 6kv5gnvTB/zz6+Z4HDswU1tIln2oN5MC/RMBU43dEyzHrVgDme6fPYhrhnDj0sgv7xdO /MLU/Ei1H0g4OjvG1Uoh+rsd6dukyU3khcSBwtStiFnDEmvr6uff9jshCOWYI72v5DrU gYq4O/Lt4L1l5t+yF7zKAdVJsrMxz+5BtpQVRGD4T2uB8A6diTY7n9101i1AfNAwLwwv AJzV0XbDS58IhiqnxhTA4Wmk4dla6EPFm1JxP/mzC+IhY+9s+W4bhq+i9ozuvEt8hy7l RWeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748579963; x=1749184763; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mx7zGASuywiR+Ti11wYezZ6qGVfJB8X9zlwy+2u3tYU=; b=vcf25SOUcsjWvkRYY0C5ajfHwHQQ9cUwKGlURbuutIDzm3A6nqZSXzeK8KyBg96y4k /emY5+84PDmW0nOdbEuVmFDQug9XI+Ii2dG/GJHX3UlXC2MDPNcDofQ7oUogNJ3va2sH TKu3UXu+RpTtVp7gMcGlcAW/Jh380ucBKB1YP5E7aiyTDKKyfEZ3ybnfNwBdj7+MA1bm 9088EBabmMI8BI9Fjf8kQIjGk9lSJkCGos314+/sS8ueFPHVYtYHnXqwLBYMT0ljUoGI 3qFrW/arnHq+Dag6HMWFhg6IfuSKIlDMJ7U3IRsAcXeD34DVObrOOmIJsxLzOfbkCotL 7irA== X-Gm-Message-State: AOJu0Yw18rCX2K2JVu0KdetMcT1/nLE5CVexKgMJlQJ2W5G7XdD118Ib gWovcTLY8TwjskRe/UVjdbCBD6zlCOD1rWrmT5EuXx69nwbDUsUv5hT2JYCV5hKYGxY= X-Gm-Gg: ASbGncuynvQ90XOOFxe5OlBaQrBwXoqiJLcPPw1spfm4tuKAruu3HUvkZwsAtJURBqN PdfEzqwpMZlvm1+NQHI2n58yo8TRGrPdYBMx8EDMEJSWLUk9i+8xTDJNKyL5PcY658RfJLUmqvr nxtLuiZOikgPmu15KykFB/hq6g+ii/qZbi8RV/a+MSKz9+IWxfUjn2roQfoVtWUfqwgG6e3cr6X smPZzYy3HRTRSOEp3IjbgqMp7IkM9LBDpQvuZMx7jzYWLHo1QKTwdoKl49LOiXrTjFWzby8SP4h Lq9Ak5QTEl5lMwuoF4IiakiLhaqg9jzupkd/Zt/y+napTaflnDFi X-Google-Smtp-Source: AGHT+IFLbR9TY06Ln9AL54x2ktJlvUISgmUTKebG27Rh2dHIPHqLTDXmYgEHz0Qdw+mCPzti2xo/oA== X-Received: by 2002:a17:90b:17c5:b0:311:eb85:96f2 with SMTP id 98e67ed59e1d1-31241735eadmr2577665a91.21.1748579962596; Thu, 29 May 2025 21:39:22 -0700 (PDT) From: Akihiko Odaki Date: Fri, 30 May 2025 13:39:12 +0900 Subject: [PATCH RFC v5 4/5] tap: Report virtio-net hashing support on Linux MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250530-hash-v5-4-343d7d7a8200@daynix.com> References: <20250530-hash-v5-0-343d7d7a8200@daynix.com> In-Reply-To: <20250530-hash-v5-0-343d7d7a8200@daynix.com> To: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Paolo Abeni , devel@daynix.com Cc: Akihiko Odaki X-Mailer: b4 0.15-dev-edae6 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=2607:f8b0:4864:20::533; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x533.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1748580011221116600 This allows offloading virtio-net hashing to tap on Linux. Signed-off-by: Akihiko Odaki Tested-by: Lei Yang --- net/tap-linux.h | 1 + net/tap_int.h | 1 + net/tap-bsd.c | 5 +++++ net/tap-linux.c | 5 +++++ net/tap-solaris.c | 5 +++++ net/tap-stub.c | 5 +++++ net/tap.c | 8 ++++++++ 7 files changed, 30 insertions(+) diff --git a/net/tap-linux.h b/net/tap-linux.h index 5bca6cab1867..fe30f4f27788 100644 --- a/net/tap-linux.h +++ b/net/tap-linux.h @@ -32,6 +32,7 @@ #define TUNSETVNETLE _IOW('T', 220, int) #define TUNSETVNETBE _IOW('T', 222, int) #define TUNSETSTEERINGEBPF _IOR('T', 224, int) +#define TUNGETVNETHASHTYPES _IOR('T', 228, __u32) #define TUNSETVNETREPORTINGAUTOMQ _IOR('T', 229, __u32) #define TUNSETVNETREPORTINGRSS _IOR('T', 230, NetVnetRss) #define TUNSETVNETRSS _IOR('T', 231, struct NetVnetRss) diff --git a/net/tap_int.h b/net/tap_int.h index 248d1efa51a0..5ff9ca721928 100644 --- a/net/tap_int.h +++ b/net/tap_int.h @@ -36,6 +36,7 @@ ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxl= en); =20 void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp); int tap_probe_vnet_hdr(int fd, Error **errp); +bool tap_probe_vnet_hash_supported_types(int fd, uint32_t *types); int tap_probe_has_ufo(int fd); int tap_probe_has_uso(int fd); void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int= ufo, diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 8ed384f02c5b..749732138502 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -217,6 +217,11 @@ int tap_probe_has_uso(int fd) return 0; } =20 +bool tap_probe_vnet_hash_supported_types(int fd, uint32_t *types) +{ + return false; +} + void tap_fd_set_vnet_hdr_len(int fd, int len) { } diff --git a/net/tap-linux.c b/net/tap-linux.c index d0adb168e977..76fc88acaa18 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -196,6 +196,11 @@ int tap_probe_has_uso(int fd) return 1; } =20 +bool tap_probe_vnet_hash_supported_types(int fd, uint32_t *types) +{ + return !ioctl(fd, TUNGETVNETHASHTYPES, types); +} + void tap_fd_set_vnet_hdr_len(int fd, int len) { if (ioctl(fd, TUNSETVNETHDRSZ, &len) =3D=3D -1) { diff --git a/net/tap-solaris.c b/net/tap-solaris.c index bc76a030e7f9..65234c49a196 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -221,6 +221,11 @@ int tap_probe_has_uso(int fd) return 0; } =20 +bool tap_probe_vnet_hash_supported_types(int fd, uint32_t *types) +{ + return false; +} + void tap_fd_set_vnet_hdr_len(int fd, int len) { } diff --git a/net/tap-stub.c b/net/tap-stub.c index 511ddfc707eb..281bae2615d2 100644 --- a/net/tap-stub.c +++ b/net/tap-stub.c @@ -52,6 +52,11 @@ int tap_probe_has_uso(int fd) return 0; } =20 +bool tap_probe_vnet_hash_supported_types(int fd, uint32_t *types) +{ + return false; +} + void tap_fd_set_vnet_hdr_len(int fd, int len) { } diff --git a/net/tap.c b/net/tap.c index e93f5f951057..4a8adcf447eb 100644 --- a/net/tap.c +++ b/net/tap.c @@ -248,6 +248,13 @@ static void tap_set_vnet_hdr_len(NetClientState *nc, i= nt len) s->using_vnet_hdr =3D true; } =20 +static bool tap_get_vnet_hash_supported_types(NetClientState *nc, + uint32_t *types) +{ + TAPState *s =3D DO_UPCAST(TAPState, nc, nc); + return tap_probe_vnet_hash_supported_types(s->fd, types); +} + static void tap_set_vnet_automq(NetClientState *nc, uint32_t hash_types) { TAPState *s =3D DO_UPCAST(TAPState, nc, nc); @@ -357,6 +364,7 @@ static NetClientInfo net_tap_info =3D { .has_vnet_hdr_len =3D tap_has_vnet_hdr_len, .set_offload =3D tap_set_offload, .set_vnet_hdr_len =3D tap_set_vnet_hdr_len, + .get_vnet_hash_supported_types =3D tap_get_vnet_hash_supported_types, .set_vnet_automq =3D tap_set_vnet_automq, .set_vnet_rss =3D tap_set_vnet_rss, .set_vnet_le =3D tap_set_vnet_le, --=20 2.49.0 From nobody Tue Dec 16 09:08:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1748580027; cv=none; d=zohomail.com; s=zohoarc; b=Yc/bw2hJtS4Yyu6FWc5qE9R2JHLl9RiTo205GeqCHrDT2cvTpNAABsIaOI9S4Gu9lWw9Pn+76BCrjhrKXdPQMz3Orb46nzAJUe9qO9uu3+qfGGK1dGtGWMjGphmQZTDGM9xr/82bPAGosGm/RIpO9S3rABDf1zd8R6KLOyXf2T8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748580027; 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=sFnEkxpqDtfzprFYZUgRLN1d2YY75A42mlPHJtM+n4U=; b=RBLdHQxKvHAe7zWn0rvbCKpnlu/0/ICwdasVM1M31smnsjqJtyw3YDxTPcPsIajfg4eAl/kYzz80/pvC/zxUZorfb+6mZq/qmfMzgad/0U3DEZnA7QPDF8WL+KrKl89G+P7lkDnJQ4ih1uuO1sCuOAbG6rl2kmnkOknvHt8RZ6I= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748580027634398.19132594403175; Thu, 29 May 2025 21:40:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKrWl-0006u2-1V; Fri, 30 May 2025 00:39: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 1uKrWi-0006tS-Qb for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:28 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uKrWh-0006ru-4g for qemu-devel@nongnu.org; Fri, 30 May 2025 00:39:28 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2351ffb669cso9117405ad.2 for ; Thu, 29 May 2025 21:39:26 -0700 (PDT) Received: from localhost ([157.82.128.1]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-3124e2e8e4bsm355921a91.23.2025.05.29.21.39.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 May 2025 21:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1748579966; x=1749184766; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sFnEkxpqDtfzprFYZUgRLN1d2YY75A42mlPHJtM+n4U=; b=j0x7us4BI421Pgkklfp9P0nvl5Fix61Gvcj0wAP4tIDryBHOOoWNN6oVjTic0q8z0n nhWenctsujeQurbGO+8ngxUSR2HFEv5ZAgpoh7u+j80m1129Mtmeri6xGuNnqpc6SUQ6 CkD5l/oG33P0ysqsJk0T7jdyGhEmrqb0hH6GiNEXQL7ifziDZjVx7XgoxXbSmvQSibp5 /W3EY+ZHWq47XJuSIIJhD1dzGMW8BIZGC6kxysW2o6W5mJOCOK1JYZvh47erBIyNRB7R SlOxmAdB28P/mVe19gThu6bToo1rk1ZLL8ShcsK+Kgs8Nis1HBt6S47WLuhpcEVRsAVd Xd3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748579966; x=1749184766; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sFnEkxpqDtfzprFYZUgRLN1d2YY75A42mlPHJtM+n4U=; b=oCqzNzThn7zIp2/4p+3bqMA5slBIwPkzJHVIewYcTNwVbzstdXBZpFvXlqnygXwtk2 e6ImuPW5Su2jAs9drOnewpJvCQUEBb2/L2c2t5IGCeKFgftSys78QFld6UY8qr9hqtSP Yo5h71yR22MFNkqBdfeCFe/Blgd4/2EZoEY8boQ2QEitAlZKR7VYUoEj3ONfUBPfjikP esUGXXqtI/fWLKpgISkrh5sL5R/qaeZg5sSrNvbAb4j0aX0HgoDpgpX14EF62hZjkH1V HY2VQCz0QU3xMOc5PIhQrKub1y8Z/s7mBt4XY/nKyhwK7s1i8EsPJlT1KeOJp9epeorV vfOQ== X-Gm-Message-State: AOJu0YyjidMURtHrNXjgME8ReNYHmtJdzlLBIf1Jb+aOGhnULCkBqDSP yhwFixqdTmisJ5WGOdjNAHlV8dN1/GY28jw3fyrgxWzF+vSeuVr6FUayRRSI3zJ5KXs= X-Gm-Gg: ASbGnctwwR1AB3MnTUv/SdXtKKq3TE/rVrQV7xbfo3I8uqXOm4EenV3InbjZqJvHRuo eKDq6I8o8py+vfJ34Cm3Fgjjb1dtmdRU38COZMs7xVip9CaefQj9inAAQhJ9DD2/Pc5MOssFDKA uAt1vHnLzHaX+IHDBQiYx5r7VDpi7ckuHdGf33hyXuFP9XgqrdcRBaPfhqV5MtlwlqrfOUz+9ol /DtboA3D/is2xQvz3Y/Krh4NfwQVXsFzBW+LMfXupxUygZOwXFM38xuNHCWSoP8whe6ePmw5YSg quJZuusWcxjgzde8zwxpi6NDQlgWBWY9WE9cTFVn+ErNOz5Ysnw/ X-Google-Smtp-Source: AGHT+IEogidMLUTfTLR0ZTlwZY1Bv4DYR5+sXt9zklUm7IoGd+1UwSQf9/gZzC3A+sUjaxtqYD9InA== X-Received: by 2002:a17:90a:d2cf:b0:312:1c83:58e7 with SMTP id 98e67ed59e1d1-3124150d60bmr3061450a91.1.1748579965684; Thu, 29 May 2025 21:39:25 -0700 (PDT) From: Akihiko Odaki Date: Fri, 30 May 2025 13:39:13 +0900 Subject: [PATCH RFC v5 5/5] docs/devel/ebpf_rss.rst: Update for peer RSS MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250530-hash-v5-5-343d7d7a8200@daynix.com> References: <20250530-hash-v5-0-343d7d7a8200@daynix.com> In-Reply-To: <20250530-hash-v5-0-343d7d7a8200@daynix.com> To: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Paolo Abeni , devel@daynix.com Cc: Akihiko Odaki X-Mailer: b4 0.15-dev-edae6 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=2607:f8b0:4864:20::62e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62e.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1748580029497116600 eBPF RSS virtio-net support was written in assumption that there is only one alternative RSS implementation: 'in-qemu' RSS. It is no longer true, and we now have yet another implementation; namely the peer RSS. Signed-off-by: Akihiko Odaki Tested-by: Lei Yang --- docs/devel/ebpf_rss.rst | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/devel/ebpf_rss.rst b/docs/devel/ebpf_rss.rst index ed5d33767bd5..739d0259a168 100644 --- a/docs/devel/ebpf_rss.rst +++ b/docs/devel/ebpf_rss.rst @@ -7,9 +7,21 @@ eBPF RSS virtio-net support RSS(Receive Side Scaling) is used to distribute network packets to guest v= irtqueues by calculating packet hash. Usually every queue is processed then by a spe= cific guest CPU core. =20 -For now there are 2 RSS implementations in qemu: -- 'in-qemu' RSS (functions if qemu receives network packets, i.e. vhost=3D= off) -- eBPF RSS (can function with also with vhost=3Don) +For now there are 3 RSS implementations in qemu: +1. Peer RSS +2. eBPF RSS +3. 'In-QEMU' RSS + +'In-QEMU' RSS is incompatible with vhost since the packets are not routed = to +QEMU. eBPF RSS requires Linux 5.8+. Peer RSS requires the peer to implemen= t RSS. +Currently QEMU can use the RSS implementation of vDPA and Linux's TUN modu= le, +which is currently being upstreamed. + +eBPF RSS does not support hash reporting. Peer RSS may support limited hash +types. + +virtio-net automatically chooses the RSS implementation to use. Peer RSS is +the most preferred, and 'in-QEMU' RSS is the least. =20 eBPF support (CONFIG_EBPF) is enabled by 'configure' script. To enable eBPF RSS support use './configure --enable-bpf'. @@ -49,9 +61,6 @@ eBPF RSS turned on by different combinations of vhost-net= , vitrio-net and tap co =20 tap,vhost=3Don & virtio-net-pci,rss=3Don,hash=3Don =20 -If CONFIG_EBPF is not set then only 'in-qemu' RSS is supported. -Also 'in-qemu' RSS, as a fallback, is used if the eBPF program failed to l= oad or set to TUN. - RSS eBPF program ---------------- =20 @@ -67,7 +76,6 @@ Prerequisites to recompile the eBPF program (regenerate e= bpf/rss.bpf.skeleton.h) $ make -f Makefile.ebpf =20 Current eBPF RSS implementation uses 'bounded loops' with 'backward jump i= nstructions' which present in the last kernels. -Overall eBPF RSS works on kernels 5.8+. =20 eBPF RSS implementation ----------------------- --=20 2.49.0