History

ethtool: add interface to interact with Ethernet Power Equipment

Add interface to support Power Sourcing Equipment. At current step it provides generic way to address all variants of PSE devices as defined in IEEE 802.3-2018 but support only objects specified for IEEE 802.3-2018 104.4 PoDL Power Sourcing Equipment (PSE). Currently supported and mandatory objects are: IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState IEEE 802.3-2018 30.15.1.2.1 acPoDLPSEAdminControl This is minimal interface needed to control PSE on each separate ethernet port but it provides not all mandatory objects specified in IEEE 802.3-2018. Since "PoDL PSE" and "PSE" have similar names, but some different values I decide to not merge them and keep separate naming schema. This should allow as to be as close to IEEE 802.3 spec as possible and avoid name conflicts in the future. This implementation is connected to PHYs instead of MACs because PSE auto classification can potentially interfere with PHY auto negotiation. So, may be some extra PHY related initialization will be needed. With WIP version of ethtools interaction with PSE capable link looks as following: $ ip l ... 5: t1l1@eth0: <BROADCAST,MULTICAST> .. ... $ ethtool --show-pse t1l1 PSE attributs for t1l1: PoDL PSE Admin State: disabled PoDL PSE Power Detection Status: disabled $ ethtool --set-pse t1l1 podl-pse-admin-control enable $ ethtool --show-pse t1l1 PSE attributs for t1l1: PoDL PSE Admin State: enabled PoDL PSE Power Detection Status: delivering power

Oleksij Rempel committed 4 years ago

Commit 18ff0bc1 parent 5e8214710 files · +449 −1Browse files

Showing the changes to include/uapi/linux (2 of 10 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/ethtool.h +45 −0
  2. include/uapi/linux/ethtool_netlink.h +16 −0
include/uapi/linux/ethtool.h+45−0
@@ -736,6 +736,51 @@ enum ethtool_module_power_mode { · 735 unmodified lines
736 ETHTOOL_MODULE_POWER_MODE_HIGH,736 ETHTOOL_MODULE_POWER_MODE_HIGH,
737};737};
738 738
739/**
740 * enum ethtool_podl_pse_admin_state - operational state of the PoDL PSE
741 * functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState
742 * @ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN: state of PoDL PSE functions are
743 * unknown
744 * @ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED: PoDL PSE functions are disabled
745 * @ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED: PoDL PSE functions are enabled
746 */
747enum ethtool_podl_pse_admin_state {
748 ETHTOOL_PODL_PSE_ADMIN_STATE_UNKNOWN = 1,
749 ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED,
750 ETHTOOL_PODL_PSE_ADMIN_STATE_ENABLED,
751};
752
753/**
754 * enum ethtool_podl_pse_pw_d_status - power detection status of the PoDL PSE.
755 * IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus:
756 * @ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN: PoDL PSE
757 * @ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED: "The enumeration “disabled” is
758 * asserted true when the PoDL PSE state diagram variable mr_pse_enable is
759 * false"
760 * @ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING: "The enumeration “searching” is
761 * asserted true when either of the PSE state diagram variables
762 * pi_detecting or pi_classifying is true."
763 * @ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING: "The enumeration “deliveringPower”
764 * is asserted true when the PoDL PSE state diagram variable pi_powered is
765 * true."
766 * @ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP: "The enumeration “sleep” is asserted
767 * true when the PoDL PSE state diagram variable pi_sleeping is true."
768 * @ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE: "The enumeration “idle” is asserted true
769 * when the logical combination of the PoDL PSE state diagram variables
770 * pi_prebiased*!pi_sleeping is true."
771 * @ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR: "The enumeration “error” is asserted
772 * true when the PoDL PSE state diagram variable overload_held is true."
773 */
774enum ethtool_podl_pse_pw_d_status {
775 ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN = 1,
776 ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED,
777 ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING,
778 ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING,
779 ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP,
780 ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE,
781 ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR,
782};
783
739/**784/**
740 * struct ethtool_gstrings - string set for data tagging785 * struct ethtool_gstrings - string set for data tagging
741 * @cmd: Command number = %ETHTOOL_GSTRINGS786 * @cmd: Command number = %ETHTOOL_GSTRINGS
include/uapi/linux/ethtool_netlink.h+16−0
@@ -49,6 +49,8 @@ enum { · 48 unmodified lines
49 ETHTOOL_MSG_PHC_VCLOCKS_GET,49 ETHTOOL_MSG_PHC_VCLOCKS_GET,
50 ETHTOOL_MSG_MODULE_GET,50 ETHTOOL_MSG_MODULE_GET,
51 ETHTOOL_MSG_MODULE_SET,51 ETHTOOL_MSG_MODULE_SET,
52 ETHTOOL_MSG_PSE_GET,
53 ETHTOOL_MSG_PSE_SET,
52 54
53 /* add new constants above here */55 /* add new constants above here */
54 __ETHTOOL_MSG_USER_CNT,56 __ETHTOOL_MSG_USER_CNT,
@@ -94,6 +96,7 @@ enum { · 39 unmodified lines
94 ETHTOOL_MSG_PHC_VCLOCKS_GET_REPLY,96 ETHTOOL_MSG_PHC_VCLOCKS_GET_REPLY,
95 ETHTOOL_MSG_MODULE_GET_REPLY,97 ETHTOOL_MSG_MODULE_GET_REPLY,
96 ETHTOOL_MSG_MODULE_NTF,98 ETHTOOL_MSG_MODULE_NTF,
99 ETHTOOL_MSG_PSE_GET_REPLY,
97 100
98 /* add new constants above here */101 /* add new constants above here */
99 __ETHTOOL_MSG_KERNEL_CNT,102 __ETHTOOL_MSG_KERNEL_CNT,
@@ -863,6 +866,19 @@ enum { · 763 unmodified lines
863 ETHTOOL_A_MODULE_MAX = (__ETHTOOL_A_MODULE_CNT - 1)866 ETHTOOL_A_MODULE_MAX = (__ETHTOOL_A_MODULE_CNT - 1)
864};867};
865 868
869/* Power Sourcing Equipment */
870enum {
871 ETHTOOL_A_PSE_UNSPEC,
872 ETHTOOL_A_PSE_HEADER, /* nest - _A_HEADER_* */
873 ETHTOOL_A_PODL_PSE_ADMIN_STATE, /* u32 */
874 ETHTOOL_A_PODL_PSE_ADMIN_CONTROL, /* u32 */
875 ETHTOOL_A_PODL_PSE_PW_D_STATUS, /* u32 */
876
877 /* add new constants above here */
878 __ETHTOOL_A_PSE_CNT,
879 ETHTOOL_A_PSE_MAX = (__ETHTOOL_A_PSE_CNT - 1)
880};
881
866/* generic netlink info */882/* generic netlink info */
867#define ETHTOOL_GENL_NAME "ethtool"883#define ETHTOOL_GENL_NAME "ethtool"
868#define ETHTOOL_GENL_VERSION 1884#define ETHTOOL_GENL_VERSION 1