From nobody Sun Dec 29 00:43:19 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1720933934; cv=none; d=zohomail.com; s=zohoarc; b=CfHjrEcKaRGMHTj+ifhbcNmfKYi41gWvahiL8YboNwyQCRAoA20tcWwxR9Wcn93x6WXxzPztwswdylJAXBZz26i4wejef8uVu4eLhlDO/Vdna7q4VlIIw62k06xv3CI0bR7JFdJ9/wkHqk889/g8NF1Fv/A+pnpF+U0lCnz+HgE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720933934; 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=4cfAZs9gcmRBQAfP5MoBvIZbiyJezK58nIuVHbTQt3E=; b=UX0gS5n6tuyQFP0tIZ1Vk/tUXJ4tlTgKgMoE9pFBu5kmE2WwUKbRB0Iggqx6CKXyDpSDkso7GUdPb18QTdry6P7egLWNWH4xvVLSZpr0q9UmTislmT6POQHhjMAHUf0pSFznIb4TvhoaNwllAeih8TQgtJR/FlzJ/Ldr+jIeMTk= 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+importer2=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 1720933934172220.36839066775906; Sat, 13 Jul 2024 22:12:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSrWM-0007bz-11; Sun, 14 Jul 2024 01:11: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 1sSrWF-0007Nm-RO for qemu-devel@nongnu.org; Sun, 14 Jul 2024 01:11:33 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSrWE-00054Z-By for qemu-devel@nongnu.org; Sun, 14 Jul 2024 01:11:31 -0400 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3d9db222782so1970458b6e.3 for ; Sat, 13 Jul 2024 22:11:29 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-70b7eca64b1sm2074373b3a.143.2024.07.13.22.11.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 Jul 2024 22:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1720933889; x=1721538689; 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=4cfAZs9gcmRBQAfP5MoBvIZbiyJezK58nIuVHbTQt3E=; b=nmN01QC+i2TmW50HmFRYof4EWvWf56TlnCfXuYO7DtLXGVwkJWyoDqWuA/fIbybfav LTTZn5mB5G4+ckrfypmk1OTkiBI5miS5nkjCiip0nuO+0o+xXs6XL+qh1ERGa2N0DOP6 vxeC4eoMtcGexZsfSfxbtIyuydmdeNZPiSXOF/f1ZEi57N5/qdPnMNO8JEOgBLFML3iq 2KfixsAy0TcFbujGV6tzn8rvkACmhhzSU0yXlKibU61z9+Nqy1543+okTX3wRR1fDwI+ ZKOS7h3OGEXc4XlS3JtFKPHIdtFIMzT+KL6Y0KcEOYGjJpsE5Qd8dh1nRL+ryb2uTlBc LrnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720933889; x=1721538689; 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=4cfAZs9gcmRBQAfP5MoBvIZbiyJezK58nIuVHbTQt3E=; b=hYYI52yEK6Q3Te48THRDKKr9JCUeRO80HR3HsvLUM+1cvqGKN7VmF9vzcRNm3NeSHH AmpAl/1H8U+INuUZkZjcyh9WXF7nBAQZ1j6gQYYoTNV6ZoTkwsMJitG56F4XbwjJrnYN iZ9kTbK+5xl7VA3pPhaoXotEUO5exaCcadBt2L/ab4Yd9/g2OISr2FfSiHqHEQv+HeQz TPIlFtKeMzoTK4gCvf5LLfJ+FPp/gjRcVSGq+vUWHkWCuV5CNyzOtC8yTseBLjYd7BL+ pipD4CnCraXnw7VsLlDDA7G/ljJQLPW5AaIh9pmHx+0r2a1daQ/ZE3KDSXuij6RwbVua CyXQ== X-Gm-Message-State: AOJu0Yx+W5eeaXCRgwo41b2kIHw9Uz/Kf2/JH5zCPxAIKEeMIcrBcypC DeS+abXu6fPgeg1APLCuB1AXonqqRYZo/TkDXt/RGurRQmoZlR636Y1EG3ygyuM= X-Google-Smtp-Source: AGHT+IFkXgADrSYg1RyLJr4YABin1ixkWJpJRXbaB90TFqgaot5y98YF1Mjin56f/JHbYT/0pGjqyg== X-Received: by 2002:a05:6808:1311:b0:3d9:2562:7541 with SMTP id 5614622812f47-3d93c01f75dmr20053472b6e.24.1720933889093; Sat, 13 Jul 2024 22:11:29 -0700 (PDT) From: Akihiko Odaki Date: Sun, 14 Jul 2024 14:11:05 +0900 Subject: [PATCH v3 5/5] virtio-net: Remove fallback from ebpf-rss-fds MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240714-auto-v3-5-e27401aabab3@daynix.com> References: <20240714-auto-v3-0-e27401aabab3@daynix.com> In-Reply-To: <20240714-auto-v3-0-e27401aabab3@daynix.com> To: Jason Wang , Dmitry Fleytman , Sriram Yagnaraman , "Michael S. Tsirkin" , Luigi Rizzo , Giuseppe Lettieri , Vincenzo Maffione , Andrew Melnychenko , Yuri Benditovich , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost Cc: qemu-devel@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::22f; envelope-from=akihiko.odaki@daynix.com; helo=mail-oi1-x22f.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_NONE=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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1720933935756116300 If ebpf-rss-fds is specified but we fail to use, we should not fall back to loading eBPF programs by ourselves as such makes the situation complicated. Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index e779ba2df428..2f0a4f2aabf7 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1361,21 +1361,21 @@ static void virtio_net_disable_rss(VirtIONet *n) virtio_net_commit_rss_config(n); } =20 -static bool virtio_net_load_ebpf_fds(VirtIONet *n) +static bool virtio_net_load_ebpf_fds(VirtIONet *n, Error **errp) { int fds[EBPF_RSS_MAX_FDS] =3D { [0 ... EBPF_RSS_MAX_FDS - 1] =3D -1}; int ret =3D true; int i =3D 0; =20 if (n->nr_ebpf_rss_fds !=3D EBPF_RSS_MAX_FDS) { - warn_report("Expected %d file descriptors but got %d", - EBPF_RSS_MAX_FDS, n->nr_ebpf_rss_fds); + error_setg(errp, "Expected %d file descriptors but got %d", + EBPF_RSS_MAX_FDS, n->nr_ebpf_rss_fds); return false; } =20 for (i =3D 0; i < n->nr_ebpf_rss_fds; i++) { fds[i] =3D monitor_fd_param(monitor_cur(), n->ebpf_rss_fds[i], - &error_warn); + errp); if (fds[i] < 0) { ret =3D false; goto exit; @@ -1394,17 +1394,11 @@ exit: return ret; } =20 -static bool virtio_net_load_ebpf(VirtIONet *n) +static bool virtio_net_load_ebpf(VirtIONet *n, Error **errp) { - bool ret =3D false; - - if (virtio_net_attach_ebpf_to_backend(n->nic, -1)) { - if (!(n->ebpf_rss_fds && virtio_net_load_ebpf_fds(n))) { - ret =3D ebpf_rss_load(&n->ebpf_rss); - } - } - - return ret; + return virtio_net_attach_ebpf_to_backend(n->nic, -1) && + (n->ebpf_rss_fds ? virtio_net_load_ebpf_fds(n, errp) : + ebpf_rss_load(&n->ebpf_rss)); } =20 static void virtio_net_unload_ebpf(VirtIONet *n) @@ -3805,7 +3799,7 @@ static void virtio_net_device_realize(DeviceState *de= v, Error **errp) if (virtio_has_feature(n->host_features.on_bits | n->host_features.auto_bits, VIRTIO_NET_F_RSS)) { - virtio_net_load_ebpf(n); + virtio_net_load_ebpf(n, errp); } } =20 --=20 2.45.2