2024-04-23 09:06:25

by Kory Maincent

[permalink] [raw]
Subject: [PATCH ethtool-next 0/2] Add support for Power over Ethernet

From: Kory Maincent (Dent Project) <[email protected]>

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

Signed-off-by: Kory Maincent <[email protected]>
---
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



2024-04-23 09:06:40

by Kory Maincent

[permalink] [raw]
Subject: [PATCH ethtool-next 1/2] update UAPI header copies

From: Kory Maincent (Dent Project) <[email protected]>

Update to kernel commit 6a57f091622a.

Signed-off-by: Kory Maincent <[email protected]>
---
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


2024-04-23 09:07:05

by Kory Maincent

[permalink] [raw]
Subject: [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33)

From: Kory Maincent (Dent Project) <[email protected]>

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 <[email protected]>
---
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


2024-05-17 12:28:20

by Kory Maincent

[permalink] [raw]
Subject: Re: [PATCH ethtool-next 0/2] Add support for Power over Ethernet

On Tue, 23 Apr 2024 11:05:40 +0200
Kory Maincent <[email protected]> wrote:

> From: Kory Maincent (Dent Project) <[email protected]>
>
> 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

2024-05-17 12:39:08

by Michal Kubecek

[permalink] [raw]
Subject: Re: [PATCH ethtool-next 0/2] Add support for Power over Ethernet

On Fri, May 17, 2024 at 02:28:03PM +0200, Kory Maincent wrote:
> On Tue, 23 Apr 2024 11:05:40 +0200
> Kory Maincent <[email protected]> wrote:
>
> > From: Kory Maincent (Dent Project) <[email protected]>
> >
> > 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


Attachments:
(No filename) (509.00 B)
signature.asc (499.00 B)
Download all attachments

2024-05-17 12:43:21

by Kory Maincent

[permalink] [raw]
Subject: Re: [PATCH ethtool-next 0/2] Add support for Power over Ethernet

On Fri, 17 May 2024 14:38:54 +0200
Michal Kubecek <[email protected]> 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 <[email protected]> wrote:
> >
> > > From: Kory Maincent (Dent Project) <[email protected]>
> > >
> > > 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

2024-05-20 00:16:32

by Michal Kubecek

[permalink] [raw]
Subject: Re: [PATCH ethtool-next 2/2] ethtool: pse-pd: Add support for Power over Ethernet (clause 33)

On Tue, Apr 23, 2024 at 11:05:42AM +0200, Kory Maincent wrote:
> From: Kory Maincent (Dent Project) <[email protected]>
>
> 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 <[email protected]>
> ---
> 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


Attachments:
(No filename) (728.00 B)
signature.asc (499.00 B)
Download all attachments