diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2023-10-22 10:56:22 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-10-24 10:29:48 +0200 |
commit | f6e12277011d39a42e2c01fabb4222c09cb099fc (patch) | |
tree | 97f77ad2a5db9c558f08255ce187699e5c363c54 /drivers | |
parent | 169e0a5e43208fc5a6c5bc6476348cbd7203ae8a (diff) |
net: ti: icssg-prueth: Add phys_port_name support
Helps identifying the ports in udev rules e.g.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/895ae9c1-b6dd-4a97-be14-6f2b73c7b2b5@siemens.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/ti/icssg/icssg_prueth.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index de3bb9da3b13..6c4b64227ac8 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -1659,6 +1659,19 @@ static void emac_ndo_get_stats64(struct net_device *ndev, stats->tx_dropped = ndev->stats.tx_dropped; } +static int emac_ndo_get_phys_port_name(struct net_device *ndev, char *name, + size_t len) +{ + struct prueth_emac *emac = netdev_priv(ndev); + int ret; + + ret = snprintf(name, len, "p%d", emac->port_id); + if (ret >= len) + return -EINVAL; + + return 0; +} + static const struct net_device_ops emac_netdev_ops = { .ndo_open = emac_ndo_open, .ndo_stop = emac_ndo_stop, @@ -1669,6 +1682,7 @@ static const struct net_device_ops emac_netdev_ops = { .ndo_set_rx_mode = emac_ndo_set_rx_mode, .ndo_eth_ioctl = emac_ndo_ioctl, .ndo_get_stats64 = emac_ndo_get_stats64, + .ndo_get_phys_port_name = emac_ndo_get_phys_port_name, }; /* get emac_port corresponding to eth_node name */ |