Commit 6fdb0384 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Jakub Kicinski

net: dsa: use NET_NAME_PREDICTABLE for user ports with name given in DT

When a user port has a label in device tree, the corresponding
netdevice is, to quote include/uapi/linux/netdevice.h, "predictably
named by the kernel". This is also explicitly one of the intended use
cases for NET_NAME_PREDICTABLE, quoting 685343fc ("net: add
name_assign_type netdev attribute"):

  NET_NAME_PREDICTABLE:
    The ifname has been assigned by the kernel in a predictable way
    [...] Examples include [...] and names deduced from hardware
    properties (including being given explicitly by the firmware).

Expose that information properly for the benefit of userspace tools
that make decisions based on the name_assign_type attribute,
e.g. a systemd-udev rule with "kernel" in NamePolicy.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.faineli@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0171a1d2
...@@ -2377,7 +2377,7 @@ int dsa_slave_create(struct dsa_port *port) ...@@ -2377,7 +2377,7 @@ int dsa_slave_create(struct dsa_port *port)
if (port->name) { if (port->name) {
name = port->name; name = port->name;
assign_type = NET_NAME_UNKNOWN; assign_type = NET_NAME_PREDICTABLE;
} else { } else {
name = "eth%d"; name = "eth%d";
assign_type = NET_NAME_UNKNOWN; assign_type = NET_NAME_UNKNOWN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment