Skip to contentSkip to conversation

arch, misc: use eth_hw_addr_set()

PATCH Applied Jakub Kicinski 4 participants 7 messages Oct 29, 2021

Subsystems (5)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover arch, misc: use eth_hw_addr_set()

Convert remaining misc drivers to use helpers to write to netdev->dev_addr.

This is the last set :) :)

Jakub Kicinski (3):
net: sgi-xp: use eth_hw_addr_set()
net: um: use eth_hw_addr_set()
net: xtensa: use eth_hw_addr_set()

 arch/um/drivers/net_kern.c          | 3 ++-
 arch/xtensa/platforms/iss/network.c | 3 ++-
 drivers/misc/sgi-xp/xpnet.c         | 9 ++++++---
 3 files changed, 10 insertions(+), 5 deletions(-)
Signature · 1 line
2.31.1
author maintainer
#1 lore raw

PATCH 1/3 net: sgi-xp: use eth_hw_addr_set()

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 drivers/misc/sgi-xp/xpnet.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/misc/sgi-xp/xpnet.c +6 -3
index 2508f83bdc3f..dab7b92db790 100644
@@ -514,6 +514,7 @@ static const struct net_device_ops xpnet_netdev_ops = {
 static int __init
 xpnet_init(void)
 {
+	u8 addr[ETH_ALEN];
 	int result;
 
 	if (!is_uv_system())
@@ -545,15 +546,17 @@ xpnet_init(void)
 	xpnet_device->min_mtu = XPNET_MIN_MTU;
 	xpnet_device->max_mtu = XPNET_MAX_MTU;
 
+	memset(addr, 0, sizeof(addr));
 	/*
 	 * Multicast assumes the LSB of the first octet is set for multicast
 	 * MAC addresses.  We chose the first octet of the MAC to be unlikely
 	 * to collide with any vendor's officially issued MAC.
 	 */
-	xpnet_device->dev_addr[0] = 0x02;     /* locally administered, no OUI */
+	addr[0] = 0x02;     /* locally administered, no OUI */
 
-	xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
-	xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
+	addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
+	addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
+	eth_hw_addr_set(xpnet_device, addr);
 
 	/*
 	 * ether_setup() sets this to a multicast device.  We are
Signature · 1 line
2.31.1
#2 lore raw

Re: [PATCH net-next 1/3] net: sgi-xp: use eth_hw_addr_set()

Quoted 52 lines · Jakub Kicinski

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 drivers/misc/sgi-xp/xpnet.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/misc/sgi-xp/xpnet.c +6 -3
index 2508f83bdc3f..dab7b92db790 100644
@@ -514,6 +514,7 @@ static const struct net_device_ops xpnet_netdev_ops = {
 static int __init
 xpnet_init(void)
 {
+	u8 addr[ETH_ALEN];
 	int result;
 
 	if (!is_uv_system())
@@ -545,15 +546,17 @@ xpnet_init(void)
 	xpnet_device->min_mtu = XPNET_MIN_MTU;
 	xpnet_device->max_mtu = XPNET_MAX_MTU;
 
+	memset(addr, 0, sizeof(addr));
 	/*
 	 * Multicast assumes the LSB of the first octet is set for multicast
 	 * MAC addresses.  We chose the first octet of the MAC to be unlikely
 	 * to collide with any vendor's officially issued MAC.
 	 */
-	xpnet_device->dev_addr[0] = 0x02;     /* locally administered, no OUI */
+	addr[0] = 0x02;     /* locally administered, no OUI */
 
-	xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
-	xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
+	addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
+	addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
+	eth_hw_addr_set(xpnet_device, addr);
 
 	/*
 	 * ether_setup() sets this to a multicast device.  We are
Signature · 1 line
2.31.1
Signature · 1 line
Steve Wahl, Hewlett Packard Enterprise
author maintainer
#3 lore raw

PATCH 2/3 net: um: use eth_hw_addr_set()

In reply to Jakub Kicinski

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 arch/um/drivers/net_kern.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/net_kern.c +2 -1
index 2fc0b038ff8a..59331384c2d3 100644
@@ -276,7 +276,7 @@ static const struct ethtool_ops uml_net_ethtool_ops = {
 
 void uml_net_setup_etheraddr(struct net_device *dev, char *str)
 {
-	unsigned char *addr = dev->dev_addr;
+	u8 addr[ETH_ALEN];
 	char *end;
 	int i;
 
@@ -316,6 +316,7 @@ void uml_net_setup_etheraddr(struct net_device *dev, char *str)
 		       addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4],
 		       addr[5]);
 	}
+	eth_hw_addr_set(dev, addr);
 	return;
 
 random:
Signature · 7 lines
2.31.1


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
maintainer Acked-by on v1 2/3
#4 lore raw

Re: [PATCH net-next 2/3] net: um: use eth_hw_addr_set()

Quoted 31 lines · Jakub Kicinski

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
  arch/um/drivers/net_kern.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/net_kern.c +1 -1
index 2fc0b038ff8a..59331384c2d3 100644
@@ -276,7 +276,7 @@ static const struct ethtool_ops uml_net_ethtool_ops = {
 
  void uml_net_setup_etheraddr(struct net_device *dev, char *str)
  {
-	unsigned char *addr = dev->dev_addr;
+	u8 addr[ETH_ALEN];
  	char *end;
  	int i;
 

arch/um/drivers/net_kern.c void uml_net_setup_etheraddr(struct net_device *dev, char *str) · line 322

Quoted 7 lines
arch/um/drivers/net_kern.c +1 -0
@@ -316,6 +316,7 @@ void uml_net_setup_etheraddr(struct net_device *dev, char *str)
  		       addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4],
  		       addr[5]);
  	}
+	eth_hw_addr_set(dev, addr);
  	return;
 
  random:
Signature · 3 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
author maintainer
#5 lore raw

PATCH 3/3 net: xtensa: use eth_hw_addr_set()

In reply to Jakub Kicinski

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 arch/xtensa/platforms/iss/network.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/platforms/iss/network.c +2 -1
index 8b806d305948..962e5e145209 100644
@@ -124,7 +124,7 @@ static char *split_if_spec(char *str, ...)
 
 static void setup_etheraddr(struct net_device *dev, char *str)
 {
-	unsigned char *addr = dev->dev_addr;
+	u8 addr[ETH_ALEN];
 
 	if (str == NULL)
 		goto random;
@@ -147,6 +147,7 @@ static void setup_etheraddr(struct net_device *dev, char *str)
 	if (!is_local_ether_addr(addr))
 		pr_warn("%s: assigning a globally valid ethernet address\n",
 			dev->name);
+	eth_hw_addr_set(dev, addr);
 	return;
 
 random:
Signature · 1 line
2.31.1
#6 lore raw
In reply to Jakub Kicinski
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 11 lines · On Thu, 28 Oct 2021 19:47:04 -0700 you wrote:

Convert remaining misc drivers to use helpers to write to netdev->dev_addr.

This is the last set :) :)

Jakub Kicinski (3):
net: sgi-xp: use eth_hw_addr_set()
net: um: use eth_hw_addr_set()
net: xtensa: use eth_hw_addr_set()

[...]

Here is the summary with links:
- [net-next,1/3] net: sgi-xp: use eth_hw_addr_set()

    https://git.kernel.org/netdev/net-next/c/40d5cb400530
  - [net-next,2/3] net: um: use eth_hw_addr_set()
    https://git.kernel.org/netdev/net-next/c/ac617341343c
  - [net-next,3/3] net: xtensa: use eth_hw_addr_set()
    https://git.kernel.org/netdev/net-next/c/7e1dd824e531

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html