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 40F41A0C41 for ; Fri, 3 Dec 2021 23:56:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F2E042741; Fri, 3 Dec 2021 23:56:06 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2111.outbound.protection.outlook.com [40.107.21.111]) by mails.dpdk.org (Postfix) with ESMTP id 7BCBD40041; Fri, 3 Dec 2021 23:55:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQ89CbGDOfZfQ46zrpSfZ0A7JqX0beDQjr+q7xnkw+nhvxoz8Rdy42+QO6+qlEpb9d3BumU0GNX8OaP6Nqkop8pO6Y8UoXtmtCW1vO1YzVu+cmUCZJI6ngY8y9MaxWtoBTbhx3c5RgGvaDpB+0g3POeB9yvpqfp1B2HMhUQC6ncfxBXoebll0xU933rF+Gw4ps3CtIiET1zP7I9Zv2ozOVPGJJyoBcdVc+A+H9Ik8Bbq7f3cyLyS0GCDcKQbxxNkrwwxQlsVe1I8m0qEeb0H+NRw0EZ7bemA9Ma4CNAFzkEqeKwhwSXDpoy1sPPldRROaYelfkGJh/WpnjYhNmsmUQ== 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=S+qvJ7TWGEzjPB2KcQX9exVWsDjyIT61sB1oY5i874c=; b=nJrMMeFd2eHhUSAVk2rp65pGOarga1AEuraB5fbNBqxx+x9DOHc+A1qaOcJpMksELsoUbGjJIhBd74MBQmSK1k9O2O9VgYDRZEj3wHI1dAygOXDdrg4Kj85HdZpq+XacQ41aoORQ+UTOURP3W30KLKeRgaxkcexD9hotMItmvKPC5BzMfWsmgkTnv/JWMpIOXIsEAapWeLrgn+V8q4pVWl9cslY70TKfBubp5rhNgL0GmxMhWfHtlSKhtY5RbbX/SKLWwFOoLdqKzIie4ymO0jB1yFjFASuJ9nMQc73eLIpPOVk0aYLQPRCjl7yVcq/ezST8o3pIqcNIjQxsPPpMRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silicom-usa.com; dmarc=pass action=none header.from=silicom-usa.com; dkim=pass header.d=silicom-usa.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=SILICOMLTD.onmicrosoft.com; s=selector2-SILICOMLTD-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S+qvJ7TWGEzjPB2KcQX9exVWsDjyIT61sB1oY5i874c=; b=FNKHfOpJcEoQtpwZlWB/xCrMN/AHpAxx7M9zhw3wTyogXQwj1fGR9sVKDyoJTvSW18dFLsydmvEL97m/Z30v5fw4GF0vyGHV+GprhrlMEi1yFKjG6ZeIxjhRWsskV3qv9BgplMep9o6whlKxhdYTOHMMuj0cI/m/JOprc8qBIJM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silicom-usa.com; Received: from AM0PR04MB4083.eurprd04.prod.outlook.com (2603:10a6:208:64::29) by AM0PR04MB6404.eurprd04.prod.outlook.com (2603:10a6:208:178::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Fri, 3 Dec 2021 22:55:57 +0000 Received: from AM0PR04MB4083.eurprd04.prod.outlook.com ([fe80::f4db:d40d:a746:7bfc]) by AM0PR04MB4083.eurprd04.prod.outlook.com ([fe80::f4db:d40d:a746:7bfc%7]) with mapi id 15.20.4755.019; Fri, 3 Dec 2021 22:55:57 +0000 From: Stephen Douthit To: dev@dpdk.org Cc: wenw@silicom-usa.com, Stephen Douthit , stable@dpdk.org, Haiyue Wang , Xiaolong Ye , Xiao Zhang , Wei Zhao , Lunyuan Cui Subject: [PATCH 4/7] net/ixgbe: Run 82599 link status workaround only on affected devices Date: Fri, 3 Dec 2021 17:55:13 -0500 Message-Id: <20211203225516.571368-5-stephend@silicom-usa.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211203225516.571368-1-stephend@silicom-usa.com> References: <20211203225516.571368-1-stephend@silicom-usa.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BL1PR13CA0431.namprd13.prod.outlook.com (2603:10b6:208:2c3::16) To AM0PR04MB4083.eurprd04.prod.outlook.com (2603:10a6:208:64::29) MIME-Version: 1.0 Received: from lappy.adi.eng (173.14.114.227) by BL1PR13CA0431.namprd13.prod.outlook.com (2603:10b6:208:2c3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.10 via Frontend Transport; Fri, 3 Dec 2021 22:55:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1725f558-a36b-456e-1fbc-08d9b6b01194 X-MS-TrafficTypeDiagnostic: AM0PR04MB6404: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X8binozqhSj7CEM8woQZXdmGpJ92TLZ6iXsVVDUFiKXIZQ6Wj6l5Kll0+bE9ii3TSjMBkB9ObJQR2W+rC0pu/hNqOyYJW0r0Egy3XjNVKgb8o0QhCEmPw/dY7IZD1JZQAcnTOmvl4hwx0FRjMRKNSEmbU1KZfmyEWPdGjx04gQETHS7BfTyiEEZWwTJhixpp90mWqGmPAIU9i0E7lxON0ZtgXzYAtnzbB8u3oWVvi1lQB3FtTB9t0HllwsltukLWni8C6G2E0Q3EPAfmZgqPffrl5/mFKiuaACjWZvGhJy542lko4mab5PsY0DJay9i8k1+QEfwWGMbBvpILnSdRcH3TwjXtTbClJxTg1IRnNq71RUYqSOxCtDUnE56HVUAij1fNM0UJgO7V+lpqpohmscPhSDVX2gaBBGai9m0mgD5HiskQ6Cz2R5pDt2oJQqe1rQPmat4571rqZ2flXgR30YpaOVl1MLFBZZHe5DnFlWzzPnjOzrE7doyge8q58HkOJ0wEzWCAuYcNSf0R63QuXJeV2SWhygJLic9y26jx8CgzFNz9rZ/jP7nrzz3KqwLUP5lPXWBVnx7xagxdpR9KSEojcImC4xddKE+ch2ZV3Tqxkzs4ZanzLm4Es6i3jj0fqnNpim/U5y0qDhNF4wB8q/Y0MRiCW3JWLHlQqbtV9GYl1aDAzqKfzrJh7CIbNfZZyxFTeFOQbGM51fx3UP4KBg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB4083.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(2906002)(508600001)(6916009)(8676002)(6486002)(26005)(956004)(83380400001)(316002)(1076003)(36756003)(5660300002)(86362001)(186003)(4326008)(66946007)(2616005)(38100700002)(38350700002)(6506007)(66556008)(52116002)(66476007)(6666004)(6512007)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1xdyy/HRTFwl86fRKVFupSpcLFrvj+ub5QZV9gIIZqDQXogPhOFuywmJzTwy?= =?us-ascii?Q?/cg8sPMEbSpBtnudBZcPRX/9ExqWaJsD0wUaGLD8Ll4VVzpmfv3Xu4wD/ZOt?= =?us-ascii?Q?MA4BXl57dIiAK7clQsmAWg+G8Y7gH9NswL6jDzmItFfIlA2Up34J3FgjfZ+y?= =?us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8+pbmqqSYMXEg+smr?= =?us-ascii?Q?G+oDVNXmbmlIQi21IrD2WubefoyMFHRulVai0Wd56akICal5USfTA2UtrcDp?= =?us-ascii?Q?AxGWDKQz5fdV3CZXYCj7N1g9fHGGJMEYvV+h04bo50pvc78OifGmZzjGtsJH?= =?us-ascii?Q?rJyGCHlBIjejkOzvee6dWARrJHtSa8tvvEG9Ix9sd4Dhsr6tl0BZFkdOanK/?= =?us-ascii?Q?4liuF8WuexKSr1oWVKBCmARChuWZC9aUh4cW/HFm+kRcJz0ZTFy14w+nocqI?= =?us-ascii?Q?GIqPao9B1xsVv+tCNnvGA7hho0OLzzoIp0C/fvK2lXpIE8kZOQRUFuKU4w/x?= =?us-ascii?Q?F4/+IzvttZItXLZTyJDVbAoIwaOZpbDnfdE7dFPCmzBxENEK+BfjhEGwXuwD?= =?us-ascii?Q?GcerM2rC7GIo18O5sscapdgPq7pZwpXgrfK/FzDVv+fpgvQqhURbI6ftnX7s?= =?us-ascii?Q?bkM/BrhVwLbuX1qvbmvUW1f6FEKF+0v4J39d8i1ARqPoLHvVLHRlN11Lt2Dq?= =?us-ascii?Q?Vrys0pR0JeYt/Ibo3pA+tzd5iWUX33JYooRYCtUlTURs+FaEfcMoI1NJqFAr?= =?us-ascii?Q?ZXGf4Re6Zf40JDeeXPMBhNY90tdEX4BLPLt5FY+K1J0ky1OnvrgYHe6YLXu7?= =?us-ascii?Q?Qgfc9MrxLJ7jAsfRFriS9Ki+628=3D?= X-OriginatorOrg: silicom-usa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1725f558-a36b-456e-1fbc-08d9b6b01194 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4083.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 22:55:57.5864 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: c9e326d8-ce47-4930-8612-cc99d3c87ad1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ehC/ZrczuM4mi95eD/G0IOpNCvhQv7NCnc3HNN1tyyqDznnJYJfcjJWWkB65pRW7oVRGzefqwYhJC73Zvmhk77RiI/0L5miTA+B00JtBnfc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6404 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 1ca05831b9b added a check that SDP3 (used as a TX_DISABLE output to the SFP cage on these cards) is not asserted to avoid incorrectly reporting link up when the SFP's laser is turned off. ff8162cb957 limited this workaround to fiber ports Refactor this so it's: * Not open coded in ixgbe_dev_link_update_share() * Runs only on fiber 82599 devices, not all fiber ixgbe devs (which don't all use SDP3 as TX_DISABLE) Fixes: 1ca05831b9b ("net/ixgbe: fix link status") Fixes: ff8162cb957 ("net/ixgbe: fix link status") Cc: stable@dpdk.org Signed-off-by: Stephen Douthit --- drivers/net/ixgbe/base/ixgbe_82599.c | 41 ++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 7 ----- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_82599.c b/drivers/net/ixgbe/base/ixgbe_82599.c index 69fd4cd3fb..5786114b0a 100644 --- a/drivers/net/ixgbe/base/ixgbe_82599.c +++ b/drivers/net/ixgbe/base/ixgbe_82599.c @@ -28,6 +28,39 @@ STATIC s32 ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, STATIC s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset, u8 dev_addr, u8 data); +/** + * ixgbe_check_mac_link_82599_fiber - Determine link and speed status + * + * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @link_up: true when link is up + * @link_up_wait_to_complete: bool used to wait for link up or not + * + * Call the generic MAC check_link function, but also take into account the + * state of SDP3, which is a GPIO configured as an output driving the TX_DISABLE + * pin on the SFP cage. This prevents reporting a false positive link up in the + * case where the link partner is transmitting, but we are not. + **/ +STATIC s32 ixgbe_check_mac_link_82599_fiber(struct ixgbe_hw *hw, + ixgbe_link_speed *speed, + bool *link_up, + bool link_up_wait_to_complete) +{ + u32 esdp_reg; + s32 err; + + DEBUGFUNC("ixgbe_check_mac_link_82599_fiber"); + + err = ixgbe_check_mac_link_generic(hw, speed, link_up, + link_up_wait_to_complete); + + esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); + if ((esdp_reg & IXGBE_ESDP_SDP3)) + *link_up = 0; + + return err; +} + void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) { struct ixgbe_mac_info *mac = &hw->mac; @@ -52,6 +85,14 @@ void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) mac->ops.flap_tx_laser = NULL; } + /* + * For 82599 SFP+ fiber, make sure that SDP3 (TX_DISABLE to SFP cage) + * isn't asserted. Either by mac->ops.disable_tx_laser(), or possibly + * management firmware + */ + if (mac->ops.get_media_type(hw) == ixgbe_media_type_fiber) + mac->ops.check_link = ixgbe_check_mac_link_82599_fiber; + if (hw->phy.multispeed_fiber) { /* Set up dual speed SFP+ support */ mac->ops.setup_link = ixgbe_setup_mac_link_multispeed_fiber; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 66f7af95de..34b7cb2d4e 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -4216,7 +4216,6 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, bool link_up; int diag; int wait = 1; - u32 esdp_reg; memset(&link, 0, sizeof(link)); link.link_status = RTE_ETH_LINK_DOWN; @@ -4250,12 +4249,6 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev, return rte_eth_linkstatus_set(dev, &link); } - if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { - esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP); - if ((esdp_reg & IXGBE_ESDP_SDP3)) - link_up = 0; - } - if (link_up == 0) { if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) { ixgbe_dev_wait_setup_link_complete(dev, 0); -- 2.31.1