From patchwork Wed Jan 5 08:19:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 1575533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=D5wMuwKY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JTMq83PBGz9sRR for ; Wed, 5 Jan 2022 19:20:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5FD1E4071B; Wed, 5 Jan 2022 08:20:02 +0000 (UTC) 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 E4IphIAHwI2V; Wed, 5 Jan 2022 08:20:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 96523408CD; Wed, 5 Jan 2022 08:19:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 72A61C0030; Wed, 5 Jan 2022 08:19:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5C12FC001E for ; Wed, 5 Jan 2022 08:19:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 407F94160D for ; Wed, 5 Jan 2022 08:19:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dt_yY9F3kUoP for ; Wed, 5 Jan 2022 08:19:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5ADDB41607 for ; Wed, 5 Jan 2022 08:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641370794; 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=cdUQxHFBYBnzKgVdiJonXAqGITHqc2wYAW3suaaofI8=; b=D5wMuwKYieiCUcr6mPKZVQ+Z6VMsaujDbTxlFTqSuJMjaLhJxdf52G2sgf/J7jCGZPNCEQ gwOISqawLd1/HwgnbtFZA9cyG2Il6/AlYGksirwZq71xv/uDZn3yR+36okV5mBQ4pF6v0B hvu5A/3dyBYafWVEyb0reqJrkFThfN8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-186-T2jIpLfDNjucNBD6Y88oPA-1; Wed, 05 Jan 2022 03:19:51 -0500 X-MC-Unique: T2jIpLfDNjucNBD6Y88oPA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E0C02100CCC2; Wed, 5 Jan 2022 08:19:50 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 271A216A51; Wed, 5 Jan 2022 08:19:48 +0000 (UTC) From: Maxime Coquelin To: dev@openvswitch.org Date: Wed, 5 Jan 2022 09:19:24 +0100 Message-Id: <20220105081926.613684-4-maxime.coquelin@redhat.com> In-Reply-To: <20220105081926.613684-1-maxime.coquelin@redhat.com> References: <20220105081926.613684-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: fbl@sysclose.org, Maxime Coquelin , i.maximets@ovn.org, david.marchand@redhat.com Subject: [ovs-dev] [PATCH v5 3/5] dpif-netdev: Introduce Tx queue 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" A boolean is currently used to differenciate between the static and XPS Tx queue modes. Since we are going to introduce a new steering mode, replace this boolean with an enum. This patch does not introduce functionnal changes. Signed-off-by: Maxime Coquelin Reviewed-by: David Marchand --- lib/dpif-netdev.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index a790df5fd..13b7d2835 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -385,10 +385,15 @@ struct dp_netdev_rxq { atomic_ullong cycles_intrvl[PMD_INTERVAL_MAX]; }; +enum txq_mode { + TXQ_MODE_STATIC, + TXQ_MODE_XPS, +}; + /* A port in a netdev-based datapath. */ struct dp_netdev_port { odp_port_t port_no; - bool dynamic_txqs; /* If true XPS will be used. */ + enum txq_mode txq_mode; /* static, XPS */ bool need_reconfigure; /* True if we should reconfigure netdev. */ struct netdev *netdev; struct hmap_node node; /* Node in dp_netdev's 'ports'. */ @@ -4591,24 +4596,25 @@ dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd, int i; int tx_qid; int output_cnt; - bool dynamic_txqs; + bool concurrent_txqs; struct cycle_timer timer; uint64_t cycles; uint32_t tx_flush_interval; cycle_timer_start(&pmd->perf_stats, &timer); - dynamic_txqs = p->port->dynamic_txqs; - if (dynamic_txqs) { + if (p->port->txq_mode == TXQ_MODE_XPS) { tx_qid = dpif_netdev_xps_get_tx_qid(pmd, p); + concurrent_txqs = true; } else { tx_qid = pmd->static_tx_qid; + concurrent_txqs = false; } output_cnt = dp_packet_batch_size(&p->output_pkts); ovs_assert(output_cnt > 0); - netdev_send(p->port->netdev, tx_qid, &p->output_pkts, dynamic_txqs); + netdev_send(p->port->netdev, tx_qid, &p->output_pkts, concurrent_txqs); dp_packet_batch_init(&p->output_pkts); /* Update time of the next flush. */ @@ -5761,14 +5767,14 @@ reconfigure_datapath(struct dp_netdev *dp) * 'port->need_reconfigure', because netdev_is_reconf_required() can * change at any time. * Also mark for reconfiguration all ports which will likely change their - * 'dynamic_txqs' parameter. It's required to stop using them before + * 'txq_mode' parameter. It's required to stop using them before * changing this setting and it's simpler to mark ports here and allow * 'pmd_remove_stale_ports' to remove them from threads. There will be * no actual reconfiguration in 'port_reconfigure' because it's * unnecessary. */ HMAP_FOR_EACH (port, node, &dp->ports) { if (netdev_is_reconf_required(port->netdev) - || (port->dynamic_txqs + || ((port->txq_mode == TXQ_MODE_XPS) != (netdev_n_txq(port->netdev) < wanted_txqs))) { port->need_reconfigure = true; } @@ -5804,7 +5810,8 @@ reconfigure_datapath(struct dp_netdev *dp) seq_change(dp->port_seq); port_destroy(port); } else { - port->dynamic_txqs = netdev_n_txq(port->netdev) < wanted_txqs; + port->txq_mode = (netdev_n_txq(port->netdev) < wanted_txqs) + ? TXQ_MODE_XPS : TXQ_MODE_STATIC; } } @@ -7812,7 +7819,7 @@ dpif_netdev_xps_revalidate_pmd(const struct dp_netdev_pmd_thread *pmd, long long interval; HMAP_FOR_EACH (tx, node, &pmd->send_port_cache) { - if (!tx->port->dynamic_txqs) { + if (tx->port->txq_mode != TXQ_MODE_XPS) { continue; } interval = pmd->ctx.now - tx->last_used;