From patchwork Fri Oct 22 17:42:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12578335 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 DE6E5C4332F for ; Fri, 22 Oct 2021 17:42:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0C7461052 for ; Fri, 22 Oct 2021 17:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233880AbhJVRo5 (ORCPT ); Fri, 22 Oct 2021 13:44:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:46418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbhJVRoz (ORCPT ); Fri, 22 Oct 2021 13:44:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED5296109D; Fri, 22 Oct 2021 17:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634924558; bh=QOVNcAcQ6j4lXFQzvAxlv4geOgG9g056VbLlYNNJGz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnhKvWn92LHM0bajjcJl+t2P4oF2t3FJyHYxIWdt9QNvmY4o5jBIkA8XqqC3lpFdC HNLd7GFssBEaxazNMY7+CT2fzpHl02BfHwDp2UA/syqafPjn6tSeNUoZpr5crSBHC1 IIRs22aMavHHNvYgiOaSz8y/Nlig4cf/YEt0mhVApcoOfznhrTS/vQ0369FXje8diu Dn+YTxM3CPV+NCNNinmGVDgGyboRu9hPL+YOc3v3ThZLqBSKEOwcBsCUtfG7VmCYLn Q2+FpUcsiqmGg5H9/xyVhUE9yTHE/qJ5PqMQcF7YjVS1bMu3YMFcqAxW7L7tkWo5IW cfyba2klAKAnA== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-bluetooth@vger.kernel.org, marcel@holtmann.org, Jakub Kicinski Subject: [PATCH net-next 1/2] bluetooth: use eth_hw_addr_set() Date: Fri, 22 Oct 2021 10:42:31 -0700 Message-Id: <20211022174232.2510917-2-kuba@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211022174232.2510917-1-kuba@kernel.org> References: <20211022174232.2510917-1-kuba@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@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 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 Reviewed-by: Marcel Holtmann Acked-by: Marcel Holtmann --- 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; From patchwork Fri Oct 22 17:42:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 12578337 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 8985FC4321E for ; Fri, 22 Oct 2021 17:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FD836120D for ; Fri, 22 Oct 2021 17:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233893AbhJVRo6 (ORCPT ); Fri, 22 Oct 2021 13:44:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233538AbhJVRo4 (ORCPT ); Fri, 22 Oct 2021 13:44:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4B90161108; Fri, 22 Oct 2021 17:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634924558; bh=KSTZbTwJED2Trs1mK+SIVPqifn31y3USERdU78twhzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKnDI1O4kcsnLqjWWYFQC4O2pd+NTtFV2+WCsphme2tDGuXIAQA+whXkccrUUcl6c OgzR9XyxQPpbc90sDwjcz4LI5I3vnhyJkJ2GYP813U1TkJ+YGM81lnW0NviH2vQh9d OUEcxLGgsrn0zIFmZyjxdJtsZ2TEA3XSeEXsMv+L/+CYPTOB5V97PD/ca15LpNWAE2 EwKv3ikzYzNVUHp79Va+nWQHKRzXpP4PTJeBJ1tuzXhnCgtZEh4EVQzOgRrCFPw/6k mJhlfbrKvNEgZWStxcwXKA5TOKWG4sb75igg7v1RHM7Te4+F+voTsor50dKz69nr+Q vS2DsEnvISmmw== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-bluetooth@vger.kernel.org, marcel@holtmann.org, Jakub Kicinski , johan.hedberg@gmail.com, luiz.dentz@gmail.com Subject: [PATCH net-next 2/2] bluetooth: use dev_addr_set() Date: Fri, 22 Oct 2021 10:42:32 -0700 Message-Id: <20211022174232.2510917-3-kuba@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211022174232.2510917-1-kuba@kernel.org> References: <20211022174232.2510917-1-kuba@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@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. Signed-off-by: Jakub Kicinski Reviewed-by: Marcel Holtmann Acked-by: Marcel Holtmann --- 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);