* [PATCH ethtool v2 0/3] Add support for PSE priority feature and PSE event monitoring
@ 2025-08-13 8:57 Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 1/3] update UAPI header copies Kory Maincent
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Kory Maincent @ 2025-08-13 8:57 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Michal Kubecek
Cc: Dent Project, Kyle Swenson, Thomas Petazzoni, netdev,
linux-kernel, Kory Maincent
From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
Add support for PSE (Power Sourcing Equipment) priority management and
event monitoring capabilities.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Changes in v2:
- Split the second patch in two to separate the PSE priority feature and
the PSE event feature support.
- Regenerate the "update UAPI header copies" patch.
- Link to v1: https://lore.kernel.org/r/20250620-b4-feature_poe_pw_budget-v1-0-0bdb7d2b9c8f@bootlin.com
---
Kory Maincent (3):
update UAPI header copies
ethtool: pse-pd: Add PSE priority support
ethtool: pse-pd: Add PSE event monitoring support
ethtool.8.in | 13 +++++
ethtool.c | 1 +
netlink/monitor.c | 9 +++-
netlink/netlink.h | 1 +
netlink/pse-pd.c | 87 ++++++++++++++++++++++++++++++++++
uapi/linux/ethtool.h | 4 +-
uapi/linux/ethtool_netlink.h | 2 -
uapi/linux/ethtool_netlink_generated.h | 83 ++++++++++++++++++++++++++++++++
uapi/linux/if_link.h | 2 +
uapi/linux/neighbour.h | 5 ++
10 files changed, 202 insertions(+), 5 deletions(-)
---
base-commit: 755f5d758e7a365d13140a130a748283b67f756e
change-id: 20241204-b4-feature_poe_pw_budget-0aee8624fc55
Best regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH ethtool v2 1/3] update UAPI header copies
2025-08-13 8:57 [PATCH ethtool v2 0/3] Add support for PSE priority feature and PSE event monitoring Kory Maincent
@ 2025-08-13 8:57 ` Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support Kory Maincent
2 siblings, 0 replies; 8+ messages in thread
From: Kory Maincent @ 2025-08-13 8:57 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Michal Kubecek
Cc: Dent Project, Kyle Swenson, Thomas Petazzoni, netdev,
linux-kernel, Kory Maincent
From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
Update to kernel commit c04fdca8a98a.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
uapi/linux/ethtool.h | 4 +-
uapi/linux/ethtool_netlink.h | 2 -
uapi/linux/ethtool_netlink_generated.h | 83 ++++++++++++++++++++++++++++++++++
uapi/linux/if_link.h | 2 +
uapi/linux/neighbour.h | 5 ++
5 files changed, 92 insertions(+), 4 deletions(-)
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index 253df22..4a4b77b 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -2312,7 +2312,7 @@ enum {
IPV6_USER_FLOW = 0x0e, /* spec only (usr_ip6_spec; nfc only) */
IPV4_FLOW = 0x10, /* hash only */
IPV6_FLOW = 0x11, /* hash only */
- ETHER_FLOW = 0x12, /* spec only (ether_spec) */
+ ETHER_FLOW = 0x12, /* hash or spec (ether_spec) */
/* Used for GTP-U IPv4 and IPv6.
* The format of GTP packets only includes
@@ -2369,7 +2369,7 @@ enum {
/* Flag to enable RSS spreading of traffic matching rule (nfc only) */
#define FLOW_RSS 0x20000000
-/* L3-L4 network traffic flow hash options */
+/* L2-L4 network traffic flow hash options */
#define RXH_L2DA (1 << 1)
#define RXH_VLAN (1 << 2)
#define RXH_L3_PROTO (1 << 3)
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h
index 0e9520f..041e768 100644
--- a/uapi/linux/ethtool_netlink.h
+++ b/uapi/linux/ethtool_netlink.h
@@ -208,6 +208,4 @@ enum {
ETHTOOL_A_STATS_PHY_MAX = (__ETHTOOL_A_STATS_PHY_CNT - 1)
};
-#define ETHTOOL_MCGRP_MONITOR_NAME "monitor"
-
#endif /* _LINUX_ETHTOOL_NETLINK_H_ */
diff --git a/uapi/linux/ethtool_netlink_generated.h b/uapi/linux/ethtool_netlink_generated.h
index fcc2986..98d12b0 100644
--- a/uapi/linux/ethtool_netlink_generated.h
+++ b/uapi/linux/ethtool_netlink_generated.h
@@ -49,6 +49,34 @@ enum hwtstamp_source {
HWTSTAMP_SOURCE_PHYLIB,
};
+/**
+ * enum ethtool_pse_event - PSE event list for the PSE controller
+ * @ETHTOOL_PSE_EVENT_OVER_CURRENT: PSE output current is too high
+ * @ETHTOOL_PSE_EVENT_OVER_TEMP: PSE in over temperature state
+ * @ETHTOOL_C33_PSE_EVENT_DETECTION: detection process occur on the PSE. IEEE
+ * 802.3-2022 33.2.5 and 145.2.6 PSE detection of PDs. IEEE 802.3-202
+ * 30.9.1.1.5 aPSEPowerDetectionStatus
+ * @ETHTOOL_C33_PSE_EVENT_CLASSIFICATION: classification process occur on the
+ * PSE. IEEE 802.3-2022 33.2.6 and 145.2.8 classification of PDs mutual
+ * identification. IEEE 802.3-2022 30.9.1.1.8 aPSEPowerClassification.
+ * @ETHTOOL_C33_PSE_EVENT_DISCONNECTION: PD has been disconnected on the PSE.
+ * IEEE 802.3-2022 33.3.8 and 145.3.9 PD Maintain Power Signature. IEEE
+ * 802.3-2022 33.5.1.2.9 MPS Absent. IEEE 802.3-2022 30.9.1.1.20
+ * aPSEMPSAbsentCounter.
+ * @ETHTOOL_PSE_EVENT_OVER_BUDGET: PSE turned off due to over budget situation
+ * @ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR: PSE faced an error managing the
+ * power control from software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898,16 @@ enum {
ETHTOOL_MSG_PHY_NTF,
ETHTOOL_MSG_TSCONFIG_GET_REPLY,
ETHTOOL_MSG_TSCONFIG_SET_REPLY,
+ ETHTOOL_MSG_PSE_NTF,
+ ETHTOOL_MSG_RSS_NTF,
+ ETHTOOL_MSG_RSS_CREATE_ACT_REPLY,
+ ETHTOOL_MSG_RSS_CREATE_NTF,
+ ETHTOOL_MSG_RSS_DELETE_NTF,
__ETHTOOL_MSG_KERNEL_CNT,
ETHTOOL_MSG_KERNEL_MAX = (__ETHTOOL_MSG_KERNEL_CNT - 1)
};
+#define ETHTOOL_MCGRP_MONITOR_NAME "monitor"
+
#endif /* _LINUX_ETHTOOL_NETLINK_GENERATED_H */
diff --git a/uapi/linux/if_link.h b/uapi/linux/if_link.h
index bb94d88..b450757 100644
--- a/uapi/linux/if_link.h
+++ b/uapi/linux/if_link.h
@@ -1396,6 +1396,7 @@ enum {
IFLA_VXLAN_LOCALBYPASS,
IFLA_VXLAN_LABEL_POLICY, /* IPv6 flow label policy; ifla_vxlan_label_policy */
IFLA_VXLAN_RESERVED_BITS,
+ IFLA_VXLAN_MC_ROUTE,
__IFLA_VXLAN_MAX
};
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -1532,6 +1533,7 @@ enum {
IFLA_BOND_MISSED_MAX,
IFLA_BOND_NS_IP6_TARGET,
IFLA_BOND_COUPLED_CONTROL,
+ IFLA_BOND_BROADCAST_NEIGH,
__IFLA_BOND_MAX,
};
diff --git a/uapi/linux/neighbour.h b/uapi/linux/neighbour.h
index 5e67a7e..1401f57 100644
--- a/uapi/linux/neighbour.h
+++ b/uapi/linux/neighbour.h
@@ -54,6 +54,7 @@ enum {
/* Extended flags under NDA_FLAGS_EXT: */
#define NTF_EXT_MANAGED (1 << 0)
#define NTF_EXT_LOCKED (1 << 1)
+#define NTF_EXT_EXT_VALIDATED (1 << 2)
/*
* Neighbor Cache Entry States.
@@ -92,6 +93,10 @@ enum {
* bridge in response to a host trying to communicate via a locked bridge port
* with MAB enabled. Their purpose is to notify user space that a host requires
* authentication.
+ *
+ * NTF_EXT_EXT_VALIDATED flagged neighbor entries were externally validated by
+ * a user space control plane. The kernel will not remove or invalidate them,
+ * but it can probe them and notify user space when they become reachable.
*/
struct nda_cacheinfo {
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support
2025-08-13 8:57 [PATCH ethtool v2 0/3] Add support for PSE priority feature and PSE event monitoring Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 1/3] update UAPI header copies Kory Maincent
@ 2025-08-13 8:57 ` Kory Maincent
2025-08-13 12:25 ` Oleksij Rempel
2025-08-13 8:57 ` [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support Kory Maincent
2 siblings, 1 reply; 8+ messages in thread
From: Kory Maincent @ 2025-08-13 8:57 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Michal Kubecek
Cc: Dent Project, Kyle Swenson, Thomas Petazzoni, netdev,
linux-kernel, Kory Maincent
From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
Add support for PSE (Power Sourcing Equipment) priority management:
- Add priority configuration parameter (prio) for port priority management
- Display power domain index, maximum priority, and current priority
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
ethtool.8.in | 13 +++++++++++++
ethtool.c | 1 +
netlink/pse-pd.c | 29 +++++++++++++++++++++++++++++
3 files changed, 43 insertions(+)
diff --git a/ethtool.8.in b/ethtool.8.in
index 29b8a8c..163b2b0 100644
--- a/ethtool.8.in
+++ b/ethtool.8.in
@@ -561,6 +561,7 @@ ethtool \- query or control network driver and hardware settings
.RB [ c33\-pse\-admin\-control
.BR enable | disable ]
.BN c33\-pse\-avail\-pw\-limit N
+.BN prio N
.HP
.B ethtool \-\-flash\-module\-firmware
.I devname
@@ -1911,6 +1912,15 @@ This attribute specifies the allowed power limit ranges in mW for
configuring the c33-pse-avail-pw-limit parameter. It defines the valid
power levels that can be assigned to the c33 PSE in compliance with the
c33 standard.
+.TP
+.B power-domain-index
+This attribute defines the index of the PSE Power Domain.
+.TP
+.B priority-max
+This attribute defines the maximum priority available for the PSE.
+.TP
+.B priority
+This attribute defines the currently configured priority for the PSE.
.RE
.TP
@@ -1930,6 +1940,9 @@ This parameter manages c33 PSE Admin operations in accordance with the IEEE
This parameter manages c33 PSE Available Power Limit in mW, in accordance
with the IEEE 802.3-2022 33.2.4.4 Variables (pse_available_power)
specification.
+.TP
+.B prio \ N
+This parameter manages port priority.
.RE
.TP
diff --git a/ethtool.c b/ethtool.c
index 215f566..948d551 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -6339,6 +6339,7 @@ static const struct option args[] = {
.xhelp = " [ podl-pse-admin-control enable|disable ]\n"
" [ c33-pse-admin-control enable|disable ]\n"
" [ c33-pse-avail-pw-limit N ]\n"
+ " [ prio N ]\n"
},
{
.opts = "--flash-module-firmware",
diff --git a/netlink/pse-pd.c b/netlink/pse-pd.c
index fd1fc4d..5bde176 100644
--- a/netlink/pse-pd.c
+++ b/netlink/pse-pd.c
@@ -420,6 +420,29 @@ int pse_reply_cb(const struct nlmsghdr *nlhdr, void *data)
}
}
+ if (tb[ETHTOOL_A_PSE_PW_D_ID]) {
+ u32 val;
+
+ val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PW_D_ID]);
+ print_uint(PRINT_ANY, "power-domain-index",
+ "Power domain index: %u\n", val);
+ }
+
+ if (tb[ETHTOOL_A_PSE_PRIO_MAX]) {
+ u32 val;
+
+ val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PRIO_MAX]);
+ print_uint(PRINT_ANY, "priority-max",
+ "Max allowed priority: %u\n", val);
+ }
+
+ if (tb[ETHTOOL_A_PSE_PRIO]) {
+ u32 val;
+
+ val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PRIO]);
+ print_uint(PRINT_ANY, "priority", "Priority %u\n", val);
+ }
+
close_json_object();
return MNL_CB_OK;
@@ -487,6 +510,12 @@ static const struct param_parser spse_params[] = {
.handler = nl_parse_direct_u32,
.min_argc = 1,
},
+ {
+ .arg = "prio",
+ .type = ETHTOOL_A_PSE_PRIO,
+ .handler = nl_parse_direct_u32,
+ .min_argc = 1,
+ },
{}
};
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support
2025-08-13 8:57 [PATCH ethtool v2 0/3] Add support for PSE priority feature and PSE event monitoring Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 1/3] update UAPI header copies Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support Kory Maincent
@ 2025-08-13 8:57 ` Kory Maincent
2025-08-13 12:44 ` Oleksij Rempel
2 siblings, 1 reply; 8+ messages in thread
From: Kory Maincent @ 2025-08-13 8:57 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Michal Kubecek
Cc: Dent Project, Kyle Swenson, Thomas Petazzoni, netdev,
linux-kernel, Kory Maincent
From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
Add support for PSE (Power Sourcing Equipment) event monitoring
capabilities through the monitor command.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
netlink/monitor.c | 9 ++++++++-
netlink/netlink.h | 1 +
netlink/pse-pd.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/netlink/monitor.c b/netlink/monitor.c
index c511389..a16cb97 100644
--- a/netlink/monitor.c
+++ b/netlink/monitor.c
@@ -79,6 +79,10 @@ static struct {
.cmd = ETHTOOL_MSG_PLCA_NTF,
.cb = plca_get_cfg_reply_cb,
},
+ {
+ .cmd = ETHTOOL_MSG_PSE_NTF,
+ .cb = pse_ntf_cb,
+ },
};
static void clear_filter(struct nl_context *nlctx)
@@ -194,7 +198,10 @@ static struct monitor_option monitor_opts[] = {
.pattern = "--get-plca-cfg|--set-plca-cfg",
.cmd = ETHTOOL_MSG_PLCA_NTF,
},
-
+ {
+ .pattern = "--pse-event",
+ .cmd = ETHTOOL_MSG_PSE_NTF,
+ },
};
static bool pattern_match(const char *s, const char *pattern)
diff --git a/netlink/netlink.h b/netlink/netlink.h
index 290592b..eefedf7 100644
--- a/netlink/netlink.h
+++ b/netlink/netlink.h
@@ -93,6 +93,7 @@ int cable_test_tdr_ntf_cb(const struct nlmsghdr *nlhdr, void *data);
int fec_reply_cb(const struct nlmsghdr *nlhdr, void *data);
int module_reply_cb(const struct nlmsghdr *nlhdr, void *data);
int plca_get_cfg_reply_cb(const struct nlmsghdr *nlhdr, void *data);
+int pse_ntf_cb(const struct nlmsghdr *nlhdr, void *data);
/* dump helpers */
diff --git a/netlink/pse-pd.c b/netlink/pse-pd.c
index 5bde176..3fb0616 100644
--- a/netlink/pse-pd.c
+++ b/netlink/pse-pd.c
@@ -475,6 +475,64 @@ int nl_gpse(struct cmd_context *ctx)
return ret;
}
+static const char *pse_events_name(u64 val)
+{
+ switch (val) {
+ case ETHTOOL_PSE_EVENT_OVER_CURRENT:
+ return "over-current";
+ case ETHTOOL_PSE_EVENT_OVER_TEMP:
+ return "over-temperature";
+ case ETHTOOL_C33_PSE_EVENT_DETECTION:
+ return "detection";
+ case ETHTOOL_C33_PSE_EVENT_CLASSIFICATION:
+ return "classification";
+ case ETHTOOL_C33_PSE_EVENT_DISCONNECTION:
+ return "disconnection";
+ case ETHTOOL_PSE_EVENT_OVER_BUDGET:
+ return "over-budget";
+ case ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR:
+ return "software power control error";
+ default:
+ return "unknown";
+ }
+}
+
+int pse_ntf_cb(const struct nlmsghdr *nlhdr, void *data)
+{
+ const struct nlattr *tb[ETHTOOL_A_PSE_MAX + 1] = {};
+ struct nl_context *nlctx = data;
+ DECLARE_ATTR_TB_INFO(tb);
+ u64 val;
+ int ret, i;
+
+ ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info);
+ if (ret < 0)
+ return MNL_CB_OK;
+
+ if (!tb[ETHTOOL_A_PSE_NTF_EVENTS])
+ return MNL_CB_OK;
+
+ nlctx->devname = get_dev_name(tb[ETHTOOL_A_PSE_HEADER]);
+ if (!dev_ok(nlctx))
+ return MNL_CB_OK;
+
+ open_json_object(NULL);
+ print_string(PRINT_ANY, "ifname", "PSE event for %s:\n",
+ nlctx->devname);
+ open_json_array("events", "Events:");
+ val = attr_get_uint(tb[ETHTOOL_A_PSE_NTF_EVENTS]);
+ for (i = 0; 1 << i <= ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR; i++)
+ if (val & 1 << i)
+ print_string(PRINT_ANY, NULL, " %s",
+ pse_events_name(val & 1 << i));
+ close_json_array("\n");
+ if (ret < 0)
+ return MNL_CB_OK;
+
+ close_json_object();
+ return MNL_CB_OK;
+}
+
/* PSE_SET */
static const struct lookup_entry_u32 podl_pse_admin_control_values[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support
2025-08-13 8:57 ` [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support Kory Maincent
@ 2025-08-13 12:25 ` Oleksij Rempel
2025-08-13 12:57 ` Kory Maincent
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2025-08-13 12:25 UTC (permalink / raw)
To: Kory Maincent
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, Michal Kubecek, Dent Project, Kyle Swenson,
Thomas Petazzoni, netdev, linux-kernel
Hi Kory,
Thank you for your work! Here are some review comments...
On Wed, Aug 13, 2025 at 10:57:51AM +0200, Kory Maincent wrote:
> From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
>
> Add support for PSE (Power Sourcing Equipment) priority management:
> - Add priority configuration parameter (prio) for port priority management
> - Display power domain index, maximum priority, and current priority
>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
> ethtool.8.in | 13 +++++++++++++
> ethtool.c | 1 +
> netlink/pse-pd.c | 29 +++++++++++++++++++++++++++++
> 3 files changed, 43 insertions(+)
>
> diff --git a/ethtool.8.in b/ethtool.8.in
> index 29b8a8c..163b2b0 100644
> --- a/ethtool.8.in
> +++ b/ethtool.8.in
> @@ -561,6 +561,7 @@ ethtool \- query or control network driver and hardware settings
> .RB [ c33\-pse\-admin\-control
> .BR enable | disable ]
> .BN c33\-pse\-avail\-pw\-limit N
> +.BN prio N
> .HP
> .B ethtool \-\-flash\-module\-firmware
> .I devname
> @@ -1911,6 +1912,15 @@ This attribute specifies the allowed power limit ranges in mW for
> configuring the c33-pse-avail-pw-limit parameter. It defines the valid
> power levels that can be assigned to the c33 PSE in compliance with the
> c33 standard.
> +.TP
> +.B power-domain-index
> +This attribute defines the index of the PSE Power Domain.
May be:
Reports the index of the PSE power domain the port belongs to. Every
port belongs to exactly one power domain. Port priorities are defined
within that power domain.
Each power domain may have its own maximum budget (e.g., 100 W per
domain) in addition to a system-wide budget (e.g., 200 W overall).
Domain limits are enforced first: if a single domain reaches its budget,
only ports in that domain are affected. The system-wide budget is
enforced across all domains; only when it is exceeded do cross-domain
priorities apply.
> +.TP
> +.B priority-max
> +This attribute defines the maximum priority available for the PSE.
Reports the maximum configurable port priority value within the reported
power domain. The valid range for prio is 0 to priority-max (inclusive).
> +.TP
> +.B priority
> +This attribute defines the currently configured priority for the PSE.
Reports the currently configured port priority within the reported power
domain. Lower numeric values indicate higher priority: 0 is the highest
priority.
> .RE
> .TP
> @@ -1930,6 +1940,9 @@ This parameter manages c33 PSE Admin operations in accordance with the IEEE
> This parameter manages c33 PSE Available Power Limit in mW, in accordance
> with the IEEE 802.3-2022 33.2.4.4 Variables (pse_available_power)
> specification.
> +.TP
> +.B prio \ N
> +This parameter manages port priority.
Set the port priority, scoped to the port's power domain
as reported by power-domain-index. Lower values indicate higher
priority; 0 is the highest. The valid range is 0 to the
priority-max reported by --show-pse.
When a single domain exceeds its budget, ports in that domain are
powered up/down by priority (highest first for power-up; lowest shed
first). When the system-wide budget is exceeded, priority ordering is
applied across domains.
> .RE
> .TP
> diff --git a/ethtool.c b/ethtool.c
> index 215f566..948d551 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -6339,6 +6339,7 @@ static const struct option args[] = {
> .xhelp = " [ podl-pse-admin-control enable|disable ]\n"
> " [ c33-pse-admin-control enable|disable ]\n"
> " [ c33-pse-avail-pw-limit N ]\n"
> + " [ prio N ]\n"
> },
> {
> .opts = "--flash-module-firmware",
> diff --git a/netlink/pse-pd.c b/netlink/pse-pd.c
> index fd1fc4d..5bde176 100644
> --- a/netlink/pse-pd.c
> +++ b/netlink/pse-pd.c
> @@ -420,6 +420,29 @@ int pse_reply_cb(const struct nlmsghdr *nlhdr, void *data)
> }
> }
>
> + if (tb[ETHTOOL_A_PSE_PW_D_ID]) {
> + u32 val;
> +
> + val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PW_D_ID]);
> + print_uint(PRINT_ANY, "power-domain-index",
> + "Power domain index: %u\n", val);
> + }
> +
> + if (tb[ETHTOOL_A_PSE_PRIO_MAX]) {
> + u32 val;
> +
> + val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PRIO_MAX]);
> + print_uint(PRINT_ANY, "priority-max",
> + "Max allowed priority: %u\n", val);
> + }
> +
> + if (tb[ETHTOOL_A_PSE_PRIO]) {
> + u32 val;
> +
> + val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PRIO]);
> + print_uint(PRINT_ANY, "priority", "Priority %u\n", val);
missing colon
print_uint(PRINT_ANY, "priority", "Priority: %u\n", val);
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support
2025-08-13 8:57 ` [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support Kory Maincent
@ 2025-08-13 12:44 ` Oleksij Rempel
2025-08-13 13:22 ` Kory Maincent
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2025-08-13 12:44 UTC (permalink / raw)
To: Kory Maincent
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, Michal Kubecek, Dent Project, Kyle Swenson,
Thomas Petazzoni, netdev, linux-kernel
On Wed, Aug 13, 2025 at 10:57:52AM +0200, Kory Maincent wrote:
> From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
....
> diff --git a/netlink/pse-pd.c b/netlink/pse-pd.c
> index 5bde176..3fb0616 100644
> --- a/netlink/pse-pd.c
> +++ b/netlink/pse-pd.c
> @@ -475,6 +475,64 @@ int nl_gpse(struct cmd_context *ctx)
> return ret;
> }
>
> +static const char *pse_events_name(u64 val)
> +{
> + switch (val) {
> + case ETHTOOL_PSE_EVENT_OVER_CURRENT:
> + return "over-current";
> + case ETHTOOL_PSE_EVENT_OVER_TEMP:
> + return "over-temperature";
> + case ETHTOOL_C33_PSE_EVENT_DETECTION:
> + return "detection";
> + case ETHTOOL_C33_PSE_EVENT_CLASSIFICATION:
> + return "classification";
> + case ETHTOOL_C33_PSE_EVENT_DISCONNECTION:
> + return "disconnection";
> + case ETHTOOL_PSE_EVENT_OVER_BUDGET:
> + return "over-budget";
> + case ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR:
> + return "software power control error";
> + default:
> + return "unknown";
> + }
> +}
> +
> +int pse_ntf_cb(const struct nlmsghdr *nlhdr, void *data)
> +{
> + const struct nlattr *tb[ETHTOOL_A_PSE_MAX + 1] = {};
s/ETHTOOL_A_PSE_MAX/ETHTOOL_A_PSE_NTF_MAX ?
> + struct nl_context *nlctx = data;
> + DECLARE_ATTR_TB_INFO(tb);
> + u64 val;
> + int ret, i;
> +
> + ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info);
> + if (ret < 0)
> + return MNL_CB_OK;
> +
> + if (!tb[ETHTOOL_A_PSE_NTF_EVENTS])
> + return MNL_CB_OK;
> +
> + nlctx->devname = get_dev_name(tb[ETHTOOL_A_PSE_HEADER]);
s/ETHTOOL_A_PSE_HEADER/ETHTOOL_A_PSE_NTF_HEADER ?
> + if (!dev_ok(nlctx))
> + return MNL_CB_OK;
> +
> + open_json_object(NULL);
> + print_string(PRINT_ANY, "ifname", "PSE event for %s:\n",
> + nlctx->devname);
> + open_json_array("events", "Events:");
> + val = attr_get_uint(tb[ETHTOOL_A_PSE_NTF_EVENTS]);
we have here uint but val is u64, is it as expected?
> + for (i = 0; 1 << i <= ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR; i++)
> + if (val & 1 << i)
> + print_string(PRINT_ANY, NULL, " %s",
> + pse_events_name(val & 1 << i));
Hm, may be it is better to not limit to ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR
and report unknow numeric value. It will keep even old ethtool at least
partially usable.
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support
2025-08-13 12:25 ` Oleksij Rempel
@ 2025-08-13 12:57 ` Kory Maincent
0 siblings, 0 replies; 8+ messages in thread
From: Kory Maincent @ 2025-08-13 12:57 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, Michal Kubecek, Dent Project, Kyle Swenson,
Thomas Petazzoni, netdev, linux-kernel
Le Wed, 13 Aug 2025 14:25:22 +0200,
Oleksij Rempel <o.rempel@pengutronix.de> a écrit :
> Hi Kory,
>
> Thank you for your work! Here are some review comments...
Hello Oleksij,
>
> On Wed, Aug 13, 2025 at 10:57:51AM +0200, Kory Maincent wrote:
> > From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
> >
> > Add support for PSE (Power Sourcing Equipment) priority management:
> > - Add priority configuration parameter (prio) for port priority management
> > - Display power domain index, maximum priority, and current priority
> >
> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> > ---
> > ethtool.8.in | 13 +++++++++++++
> > ethtool.c | 1 +
> > netlink/pse-pd.c | 29 +++++++++++++++++++++++++++++
> > 3 files changed, 43 insertions(+)
> >
> > diff --git a/ethtool.8.in b/ethtool.8.in
> > index 29b8a8c..163b2b0 100644
> > --- a/ethtool.8.in
> > +++ b/ethtool.8.in
> > @@ -561,6 +561,7 @@ ethtool \- query or control network driver and hardware
> > settings .RB [ c33\-pse\-admin\-control
> > .BR enable | disable ]
> > .BN c33\-pse\-avail\-pw\-limit N
> > +.BN prio N
> > .HP
> > .B ethtool \-\-flash\-module\-firmware
> > .I devname
> > @@ -1911,6 +1912,15 @@ This attribute specifies the allowed power limit
> > ranges in mW for configuring the c33-pse-avail-pw-limit parameter. It
> > defines the valid power levels that can be assigned to the c33 PSE in
> > compliance with the c33 standard.
> > +.TP
> > +.B power-domain-index
> > +This attribute defines the index of the PSE Power Domain.
>
> May be:
>
> Reports the index of the PSE power domain the port belongs to. Every
> port belongs to exactly one power domain. Port priorities are defined
> within that power domain.
>
> Each power domain may have its own maximum budget (e.g., 100 W per
> domain) in addition to a system-wide budget (e.g., 200 W overall).
> Domain limits are enforced first: if a single domain reaches its budget,
> only ports in that domain are affected. The system-wide budget is
> enforced across all domains; only when it is exceeded do cross-domain
> priorities apply.
Thanks for the doc review!
Maybe we should not talking about cross-domain priority yet, we don't know how
PSE are supposed to behave on that specific case.
...
> > + if (tb[ETHTOOL_A_PSE_PRIO]) {
> > + u32 val;
> > +
> > + val = mnl_attr_get_u32(tb[ETHTOOL_A_PSE_PRIO]);
> > + print_uint(PRINT_ANY, "priority", "Priority %u\n", val);
>
> missing colon
> print_uint(PRINT_ANY, "priority", "Priority: %u\n", val);
Well spotted, thanks!
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support
2025-08-13 12:44 ` Oleksij Rempel
@ 2025-08-13 13:22 ` Kory Maincent
0 siblings, 0 replies; 8+ messages in thread
From: Kory Maincent @ 2025-08-13 13:22 UTC (permalink / raw)
To: Oleksij Rempel
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, Michal Kubecek, Dent Project, Kyle Swenson,
Thomas Petazzoni, netdev, linux-kernel
Le Wed, 13 Aug 2025 14:44:27 +0200,
Oleksij Rempel <o.rempel@pengutronix.de> a écrit :
> > +int pse_ntf_cb(const struct nlmsghdr *nlhdr, void *data)
> > +{
> > + const struct nlattr *tb[ETHTOOL_A_PSE_MAX + 1] = {};
>
> s/ETHTOOL_A_PSE_MAX/ETHTOOL_A_PSE_NTF_MAX ?
Thanks, well spotted.
> > + struct nl_context *nlctx = data;
> > + DECLARE_ATTR_TB_INFO(tb);
> > + u64 val;
> > + int ret, i;
> > +
> > + ret = mnl_attr_parse(nlhdr, GENL_HDRLEN, attr_cb, &tb_info);
> > + if (ret < 0)
> > + return MNL_CB_OK;
> > +
> > + if (!tb[ETHTOOL_A_PSE_NTF_EVENTS])
> > + return MNL_CB_OK;
> > +
> > + nlctx->devname = get_dev_name(tb[ETHTOOL_A_PSE_HEADER]);
>
> s/ETHTOOL_A_PSE_HEADER/ETHTOOL_A_PSE_NTF_HEADER ?
Thanks, well spotted.
> > + if (!dev_ok(nlctx))
> > + return MNL_CB_OK;
> > +
> > + open_json_object(NULL);
> > + print_string(PRINT_ANY, "ifname", "PSE event for %s:\n",
> > + nlctx->devname);
> > + open_json_array("events", "Events:");
> > + val = attr_get_uint(tb[ETHTOOL_A_PSE_NTF_EVENTS]);
>
> we have here uint but val is u64, is it as expected?
Yes, same behavior in Linux using nla_put_uint().
> > + for (i = 0; 1 << i <= ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR; i++)
> > + if (val & 1 << i)
> > + print_string(PRINT_ANY, NULL, " %s",
> > + pse_events_name(val & 1 << i));
>
> Hm, may be it is better to not limit to ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR
> and report unknow numeric value. It will keep even old ethtool at least
> partially usable.
Ok, I will loop until UINT_MAX then.
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-08-13 13:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 8:57 [PATCH ethtool v2 0/3] Add support for PSE priority feature and PSE event monitoring Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 1/3] update UAPI header copies Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support Kory Maincent
2025-08-13 12:25 ` Oleksij Rempel
2025-08-13 12:57 ` Kory Maincent
2025-08-13 8:57 ` [PATCH ethtool v2 3/3] ethtool: pse-pd: Add PSE event monitoring support Kory Maincent
2025-08-13 12:44 ` Oleksij Rempel
2025-08-13 13:22 ` Kory Maincent
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).