Skip to content
Advertisement

Ethtool Structs elements and what are they. What settings and info defined on them

I am reading driver code from Intel E1000E AND Realtek r1869 driver. I hvae the devices for both,

Currently I am studying ethtool_ops. I know Ethtool can be a tool for

Long story short, ethtool is a means to display and adjust generic NIC/driver parameters
(identification, the number of receive and transmit queues, receive and transmit offloads, you > name it) in a userspace application

But if you look at the struct ethtool_ops not everythhing is crystal clear

Below is a Ethtool struct

        static const struct ethtool_ops rtl8169_ethtool_ops = {
            .supported_coalesce_params = ETHTOOL_COALESCE_USECS |
                             ETHTOOL_COALESCE_MAX_FRAMES,
            .get_drvinfo        = rtl8169_get_drvinfo,
            .get_regs_len       = rtl8169_get_regs_len,
            .get_link       = ethtool_op_get_link,
            .get_coalesce       = rtl_get_coalesce,
            .set_coalesce       = rtl_set_coalesce,
            .get_regs       = rtl8169_get_regs,
            .get_wol        = rtl8169_get_wol,
            .set_wol        = rtl8169_set_wol,
            .get_strings        = rtl8169_get_strings,
            .get_sset_count     = rtl8169_get_sset_count,
            .get_ethtool_stats  = rtl8169_get_ethtool_stats,
            .get_ts_info        = ethtool_op_get_ts_info,
            .nway_reset     = phy_ethtool_nway_reset,
            .get_eee        = rtl8169_get_eee,
            .set_eee        = rtl8169_set_eee,
            .get_link_ksettings = phy_ethtool_get_link_ksettings,
            .set_link_ksettings = phy_ethtool_set_link_ksettings,
        };

What I don’t get it is some info on this page, for example, show doing settings. But when you look at the struct much make no sense https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/monitoring-and-tuning-the-rx-ring-buffer_configuring-and-managing-networking

https://linoxide.com/linux-how-to/ethtool-command-with-examples/

So I like to know what if I have to do these following thinges using ethtool userspace application. then which ethtool_ops function handlers this

  1. Displaying the number of dropped packets: I for that I have .get_ethtool_stats = rtl8169_get_ethtool_stats, in r8169 driver from RealTek. Correct me if I am wrong that this info managed by kernel stack.

  2. Increasing the RX ring buffer to reduce a high packet drop rate. I couldn’t figure out which member of struct ethtool_ops handles this

  3. Flow control in full duplex can be enabled by ‘PAUSE’ parameter in the latest MAC and GMAC embedded devices.

  4. Set Duplex Mode

  5. Which function handlers transmit offloads like Transmit segmentation offload for group sending of packets

  6. TCP segmentation Offload.

Also what is ksettings operation in the struct

Advertisement

Answer

  1. Check with ethtool -h which command is responsible for the respective action
  2. Check in ethtool source code how command is handled
  3. Check in net/ethtool/ on the kernel side

And a general hint: Basically no network driver implements all ethtool functionalities.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement