Netdev List
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Eric Joyner <eric.joyner@amd.com>, netdev@vger.kernel.org
Cc: Brett Creeley <brett.creeley@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	"Nikhil P. Rao" <nikhil.rao@amd.com>,
	Eric Dumazet <edumazet@kernel.org>
Subject: Re: [PATCH net-next v7 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam()
Date: Wed, 2 Dec 2026 13:49:33 +0000	[thread overview]
Message-ID: <507a89c7-7976-4bd2-90ce-80970ad7fca6@linux.dev> (raw)
In-Reply-To: <20261130-ionic-get-fec-stats-v7-4-730c1672f561@amd.com>

On 01/12/2026 06:48, Eric Joyner 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    | 38 +++++++++++++---------
>   1 file changed, 23 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> index 0627e4e171a8..9f0af298c8db 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
> @@ -424,28 +424,36 @@ 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;
>   	}
> +}
> +
> +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;
>   
> -	if (lif->ionic->idev.port_info->config.an_enable)
> +	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);
> +	if (port_info->config.an_enable)
>   		fec->fec = ETHTOOL_FEC_AUTO;
> +	else
> +		fec->fec = ionic_fec_type_to_ethtool(config_fec_type);
>   
>   	return 0;
>   }
> 

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2026-12-02 13:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  6:48 [PATCH net-next v7 0/6] ionic: FEC reporting fixes and .get_fec_stats handler Eric Joyner
2026-12-01  6:48 ` [PATCH net-next v7 1/6] ionic: access the extra_stats counters one at a time Eric Joyner
2026-12-01  6:48 ` [PATCH net-next v7 2/6] ionic: report FEC off as a supported link mode Eric Joyner
2026-12-01  6:48 ` [PATCH net-next v7 3/6] ionic: report the configured FEC mode in ethtool_fecparam.fec Eric Joyner
2026-12-02 13:45   ` Vadim Fedorenko
2026-12-01  6:48 ` [PATCH net-next v7 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam() Eric Joyner
2026-12-02 13:49   ` Vadim Fedorenko [this message]
2026-12-01  6:48 ` [PATCH net-next v7 5/6] ionic: report the operational FEC mode from ethtool --show-fec Eric Joyner
2026-12-01  6:48 ` [PATCH net-next v7 6/6] ionic: Add .get_fec_stats ethtool handler Eric Joyner
2026-12-01  6:54 ` [PATCH net-next v7 0/6] ionic: FEC reporting fixes and .get_fec_stats handler netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=507a89c7-7976-4bd2-90ce-80970ad7fca6@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=brett.creeley@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eric.joyner@amd.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikhil.rao@amd.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox