From patchwork Tue May 2 22:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Fontaine X-Patchwork-Id: 1776047 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=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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=VyiXdRcP; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q9vg41qK0z20fg for ; Wed, 3 May 2023 08:21:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 34CF5408B6; Tue, 2 May 2023 22:21:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 34CF5408B6 Authentication-Results: smtp2.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=VyiXdRcP X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WYGYyUBa6Gtu; Tue, 2 May 2023 22:20:59 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 51062400C1; Tue, 2 May 2023 22:20:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 51062400C1 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 231E7C0036; Tue, 2 May 2023 22:20:58 +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 25857C002A for ; Tue, 2 May 2023 22:20:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EDDE360F0C for ; Tue, 2 May 2023 22:20:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EDDE360F0C 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=VyiXdRcP 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 rP8v8I9ktCcC for ; Tue, 2 May 2023 22:20:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 29A9460F02 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 29A9460F02 for ; Tue, 2 May 2023 22:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683066053; 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; bh=LsXrk1sSzfIATbXDct8+niWFJlOsukQeiYB8rcWklhk=; b=VyiXdRcP7GMSU7AalrZGtQmQWRonBNfH+jETxujNVUmeOR1uoeCqYmPXTZACM6B016NQCt NStlKjRsEPWkXJ2/tcBTbTXdpwJHf+/KCNvuoTZC3HWuVjDco5z2n/AOzJGrWweHKhn1R0 r2EJT4W+gwBddL1SOEcDJPoF3wx/rI0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-267-UPPT7z3KNZ6TJwx7IyVpZw-1; Tue, 02 May 2023 18:20:52 -0400 X-MC-Unique: UPPT7z3KNZ6TJwx7IyVpZw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22248A0F381 for ; Tue, 2 May 2023 22:20:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DD7140C2009; Tue, 2 May 2023 22:20:51 +0000 (UTC) From: Christophe Fontaine To: dev@openvswitch.org Date: Wed, 3 May 2023 00:20:25 +0200 Message-Id: <20230502222024.9233-1-cfontain@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] dpif-netdev: Add config option for vhost tx_steering default mode 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" Current tx_steering mode has to be configured on each Interface. The global config option "vhost-tx-steering-default" allows the user to select a default mode (thread or hash) for all dpdkvhost ports. Signed-off-by: Christophe Fontaine --- NEWS | 1 + lib/dpif-netdev.c | 43 ++++++++++++++++++++++++++++++------------- vswitchd/vswitch.xml | 12 ++++++++++++ 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index cfd466663..c1d64cb29 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ Post-v3.1.0 * ovs-vswitchd will keep the CAP_SYS_RAWIO capability when started with the --hw-rawio-access command line option. This allows the process extra privileges when mapping physical interconnect memory. + * Added new global configuration option "vhost-tx-steering-default". - SRv6 Tunnel Protocol * Added support for userspace datapath (only). diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 70b953ae6..38c60de1c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -246,6 +246,17 @@ enum sched_assignment_type { SCHED_GROUP }; +enum txq_req_mode { + TXQ_REQ_MODE_THREAD, + TXQ_REQ_MODE_HASH, +}; + +enum txq_mode { + TXQ_MODE_STATIC, + TXQ_MODE_XPS, + TXQ_MODE_XPS_HASH, +}; + /* Datapath based on the network device interface from netdev.h. * * @@ -334,6 +345,8 @@ struct dp_netdev { /* Bonds. */ struct ovs_mutex bond_mutex; /* Protects updates of 'tx_bonds'. */ struct cmap tx_bonds; /* Contains 'struct tx_bond'. */ + + enum txq_req_mode vhost_txq_requested_mode_default; }; static struct dp_netdev_port *dp_netdev_lookup_port(const struct dp_netdev *dp, @@ -451,17 +464,6 @@ struct dp_netdev_rxq { atomic_ullong cycles_intrvl[PMD_INTERVAL_MAX]; }; -enum txq_req_mode { - TXQ_REQ_MODE_THREAD, - TXQ_REQ_MODE_HASH, -}; - -enum txq_mode { - TXQ_MODE_STATIC, - TXQ_MODE_XPS, - TXQ_MODE_XPS_HASH, -}; - /* A port in a netdev-based datapath. */ struct dp_netdev_port { odp_port_t port_no; @@ -4993,6 +4995,14 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config) } first_set_config = false; + + const char *vhost_tx_steering_default = + smap_get_def(other_config, "vhost-tx-steering-default", "thread"); + if (nullable_string_is_equal(vhost_tx_steering_default, "hash")) { + dp->vhost_txq_requested_mode_default = TXQ_REQ_MODE_HASH; + } else { + dp->vhost_txq_requested_mode_default = TXQ_REQ_MODE_THREAD; + } return 0; } @@ -5143,10 +5153,17 @@ dpif_netdev_port_set_config(struct dpif *dpif, odp_port_t port_no, dp_netdev_request_reconfigure(dp); } - if (nullable_string_is_equal(tx_steering_mode, "hash")) { + if (!strncmp(port->type, "dpdkvhost", 9) + && dp->vhost_txq_requested_mode_default == TXQ_REQ_MODE_HASH) { txq_mode = TXQ_REQ_MODE_HASH; } else { - txq_mode = TXQ_REQ_MODE_THREAD; + txq_mode = TXQ_REQ_MODE_THREAD; + } + + if (nullable_string_is_equal(tx_steering_mode, "hash")) { + txq_mode = TXQ_REQ_MODE_HASH; + } else if (nullable_string_is_equal(tx_steering_mode, "thread")) { + txq_mode = TXQ_REQ_MODE_THREAD; } if (txq_mode != port->txq_requested_mode) { diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index edb5eafa0..84655dfcd 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -3513,6 +3513,18 @@ ovs-vsctl add-port br0 p0 -- set Interface p0 type=patch options:peer=p1 \

+ +

+ Specifies the default Tx steering mode for dpdkvhost interfaces. +

+

+ Defaults to thread, and is overriden per + Interface by the tx-steering option. +

+
+