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 B1A3F4550C; Thu, 27 Jun 2024 19:07:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E79040E2C; Thu, 27 Jun 2024 19:07:14 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by mails.dpdk.org (Postfix) with ESMTP id 3A03240E2A for ; Thu, 27 Jun 2024 19:07:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719508034; x=1751044034; h=message-id:date:subject:to:references:from:cc: in-reply-to:mime-version; bh=CT1tXcMK5+ahUxoW3ccFjdO7oEF3vov7v5Jpz0au5fE=; b=ItnPWhuDVLLP0kO9wIynQD2sUQHhN+nzBTtLYdLmiyYvyT82M/wNW6F3 2VLpKHtrPVTG20ofxL4ep2fZ6DyzdVRmKUvgsxHGAMpMWkXfDsooUPSsN nYhSUnJO0H0QRarGHHyMryHVX3nErHhNsz+WUY0ZomGiWvKOXl0mu9J4+ mcq/akJELW9EHyAD7DgctIPDbZmCh3TXdjlDnAf6XwW2Sp4H5ymkHSltF caUZbcywqME+De5Mh//ezTNTUyuxxx5Xrh1tt8Kuq+Y5WTsdsyOwfzElL /Wc379XUu4oxIpkFVi1mGVfJ03u/SuwSGxQT1tn7FLPAoruti+1tAnGlw Q==; X-CSE-ConnectionGUID: eczIutlKTOODs1Nzy0q1mA== X-CSE-MsgGUID: UYaRH7UyQfuOlBlS1LOShA== X-IronPort-AV: E=McAfee;i="6700,10204,11116"; a="27242528" X-IronPort-AV: E=Sophos;i="6.09,166,1716274800"; d="scan'208,217";a="27242528" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2024 10:07:11 -0700 X-CSE-ConnectionGUID: M2l19/cLRAWbvimYdgZxVQ== X-CSE-MsgGUID: XFUWTI07TU+ei8/QIT1wGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,166,1716274800"; d="scan'208,217";a="49364840" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Jun 2024 10:07:11 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 27 Jun 2024 10:07:10 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 27 Jun 2024 10:07:10 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 27 Jun 2024 10:07:10 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 27 Jun 2024 10:07:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZghOzNXuCbhPaLFqaWMCG5Ty+jAXzE15DkU+IMdfPOpVbt10J79qepgS7A1B6ET1UPjANTWqN82zpYneItVysmIMtIRnGKR72z/YTn4jRYYbUB132o5aWV41sD6+Pwp6ghqCP0uiD5xyMOn0p+Szw7fCatxI6cSsipu6HJKQ0t2sYY8DAXhYLKdYzwMecHQXBxF4Kxlg3I5FsHzq4ZIPI5zFfQ88s0n4yHOuzuSPEKIDPG8ew8R20l0KOZz8frxYL5lZx9mgIA1VvhAZOKN1ss6uMiI4f2CTu2xiwFmqrxYX53uAkRl7PpKbK+n+Gb5iLOf7LrfOpQZ2OCr8rwHlg== 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=IrF7yi7KGzHV5x84zC2iWLQNJjx5SCKN0voHJ9gpxHw=; b=AVxPjI4NC9XdILQVBURXBeILlcoE9JdI4uKr2hepk1VwfYzlr2wDpRKMtwhhYcQKb6HUGGSbfh0eLFFQYLEFXTqPnwlRXqKMVFMsV7mFxTdmwCSScjMcbDj4b9+PM5/jvItEutgC1Ezsadt+6YRxS1TAbney0i9rbGULeYFROfs8NYu5MLfTc9mJXCusVkXfGRR36s7OfirU1unUTIwelCjSK58EohOds5K5srEWLjXi1rga+qhC2MZ8SPqTv/vUfUcKN9wUMhAs7reVO0LR4twF9ppifFDYdwwcivQQ6tkzADqN4AzNORvci699Awy3WSMfLAeJD9WUe0cDkl5VsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by CH3PR11MB8383.namprd11.prod.outlook.com (2603:10b6:610:171::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Thu, 27 Jun 2024 17:07:07 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5851:319:3da6:850b%5]) with mapi id 15.20.7698.033; Thu, 27 Jun 2024 17:07:07 +0000 Content-Type: multipart/alternative; boundary="------------0Fx9PUCTgckORFtSnnIh0IUm" Message-ID: <4292a06f-9520-42d4-b0ac-f0a2d6a9977c@intel.com> Date: Thu, 27 Jun 2024 18:07:02 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] net/ice: support FEC feature To: Mingjin Ye , References: <20240411094548.1622662-1-mingjinx.ye@intel.com> Content-Language: en-US From: "Medvedkin, Vladimir" CC: In-Reply-To: <20240411094548.1622662-1-mingjinx.ye@intel.com> X-ClientProxiedBy: DU2PR04CA0311.eurprd04.prod.outlook.com (2603:10a6:10:2b5::16) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5772:EE_|CH3PR11MB8383:EE_ X-MS-Office365-Filtering-Correlation-Id: 315d4457-bbaa-4eb4-f309-08dc96cb933b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?NHdYYjlFbXZyVEpCRWh2WDVIU1MwN3BPZUFuWkRORmpGWGRIUExxYjhsUGFz?= =?utf-8?B?U2tNUlNNRWFTb3BpSENyU1VwLzRJbmJWZnVqODZobVArQkVNeWttZmp3bUVJ?= =?utf-8?B?NDJnVElCUWUwaXR6cTBTcjc3WW52OEpIQk1XVG12S2ozMzBMODI3a0R4MjZj?= =?utf-8?B?NnJlZHgrdE82Z0ZCMkMzVlk0OWxScjgyU1Brb2ZyWC93ak5uT3RtVHM0YnlP?= =?utf-8?B?UVBLVXZU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B?TFcxN214RzBEUjhKbVlrcERCZDljQVRIQUVZRHZlZENxUkIvdHdacXFzRTJV?= =?utf-8?B?S3d6b1lpSGtGN1M4N1JWMElXWnEvV3VLMndIclNqM2NSMER1U29FUzl3TjNL?= =?utf-8?B?bHdHZFBuczYrZlF6SUZEY3NrS0VkaFlPYkRCdEQvV1l1OXptSTl6eW04bWF2?= =?utf-8?B?cXFVd21mNXpVNnJwR3lkV2RKdFMwdE9sTWZVcFkvSUl6NTduOTJDZXBVdHpi?= =?utf-8?B?Rzd1U0poNnBnUVkzQWQ4cE51M3ltMWN0eFFFSWhweXhtM0Z5T0IvUEszZVo0?= =?utf-8?B?bDdwaGdqc3JnT3V3NWlGMDcyNlIvNk1GSHlGYUU0WlhhZ2lGaERURVJzSVVJ?= =?utf-8?B?a0pINGRmSkl2dXlNdmlHRVpSdjBOZmRsd05oSXY0Q0F6UndEcVZPbklNTHJC?= =?utf-8?B?Zll6YzlBeXg3SW9mQ3FWdkR4V3Jya2xxeXJiWU5tRDFqMzk5aHAwdlFPOTdB?= =?utf-8?B?UHk1TlJCU1JsMWdIRUpZYjVyTHRudUYva0w4MzJzVlhxaFhqNnY1UlVYclpj?= =?utf-8?B?NVhPZEpROWVpNHFhUjFxTUpNVWtDUEtGeVZRTEwvUWt5SHl5V0Vyamk5OHJm?= =?utf-8?B?SHJRb1dlUG8yTVY1SmZEYXlGb051YVlRVEEwNWRzeWg4ZHIrTVByYVhBWnRY?= =?utf-8?B?WEdmR0Z6SXFhMS80TS9QUT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R2xRM0g4SlRvMkZMbThKalp5akN0YnZxS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XJwNmltdjdHWEI4eW96NkFhdER5M3hQRitNVHBjVDhYek1abkRyb0Q2Tkhn?= =?utf-8?B?SDR5bGVHZ1REa3ArY080OHhBcERaVXFMSERxc09VbG96L0RGdGlMT1FveWJ4?= =?utf-8?B?K1hpWlArWEU4SStkZkhXZzY4UzcvVEZyc1o0U29ycjJDZVIwUXVpVFVhU3Rn?= =?utf-8?B?RXc3MU03dzRlR2RYaFBFazlCM3hQRldBRWxoaDg1MUFoa2t2MzRxYVdKSW9a?= =?utf-8?B?ZVNtbExRZnJpSFU0ZW1HTkp6STJDUkNiMzFFVkRWN0JkQ0JYWS9uQ3RKd0s3?= =?utf-8?B?R0tuaWRnTitXWkw5RXQ1QVdWWXhKLys1VjJKQkhjdm1kTlArbzZlazhKaHA5?= =?utf-8?B?OHc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 315d4457-bbaa-4eb4-f309-08dc96cb933b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 17:07:07.4955 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rgXV1Kdn/8mVsTAwLNomTtdD0Jg6ivJyK15TGIX5YUqTW09JtNFlbbmLn2ZIpk3V92A49sLEPloGKvr8oft66AhzIiiFZ13g9CjIWuUaKZo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8383 X-OriginatorOrg: intel.com 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 --------------0Fx9PUCTgckORFtSnnIh0IUm Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Hi Mingjin, On 11/04/2024 10:45, Mingjin Ye wrote: > This patch enable three Forward Error Correction(FEC) related ops > in ice driver. As no speed information can get from HW, this patch > only show FEC capability. > > Signed-off-by: Mingjin Ye > --- > doc/guides/nics/features/ice.ini | 1 + > doc/guides/nics/ice.rst | 5 + > drivers/net/ice/ice_ethdev.c | 176 +++++++++++++++++++++++++++++++ > 3 files changed, 182 insertions(+) > > diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini > index 62869ef0a0..a9be394696 100644 > --- a/doc/guides/nics/features/ice.ini > +++ b/doc/guides/nics/features/ice.ini > @@ -9,6 +9,7 @@ > [Features] > Speed capabilities = Y > Link speed configuration = Y > +FEC = Y > Link status = Y > Link status event = Y > Rx interrupt = Y > diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst > index 3deeea9e6c..3d7e4ed7f1 100644 > --- a/doc/guides/nics/ice.rst > +++ b/doc/guides/nics/ice.rst > @@ -323,6 +323,11 @@ The DCF PMD needs to advertise and acquire DCF capability which allows DCF to > send AdminQ commands that it would like to execute over to the PF and receive > responses for the same from PF. > > +Forward Error Correction (FEC) > +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +Supports get/set FEC mode and get FEC capability. > + > Generic Flow Support > ~~~~~~~~~~~~~~~~~~~~ > > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c > index 87385d2649..56d0f2bb28 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -181,6 +181,10 @@ static int ice_timesync_read_time(struct rte_eth_dev *dev, > static int ice_timesync_write_time(struct rte_eth_dev *dev, > const struct timespec *timestamp); > static int ice_timesync_disable(struct rte_eth_dev *dev); > +static int ice_fec_get_capability(struct rte_eth_dev *dev, struct rte_eth_fec_capa *speed_fec_capa, > + unsigned int num); > +static int ice_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa); > +static int ice_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa); > static const uint32_t *ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev, > size_t *no_of_elements); > > @@ -298,6 +302,9 @@ static const struct eth_dev_ops ice_eth_dev_ops = { > .timesync_write_time = ice_timesync_write_time, > .timesync_disable = ice_timesync_disable, > .tm_ops_get = ice_tm_ops_get, > + .fec_get_capability = ice_fec_get_capability, > + .fec_get = ice_fec_get, > + .fec_set = ice_fec_set, > .buffer_split_supported_hdr_ptypes_get = ice_buffer_split_supported_hdr_ptypes_get, > }; > > @@ -6644,6 +6651,175 @@ ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev __rte_unused, > return ptypes; > } > > +static int > +ice_fec_get_capa_num(struct ice_aqc_get_phy_caps_data *pcaps, > + struct rte_eth_fec_capa *speed_fec_capa) > +{ > + int num = 0; > + > + if (!pcaps) > + return ICE_ERR_NO_MEMORY; no need to check since it was checked before in ice_fec_get_capability > + > + if (pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC) { > + if (speed_fec_capa) > + speed_fec_capa[num].capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); > + num++; > + } > + > + if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN || > + pcaps->link_fec_options & ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ || > + pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN || > + pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_KR_REQ) { > + if (speed_fec_capa) > + speed_fec_capa[num].capa = RTE_ETH_FEC_MODE_CAPA_MASK(BASER); > + num++; > + } > + > + if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_528_REQ || > + pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_544_REQ || > + pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN) { > + if (speed_fec_capa) > + speed_fec_capa[num].capa = RTE_ETH_FEC_MODE_CAPA_MASK(RS); > + num++; > + } > + > + if (pcaps->link_fec_options == 0) { > + if (speed_fec_capa) > + speed_fec_capa[num].capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); > + num++; > + } > + > + return num; > +} here in this function above I see a number of problems: 1. according to API returning speed_fec_capa must have capabilities associated with corresponding link speed. 2. RTE_ETH_FEC_MODE_CAPA_MASK(AUTO) is not an unique fec capability, if it is supported then it should be presented in capability bitmask for every speed 3. Same applied for RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC) My suggestions here: -  check for available speed in pcaps->eee_cap - look at Table 3-20. Supported Electrical Modes to get supported FEC modes for a given speed something like: int auto = (pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC) ? RTE_ETH_FEC_MODE_CAPA_MASK(AUTO) : 0; int nofec = (pcaps->caps & ICE_AQC_PHY_FEC_DIS) ? RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC) : 0; if (pcaps->eee_cap & ICE_AQC_PHY_EEE_EN_100BASE_TX) {     speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_100M;     speed_fec_capa[num++].capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); } if (pcaps->eee_cap & (ICE_AQC_PHY_EEE_EN_1000BASE_T|ICE_AQC_PHY_EEE_EN_1000BASE_KX)) {     speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_1G;     speed_fec_capa[num++].capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); } if (pcaps->eee_cap & ICE_AQC_PHY_EEE_EN_10GBASE_T) {     speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_10G;     speed_fec_capa[num].capa = auto|nofec;     if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN)         speed_fec_capa[num].capa |= RTE_ETH_FEC_MODE_CAPA_MASK(BASER);     num++; } if (pcaps->eee_cap & ICE_AQC_PHY_EEE_EN_25GBASE_KR) {     speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_25G;     speed_fec_capa[num].capa = auto|nofec;     if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN)         speed_fec_capa[num].capa |= RTE_ETH_FEC_MODE_CAPA_MASK(BASER);     if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)         speed_fec_capa[num].capa |= RTE_ETH_FEC_MODE_CAPA_MASK(RS);     num++; } if (pcaps->eee_cap & (ICE_AQC_PHY_EEE_EN_50GBASE_KR2|ICE_AQC_PHY_EEE_EN_50GBASE_KR_PAM4)) {     speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_50G;     speed_fec_capa[num].capa = auto|nofec;     if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)         speed_fec_capa[num].capa |= RTE_ETH_FEC_MODE_CAPA_MASK(RS);     num++; } if (pcaps->eee_cap & (ICE_AQC_PHY_EEE_EN_100GBASE_KR4|ICE_AQC_PHY_EEE_EN_100GBASE_KR2_PAM4)) {     speed_fec_capa[num].speed = RTE_ETH_SPEED_NUM_100G;     speed_fec_capa[num].capa = auto|nofec;     if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)         speed_fec_capa[num].capa |= RTE_ETH_FEC_MODE_CAPA_MASK(RS);     num++; } > + > +static int > +ice_fec_get_capability(struct rte_eth_dev *dev, struct rte_eth_fec_capa *speed_fec_capa, > + unsigned int num) > +{ > + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + struct ice_aqc_get_phy_caps_data *pcaps; > + unsigned int capa_num; > + int ret; > + > + pcaps = (struct ice_aqc_get_phy_caps_data *) > + ice_malloc(hw, sizeof(*pcaps)); > + if (!pcaps) > + return ICE_ERR_NO_MEMORY; wouldn't it be easier just to have this struct on the stack? > + > + ret = ice_aq_get_phy_caps(hw->port_info, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA, > + pcaps, NULL); > + if (ret) should be (ret != ICE_SUCCESS) since this function returns enum ice_status > + goto done; > + > + /* first time to get capa_num */ > + capa_num = ice_fec_get_capa_num(pcaps, NULL); > + if (!speed_fec_capa || num < capa_num) { > + ret = capa_num; > + goto done; > + } > + > + ret = ice_fec_get_capa_num(pcaps, speed_fec_capa); > + > +done: > + ice_free(hw, pcaps); > + return ret; > +} > + > +static int > +ice_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa) > +{ > + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + struct ice_port_info *pi = hw->port_info; > + u32 temp_fec_capa = 0; > + int ret = 0; > + > + if (!pi) > + return -ENOTSUP; > + > + /* Get current FEC mode from port info */ > + switch (pi->phy.curr_user_fec_req) { > + case ICE_FEC_NONE: > + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); > + break; > + case ICE_FEC_AUTO: > + case ICE_FEC_DIS_AUTO: > + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); > + break; > + case ICE_FEC_BASER: > + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(BASER); > + break; > + case ICE_FEC_RS: > + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(RS); > + break; > + default: > + ret = -ENOTSUP; > + break; > + } > + > + *fec_capa = temp_fec_capa; > + return ret; > +} Thisfunctionneedsto berewrittentomeetAPIrequirements: "Get current Forward Error Correction(FEC) mode. If link is down and AUTO is enabled, AUTO is returned, otherwise, configured FEC mode is returned. If link is up, current FEC mode is returned." So, if link is down - return AUTO or bitmask with supported capabilities (from ice_aqc_get_phy_caps_data) If link is up - use your logic with switch (pi->phy.curr_user_fec_req) {} (but without case ICE_FEC_AUTO/ICE_FEC_DIS_AUTO, because we need to return current mode) Also, check plz that curr_user_fec_req has relevant data. As I can see it is not updated anywhere in the code, since ice_cache_phy_user_req() is called only with ICE_FC_MODE. So probably you need to use corresponding AQ command to retrieve current fec mode from the HW. Or it is probably better to read directly content of the "Table 3-40. Get Link Status Command Response Data Structure" instead of cached "pi->phy.curr_user_fec_req" > + > +static int > +ice_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa) > +{ > + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + struct ice_port_info *pi = hw->port_info; > + struct ice_aqc_set_phy_cfg_data config = { 0 }; > + enum ice_fec_mode req_fec; > + int ret = 0; > + > + if (!pi) > + return -ENOTSUP; > + > + switch (fec_capa) { > + case RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC): > + req_fec = ICE_FEC_NONE; > + break; > + case RTE_ETH_FEC_MODE_CAPA_MASK(AUTO): > + if (ice_fw_supports_fec_dis_auto(hw)) > + req_fec = ICE_FEC_DIS_AUTO; I'm not sure why it is here, could you clarify plz? Shouldn't ICE_FEC_DIS_AUTO be specified if RTE_ETH_FEC_MODE_CAPA_MASK(AUTO)? > + else > + req_fec = ICE_FEC_AUTO; > + break; > + case RTE_ETH_FEC_MODE_CAPA_MASK(BASER): > + req_fec = ICE_FEC_BASER; > + break; > + case RTE_ETH_FEC_MODE_CAPA_MASK(RS): > + req_fec = ICE_FEC_RS; > + break; > + default: > + PMD_DRV_LOG(ERR, "Unsupported FEC mode: %d\n", fec_capa); > + return -EINVAL; > + } > + > + /* Proceed only if requesting different FEC mode */ > + if (pi->phy.curr_user_fec_req == req_fec) > + return 0; > + > + /* Copy the current user PHY configuration. The current user PHY > + * configuration is initialized during probe from PHY capabilities > + * software mode, and updated on set PHY configuration. > + */ > + memcpy(&config, &pi->phy.curr_user_phy_cfg, sizeof(config)); > + > + ret = ice_cfg_phy_fec(pi, &config, req_fec); > + if (ret) { > + PMD_DRV_LOG(ERR, "Failed to set FEC mode"); > + return -EINVAL; > + } > + > + config.caps |= ICE_AQ_PHY_ENA_AUTO_LINK_UPDT; > + > + if (ice_aq_set_phy_cfg(pi->hw, pi, &config, NULL)) > + return -EAGAIN; > + > + /* Save requested FEC config */ > + pi->phy.curr_user_fec_req = req_fec; > + > + return 0; > +} From API documentation: "fec_capa    A bitmask of allowed FEC modes. If AUTO bit is set, other bits specify FEC modes which may be negotiated. If AUTO bit is clear, specify FEC modes to be used (only one valid mode per speed may be set)." I think logic of this function should be rewritten to meet API requirements. The goal of this function to set proper PHY config (see Table 3-28. Set PHY Config Command Data Structure), particularily: Auto FEC Enable bit (if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(AUTO))) and Link FEC Options bits. I'm not sure if current implementation of ice_cfg_phy_fec() fits perfectly here since it doesn't allow you to have different FEC modes (RS and BASER at the same time) > + > static int > ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > struct rte_pci_device *pci_dev) -- Regards, Vladimir --------------0Fx9PUCTgckORFtSnnIh0IUm Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi Mingjin,

