linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211: use eth_hw_addr_set()
@ 2021-10-19 16:28 Jakub Kicinski
  2021-10-19 16:28 ` [PATCH 2/2] cfg80211: prepare for const netdev->dev_addr Jakub Kicinski
  2021-10-19 17:53 ` [PATCH 1/2] mac80211: use eth_hw_addr_set() Johannes Berg
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-10-19 16:28 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, 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.

Convert mac80211 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>
---
 net/mac80211/iface.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 62c95597704b..878b919f22bb 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1108,9 +1108,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
 	 * this interface, if it has the special null one.
 	 */
 	if (dev && is_zero_ether_addr(dev->dev_addr)) {
-		memcpy(dev->dev_addr,
-		       local->hw.wiphy->perm_addr,
-		       ETH_ALEN);
+		eth_hw_addr_set(dev, local->hw.wiphy->perm_addr);
 		memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN);
 
 		if (!is_valid_ether_addr(dev->dev_addr)) {
@@ -1964,9 +1962,9 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
 		ieee80211_assign_perm_addr(local, ndev->perm_addr, type);
 		if (is_valid_ether_addr(params->macaddr))
-			memcpy(ndev->dev_addr, params->macaddr, ETH_ALEN);
+			eth_hw_addr_set(ndev, params->macaddr);
 		else
-			memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN);
+			eth_hw_addr_set(ndev, ndev->perm_addr);
 		SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy));
 
 		/* don't use IEEE80211_DEV_TO_SUB_IF -- it checks too much */
-- 
2.31.1


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

* [PATCH 2/2] cfg80211: prepare for const netdev->dev_addr
  2021-10-19 16:28 [PATCH 1/2] mac80211: use eth_hw_addr_set() Jakub Kicinski
@ 2021-10-19 16:28 ` Jakub Kicinski
  2021-10-19 17:53 ` [PATCH 1/2] mac80211: use eth_hw_addr_set() Johannes Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-10-19 16:28 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Jakub Kicinski

netdev->dev_addr will be const soon.
All callers of wdev_address() can take const already.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: johannes@sipsolutions.net
CC: linux-wireless@vger.kernel.org
---
 include/net/cfg80211.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 62dd8422e0dc..61c87d8e7f2a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5492,7 +5492,7 @@ struct wireless_dev {
 	unsigned long unprot_beacon_reported;
 };
 
-static inline u8 *wdev_address(struct wireless_dev *wdev)
+static inline const u8 *wdev_address(struct wireless_dev *wdev)
 {
 	if (wdev->netdev)
 		return wdev->netdev->dev_addr;
-- 
2.31.1


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

* Re: [PATCH 1/2] mac80211: use eth_hw_addr_set()
  2021-10-19 16:28 [PATCH 1/2] mac80211: use eth_hw_addr_set() Jakub Kicinski
  2021-10-19 16:28 ` [PATCH 2/2] cfg80211: prepare for const netdev->dev_addr Jakub Kicinski
@ 2021-10-19 17:53 ` Johannes Berg
  2021-10-19 18:06   ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2021-10-19 17:53 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: linux-wireless

On Tue, 2021-10-19 at 09:28 -0700, 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.
> 
Looks fine. Do you expect me to apply this (and if so where), or will
you?

johannes



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

* Re: [PATCH 1/2] mac80211: use eth_hw_addr_set()
  2021-10-19 17:53 ` [PATCH 1/2] mac80211: use eth_hw_addr_set() Johannes Berg
@ 2021-10-19 18:06   ` Jakub Kicinski
  2021-10-19 19:04     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2021-10-19 18:06 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Tue, 19 Oct 2021 19:53:01 +0200 Johannes Berg wrote:
> On Tue, 2021-10-19 at 09:28 -0700, 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.
> >   
> Looks fine. Do you expect me to apply this (and if so where), or will
> you?

I was expecting you to take these, there will be another -next PR
before the merge window, right?

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

* Re: [PATCH 1/2] mac80211: use eth_hw_addr_set()
  2021-10-19 18:06   ` Jakub Kicinski
@ 2021-10-19 19:04     ` Johannes Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2021-10-19 19:04 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: linux-wireless

On Tue, 2021-10-19 at 11:06 -0700, Jakub Kicinski wrote:
> On Tue, 19 Oct 2021 19:53:01 +0200 Johannes Berg wrote:
> > On Tue, 2021-10-19 at 09:28 -0700, 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.
> > >   
> > > 
> > Looks fine. Do you expect me to apply this (and if so where), or will
> > you?
> 
> I was expecting you to take these, there will be another -next PR
> before the merge window, right?
> 
Yeah, I should have one.

johannes


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-19 16:28 [PATCH 1/2] mac80211: use eth_hw_addr_set() Jakub Kicinski
2021-10-19 16:28 ` [PATCH 2/2] cfg80211: prepare for const netdev->dev_addr Jakub Kicinski
2021-10-19 17:53 ` [PATCH 1/2] mac80211: use eth_hw_addr_set() Johannes Berg
2021-10-19 18:06   ` Jakub Kicinski
2021-10-19 19:04     ` Johannes Berg

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).