lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240423-feature_poe-v1-2-9e12136a8674@bootlin.com>
Date: Tue, 23 Apr 2024 11:05:42 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Oleksij Rempel <o.rempel@...gutronix.de>, 
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
 Andrew Lunn <andrew@...n.ch>, Michal Kubecek <mkubecek@...e.cz>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>, netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, Kyle Swenson <kyle.swenson@....tech>, 
 Kory Maincent <kory.maincent@...tlin.com>
Subject: [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power
 over Ethernet (clause 33)

From: Kory Maincent (Dent Project) <kory.maincent@...tlin.com>

This update extends PSE support to include Power over Ethernet (clause 33),
encompassing standards 802.3af, 802.3at, and 802.3bt infrastructure.

Signed-off-by: Kory Maincent <kory.maincent@...tlin.com>
---
 ethtool.c        |  1 +
 netlink/pse-pd.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index e587597..d85a57a 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -6216,6 +6216,7 @@ static const struct option args[] = {
 		.nlfunc	= nl_spse,
 		.help	= "Set Power Sourcing Equipment settings",
 		.xhelp	= "		[ podl-pse-admin-control enable|disable ]\n"
+			  "		[ c33-pse-admin-control enable|disable ]\n"
 	},
 	{
 		.opts	= "-h|--help",
diff --git a/netlink/pse-pd.c b/netlink/pse-pd.c
index d6faff8..2c8dd89 100644
--- a/netlink/pse-pd.c
+++ b/netlink/pse-pd.c
@@ -54,6 +54,41 @@ static const char *podl_pse_pw_d_status_name(u32 val)
 	}
 }
 
+static const char *c33_pse_admin_state_name(u32 val)
+{
+	switch (val) {
+	case ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN:
+		return "unknown";
+	case ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED:
+		return "disabled";
+	case ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED:
+		return "enabled";
+	default:
+		return "unsupported";
+	}
+}
+
+static const char *c33_pse_pw_d_status_name(u32 val)
+{
+	switch (val) {
+	case ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN:
+		return "unknown";
+	case ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED:
+		return "disabled";
+	case ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING:
+		return "searching";
+	case ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING:
+		return "delivering power";
+	case ETHTOOL_C33_PSE_PW_D_STATUS_TEST:
+		return "test";
+	case ETHTOOL_C33_PSE_PW_D_STATUS_FAULT:
+		return "fault";
+	case ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT:
+		return "otherfault";
+	default:
+		return "unsupported";
+	}
+}
 int pse_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 {
 	const struct nlattr *tb[ETHTOOL_A_PSE_MAX + 1] = {};
@@ -98,6 +133,24 @@ int pse_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 			     podl_pse_pw_d_status_name(val));
 	}
 
+	if (tb[ETHTOOL_A_C33_PSE_ADMIN_STATE]) {
+		u32 val;
+
+		val = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_ADMIN_STATE]);
+		print_string(PRINT_ANY, "c33-pse-admin-state",
+			     "Clause 33 PSE Admin State: %s\n",
+			     c33_pse_admin_state_name(val));
+	}
+
+	if (tb[ETHTOOL_A_C33_PSE_PW_D_STATUS]) {
+		u32 val;
+
+		val = mnl_attr_get_u32(tb[ETHTOOL_A_C33_PSE_PW_D_STATUS]);
+		print_string(PRINT_ANY, "c33-pse-power-detection-status",
+			     "Clause 33 PSE Power Detection Status: %s\n",
+			     c33_pse_pw_d_status_name(val));
+	}
+
 	close_json_object();
 
 	return MNL_CB_OK;
@@ -138,6 +191,12 @@ static const struct lookup_entry_u32 podl_pse_admin_control_values[] = {
 	{}
 };
 
+static const struct lookup_entry_u32 c33_pse_admin_control_values[] = {
+	{ .arg = "enable",	.val = ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED },
+	{ .arg = "disable",	.val = ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED },
+	{}
+};
+
 static const struct param_parser spse_params[] = {
 	{
 		.arg		= "podl-pse-admin-control",
@@ -146,6 +205,13 @@ static const struct param_parser spse_params[] = {
 		.handler_data	= podl_pse_admin_control_values,
 		.min_argc	= 1,
 	},
+	{
+		.arg		= "c33-pse-admin-control",
+		.type		= ETHTOOL_A_C33_PSE_ADMIN_CONTROL,
+		.handler	= nl_parse_lookup_u32,
+		.handler_data	= c33_pse_admin_control_values,
+		.min_argc	= 1,
+	},
 	{}
 };
 

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