* [PATCH ethtool-next 0/2] Userspace code for ethtool HW TS statistics
@ 2024-04-16 20:37 Rahul Rameshbabu
2024-04-16 20:37 ` [PATCH ethtool-next 1/2] update UAPI header copies Rahul Rameshbabu
2024-04-16 20:37 ` [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support Rahul Rameshbabu
0 siblings, 2 replies; 13+ messages in thread
From: Rahul Rameshbabu @ 2024-04-16 20:37 UTC (permalink / raw)
To: netdev
Cc: Vadim Fedorenko, Jacob Keller, Paolo Abeni, Jakub Kicinski,
David S. Miller, Eric Dumazet, Gal Pressman, Tariq Toukan,
Saeed Mahameed, Carolina Jubran, Cosmin Ratiu, Michal Kubecek,
Rahul Rameshbabu
Adds support for querying statistics related to tsinfo if the kernel supports
such statistics.
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Link: https://lore.kernel.org/netdev/20240403212931.128541-1-rrameshbabu@nvidia.com/
---
Rahul Rameshbabu (2):
update UAPI header copies
netlink: tsinfo: add statistics support
netlink/tsinfo.c | 66 +++++++++++++++++++++++++++++++++++-
uapi/linux/ethtool.h | 64 ++++++++++++++++++++++++++++++++++
uapi/linux/ethtool_netlink.h | 30 ++++++++++++----
uapi/linux/if_link.h | 1 +
4 files changed, 154 insertions(+), 7 deletions(-)
--
2.42.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH ethtool-next 1/2] update UAPI header copies
2024-04-16 20:37 [PATCH ethtool-next 0/2] Userspace code for ethtool HW TS statistics Rahul Rameshbabu
@ 2024-04-16 20:37 ` Rahul Rameshbabu
2024-04-17 7:55 ` Alexandra Winter
2024-04-16 20:37 ` [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support Rahul Rameshbabu
1 sibling, 1 reply; 13+ messages in thread
From: Rahul Rameshbabu @ 2024-04-16 20:37 UTC (permalink / raw)
To: netdev
Cc: Vadim Fedorenko, Jacob Keller, Paolo Abeni, Jakub Kicinski,
David S. Miller, Eric Dumazet, Gal Pressman, Tariq Toukan,
Saeed Mahameed, Carolina Jubran, Cosmin Ratiu, Michal Kubecek,
Rahul Rameshbabu
Update to kernel commit 3e6d3f6f870e.
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
---
uapi/linux/ethtool.h | 64 ++++++++++++++++++++++++++++++++++++
uapi/linux/ethtool_netlink.h | 30 +++++++++++++----
uapi/linux/if_link.h | 1 +
3 files changed, 89 insertions(+), 6 deletions(-)
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index 70f2b90..4d1738a 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -2021,6 +2021,53 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define IPV4_FLOW 0x10 /* hash only */
#define IPV6_FLOW 0x11 /* hash only */
#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
+
+/* Used for GTP-U IPv4 and IPv6.
+ * The format of GTP packets only includes
+ * elements such as TEID and GTP version.
+ * It is primarily intended for data communication of the UE.
+ */
+#define GTPU_V4_FLOW 0x13 /* hash only */
+#define GTPU_V6_FLOW 0x14 /* hash only */
+
+/* Use for GTP-C IPv4 and v6.
+ * The format of these GTP packets does not include TEID.
+ * Primarily expected to be used for communication
+ * to create sessions for UE data communication,
+ * commonly referred to as CSR (Create Session Request).
+ */
+#define GTPC_V4_FLOW 0x15 /* hash only */
+#define GTPC_V6_FLOW 0x16 /* hash only */
+
+/* Use for GTP-C IPv4 and v6.
+ * Unlike GTPC_V4_FLOW, the format of these GTP packets includes TEID.
+ * After session creation, it becomes this packet.
+ * This is mainly used for requests to realize UE handover.
+ */
+#define GTPC_TEID_V4_FLOW 0x17 /* hash only */
+#define GTPC_TEID_V6_FLOW 0x18 /* hash only */
+
+/* Use for GTP-U and extended headers for the PSC (PDU Session Container).
+ * The format of these GTP packets includes TEID and QFI.
+ * In 5G communication using UPF (User Plane Function),
+ * data communication with this extended header is performed.
+ */
+#define GTPU_EH_V4_FLOW 0x19 /* hash only */
+#define GTPU_EH_V6_FLOW 0x1a /* hash only */
+
+/* Use for GTP-U IPv4 and v6 PSC (PDU Session Container) extended headers.
+ * This differs from GTPU_EH_V(4|6)_FLOW in that it is distinguished by
+ * UL/DL included in the PSC.
+ * There are differences in the data included based on Downlink/Uplink,
+ * and can be used to distinguish packets.
+ * The functions described so far are useful when you want to
+ * handle communication from the mobile network in UPF, PGW, etc.
+ */
+#define GTPU_UL_V4_FLOW 0x1b /* hash only */
+#define GTPU_UL_V6_FLOW 0x1c /* hash only */
+#define GTPU_DL_V4_FLOW 0x1d /* hash only */
+#define GTPU_DL_V6_FLOW 0x1e /* hash only */
+
/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
#define FLOW_EXT 0x80000000
#define FLOW_MAC_EXT 0x40000000
@@ -2035,6 +2082,7 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define RXH_IP_DST (1 << 5)
#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
+#define RXH_GTP_TEID (1 << 8) /* teid in case of GTP */
#define RXH_DISCARD (1 << 31)
#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
@@ -2218,4 +2266,20 @@ struct ethtool_link_settings {
* __u32 map_lp_advertising[link_mode_masks_nwords];
*/
};
+
+/**
+ * enum phy_upstream - Represents the upstream component a given PHY device
+ * is connected to, as in what is on the other end of the MII bus. Most PHYs
+ * will be attached to an Ethernet MAC controller, but in some cases, there's
+ * an intermediate PHY used as a media-converter, which will driver another
+ * MII interface as its output.
+ * @PHY_UPSTREAM_MAC: Upstream component is a MAC (a switch port,
+ * or ethernet controller)
+ * @PHY_UPSTREAM_PHY: Upstream component is a PHY (likely a media converter)
+ */
+enum phy_upstream {
+ PHY_UPSTREAM_MAC,
+ PHY_UPSTREAM_PHY,
+};
+
#endif /* _LINUX_ETHTOOL_H */
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h
index 447d922..2503b26 100644
--- a/uapi/linux/ethtool_netlink.h
+++ b/uapi/linux/ethtool_netlink.h
@@ -117,12 +117,11 @@ enum {
/* request header */
-/* use compact bitsets in reply */
-#define ETHTOOL_FLAG_COMPACT_BITSETS (1 << 0)
-/* provide optional reply for SET or ACT requests */
-#define ETHTOOL_FLAG_OMIT_REPLY (1 << 1)
-/* request statistics, if supported by the driver */
-#define ETHTOOL_FLAG_STATS (1 << 2)
+enum ethtool_header_flags {
+ ETHTOOL_FLAG_COMPACT_BITSETS = 1 << 0, /* use compact bitsets in reply */
+ ETHTOOL_FLAG_OMIT_REPLY = 1 << 1, /* provide optional reply for SET or ACT requests */
+ ETHTOOL_FLAG_STATS = 1 << 2, /* request statistics, if supported by the driver */
+};
#define ETHTOOL_FLAG_ALL (ETHTOOL_FLAG_COMPACT_BITSETS | \
ETHTOOL_FLAG_OMIT_REPLY | \
@@ -133,6 +132,7 @@ enum {
ETHTOOL_A_HEADER_DEV_INDEX, /* u32 */
ETHTOOL_A_HEADER_DEV_NAME, /* string */
ETHTOOL_A_HEADER_FLAGS, /* u32 - ETHTOOL_FLAG_* */
+ ETHTOOL_A_HEADER_PHY_INDEX, /* u32 */
/* add new constants above here */
__ETHTOOL_A_HEADER_CNT,
@@ -478,12 +478,26 @@ enum {
ETHTOOL_A_TSINFO_TX_TYPES, /* bitset */
ETHTOOL_A_TSINFO_RX_FILTERS, /* bitset */
ETHTOOL_A_TSINFO_PHC_INDEX, /* u32 */
+ ETHTOOL_A_TSINFO_STATS, /* nest - _A_TSINFO_STAT */
/* add new constants above here */
__ETHTOOL_A_TSINFO_CNT,
ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1)
};
+enum {
+ ETHTOOL_A_TS_STAT_UNSPEC,
+
+ ETHTOOL_A_TS_STAT_TX_PKTS, /* uint */
+ ETHTOOL_A_TS_STAT_TX_LOST, /* uint */
+ ETHTOOL_A_TS_STAT_TX_ERR, /* uint */
+
+ /* add new constants above here */
+ __ETHTOOL_A_TS_STAT_CNT,
+ ETHTOOL_A_TS_STAT_MAX = (__ETHTOOL_A_TS_STAT_CNT - 1)
+
+};
+
/* PHC VCLOCKS */
enum {
@@ -515,6 +529,10 @@ enum {
ETHTOOL_A_CABLE_RESULT_CODE_OPEN,
ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT,
ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT,
+ /* detected reflection caused by the impedance discontinuity between
+ * a regular 100 Ohm cable and a part with the abnormal impedance value
+ */
+ ETHTOOL_A_CABLE_RESULT_CODE_IMPEDANCE_MISMATCH,
};
enum {
diff --git a/uapi/linux/if_link.h b/uapi/linux/if_link.h
index d17271f..ff4ceea 100644
--- a/uapi/linux/if_link.h
+++ b/uapi/linux/if_link.h
@@ -1503,6 +1503,7 @@ enum {
IFLA_BOND_AD_LACP_ACTIVE,
IFLA_BOND_MISSED_MAX,
IFLA_BOND_NS_IP6_TARGET,
+ IFLA_BOND_COUPLED_CONTROL,
__IFLA_BOND_MAX,
};
--
2.42.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH ethtool-next 1/2] update UAPI header copies
2024-04-16 20:37 ` [PATCH ethtool-next 1/2] update UAPI header copies Rahul Rameshbabu
@ 2024-04-17 7:55 ` Alexandra Winter
2024-04-17 17:53 ` Rahul Rameshbabu
2024-04-17 18:31 ` Keller, Jacob E
0 siblings, 2 replies; 13+ messages in thread
From: Alexandra Winter @ 2024-04-17 7:55 UTC (permalink / raw)
To: Rahul Rameshbabu, netdev
Cc: Vadim Fedorenko, Jacob Keller, Paolo Abeni, Jakub Kicinski,
David S. Miller, Eric Dumazet, Gal Pressman, Tariq Toukan,
Saeed Mahameed, Carolina Jubran, Cosmin Ratiu, Michal Kubecek
On 16.04.24 22:37, Rahul Rameshbabu wrote:
> Update to kernel commit 3e6d3f6f870e.
Maybe a user error on my side, but I cannot find a kernel commit with this number.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH ethtool-next 1/2] update UAPI header copies
2024-04-17 7:55 ` Alexandra Winter
@ 2024-04-17 17:53 ` Rahul Rameshbabu
2024-04-17 18:31 ` Keller, Jacob E
1 sibling, 0 replies; 13+ messages in thread
From: Rahul Rameshbabu @ 2024-04-17 17:53 UTC (permalink / raw)
To: Alexandra Winter
Cc: netdev, Vadim Fedorenko, Jacob Keller, Paolo Abeni,
Jakub Kicinski, David S. Miller, Eric Dumazet, Gal Pressman,
Tariq Toukan, Saeed Mahameed, Carolina Jubran, Cosmin Ratiu,
Michal Kubecek
On Wed, 17 Apr, 2024 09:55:57 +0200 Alexandra Winter <wintera@linux.ibm.com> wrote:
> On 16.04.24 22:37, Rahul Rameshbabu wrote:
>> Update to kernel commit 3e6d3f6f870e.
>
> Maybe a user error on my side, but I cannot find a kernel commit with this number.
Thanks for the catch. It's an issue on my end (accidentally applied my
ethtool changes when I actually generated the latest uapi commit). Will
fix this in my v2.
--
Thanks,
Rahul Rameshbabu
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH ethtool-next 1/2] update UAPI header copies
2024-04-17 7:55 ` Alexandra Winter
2024-04-17 17:53 ` Rahul Rameshbabu
@ 2024-04-17 18:31 ` Keller, Jacob E
1 sibling, 0 replies; 13+ messages in thread
From: Keller, Jacob E @ 2024-04-17 18:31 UTC (permalink / raw)
To: Alexandra Winter, Rahul Rameshbabu, netdev@vger.kernel.org
Cc: Vadim Fedorenko, Paolo Abeni, Jakub Kicinski, David S. Miller,
Eric Dumazet, Gal Pressman, Tariq Toukan, M, Saeed,
Carolina Jubran, Cosmin Ratiu, Michal Kubecek
> -----Original Message-----
> From: Alexandra Winter <wintera@linux.ibm.com>
> Sent: Wednesday, April 17, 2024 12:56 AM
> To: Rahul Rameshbabu <rrameshbabu@nvidia.com>; netdev@vger.kernel.org
> Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>; Keller, Jacob E
> <jacob.e.keller@intel.com>; Paolo Abeni <pabeni@redhat.com>; Jakub Kicinski
> <kuba@kernel.org>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Gal Pressman <gal@nvidia.com>; Tariq Toukan
> <tariqt@nvidia.com>; M, Saeed <saeedm@nvidia.com>; Carolina Jubran
> <cjubran@nvidia.com>; Cosmin Ratiu <cratiu@nvidia.com>; Michal Kubecek
> <mkubecek@suse.cz>
> Subject: Re: [PATCH ethtool-next 1/2] update UAPI header copies
>
>
>
> On 16.04.24 22:37, Rahul Rameshbabu wrote:
> > Update to kernel commit 3e6d3f6f870e.
>
> Maybe a user error on my side, but I cannot find a kernel commit with this number.
I can't find this commit in net-next either.
Thanks,
Jake
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support
2024-04-16 20:37 [PATCH ethtool-next 0/2] Userspace code for ethtool HW TS statistics Rahul Rameshbabu
2024-04-16 20:37 ` [PATCH ethtool-next 1/2] update UAPI header copies Rahul Rameshbabu
@ 2024-04-16 20:37 ` Rahul Rameshbabu
2024-04-16 22:08 ` Keller, Jacob E
2024-04-17 0:07 ` Jakub Kicinski
1 sibling, 2 replies; 13+ messages in thread
From: Rahul Rameshbabu @ 2024-04-16 20:37 UTC (permalink / raw)
To: netdev
Cc: Vadim Fedorenko, Jacob Keller, Paolo Abeni, Jakub Kicinski,
David S. Miller, Eric Dumazet, Gal Pressman, Tariq Toukan,
Saeed Mahameed, Carolina Jubran, Cosmin Ratiu, Michal Kubecek,
Rahul Rameshbabu
If stats flag is present, report back statistics for tsinfo if the netlink
response body contains statistics information.
Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
---
netlink/tsinfo.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)
diff --git a/netlink/tsinfo.c b/netlink/tsinfo.c
index c6571ff..ef5985a 100644
--- a/netlink/tsinfo.c
+++ b/netlink/tsinfo.c
@@ -5,6 +5,7 @@
*/
#include <errno.h>
+#include <inttypes.h>
#include <string.h>
#include <stdio.h>
@@ -15,6 +16,61 @@
/* TSINFO_GET */
+static int tsinfo_show_stats(const struct nlattr *nest)
+{
+ const struct nlattr *tb[ETHTOOL_A_TS_STAT_MAX + 1] = {};
+ DECLARE_ATTR_TB_INFO(tb);
+ static const struct {
+ unsigned int attr;
+ char *name;
+ } stats[] = {
+ { ETHTOOL_A_TS_STAT_TX_PKTS, "tx_pkts" },
+ { ETHTOOL_A_TS_STAT_TX_LOST, "tx_lost" },
+ { ETHTOOL_A_TS_STAT_TX_ERR, "tx_err" },
+ };
+ bool header = false;
+ bool is_u64 = false;
+ unsigned int i;
+ int ret;
+
+ ret = mnl_attr_parse_nested(nest, attr_cb, &tb_info);
+ if (ret < 0)
+ return ret;
+
+ open_json_object("statistics");
+ for (i = 0; i < ARRAY_SIZE(stats); i++) {
+ char fmt[64];
+
+ if (!tb[stats[i].attr])
+ continue;
+
+ if (!header && !is_json_context()) {
+ printf("Statistics:\n");
+ header = true;
+ }
+
+ if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
+ is_u64 = true;
+ if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
+ fprintf(stderr, "malformed netlink message (statistic)\n");
+ goto err_close_stats;
+ }
+ }
+
+ snprintf(fmt, sizeof(fmt), " %s: %%" PRIu64 "\n", stats[i].name);
+ print_u64(PRINT_ANY, stats[i].name, fmt,
+ is_u64 ? mnl_attr_get_u64(tb[stats[i].attr]) :
+ mnl_attr_get_u32(tb[stats[i].attr]));
+ }
+ close_json_object();
+
+ return 0;
+
+err_close_stats:
+ close_json_object();
+ return -1;
+}
+
static void tsinfo_dump_cb(unsigned int idx, const char *name, bool val,
void *data __maybe_unused)
{
@@ -99,6 +155,12 @@ int tsinfo_reply_cb(const struct nlmsghdr *nlhdr, void *data)
if (ret < 0)
return err_ret;
+ if (tb[ETHTOOL_A_TSINFO_STATS]) {
+ ret = tsinfo_show_stats(tb[ETHTOOL_A_TSINFO_STATS]);
+ if (ret < 0)
+ return err_ret;
+ }
+
return MNL_CB_OK;
}
@@ -106,6 +168,7 @@ int nl_tsinfo(struct cmd_context *ctx)
{
struct nl_context *nlctx = ctx->nlctx;
struct nl_socket *nlsk = nlctx->ethnl_socket;
+ u32 flags;
int ret;
if (netlink_cmd_check(ctx, ETHTOOL_MSG_TSINFO_GET, true))
@@ -116,8 +179,9 @@ int nl_tsinfo(struct cmd_context *ctx)
return 1;
}
+ flags = get_stats_flag(nlctx, ETHTOOL_MSG_TSINFO_GET, ETHTOOL_A_TSINFO_HEADER);
ret = nlsock_prep_get_request(nlsk, ETHTOOL_MSG_TSINFO_GET,
- ETHTOOL_A_TSINFO_HEADER, 0);
+ ETHTOOL_A_TSINFO_HEADER, flags);
if (ret < 0)
return ret;
return nlsock_send_get_request(nlsk, tsinfo_reply_cb);
--
2.42.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* RE: [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support
2024-04-16 20:37 ` [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support Rahul Rameshbabu
@ 2024-04-16 22:08 ` Keller, Jacob E
2024-04-17 0:07 ` Jakub Kicinski
1 sibling, 0 replies; 13+ messages in thread
From: Keller, Jacob E @ 2024-04-16 22:08 UTC (permalink / raw)
To: Rahul Rameshbabu, netdev@vger.kernel.org
Cc: Vadim Fedorenko, Paolo Abeni, Jakub Kicinski, David S. Miller,
Eric Dumazet, Gal Pressman, Tariq Toukan, M, Saeed,
Carolina Jubran, Cosmin Ratiu, Michal Kubecek
> -----Original Message-----
> From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Sent: Tuesday, April 16, 2024 1:37 PM
> To: netdev@vger.kernel.org
> Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>; Keller, Jacob E
> <jacob.e.keller@intel.com>; Paolo Abeni <pabeni@redhat.com>; Jakub Kicinski
> <kuba@kernel.org>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Gal Pressman <gal@nvidia.com>; Tariq Toukan
> <tariqt@nvidia.com>; M, Saeed <saeedm@nvidia.com>; Carolina Jubran
> <cjubran@nvidia.com>; Cosmin Ratiu <cratiu@nvidia.com>; Michal Kubecek
> <mkubecek@suse.cz>; Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Subject: [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support
>
> If stats flag is present, report back statistics for tsinfo if the netlink
> response body contains statistics information.
>
> Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
> Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
> Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Thanks! I'm hoping I can get to the Intel drivers soon.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support
2024-04-16 20:37 ` [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support Rahul Rameshbabu
2024-04-16 22:08 ` Keller, Jacob E
@ 2024-04-17 0:07 ` Jakub Kicinski
2024-04-17 1:25 ` Rahul Rameshbabu
1 sibling, 1 reply; 13+ messages in thread
From: Jakub Kicinski @ 2024-04-17 0:07 UTC (permalink / raw)
To: Rahul Rameshbabu
Cc: netdev, Vadim Fedorenko, Jacob Keller, Paolo Abeni,
David S. Miller, Eric Dumazet, Gal Pressman, Tariq Toukan,
Saeed Mahameed, Carolina Jubran, Cosmin Ratiu, Michal Kubecek
On Tue, 16 Apr 2024 13:37:17 -0700 Rahul Rameshbabu wrote:
> + if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
> + is_u64 = true;
> + if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
> + fprintf(stderr, "malformed netlink message (statistic)\n");
> + goto err_close_stats;
> + }
> + }
possibly cleaner:
__u64 val;
if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
val = mnl_attr_get_u32(tb[stats[i].attr]);
} else if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
val = mnl_attr_get_u64(tb[stats[i].attr]);
} else {
fprintf(stderr, "malformed netlink message (statistic)\n");
goto err_close_stats;
}
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support
2024-04-17 0:07 ` Jakub Kicinski
@ 2024-04-17 1:25 ` Rahul Rameshbabu
0 siblings, 0 replies; 13+ messages in thread
From: Rahul Rameshbabu @ 2024-04-17 1:25 UTC (permalink / raw)
To: Jakub Kicinski
Cc: netdev, Vadim Fedorenko, Jacob Keller, Paolo Abeni,
David S. Miller, Eric Dumazet, Gal Pressman, Tariq Toukan,
Saeed Mahameed, Carolina Jubran, Cosmin Ratiu, Michal Kubecek
On Tue, 16 Apr, 2024 17:07:42 -0700 Jakub Kicinski <kuba@kernel.org> wrote:
> On Tue, 16 Apr 2024 13:37:17 -0700 Rahul Rameshbabu wrote:
>> + if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
>> + is_u64 = true;
>> + if (mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
>> + fprintf(stderr, "malformed netlink message (statistic)\n");
>> + goto err_close_stats;
>> + }
>> + }
>
> possibly cleaner:
>
> __u64 val;
>
> if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U32)) {
> val = mnl_attr_get_u32(tb[stats[i].attr]);
> } else if (!mnl_attr_validate(tb[stats[i].attr], MNL_TYPE_U64)) {
> val = mnl_attr_get_u64(tb[stats[i].attr]);
> } else {
> fprintf(stderr, "malformed netlink message (statistic)\n");
> goto err_close_stats;
> }
I think this refactor is nice as well. Will wait 24 hours before
reposting but will send out a v2.
--
Thanks,
Rahul Rameshbabu
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH ethtool-next 0/2] Add support for PSE priority feature.
@ 2025-06-20 12:33 Kory Maincent
2025-06-20 12:33 ` [PATCH ethtool-next 1/2] update UAPI header copies Kory Maincent
0 siblings, 1 reply; 13+ messages in thread
From: Kory Maincent @ 2025-06-20 12:33 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Michal Kubecek
Cc: 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>
---
Kory Maincent (2):
update UAPI header copies
ethtool: pse-pd: Add PSE priority and event monitoring support
ethtool.8.in | 13 ++++
ethtool.c | 1 +
netlink/monitor.c | 8 ++
netlink/netlink.h | 1 +
netlink/pse-pd.c | 88 ++++++++++++++++++++++
uapi/linux/ethtool.h | 134 +++++++++++++++++----------------
uapi/linux/ethtool_netlink_generated.h | 59 +++++++++++++--
uapi/linux/if_link.h | 16 ++++
8 files changed, 250 insertions(+), 70 deletions(-)
---
base-commit: 64226907d0d6734bef5098eb343fd2194cd140e2
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] 13+ messages in thread* [PATCH ethtool-next 1/2] update UAPI header copies
2025-06-20 12:33 [PATCH ethtool-next 0/2] Add support for PSE priority feature Kory Maincent
@ 2025-06-20 12:33 ` Kory Maincent
0 siblings, 0 replies; 13+ messages in thread
From: Kory Maincent @ 2025-06-20 12:33 UTC (permalink / raw)
To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, Michal Kubecek
Cc: Kyle Swenson, Thomas Petazzoni, netdev, linux-kernel,
Kory Maincent
From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
Update to kernel commit 757639ac608e.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
uapi/linux/ethtool.h | 134 +++++++++++++++++----------------
uapi/linux/ethtool_netlink_generated.h | 59 +++++++++++++--
uapi/linux/if_link.h | 16 ++++
3 files changed, 139 insertions(+), 70 deletions(-)
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index 506e086..253df22 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -2293,71 +2293,75 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define RXH_XFRM_SYM_OR_XOR (1 << 1)
#define RXH_XFRM_NO_CHANGE 0xff
-/* L2-L4 network traffic flow types */
-#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
-#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
-#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
-#define AH_ESP_V4_FLOW 0x04 /* hash only */
-#define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */
-#define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */
-#define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */
-#define AH_ESP_V6_FLOW 0x08 /* hash only */
-#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
-#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
-#define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */
-#define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */
-#define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
-#define IP_USER_FLOW IPV4_USER_FLOW
-#define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */
-#define IPV4_FLOW 0x10 /* hash only */
-#define IPV6_FLOW 0x11 /* hash only */
-#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
-
-/* Used for GTP-U IPv4 and IPv6.
- * The format of GTP packets only includes
- * elements such as TEID and GTP version.
- * It is primarily intended for data communication of the UE.
- */
-#define GTPU_V4_FLOW 0x13 /* hash only */
-#define GTPU_V6_FLOW 0x14 /* hash only */
-
-/* Use for GTP-C IPv4 and v6.
- * The format of these GTP packets does not include TEID.
- * Primarily expected to be used for communication
- * to create sessions for UE data communication,
- * commonly referred to as CSR (Create Session Request).
- */
-#define GTPC_V4_FLOW 0x15 /* hash only */
-#define GTPC_V6_FLOW 0x16 /* hash only */
-
-/* Use for GTP-C IPv4 and v6.
- * Unlike GTPC_V4_FLOW, the format of these GTP packets includes TEID.
- * After session creation, it becomes this packet.
- * This is mainly used for requests to realize UE handover.
- */
-#define GTPC_TEID_V4_FLOW 0x17 /* hash only */
-#define GTPC_TEID_V6_FLOW 0x18 /* hash only */
-
-/* Use for GTP-U and extended headers for the PSC (PDU Session Container).
- * The format of these GTP packets includes TEID and QFI.
- * In 5G communication using UPF (User Plane Function),
- * data communication with this extended header is performed.
- */
-#define GTPU_EH_V4_FLOW 0x19 /* hash only */
-#define GTPU_EH_V6_FLOW 0x1a /* hash only */
-
-/* Use for GTP-U IPv4 and v6 PSC (PDU Session Container) extended headers.
- * This differs from GTPU_EH_V(4|6)_FLOW in that it is distinguished by
- * UL/DL included in the PSC.
- * There are differences in the data included based on Downlink/Uplink,
- * and can be used to distinguish packets.
- * The functions described so far are useful when you want to
- * handle communication from the mobile network in UPF, PGW, etc.
- */
-#define GTPU_UL_V4_FLOW 0x1b /* hash only */
-#define GTPU_UL_V6_FLOW 0x1c /* hash only */
-#define GTPU_DL_V4_FLOW 0x1d /* hash only */
-#define GTPU_DL_V6_FLOW 0x1e /* hash only */
+enum {
+ /* L2-L4 network traffic flow types */
+ TCP_V4_FLOW = 0x01, /* hash or spec (tcp_ip4_spec) */
+ UDP_V4_FLOW = 0x02, /* hash or spec (udp_ip4_spec) */
+ SCTP_V4_FLOW = 0x03, /* hash or spec (sctp_ip4_spec) */
+ AH_ESP_V4_FLOW = 0x04, /* hash only */
+ TCP_V6_FLOW = 0x05, /* hash or spec (tcp_ip6_spec; nfc only) */
+ UDP_V6_FLOW = 0x06, /* hash or spec (udp_ip6_spec; nfc only) */
+ SCTP_V6_FLOW = 0x07, /* hash or spec (sctp_ip6_spec; nfc only) */
+ AH_ESP_V6_FLOW = 0x08, /* hash only */
+ AH_V4_FLOW = 0x09, /* hash or spec (ah_ip4_spec) */
+ ESP_V4_FLOW = 0x0a, /* hash or spec (esp_ip4_spec) */
+ AH_V6_FLOW = 0x0b, /* hash or spec (ah_ip6_spec; nfc only) */
+ ESP_V6_FLOW = 0x0c, /* hash or spec (esp_ip6_spec; nfc only) */
+ IPV4_USER_FLOW = 0x0d, /* spec only (usr_ip4_spec) */
+ IP_USER_FLOW = IPV4_USER_FLOW,
+ 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) */
+
+ /* Used for GTP-U IPv4 and IPv6.
+ * The format of GTP packets only includes
+ * elements such as TEID and GTP version.
+ * It is primarily intended for data communication of the UE.
+ */
+ GTPU_V4_FLOW = 0x13, /* hash only */
+ GTPU_V6_FLOW = 0x14, /* hash only */
+
+ /* Use for GTP-C IPv4 and v6.
+ * The format of these GTP packets does not include TEID.
+ * Primarily expected to be used for communication
+ * to create sessions for UE data communication,
+ * commonly referred to as CSR (Create Session Request).
+ */
+ GTPC_V4_FLOW = 0x15, /* hash only */
+ GTPC_V6_FLOW = 0x16, /* hash only */
+
+ /* Use for GTP-C IPv4 and v6.
+ * Unlike GTPC_V4_FLOW, the format of these GTP packets includes TEID.
+ * After session creation, it becomes this packet.
+ * This is mainly used for requests to realize UE handover.
+ */
+ GTPC_TEID_V4_FLOW = 0x17, /* hash only */
+ GTPC_TEID_V6_FLOW = 0x18, /* hash only */
+
+ /* Use for GTP-U and extended headers for the PSC (PDU Session Container).
+ * The format of these GTP packets includes TEID and QFI.
+ * In 5G communication using UPF (User Plane Function),
+ * data communication with this extended header is performed.
+ */
+ GTPU_EH_V4_FLOW = 0x19, /* hash only */
+ GTPU_EH_V6_FLOW = 0x1a, /* hash only */
+
+ /* Use for GTP-U IPv4 and v6 PSC (PDU Session Container) extended headers.
+ * This differs from GTPU_EH_V(4|6)_FLOW in that it is distinguished by
+ * UL/DL included in the PSC.
+ * There are differences in the data included based on Downlink/Uplink,
+ * and can be used to distinguish packets.
+ * The functions described so far are useful when you want to
+ * handle communication from the mobile network in UPF, PGW, etc.
+ */
+ GTPU_UL_V4_FLOW = 0x1b, /* hash only */
+ GTPU_UL_V6_FLOW = 0x1c, /* hash only */
+ GTPU_DL_V4_FLOW = 0x1d, /* hash only */
+ GTPU_DL_V6_FLOW = 0x1e, /* hash only */
+
+ __FLOW_TYPE_COUNT,
+};
/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
#define FLOW_EXT 0x80000000
diff --git a/uapi/linux/ethtool_netlink_generated.h b/uapi/linux/ethtool_netlink_generated.h
index fa0522b..c06721f 100644
--- a/uapi/linux/ethtool_netlink_generated.h
+++ b/uapi/linux/ethtool_netlink_generated.h
@@ -31,17 +31,52 @@ enum ethtool_header_flags {
ETHTOOL_FLAG_STATS = 4,
};
-enum {
- ETHTOOL_PHY_UPSTREAM_TYPE_MAC,
- ETHTOOL_PHY_UPSTREAM_TYPE_PHY,
-};
-
enum ethtool_tcp_data_split {
ETHTOOL_TCP_DATA_SPLIT_UNKNOWN,
ETHTOOL_TCP_DATA_SPLIT_DISABLED,
ETHTOOL_TCP_DATA_SPLIT_ENABLED,
};
+/**
+ * enum hwtstamp_source - Source of the hardware timestamp
+ * @HWTSTAMP_SOURCE_NETDEV: Hardware timestamp comes from a MAC or a device
+ * which has MAC and PHY integrated
+ * @HWTSTAMP_SOURCE_PHYLIB: Hardware timestamp comes from one PHY device of the
+ * network topology
+ */
+enum hwtstamp_source {
+ HWTSTAMP_SOURCE_NETDEV = 1,
+ 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
+ */
+enum ethtool_pse_event {
+ ETHTOOL_PSE_EVENT_OVER_CURRENT = 1,
+ ETHTOOL_PSE_EVENT_OVER_TEMP = 2,
+ ETHTOOL_C33_PSE_EVENT_DETECTION = 4,
+ ETHTOOL_C33_PSE_EVENT_CLASSIFICATION = 8,
+ ETHTOOL_C33_PSE_EVENT_DISCONNECTION = 16,
+ ETHTOOL_PSE_EVENT_OVER_BUDGET = 32,
+ ETHTOOL_PSE_EVENT_SW_PW_CONTROL_ERROR = 64,
+};
+
enum {
ETHTOOL_A_HEADER_UNSPEC,
ETHTOOL_A_HEADER_DEV_INDEX,
@@ -406,6 +441,8 @@ enum {
ETHTOOL_A_TSINFO_PHC_INDEX,
ETHTOOL_A_TSINFO_STATS,
ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER,
+ ETHTOOL_A_TSINFO_HWTSTAMP_SOURCE,
+ ETHTOOL_A_TSINFO_HWTSTAMP_PHYINDEX,
__ETHTOOL_A_TSINFO_CNT,
ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1)
@@ -633,6 +670,9 @@ enum {
ETHTOOL_A_C33_PSE_EXT_SUBSTATE,
ETHTOOL_A_C33_PSE_AVAIL_PW_LIMIT,
ETHTOOL_A_C33_PSE_PW_LIMIT_RANGES,
+ ETHTOOL_A_PSE_PW_D_ID,
+ ETHTOOL_A_PSE_PRIO_MAX,
+ ETHTOOL_A_PSE_PRIO,
__ETHTOOL_A_PSE_CNT,
ETHTOOL_A_PSE_MAX = (__ETHTOOL_A_PSE_CNT - 1)
@@ -709,6 +749,14 @@ enum {
ETHTOOL_A_TSCONFIG_MAX = (__ETHTOOL_A_TSCONFIG_CNT - 1)
};
+enum {
+ ETHTOOL_A_PSE_NTF_HEADER = 1,
+ ETHTOOL_A_PSE_NTF_EVENTS,
+
+ __ETHTOOL_A_PSE_NTF_CNT,
+ ETHTOOL_A_PSE_NTF_MAX = (__ETHTOOL_A_PSE_NTF_CNT - 1)
+};
+
enum {
ETHTOOL_MSG_USER_NONE = 0,
ETHTOOL_MSG_STRSET_GET = 1,
@@ -813,6 +861,7 @@ enum {
ETHTOOL_MSG_PHY_NTF,
ETHTOOL_MSG_TSCONFIG_GET_REPLY,
ETHTOOL_MSG_TSCONFIG_SET_REPLY,
+ ETHTOOL_MSG_PSE_NTF,
__ETHTOOL_MSG_KERNEL_CNT,
ETHTOOL_MSG_KERNEL_MAX = (__ETHTOOL_MSG_KERNEL_CNT - 1)
diff --git a/uapi/linux/if_link.h b/uapi/linux/if_link.h
index ceff2f2..cdb5acc 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)
@@ -1984,4 +1985,19 @@ enum {
#define IFLA_DSA_MAX (__IFLA_DSA_MAX - 1)
+/* OVPN section */
+
+enum ovpn_mode {
+ OVPN_MODE_P2P,
+ OVPN_MODE_MP,
+};
+
+enum {
+ IFLA_OVPN_UNSPEC,
+ IFLA_OVPN_MODE,
+ __IFLA_OVPN_MAX,
+};
+
+#define IFLA_OVPN_MAX (__IFLA_OVPN_MAX - 1)
+
#endif /* _LINUX_IF_LINK_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [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
0 siblings, 1 reply; 13+ 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] 13+ 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
0 siblings, 0 replies; 13+ 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] 13+ messages in thread
* [PATCH ethtool-next 0/2] add support for PLCA RS
@ 2023-01-04 14:08 Piergiorgio Beruto
2023-01-04 14:08 ` [PATCH ethtool-next 1/2] update UAPI header copies Piergiorgio Beruto
0 siblings, 1 reply; 13+ messages in thread
From: Piergiorgio Beruto @ 2023-01-04 14:08 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: linux-kernel, netdev, Oleksij Rempel
This patch adds support for the IEEE802.3cg-2019 Clause 148 PLCA
Reconciliation Sublayer. It adds get/set configuration and get status
functions. Additionally, shows PLCA capabilities and status when invoked
without arguments.
Piergiorgio Beruto (2):
update UAPI header copies
add support for IEEE 802.3cg-2019 Clause 148 - PLCA RS
Makefile.am | 1 +
ethtool.c | 21 +++
netlink/extapi.h | 6 +
netlink/plca.c | 295 +++++++++++++++++++++++++++++++++++
netlink/settings.c | 86 +++++++++-
uapi/linux/ethtool.h | 3 +
uapi/linux/ethtool_netlink.h | 39 +++++
uapi/linux/net_tstamp.h | 3 +-
8 files changed, 451 insertions(+), 3 deletions(-)
create mode 100644 netlink/plca.c
--
2.37.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH ethtool-next 1/2] update UAPI header copies
2023-01-04 14:08 [PATCH ethtool-next 0/2] add support for PLCA RS Piergiorgio Beruto
@ 2023-01-04 14:08 ` Piergiorgio Beruto
0 siblings, 0 replies; 13+ messages in thread
From: Piergiorgio Beruto @ 2023-01-04 14:08 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: linux-kernel, netdev, Oleksij Rempel
Update to kernel commit d6ffe9c0296b.
Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
---
uapi/linux/ethtool.h | 3 +++
uapi/linux/ethtool_netlink.h | 39 ++++++++++++++++++++++++++++++++++++
uapi/linux/net_tstamp.h | 3 ++-
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index d1748702bddc..78bf6fad9e02 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -1739,6 +1739,9 @@ enum ethtool_link_mode_bit_indices {
ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96,
ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97,
ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98,
+ ETHTOOL_LINK_MODE_10baseT1S_Full_BIT = 99,
+ ETHTOOL_LINK_MODE_10baseT1S_Half_BIT = 100,
+ ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT = 101,
/* must be last entry */
__ETHTOOL_LINK_MODE_MASK_NBITS
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h
index d581c43d592d..a6d899cd7f3a 100644
--- a/uapi/linux/ethtool_netlink.h
+++ b/uapi/linux/ethtool_netlink.h
@@ -51,6 +51,10 @@ enum {
ETHTOOL_MSG_MODULE_SET,
ETHTOOL_MSG_PSE_GET,
ETHTOOL_MSG_PSE_SET,
+ ETHTOOL_MSG_RSS_GET,
+ ETHTOOL_MSG_PLCA_GET_CFG,
+ ETHTOOL_MSG_PLCA_SET_CFG,
+ ETHTOOL_MSG_PLCA_GET_STATUS,
/* add new constants above here */
__ETHTOOL_MSG_USER_CNT,
@@ -97,6 +101,10 @@ enum {
ETHTOOL_MSG_MODULE_GET_REPLY,
ETHTOOL_MSG_MODULE_NTF,
ETHTOOL_MSG_PSE_GET_REPLY,
+ ETHTOOL_MSG_RSS_GET_REPLY,
+ ETHTOOL_MSG_PLCA_GET_CFG_REPLY,
+ ETHTOOL_MSG_PLCA_GET_STATUS_REPLY,
+ ETHTOOL_MSG_PLCA_NTF,
/* add new constants above here */
__ETHTOOL_MSG_KERNEL_CNT,
@@ -880,6 +888,37 @@ enum {
ETHTOOL_A_PSE_MAX = (__ETHTOOL_A_PSE_CNT - 1)
};
+enum {
+ ETHTOOL_A_RSS_UNSPEC,
+ ETHTOOL_A_RSS_HEADER,
+ ETHTOOL_A_RSS_CONTEXT, /* u32 */
+ ETHTOOL_A_RSS_HFUNC, /* u32 */
+ ETHTOOL_A_RSS_INDIR, /* binary */
+ ETHTOOL_A_RSS_HKEY, /* binary */
+
+ __ETHTOOL_A_RSS_CNT,
+ ETHTOOL_A_RSS_MAX = (__ETHTOOL_A_RSS_CNT - 1),
+};
+
+/* PLCA */
+
+enum {
+ ETHTOOL_A_PLCA_UNSPEC,
+ ETHTOOL_A_PLCA_HEADER, /* nest - _A_HEADER_* */
+ ETHTOOL_A_PLCA_VERSION, /* u16 */
+ ETHTOOL_A_PLCA_ENABLED, /* u8 */
+ ETHTOOL_A_PLCA_STATUS, /* u8 */
+ ETHTOOL_A_PLCA_NODE_CNT, /* u32 */
+ ETHTOOL_A_PLCA_NODE_ID, /* u32 */
+ ETHTOOL_A_PLCA_TO_TMR, /* u32 */
+ ETHTOOL_A_PLCA_BURST_CNT, /* u32 */
+ ETHTOOL_A_PLCA_BURST_TMR, /* u32 */
+
+ /* add new constants above here */
+ __ETHTOOL_A_PLCA_CNT,
+ ETHTOOL_A_PLCA_MAX = (__ETHTOOL_A_PLCA_CNT - 1)
+};
+
/* generic netlink info */
#define ETHTOOL_GENL_NAME "ethtool"
#define ETHTOOL_GENL_VERSION 1
diff --git a/uapi/linux/net_tstamp.h b/uapi/linux/net_tstamp.h
index 55501e5e7ac8..a2c66b3d7f0f 100644
--- a/uapi/linux/net_tstamp.h
+++ b/uapi/linux/net_tstamp.h
@@ -31,8 +31,9 @@ enum {
SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13),
SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14),
SOF_TIMESTAMPING_BIND_PHC = (1 << 15),
+ SOF_TIMESTAMPING_OPT_ID_TCP = (1 << 16),
- SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_BIND_PHC,
+ SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_ID_TCP,
SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
SOF_TIMESTAMPING_LAST
};
--
2.37.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH ethtool-next 1/2] update UAPI header copies
@ 2022-12-05 1:58 Piergiorgio Beruto
0 siblings, 0 replies; 13+ messages in thread
From: Piergiorgio Beruto @ 2022-12-05 1:58 UTC (permalink / raw)
To: Michal Kubecek, Andrew Lunn, Heiner Kallweit, Russell King,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: linux-kernel, netdev, Oleksij Rempel
Update to kernel commit b71fb5b0b802.
Signed-off-by: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
---
uapi/linux/ethtool.h | 3 +++
uapi/linux/ethtool_netlink.h | 25 +++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/uapi/linux/ethtool.h b/uapi/linux/ethtool.h
index d1748702bddc..78bf6fad9e02 100644
--- a/uapi/linux/ethtool.h
+++ b/uapi/linux/ethtool.h
@@ -1739,6 +1739,9 @@ enum ethtool_link_mode_bit_indices {
ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96,
ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97,
ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98,
+ ETHTOOL_LINK_MODE_10baseT1S_Full_BIT = 99,
+ ETHTOOL_LINK_MODE_10baseT1S_Half_BIT = 100,
+ ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT = 101,
/* must be last entry */
__ETHTOOL_LINK_MODE_MASK_NBITS
diff --git a/uapi/linux/ethtool_netlink.h b/uapi/linux/ethtool_netlink.h
index d581c43d592d..11a0efbf815c 100644
--- a/uapi/linux/ethtool_netlink.h
+++ b/uapi/linux/ethtool_netlink.h
@@ -51,6 +51,9 @@ enum {
ETHTOOL_MSG_MODULE_SET,
ETHTOOL_MSG_PSE_GET,
ETHTOOL_MSG_PSE_SET,
+ ETHTOOL_MSG_PLCA_GET_CFG,
+ ETHTOOL_MSG_PLCA_SET_CFG,
+ ETHTOOL_MSG_PLCA_GET_STATUS,
/* add new constants above here */
__ETHTOOL_MSG_USER_CNT,
@@ -97,6 +100,9 @@ enum {
ETHTOOL_MSG_MODULE_GET_REPLY,
ETHTOOL_MSG_MODULE_NTF,
ETHTOOL_MSG_PSE_GET_REPLY,
+ ETHTOOL_MSG_PLCA_GET_CFG_REPLY,
+ ETHTOOL_MSG_PLCA_GET_STATUS_REPLY,
+ ETHTOOL_MSG_PLCA_NTF,
/* add new constants above here */
__ETHTOOL_MSG_KERNEL_CNT,
@@ -880,6 +886,25 @@ enum {
ETHTOOL_A_PSE_MAX = (__ETHTOOL_A_PSE_CNT - 1)
};
+/* PLCA */
+
+enum {
+ ETHTOOL_A_PLCA_UNSPEC,
+ ETHTOOL_A_PLCA_HEADER, /* nest - _A_HEADER_* */
+ ETHTOOL_A_PLCA_VERSION, /* u16 */
+ ETHTOOL_A_PLCA_ENABLED, /* u8 */
+ ETHTOOL_A_PLCA_STATUS, /* u8 */
+ ETHTOOL_A_PLCA_NODE_CNT, /* u8 */
+ ETHTOOL_A_PLCA_NODE_ID, /* u8 */
+ ETHTOOL_A_PLCA_TO_TMR, /* u8 */
+ ETHTOOL_A_PLCA_BURST_CNT, /* u8 */
+ ETHTOOL_A_PLCA_BURST_TMR, /* u8 */
+
+ /* add new constants above here */
+ __ETHTOOL_A_PLCA_CNT,
+ ETHTOOL_A_PLCA_MAX = (__ETHTOOL_A_PLCA_CNT - 1)
+};
+
/* generic netlink info */
#define ETHTOOL_GENL_NAME "ethtool"
#define ETHTOOL_GENL_VERSION 1
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-06-20 12:33 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-16 20:37 [PATCH ethtool-next 0/2] Userspace code for ethtool HW TS statistics Rahul Rameshbabu
2024-04-16 20:37 ` [PATCH ethtool-next 1/2] update UAPI header copies Rahul Rameshbabu
2024-04-17 7:55 ` Alexandra Winter
2024-04-17 17:53 ` Rahul Rameshbabu
2024-04-17 18:31 ` Keller, Jacob E
2024-04-16 20:37 ` [PATCH ethtool-next 2/2] netlink: tsinfo: add statistics support Rahul Rameshbabu
2024-04-16 22:08 ` Keller, Jacob E
2024-04-17 0:07 ` Jakub Kicinski
2024-04-17 1:25 ` Rahul Rameshbabu
-- strict thread matches above, loose matches on Subject: below --
2025-06-20 12:33 [PATCH ethtool-next 0/2] Add support for PSE priority feature Kory Maincent
2025-06-20 12:33 ` [PATCH ethtool-next 1/2] update UAPI header copies Kory Maincent
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
2023-01-04 14:08 [PATCH ethtool-next 0/2] add support for PLCA RS Piergiorgio Beruto
2023-01-04 14:08 ` [PATCH ethtool-next 1/2] update UAPI header copies Piergiorgio Beruto
2022-12-05 1:58 Piergiorgio Beruto
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).