Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8069a08d authored by Xiaofei Shen's avatar Xiaofei Shen Committed by Greg Kroah-Hartman
Browse files

net: dsa: read mac address from DT for slave device



commit a2c7023f7075ca9b80f944d3f20f60e6574538e2 upstream.

Before creating a slave netdevice, get the mac address from DTS and
apply in case it is valid.

Signed-off-by: default avatarXiaofei Shen <xiaofeis@codeaurora.org>
Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Cc: Pali Rohár <pali@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3ab5872d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ struct dsa_port {
	unsigned int		index;
	const char		*name;
	const struct dsa_port	*cpu_dp;
	const char		*mac;
	struct device_node	*dn;
	unsigned int		ageing_time;
	u8			stp_state;
+1 −0
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ static int dsa_port_setup(struct dsa_port *dp)
	int err = 0;

	memset(&dp->devlink_port, 0, sizeof(dp->devlink_port));
	dp->mac = of_get_mac_address(dp->dn);

	if (dp->type != DSA_PORT_TYPE_UNUSED)
		err = devlink_port_register(ds->devlink, &dp->devlink_port,
+4 −1
Original line number Diff line number Diff line
@@ -1313,6 +1313,9 @@ int dsa_slave_create(struct dsa_port *port)
	slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
	slave_dev->hw_features |= NETIF_F_HW_TC;
	slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
	if (port->mac && is_valid_ether_addr(port->mac))
		ether_addr_copy(slave_dev->dev_addr, port->mac);
	else
		eth_hw_addr_inherit(slave_dev, master);
	slave_dev->priv_flags |= IFF_NO_QUEUE;
	slave_dev->netdev_ops = &dsa_slave_netdev_ops;