linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr
@ 2021-10-22 23:18 Jakub Kicinski
  2021-10-22 23:18 ` [PATCH net-next v2 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-22 23:18 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-bluetooth, marcel, Jakub Kicinski

The usual conversions.

These are intended to be merged to net-next directly,
because bluetooth tree is missing one of the pre-req
changes at the moment.

v2: s/got/go/

Jakub Kicinski (2):
  bluetooth: use eth_hw_addr_set()
  bluetooth: use dev_addr_set()

 net/bluetooth/6lowpan.c   | 4 +++-
 net/bluetooth/bnep/core.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next v2 1/2] bluetooth: use eth_hw_addr_set()
  2021-10-22 23:18 [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
@ 2021-10-22 23:18 ` Jakub Kicinski
  2021-10-22 23:18 ` [PATCH net-next v2 2/2] bluetooth: use dev_addr_set() Jakub Kicinski
  2021-10-25 19:00 ` [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-22 23:18 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-bluetooth, marcel, 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.

Convert bluetooth from memcpy(... ETH_ADDR) to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - memcpy(dev->dev_addr, np, ETH_ALEN)
  + eth_hw_addr_set(dev, np)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/bnep/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 72f47b372705..c9add7753b9f 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -594,7 +594,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
 	 * ie. eh.h_dest is our local address. */
 	memcpy(s->eh.h_dest,   &src, ETH_ALEN);
 	memcpy(s->eh.h_source, &dst, ETH_ALEN);
-	memcpy(dev->dev_addr, s->eh.h_dest, ETH_ALEN);
+	eth_hw_addr_set(dev, s->eh.h_dest);
 
 	s->dev   = dev;
 	s->sock  = sock;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next v2 2/2] bluetooth: use dev_addr_set()
  2021-10-22 23:18 [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
  2021-10-22 23:18 ` [PATCH net-next v2 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
@ 2021-10-22 23:18 ` Jakub Kicinski
  2021-10-25 19:00 ` [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-10-22 23:18 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-bluetooth, marcel, Jakub Kicinski, johan.hedberg,
	luiz.dentz

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.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
CC: marcel@holtmann.org
CC: johan.hedberg@gmail.com
CC: luiz.dentz@gmail.com
CC: linux-bluetooth@vger.kernel.org
---
 net/bluetooth/6lowpan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index fd164a248569..133d7ea063fb 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -663,6 +663,7 @@ static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan,
 static int setup_netdev(struct l2cap_chan *chan, struct lowpan_btle_dev **dev)
 {
 	struct net_device *netdev;
+	bdaddr_t addr;
 	int err;
 
 	netdev = alloc_netdev(LOWPAN_PRIV_SIZE(sizeof(struct lowpan_btle_dev)),
@@ -672,7 +673,8 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_btle_dev **dev)
 		return -ENOMEM;
 
 	netdev->addr_assign_type = NET_ADDR_PERM;
-	baswap((void *)netdev->dev_addr, &chan->src);
+	baswap(&addr, &chan->src);
+	__dev_addr_set(netdev, &addr, sizeof(addr));
 
 	netdev->netdev_ops = &netdev_ops;
 	SET_NETDEV_DEV(netdev, &chan->conn->hcon->hdev->dev);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr
  2021-10-22 23:18 [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
  2021-10-22 23:18 ` [PATCH net-next v2 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
  2021-10-22 23:18 ` [PATCH net-next v2 2/2] bluetooth: use dev_addr_set() Jakub Kicinski
@ 2021-10-25 19:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-25 19:00 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, linux-bluetooth, marcel

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 22 Oct 2021 16:18:32 -0700 you wrote:
> The usual conversions.
> 
> These are intended to be merged to net-next directly,
> because bluetooth tree is missing one of the pre-req
> changes at the moment.
> 
> v2: s/got/go/
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] bluetooth: use eth_hw_addr_set()
    https://git.kernel.org/netdev/net-next/c/08c181f052ed
  - [net-next,v2,2/2] bluetooth: use dev_addr_set()
    https://git.kernel.org/netdev/net-next/c/a1916d34462f

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

end of thread, other threads:[~2021-10-25 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22 23:18 [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr Jakub Kicinski
2021-10-22 23:18 ` [PATCH net-next v2 1/2] bluetooth: use eth_hw_addr_set() Jakub Kicinski
2021-10-22 23:18 ` [PATCH net-next v2 2/2] bluetooth: use dev_addr_set() Jakub Kicinski
2021-10-25 19:00 ` [PATCH net-next v2 0/2] bluetooth: don't write directly to netdev->dev_addr patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).