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 7AE16A0C41 for ; Fri, 3 Dec 2021 23:56:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3D2042732; Fri, 3 Dec 2021 23:56:03 +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 44D9340041; Fri, 3 Dec 2021 23:55:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G0Yd4dW6IBNC16p83Qvy8FF7sjoQDIwKWR01dCAcBMghSGSbwqfa8nFJSszixClKcRmA/GLUgn3ZpottBtkS4f+XTdRJud0VYqld4DaWQwuoJ9Ju5H1dmunCEHQyVlUjoVjvSpLc3WBDkgAhTfA+fHC9TDuiJaAUnpAgLq8s5RYkFP8+xkH7hfUtgPaYgYqS0SUS+IjioxKom+iT0l6x/h0hB+ZweZwU+IBcUZUDQUy6t842wP+zQZDsdkfCUCB89d7hvAkC3tuix/hdHiJ0iWGk6U0vIfQbSnNYZTV4VqbZUZfaiQQ1yNoVE62FL/LrE9LYfvEkXOUE5f0nD83Jjg== 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=U1ToY7tooyrlQKzotnHseoh8V/mRmx0gxOiB9eHyvhc=; b=eXONhwBGcvP0aDX1Pb4ZD8D6hr83d0E1a2wGOetjWGZwK5wa031GN6so3YPcvBGR/vaoqTb+QM70w9GGHw2g+2xf9LcVrK+mXs6KKNahOljP/8z9yYTgN4s2/wUUD6zkmtn77iM06/HWU9cO1BisVpVJmNGu6ylLpezKjO0DL7K2UeyM6bCyX2OPaTOrqCv2QpsEHVoQ5rhDpoP7LnmVVkxsqulyDZV6kP+cyruisbvl4v3n7AkYsG4EBG4dAU+GZGYgXGqILcjUnOjFLjgyQDtaaBlc+JZPNf8Z8R4/qQveJXuH7EMjyR+CHH/GAKZSxw6lZqTIf9SjMqMhdPPneA== 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=U1ToY7tooyrlQKzotnHseoh8V/mRmx0gxOiB9eHyvhc=; b=ZzPjSvhobI8ex/yu1PQspUwjsJugNWGiVhxDYetXhViU5BrQBNfzc01vhiUkn021CtfdLTdpKNQXuZvI6aI2KXQQqzdP196nPWVnDNs1MHxwkFnBj1AuH7489iwdDBjEnpZ+54ZtcwPBrX9cXKCQsfEv7Ya5cgWTTiC5l+CriUE= 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:55 +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:54 +0000 From: Stephen Douthit To: dev@dpdk.org Cc: wenw@silicom-usa.com, Stephen Douthit , stable@dpdk.org, Haiyue Wang , Xiao Wang , Wenzhuo Lu Subject: [PATCH 2/7] net/ixgbe: Add ixgbe_check_sfp_cage() for testing state of PRSNT# signal Date: Fri, 3 Dec 2021 17:55:11 -0500 Message-Id: <20211203225516.571368-3-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:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab76d97d-1c3a-400e-e994-08d9b6b00ff7 X-MS-TrafficTypeDiagnostic: AM0PR04MB6404: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H//7NEXNaOmWRAT1TFd9s4l7pSRcr5EKYW97lZiFweGeYUHFG0vIwKrS8AKQjeycTiZWOX8/yebduFfFuZavE/C+vzg4PpL9bIWkG9H6oIkImLlfW6NAyjD+WrvIvbMV+acm6CuUlx32EyJpMEyoiRPIO9EJZEs6nKAQefKo6aFLAmgE22sXnPxFHMqGk9LjFQ1JXKMi1iKAXbeL+Dvfe9l/FiiUjOGKPQsrGp5r7u9ojisbQ5rCSuIq62VSkI8YkUgPJblBSGbJOaXwcl2enoEvGMmUeW0oIsGT1lu85zxhespO+PDBSq5gLPwiaA7cOddZjgLavnYP2igKV6P5nzNMUFfgnMEUcOf1Mkp1bGh1rigQ8wOw0QVZWTg7AVNEhR5n3UL8zO2+/JfyeD+aO9/50sqeU7+n43uad0hoCMiNHlE92UoFlPHhIzs1qfpfJPmncIv7bhLz5l0wx30SaE9hF200JbSZNho4+3vPnGctqcV9jrhkFSCpjfH3xkDw4n70m11+vIX5/TxiZTWhMERGtJwTgulKylFNM1GhkYvcmf6afeN/9pOhUZ8vVxAKvLRXmQXuwiw3DMGaFxYW94zTdJV/SE3pqDlRvVZtsGb/oXHOmo0Qsgn+FlD86jK/hskkaB/BxQ3VbNQVkCDD3gmc3EDbWqmDo9DXAhO9F1FomyiPgeEmbNQYnZoUtfmFlO5UNqCFw2xt0OIWszy2bg== 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?R9nyEuVNxb0HRIY9Yv5jDbOdSxcqsnPsGoUw6TRopJxQwhPhkt0NwElK77ts?= =?us-ascii?Q?ZkBofisCch06FCTxG99VYDRJP1rVCGVz1UbDn3bilDU8MrPur9bRAX542eYv?= =?us-ascii?Q?V2IQ3wGJYOSOaulVWHU0fjK3COgKH8bU3t2ir5hkfsrPOEKOl6stJkBrUBR8?= =?us-ascii?Q?G9LxqxPoaMh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?= =?us-ascii?Q?M2Av59dUScgOQEWrvbX9SFVkRaS0wzw8qFoRsLGdKRZ57zWXpDCTUi/5tPIm?= =?us-ascii?Q?DDIwCAUL1eB+SS+eOcYKNGiVb9qqLIDX5MbhMOdhJHzE0dos/V/KPB43zbBx?= =?us-ascii?Q?sTifCgwpLIhQcgH+6MAJONpWY62SVFaUVjY7h24yisrZRWTFad0Mr/sW1csL?= =?us-ascii?Q?/yc8Dg1aGX76RQPuV8nZuzDlF8dAz/uNVFxIWwx2hp66tBMxJ4ZXSupjpN4F?= =?us-ascii?Q?+aH0oDREEhLpcXhyAOjOspmKstaDlUizLVkDLMpfL5khyguFAQYfcL2KxLkk?= =?us-ascii?Q?bdvq49NQ9054GhnILqyhF0fkyhYx5DG1axGcmZCW7UhGSGDnbifxHn1NGqfg?= =?us-ascii?Q?xtkCb0ViGeidRvge9Mocp5cj9r71eA+DbJykKdABDkpNREcmQ6LuzjpccHWo?= =?us-ascii?Q?JbReGn64rUzmy/0PeHBAZRNYJeil5D1Urhl3M4YZskCn2Ie64TxzC/3mRxPC?= =?us-ascii?Q?UtPqSKEle4EjHyyjBySqt9yRZJ8TpHrZvSonPOG7SUDP34x1+ZqyFs5TDeSQ?= =?us-ascii?Q?lc0fCiRFZImeatgcAT0oOBA17g2Lr7kcq/eoc6ddDbrXteTSdrT0dc7CN3Zt?= =?us-ascii?Q?ZSMKyqQ4a81BJmh4ccEGFRm9gLw=3D?= X-OriginatorOrg: silicom-usa.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab76d97d-1c3a-400e-e994-08d9b6b00ff7 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:54.8780 (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: kisPSQ8YzQgyhQ70SWv+yG9rbzvSdqKXQRDBZN1YffhgKKg1FRKZRaZQcel4XC6ZnU2jwk1pKBGC1W1NVNzQZ/LgwXjh+PjOQUtOMJG3fqM= 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 Refactor the SFP check code from ixgbe_check_mac_link_generic into its own function. Note that the SFP present status was inverted for the X550EM family of devices, where SDP0 represents the active low PRSNT# signal from the cage. Call the new function in ixgbe_identify_module_generic() to short circuit the I2C polling and greatly speed things up for devices we know are absent. Fixes: dd3a93cf5a2 ("net/ixgbe/base: bypass checking link for crosstalk") Cc: stable@dpdk.org Signed-off-by: Stephen Douthit --- drivers/net/ixgbe/base/ixgbe_common.c | 60 +++++++++++++++++++-------- drivers/net/ixgbe/base/ixgbe_common.h | 8 ++++ drivers/net/ixgbe/base/ixgbe_phy.c | 8 ++++ 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c index aa843bd5c4..2764cf7cf1 100644 --- a/drivers/net/ixgbe/base/ixgbe_common.c +++ b/drivers/net/ixgbe/base/ixgbe_common.c @@ -4124,6 +4124,45 @@ static bool ixgbe_need_crosstalk_fix(struct ixgbe_hw *hw) return true; } +/** + * ixgbe_check_sfp_cage - Find present status of SFP module + * @hw: pointer to hardware structure + * + * Find if a SFP module is present and if this device supports SFPs + **/ +enum ixgbe_sfp_cage_status ixgbe_check_sfp_cage(struct ixgbe_hw *hw) +{ + enum ixgbe_sfp_cage_status status; + + /* If we're not a fiber/fiber_qsfp, no cage to check */ + switch (hw->mac.ops.get_media_type(hw)) { + case ixgbe_media_type_fiber: + case ixgbe_media_type_fiber_qsfp: + break; + default: + return IXGBE_SFP_CAGE_NOCAGE; + } + + switch (hw->mac.type) { + case ixgbe_mac_82599EB: + status = !!(IXGBE_READ_REG(hw, IXGBE_ESDP) & + IXGBE_ESDP_SDP2); + break; + case ixgbe_mac_X550EM_x: + case ixgbe_mac_X550EM_a: + /* SDP0 is the active low signal PRSNT#, so invert this */ + status = !(IXGBE_READ_REG(hw, IXGBE_ESDP) & + IXGBE_ESDP_SDP0); + break; + default: + /* Don't know how to check this device type yet */ + status = IXGBE_SFP_CAGE_UNKNOWN; + break; + } + + return status; +} + /** * ixgbe_check_mac_link_generic - Determine link and speed status * @hw: pointer to hardware structure @@ -4145,25 +4184,10 @@ s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, * the SFP+ cage is full. */ if (ixgbe_need_crosstalk_fix(hw)) { - u32 sfp_cage_full; - - switch (hw->mac.type) { - case ixgbe_mac_82599EB: - sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) & - IXGBE_ESDP_SDP2; - break; - case ixgbe_mac_X550EM_x: - case ixgbe_mac_X550EM_a: - sfp_cage_full = IXGBE_READ_REG(hw, IXGBE_ESDP) & - IXGBE_ESDP_SDP0; - break; - default: - /* sanity check - No SFP+ devices here */ - sfp_cage_full = false; - break; - } + enum ixgbe_sfp_cage_status sfp_cage_status; - if (!sfp_cage_full) { + sfp_cage_status = ixgbe_check_sfp_cage(hw); + if (sfp_cage_status != IXGBE_SFP_CAGE_FULL) { *link_up = false; *speed = IXGBE_LINK_SPEED_UNKNOWN; return IXGBE_SUCCESS; diff --git a/drivers/net/ixgbe/base/ixgbe_common.h b/drivers/net/ixgbe/base/ixgbe_common.h index 5bdb484407..30db9a08c4 100644 --- a/drivers/net/ixgbe/base/ixgbe_common.h +++ b/drivers/net/ixgbe/base/ixgbe_common.h @@ -112,6 +112,14 @@ s32 ixgbe_set_vlvf_generic(struct ixgbe_hw *hw, u32 vlan, u32 vind, s32 ixgbe_clear_vfta_generic(struct ixgbe_hw *hw); s32 ixgbe_find_vlvf_slot(struct ixgbe_hw *hw, u32 vlan, bool vlvf_bypass); +enum ixgbe_sfp_cage_status { + IXGBE_SFP_CAGE_EMPTY = 0, + IXGBE_SFP_CAGE_FULL, + IXGBE_SFP_CAGE_UNKNOWN = -1, + IXGBE_SFP_CAGE_NOCAGE = -2, +}; +enum ixgbe_sfp_cage_status ixgbe_check_sfp_cage(struct ixgbe_hw *hw); + s32 ixgbe_check_mac_link_generic(struct ixgbe_hw *hw, ixgbe_link_speed *speed, bool *link_up, bool link_up_wait_to_complete); diff --git a/drivers/net/ixgbe/base/ixgbe_phy.c b/drivers/net/ixgbe/base/ixgbe_phy.c index 8d4d9bbfef..d8d51d2c3f 100644 --- a/drivers/net/ixgbe/base/ixgbe_phy.c +++ b/drivers/net/ixgbe/base/ixgbe_phy.c @@ -1228,9 +1228,17 @@ s32 ixgbe_reset_phy_nl(struct ixgbe_hw *hw) s32 ixgbe_identify_module_generic(struct ixgbe_hw *hw) { s32 status = IXGBE_ERR_SFP_NOT_PRESENT; + enum ixgbe_sfp_cage_status sfp_cage_status; DEBUGFUNC("ixgbe_identify_module_generic"); + sfp_cage_status = ixgbe_check_sfp_cage(hw); + if (sfp_cage_status == IXGBE_SFP_CAGE_EMPTY || + sfp_cage_status == IXGBE_SFP_CAGE_NOCAGE) { + hw->phy.sfp_type = ixgbe_sfp_type_not_present; + return status; + } + switch (hw->mac.ops.get_media_type(hw)) { case ixgbe_media_type_fiber: status = ixgbe_identify_sfp_module_generic(hw); -- 2.31.1