On 11/04/2024 10:45, Mingjin Ye wrote:
This patch enable three Forwar=
d Error Correction(FEC) related ops
in ice driver. As no speed information can get from HW, this patch
only show FEC capability.

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
 doc/guides/nics/features/ice.ini |   1 +
 doc/guides/nics/ice.rst          |   5 +
 drivers/net/ice/ice_ethdev.c     | 176 +++++++++++++++++++++++++++++++
 3 files changed, 182 insertions(+)

diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ic=
e.ini
index 62869ef0a0..a9be394696 100644
--- a/doc/guides/nics/features/ice.ini
+++ b/doc/guides/nics/features/ice.ini
@@ -9,6 +9,7 @@
 [Features]
 Speed capabilities   =3D Y
 Link speed configuration =3D Y
+FEC                  =3D Y
 Link status          =3D Y
 Link status event    =3D Y
 Rx interrupt         =3D Y
diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
index 3deeea9e6c..3d7e4ed7f1 100644
--- a/doc/guides/nics/ice.rst
+++ b/doc/guides/nics/ice.rst
@@ -323,6 +323,11 @@ The DCF PMD needs to advertise and acquire DCF capabil=
ity which allows DCF to
 send AdminQ commands that it would like to execute over to the PF and rece=
ive
 responses for the same from PF.
