From patchwork Mon Apr 3 14:48:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 9659679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7858D6032D for ; Mon, 3 Apr 2017 14:49:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BE50283BA for ; Mon, 3 Apr 2017 14:49:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60D5A283F1; Mon, 3 Apr 2017 14:49:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D44A6283BA for ; Mon, 3 Apr 2017 14:49:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248AbdDCOtE (ORCPT ); Mon, 3 Apr 2017 10:49:04 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35005 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750777AbdDCOtD (ORCPT ); Mon, 3 Apr 2017 10:49:03 -0400 Received: by mail-lf0-f67.google.com with SMTP id v2so13108160lfi.2; Mon, 03 Apr 2017 07:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=yykiYd9la0ExLEuR84gn2domdO4IiEjRCFqxHEr1j24=; b=fvbguV+XEyYD4IXuvRzaWfwKBO3iw4wEDY35o121laT+/KBJvYLbaFDqREBEDkFNSl YOYdzsQymMv9UL2Q/qjH0TpIA2fVfExUQ7tqzu/s5SiR9Yz9ZAw5TakNr2oRbZhrCakO WzHbQppBqcJxLtoUn0O8DFnwQF9ci3MG+cONCpyz56QgYAj/IMP6MVu0s1GSAWD8a3BO 0N6SfbZl2Qr9HaLQVO5NGRHgZ7Nmlm3mZAJt6Oyy47+rQoRwzBqU+v2wxJtPl0d0sRVu Ttk/W+UPhHVZ0XNJod6w52kmsLwR+mTDbS68v5jChMTBjM9zJcXJ7bpo7j03QrhyU6S3 wEmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yykiYd9la0ExLEuR84gn2domdO4IiEjRCFqxHEr1j24=; b=WD+97jeyQPI1va0DzVqHUka2n3jF/OHfa6oFXy+izNk3yOaFO8wU2nZ0y0s2kDDK2Z Sf4JCjVFpjAvdrTwsTd1BtJboYsjtUdOdDjy/PqMPT1l0EiCD8QTrfhBqZZU+zltAu27 T7QJD0nT09bOcQZ/Tx0p/EkvZnvG9cgFNvtkEe77gVLQnKiuc8+OEUj/not1YAgoYQdf cALvm63253xZzQwcdhveQIqzHzmFLAYrbTDPLHhkozh7AtMlOg3hBHesqBcv1ryE9vLZ LBOS+c+nlrsYZP2yaO9OYYuLPgX0qpEDq7HQkNq031Thiz/3+j5celLQOYqgPrzKh+16 Gx3g== X-Gm-Message-State: AFeK/H1nAPlp7KT5v+fvV7S+go1IVi3efQ5Zna0lnmPKLxaBRH6imZJOpOgD+1meSTAXcw== X-Received: by 10.46.69.213 with SMTP id s204mr5057634lja.71.1491230941673; Mon, 03 Apr 2017 07:49:01 -0700 (PDT) Received: from localhost.localdomain (85-76-97-254-nat.elisa-mobile.fi. [85.76.97.254]) by smtp.gmail.com with ESMTPSA id e88sm2628995lji.26.2017.04.03.07.49.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 07:49:00 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: aar@pengutronix.de, jukka.rissanen@linux.intel.com, linux-wpan@vger.kernel.org Subject: [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Date: Mon, 3 Apr 2017 17:48:55 +0300 Message-Id: <20170403144857.4661-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Luiz Augusto von Dentz During chan_recv_cb there is already a peer lookup which can be passed to recv_pkt directly instead of the channel. Signed-off-by: Luiz Augusto von Dentz Acked-by: Jukka Rissanen --- net/bluetooth/6lowpan.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index b39da8d..2063e96 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -269,27 +269,20 @@ static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev) } static int iphc_decompress(struct sk_buff *skb, struct net_device *netdev, - struct l2cap_chan *chan) + struct lowpan_peer *peer) { const u8 *saddr; struct lowpan_btle_dev *dev; - struct lowpan_peer *peer; dev = lowpan_btle_dev(netdev); - rcu_read_lock(); - peer = __peer_lookup_chan(dev, chan); - rcu_read_unlock(); - if (!peer) - return -EINVAL; - saddr = peer->lladdr; return lowpan_header_decompress(skb, netdev, netdev->dev_addr, saddr); } static int recv_pkt(struct sk_buff *skb, struct net_device *dev, - struct l2cap_chan *chan) + struct lowpan_peer *peer) { struct sk_buff *local_skb; int ret; @@ -342,7 +335,7 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev, local_skb->dev = dev; - ret = iphc_decompress(local_skb, dev, chan); + ret = iphc_decompress(local_skb, dev, peer); if (ret < 0) { kfree_skb(local_skb); goto drop; @@ -388,7 +381,7 @@ static int chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) if (!dev || !dev->netdev) return -ENOENT; - err = recv_pkt(skb, dev->netdev, chan); + err = recv_pkt(skb, dev->netdev, peer); if (err) { BT_DBG("recv pkt %d", err); err = -EAGAIN;