Bluetooth: 6lowpan: Remove unnecessary peer lookup
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 <luiz.von.dentz@intel.com> Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
c8ba804437
commit
27ce68a37b
|
@ -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,
|
static int iphc_decompress(struct sk_buff *skb, struct net_device *netdev,
|
||||||
struct l2cap_chan *chan)
|
struct lowpan_peer *peer)
|
||||||
{
|
{
|
||||||
const u8 *saddr;
|
const u8 *saddr;
|
||||||
struct lowpan_btle_dev *dev;
|
struct lowpan_btle_dev *dev;
|
||||||
struct lowpan_peer *peer;
|
|
||||||
|
|
||||||
dev = lowpan_btle_dev(netdev);
|
dev = lowpan_btle_dev(netdev);
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
peer = __peer_lookup_chan(dev, chan);
|
|
||||||
rcu_read_unlock();
|
|
||||||
if (!peer)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
saddr = peer->lladdr;
|
saddr = peer->lladdr;
|
||||||
|
|
||||||
return lowpan_header_decompress(skb, netdev, netdev->dev_addr, saddr);
|
return lowpan_header_decompress(skb, netdev, netdev->dev_addr, saddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
|
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;
|
struct sk_buff *local_skb;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -342,7 +335,7 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
|
||||||
|
|
||||||
local_skb->dev = dev;
|
local_skb->dev = dev;
|
||||||
|
|
||||||
ret = iphc_decompress(local_skb, dev, chan);
|
ret = iphc_decompress(local_skb, dev, peer);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
kfree_skb(local_skb);
|
kfree_skb(local_skb);
|
||||||
goto drop;
|
goto drop;
|
||||||
|
@ -388,7 +381,7 @@ static int chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
|
||||||
if (!dev || !dev->netdev)
|
if (!dev || !dev->netdev)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
err = recv_pkt(skb, dev->netdev, chan);
|
err = recv_pkt(skb, dev->netdev, peer);
|
||||||
if (err) {
|
if (err) {
|
||||||
BT_DBG("recv pkt %d", err);
|
BT_DBG("recv pkt %d", err);
|
||||||
err = -EAGAIN;
|
err = -EAGAIN;
|
||||||
|
|
Loading…
Reference in New Issue