=20
+Forward Error Correction (FEC)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Supports get/set FEC mode and get FEC capability.
+
 Generic Flow Support
 ~~~~~~~~~~~~~~~~~~~~
=20
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 87385d2649..56d0f2bb28 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -181,6 +181,10 @@ static int ice_timesync_read_time(struct rte_eth_dev *=
dev,
 static int ice_timesync_write_time(struct rte_eth_dev *dev,
 				   const struct timespec *timestamp);
 static int ice_timesync_disable(struct rte_eth_dev *dev);
+static int ice_fec_get_capability(struct rte_eth_dev *dev, struct rte_eth_=
fec_capa *speed_fec_capa,
+			   unsigned int num);
+static int ice_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa);
+static int ice_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa);
 static const uint32_t *ice_buffer_split_supported_hdr_ptypes_get(struct rt=
e_eth_dev *dev,
 						size_t *no_of_elements);
=20
@@ -298,6 +302,9 @@ static const struct eth_dev_ops ice_eth_dev_ops =3D {
 	.timesync_write_time          =3D ice_timesync_write_time,
 	.timesync_disable             =3D ice_timesync_disable,
 	.tm_ops_get                   =3D ice_tm_ops_get,
+	.fec_get_capability           =3D ice_fec_get_capability,
+	.fec_get                      =3D ice_fec_get,
+	.fec_set                      =3D ice_fec_set,
 	.buffer_split_supported_hdr_ptypes_get =3D ice_buffer_split_supported_hdr=
_ptypes_get,
 };
