From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 426D242ECF for ; Thu, 20 Jul 2023 17:25:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F75242D48; Thu, 20 Jul 2023 17:25:03 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 82A3540685 for ; Thu, 20 Jul 2023 17:25:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689866701; 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=7PFFik6NpZsq3ZO+t4x8XPPlmMi+Z1QSRdvHu/nYymY=; b=PKDTJLIbZxU+i4wzZVHOSogqFbdOdI1Ucy1sXY36YPeEvFMDacif+kaPMPf8k1Caj8BPJ8 u/dce7eL9meMUTOBqARbgyggGEZf2m2TG6+FeT/AqkaeEgtpWvwmct5tBOKrcbVxtfyMvC UrPrv3jEwgQh1TzCeISzIPRzUvpz23k= 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-442-87iDAY6YNCKw6HcnJzqNSw-1; Thu, 20 Jul 2023 11:23:17 -0400 X-MC-Unique: 87iDAY6YNCKw6HcnJzqNSw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE93B8351BA; Thu, 20 Jul 2023 15:22:43 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA2E84A9004; Thu, 20 Jul 2023 15:22:42 +0000 (UTC) From: Kevin Traynor To: Satha Rao Cc: dpdk stable Subject: patch 'net/cnxk: flush SQ before configuring MTU' has been queued to stable release 21.11.5 Date: Thu, 20 Jul 2023 16:18:59 +0100 Message-ID: <20230720151942.262154-108-ktraynor@redhat.com> In-Reply-To: <20230720151942.262154-1-ktraynor@redhat.com> References: <20230720151942.262154-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/25/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/dd0782d8b25ab3e90c4dc5946e60fc01a2dca04a Thanks. Kevin --- >From dd0782d8b25ab3e90c4dc5946e60fc01a2dca04a Mon Sep 17 00:00:00 2001 From: Satha Rao Date: Thu, 15 Jun 2023 01:04:23 -0400 Subject: [PATCH] net/cnxk: flush SQ before configuring MTU [ upstream commit b33bef500a50b750577e3028e7ae8aff08bf3ae9 ] When try to configure MTU for lower value causes run time failure due to old bigger packets enqueued. To avoid error interrupts better to flush the all SQs of this port before configuring new MTU. Fixes: 8589ec212e80 ("net/cnxk: support MTU set") Signed-off-by: Satha Rao --- drivers/net/cnxk/cnxk_ethdev.h | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 47 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 480cc6dfa4..ccdc5f04ee 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -445,4 +445,5 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv, int cnxk_nix_remove(struct rte_pci_device *pci_dev); int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu); +int cnxk_nix_sq_flush(struct rte_eth_dev *eth_dev); int cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addr_set, diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index f1d13c5004..9662bb0a2c 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -391,4 +391,42 @@ cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index) } +int +cnxk_nix_sq_flush(struct rte_eth_dev *eth_dev) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + struct rte_eth_dev_data *data = eth_dev->data; + int i, rc = 0; + + /* Flush all tx queues */ + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { + struct roc_nix_sq *sq = &dev->sqs[i]; + + if (eth_dev->data->tx_queues[i] == NULL) + continue; + + rc = roc_nix_tm_sq_aura_fc(sq, false); + if (rc) { + plt_err("Failed to disable sqb aura fc, rc=%d", rc); + goto exit; + } + + /* Wait for sq entries to be flushed */ + rc = roc_nix_tm_sq_flush_spin(sq); + if (rc) { + plt_err("Failed to drain sq, rc=%d\n", rc); + goto exit; + } + if (data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED) { + rc = roc_nix_tm_sq_aura_fc(sq, true); + if (rc) { + plt_err("Failed to enable sq aura fc, txq=%u, rc=%d", i, rc); + goto exit; + } + } + } +exit: + return rc; +} + int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) @@ -434,4 +472,13 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) } + /* if new MTU was smaller than old one, then flush all SQs before MTU change */ + if (old_frame_size > frame_size) { + if (data->dev_started) { + plt_err("Reducing MTU is not supported when device started"); + goto exit; + } + cnxk_nix_sq_flush(eth_dev); + } + frame_size -= RTE_ETHER_CRC_LEN; -- 2.41.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-07-20 16:18:08.228273487 +0100 +++ 0108-net-cnxk-flush-SQ-before-configuring-MTU.patch 2023-07-20 16:17:55.086752244 +0100 @@ -1 +1 @@ -From b33bef500a50b750577e3028e7ae8aff08bf3ae9 Mon Sep 17 00:00:00 2001 +From dd0782d8b25ab3e90c4dc5946e60fc01a2dca04a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b33bef500a50b750577e3028e7ae8aff08bf3ae9 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index 45dc72b609..ed531fb277 100644 +index 480cc6dfa4..ccdc5f04ee 100644 @@ -23 +24 @@ -@@ -466,4 +466,5 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv, +@@ -445,4 +445,5 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv, @@ -30 +31 @@ -index bce6d59bbc..da5ee19c85 100644 +index f1d13c5004..9662bb0a2c 100644 @@ -33 +34 @@ -@@ -496,4 +496,42 @@ cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index) +@@ -391,4 +391,42 @@ cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index) @@ -76 +77 @@ -@@ -539,4 +577,13 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) +@@ -434,4 +472,13 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)