new file mode 100644
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Userspace API for synchronous ethernet configuration
+ *
+ * Copyright (C) 2021 Intel Corporation
+ * Author: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
+ *
+ */
+#ifndef _NET_SYNCE_H
+#define _NET_SYNCE_H
+#include <linux/types.h>
+
+/*
+ * Structure used for passing data with SIOCSSYNCE and SIOCGSYNCE ioctls
+ */
+struct synce_ref_clk_cfg {
+ __u8 pin_id;
+ _Bool enable;
+};
+
+#endif /* _NET_SYNCE_H */
@@ -153,6 +153,10 @@
#define SIOCSHWTSTAMP 0x89b0 /* set and get config */
#define SIOCGHWTSTAMP 0x89b1 /* get config */
+/* synchronous ethernet config per physical function */
+#define SIOCSSYNCE 0x89c0 /* set and get config */
+#define SIOCGSYNCE 0x89c1 /* get config */
+
/* Device private ioctl calls */
/*
@@ -406,7 +406,9 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data,
cmd == SIOCGMIIREG ||
cmd == SIOCSMIIREG ||
cmd == SIOCSHWTSTAMP ||
- cmd == SIOCGHWTSTAMP) {
+ cmd == SIOCGHWTSTAMP ||
+ cmd == SIOCSSYNCE ||
+ cmd == SIOCGSYNCE) {
err = dev_eth_ioctl(dev, ifr, cmd);
} else if (cmd == SIOCBONDENSLAVE ||
cmd == SIOCBONDRELEASE ||
@@ -577,6 +579,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr,
case SIOCBRADDIF:
case SIOCBRDELIF:
case SIOCSHWTSTAMP:
+ case SIOCSSYNCE:
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;
fallthrough;
@@ -605,6 +608,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr,
default:
if (cmd == SIOCWANDEV ||
cmd == SIOCGHWTSTAMP ||
+ cmd == SIOCGSYNCE ||
(cmd >= SIOCDEVPRIVATE &&
cmd <= SIOCDEVPRIVATE + 15)) {
dev_load(net, ifr->ifr_name);
Previously there was no similar interface. It is required for configuration of Synchronous Ethernet (SyncE). User must be able to enable or disable propagation of its PHY recovered clock signal onto available output pin. This allows the signal to be used as frequency reference signal for different hardware chips. Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> --- include/uapi/linux/net_synce.h | 21 +++++++++++++++++++++ include/uapi/linux/sockios.h | 4 ++++ net/core/dev_ioctl.c | 6 +++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 include/uapi/linux/net_synce.h