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 94FACA00C2 for ; Tue, 8 Mar 2022 16:10:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76A8940DDB; Tue, 8 Mar 2022 16:10:57 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2046.outbound.protection.outlook.com [40.107.243.46]) by mails.dpdk.org (Postfix) with ESMTP id B91B240696 for ; Tue, 8 Mar 2022 16:10:56 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dww+G4cySRiTQMkM0T40nEyubvepKWtcSRPYO3Bjdd2P2kbvQUNRDQjMH3GNuPo77SeKOm1/4DJIr8YTs9UUlPkrbfLL7XpqkY0i6RcCHp/8z5NR1h5iY5PXY1OEYftbB6+IJ8K3KbqAoEVQjMtFlp8mhauE2FED02/OaCCFGPo7cLdAFzBat8p3fJHyhuRNtsqXwKgmfNtxyIbZaSaE2Nq6Za9kTh3YYnlFNBHEXj5pDds172Wffr4HAp7V8r+Xfd60rC7R6ezKBpylQWKm78pCIN+lT0FenJwKc7TleDT+ufub2R49ufc4Gn9CLS3nbZWH2w67Vz2ZtxKC1Zq6vQ== 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=UFMgwMXqKkh8Tr7ROdsyKqqHlpksYWhHtWUW42H0Cgs=; b=USMOtP8n9hC+Xko9OUcrVN/uA+zAagIj7tvN9Y5mSZabFlK7akQDpZtM+NDXlZgOhc+lUciVkxGFrzRnvhuEBeD3NPei0GKnfJp11wsuxGZ3KX5IdrG4fA/8BrvovpVUSJwk0/Pz/8TS9jQmQXttCVmwmD6xfU92NI5mhTyv1gUWl7pQF7oWc+rWw8TmCOSVhV+m3EV0TY2EdX2FSyV4awRNiDZEcl61dhnuz45pVXUvftnVtimDoYkPdMbIN+H/KlStsmPxUCE6SJjY2CpB2jX43TZYvpJh9kSBGFoEzQCn1nHrNQlsO6PEuI2s+tUHgWyYx7K8v4pMtnzyCIITsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=redhat.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=UFMgwMXqKkh8Tr7ROdsyKqqHlpksYWhHtWUW42H0Cgs=; b=r71gxQ7M3cjFtC7zWvrgVUgVB22S6AhM5yxdH9xhXEqKc4+oUGvaPJ5VzYwx/IOITDox6LfyKEVPDY5jI8NWQrbmEAvprJhm0+pliyW0acsNfpVz8d4TFzcq6dw2ca0X3ldhA8ZPGtyGHuMRdNkG0DquKB6Gg6YchqxSxtBEVGyfQPWDadDq6IezUPEi35LG94FQrhgmqmGfovBg+Ef019S6yWOQJ0BCYM+isQLh0syRrdvDA/h9dnbnFgnkqKasDBbBuoszlppJGWTQIs+estlkzvmRATKFCbudy4JwuzksSHe+CHRy3zHt6e1vhXLB4Xv4G3sM+7BqZePdrGAxEQ== Received: from DM5PR21CA0036.namprd21.prod.outlook.com (2603:10b6:3:ed::22) by BYAPR12MB3368.namprd12.prod.outlook.com (2603:10b6:a03:dc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.17; Tue, 8 Mar 2022 15:10:55 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ed:cafe::a6) by DM5PR21CA0036.outlook.office365.com (2603:10b6:3:ed::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.5 via Frontend Transport; Tue, 8 Mar 2022 15:10:54 +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 DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Tue, 8 Mar 2022 15:10:54 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 8 Mar 2022 15:10:54 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Tue, 8 Mar 2022 07:10:53 -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.9 via Frontend Transport; Tue, 8 Mar 2022 07:10:52 -0800 From: Dmitry Kozlyuk To: CC: Kevin Traynor , Viacheslav Ovsiienko Subject: [PATCH 21.11 3/3] net/mlx5: fix initial link status detection Date: Tue, 8 Mar 2022 17:10:44 +0200 Message-ID: <20220308151044.1012413-4-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220308151044.1012413-1-dkozlyuk@nvidia.com> References: <20220308151044.1012413-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: c857ca3b-5ccd-4287-d5a4-08da0115d786 X-MS-TrafficTypeDiagnostic: BYAPR12MB3368: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: 4ORH76Px3Q5gEIV85xknzMiUciQryWKcyQoYKDqRLmm4EgMb7raJkzLTunZalVFMyqqX9iWfxLvGUaKf+OZ3+ZonSmgzUvzI0geqPjvJVYQwYzVRpBNxtzzgTGh/mY/BmIaqDTda3xypctc9pQpM0XAqcoeAQnQluwS0m7Dl/rH6+YUCyk/d8LMIrVuaiA4j3dIPzCEFxVbi8DbIzZzt7UFziEFF2xV55XjPca2l3wH7zRvYlFuxjGnsbtc0vCVu+tQeRiLrpcQ3ZOfktXHnnPVVgLImb2MFqPmmASEXqRC2ipRbr8qS4nzHcPxhCUG57uweoIO0nyMRl42NwGBBeNyHpaS1+6luul3mb/iOKccv+1iNTCCvmje9eu3ZykdUOwCepc9i1G4AAqSHC+rrRydejGBUraJZVbMOFtQaHeSXSShOixbMejgrJv/D1SI+/I1dFDAgNEbkZlaUbZIUy/dtRM+PqQRpeVd9Cfq8TjedBmJQa2QE6dbWwWwi+cCENPfbd+jn0kbCLkPyMG+jug2e7bmZfRuXT/fM6M1ucFrgjMH7dQMMlx3PcmZ2R9YNVbhwupeExefx5VZKMj24yMW/+dfzSvV6gJJuZCdVLtefXzZGfRRAl6LYoaUSUw81BVbjtbPnGeQ/coc2vqqid7Xgrn+mQ5H2HZIZTgOVKblSNYd9V0KsCBReP0hFz98ijGrR16kA6bg4qiI5qJT3kA== 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)(40470700004)(36840700001)(55016003)(47076005)(82310400004)(186003)(316002)(70586007)(70206006)(54906003)(4326008)(36756003)(83380400001)(6916009)(86362001)(107886003)(426003)(36860700001)(81166007)(8676002)(2616005)(1076003)(40460700003)(5660300002)(7696005)(6666004)(356005)(6286002)(336012)(26005)(508600001)(8936002)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2022 15:10:54.6975 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c857ca3b-5ccd-4287-d5a4-08da0115d786 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3368 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/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 069d5f8807..6c76a30e8c 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1665,13 +1665,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); /* Detect minimal data bytes to inline. */ mlx5_set_min_inline(spawn, config); /* Store device configuration on private structure. */ -- 2.25.1