From patchwork Mon Nov 13 08:53:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Meng X-Patchwork-Id: 1863038 X-Patchwork-Delegate: ktraynor@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gb+aMDxF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4STNX22Lnjz1yRV for ; Mon, 13 Nov 2023 19:54:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1B4A381FC0; Mon, 13 Nov 2023 08:54:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1B4A381FC0 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gb+aMDxF X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o2FrI1xQt01o; Mon, 13 Nov 2023 08:54:07 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 31D2B81FD4; Mon, 13 Nov 2023 08:54:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 31D2B81FD4 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F3D54C0071; Mon, 13 Nov 2023 08:54:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8A713C0032 for ; Mon, 13 Nov 2023 08:54:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 59B9260D53 for ; Mon, 13 Nov 2023 08:54:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 59B9260D53 Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gb+aMDxF X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QuI_bIOEauRt for ; Mon, 13 Nov 2023 08:54:03 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5361260C23 for ; Mon, 13 Nov 2023 08:54:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5361260C23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699865642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/hqcfcYp7gHd5oBMHmU1yK8whuqapryFnKpQlDi8Mys=; b=gb+aMDxFZF3A5m+I8fWSsWVg3kyhZKKxAfaC2DA2F9ZmPl4Y5+Rw4K6a6bV4kkaeTqoBMs CiGwoTb6jbW0id6IiMhMqARHAdIVwH3B3z9PgSkS2WKt7lWKhHTTapek5mtzEus4pUPchF TvU4cspNOAPEx+Bioa9lxOblR2lE6bI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-XPJ0e7iuPcKqgcbkgOzgOw-1; Mon, 13 Nov 2023 03:54:00 -0500 X-MC-Unique: XPJ0e7iuPcKqgcbkgOzgOw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4084163ecd9so28949225e9.3 for ; Mon, 13 Nov 2023 00:54:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699865639; x=1700470439; 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=/hqcfcYp7gHd5oBMHmU1yK8whuqapryFnKpQlDi8Mys=; b=IcIxcIdOSzLsDLfx6v8mFT6MPhpYZCk1zwL4gp6dxYGQrntRpuRuhl1iBYmvXuwkFA lDaHD2CHEFmPJOvGX5juAoklyVQxGNEFvqYa4ehytPAlsrC6LORfc4lfFVeYN20i9W6L HEILd0gY1YFV2cLZf/6truL9Dpa+kXbhaza7bLadGPWJVIyKYDgHczuuUB9enAsaCTzF AvonblpG8Kmx+nPJhDbv4KSfBwvKBlA7Epaigfj+cSgpiYoPfImpINohAn7ov0crfzRS LtaJqsUIYoT8vKzLrdf8FlkLJYOWwQnthRKyzMt4WbRHa/j+HnYI2P16Uc5yMxJtMnzD U+8g== X-Gm-Message-State: AOJu0YyuDzznsiP59Zy9WcU6noDNadVolUW2ps4ILfWbcjXxzPNejVov CrZHkIGmiexggU7LeYmv5isvLqB2Fk3UO7EGpg5EfEFCNlkxt7j4LY9KaNSU1YzJx73p5dtmorQ uDMAaRCjwdS6Ch7hL7zN91bPGWrcmW5Xg2Kvfez+qhbyivvNCmtRjE0NXkZZjGju1WbI= X-Received: by 2002:a05:600c:1381:b0:409:718b:33e0 with SMTP id u1-20020a05600c138100b00409718b33e0mr5317428wmf.16.1699865639432; Mon, 13 Nov 2023 00:53:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDhKSmoMjIVhUKsqj0NtT4MwLYT7nIw+LKefgPhdo8cSJEIhGC7UFavM/dIygD77QCPveosw== X-Received: by 2002:a05:600c:1381:b0:409:718b:33e0 with SMTP id u1-20020a05600c138100b00409718b33e0mr5317405wmf.16.1699865638973; Mon, 13 Nov 2023 00:53:58 -0800 (PST) Received: from positronik4lide.redhat.com ([87.122.59.133]) by smtp.gmail.com with ESMTPSA id 20-20020a05600c025400b004065e235417sm12940677wmj.21.2023.11.13.00.53.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 00:53:58 -0800 (PST) From: jmeng@redhat.com To: dev@openvswitch.org, rjarry@redhat.com, ktraynor@redhat.com, i.maximets@ovn.org Date: Mon, 13 Nov 2023 09:53:46 +0100 Message-Id: <20231113085347.11450-3-jmeng@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231113085347.11450-1-jmeng@redhat.com> References: <20231113085347.11450-1-jmeng@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v8 2/3] netdev-afxdp: Sync and clean {get, set}_config() callbacks. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Jakob Meng For better usability, the function pairs get_config() and set_config() for netdevs should be symmetric: Options which are accepted by set_config() should be returned by get_config() and the latter should output valid options for set_config() only. This patch also moves key-value pairs which are no valid options from get_config() to the get_status() callback. The documentation in vswitchd/vswitch.xml for status columns has been updated accordingly. Reported-at: https://bugzilla.redhat.com/1949855 Signed-off-by: Jakob Meng --- Documentation/intro/install/afxdp.rst | 12 ++++-------- lib/netdev-afxdp.c | 21 +++++++++++++++++++-- lib/netdev-afxdp.h | 1 + lib/netdev-linux-private.h | 1 + lib/netdev-linux.c | 4 ++-- vswitchd/vswitch.xml | 11 +++++++++++ 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst index 51c24bf5b..5776614c8 100644 --- a/Documentation/intro/install/afxdp.rst +++ b/Documentation/intro/install/afxdp.rst @@ -219,14 +219,10 @@ Otherwise, enable debugging by:: ovs-appctl vlog/set netdev_afxdp::dbg To check which XDP mode was chosen by ``best-effort``, you can look for -``xdp-mode-in-use`` in the output of ``ovs-appctl dpctl/show``:: - - # ovs-appctl dpctl/show - netdev@ovs-netdev: - <...> - port 2: ens802f0 (afxdp: n_rxq=1, use-need-wakeup=true, - xdp-mode=best-effort, - xdp-mode-in-use=native-with-zerocopy) +``xdp-mode`` in the output of ``ovs-vsctl get interface INT status:xdp-mode``:: + + # ovs-vsctl get interface ens802f0 status:xdp-mode + "native-with-zerocopy" References ---------- diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c index 16f26bc30..b680a1479 100644 --- a/lib/netdev-afxdp.c +++ b/lib/netdev-afxdp.c @@ -672,8 +672,6 @@ netdev_afxdp_get_config(const struct netdev *netdev, struct smap *args) ovs_mutex_lock(&dev->mutex); smap_add_format(args, "n_rxq", "%d", netdev->n_rxq); smap_add_format(args, "xdp-mode", "%s", xdp_modes[dev->xdp_mode].name); - smap_add_format(args, "xdp-mode-in-use", "%s", - xdp_modes[dev->xdp_mode_in_use].name); smap_add_format(args, "use-need-wakeup", "%s", dev->use_need_wakeup ? "true" : "false"); ovs_mutex_unlock(&dev->mutex); @@ -1367,3 +1365,22 @@ netdev_afxdp_get_stats(const struct netdev *netdev, return error; } + +int +netdev_afxdp_get_status(const struct netdev *netdev, struct smap *args) +{ + int error = netdev_linux_get_status(netdev, args); + + if (error) { + return error; + } + + struct netdev_linux *dev = netdev_linux_cast(netdev); + + ovs_mutex_lock(&dev->mutex); + smap_add_format(args, "xdp-mode", "%s", + xdp_modes[dev->xdp_mode_in_use].name); + ovs_mutex_unlock(&dev->mutex); + + return error; +} diff --git a/lib/netdev-afxdp.h b/lib/netdev-afxdp.h index e91cd102d..bd3b9dfbe 100644 --- a/lib/netdev-afxdp.h +++ b/lib/netdev-afxdp.h @@ -63,6 +63,7 @@ int netdev_afxdp_set_config(struct netdev *netdev, const struct smap *args, int netdev_afxdp_get_config(const struct netdev *netdev, struct smap *args); int netdev_afxdp_get_stats(const struct netdev *netdev_, struct netdev_stats *stats); +int netdev_afxdp_get_status(const struct netdev *netdev, struct smap *args); int netdev_afxdp_get_custom_stats(const struct netdev *netdev, struct netdev_custom_stats *custom_stats); diff --git a/lib/netdev-linux-private.h b/lib/netdev-linux-private.h index 0ecf0f748..188e8438a 100644 --- a/lib/netdev-linux-private.h +++ b/lib/netdev-linux-private.h @@ -50,6 +50,7 @@ struct netdev_rxq_linux { }; int netdev_linux_construct(struct netdev *); +int netdev_linux_get_status(const struct netdev *, struct smap *); void netdev_linux_run(const struct netdev_class *); int get_stats_via_netlink(const struct netdev *netdev_, diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index cca340879..70521e3c7 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -3493,7 +3493,7 @@ netdev_linux_get_next_hop(const struct in_addr *host, struct in_addr *next_hop, return ENXIO; } -static int +int netdev_linux_get_status(const struct netdev *netdev_, struct smap *smap) { struct netdev_linux *netdev = netdev_linux_cast(netdev_); @@ -3759,7 +3759,7 @@ const struct netdev_class netdev_internal_class = { .destruct = netdev_afxdp_destruct, \ .get_stats = netdev_afxdp_get_stats, \ .get_custom_stats = netdev_afxdp_get_custom_stats, \ - .get_status = netdev_linux_get_status, \ + .get_status = netdev_afxdp_get_status, \ .set_config = netdev_afxdp_set_config, \ .get_config = netdev_afxdp_get_config, \ .reconfigure = netdev_afxdp_reconfigure, \ diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index e400043ce..81f6e872e 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -3854,6 +3854,17 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \ Whether userspace-tso is enabled or disabled. + + +

+ AF_XDP specific interface status options. +

+ + + XDP mode currently in use. See for description of possible values. + +