Skip to contentSkip to conversation

bluetooth: use eth_hw_addr_set()

PATCH In review Jakub Kicinski 2 participants 6 messages Oct 19, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bluetooth: 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 got 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)

---
 net/bluetooth/bnep/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/bnep/core.c +1 -1
index 72f47b372705..c9add7753b9f 100644
@@ -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;
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/2 bluetooth: use dev_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 got through appropriate helpers.

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

---
 net/bluetooth/6lowpan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/6lowpan.c +3 -1
index fd164a248569..133d7ea063fb 100644
@@ -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);
Signature · 1 line
2.31.1
maintainer Acked-by Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] bluetooth: use dev_addr_set()

Hi Jakub,

Quoted 6 lines

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.

Quoted 8 lines

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
---
net/bluetooth/6lowpan.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)

please also take this directly via net-next.

Regards

Marcel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · On Tue, 19 Oct 2021 10:29:08 -0700 (PDT) [email protected] wrote:

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=566505

Eish, sorry, you need 40af35fdf79c ("netdevice: demote the type of some dev_addr_set() helpers") from net-next for this change to build cleanly.

What are your plans on sending a PR for net-next? Probably easiest if I resend this after such PR? Or apply directly to net-next.

maintainer Reviewed-by Acked-by
#5 lore raw

Hi Jakub,

Quoted 9 lines
Quoted 3 lines

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=566505

Eish, sorry, you need 40af35fdf79c ("netdevice: demote the type of some dev_addr_set() helpers") from net-next for this change to build cleanly.

What are your plans on sending a PR for net-next? Probably easiest if I resend this after such PR? Or apply directly to net-next.

we have one more pull request for you in the works, but I was not planning to rebase bluetooth-next if not needed. So just go ahead and take the patch directly into net-next.

Regards

Marcel

#6 lore raw
Quoted 10 lines · On Tue, 19 Oct 2021 20:26:39 +0200 Marcel Holtmann wrote:
Quoted 9 lines
Quoted 3 lines

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=566505

Eish, sorry, you need 40af35fdf79c ("netdevice: demote the type of some dev_addr_set() helpers") from net-next for this change to build cleanly.

What are your plans on sending a PR for net-next? Probably easiest if I resend this after such PR? Or apply directly to net-next.

Quoted 6 lines

we have one more pull request for you in the works, but I was not planning to rebase bluetooth-next if not needed. So just go ahead and take the patch directly into net-next.

Will do, thanks!