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 E9CBCA0093 for ; Fri, 11 Mar 2022 09:06:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E10AC40E78; Fri, 11 Mar 2022 09:06:40 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by mails.dpdk.org (Postfix) with ESMTP id A819F4113F for ; Fri, 11 Mar 2022 09:06:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JtrXG/hUklsuyMPbaRKGRzaKB90X4/nX9M9BEnPbDjTRD3HeN8OhSCcrf+PHkj46UIZ/Uw9RV2xVVBHEKMsOP6Y3JYgYgJyDM5OVIsZKQMLcgqGJQ2afyR/AD2P5Hpa5Do/qxiNjAmdpCkAbgZB/0LQBrleA78aS9cHIsGfiv8pjkQ0PZRAki88AWa3YTNTqA0xpfV3V+xmG9+kDbPRVav2RqpO0lb7fqOM51xL1stahY5Rv34EQsNMtHw9Gzxhaab1tTPMyq3zIW0OPG1vTc1Wv8SCIei8mfk89XTXmoWJ0WfbHVJtprv5C1URODrXC2VFyPM/cQZghlu70lGVBoQ== 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=dJDq9EwopdwMm2NSKyZKQGErhtecYBmAyf9QIeQh93c=; b=eqPoF+L+oNH8C5pImpcCkbYqplhjtyUCihrAdducAEtC7kwIsyAhaEYR244700bAntHV6gl9MS4L5h7XfAQQ/a/ZRkBI8EO/XAdQkorMZPChkW20+V37l4E6bL2NscRpL6QzWpKgazxx3GoiAk//jI9q62vKW15kqhiuZ2nKU+wWJwJYnOZiADdwOpWMFDR7za2M774FgAwH4HGtzymMpTEsBsJfdub6zipxqS094wwRNBJHBe1freal7UMmJzSNiHa3Vsnw6k1pnnVPQsjekc6ieuQ8VA/tTlY1ivTb9xmzDdPwkl6ZRE52Nc0tdfJNfWkfy8K2Xxc15bZdFkQkdQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=canonical.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dJDq9EwopdwMm2NSKyZKQGErhtecYBmAyf9QIeQh93c=; b=NGYgjQFQO5aeBQynUohQekrW31xThM3d2WnxpAz/t3ZqCSiu6H87CpRnqvC3g+/haUZH+EHIe2QGh44ZimmQcrvnl8PC5+Qs/wIEJDMqUabo8MxIX9ZRLBE2YQ3Wnbcx9ogjpvxeBuhV3cZlldY3hBIGHopHqtx1TZxfqsJ+/P4paFYrAvSZchAYprL4SO7Dzm9Hp9BHpOo0+Q13bKGfYYPMD4UN8Pz/zsqKf2GGrf8LAJM5jCAy/+WGFJ33FGy9zuNrxZHxO4UFpSbxHykE+y9dSO0MUzlD0JmZjo8wpXSB7IIoVyznEY5VzZ+fZ+g9yz4TgE5M44uN6UDN4Xtqjg== Received: from DM5PR07CA0122.namprd07.prod.outlook.com (2603:10b6:3:13e::12) by CH2PR12MB4938.namprd12.prod.outlook.com (2603:10b6:610:34::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Fri, 11 Mar 2022 08:06:37 +0000 Received: from DM6NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13e:cafe::ab) by DM5PR07CA0122.outlook.office365.com (2603:10b6:3:13e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.23 via Frontend Transport; Fri, 11 Mar 2022 08:06:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT061.mail.protection.outlook.com (10.13.173.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Fri, 11 Mar 2022 08:06:37 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 11 Mar 2022 08:06:36 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Fri, 11 Mar 2022 00:06:35 -0800 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.22 via Frontend Transport; Fri, 11 Mar 2022 00:06:34 -0800 From: Dmitry Kozlyuk To: CC: Christian Ehrhardt , "Viacheslav Ovsiienko" Subject: [PATCH 19.11 3/3] net/mlx5: fix initial link status detection Date: Fri, 11 Mar 2022 10:06:27 +0200 Message-ID: <20220311080627.1195847-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220311080627.1195847-1-dkozlyuk@nvidia.com> References: <20220311080627.1195847-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 56640e68-513b-456a-8cfc-08da033610e8 X-MS-TrafficTypeDiagnostic: CH2PR12MB4938:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jc496wOH/xgFDjrd6MqP/4SGjXdxp45Iu9MHsiiKOVtK9OyYVV8otJwt0HGsZvxtuN/sAEHDXAPW5Rw57PypgTpgf+yBEkHpJnmaooQbnmCZT824XSoTR/3dWRUT+GYpL+a2EY2cgkNDqy+K1IaqZuLGgR0DYI/hY3kZYJ2KHNhEZHA9urKe9qGiyQdfW9PnWS7bxwYk+6bkCUVsH/MCx8nNmJX4YhYntY/Yr4MCBMg03HYH0oEr7e9vapsgksLJSIGrYkmhcX7DUtIgEAwf7kE3bv8YNlv6V6lqUCdorXogBhKXq+orfKMSS8agnPffrmn2ULadnkQdFTkoD3RZV9GFjQkdg7vpocwz90pUJUARDQDshhzq4J/ugM7dIUebXeG04hhHs46v0zvK6S8xdgaspT0Pit0xAWm23i33yH7V66NTQmC4bLomA14nyVS7SSOIUWkVnLDSPo1szs/qgm5t6Q42v44st34WGagzIjT+RlPsbTs1ILnIyWMdihRnBmhIrwcN8UfjPdUaUK7FJiHLo+MS12xO8ndFGJSt5G6UUrcBNIz4zLKTFdSbVTOjS+DYxfDWC32hhWRWH/VWLBV7UteqRMp5OgaDR5uPKqHhRtaA9q6gpzFTwcGVkkr8n7JESHFFXPGX7NvhF6vzpruZLvXsfdtVjxZxPu35MLVz9pzUshlw5Mi83Fxawz/np7aJ+7VX+AUpLQka5DCpig== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(508600001)(2906002)(6286002)(83380400001)(1076003)(2616005)(81166007)(6666004)(186003)(26005)(82310400004)(5660300002)(356005)(86362001)(7696005)(8936002)(107886003)(40460700003)(55016003)(316002)(36756003)(47076005)(6916009)(36860700001)(70586007)(54906003)(4326008)(336012)(426003)(8676002)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2022 08:06:37.1889 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56640e68-513b-456a-8cfc-08da033610e8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4938 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 [ upstream commit 655c3c26c11e7a6f1b5421afe40b06d580b8f2dd ] Link status change takes time that depends on the HW and the kernel. It was checked immediately after the change was issued at probing. If the port had beed down before probing, a "down" state may be read, while the port would be "up" imminently. After that, DPDK reported the port as "down" mistakenly and "ifconfig $DEV up" did not trigger an LSC event, because from the system's perspective the port was "up" already. Install Netlink event handler at port probe before requesting the port to come up in order to receive LSC event even if it comes up between probe and start. Fixes: b6499434b83e ("net/mlx5: fix link status initialization") Signed-off-by: Dmitry Kozlyuk Reviewed-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 068b0ef981..12c87175b9 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2822,13 +2822,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, /* Bring Ethernet device up. */ DRV_LOG(DEBUG, "port %u forcing Ethernet interface up", eth_dev->data->port_id); - mlx5_set_link_up(eth_dev); - /* - * Even though the interrupt handler is not installed yet, - * interrupts will still trigger on the async_fd from - * Verbs context returned by ibv_open_device(). - */ + /* Read link status in case it is up and there will be no event. */ mlx5_link_update(eth_dev, 0); + /* Watch LSC interrupts between port probe and port start. */ + priv->sh->port[priv->ibv_port - 1].nl_ih_port_id = + eth_dev->data->port_id; + mlx5_set_link_up(eth_dev); #ifdef HAVE_MLX5DV_DR_ESWITCH if (!(config.hca_attr.eswitch_manager && config.dv_flow_en && (switch_info->representor || switch_info->master))) -- 2.25.1