Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Vadim Fedorenko
Sat, 28 Nov 2026 13:26
Re: [PATCH net-next v6 4/6] ionic: map the FEC type through a helper in ionic_get_fecparam()
Author: 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>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads