From: "Nikhil P. Rao" 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. No functional change. Signed-off-by: Nikhil P. Rao Signed-off-by: Eric Joyner --- .../net/ethernet/pensando/ionic/ionic_ethtool.c | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c index a192302c5e19..c55148f3ae8f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c @@ -426,25 +426,31 @@ 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; + + lif = netdev_priv(netdev); + port_info = lif->ionic->idev.port_info; + + fec->active_fec = ionic_fec_type_to_ethtool(port_info->config.fec_type); + fec->fec = ionic_fec_type_to_ethtool(port_info->config.fec_type); return 0; } -- 2.53.0