summaryrefslogtreecommitdiff
path: root/include/linux/phy.h
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2020-05-27 00:21:41 +0200
committerDavid S. Miller <davem@davemloft.net>2020-05-26 23:22:21 -0700
commitf2bc8ad31a7f814237bc6301d59296d76505a688 (patch)
tree738fb4f9aa7157772793f5c7c5febbedb6d828f4 /include/linux/phy.h
parent0c9bcc1d2394acef2c6e89e652d984cc845c7bea (diff)
net: ethtool: Allow PHY cable test TDR data to configured
Allow the user to configure where on the cable the TDR data should be retrieved, in terms of first and last sample, and the step between samples. Also add the ability to ask for TDR data for just one pair. If this configuration is not provided, it defaults to 1-150m at 1m intervals for all pairs. Signed-off-by: Andrew Lunn <andrew@lunn.ch> v3: Move the TDR configuration into a structure Add a range check on step Use NL_SET_ERR_MSG_ATTR() when appropriate Move TDR configuration into a nest Document attributes in the request Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/phy.h')
-rw-r--r--include/linux/phy.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d3c384f353ca..8c05d0fb5c00 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -548,6 +548,18 @@ struct phy_device {
#define to_phy_device(d) container_of(to_mdio_device(d), \
struct phy_device, mdio)
+/* A structure containing possible configuration parameters
+ * for a TDR cable test. The driver does not need to implement
+ * all the parameters, but should report what is actually used.
+ */
+struct phy_tdr_config {
+ u32 first;
+ u32 last;
+ u32 step;
+ s8 pair;
+};
+#define PHY_PAIR_ALL -1
+
/* struct phy_driver: Driver structure for a particular PHY type
*
* driver_data: static driver data
@@ -701,7 +713,8 @@ struct phy_driver {
int (*cable_test_start)(struct phy_device *dev);
/* Start a raw TDR cable test */
- int (*cable_test_tdr_start)(struct phy_device *dev);
+ int (*cable_test_tdr_start)(struct phy_device *dev,
+ const struct phy_tdr_config *config);
/* Once per second, or on interrupt, request the status of the
* test.
@@ -1256,7 +1269,8 @@ int phy_reset_after_clk_enable(struct phy_device *phydev);
int phy_start_cable_test(struct phy_device *phydev,
struct netlink_ext_ack *extack);
int phy_start_cable_test_tdr(struct phy_device *phydev,
- struct netlink_ext_ack *extack);
+ struct netlink_ext_ack *extack,
+ const struct phy_tdr_config *config);
#else
static inline
int phy_start_cable_test(struct phy_device *phydev,
@@ -1267,7 +1281,8 @@ int phy_start_cable_test(struct phy_device *phydev,
}
static inline
int phy_start_cable_test_tdr(struct phy_device *phydev,
- struct netlink_ext_ack *extack)
+ struct netlink_ext_ack *extack,
+ const struct phy_tdr_config *config)
{
NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support");
return -EOPNOTSUPP;