Thread (9 messages) 9 messages, 2 authors, 2024-12-06

Re: [PATCH net-next v20 4/6] net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology

From: Simon Horman <horms@kernel.org>
Date: 2024-12-06 14:27:24
Also in: linux-doc, lkml

On Wed, Dec 04, 2024 at 03:44:45PM +0100, Kory Maincent wrote:
Either the MAC or the PHY can provide hwtstamp, so we should be able to
read the tsinfo for any hwtstamp provider.

Enhance 'get' command to retrieve tsinfo of hwtstamp providers within a
network topology.

Add support for a specific dump command to retrieve all hwtstamp
providers within the network topology, with added functionality for
filtered dump to target a single interface.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
...
quoted hunk ↗ jump to hunk
diff --git a/net/ethtool/ts.h b/net/ethtool/ts.h
new file mode 100644
index 000000000000..b7665dd4330d
--- /dev/null
+++ b/net/ethtool/ts.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _NET_ETHTOOL_TS_H
+#define _NET_ETHTOOL_TS_H
+
+#include "netlink.h"
+
+static const struct nla_policy
+ethnl_ts_hwtst_prov_policy[ETHTOOL_A_TS_HWTSTAMP_PROVIDER_MAX + 1] = {
+	[ETHTOOL_A_TS_HWTSTAMP_PROVIDER_INDEX] =
+		NLA_POLICY_MIN(NLA_S32, 0),
+	[ETHTOOL_A_TS_HWTSTAMP_PROVIDER_QUALIFIER] =
+		NLA_POLICY_MAX(NLA_U32, HWTSTAMP_PROVIDER_QUALIFIER_CNT - 1)
+};
Hi Kory,

It looks like ethnl_ts_hwtst_prov_policy is only used in tsinfo.c and could
be moved into that file. That would avoid a separate copy for each file
that includes ts.h and the following warning flagged by gcc-14 W=1 builds
with patch 5/6 applied.

  CC      net/ethtool/tsconfig.o
In file included from net/ethtool/tsconfig.c:10:
net/ethtool/ts.h:9:1: warning: 'ethnl_ts_hwtst_prov_policy' defined but not used [-Wunused-const-variable=]
    9 | ethnl_ts_hwtst_prov_policy[ETHTOOL_A_TS_HWTSTAMP_PROVIDER_MAX + 1] = {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
+
+int ts_parse_hwtst_provider(const struct nlattr *nest,
+			    struct hwtstamp_provider_desc *hwprov_desc,
+			    struct netlink_ext_ack *extack,
+			    bool *mod);
+
+#endif /* _NET_ETHTOOL_TS_H */
...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help