Article View: linux.kernel.netdev
Article #23873Re: [PATCH net-next v6 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam()
From: Vadim Fedorenko
Date: Sat, 28 Nov 2026 13:26
Date: Sat, 28 Nov 2026 13:26
82 lines
11260 bytes
11260 bytes
On 25/11/2026 23:22, Brett Creeley wrote:
> From: "Nikhil P. Rao" <nikhil.rao@amd.com>
>
> ionic_get_fecparam() maps config.fec_type onto the ethtool FEC values
> with a switch that assigns both fec->active_fec and fec->fec in each
> arm. A later patch gives the two fields distinct sources, which would
> mean duplicating the switch.
>
> Move the mapping into ionic_fec_type_to_ethtool() and call it once per
> field. Read config.fec_type once, as the switch did, so the two fields
> cannot be filled from different values while firmware rewrites
> port_info.
>
> No functional change.
>
> Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com>
> Signed-off-by: Eric Joyner <eric.joyner@amd.com>
> Signed-off-by: Brett Creeley <brett.creeley@amd.com>
> ---
> .../net/ethernet/pensando/ionic/ionic_ethtool.c | 36 +++++++++++++---------
> 1 file changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index e7262a842eda..312cd3e5e404 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -424,25 +424,33 @@ static int ionic_set_pauseparam(struct net_device *netdev,
> return 0;
> }
>
> -static int ionic_get_fecparam(struct net_device *netdev,
> - struct ethtool_fecparam *fec)
> +static u32 ionic_fec_type_to_ethtool(u8 fec_type)
> {
> - struct ionic_lif *lif = netdev_priv(netdev);
> -
> - switch (lif->ionic->idev.port_info->config.fec_type) {
> + switch (fec_type) {
> case IONIC_PORT_FEC_TYPE_NONE:
> - fec->active_fec = ETHTOOL_FEC_OFF;
> - fec->fec = ETHTOOL_FEC_OFF;
> - break;
> + return ETHTOOL_FEC_OFF;
> case IONIC_PORT_FEC_TYPE_RS:
> - fec->active_fec = ETHTOOL_FEC_RS;
> - fec->fec = ETHTOOL_FEC_RS;
> - break;
> + return ETHTOOL_FEC_RS;
> case IONIC_PORT_FEC_TYPE_FC:
> - fec->active_fec = ETHTOOL_FEC_BASER;
> - fec->fec = ETHTOOL_FEC_BASER;
> - break;
> + return ETHTOOL_FEC_BASER;
> + default:
> + return 0;
> }
> +}
this added helper can also be used in ionic_get_link_ksettings().
no need to respin for this change, but just a possible follow-up
> +
> +static int ionic_get_fecparam(struct net_device *netdev,
> + struct ethtool_fecparam *fec)
> +{
> + struct ionic_port_info *port_info;
> + struct ionic_lif *lif;
> + u8 config_fec_type;
> +
> + lif = netdev_priv(netdev);
> + port_info = lif->ionic->idev.port_info;
> + config_fec_type = port_info->config.fec_type;
> +
> + fec->active_fec = ionic_fec_type_to_ethtool(config_fec_type);
> + fec->fec = ionic_fec_type_to_ethtool(config_fec_type);
>
> return 0;
> }
>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Technical Details
Message-ID:
<6c1ae0e9-f03b-47d6-b8c7-0e4b2ba225f9@linux.dev>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373129-linux-kernel-netdev=dewy.ruReferences:
<20261125-ionic-get-fec-stats-v6-0-1ab49c729c00@amd.com> <20261125-ionic-get-fec-stats-v6-4-1ab49c729c00@amd.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373129-linux-kernel-netdev=dewy.ru From: vadim.fedorenko@linux.dev (Vadim Fedorenko) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v6 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam() Date: Sat, 28 Nov 2026 13:26:35 +0000 Organization: Usenet Network Message-ID: <6c1ae0e9-f03b-47d6-b8c7-0e4b2ba225f9@linux.dev> References: <20261125-ionic-get-fec-stats-v6-0-1ab49c729c00@amd.com> <20261125-ionic-get-fec-stats-v6-4-1ab49c729c00@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="954900"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Qx7hB4nozKvuRnW0PPYLO0xZSwo= sha256:LXMWh5341gfOuHRSr8h9vi+bAGpiuybpFsOEV/r50VY= sha1:i7FIV5E57zj4tIgECJ76B1eevpg= sha256:vTuo5Gjc9K2cRSWpg5S3T5IJ7nOHY9ci1BhPrktv+VA= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2B301125F7D; Sat, 28 Nov 2026 16:26:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZTyBGCE7WcF7; Sat, 28 Nov 2026 16:26:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373129-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id CB6B8125F76; Sat, 28 Nov 2026 16:26:43 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id D5CF32CE9C; Sat, 28 Nov 2026 13:26:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795872399; b=r2TVyOfUwoXfnFZfWFb/4tgTBjSD+7qS44EW+b5Z2qaBDI2suonuMpws2Kt8PP1GAZXv Wng95zP/h3G+utpngKOogqm/ojdmo8InAxAA9k5R3jl4RiTZVH/odmoGV1MwGTmICgL/6 StCtahD/Xf7wCtCrGS20uj94yzPMDnuwiMv4LRdf7v4v2vuOsrhLpYN+kAoakS8LkCjk6 rJZkaLKHMO2kW6JpSWtAjgoJdJolKK1yaVxx8UEx3QLs4KePIzHVzATaFd+QeLIH+pJ4u YUcnvbpABAlkbpPFJPVgAIT3DzyYseSIpc2piUI5XIxErgtmm7JsDJ/5HovsyXilNQA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795872399; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=Dh4Oh9I1GeCcuTAFQ3ynNlMPqbFNWdkkU/SHOgGCAqk=; b=LJdCN6AyrtNMsaZXqU46w8qJNCwDFLK6LDBXjm4c8O4OUlZtG5BIiqPpss0zqsAmtCCk NEs2lNaTWky+N0AJFJWOCqZC40JlnvD6oC4hoKRaUDh6DPbiCmv8upLKj1n9tm8FPZu9s TsGZavIxQL8rR28fjjSyb+vQR+jVCp+dZPdGdQD6k6fS4ey1avfA6ZkrVaZfQvGCs77oE nDa+Gq0WmEcNfjxD98ENnYnDK1KDAr5eJJ0zWGJ4/yUHrjLQPx5Sm/qwJggHdvngblEuY TixByPGoeKMf5P/s8BVz2rn3dI/NNBzl6j/oZ6L33AmYArLvdRxhInzIg8ts3ZVub6A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=IpbRbOii; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9928D606A326; Sat, 28 Nov 2026 13:26:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=IpbRbOii X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.131 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795872398; b=r6JhdsOTMmYVGn0KkFfUkhoQQXM0oDlUK6HbAAmWGqQk2Z5QfOKvNm837HI7HfDM6YUq rW8JpVjxGBqDVolfa8GQzezhUkVtf0CbmfkInXCCuVZNmRfBWrTdywaSeGWBdmq5OcN8Y 6E8dJNC6wCTy9iflTL/SEgTEZ/tVTozj4i+4fJ6FBfUvowKw5JKpbIDPYZfDMG5RfuM1+ XyldVMrTQfXnQXRSt+ut3QKoOBQAeC+dLEEWjArCRE+vPAK/MIPbytMecGfaiqqMzzpW1 K/Q3GtRuKxPA2BWTk5ttMKylaSzwKJzuDW+1nDEEaqZfLFrfQBVjG4HC1JkFf7eG33w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795872398; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=Dh4Oh9I1GeCcuTAFQ3ynNlMPqbFNWdkkU/SHOgGCAqk=; b=GUy1joDG8lJo150Uj+mm+wwCpzqFhkC+O3h2ctBOA/8DLeSVhoUfkaErEYkI00y8BYVN 3J/PjvwX3vwvDM5dPIBq9r1d1GI0T8mYLCkACD70uFpVDvcekpwL1XQA18nxeQuGeChWa zhClzSkoOrOJpQ3pVmqnh9LmqNAxAev7/X66DRBQ6zFuVFBMaXkne44pB8b3HomgHUFVO 6E49zkwpjaRVGI0oWeOE0RZ8t9E5dQfYcjT0HbtXM9WiYThyuk/ACS+IiJ8Hiqbos+a5D k5Ag/dXxkv+vdY+G3yXlENcdT6H8be3QT/ed5K1bsb8ECXx2Q/fIQdkmLh/8sXDtHLA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=IpbRbOii; arc=none smtp.remote-ip=91.218.175.131 X-Received: from mta0.migadu.com (out-131.mta0.migadu.com [91.218.175.131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F24FE606A31C for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 13:26:37 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F24FE606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=mc5C+pGlBFnh+zZ+ikb3wESdpy7oMs7TbURUAq1Tc7U=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795872396; v=1; x=1796477196; b=IpbRbOiiRwWb+rBmhbZqT709ehnGe9IrHuz4Mww1n+2Kk+NgZr1lt0MyO0b6yvIo5IIGnexD bz1emOiWmzSa0yEk54MB4TvdjlL13EqfLtxJezTzXwSwVOlOWAhT0BfPUKoxY78offGl1b8FTlE sUAO18q+dq3ZZkbqQZNfD5IE= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id af03c646e90530e6; Sat, 28 Nov 2026 13:26:35 +0000 X-Mizu-Trace-ID: af03c646e90530e6 X-Migadu-Flow: FLOW_OUT X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird X-Cc: netdev@vger.kernel.org, Simon Horman <horms@kernel.org>, "Nikhil P. Rao" <nikhil.rao@amd.com>, Eric Joyner <eric.joyner@amd.com>, Breno Leitao <leitao@debian.org>, Arun Kumar Prakash <ArunKumar.Prakash@amd.com> X-In-Reply-To: <20261125-ionic-get-fec-stats-v6-4-1ab49c729c00@amd.com>