Skip to content

Commit f6e1227

Browse files
jan-kiszkaPaolo Abeni
authored and
Paolo Abeni
committed
net: ti: icssg-prueth: Add phys_port_name support
Helps identifying the ports in udev rules e.g. Signed-off-by: Jan Kiszka <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 169e0a5 commit f6e1227

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/net/ethernet/ti/icssg/icssg_prueth.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,19 @@ static void emac_ndo_get_stats64(struct net_device *ndev,
16591659
stats->tx_dropped = ndev->stats.tx_dropped;
16601660
}
16611661

1662+
static int emac_ndo_get_phys_port_name(struct net_device *ndev, char *name,
1663+
size_t len)
1664+
{
1665+
struct prueth_emac *emac = netdev_priv(ndev);
1666+
int ret;
1667+
1668+
ret = snprintf(name, len, "p%d", emac->port_id);
1669+
if (ret >= len)
1670+
return -EINVAL;
1671+
1672+
return 0;
1673+
}
1674+
16621675
static const struct net_device_ops emac_netdev_ops = {
16631676
.ndo_open = emac_ndo_open,
16641677
.ndo_stop = emac_ndo_stop,
@@ -1669,6 +1682,7 @@ static const struct net_device_ops emac_netdev_ops = {
16691682
.ndo_set_rx_mode = emac_ndo_set_rx_mode,
16701683
.ndo_eth_ioctl = emac_ndo_ioctl,
16711684
.ndo_get_stats64 = emac_ndo_get_stats64,
1685+
.ndo_get_phys_port_name = emac_ndo_get_phys_port_name,
16721686
};
16731687

16741688
/* get emac_port corresponding to eth_node name */

0 commit comments

Comments
 (0)