From patchwork Tue Oct 19 16:28:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12570559 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23953C433F5 for ; Tue, 19 Oct 2021 16:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F28EA6113D for ; Tue, 19 Oct 2021 16:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbhJSQae (ORCPT ); Tue, 19 Oct 2021 12:30:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbhJSQad (ORCPT ); Tue, 19 Oct 2021 12:30:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D289360E76; Tue, 19 Oct 2021 16:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634660900; bh=SLj3u9qQw6idOnVDL7zGHCaBfWPhvEXHe/kZALrxMkg=; h=From:To:Cc:Subject:Date:From; b=mkxXNqITf57GSfcxNogILvRLjki4cK3thM0CMjUm89/mbqwYFSMMGP9hUrOX89lb6 VUoEaahTk0cTWcqBMFbe3A1ioAsw6oa8koPR+ZIz8mFVJaQNa+tASxNgnEtr81UiMV Fx5/Xqn0nS6laEYDBa7NWkbIbZS54hpsfXmUD65uqoRHEBYuJGi/XqNMsW5LnAKY1p RVYz/2Jm/Q72WDuya3fJdw9/spCPpAf6o3Viaxhd8vYWpE//FN0+6OMIGMfWdEfYyT ppTPTP/FagpnL0YG2BWszk1k0/pyr7jiSZaXDPKxajNEJTTxpUmcWrN6wU+oGbhC3P I2FWg4Rv2djDQ== From: Jakub Kicinski To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Jakub Kicinski Subject: [PATCH 1/2] mac80211: use eth_hw_addr_set() Date: Tue, 19 Oct 2021 09:28:15 -0700 Message-Id: <20211019162816.1384077-1-kuba@kernel.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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 */ From patchwork Tue Oct 19 16:28:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12570561 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE33C433FE for ; Tue, 19 Oct 2021 16:28:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BB1F6113D for ; Tue, 19 Oct 2021 16:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233499AbhJSQaf (ORCPT ); Tue, 19 Oct 2021 12:30:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:52206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233737AbhJSQae (ORCPT ); Tue, 19 Oct 2021 12:30:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1426C61052; Tue, 19 Oct 2021 16:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634660901; bh=9HBvlgibHv8CAFNjoiM5GBApxiv8wnMQ1NVLjI23rso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W+4GM0r/PAnZlwRPbARdQxyDNbPukU0HDnWZCWJpcNIjqVjI2E5bAS51q+w9arZeh LLIZbEA3njcblCrL0IM/k+6fSejk9Lmix/xrdRyaexS340Jy6a9MI9+V7B7lJwsRv9 hZ+ZVdWwSyX01OVw2C1ssljFcjqJSroU/N3F4o+JrFePO/EaP9KpgcuYCcSexLOv03 AlLmre4P386B1QJQttVaJJRT6tjNLzTXXc9IQWrBUwXek9e/QtMewfSWux1GvpxMes 8gSYnJHsJtdFzvkIdo4s2aC9EHazUHXLYzq7pW8oOKL1BN8p2Gpgnivh0I5QGCeief rYXhM4nj1G+9g== From: Jakub Kicinski To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Jakub Kicinski Subject: [PATCH 2/2] cfg80211: prepare for const netdev->dev_addr Date: Tue, 19 Oct 2021 09:28:16 -0700 Message-Id: <20211019162816.1384077-2-kuba@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211019162816.1384077-1-kuba@kernel.org> References: <20211019162816.1384077-1-kuba@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org netdev->dev_addr will be const soon. All callers of wdev_address() can take const already. Signed-off-by: Jakub Kicinski --- 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;