@@ -13,7 +13,7 @@
*/
const char *phy_speed_to_str(int speed)
{
- BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 92,
+ BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 98,
"Enum ethtool_link_mode_bit_indices and phylib are out of sync. "
"If a speed or mode has been added please update phy_speed_to_str "
"and the PHY settings array.\n");
@@ -1619,6 +1619,15 @@ enum ethtool_link_mode_bit_indices {
ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89,
ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90,
ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91,
+
+ /* CAN specific capabilities */
+ ETHTOOL_LINK_MODE_CAN_SW_BIT = 92,
+ ETHTOOL_LINK_MODE_CAN_LS_BIT = 93,
+ ETHTOOL_LINK_MODE_CAN_HS_BIT = 94,
+ ETHTOOL_LINK_MODE_CAN_FD_BIT = 95,
+ ETHTOOL_LINK_MODE_CAN_SIC_BIT = 96,
+ ETHTOOL_LINK_MODE_CAN_SIC_XL_BIT = 97,
+
/* must be last entry */
__ETHTOOL_LINK_MODE_MASK_NBITS
};
@@ -194,6 +194,13 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {
__DEFINE_LINK_MODE_NAME(400000, CR4, Full),
__DEFINE_LINK_MODE_NAME(100, FX, Half),
__DEFINE_LINK_MODE_NAME(100, FX, Full),
+
+ __DEFINE_SPECIAL_MODE_NAME(CAN_SW, "Single-wire CAN"), /* SAE J2411 */
+ __DEFINE_SPECIAL_MODE_NAME(CAN_LS, "CAN low-speed"), /* ISO 11898-3 (aka. Fault tolerant) */
+ __DEFINE_SPECIAL_MODE_NAME(CAN_HS, "CAN high-speed"), /* ISO 11898-2:2016 limited to bit-rates of 1 Mbit/s */
+ __DEFINE_SPECIAL_MODE_NAME(CAN_FD, "CAN FD"), /* ISO 11898-2:2016 supporting improved optional parameters */
+ __DEFINE_SPECIAL_MODE_NAME(CAN_SIC, "CAN SIC"), /* CiA 601-4 */
+ __DEFINE_SPECIAL_MODE_NAME(CAN_SIC_XL, "CAN SIC XL"), /* CiA 610-3 */
};
static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -264,6 +264,13 @@ static const struct link_mode_info link_mode_params[] = {
__DEFINE_LINK_MODE_PARAMS(400000, CR4, Full),
__DEFINE_LINK_MODE_PARAMS(100, FX, Half),
__DEFINE_LINK_MODE_PARAMS(100, FX, Full),
+
+ __DEFINE_SPECIAL_MODE_PARAMS(CAN_SW),
+ __DEFINE_SPECIAL_MODE_PARAMS(CAN_LS),
+ __DEFINE_SPECIAL_MODE_PARAMS(CAN_HS),
+ __DEFINE_SPECIAL_MODE_PARAMS(CAN_FD),
+ __DEFINE_SPECIAL_MODE_PARAMS(CAN_SIC),
+ __DEFINE_SPECIAL_MODE_PARAMS(CAN_SIC_XL),
};
const struct nla_policy ethnl_linkmodes_set_policy[] = {
This patch adds the CAN specific link modes to the ethtool user space API. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- drivers/net/phy/phy-core.c | 2 +- include/uapi/linux/ethtool.h | 9 +++++++++ net/ethtool/common.c | 7 +++++++ net/ethtool/linkmodes.c | 7 +++++++ 4 files changed, 24 insertions(+), 1 deletion(-)