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 335EF43CB6; Thu, 14 Mar 2024 22:41:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4CF04029B; Thu, 14 Mar 2024 22:41:49 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by mails.dpdk.org (Postfix) with ESMTP id E73DB40144 for ; Thu, 14 Mar 2024 22:41:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710452508; x=1741988508; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=5uTRAJjF7pxQAqMvbGIKAeTZTtPv3EZibJTrAUO42d0=; b=RxVW2yVZ/yiyO3ONOUa+DObsJFhN+RN+xlaVadWAXBli+sOXpYIfwx6p mimm41ZOaIyEMCIXG3TUa8ztswSjeIr/TddGdf9iUF6B21jpaYygDEgAv LDaOknjbpjApd9DK6IeL2qnDe+jPl5ozyKv164BgUTAeF8zPj3uUmd5jE p76HIhKgZbtUOkkrg7+xdt3j0+9qSzmW+AuucMkYb8fPzcyFcYR6ZcEXs qO0qfgjafSnwRiHwbhm/IvlygCyiOcIxRafrZWArU2A0F20xLZmEZv/9Z dmgQZ6G5BS7k5EH44QYO8CbYsnzj59rHLKU67RAPv+zwLpM5rFWzgsNH5 w==; X-IronPort-AV: E=McAfee;i="6600,9927,11013"; a="30739525" X-IronPort-AV: E=Sophos;i="6.07,126,1708416000"; d="scan'208";a="30739525" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 14:41:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,126,1708416000"; d="scan'208";a="43344948" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 14 Mar 2024 14:41:46 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 14 Mar 2024 14:41:45 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 14 Mar 2024 14:41:45 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 14 Mar 2024 14:41:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FjrRKG7uSLdaddPqAc0O9jx8Uvbp/gxaM2SBm9a4iAqwChA6WOKYQG/HainPzplVXdpeaUOYmCdNQldt4DmvK5j1h1CMKNGjg9CnaHB6UbPlmJ1Uyo/NmF2etQkH2w7Hqmx5g9bVNWGrWMROpLMXlmhdCckFenkAfmXTXJwBIF+2269Of/TD0xxSHp603dM8282UwcFFz8q0m1S679u3UhBzR6Ss9dMhw5TDi0n144sh/TVqjPuMtLBAW5Wwklh8zb1ZMcMPBVtI15GQYW4ru8EDHDW7x3I9/U7ohZwDA6Q7YyX0Ktxxus/wh+nsqchdM3QiUvZI5PB0q37cGL9s9w== 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=lxLZORqba1lZFsa0KLcyfzqk0TMKOe8b8eBskl7aPCc=; b=c0ddJpA+dn18++FtZYYgyeqAHMJn3ZTZGMMar8ZMycG9p13YsWDnPpJMmwoHJrtHZyexxgwDmrE7ytUnNbA1jnTDZiGT0Xk4zTHhpjf+5fhNzK4tGOxnBgM0GlVoT++rNdDQ1Mta4gR924+iIiz/ID8CRNjwgF2rkTiM1b49O5jQ3tpztDCfV3DrEEKaGAHA1W5pf2SlKXEmPhe9DiUXHG48W7w9gPBdSyz7R7BlSuzWvQCnowvizITgkheRlXbcrn/+ZPJt6bMrek30FL1eBzjjMkY2VgJzO8ni+wVqSE/US9plxQlgu4f3BPiIqtLax55ZfCk8EjUxtNAAXHaDAw== 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 DS0PR11MB6493.namprd11.prod.outlook.com (2603:10b6:8:c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.17; Thu, 14 Mar 2024 21:41:43 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5344:9a0c:2f3d:98c8]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::5344:9a0c:2f3d:98c8%5]) with mapi id 15.20.7386.017; Thu, 14 Mar 2024 21:41:42 +0000 Message-ID: <701bc7bc-3b40-4a3f-bc7a-2ab02b6cc399@intel.com> Date: Thu, 14 Mar 2024 21:41:37 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] net/i40e: support FEC feature Content-Language: en-US To: "Zeng, ZhichaoX" , "dev@dpdk.org" CC: "Cui, KaixinX" , "Xu, HailinX" References: <20231220084706.446508-1-qiming.yang@intel.com> <20240306104135.2805774-1-zhichaox.zeng@intel.com> From: "Medvedkin, Vladimir" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DU2P250CA0021.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:231::26) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5772:EE_|DS0PR11MB6493:EE_ X-MS-Office365-Filtering-Correlation-Id: a6e5ca7b-8925-4441-8e12-08dc446f89a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z1+sY5mxyN1WDiAMUPbkb+tKEvKYNnUVqZJxAJdXVWUvU8vnBdo+OKBaZ1MGLK/j+yLCkhRXcYRrjbPbMDM0So8Up/gtw7Xx5lcTLCmTJh8LVqO3Ujuu3Jr2LB/7hSq/YKcWPlXQSwQipcIAliBcQqFNDbFPMe58Z6O1pe75Z+wOjT+KbRfP++VWs7QU44sWUxdsRb7upO1w3sRHm4uXcDtJctbFjahjdITTUqTQkKmdsqXB5QUsiWMK81q5GU3+DQCOLIxaSjqS4I5Eds32vxPr5Sol/a8sYZqhql3xhy8l1lj/kE8xoxenvDbsa36I/0yEwkApfNEf4hm5UXmBgRl1EEA+y1YdC4Oz9w9OO5PxpNuvHXxIz427h4xNh4r28ByPUQZ3edw6Y9cco8+eWFPoOXXVFdpbojHV8VzS1dWoShnnWhXJcMej65siofXhLGkacFW9HkH0QBEV4vEm9TlOUE97uksBvvH0aBXETlpIb0adIdg93dbj4vpssopSErocpxYgG95cxVFsrvA0QUUd/TDWQtVjSsYKXh3MDWZbl0hmfjlUowgzu5vqUI2QBKlYDuE4EMf8odx9EOM1GwiXRQ5KsJWrBZQZ/9jFhTKmfihkkgiA1YnVyys0REOI 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:(13230031)(376005)(1800799015); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ejM5ckpremlORkhVRWc1WU9kZFVqZHFUckMrUjNxVGJkOHQvczQxWGUvU2t0?= =?utf-8?B?QzM2YmUrZEZFZmx4b01Mc2MzbEFxZ2l0enNQVGNUTmppZEk5YkdsWWI3eFlP?= =?utf-8?B?K1NFbE1TcWxCTWIzWGIzODVqandhOGFlak56b0J6SzVzWHlYeG5EdXFDek5N?= =?utf-8?B?aXNmVk9RQ1B2Und2aE1DK0JLa3NiTXlOQVV5TjZPMWRIanJQZ0orRGp3QU0x?= =?utf-8?B?SHBTdm42akhZZHZpZXcxcXpnMHR2YzBTcUttd0h4V0NtSGhkVmhVZmh1UHVn?= =?utf-8?B?aE05R2NYY1IrdEdrZHlhVkdIMjRPc1pRMFFOR2k4VTh5aUZETWR4NG9Ec2p4?= =?utf-8?B?UCs5c2pIVnUrWEVKcGd0ZEVKTkpzNjdNbk5lenZ3RW5zWk5tY1BMZFlMV2d5?= =?utf-8?B?UGhZVWlwbFFMV3g0Um5VcnVVWkdoVi82Q3d2eSt6SzlXanpNQVdReTdCaTdM?= =?utf-8?B?SndIelJ1dDR3MjVoeWJXSGs3N2hJWFBTenB0V3gxTGRtdFlGTzJjTGtSdjFO?= =?utf-8?B?Zkh4RzB3ZDl6aDErcXhlTnNRRkRwT0t3K2tOR2JoRTh6cUJzM0RwOEFQZFda?= =?utf-8?B?SzhQNklsckN6WkxVZmZ3L1QwT0hFRzcwUXZwTjhMc3FxS3JMTXRyUzd2cDFZ?= =?utf-8?B?emNqOWJ4M1lPOStFUFMyb3BDeGMwaFdYZTZmd3VITk9oRTJSdSt2RzZZRDh2?= =?utf-8?B?eWs2eWdUdG5BTklBa1p6UHBRUHNDeTBkZnpoeS9lZDh2M1o3Wk9VUVUvZTcx?= =?utf-8?B?a2t2QVk4V2o2MUNtY1RlMTk4TWhLQ2ozOEpQQVZmc1c2Y3ZWWXE2WERSUWQ2?= =?utf-8?B?c2hLV0FwL0dITmdsblZiUldIc29kVWRCUkVWV3hIK2YraHBhdTlPeHVCYnls?= =?utf-8?B?THI1ODV5Z3hWMWJ1aHZUbHoxRHF0YkdabVJVL2ZicW9RbzFZMU02NWJObWo3?= =?utf-8?B?YVVoMTJTeTBLY0l2bXlXOXJvMjg5VmY5c3JSLzZsamE3SGErdFBwbzFYdm1s?= =?utf-8?B?RDdXZFp4QUZIeThjRkpwR0Y1ZnpHMUpSaVZPQ3NFTVk3eEZXRFIyNllLNHBa?= =?utf-8?B?bHB6ZjVQODg5VkNlUG1BRGVRTXFNMHFnQ25aeEYvaXdXVzhyc2hIejZQbDJE?= =?utf-8?B?R1dLVFNicncxL0tqOTVLS3hSblgzYjgxa0w4RTQxbGkrR2doSVNHWnZCdzM3?= =?utf-8?B?eFBNVXgwUWtVTzNoWnNJWXdPRzVZYjBGMzNESy9CVlZ2cGhlZTluQzBKdDNq?= =?utf-8?B?ZVc3dmdwV1BqQ1BKSlFLNnZTeTFYSkdGdmprOFZmNFBpYjZxTjJ2ZVRCSDJv?= =?utf-8?B?K0h2MjNiRTlRQTFxZFIwRVR5bm5lUEpkSExOWFY2cGlxYnp5aElGY3huSy9G?= =?utf-8?B?SFRGeUtLUGhFMWRIWW55aS94eVdLOUpNZ2ZWQ0ppSW1USUJlck16SlkvZWRQ?= =?utf-8?B?SkxlUDZ5a2owRFB6aVpHY2RtZjBpQzhkQ1VOSWE1T3Y2WUdKcmdaaTIrY2tP?= =?utf-8?B?ZnY2WnNGN0lXekVGOVFnNFhhUjQ1WU1EMjBUWDIydnVGWXlob0xVcnF6dDRz?= =?utf-8?B?Q2xzaC8rM0NQSWJPVmZlQnVqOU9YRlAvWTV2MHMyYjRJeUo2Z1Bla3g5UDN3?= =?utf-8?B?S0pqWUYzWHZ0cjExOFdWQjVMNi9QMjNFYVZYYWtJZ0g3SVF0Z1FrZ1d5eHZs?= =?utf-8?B?OHBzdEtJZkI4V2pOUjQyTjVLb1RaYmpLczRKdVIzaklXNHlZVnR2UFJIRVh5?= =?utf-8?B?d3NZZ0hoMWtEemZQVEN6b01xMFdob2NXeDNsaS9pZXVzRzdCNDU0K2JQSGVN?= =?utf-8?B?SFVQWitvZ2FmNnpTR29BV3VZVHErWjZtWnIvOFVNRkc5cm0xZGF0OFdpc1Na?= =?utf-8?B?bWd4ZUw4MnI4dnpVY1ZyUUZiaXVmZjNFV1N4ci9IdEpMSDNzUTFFU0p5aUpR?= =?utf-8?B?d25BK2dDNmVpSlpEUXZUNVpMc1BtUVcrZHV1RlhsRkpkdjhhSkhXSWk0WmJF?= =?utf-8?B?VG9takwyUUlRMWEzWWRRbTA5bk95NFJFcDdpZ0FneDhwckxsd05DM0xFTlpk?= =?utf-8?B?V3E2ZDJXc1N0T3VEUmtGVFJCZ0pxZjRGZktRL0Qwa21zZW0zdldGNDNYSFZn?= =?utf-8?B?bUd4a09FM0ZqR1RucERDTVZkTmJWMldjT2xaZlF2ZzJrWVQrck13eWNwRDZi?= =?utf-8?B?dEE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: a6e5ca7b-8925-4441-8e12-08dc446f89a3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2024 21:41:42.3445 (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: pf/jCQVFj8dSO6EIvAj1eGIhFJRG9m0ZJC3SVpowFLugSY6y4vuK9CbklteEjZyd8CsoNE1o6ui6SUsu7R2LkeHvajoaFJ3annMq+/t9uH4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6493 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 Hi Zhichao, On 12/03/2024 08:44, Zeng, ZhichaoX wrote: > Hi Vladimir: > > Thanks for your comments, some responses and questions are inline. > >> From: Medvedkin, Vladimir >> Sent: Monday, March 11, 2024 11:59 PM >> To: Zeng, ZhichaoX ; dev@dpdk.org >> Cc: Cui, KaixinX ; Yang, Qiming ; Zhang, Yuying >> Subject: Re: [PATCH v4] net/i40e: support FEC feature >> >> Hi Zhicha, >> It would be good to reflect FEC feature here: >> https://doc.dpdk.org/guides/nics/overview.html >> in " Table 1.1 Features availability in networking drivers " > After modifying "doc/guides/nics/features/i40e.ini", the corresponding "overview.html" will be generated after compiling the document. Ah sure, my bad, thanks! >> please find the rest comments inline >> On 06/03/2024 10:41, Zhichao Zeng wrote: >> This patch enabled querying Forward Error Correction(FEC) capabilities, >> set FEC mode and get current FEC mode functions. >> >> Signed-off-by: Qiming Yang mailto:qiming.yang@intel.com >> Signed-off-by: Zhichao Zeng mailto:zhichaox.zeng@intel.com >> >> --- >> v4: fix some logic >> v3: optimize code details >> v2: update NIC feature document >> --- >> doc/guides/nics/features/i40e.ini | 1 + >> doc/guides/rel_notes/release_24_03.rst | 5 + >> drivers/net/i40e/i40e_ethdev.c | 192 +++++++++++++++++++++++++ >> 3 files changed, 198 insertions(+) >> >> diff --git a/doc/guides/nics/features/i40e.ini b/doc/guides/nics/features/i40e.ini >> index e241dad047..aac2c1a6a1 100644 >> --- a/doc/guides/nics/features/i40e.ini >> +++ b/doc/guides/nics/features/i40e.ini >> @@ -30,6 +30,7 @@ Flow control = Y >> CRC offload = Y >> VLAN offload = Y >> QinQ offload = P >> +FEC = Y >> L3 checksum offload = P >> L4 checksum offload = P >> Inner L3 checksum = P >> diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst >> index 161f77112b..862a5f8fb8 100644 >> --- a/doc/guides/rel_notes/release_24_03.rst >> +++ b/doc/guides/rel_notes/release_24_03.rst >> @@ -110,6 +110,11 @@ New Features >> >> * Added support for 5760X device family. >> >> +* **Updated Intel i40e driver.** >> + >> + * Added support for configuring the Forward Error Correction(FEC) mode, querying >> + * FEC capabilities and current FEC mode from a device. >> + >> * **Updated Marvell cnxk net driver.** >> >> * Added support for port representors. >> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c >> index 380ce1a720..2bc6675a04 100644 >> --- a/drivers/net/i40e/i40e_ethdev.c >> +++ b/drivers/net/i40e/i40e_ethdev.c >> @@ -406,6 +406,10 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf); >> static void i40e_tunnel_filter_restore(struct i40e_pf *pf); >> static void i40e_filter_restore(struct i40e_pf *pf); >> static void i40e_notify_all_vfs_link_status(struct rte_eth_dev *dev); >> +static int i40e_fec_get_capability(struct rte_eth_dev *dev, >> + struct rte_eth_fec_capa *speed_fec_capa, unsigned int num); >> +static int i40e_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa); >> +static int i40e_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa); >> >> static const char *const valid_keys[] = { >> ETH_I40E_FLOATING_VEB_ARG, >> @@ -521,6 +525,9 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { >> .tm_ops_get = i40e_tm_ops_get, >> .tx_done_cleanup = i40e_tx_done_cleanup, >> .get_monitor_addr = i40e_get_monitor_addr, >> + .fec_get_capability = i40e_fec_get_capability, >> + .fec_get = i40e_fec_get, >> + .fec_set = i40e_fec_set, >> }; >> >> /* store statistics names and its offset in stats structure */ >> @@ -12297,6 +12304,191 @@ i40e_cloud_filter_qinq_create(struct i40e_pf *pf) >> return ret; >> } >> >> +static int >> +i40e_fec_get_capability(struct rte_eth_dev *dev, >> + struct rte_eth_fec_capa *speed_fec_capa, __rte_unused unsigned int num) >> +{ >> + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); >> + >> + if (hw->mac.type == I40E_MAC_X722 && >> + !(hw->flags & I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE)) { >> + PMD_DRV_LOG(ERR, "Setting FEC encoding not supported by" >> + " firmware. Please update the NVM image.\n"); >> + return -ENOTSUP; >> + } >> + >> + if (hw->device_id == I40E_DEV_ID_25G_SFP28 || >> + hw->device_id == I40E_DEV_ID_25G_B) { >> + if (speed_fec_capa) { >> + speed_fec_capa->speed = RTE_ETH_SPEED_NUM_25G; >> + speed_fec_capa->capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC) | >> + RTE_ETH_FEC_MODE_CAPA_MASK(BASER) | >> + RTE_ETH_FEC_MODE_CAPA_MASK(AUTO) | >> + RTE_ETH_FEC_MODE_CAPA_MASK(RS); >> + } >> + >> + /* since HW only supports 25G */ >> + return 1; >> + } else if (hw->device_id == I40E_DEV_ID_KX_X722) { >> + if (speed_fec_capa) { >> + speed_fec_capa->speed = RTE_ETH_SPEED_NUM_25G; >> + speed_fec_capa->capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO) | >> + RTE_ETH_FEC_MODE_CAPA_MASK(RS); >> + } >> + return 1; >> + } >> + >> + return -ENOTSUP; >> +} >> + >> +static int >> +i40e_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa) >> +{ >> + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); >> + struct i40e_link_status link_status = {0}; >> + uint8_t configured_fec_cfg = 0, current_fec_cfg; >> + uint32_t temp_fec_capa = 0; >> + bool link_up, enable_lse; >> + int ret = 0; >> + >> + enable_lse = dev->data->dev_conf.intr_conf.lsc ? true : false; >> + /* Get FEC info */ >> + ret = i40e_aq_get_link_info(hw, enable_lse, &link_status, NULL); >> + if (ret != I40E_SUCCESS) { >> + PMD_DRV_LOG(ERR, "Failed to get link information"); >> + return -ENOTSUP; >> + } >> + >> + link_up = link_status.link_info & I40E_AQ_LINK_UP; >> + >> + /** >> + * 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. >> + */ >> + configured_fec_cfg = link_status.req_fec_info; >> here we need to better understand the difference between [FC,RS]-FEC ability bit (aka I40E_AQ_ENABLE_FEC_[KR,RS]) from [FC,RS]-FEC Request bit (aka I40E_AQ_REQUEST_FEC_[KR,RS]), since link_status.req_fec_info has only "Request" bits for each FEC algo (see i40e_update_link_info()). >> From what I found on the internet, it seems that we don't need to use them at all, because, for example for FC-FEC (aka Clause 74), from: >> https://www.ieee802.org/3/25GSG/public/Nov14/baden_25GE_02_1114.pdf >> Key phrase: "If both LPs advertise the FEC Ability, and EITHER LP requests the FEC, it is enabled." >> So I'd suggest not to use these "Request" bits here. >> For configured fec (case when link is DOWN) please use struct i40e_aq_get_phy_abilities_resp abilities. > Will fix in next version. > >> + current_fec_cfg = link_status.fec_info; >> + >> + if (!link_up) { >> This section should be rewritten according to bit flags from abilities.fec_cfg_curr_mod_ext_info. >> + if (current_fec_cfg & (I40E_AQ_ENABLE_FEC_KR | I40E_AQ_ENABLE_FEC_RS)) { >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); >> + } else { >> + if (configured_fec_cfg == (I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS)) >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); >> + else if (configured_fec_cfg & I40E_AQ_REQUEST_FEC_KR) >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(BASER); >> + else if (configured_fec_cfg & I40E_AQ_REQUEST_FEC_RS) >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(RS); >> + else >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); >> + } > Should current_fec_cfg (link_status.fec_info) be rewritten this way since it only has KR or RS bit and no AUTO bit? any suggestion please? > > if (configured_fec_cfg & I40E_AQ_ENABLE_FEC_AUTO) > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); > else if (configured_fec_cfg & I40E_AQ_ENABLE_FEC_KR) > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(BASER); > else if (configured_fec_cfg & I40E_AQ_ENABLE_FEC_RS) > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(RS); > else > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); Probably you confused "current_fec_cfg" with "configured_fec_cfg". Let's rename those variables, for example use current_fec_mode for "link_status.fec_info" which will be used in case when link is UP, and fec_config for "abilities.fec_cfg_curr_mod_ext_info" which will be used in case when link is DOWN. So, logic here should be like: if (link is UP) { /* check current_fec_mode */ if (popcnt(current_fec_mode) > 1)     return -EINVAL; switch (current_fec_mode) { case I40E_AQ_CONFIG_FEC_KR_ENA:     *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_BASER);     break; case I40E_AQ_CONFIG_FEC_RS_ENA:     *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_RS);     break; case 0:     *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_NOFEC);     break; default:     return -EINVAL; } return 0; } /*port is UP, check fec_config */ else { if (fec_config & I40E_AQ_ENABLE_FEC_AUTO ) {     *fec_capa = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_AUTO);     return 0; } uint32_t ret_fec = 0; if (fec_config & I40E_AQ_ENABLE_FEC_KR)     ret_fec |= RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_BASER); if (fec_config & I40E_AQ_ENABLE_FEC_RS)     ret_fec |= RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_RS); if (ret_fec == 0)     ret_fec = RTE_ETH_FEC_MODE_TO_CAPA(RTE_ETH_FEC_NOFEC); *fec_capa = ret_fec; return 0; } >> + } else { >> + if (current_fec_cfg & (I40E_AQ_ENABLE_FEC_KR | I40E_AQ_ENABLE_FEC_RS)) >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(AUTO); >> In case when FEC was successfully negotiated current_fec_cfg is containing only single bit (since 2 algos can not be enabled at the same time), so this part is meaningless. Also here and below in this else section (i.e. in section if link is UP), for consistency please use corresponding macros defined for struct i40e_aqc_get_link_status - I40E_AQ_CONFIG_FEC_KR_ENA and I40E_AQ_CONFIG_FEC_RS_ENA instead of I40E_AQ_ENABLE_FEC_ . >> + else if (current_fec_cfg & I40E_AQ_ENABLE_FEC_KR) >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(BASER); >> + else if (current_fec_cfg & I40E_AQ_ENABLE_FEC_RS) >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(RS); >> + else >> + temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); > Is there any issue with this change? > > if (current_fec_cfg & I40E_AQ_CONFIG_FEC_KR_ENA) > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(BASER); > else if (current_fec_cfg & I40E_AQ_CONFIG_FEC_RS_ENA) > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(RS); > else > temp_fec_capa = RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC); It should be fine if there is only one single bit in the current_fec_cfg. Please refer to my previous comment above. >> + } >> + >> + *fec_capa = temp_fec_capa; >> + >> + return 0; >> +} >> + >> +static int >> +i40e_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa) >> +{ >> + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); >> + struct i40e_aq_get_phy_abilities_resp abilities = {0}; >> + struct i40e_aq_set_phy_config config = {0}; >> + enum i40e_status_code status; >> + uint8_t req_fec = 0; >> + >> + if (hw->device_id != I40E_DEV_ID_25G_SFP28 && >> + hw->device_id != I40E_DEV_ID_25G_B && >> + hw->device_id != I40E_DEV_ID_KX_X722) { >> + return -ENOTSUP; >> + } >> + >> + if (hw->mac.type == I40E_MAC_X722 && >> + !(hw->flags & I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE)) { >> + PMD_DRV_LOG(ERR, "Setting FEC encoding not supported by" >> + " firmware. Please update the NVM image.\n"); >> + return -ENOTSUP; >> + } >> + >> + /** >> + * 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. >> + */ >> + if (fec_capa != 0) >> + return -EINVAL; >> Did you mean if (fec_capa == 0)? > Yes...sorry for mistake, will fix in next version. > >> + >> + if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(AUTO)) { >> + if (hw->mac.type == I40E_MAC_X722) { >> + PMD_DRV_LOG(ERR, "X722 Unsupported FEC mode: AUTO"); >> + return -EINVAL; >> + } >> + req_fec = I40E_AQ_SET_FEC_AUTO; >> + goto set_fec; >> + } >> + >> + if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC)) >> + req_fec = 0; >> + >> + if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(BASER)) >> + req_fec |= I40E_AQ_SET_FEC_REQUEST_KR; >> + >> + if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(RS)) { >> + if (hw->mac.type == I40E_MAC_X722) { >> + PMD_DRV_LOG(ERR, "X722 Unsupported FEC mode: RS"); >> + return -EINVAL; >> + } >> + req_fec |= I40E_AQ_SET_FEC_REQUEST_RS; >> + } >> This part is not looking correct to me: >> - only I40E_AQ_SET_FEC_AUTO bit is set w/o enabling specific protocols >> - "if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(NOFEC))" makes no sense if other bitfields are set >> - only I40E_AQ_SET_FEC_REQUEST_* is set without I40E_AQ_SET_FEC_ABILITY_* >> According to API : "If only the AUTO bit is set, the decision on which FEC mode to use will be made by HW/FW or driver. If the AUTO bit is set with some FEC modes, only specified FEC modes can be set. If AUTO bit is clear, specify FEC mode to be used (only one valid mode per speed may be set)." I'd suggest: >> - In case when AUTO bit is set we need to check for other bit flags. In case of absence let's decide to add all supported by mac type algorithms (i.e. set corresponding _enable_ and _request_ bit fields for each supported algo). >> - In case if there are more bits apart from AUTO - check for their validity and support and specify corresponding _enable_ and _request_ flags. >> - In case if AUTO is not set check that only single mode was specified, check its validity + support and so on. > Based on your suggestions, any other suggestion for the following rework? > > if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(AUTO)) > fec_auto = 1; > > if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(BASER)) > fec_kr = 1; > > if (fec_capa & RTE_ETH_FEC_MODE_CAPA_MASK(RS)) > fec_rs = 1; > > if (fec_auto) { > if (hw->mac.type == I40E_MAC_X722) { > PMD_DRV_LOG(ERR, "X722 Unsupported FEC mode: AUTO"); > return -EINVAL; > } > if (fec_kr ^ fec_rs) { did you mean OR instead of XOR? > if (fec_kr) > req_fec = I40E_AQ_SET_FEC_ABILITY_KR | > I40E_AQ_SET_FEC_REQUEST_KR; > else { here instead of else should be if (fec_rs)                                             req_fec |= ... > if (hw->mac.type == I40E_MAC_X722) { > PMD_DRV_LOG(ERR, "X722 Unsupported FEC mode: RS"); > return -EINVAL; > } > req_fec = I40E_AQ_SET_FEC_ABILITY_RS | > I40E_AQ_SET_FEC_REQUEST_RS; > } > } else { > if (hw->mac.type == I40E_MAC_X722) { > req_fec = I40E_AQ_SET_FEC_ABILITY_KR | > I40E_AQ_SET_FEC_REQUEST_KR; > } else { > req_fec = I40E_AQ_SET_FEC_ABILITY_KR | > I40E_AQ_SET_FEC_REQUEST_KR | > I40E_AQ_SET_FEC_ABILITY_RS | > I40E_AQ_SET_FEC_REQUEST_RS; > } > } > } else { > if (fec_kr ^ fec_rs) { > if (fec_kr) > req_fec = I40E_AQ_SET_FEC_ABILITY_KR | > I40E_AQ_SET_FEC_REQUEST_KR; > else { > if (hw->mac.type == I40E_MAC_X722) { > PMD_DRV_LOG(ERR, "X722 Unsupported FEC mode: RS"); > return -EINVAL; > } > req_fec = I40E_AQ_SET_FEC_ABILITY_RS | > I40E_AQ_SET_FEC_REQUEST_RS; > } > } else { > return -EINVAL; > } > } It's better to rewrite this section >> + >> +set_fec: >> + /* Get the current phy config */ >> + status = i40e_aq_get_phy_capabilities(hw, false, false, &abilities, >> + NULL); >> + if (status) { >> + PMD_DRV_LOG(ERR, "Failed to get PHY capabilities: %d\n", >> + status); >> + return -ENOTSUP; >> + } >> + >> + if (abilities.fec_cfg_curr_mod_ext_info != req_fec) { >> + config.phy_type = abilities.phy_type; >> + config.abilities = abilities.abilities | >> + I40E_AQ_PHY_ENABLE_ATOMIC_LINK; >> + config.phy_type_ext = abilities.phy_type_ext; >> + config.link_speed = abilities.link_speed; >> + config.eee_capability = abilities.eee_capability; >> + config.eeer = abilities.eeer_val; >> + config.low_power_ctrl = abilities.d3_lpan; >> + config.fec_config = req_fec & I40E_AQ_PHY_FEC_CONFIG_MASK; >> + status = i40e_aq_set_phy_config(hw, &config, NULL); >> + if (status) { >> + PMD_DRV_LOG(ERR, "Failed to set PHY capabilities: %d\n", >> + status); >> + return -ENOTSUP; >> + } >> + } >> + >> + status = i40e_update_link_info(hw); >> + if (status) { >> + PMD_DRV_LOG(ERR, "Failed to set PHY capabilities: %d\n", >> + status); >> + return -EAGAIN; >> This is a new return status of this API. It needs to be added in doxygen documentation for this function and be reflected in release notes > My bad, will fix in next version. > >> + } >> + >> + return 0; >> +} >> + >> RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE); >> RTE_LOG_REGISTER_SUFFIX(i40e_logtype_driver, driver, NOTICE); >> #ifdef RTE_ETHDEV_DEBUG_RX >> -- >> Regards, >> Vladimir >> > Regards, > Zhichao -- Regards, Vladimir