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 30621A0353 for ; Tue, 1 Mar 2022 13:16:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ECE7342706; Tue, 1 Mar 2022 13:16:05 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2086.outbound.protection.outlook.com [40.107.212.86]) by mails.dpdk.org (Postfix) with ESMTP id 286FD42701; Tue, 1 Mar 2022 13:16:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BRlQhimAEGKezNr2HRkKWDPleP9yO3Isc1yTO16PequJrhXxCmpbtvhuukY/GaVGbK9uwz57hGgge8KdCnzN1nOfcqZY0wqlC/9iRXCKCW1E5NDw0lcYjNmiu/qCzKKAxQDHhgzAit9dKLB6geskYaHuGYvQm0eeWHzJeML3Hi5pkqyBHdB2qi/INoZLYSHABEFDTBSbSX44DwUWWczxNJJ7OCLOGxrtT4Fl1dpvsL8K0JQdJxB+MX3ke1jBSsvfyCF2P+8TfJHHxkQDNhxeGlTXUinLXWF1QaSO/Ws5ilU4B73JOqc6oivSgsnb7pvDloz8NXUomPFp0HsY/JXvzQ== 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=N8CSGgIMuvLSiqb9r5A49CXR/mHz8YBdA9G3vgJBpME=; b=ZudWuklgl32k1bcAyltZ0ODZSQX9HjWbwdYnfBorHKWeYmsyWPJVWSTOw3Gg6+9UJ/CGEmY3sEtOW2+CrZ0JOQlkxWmdqKZlTcy+hBytBdc0RrqNGAcNa99RvY57x2wxpxC1di43A7Bi8iSCJIzCn1jCFdiqtrobYXsYYARCb4vrKGXZmFipWz8K5Ea/sG3qDKBj/AxuE+D+eKo0Aa6NHT1f5wxjpFERm5fcK/Lw4d0pjzp9IxweRl6+ZXc6s6jwOAqLqnKnhmHZm39vRwNcMfDZz/crOhrfGyJUJTzbCFJVm1qKBHzBw//l18bb8d6Z3lC7T+HHtDaI7kypRaYmKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=dpdk.org 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=N8CSGgIMuvLSiqb9r5A49CXR/mHz8YBdA9G3vgJBpME=; b=HIWF1vccG/qGzMkgHXRsMxZ49g6V2J1nDIdXe9GpGiKYvvJf/fDpEx1flHUC3w7ebg/Qr6X4woJ1F6VK60+a/r/gJMdmX5VSRxhx8qRpRHDhLpvtX2dWhAtH5mkTkxY2WH6a5lwfNIttWth4mOdKDI+Tbiio6mzAmA6mw3bWFH/PBpPxK73V04T240C2SHUzlz2d2klbjODEhbnv8gNCAuocsabdfQ5OCOOAuZDs/Hj4RL/7ZLNw0CJg6TlE3Oj4RDDFgqZhuI8jzIm3LXV8J+o1a094QCnjV5lGVr+vAzeUl4YPxDBKy8wifOJ2iT+PHNV43OJyY+IANXfuz374Yg== Received: from MW4PR03CA0022.namprd03.prod.outlook.com (2603:10b6:303:8f::27) by MW3PR12MB4427.namprd12.prod.outlook.com (2603:10b6:303:52::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Tue, 1 Mar 2022 12:16:01 +0000 Received: from CO1NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8f:cafe::81) by MW4PR03CA0022.outlook.office365.com (2603:10b6:303:8f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Tue, 1 Mar 2022 12:16:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT017.mail.protection.outlook.com (10.13.175.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Tue, 1 Mar 2022 12:16:00 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 1 Mar 2022 12:16:00 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) 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.9; Tue, 1 Mar 2022 04:15:58 -0800 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Tue, 1 Mar 2022 04:15:57 -0800 From: Dmitry Kozlyuk To: CC: , Viacheslav Ovsiienko , "Matan Azrad" Subject: [PATCH v2 3/3] net/mlx5: fix initial link status detection Date: Tue, 1 Mar 2022 14:15:14 +0200 Message-ID: <20220301121514.41497-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220301121514.41497-1-dkozlyuk@nvidia.com> References: <20220223164333.3834590-1-dkozlyuk@nvidia.com> <20220301121514.41497-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: 23c39c19-dddb-413a-e9fd-08d9fb7d3fbd X-MS-TrafficTypeDiagnostic: MW3PR12MB4427: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: F5kSW6jZjNS7yfRAIPPBMyWnA+w6K3gjSxGfvpvo8ukXVpNwPkHc4a35k6YWMzom2tmP12Ww7e5oZey1qFt3A3cSaZLZOFAMrBHekli6aS8z5god2tH9tnwf/GOayyUWtt4vQxv8heFFXIyANHljg44i7hyiIwQWah6sQhZIAXaQHRqoQSIJ8qA5MPpob3FByuJX5Kp/0/iyJXbFrJAlsppbaxMXKzbMfHMopJKlrwwt3SHwir1WpE8V29aOzZUPgJfI0yoxHBBhjTZTQhhTCEiUrzPojkdPM6kfPVKIK592wpMUIfdoIhdltC4XdYPTh5fTbR5m17vuIyAxbHuDR/mWa/whBUgXK/my5pbJvZL1+IY+zeOuHJGzyEm6gcDrlxmmGpxZFL2JtAElkftjSQZszazHzKK4YFzEIP+8CN9KNx0KQOcC0h9oroS14K4Ul0+eXUkt74BcCqllsSVb0x2Q2te08wjt26jKMY4Usr6vwQCyw3YeV9RcaCqurMnaUJ9HLw9TN6zcKzmInPY6Njlf0RB826hCqEo9G1VRPnQRx2jtD7VsgYRMwvyM7OUpkIYFfaEnylId2e0wNItyFxypGVju1ka6YhKrNDrJ+wM4drPiipQMJhAuVKzNsw+YfVECPS1QGYR5EMPszQ0Rf6GQHocdEIuGMZa7LZuvDpgt05CzRmTE58ojNe7yVFIzvxuUpsDXaE1jrsg6ApZnp4Dk4vGFZR0pX5ud2vw/y94= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(70586007)(70206006)(450100002)(36860700001)(36756003)(6916009)(81166007)(316002)(2906002)(54906003)(356005)(82310400004)(4326008)(508600001)(6666004)(83380400001)(86362001)(7696005)(8936002)(5660300002)(8676002)(55016003)(40460700003)(107886003)(186003)(336012)(426003)(1076003)(26005)(2616005)(6286002)(47076005)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2022 12:16:00.7280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23c39c19-dddb-413a-e9fd-08d9fb7d3fbd 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4427 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 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") Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Reviewed-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 29a4890d14..ff65efb2a2 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1483,13 +1483,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->dev_port - 1].nl_ih_port_id = + eth_dev->data->port_id; + mlx5_set_link_up(eth_dev); for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) { icfg[i].release_mem_en = !!sh->config.reclaim_mode; if (sh->config.reclaim_mode) -- 2.25.1