EEE support for 2.5G/5G
Subsystems (2)
Hi,
I am currently in the process of implementing EEE (energy-efficient ethernet) ethtool get/set on my PHY driver. There are generic functions to achieve this, but they do not currently have the capability to set or check for 2.5G and 5G EEE LPI.
I had begun to add these additional modes when I realised this was not possible as the EEE ethtool command struct, only has 32-bit fields, and the ethtool bit mask for the 2.5G and 5G modes is 47 and 48 respectively.
I could of course use custom functions to achieve my objective, but I would like to ask if my understanding of the situation is correct.
To my knowledge, there is no framework currently in place to set 2.5G/5G EE through generic phy functions, and it cannot be implemented currently due to the size of the bit fields in the ethtool command. Are there any other places I should be looking at for this functionality? Further from this, is it time to create a new ethtool command for EEE (similar to set/get settings) that can account for these new speeds?
Thank you,
I look forward to your reply,
Aryan Srivastava,
Allied Telesis NZ
Quoted 3 lines · Aryan Srivastava
Hi,
I am currently in the process of implementing EEE (energy-efficient ethernet) ethtool get/set on my PHY driver.
I hope you are following the discussions on the mailing list about EEE. Most drivers get EEE wrong, so be careful which driver you copy.
Quoted 8 lines
There are generic functions to achieve this, but they do not currently have the capability to set or check for 2.5G and 5G EEE LPI.
I had begun to add these additional modes when I realised this was not possible as the EEE ethtool command struct, only has 32-bit fields, and the ethtool bit mask for the 2.5G and 5G modes is 47 and 48 respectively.
So you need to differentiate between the IOCTL API and netlink. Netlink should allow user space to use any link modes without any backwards compatibility issues. The IOCTL API is stuck to just 1G and less.
Quoted 4 lines
To my knowledge, there is no framework currently in place to set 2.5G/5G EE through generic phy functions, and it cannot be implemented currently due to the size of the bit fields in the ethtool command.
Partially wrong. See above. But you are going to have do some kernel internal plumbing. Within the kernel you need to replace struct ethtool_eee with a different structure that replaces the u32 supported, advertised, and lp_advertised with a __ETHTOOL_DECLARE_LINK_MODE_MASK. net/ethtool needs to map the IOCTL call, using the UAPI ethtool_eee to this new structure, and the netlink version should be swapped to ethnl_put_bitset() rather than ethnl_put_bitset32(). You then need to modify every MAC driver which has .eee_set() and .eee_get(). Those that use phylib probably don't need any changes, but those doing EEE in firmware you are going to have to add convert_link_ksettings_to_legacy_settings() to turn the values back into u32. And then modify phylib to remove the recently added convert_link_ksettings_to_legacy_settings().
Make sure you are on top of net-next. phylib has had a lot of EEE changes recently, and more will be merged next cycle.
Andrew