=20
@@ -6644,6 +6651,175 @@ ice_buffer_split_supported_hdr_ptypes_get(struct rt=
e_eth_dev *dev __rte_unused,
 	return ptypes;
 }
=20
+static int
+ice_fec_get_capa_num(struct ice_aqc_get_phy_caps_data *pcaps,
+			   struct rte_eth_fec_capa *speed_fec_capa)
+{
+	int num =3D 0;
+
+	if (!pcaps)
+		return ICE_ERR_NO_MEMORY;

no need to check since it was checked before in ice_fec_get_capability

+
+	if (pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC) {
+		if (speed_fec_capa)
+			speed_fec_capa[num].capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(AUTO);
+		num++;
+	}
+
+	if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN ||
+	    pcaps->link_fec_options & ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ |=
|
+	    pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN |=
|
+	    pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_KR_REQ) {
+		if (speed_fec_capa)
+			speed_fec_capa[num].capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(BASER);
+		num++;
+	}
+
+	if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_528_REQ ||
+	    pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_544_REQ ||
+	    pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN) =
{
+		if (speed_fec_capa)
+			speed_fec_capa[num].capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(RS);
+		num++;
+	}
+
+	if (pcaps->link_fec_options =3D=3D 0) {
+		if (speed_fec_capa)
+			speed_fec_capa[num].capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);
+		num++;
+	}
+
+	return num;
+}

