[PATCH RFC] Revert "generic: write back netdev MAC-address to device-tree"
Rafał Miłecki
zajec5 at gmail.com
Sat Jan 7 04:05:42 PST 2023
From: Rafał Miłecki <rafal at milecki.pl>
This reverts commit cd39aba402ea7e7a11e173b0b5aa96e42bf1f2ac.
Adding "mac-address" property to the device tree seems to be done to
allow reading it using procfs (/proc/device-tree/). It seems like a hack
without a proper explanation WHY do we need that.
Reading MAC address can be done other ways including fs based:
cat /sys/class/net/<foo>/address
Cc: David Bauer <mail at david-bauer.net>
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
David, everyone,
it seems this patch never ended up being sent upstream and it sits in
our tree without actual explanation why do we need that.
I was wondering if we can just drop it?
---
...83-of_net-add-mac-address-to-of-tree.patch | 54 ------------------
...83-of_net-add-mac-address-to-of-tree.patch | 55 -------------------
2 files changed, 109 deletions(-)
delete mode 100644 target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch
delete mode 100644 target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch
diff --git a/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch
deleted file mode 100644
index 501422551b..0000000000
--- a/target/linux/generic/pending-5.10/683-of_net-add-mac-address-to-of-tree.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From: David Bauer <mail at david-bauer.net>
-Subject: of/net: Add MAC address to of tree
-
-The label-mac logic relies on the mac-address property of a netdev
-devices of-node. However, the mac address can also be stored as a
-different property or read from e.g. an mtd device.
-
-Create this node when reading a mac-address from OF if it does not
-already exist and copy the mac-address used for the device to this
-property. This way, the MAC address can be accessed using procfs.
-
-Submitted-by: David Bauer <mail at david-bauer.net>
----
- drivers/of/of_net.c | 22 ++++++++++++++
- 1 files changed, 22 insertions(+)
-
---- a/drivers/of/of_net.c
-+++ b/drivers/of/of_net.c
-@@ -95,6 +95,27 @@ static int of_get_mac_addr_nvmem(struct
- return 0;
- }
-
-+static int of_add_mac_address(struct device_node *np, u8* addr)
-+{
-+ struct property *prop;
-+
-+ prop = kzalloc(sizeof(*prop), GFP_KERNEL);
-+ if (!prop)
-+ return -ENOMEM;
-+
-+ prop->name = "mac-address";
-+ prop->length = ETH_ALEN;
-+ prop->value = kmemdup(addr, ETH_ALEN, GFP_KERNEL);
-+ if (!prop->value || of_update_property(np, prop))
-+ goto free;
-+
-+ return 0;
-+free:
-+ kfree(prop->value);
-+ kfree(prop);
-+ return -ENOMEM;
-+}
-+
- /**
- * Search the device tree for the best MAC address to use. 'mac-address' is
- * checked first, because that is supposed to contain to "most recent" MAC
-@@ -171,6 +192,7 @@ found:
- addr[5] = (mac_val >> 0) & 0xff;
- }
-
-+ of_add_mac_address(np, addr);
- return ret;
- }
- EXPORT_SYMBOL(of_get_mac_address);
diff --git a/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch b/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch
deleted file mode 100644
index f7ef06a14a..0000000000
--- a/target/linux/generic/pending-5.15/683-of_net-add-mac-address-to-of-tree.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 8585756342caa6d27008d1ad0c18023e4211a40a Mon Sep 17 00:00:00 2001
-From: OpenWrt community <openwrt-devel at lists.openwrt.org>
-Date: Wed, 13 Jul 2022 12:22:48 +0200
-Subject: [PATCH] of/of_net: write back netdev MAC-address to device-tree
-
-The label-mac logic relies on the mac-address property of a netdev
-devices of-node. However, the mac address can also be stored as a
-different property or read from e.g. an mtd device.
-
-Create this node when reading a mac-address from OF if it does not
-already exist and copy the mac-address used for the device to this
-property. This way, the MAC address can be accessed using procfs.
-
----
- net/core/of_net.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
---- a/net/core/of_net.c
-+++ b/net/core/of_net.c
-@@ -95,6 +95,27 @@ static int of_get_mac_addr_nvmem(struct
- return 0;
- }
-
-+static int of_add_mac_address(struct device_node *np, u8* addr)
-+{
-+ struct property *prop;
-+
-+ prop = kzalloc(sizeof(*prop), GFP_KERNEL);
-+ if (!prop)
-+ return -ENOMEM;
-+
-+ prop->name = "mac-address";
-+ prop->length = ETH_ALEN;
-+ prop->value = kmemdup(addr, ETH_ALEN, GFP_KERNEL);
-+ if (!prop->value || of_update_property(np, prop))
-+ goto free;
-+
-+ return 0;
-+free:
-+ kfree(prop->value);
-+ kfree(prop);
-+ return -ENOMEM;
-+}
-+
- /**
- * of_get_mac_address()
- * @np: Caller's Device Node
-@@ -175,6 +196,7 @@ found:
- addr[5] = (mac_val >> 0) & 0xff;
- }
-
-+ of_add_mac_address(np, addr);
- return ret;
- }
- EXPORT_SYMBOL(of_get_mac_address);
--
2.34.1
More information about the openwrt-devel
mailing list