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 2C60AA0540 for ; Thu, 7 Jul 2022 09:58:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 278D24113C; Thu, 7 Jul 2022 09:58:55 +0200 (CEST) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 88785406B4 for ; Thu, 7 Jul 2022 09:58:53 +0200 (CEST) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 5F292402B9 for ; Thu, 7 Jul 2022 07:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1657180733; bh=z4swrf8PiEvMKaLZ2gFpxIKcQ34xEFCsnULa8ViCJlo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hdtkGRp2NC87ahFWNxR5jn2XROAmpk8iFYFjSEz/9/98oL8OJnFVSy7bH7C2FDQPS sPMuIHCyvei+yUBWiEekVssEPUKhHQ4deMcymackdpYUGJVG6isPPWEanaKwT1+CPl zjLukyJIrnmkrFWGIeYdhJhWaSs7N5mB6o2OzDI6q2xDBqeqYpDhnC/OGcdAcDhvR0 0Z5PXR/P9KrRIQELN5mGn7u5DAcTQncvj2I/qVw/xYxkZuB00EeZSPawCuxAMVMvZ8 72T5LnAixq/Jc9RygAhs9b8E8gypMs4hwUxylrPDeYcy9voN4bN8KZYDhLOIgA/rRZ yq1vtcPdfW3zA== Received: by mail-ej1-f70.google.com with SMTP id hq41-20020a1709073f2900b00722e5ad076cso4518786ejc.20 for ; Thu, 07 Jul 2022 00:58:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z4swrf8PiEvMKaLZ2gFpxIKcQ34xEFCsnULa8ViCJlo=; b=3YFDze2364+gzv+CsE6JiCcli3wjkOPxzteGBkjghWaeP/14rJ6eNrMv4+vRxJr8dG bmdxWc2U28RpFYdM0rcBv/3nTrnXIL6om/RXlVefAdlSJCZgp1ecoCulyGYFcv3gk9W5 E5AaGanKmCQGsWDR+LLPsA5I5tL0rkCrZqjrFwOiTT5hN3D9nGGwoFhkVKiJDA4Vrvbr fFxsuEwCU41bn9CDHCmMl9lWF8KSPwvcF1joohm7ySXampeZi/B/FoiDQj+WNoZ10JMN MdG10H8a4a0+GUJj6wgEs9r3FxZ0W8G9IAeXURUANcjEcfhYHfh9JrHRI40vPe2ZFn5g 2zSQ== X-Gm-Message-State: AJIora/46ZqxYqsdYhFIeNmLTFO06FR0XdHhWgvja7Ji0QzNpNjZQsgd M94YNVo01xxVWEhlrhSPyUBe1OnmsKlzhB2YAarrcm+0mRpB4rpp9nkDGhk3Ul+Vdveahzzmfal e6bzu+1oPf7eS8+inFPpB+Sr5 X-Received: by 2002:a17:907:a075:b0:72a:7508:c014 with SMTP id ia21-20020a170907a07500b0072a7508c014mr36277505ejc.176.1657180732801; Thu, 07 Jul 2022 00:58:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sCrmbnbUaZfsFT5yJCuai6WeSA9Y6cjrg/v/KvaOTMCjAFaTZ5ZdX06GeGlMEbC6AwkOLDog== X-Received: by 2002:a17:907:a075:b0:72a:7508:c014 with SMTP id ia21-20020a170907a07500b0072a7508c014mr36277493ejc.176.1657180732584; Thu, 07 Jul 2022 00:58:52 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2a02:6d40:3a4f:7b00:c19b:938e:7c97:afe2]) by smtp.gmail.com with ESMTPSA id t12-20020a50d70c000000b0043590660f16sm28173064edi.35.2022.07.07.00.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 00:58:51 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Harman Kalra Cc: dpdk stable Subject: patch 'net/octeontx: fix port close' has been queued to stable release 19.11.13 Date: Thu, 7 Jul 2022 09:55:05 +0200 Message-Id: <20220707075522.194223-70-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220707075522.194223-1-christian.ehrhardt@canonical.com> References: <20220707075522.194223-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 19.11.13 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/09/22. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/07d9cd4f91aca2e67fa3dd776b7d43ad933546b1 Thanks. Christian Ehrhardt --- >From 07d9cd4f91aca2e67fa3dd776b7d43ad933546b1 Mon Sep 17 00:00:00 2001 From: Harman Kalra Date: Tue, 24 May 2022 14:12:26 +0530 Subject: [PATCH] net/octeontx: fix port close [ upstream commit 39e07170331f869c581ce4d3cdc0360f7b6b444a ] Segmentation fault has been observed while closing the ethernet port. Reason for the segfault is, eth port close also shuts down event device while other ethernet port is still using the event device. Fixes: da6c687471a3 ("net/octeontx: add start and stop support") Signed-off-by: Harman Kalra --- drivers/net/octeontx/octeontx_ethdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index a496ee60cf..3fc405908d 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -24,6 +24,11 @@ #include "octeontx_rxtx.h" #include "octeontx_logs.h" +/* Useful in stopping/closing event device if no of + * eth ports are using it. + */ +uint16_t evdev_refcnt; + struct octeontx_vdev_init_params { uint8_t nr_port; }; @@ -336,7 +341,11 @@ octeontx_dev_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return; - rte_event_dev_close(nic->evdev); + /* Stopping/closing event device once all eth ports are closed. */ + if (__atomic_sub_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE) == 0) { + rte_event_dev_stop(nic->evdev); + rte_event_dev_close(nic->evdev); + } ret = octeontx_pko_channel_close(nic->base_ochan); if (ret < 0) { @@ -429,8 +438,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - rte_event_dev_stop(nic->evdev); - ret = octeontx_port_stop(nic); if (ret < 0) { octeontx_log_err("failed to req stop port %d res=%d", @@ -1059,6 +1066,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, nic->pko_vfid = pko_vfid; nic->port_id = port; nic->evdev = evdev; + __atomic_add_fetch(&evdev_refcnt, 1, __ATOMIC_ACQUIRE); res = octeontx_port_open(nic); if (res < 0) @@ -1287,6 +1295,7 @@ octeontx_probe(struct rte_vdev_device *dev) } } + __atomic_store_n(&evdev_refcnt, 0, __ATOMIC_RELEASE); /* * Do 1:1 links for ports & queues. All queues would be mapped to * one port. If there are more ports than queues, then some ports -- 2.37.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-07-07 09:54:14.051085649 +0200 +++ 0070-net-octeontx-fix-port-close.patch 2022-07-07 09:54:10.985824740 +0200 @@ -1 +1 @@ -From 39e07170331f869c581ce4d3cdc0360f7b6b444a Mon Sep 17 00:00:00 2001 +From 07d9cd4f91aca2e67fa3dd776b7d43ad933546b1 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 39e07170331f869c581ce4d3cdc0360f7b6b444a ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index f5ea9de8ef..6469fd0a96 100644 +index a496ee60cf..3fc405908d 100644 @@ -23 +24 @@ -@@ -26,6 +26,11 @@ +@@ -24,6 +24,11 @@ @@ -32,4 +33,4 @@ - struct evdev_priv_data { - OFFLOAD_FLAGS; /*Sequence should not be changed */ - } __rte_cache_aligned; -@@ -491,7 +496,11 @@ octeontx_dev_close(struct rte_eth_dev *dev) + struct octeontx_vdev_init_params { + uint8_t nr_port; + }; +@@ -336,7 +341,11 @@ octeontx_dev_close(struct rte_eth_dev *dev) @@ -37 +38 @@ - return 0; + return; @@ -46,3 +47,3 @@ - octeontx_dev_flow_ctrl_fini(dev); - -@@ -671,8 +680,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev) + ret = octeontx_pko_channel_close(nic->base_ochan); + if (ret < 0) { +@@ -429,8 +438,6 @@ octeontx_dev_stop(struct rte_eth_dev *dev) @@ -57 +58 @@ -@@ -1333,6 +1340,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, +@@ -1059,6 +1066,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, @@ -65 +66 @@ -@@ -1582,6 +1590,7 @@ octeontx_probe(struct rte_vdev_device *dev) +@@ -1287,6 +1295,7 @@ octeontx_probe(struct rte_vdev_device *dev)