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 77CCAA0C45; Wed, 6 Oct 2021 08:45:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A7B541398; Wed, 6 Oct 2021 08:45:38 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2107.outbound.protection.outlook.com [40.107.101.107]) by mails.dpdk.org (Postfix) with ESMTP id 031FD410F2; Wed, 6 Oct 2021 08:45:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YsNupKX0GssA/ovm6wGjm8D4R/wGAkClFNJO/hHVIWZ3fyFYaDsztJ5S/bSxMw+lYLc5h0gczDueFIdAr0dgXrgk+36/xlkxdtnawwqLxDQ7xoYJw4FM3lOEO2jii7LRwWRaKQhgxekK2pHDvCPYuzbREhnuJVrwtBu0QDtnp7920DZrcb0QHb75Wk8F0xlnnPvyvOwpO8CDT1+TKH/FmiH6IYNapTonk/ZVeQ+pMOFAwccEU7aQaJSfmGProv1zaLj5b4GvY7CHoYys3wiReyCE5/IaXSi9lrarwrISGNa12bHTkClWy/44WAwjA7a2W8VhJxCbDkC+of2ZG/ZZ2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aUIEJBNJo5YUjiqHcEh+ykYvNe6xcp6E55STIgOzVHU=; b=gv+QPgCdrf1xmZfflkDMAQBgoid5WTMrTvXyZqTeK8g+JE4HgZx9M7y16v2RhWMTiAaXMl991GdIsKn9KmJKKVNTHWHcPcfTJNkqZAsA721t2huK7BiTEVZAqbexj+Gm8KBMmntcy+KOM0CccKIeLvfvnG2QrAKiIJ6yCmG9dSKZGDJzWvtk2pAPlifoEGj9rDdh+YToRQlcfKTjcwXE7uN6lAHXzCW3+FQcSfnCrUslfr78WeVPG0iuPTRHnQL65aQJWKk4s5NI3gSCSReRORf9FmZggIqBW9Czg4h87D79rjyExumTBgHWa3vv2rZN1gjfFCUNwH3fgsZX8o3Vsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aUIEJBNJo5YUjiqHcEh+ykYvNe6xcp6E55STIgOzVHU=; b=CnI9Sd9rGGH51wGFn9wYnstj73VhsIvCSzxegJr20RIunMWdhCMGMwRHNyi3aomjcb5ZTkhRWhn9DqEjJH0lNSzotcoaO+T4/ewIVsldaxiSeMeZ8dFuwD1oJt5rFuYYfXm7gz/BlAYKMQsZQmbD+A07Oh1D77txML/oqvr1jLY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5381.namprd13.prod.outlook.com (2603:10b6:a03:3d2::17) by BY5PR13MB3316.namprd13.prod.outlook.com (2603:10b6:a03:1a4::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.4; Wed, 6 Oct 2021 06:45:35 +0000 Received: from SJ0PR13MB5381.namprd13.prod.outlook.com ([fe80::71d3:f17d:5b70:38ee]) by SJ0PR13MB5381.namprd13.prod.outlook.com ([fe80::71d3:f17d:5b70:38ee%3]) with mapi id 15.20.4566.022; Wed, 6 Oct 2021 06:45:35 +0000 From: heinrich.kuhn@corigine.com To: dev@dpdk.org Cc: Heinrich Kuhn , stable@dpdk.org, Simon Horman Date: Wed, 6 Oct 2021 08:44:55 +0200 Message-Id: <20211006064455.18114-1-heinrich.kuhn@corigine.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: JNAP275CA0055.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4f::11) To SJ0PR13MB5381.namprd13.prod.outlook.com (2603:10b6:a03:3d2::17) MIME-Version: 1.0 Received: from localhost.localdomain (155.93.215.104) by JNAP275CA0055.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Wed, 6 Oct 2021 06:45:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc610c2f-e669-4bf0-e5ab-08d98894e5ee X-MS-TrafficTypeDiagnostic: BY5PR13MB3316: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ISsroHR2ukfYzm9wYoTijVcxGAoqfP49neO23kEQFZnlIuoB512VIYXXoj57iOS69DV6nH5AN2yT2TwKU/lLtbzyG3Do/Fa/eiVO1mszLg3TCjW8aDOkgar/WifONNwiVBeFuCJlq0V/56FKuJUc/zWbRkVZIB/w/uikyRXBH5M25BBHGXOQVk9WPd+kRfy8CdgbbAd1JpJEOM5h6AIwd1sYACgunvINhepbnoJvVqEUz6jRhzp4OdmUxI8FjSmXBq+Dy1k+ZGP0kYHxF1UsYW/WWD9WrvSDgIaTC+w+BQKnvdAnQuEuzXR0zWGOfbrD+lkEzsqXB53CqX9sHDgr51pmejkcY5UuiyOar3DArh35BNncpbproTEuQ3URWA0By0ZbGbXly8XAmwTaYhJhRCu60LBhfKUE/9bN4sV4LJXLnswZ9uA+JN1CYMTKTU1/jgbf6iprsUwfhlxofE0NC17q2FqvzPJKsL2l4/6dhbeyire4vvTnTE6rhepEwcu90MytPXRJ1LtI7ZReUGXKkLuWzTl8vUw4Ym4pVMuuSfrN0uSDKfvnhGIf7msQqTX58xYk1GOU+bFE0FgJS/YxXgFqyq6ALhTA7jR3kyFXq//RD1bC6fmwGGxtCBB9WmfwxCuIw2MJ1M51YadnUWEZ+Hvj/D4mkhFCQ3woyLXp/Kk/f70v6vL1yZL/NA1fvGjNAF0HAFYqRSwme6ht+YTYJg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5381.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(376002)(346002)(366004)(396003)(39830400003)(66476007)(26005)(6916009)(8936002)(36756003)(54906003)(38350700002)(2906002)(316002)(508600001)(86362001)(186003)(38100700002)(6666004)(9686003)(6506007)(5660300002)(8676002)(66556008)(6512007)(107886003)(52116002)(1076003)(66946007)(4326008)(956004)(83380400001)(2616005)(450100002)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xzfE6/MvWgLxn3TULZOrMc9oefbOpGA2FiO62eCJ0D9vkL69oq+zJYdrTYQl?= =?us-ascii?Q?l1blrGrny6ZrE0ouoXXoU3AmLzfokmokgiIPb6OdXAjtooWJIoTFX6ttXKjo?= =?us-ascii?Q?uYXNyFiy1gxoHrEX6dQM3v9+eouYalVvLpIeylbvbIK00x+d9PghjuJ+7E6i?= =?us-ascii?Q?OXpfmYHd8L0HSLOSbSh8j9DoTIKphSBHznDji2nK9hPb2FaHR3QqR2kmBG51?= =?us-ascii?Q?FtkPnRMtSEyfv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ascii?Q?0hmRZ4wW3M/04wGfqyiDIDxiKjuuK9q6c9JGqIYr2I4nKAOlSz+6NgGsoAiE?= =?us-ascii?Q?59JlR3pDJNnSiJvrJDi8oYXPY6iC3j8T96zFA1vSiZAZQtdIU7dDFHRpRFJE?= =?us-ascii?Q?8Afdp8Y191+4LiPLAAoNA1T08cHRVYNATJSTF0SExWB17suuZ/JzNakd0ulV?= =?us-ascii?Q?f0r8sdjDJR7OQSzg6fwhSJVV?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc610c2f-e669-4bf0-e5ab-08d98894e5ee X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5381.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2021 06:45:34.8939 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vpZP2aWYLiiRjWFGrPCLpmcAByhIQrsOQvVXvWkKs5RdFXxf2rcVQCMN8Dyxjq2tsbyBKnv2RKHCqrUNonXO9qKO5ThZeRKYQrNGCVhKNM0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR13MB3316 Subject: [dpdk-dev] [PATCH] net/nfp: cancel delayed LSC work in port close logic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Heinrich Kuhn The link state change interrupt handler of the NFP PMD will delay the actual LSC work for a short period to ensure the link is stable. If the link of the port changes state and the port is closed immediately after the link event then a segmentation fault will occur. This happens because the delayed LSC work eventually triggers and this logic will try to access private port data that had been released when the port was closed. Fixes: 6c53f87b3497 ("nfp: add link status interrupt") Cc: stable@dpdk.org Signed-off-by: Heinrich Kuhn Signed-off-by: Simon Horman --- drivers/net/nfp/nfp_common.c | 2 +- drivers/net/nfp/nfp_common.h | 1 + drivers/net/nfp/nfp_ethdev.c | 5 +++++ drivers/net/nfp/nfp_ethdev_vf.c | 6 ++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 1b4bc33593..4395a09c59 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -898,7 +898,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev) * * @return void */ -static void +void nfp_net_dev_interrupt_delayed_handler(void *param) { struct rte_eth_dev *dev = (struct rte_eth_dev *)param; diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 1fbf3d7cd6..3556c9cd17 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -376,6 +376,7 @@ void nfp_net_params_setup(struct nfp_net_hw *hw); void nfp_net_cfg_queue_setup(struct nfp_net_hw *hw); void nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src); void nfp_net_dev_interrupt_handler(void *param); +void nfp_net_dev_interrupt_delayed_handler(void *param); int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); int nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask); int nfp_net_reta_update(struct rte_eth_dev *dev, diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 6ba3c27f7f..1169ea77a8 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "eal_firmware.h" #include "nfpcore/nfp_cpp.h" @@ -307,6 +308,10 @@ nfp_net_close(struct rte_eth_dev *dev) nfp_net_reset_rx_queue(this_rx_q); } + /* Cancel possible impending LSC work here before releasing the port*/ + rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler, + (void *)dev); + /* Only free PF resources after all physical ports have been closed */ /* Mark this port as unused and free device priv resources*/ nn_cfg_writeb(hw, NFP_NET_CFG_LSC, 0xff); diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index b697b55865..62cb3536e0 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -13,6 +13,8 @@ * Netronome vNIC VF DPDK Poll-Mode Driver: Main entry point */ +#include + #include "nfpcore/nfp_mip.h" #include "nfpcore/nfp_rtsym.h" @@ -230,6 +232,10 @@ nfp_netvf_close(struct rte_eth_dev *dev) nfp_net_dev_interrupt_handler, (void *)dev); + /* Cancel possible impending LSC work here before releasing the port*/ + rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler, + (void *)dev); + /* * The ixgbe PMD driver disables the pcie master on the * device. The i40e does not... -- 2.30.1 (Apple Git-130)