netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ethtool-next 0/2] Add support for Power over Ethernet
@ 2024-04-23  9:05 Kory Maincent
  2024-04-23  9:05 ` [PATCH ethtool-next 1/2] update UAPI header copies Kory Maincent
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kory Maincent @ 2024-04-23  9:05 UTC (permalink / raw)
  To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Michal Kubecek
  Cc: Thomas Petazzoni, netdev, linux-kernel, Kyle Swenson,
	Kory Maincent

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 821 bytes --]

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

Expand the PSE support with Power over Ethernet (clause 33) alongside
the already existing PoDL support.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Kory Maincent (2):
      update UAPI header copies
      ethtool: pse-pd: Add support for Power over Ethernet (clause 33)

 ethtool.c                    |  1 +
 netlink/pse-pd.c             | 66 ++++++++++++++++++++++++++++++++++++++++++++
 uapi/linux/ethtool.h         | 55 ++++++++++++++++++++++++++++++++++++
 uapi/linux/ethtool_netlink.h |  3 ++
 4 files changed, 125 insertions(+)
---
base-commit: e7700bcc192c1a184f9fc3a5eee02939392a8f08
change-id: 20240423-feature_poe-f1400e5861d4

Best regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH ethtool-next 1/2] update UAPI header copies
  2024-04-23  9:05 [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
@ 2024-04-23  9:05 ` Kory Maincent
  2024-04-23  9:05 ` [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33) Kory Maincent
  2024-05-17 12:28 ` [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
  2 siblings, 0 replies; 7+ messages in thread
From: Kory Maincent @ 2024-04-23  9:05 UTC (permalink / raw)
  To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Michal Kubecek
  Cc: Thomas Petazzoni, netdev, linux-kernel, Kyle Swenson,
	Kory Maincent

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

Update to kernel commit 6a57f091622a.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 uapi/linux/ethtool.h         | 55 ++++++++++++++++++++++++++++++++++++++++++++
 uapi/linux/ethtool_netlink.h |  3 +++
 2 files changed, 58 insertions(+)

diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index 4d1738a..3884bc4 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -750,6 +750,61 @@ enum ethtool_module_power_mode {
 	ETHTOOL_MODULE_POWER_MODE_HIGH,
 };
 
+/**
+ * enum ethtool_pse_types - Types of PSE controller.
+ * @ETHTOOL_PSE_UNKNOWN: Type of PSE controller is unknown
+ * @ETHTOOL_PSE_PODL: PSE controller which support PoDL
+ * @ETHTOOL_PSE_C33: PSE controller which support Clause 33 (PoE)
+ */
+enum ethtool_pse_types {
+	ETHTOOL_PSE_UNKNOWN =	1 << 0,
+	ETHTOOL_PSE_PODL =	1 << 1,
+	ETHTOOL_PSE_C33 =	1 << 2,
+};
+
+/**
+ * enum ethtool_c33_pse_admin_state - operational state of the PoDL PSE
+ *	functions. IEEE 802.3-2022 30.9.1.1.2 aPSEAdminState
+ * @ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN: state of PSE functions is unknown
+ * @ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED: PSE functions are disabled
+ * @ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED: PSE functions are enabled
+ */
+enum ethtool_c33_pse_admin_state {
+	ETHTOOL_C33_PSE_ADMIN_STATE_UNKNOWN = 1,
+	ETHTOOL_C33_PSE_ADMIN_STATE_DISABLED,
+	ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED,
+};
+
+/**
+ * enum ethtool_c33_pse_pw_d_status - power detection status of the PSE.
+ *	IEEE 802.3-2022 30.9.1.1.3 aPoDLPSEPowerDetectionStatus:
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN: PSE status is unknown
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED: The enumeration "disabled"
+ *	indicates that the PSE State diagram is in the state DISABLED.
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING: The enumeration "searching"
+ *	indicates the PSE State diagram is in a state other than those
+ *	listed.
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING: The enumeration
+ *	"deliveringPower" indicates that the PSE State diagram is in the
+ *	state POWER_ON.
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_TEST: The enumeration "test" indicates that
+ *	the PSE State diagram is in the state TEST_MODE.
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_FAULT: The enumeration "fault" indicates that
+ *	the PSE State diagram is in the state TEST_ERROR.
+ * @ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT: The enumeration "otherFault"
+ *	indicates that the PSE State diagram is in the state IDLE due to
+ *	the variable error_condition = true.
+ */
+enum ethtool_c33_pse_pw_d_status {
+	ETHTOOL_C33_PSE_PW_D_STATUS_UNKNOWN = 1,
+	ETHTOOL_C33_PSE_PW_D_STATUS_DISABLED,
+	ETHTOOL_C33_PSE_PW_D_STATUS_SEARCHING,
+	ETHTOOL_C33_PSE_PW_D_STATUS_DELIVERING,
+	ETHTOOL_C33_PSE_PW_D_STATUS_TEST,
+	ETHTOOL_C33_PSE_PW_D_STATUS_FAULT,
+	ETHTOOL_C33_PSE_PW_D_STATUS_OTHERFAULT,
+};
+
 /**
  * enum ethtool_podl_pse_admin_state - operational state of the PoDL PSE
  *	functions. IEEE 802.3-2018 30.15.1.1.2 aPoDLPSEAdminState
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h
index 2503b26..b61c04d 100644
--- a/uapi/linux/ethtool_netlink.h
+++ b/uapi/linux/ethtool_netlink.h
@@ -913,6 +913,9 @@ enum {
 	ETHTOOL_A_PODL_PSE_ADMIN_STATE,		/* u32 */
 	ETHTOOL_A_PODL_PSE_ADMIN_CONTROL,	/* u32 */
 	ETHTOOL_A_PODL_PSE_PW_D_STATUS,		/* u32 */
+	ETHTOOL_A_C33_PSE_ADMIN_STATE,		/* u32 */
+	ETHTOOL_A_C33_PSE_ADMIN_CONTROL,	/* u32 */
+	ETHTOOL_A_C33_PSE_PW_D_STATUS,		/* u32 */
 
 	/* add new constants above here */
 	__ETHTOOL_A_PSE_CNT,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33)
  2024-04-23  9:05 [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
  2024-04-23  9:05 ` [PATCH ethtool-next 1/2] update UAPI header copies Kory Maincent
@ 2024-04-23  9:05 ` Kory Maincent
  2024-05-20  0:16   ` Michal Kubecek
  2024-05-17 12:28 ` [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
  2 siblings, 1 reply; 7+ messages in thread
From: Kory Maincent @ 2024-04-23  9:05 UTC (permalink / raw)
  To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Michal Kubecek
  Cc: Thomas Petazzoni, netdev, linux-kernel, Kyle Swenson,
	Kory Maincent

From: Kory Maincent (Dent Project) <kory.maincent@bootlin.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@bootlin.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH ethtool-next 0/2] Add support for Power over Ethernet
  2024-04-23  9:05 [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
  2024-04-23  9:05 ` [PATCH ethtool-next 1/2] update UAPI header copies Kory Maincent
  2024-04-23  9:05 ` [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33) Kory Maincent
@ 2024-05-17 12:28 ` Kory Maincent
  2024-05-17 12:38   ` Michal Kubecek
  2 siblings, 1 reply; 7+ messages in thread
From: Kory Maincent @ 2024-05-17 12:28 UTC (permalink / raw)
  To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Michal Kubecek
  Cc: Thomas Petazzoni, netdev, linux-kernel, Kyle Swenson

On Tue, 23 Apr 2024 11:05:40 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:

> From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
> 
> Expand the PSE support with Power over Ethernet (clause 33) alongside
> the already existing PoDL support.

Hello,

Any news on this patch series?
Would someone have the time to take a look at it?

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH ethtool-next 0/2] Add support for Power over Ethernet
  2024-05-17 12:28 ` [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
@ 2024-05-17 12:38   ` Michal Kubecek
  2024-05-17 12:42     ` Kory Maincent
  0 siblings, 1 reply; 7+ messages in thread
From: Michal Kubecek @ 2024-05-17 12:38 UTC (permalink / raw)
  To: Kory Maincent
  Cc: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Thomas Petazzoni, netdev, linux-kernel,
	Kyle Swenson

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

On Fri, May 17, 2024 at 02:28:03PM +0200, Kory Maincent wrote:
> On Tue, 23 Apr 2024 11:05:40 +0200
> Kory Maincent <kory.maincent@bootlin.com> wrote:
> 
> > From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
> > 
> > Expand the PSE support with Power over Ethernet (clause 33) alongside
> > the already existing PoDL support.
> 
> Hello,
> 
> Any news on this patch series?
> Would someone have the time to take a look at it?

I should be able to get to it this weekend.

Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH ethtool-next 0/2] Add support for Power over Ethernet
  2024-05-17 12:38   ` Michal Kubecek
@ 2024-05-17 12:42     ` Kory Maincent
  0 siblings, 0 replies; 7+ messages in thread
From: Kory Maincent @ 2024-05-17 12:42 UTC (permalink / raw)
  To: Michal Kubecek
  Cc: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Thomas Petazzoni, netdev, linux-kernel,
	Kyle Swenson

On Fri, 17 May 2024 14:38:54 +0200
Michal Kubecek <mkubecek@suse.cz> wrote:

> On Fri, May 17, 2024 at 02:28:03PM +0200, Kory Maincent wrote:
> > On Tue, 23 Apr 2024 11:05:40 +0200
> > Kory Maincent <kory.maincent@bootlin.com> wrote:
> >   
> > > From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
> > > 
> > > Expand the PSE support with Power over Ethernet (clause 33) alongside
> > > the already existing PoDL support.  
> > 
> > Hello,
> > 
> > Any news on this patch series?
> > Would someone have the time to take a look at it?  
> 
> I should be able to get to it this weekend.

Ok great, thanks!

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33)
  2024-04-23  9:05 ` [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33) Kory Maincent
@ 2024-05-20  0:16   ` Michal Kubecek
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Kubecek @ 2024-05-20  0:16 UTC (permalink / raw)
  To: Kory Maincent
  Cc: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Thomas Petazzoni, netdev, linux-kernel,
	Kyle Swenson

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

On Tue, Apr 23, 2024 at 11:05:42AM +0200, Kory Maincent wrote:
> From: Kory Maincent (Dent Project) <kory.maincent@bootlin.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@bootlin.com>
> ---
>  ethtool.c        |  1 +
>  netlink/pse-pd.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 67 insertions(+)

Hello,

after I merged your patch and pushed to the server, I realized that you
forgot to update also the manual page (file ethtool.8.in). Please send
a follow-up patch with manual page update.

Thank you,
Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-20  0:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23  9:05 [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
2024-04-23  9:05 ` [PATCH ethtool-next 1/2] update UAPI header copies Kory Maincent
2024-04-23  9:05 ` [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33) Kory Maincent
2024-05-20  0:16   ` Michal Kubecek
2024-05-17 12:28 ` [PATCH ethtool-next 0/2] Add support for Power over Ethernet Kory Maincent
2024-05-17 12:38   ` Michal Kubecek
2024-05-17 12:42     ` 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).