Skip to content

Commit e74249a

Browse files
Jimmy Assarssonmarckleinebudde
authored andcommitted
can: kvaser_pciefd: Add support for ethtool set_phys_id()
Add support for ethtool set_phys_id(), to physically locate devices by flashing a LED on the device. Reviewed-by: Axel Forsman <axfo@kvaser.com> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Signed-off-by: Jimmy Assarsson <extja@kvaser.com> Link: https://patch.msgid.link/20250725123230.8-3-extja@kvaser.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 44f0b63 commit e74249a

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

drivers/net/can/kvaser_pciefd.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,32 @@ static const struct net_device_ops kvaser_pciefd_netdev_ops = {
968968
.ndo_change_mtu = can_change_mtu,
969969
};
970970

971+
static int kvaser_pciefd_set_phys_id(struct net_device *netdev,
972+
enum ethtool_phys_id_state state)
973+
{
974+
struct kvaser_pciefd_can *can = netdev_priv(netdev);
975+
976+
switch (state) {
977+
case ETHTOOL_ID_ACTIVE:
978+
return 3; /* 3 On/Off cycles per second */
979+
980+
case ETHTOOL_ID_ON:
981+
kvaser_pciefd_set_led(can, true);
982+
return 0;
983+
984+
case ETHTOOL_ID_OFF:
985+
case ETHTOOL_ID_INACTIVE:
986+
kvaser_pciefd_set_led(can, false);
987+
return 0;
988+
989+
default:
990+
return -EINVAL;
991+
}
992+
}
993+
971994
static const struct ethtool_ops kvaser_pciefd_ethtool_ops = {
972995
.get_ts_info = can_ethtool_op_get_ts_info_hwts,
996+
.set_phys_id = kvaser_pciefd_set_phys_id,
973997
};
974998

975999
static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie)

0 commit comments

Comments
 (0)