On Tue, 19 Dec 2023 17:53:52 +0100 Christian Marangi <ansuelsmth@xxxxxxxxx> wrote: > + for_each_set_bit(mode, supported_link_modes, __ETHTOOL_LINK_MODE_MASK_NBITS) { > + struct ethtool_link_ksettings link_ksettings; > + > + ethtool_params_from_link_mode(&link_ksettings, mode); > + > + if (attr == &dev_attr_link_10.attr && > + link_ksettings.base.speed == SPEED_10) > + return attr->mode; > + > + if (attr == &dev_attr_link_100.attr && > + link_ksettings.base.speed == SPEED_100) > + return attr->mode; > + > + if (attr == &dev_attr_link_1000.attr && > + link_ksettings.base.speed == SPEED_1000) > + return attr->mode; > + > + if (attr == &dev_attr_link_2500.attr && > + link_ksettings.base.speed == SPEED_2500) > + return attr->mode; > + > + if (attr == &dev_attr_link_5000.attr && > + link_ksettings.base.speed == SPEED_5000) > + return attr->mode; > + > + if (attr == &dev_attr_link_10000.attr && > + link_ksettings.base.speed == SPEED_10000) > + return attr->mode; Hi Christian, ugly code repetition. Use a macro or a switch or something. Marek