History

net: ethtool: Add generic parts of cable test TDR

Add the generic parts of the code used to trigger a cable test and return raw TDR data. Any PHY driver which support this must implement the new driver op. Signed-off-by: Andrew Lunn <andrew@lunn.ch> v2 Update nxp-tja11xx for API change.

Andrew Lunn committed 6 years ago

Commit 1a644de1 parent a3311727 files · +144 −10Browse files

Showing the changes to include/linux (2 of 7 files). Show all

Unified · Split

2 files
  1. include/linux/ethtool_netlink.h +2 −2
  2. include/linux/phy.h +13 −0
include/linux/ethtool_netlink.h+2−2
@@ -17,13 +17,13 @@ enum ethtool_multicast_groups { · 16 unmodified lines
17struct phy_device;17struct phy_device;
18 18
19#if IS_ENABLED(CONFIG_ETHTOOL_NETLINK)19#if IS_ENABLED(CONFIG_ETHTOOL_NETLINK)
20int ethnl_cable_test_alloc(struct phy_device *phydev);20int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd);
21void ethnl_cable_test_free(struct phy_device *phydev);21void ethnl_cable_test_free(struct phy_device *phydev);
22void ethnl_cable_test_finished(struct phy_device *phydev);22void ethnl_cable_test_finished(struct phy_device *phydev);
23int ethnl_cable_test_result(struct phy_device *phydev, u8 pair, u8 result);23int ethnl_cable_test_result(struct phy_device *phydev, u8 pair, u8 result);
24int ethnl_cable_test_fault_length(struct phy_device *phydev, u8 pair, u32 cm);24int ethnl_cable_test_fault_length(struct phy_device *phydev, u8 pair, u32 cm);
25#else25#else
26static inline int ethnl_cable_test_alloc(struct phy_device *phydev)26static inline int ethnl_cable_test_alloc(struct phy_device *phydev, u8 cmd)
27{27{
28 return -EOPNOTSUPP;28 return -EOPNOTSUPP;
29}29}
include/linux/phy.h+13−0
@@ -699,6 +699,10 @@ struct phy_driver { · 698 unmodified lines
699 699
700 /* Start a cable test */700 /* Start a cable test */
701 int (*cable_test_start)(struct phy_device *dev);701 int (*cable_test_start)(struct phy_device *dev);
702
703 /* Start a raw TDR cable test */
704 int (*cable_test_tdr_start)(struct phy_device *dev);
705
702 /* Once per second, or on interrupt, request the status of the706 /* Once per second, or on interrupt, request the status of the
703 * test.707 * test.
704 */708 */
@@ -1251,6 +1255,8 @@ int phy_reset_after_clk_enable(struct phy_device *phydev); · 546 unmodified lines
1251#if IS_ENABLED(CONFIG_PHYLIB)1255#if IS_ENABLED(CONFIG_PHYLIB)
1252int phy_start_cable_test(struct phy_device *phydev,1256int phy_start_cable_test(struct phy_device *phydev,
1253 struct netlink_ext_ack *extack);1257 struct netlink_ext_ack *extack);
1258int phy_start_cable_test_tdr(struct phy_device *phydev,
1259 struct netlink_ext_ack *extack);
1254#else1260#else
1255static inline1261static inline
1256int phy_start_cable_test(struct phy_device *phydev,1262int phy_start_cable_test(struct phy_device *phydev,
@@ -1259,6 +1265,13 @@ int phy_start_cable_test(struct phy_device *phydev, · 2 unmodified lines
1259 NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support");1265 NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support");
1260 return -EOPNOTSUPP;1266 return -EOPNOTSUPP;
1261}1267}
1268static inline
1269int phy_start_cable_test_tdr(struct phy_device *phydev,
1270 struct netlink_ext_ack *extack)
1271{
1272 NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support");
1273 return -EOPNOTSUPP;
1274}
1262#endif1275#endif
1263 1276
1264int phy_cable_test_result(struct phy_device *phydev, u8 pair, u16 result);1277int phy_cable_test_result(struct phy_device *phydev, u8 pair, u16 result);