here in this function above I see a number of problems:

1. according to API returning speed_fec_capa must have capabilities associated with corresponding link speed.

2. RTE_ETH_FEC_MODE_CAPA_MASK(AUTO) is not an unique fec capability, if it is supported then it should be presented in capability bitmask for every speed

3. Same applied for RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC)

My suggestions here:

-  check for available speed in pcaps->eee_cap

- look at Table 3-20. Supported Electrical Modes to get supported FEC modes for a given speed

something like:

int auto =3D (pcaps->caps & ICE_AQC_PHY_EN_AUTO_FEC) ? RTE_ETH_FEC_MODE_CAPA_MASK(AUTO) : 0;

int nofec =3D (pcaps->caps & ICE_AQC_PHY_FEC_DIS) ? RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC) : 0;

if (pcaps->eee_cap & ICE_AQC_PHY_EEE_EN_100BASE_TX) {

    speed_fec_capa[num].speed =3D RTE_ETH_SPEED_NUM_1= 00M;

    speed_fec_capa[num++].capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);

}

if (pcaps->eee_cap & (ICE_AQC_PHY_EEE_EN_1000BASE_T|ICE_AQC_PHY_EEE_EN_1000BASE_KX)) {

    speed_fec_capa[num].speed =3D RTE_ETH_SPEED_NUM_1= G;

    speed_fec_capa[num++].capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);

}

