* [PATCH 1/2] mac802154: use dev_addr_set()
@ 2021-10-19 16:36 Jakub Kicinski
2021-10-19 16:36 ` [PATCH 2/2] mac802154: use dev_addr_set() - manual Jakub Kicinski
2021-10-20 13:30 ` [PATCH 1/2] mac802154: use dev_addr_set() patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-19 16:36 UTC (permalink / raw)
To: netdev; +Cc: 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 got through appropriate helpers.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/mac802154/iface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 323d3d2d986f..3210dec64a6a 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -129,7 +129,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
if (!ieee802154_is_valid_extended_unicast_addr(extended_addr))
return -EINVAL;
- memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+ dev_addr_set(dev, addr->sa_data);
sdata->wpan_dev.extended_addr = extended_addr;
/* update lowpan interface mac address when
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] mac802154: use dev_addr_set() - manual
2021-10-19 16:36 [PATCH 1/2] mac802154: use dev_addr_set() Jakub Kicinski
@ 2021-10-19 16:36 ` Jakub Kicinski
2021-10-20 21:16 ` Stefan Schmidt
2021-10-20 13:30 ` [PATCH 1/2] mac802154: use dev_addr_set() patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-19 16:36 UTC (permalink / raw)
To: netdev; +Cc: Jakub Kicinski, alex.aring, stefan, linux-wpan
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 got through appropriate helpers.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: alex.aring@gmail.com
CC: stefan@datenfreihafen.org
CC: linux-wpan@vger.kernel.org
---
net/ieee802154/6lowpan/core.c | 2 +-
net/mac802154/iface.c | 15 ++++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
index 3297e7fa9945..2cf62718a282 100644
--- a/net/ieee802154/6lowpan/core.c
+++ b/net/ieee802154/6lowpan/core.c
@@ -157,7 +157,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *ldev,
lowpan_802154_dev(ldev)->wdev = wdev;
/* Set the lowpan hardware address to the wpan hardware address. */
- memcpy(ldev->dev_addr, wdev->dev_addr, IEEE802154_ADDR_LEN);
+ __dev_addr_set(ldev, wdev->dev_addr, IEEE802154_ADDR_LEN);
/* We need headroom for possible wpan_dev_hard_header call and tailroom
* for encryption/fcs handling. The lowpan interface will replace
* the IPv6 header with 6LoWPAN header. At worst case the 6LoWPAN
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 3210dec64a6a..500ed1b81250 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -136,8 +136,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
* wpan mac has been changed
*/
if (sdata->wpan_dev.lowpan_dev)
- memcpy(sdata->wpan_dev.lowpan_dev->dev_addr, dev->dev_addr,
- dev->addr_len);
+ dev_addr_set(sdata->wpan_dev.lowpan_dev, dev->dev_addr);
return mac802154_wpan_update_llsec(dev);
}
@@ -615,6 +614,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
unsigned char name_assign_type, enum nl802154_iftype type,
__le64 extended_addr)
{
+ u8 addr[IEEE802154_EXTENDED_ADDR_LEN];
struct net_device *ndev = NULL;
struct ieee802154_sub_if_data *sdata = NULL;
int ret;
@@ -638,11 +638,12 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
switch (type) {
case NL802154_IFTYPE_NODE:
ndev->type = ARPHRD_IEEE802154;
- if (ieee802154_is_valid_extended_unicast_addr(extended_addr))
- ieee802154_le64_to_be64(ndev->dev_addr, &extended_addr);
- else
- memcpy(ndev->dev_addr, ndev->perm_addr,
- IEEE802154_EXTENDED_ADDR_LEN);
+ if (ieee802154_is_valid_extended_unicast_addr(extended_addr)) {
+ ieee802154_le64_to_be64(addr, &extended_addr);
+ dev_addr_set(ndev, addr);
+ } else {
+ dev_addr_set(ndev, ndev->perm_addr);
+ }
break;
case NL802154_IFTYPE_MONITOR:
ndev->type = ARPHRD_IEEE802154_MONITOR;
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] mac802154: use dev_addr_set()
2021-10-19 16:36 [PATCH 1/2] mac802154: use dev_addr_set() Jakub Kicinski
2021-10-19 16:36 ` [PATCH 2/2] mac802154: use dev_addr_set() - manual Jakub Kicinski
@ 2021-10-20 13:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-20 13:30 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev
Hello:
This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Tue, 19 Oct 2021 09:36:05 -0700 you wrote:
> 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 got through appropriate helpers.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
>
> [...]
Here is the summary with links:
- [1/2] mac802154: use dev_addr_set()
https://git.kernel.org/netdev/net-next/c/659f4e02f15a
- [2/2] mac802154: use dev_addr_set() - manual
https://git.kernel.org/netdev/net-next/c/08bb7516e530
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mac802154: use dev_addr_set() - manual
2021-10-19 16:36 ` [PATCH 2/2] mac802154: use dev_addr_set() - manual Jakub Kicinski
@ 2021-10-20 21:16 ` Stefan Schmidt
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Schmidt @ 2021-10-20 21:16 UTC (permalink / raw)
To: Jakub Kicinski, netdev; +Cc: alex.aring, linux-wpan
Hello.
On 19.10.21 18:36, Jakub Kicinski wrote:
> 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 got through appropriate helpers.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Tested on my local ieee802154 setup without showing problems.
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
regards
Stefan Schmidt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-20 21:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 16:36 [PATCH 1/2] mac802154: use dev_addr_set() Jakub Kicinski
2021-10-19 16:36 ` [PATCH 2/2] mac802154: use dev_addr_set() - manual Jakub Kicinski
2021-10-20 21:16 ` Stefan Schmidt
2021-10-20 13:30 ` [PATCH 1/2] mac802154: use dev_addr_set() patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.