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 92C29A0558; Thu, 26 May 2022 22:44:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36D7140E50; Thu, 26 May 2022 22:44:10 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50113.outbound.protection.outlook.com [40.107.5.113]) by mails.dpdk.org (Postfix) with ESMTP id EBDC640DF7 for ; Thu, 26 May 2022 22:44:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KUbLa6LgIDm9I106I8CC+OJ0N6YRcgOH3sFRierUsYoiCAPUWD11sPWJW+70E02sjRh+7rcIZphzksGc8+R85G9nQ1qhLCZYOhLRbUmzoK22IvAHajWn1HAyVXIlF3YrELMaVbAavb/H+uXsI8W4n/TdvjWY9Cx5FVQrDHao/xtJ4cgmJmIdOc8qJfY7kvDk7TGLSwnIYsMY5Z8z9QidYyCIp7QSFypu6G7xkk0On8nsJjXXRQ8nnrBCKLlyKHf7SnbSdy4UNmiFTabPxSMAl1fzRzyqnYJ9W1K8pqRbkBTw23y9Zo9d38HQ3vQqzY+keCl+d6NX08TSt+kLwNwjpA== 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=2IrIE65eU8DVZh0kH7CArZ+N5memp/tIVdl7GR2rnK0=; b=MFVii6KFXBIsYAWr2xkncUEOQoIO8iIlHmQwBJTlUK7nHw3lEsyBdclpa5EMroiG2ZHWmqmz9lk6Grqm9CRS7yI19bNFmxYRHhRBLPpsgI5Y+rzUSquLR71m7QQHgZQDN+9vBj+jBLCrSXpn4R8kURlKKYM96/I0S8HoSk8TMsYTCUyGU7Y3esaJbbGm3/txxmzjMlMTbg9MN9d9wub/yDN2PbjViuHHQBMRyvH6kiwsdlQe90v0V3EbUV7OPvKF41ANsLEL8eFa4KoAPB2r1hM0rNpa+qFCsBd7rTtcNKy8JCsMrEF63kyswaaShoojdCd3BTeP3oBXlrsor5TPKw== 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=2IrIE65eU8DVZh0kH7CArZ+N5memp/tIVdl7GR2rnK0=; b=bpPiqOK3SVKlbhgMUo0trhNiAA1Mygqym4OEy+zp6mhJP4P03KK/I3MZ1pDAZAc4o9nIqOpBf2EJbFs7hTeUQ1G2qjigYrYVkIeejOvizFHU8zKuQat+qNQgNMtlEYeMErbQZzQHTWw4J6vUx74+KmOS3DVc1GRmAs7b3XkgKEo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silicom-usa.com; Received: from VI1PR0402MB3517.eurprd04.prod.outlook.com (2603:10a6:803:b::16) by PA4PR04MB7949.eurprd04.prod.outlook.com (2603:10a6:102:cc::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Thu, 26 May 2022 20:44:07 +0000 Received: from VI1PR0402MB3517.eurprd04.prod.outlook.com ([fe80::9198:ca97:d3b9:d3cc]) by VI1PR0402MB3517.eurprd04.prod.outlook.com ([fe80::9198:ca97:d3b9:d3cc%4]) with mapi id 15.20.5293.013; Thu, 26 May 2022 20:44:07 +0000 From: Jeff Daly To: dev@dpdk.org Cc: Stephen Douthit , Qiming Yang , Wenjun Wu Subject: [PATCH v2] net/ixgbe: Treat 1G Cu SFPs as 1G SX on the X550 devices Date: Thu, 26 May 2022 16:43:55 -0400 Message-Id: <20220526204355.5014-1-jeffd@silicom-usa.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307223442.28012-1-jeffd@silicom-usa.com> References: <20220307223442.28012-1-jeffd@silicom-usa.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MN2PR20CA0034.namprd20.prod.outlook.com (2603:10b6:208:e8::47) To VI1PR0402MB3517.eurprd04.prod.outlook.com (2603:10a6:803:b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1551fb22-b654-43ab-f4e5-08da3f587a30 X-MS-TrafficTypeDiagnostic: PA4PR04MB7949: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: IhBgsQ7f/0gGEUfKpNp72iBw4TuiDPz45/u3j8HeyHuGpLj7DdWR1C5tv6e9vXWCB+N1m22yyCYDTRhMjTrivpmn/oWsv1fki0nyED2oB/wUMikVeJdD8AyI4kgSzxw1yeDk04W9qXxuZ6EwrSo8IQStHAVcFgvteoRnXkkwlc7L2LdQcmwNQBO5RqHcrOrAkPAKkDLvvnoxGaOYw6rx+YPrNdWArhVMSbCRp1Am1uq61pYZjKYUDCLjAdFhJAKCl0N/rR53MWoyNZcQEDEvx1g7ov3XFqFnXLKiVeg+nxi48iQ4AWq1MBaWcE5Lc0kRMhwjGFHMKXb6W9KZkUy/RByBKd4zgx8uQrycyH4OhpkySKQf3ja706+m+ak719qw8iEDbnqHOfunwJamYhwu/z5Fg4+2HzHe3iXzM7Mtpbkvm9FLbULjO2WVL7Sfy6BNRYVltfc+TxgJD6EXbH9r+Ao5KgvlDms1b+kFcr7P5eiMKiyI5/6q3pcXI19FTnYuafzOGm3UyVleZS1IU5lomUO225ezRGaH1ZHtrSVr+mmkj6cyye1sr9/gLD2N3DPj/sexNYmlfVQ5uVmOQuLTrjK9AJi3gO6jdrOBPCrTU4FRbc9t0Ryb0UPndXq57awgByRWblefeeIZBHnQGcAZAco+FnDKAbNA+GKN2l+kIXrUle5qzxXqTt3jcDKTElWKQRspNi7YIozbLp0Tzf6Upg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0402MB3517.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(86362001)(38350700002)(6486002)(508600001)(8676002)(4326008)(66556008)(66946007)(66476007)(54906003)(6512007)(6916009)(316002)(26005)(52116002)(186003)(83380400001)(5660300002)(2906002)(1076003)(2616005)(38100700002)(8936002)(6666004)(6506007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZK2jmikj4cSb0A86rk9M9Z+XVgZL/bKINMSOdouUxnCT6HNTAeuMuz3Mh5r6?= =?us-ascii?Q?4Bjd6/YDreaIqmb+zevI/T7KiWtxRWz2baKMOBI4nlzqTL2Zaz51PtSUIrle?= =?us-ascii?Q?okg+xDS5sV1cxeqkrJFY6f+AT6cKMYg25rTi75jZ1rprRToD6mqet18c7GJQ?= =?us-ascii?Q?Ku0YyRATtmfB/5FCAoM6KLAvghi3YIKPGxvogq6AkKeESAHT2OJS6xLBiWpD?= =?us-ascii?Q?w9zPG2o0ysJbTbHadMVxyP+oRSOaj9NQtPe0CltWKfRBg5llMTeiJmF303Rk?= =?us-ascii?Q?JPrAXnUvVBLyGrAN8cz3/X+5eWf3/LSsuuKgtpW1wDybL+4sT/8IGOUEuaHo?= =?us-ascii?Q?ZL6BRkGLmAtznwUcz0FV6otJb3bZ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9TBZgfQaym7Yu78Tj5ueXv6qbZfCsqXtG4Vw1PNwGUYmecrk+Rv25yla3a3?= =?us-ascii?Q?XJ++5x5LVaRBmXKIQKR8pfTSFT3DB25Vj9w6JRFOL8Q+Y5uTFODjbNlKLeSU?= =?us-ascii?Q?oAFRXfYpXtqUnTiCCWo/m4a3gOcUC0J+ny+jrZIABq9UKUM/iTjmgg02FvUA?= =?us-ascii?Q?GMDVh9EzBh4L68m9aCFJmYZRaV2oAzc/jXdeYXkeOrMTVpFHNPUXBjcZpIdP?= =?us-ascii?Q?dyqCwIKAfV54uQWCQ1/f2bNvPbgFCZT78dN1A+DZ1iM/YtdHulDVkxTe6N7L?= =?us-ascii?Q?uU8utndjD/EnAsoGzbQMBp/+zYMCiXcoG9EeX17FuWVpHmCPAGVOF+Kgs0SX?= =?us-ascii?Q?1HCnD5H/0GMOjUedcGtCdejm/GKOW9JrMAzc1fEuWn91xGPSusNcSwxwDN7c?= =?us-ascii?Q?KQHsb/CiCTsjtFGUniGVwjgnNXXuCWg6pjg1F012jevXJcUd7lAcPUfBC6oD?= =?us-ascii?Q?d2K6++B8Xg=3D=3D?= X-OriginatorOrg: silicom-usa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1551fb22-b654-43ab-f4e5-08da3f587a30 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3517.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 May 2022 20:44:06.9172 (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: IbbmfjmIbQeQhVsMvXCN3UTvCLJkyQUOxRM4fXR1O5Q7SOYuBvTF4y0XSBzzOYVsb9mnvbydlotQUx55pECMtA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7949 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 1G Cu SFPs are not officially supported on the X552/X553 family of devices but create an option cu_sfp_as_sx to treat them as 1G SX modules since they usually work. Print a warning though since support isn't validated, similar to what already happens for other unofficially supported SFPs enabled via the allow_unsupported_sfps parameter inherited from the mainline Linux driver. Signed-off-by: Jeff Daly Suggested-by: Stephen Douthit --- v2: * Introduced cu_sfp_as_sx option, default off. --- doc/guides/nics/ixgbe.rst | 16 ++++++++++++++ drivers/net/ixgbe/base/ixgbe_type.h | 1 + drivers/net/ixgbe/base/ixgbe_x550.c | 12 ++++++++++- drivers/net/ixgbe/ixgbe_ethdev.c | 33 +++++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ 5 files changed, 64 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst index 82fa453fa28e..5db63083eef8 100644 --- a/doc/guides/nics/ixgbe.rst +++ b/doc/guides/nics/ixgbe.rst @@ -101,6 +101,22 @@ To guarantee the constraint, capabilities in dev_conf.rxmode.offloads will be ch fdir_conf->mode will also be checked. +Runtime Options +^^^^^^^^^^^^^^^^^^ + +The following ``devargs`` options can be enabled at runtime. They must +be passed as part of EAL arguments. For example, + +.. code-block:: console + + dpdk-testpmd -a af:10.0,cu_sfp_as_sx=1 -- -i + +- ``cu_sfp_as_sx`` (default **0**) + + This option is used to allow the X550 devices to treat 1G Cu SFPs as + 1G SX SFPs, since this usually works. By default, 1G Cu SFPs are not + supported by Intel for the X550. + VF Runtime Options ^^^^^^^^^^^^^^^^^^ diff --git a/drivers/net/ixgbe/base/ixgbe_type.h b/drivers/net/ixgbe/base/ixgbe_type.h index b7eec456358d..36d741dbfaad 100644 --- a/drivers/net/ixgbe/base/ixgbe_type.h +++ b/drivers/net/ixgbe/base/ixgbe_type.h @@ -4190,6 +4190,7 @@ struct ixgbe_hw { bool allow_unsupported_sfp; bool wol_enabled; bool need_crosstalk_fix; + bool cu_sfp_as_sx; }; #define ixgbe_call_func(hw, func, params, error) \ diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c index 8810d1658e91..7211b8c707d8 100644 --- a/drivers/net/ixgbe/base/ixgbe_x550.c +++ b/drivers/net/ixgbe/base/ixgbe_x550.c @@ -1538,9 +1538,19 @@ STATIC s32 ixgbe_supported_sfp_modules_X550em(struct ixgbe_hw *hw, bool *linear) case ixgbe_sfp_type_1g_lha_core1: *linear = false; break; - case ixgbe_sfp_type_unknown: case ixgbe_sfp_type_1g_cu_core0: + if (hw->cu_sfp_as_sx == 1) { + EWARN(hw, "WARNING: Treating Cu SFP modules as SX modules is unsupported by Intel and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using Cu modules in this way with this adapter.\n"); + *linear = false; + hw->phy.sfp_type = ixgbe_sfp_type_1g_sx_core0; + } case ixgbe_sfp_type_1g_cu_core1: + if (hw->cu_sfp_as_sx == 1) { + EWARN(hw, "WARNING: Treating Cu SFP modules as SX modules is unsupported by Intel and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using Cu modules in this way with this adapter.\n"); + *linear = false; + hw->phy.sfp_type = ixgbe_sfp_type_1g_sx_core1; + } + case ixgbe_sfp_type_unknown: default: return IXGBE_ERR_SFP_NOT_SUPPORTED; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2da3f67bbc78..419342f34132 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -129,12 +129,18 @@ #define IXGBE_DMATXCTL_VT_MASK 0xFFFF0000 #define IXGBEVF_DEVARG_PFLINK_FULLCHK "pflink_fullchk" +#define IXGBE_DEVARG_CU_SFP_AS_SX "cu_sfp_as_sx" static const char * const ixgbevf_valid_arguments[] = { IXGBEVF_DEVARG_PFLINK_FULLCHK, NULL }; +static const char * const ixgbe_valid_arguments[] = { + IXGBE_DEVARG_CU_SFP_AS_SX, + NULL +}; + static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params); static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev); static int ixgbe_fdir_filter_init(struct rte_eth_dev *eth_dev); @@ -185,6 +191,8 @@ static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, static int ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev); +static int devarg_handle_int(const char *key, const char *value, + void *extra_args); static int ixgbevf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); @@ -1032,6 +1040,29 @@ ixgbe_swfw_lock_reset(struct ixgbe_hw *hw) ixgbe_release_swfw_semaphore(hw, mask); } +static void +ixgbe_parse_devargs(struct ixgbe_adapter *adapter, + struct rte_devargs *devargs) +{ + struct rte_kvargs *kvlist; + uint16_t cu_sfp_as_sx; + + if (devargs == NULL) + return; + + kvlist = rte_kvargs_parse(devargs->args, ixgbe_valid_arguments); + if (kvlist == NULL) + return; + + if (rte_kvargs_count(kvlist, IXGBE_DEVARG_CU_SFP_AS_SX) == 1 && + rte_kvargs_process(kvlist, IXGBE_DEVARG_CU_SFP_AS_SX, + devarg_handle_int, &cu_sfp_as_sx) == 0 && + cu_sfp_as_sx == 1) + adapter->cu_sfp_as_sx = 1; + + rte_kvargs_free(kvlist); +} + /* * This function is based on code in ixgbe_attach() in base/ixgbe.c. * It returns 0 on success. @@ -1095,6 +1126,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) } rte_atomic32_clear(&ad->link_thread_running); + ixgbe_parse_devargs(eth_dev->data->dev_private, + pci_dev->device.devargs); rte_eth_copy_pci_info(eth_dev, pci_dev); eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 69e0e82a5b1a..c29e14c120b0 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -498,6 +498,9 @@ struct ixgbe_adapter { struct rte_timecounter tx_tstamp_tc; struct ixgbe_tm_conf tm_conf; + /* For treating CU SFPs as SX (Unsupported by Intel) */ + uint8_t cu_sfp_as_sx; + /* For RSS reta table update */ uint8_t rss_reta_updated; -- 2.25.1