if (pcaps->eee_cap & ICE_AQC_PHY_EEE_EN_10GBASE_T) {

    speed_fec_capa[num].speed =3D RTE_ETH_SPEED_NUM_1= 0G;

    speed_fec_capa[num].capa =3D auto|nofec;

    if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN)

        speed_fec_capa[num].capa |=3D RTE_ETH_FEC_MODE_CAPA_MASK(BASER);

    num++;

}

if (pcaps->eee_cap & ICE_AQC_PHY_EEE_EN_25GBASE_KR) {

    speed_fec_capa[num].speed =3D RTE_ETH_SPEED_NUM_2= 5G;

    speed_fec_capa[num].capa =3D auto|nofec;

    if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN)

        speed_fec_capa[num].capa |=3D RTE_ETH_FEC_MODE_CAPA_MASK(BASER);

    if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)

        speed_fec_capa[num].capa |=3D RTE_ETH_FEC_MODE_CAPA_MASK(RS);

    num++;

}

if (pcaps->eee_cap & (ICE_AQC_PHY_EEE_EN_50GBASE_KR2|ICE_AQC_PHY_EEE_EN_50GBASE_KR_PAM4)) {

    speed_fec_capa[num].speed =3D RTE_ETH_SPEED_NUM_5= 0G;

    speed_fec_capa[num].capa =3D auto|nofec;

    if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)

        speed_fec_capa[num].capa |=3D RTE_ETH_FEC_MODE_CAPA_MASK(RS);

    num++;

}

