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 D05B1A034F; Mon, 6 Dec 2021 23:20:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2358426FC; Mon, 6 Dec 2021 23:19:55 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130132.outbound.protection.outlook.com [40.107.13.132]) by mails.dpdk.org (Postfix) with ESMTP id 0C61E41C26; Mon, 6 Dec 2021 23:19:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZtmoU8oAKcreypqHvqKVl8YQFLr7MxWTS9g6/uUi8iyfPaFFeenkaVOno4vfuIvF1wxNzNWcYbQNOCcQ9YVeIdXzteM9nmAKAFBHK2QKrW34RjBWUOD4xU+pGFdzpi1QCFlryNjSXihRuZhsvNnAAiAQ3Tns8jlSUb6hTXGv3nyVPaNv6RUr7udYLUzVxrtIH5Ik5hpM880C8kkdhDOb0CWTcO815PwdW2EOV/Rm7dzsjPWu+oi7fgqzPConzLwSg17WxK1VOOMpImx+uN0jyoGjebXppCGtXjb++lpstZmqSTYg9oU8EvL0GPK25OqHMikiLcIDzHGUraOweZNOtQ== 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=LT0PIxy3YpySis6XX67ll80OneWKmv/H2At7783oNzpjfZdoy9LOQ8ojwXgmQHSD9CEUt2ohpACfD2xGwY0xGVKyLIuOH6irrHdQp6CYBdEuAv1gsB4WW+3wESpcu+4Ro3SN2bdHj5sR5C4Ejo9WeMsoSM48q7EjqtML42wKIMaOBsVeo5yV+awRrSPI3XnvOlhfj1A0WT6WI3KvdJaDzcqPX6uQzMrVixbHztvQzEEVEJTco2Vr3AMVZp6BfsL6JVpeCTHg1ej6gexdEKbbnIcW638q0Om8vfWDdofpQOhGIbMGII5XpIFOy/O+KiJcGZvLvcZCXdZN4f9fDqlC9g== 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=h6KrIv3uQgDdQdeM+5c7mdi1vlAcwFikSZnj3pTIxoAKblsnFBYkk9z+9SsiV8B97c7gmuj2ykJ3i/cIZH9YMOSnGdLwd6NluFkSthuZNiOcZE7yds1dsVEumwl0nK2QPMeOE0eJvtOTLjlKsMOqfJqwwJAyhBaS6b0yrmdt+1k= 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 AM0PR04MB6724.eurprd04.prod.outlook.com (2603:10a6:208:17a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.11; Mon, 6 Dec 2021 22:19:52 +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.022; Mon, 6 Dec 2021 22:19:52 +0000 From: Stephen Douthit To: Haiyue Wang , Wei Zhao , Xiaolong Ye , Xiao Zhang , Lunyuan Cui Cc: dev@dpdk.org, wenw@silicom-usa.com, Stephen Douthit , stable@dpdk.org Subject: [PATCH v2 4/7] net/ixgbe: Run 82599 link status workaround only on affected devices Date: Mon, 6 Dec 2021 17:19:18 -0500 Message-Id: <20211206221922.644187-5-stephend@silicom-usa.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211206221922.644187-1-stephend@silicom-usa.com> References: <20211206221922.644187-1-stephend@silicom-usa.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MN2PR20CA0031.namprd20.prod.outlook.com (2603:10b6:208:e8::44) 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 MN2PR20CA0031.namprd20.prod.outlook.com (2603:10b6:208:e8::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.19 via Frontend Transport; Mon, 6 Dec 2021 22:19:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 049e20ca-d3fc-4d18-8f11-08d9b9068679 X-MS-TrafficTypeDiagnostic: AM0PR04MB6724:EE_ 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: P8uifEtTgXkBW4xkd2HQsvUvK+Re6UUcXqpMSkToJgeBcz8DBME8Dv/vr/ArU+FRy9rWoykq63fCbsyny4VIbD5jG7MTFiDNarRvbDJzILR9zySZDDdjiVLjWZSBCNTZpt7Q8ywsl+rtSW/CgWmipbmKi2p1Vf/j+1L7tsKSyFmlNn3sbU74t0OSx1h8XrWWzFnazcOmX4bePOPr5GOEWD0f9vJyYNl9x7VXamzb6C01qsRh9I1Uxj/bequcmwuyu8we55Mx9JvPHILuk+Lipwqico9MmdRcZifgEOmFLYA8M9imDZDgZeirFMQVdCjwyK9wIIiqN19G1VqiWHU/Os7+H4mIRqa+Rr6w2NAmAydCLPtB1BcOgE6X/7Ww0qBnKmPYINztMmS2nvF/5YjXHPd3tMKPjOg6JJYXTzxM9AI8gv29IXyI44W5vImjdtSE6B5mp65rn/09TXTdx2YNmTxfC30o3mF5G6dWuZxNfgzz901Vx+qhNg9fsQx200zEdxjpljmivf8s1PzmQfTsKLWg8ZqWLfcnhxVxTd0r0u4Iz6HReApf2cfrQiRowfMRYeFycOwBoYeID0dCmp/MhAv6njeQ2nTZhWoFbdZJDcNMxikZn685QTp1BgjgdNTTjPIMOUJMz+fSfxlpp9VG5eZWBcB7ysHxaZNGvpAO96ZM9npxv9Nag6pBrigby55bkPHNaCO6C5bk/5G3NDXKCQ== 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)(4326008)(5660300002)(2906002)(83380400001)(508600001)(38100700002)(38350700002)(956004)(6512007)(6486002)(316002)(36756003)(110136005)(8936002)(26005)(1076003)(52116002)(2616005)(186003)(66476007)(6666004)(6506007)(66556008)(66946007)(8676002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pcQAXoqhF7gatIeZIDvWLfNZk28mT6T/PLSTQEK+pi8xUDA2aiAMzgCNFwxs?= =?us-ascii?Q?NdjcxpudZzpzC45XrU/Su2wPmdZCCaRV0LIXiIkVZK32qCeo/EMSMFQDt9j3?= =?us-ascii?Q?ymxF4i3C3g+jDXK9ZSVGDtUrQWiYS/2OLiGvtTd+qcGatpoUoilrDwA04v+M?= =?us-ascii?Q?j9KXpBOOFHxtJfrZrYSq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fk?= =?us-ascii?Q?Oj97PP3va7Gm5XdGLcWt2/PVNwD7faR4V8w9b/sdyvldYZkkPjetswWsdhEd?= =?us-ascii?Q?dw7SgnZ6FWTFcDNj4YYx7+T3n9aMmH3Q7fYqFXtLOnvT3TWPXepKLxZeaahX?= =?us-ascii?Q?WleCgMb9Lph6tlbUlUPDJl/E3MTX/dB+mzXZ6qgp2fkAmpUHyxz1QCRB2mrU?= =?us-ascii?Q?qqcRHoif2ZVqAdMXZqcjVXTMxivmXWRg1bVHahnv4SVUZzHBNa9vHPEa11qI?= =?us-ascii?Q?Xv5stFgRJGqnzyxhit9zcSoS/vjjOorpxd9CMMQGUfu0IV6P/1bR843jR7vA?= =?us-ascii?Q?Zg295Aed2RyVEnVXI9zGlxPJSE85wX4yk0cAdE4sLMmviML9tVDCnKM3+kVO?= =?us-ascii?Q?Y3QQLq3WL8Jb6by8Am8E3l8+vTxYi6DqzMKjonY62QYt2pMHTlAv7N7+CEYu?= =?us-ascii?Q?GaFxO4x2t481+TikkjodYjpmk9hc2470w0L/T+Y4u18bhxBKQ7E6Xpinz+wo?= =?us-ascii?Q?q0AEGOxFGa4ur6w4cPwpy/jMS8+ftnRB4TZ1P6Om9eLYrfIO+Cjl5OWeeY0k?= =?us-ascii?Q?XGjtshbdOMWuGTh2M/PvqJaD9W8HZswzUfb5rve5iJk+e/SagP0Ha46F7JAr?= =?us-ascii?Q?SoH4qw=3D=3D?= X-OriginatorOrg: silicom-usa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 049e20ca-d3fc-4d18-8f11-08d9b9068679 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB4083.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2021 22:19:52.7870 (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: +AePsj81Bn01rATUne3uP/N23Wujk8uYqhBe4MhPs+mSXmSoC7qH8I9/6n3xGVMQ7s2Z5DAuz0hyxkIAUtpt4wdEYDlDgkMQFQky4X8NQwk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6724 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 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