mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Andrew Lunn <andrew@lunn.ch>,
	Michal Kubecek <mkubecek@suse.cz>
Cc: Dent Project <dentproject@linuxfoundation.org>,
	 Kyle Swenson <kyle.swenson@est.tech>,
	 Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Kory Maincent <kory.maincent@bootlin.com>
Subject: [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support
Date: Wed, 13 Aug 2025 10:57:51 +0200	[thread overview]
Message-ID: <20250813-b4-feature_poe_pw_budget-v2-2-0bef6bfcc708@bootlin.com> (raw)
In-Reply-To: <20250813-b4-feature_poe_pw_budget-v2-0-0bef6bfcc708@bootlin.com>

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


  parent reply	other threads:[~2025-08-13  8:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-08-13 12:25   ` [PATCH ethtool v2 2/3] ethtool: pse-pd: Add PSE priority support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250813-b4-feature_poe_pw_budget-v2-2-0bef6bfcc708@bootlin.com \
    --to=kory.maincent@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dentproject@linuxfoundation.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kyle.swenson@est.tech \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®