if (pcaps->eee_cap & (ICE_AQC_PHY_EEE_EN_100GBASE_KR4|ICE_AQC_PHY_EEE_EN_100GBASE_KR2_PAM4= )) {

    speed_fec_capa[num].speed =3D RTE_ETH_SPEED_NUM_1= 00G;

    speed_fec_capa[num].capa =3D auto|nofec;

    if (pcaps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)

        speed_fec_capa[num].capa |=3D RTE_ETH_FEC_MODE_CAPA_MASK(RS);

    num++;

}

+
+static int
+ice_fec_get_capability(struct rte_eth_dev *dev, struct rte_eth_fec_capa *s=
peed_fec_capa,
+			   unsigned int num)
+{
+	struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private)=
;
+	struct ice_aqc_get_phy_caps_data *pcaps;
+	unsigned int capa_num;
+	int ret;
+
+	pcaps =3D (struct ice_aqc_get_phy_caps_data *)
+			ice_malloc(hw, sizeof(*pcaps));
+	if (!pcaps)
+		return ICE_ERR_NO_MEMORY;
wouldn't it be easier just to have this struct on the stack?
+
+	ret =3D ice_aq_get_phy_caps(hw->port_info, false, ICE_AQC_REPORT_TOPO_=
CAP_MEDIA,
+				  pcaps, NULL);
+	if (ret)
should be (ret !=3D ICE_SUCCESS) since this function returns enum ice_status
+		goto done;
+
+	/* first time to get capa_num */
+	capa_num =3D ice_fec_get_capa_num(pcaps, NULL);
+	if (!speed_fec_capa || num < capa_num) {
+		ret =3D capa_num;
+		goto done;
+	}
+
+	ret =3D ice_fec_get_capa_num(pcaps, speed_fec_capa);
+
+done:
+	ice_free(hw, pcaps);
+	return ret;
+}
+
+static int
+ice_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa)
+{
+	struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private)=
;
+	struct ice_port_info *pi =3D hw->port_info;
+	u32 temp_fec_capa =3D 0;
+	int ret =3D 0;
+
+	if (!pi)
+		return -ENOTSUP;
+
+	/* Get current FEC mode from port info */
+	switch (pi->phy.curr_user_fec_req) {
+	case ICE_FEC_NONE:
+		temp_fec_capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC);
+		break;
+	case ICE_FEC_AUTO:
+	case ICE_FEC_DIS_AUTO:
+		temp_fec_capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(AUTO);
+		break;
+	case ICE_FEC_BASER:
+		temp_fec_capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(BASER);
+		break;
+	case ICE_FEC_RS:
+		temp_fec_capa =3D RTE_ETH_FEC_MODE_CAPA_MASK(RS);
+		break;
+	default:
+		ret =3D -ENOTSUP;
+		break;
+	}
+
+	*fec_capa =3D temp_fec_capa;
+	return ret;
+}

