On 01/12/2026 06:48, Eric Joyner wrote:
> From: "Nikhil P. Rao" <nikh…@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 <nikh…@amd.com> > Signed-off-by: Eric Joyner <eric…@amd.com> > Signed-off-by: Brett Creeley <bret…@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 <vadi…@linux.dev>