This= function needs to be rewritten to meet API requirements: "Ge= t current Forward Error Correction(FEC) mode. If link is down and AUTO is e= nabled, AUTO is returned, otherwise, configured FEC mode is returned. If li= nk is up, current FEC mode is returned."

So, if link is down - return AUTO or bitmask wi= th supported capabilities (from ice_aqc_get_phy_caps_data)

If link is up - use your logic with switch (pi-= >phy.curr_user_fec_req) {} (but without case ICE_FEC_AUTO/ICE_FEC_DIS_AU= TO, because we need to return current mode)

Also, check plz that curr_user_fec_req has relevant data. As I can see it is not updated anywhere in the code, since ice_cache_phy_user_req() is called only with ICE_FC_MODE. So probably you need to use corresponding AQ command to retrieve current fec mode from the HW.

Or it is probably better to read directly content of the "Table 3-40. Get Link Status Command Response Data Structure" instead o= f cached "pi->phy.curr_user_fec_req&= quot;

+
+static int
+ice_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa)
+{
+	struct ice_hw *hw =3D ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private)=
;
+	struct ice_port_info *pi =3D hw->port_info;
+	struct ice_aqc_set_phy_cfg_data config =3D { 0 };
+	enum ice_fec_mode req_fec;
+	int ret =3D 0;
+
+	if (!pi)
+		return -ENOTSUP;
+
+	switch (fec_capa) {
+	case RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC):
+		req_fec =3D ICE_FEC_NONE;
+		break;
+	case RTE_ETH_FEC_MODE_CAPA_MASK(AUTO):
+		if (ice_fw_supports_fec_dis_auto(hw))
+			req_fec =3D ICE_FEC_DIS_AUTO;
I'm not sure why it is here, could you clarify plz? Shouldn't ICE_FEC_DIS_AUTO be specified if RTE_ETH_FEC_MODE_CAPA_MASK(AUTO)?
+		else
+			req_fec =3D ICE_FEC_AUTO;
+		break;
+	case RTE_ETH_FEC_MODE_CAPA_MASK(BASER):
+		req_fec =3D ICE_FEC_BASER;
+		break;
+	case RTE_ETH_FEC_MODE_CAPA_MASK(RS):
+		req_fec =3D ICE_FEC_RS;
+		break;
+	default:
+		PMD_DRV_LOG(ERR, "Unsupported FEC mode: %d\n", fec_capa);
+		return -EINVAL;
+	}
+
+	/* Proceed only if requesting different FEC mode */
+	if (pi->phy.curr_user_fec_req =3D=3D req_fec)
+		return 0;
+
+	/* Copy the current user PHY configuration. The current user PHY
+	 * configuration is initialized during probe from PHY capabilities
+	 * software mode, and updated on set PHY configuration.
+	 */
+	memcpy(&config, &pi->phy.curr_user_phy_cfg, sizeof(config));
+
+	ret =3D ice_cfg_phy_fec(pi, &config, req_fec);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Failed to set FEC mode");
+		return -EINVAL;
+	}
+
+	config.caps |=3D ICE_AQ_PHY_ENA_AUTO_LINK_UPDT;
+
+	if (ice_aq_set_phy_cfg(pi->hw, pi, &config, NULL))
+		return -EAGAIN;
+
+	/* Save requested FEC config */
+	pi->phy.curr_user_fec_req =3D req_fec;
+
+	return 0;
+}

From API documentation: "fec_capa    A bitmask o= f allowed FEC modes. If AUTO bit is set, other bits specify FEC modes which may be negotiated. If AUTO bit is clear, specify FEC modes to be used (only one valid mode per speed may be set)."

I think logic of this function should be rewritten to meet API requirements.

The goal of this function to set proper PHY config (see Table 3-28. Set PHY Config Command Data Structure), particularily:

Auto FEC Enable bit (if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(AUTO)))

and Link FEC Options bits.

I'm not sure if current implementation of ice_cfg_phy_fec() fits perfectly here since it doesn't allow you to have different FEC modes (RS and BASER at the same time)

+
 static int
 ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	      struct rte_pci_device *pci_dev)
--=20
Regards,
Vladimir
--------------0Fx9PUCTgckORFtSnnIh0IUm--