All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup
@ 2017-04-03 14:48 Luiz Augusto von Dentz
  2017-04-03 14:48 ` [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt Luiz Augusto von Dentz
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2017-04-03 14:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: aar, jukka.rissanen, linux-wpan

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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>
---
 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;
-- 
2.9.3


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

* [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt
  2017-04-03 14:48 [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Luiz Augusto von Dentz
@ 2017-04-03 14:48 ` Luiz Augusto von Dentz
  2017-04-05 12:23   ` Jukka Rissanen
  2017-04-03 14:48 ` [PATCH 3/3] Bluetooth: L2CAP: Don't return -EAGAIN if out of credits Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2017-04-03 14:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: aar, jukka.rissanen, linux-wpan

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes should make it more clear why a packet is being dropped.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/6lowpan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 2063e96..5b91e85 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -337,6 +337,7 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
 
 		ret = iphc_decompress(local_skb, dev, peer);
 		if (ret < 0) {
+			BT_DBG("iphc_decompress failed: %d", ret);
 			kfree_skb(local_skb);
 			goto drop;
 		}
@@ -356,6 +357,7 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
 		consume_skb(local_skb);
 		consume_skb(skb);
 	} else {
+		BT_DBG("unknown packet type");
 		goto drop;
 	}
 
-- 
2.9.3


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

* [PATCH 3/3] Bluetooth: L2CAP: Don't return -EAGAIN if out of credits
  2017-04-03 14:48 [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Luiz Augusto von Dentz
  2017-04-03 14:48 ` [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt Luiz Augusto von Dentz
@ 2017-04-03 14:48 ` Luiz Augusto von Dentz
  2017-04-05 12:24   ` Jukka Rissanen
  2017-04-05 12:23 ` [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Jukka Rissanen
  2017-04-05 13:47 ` Marcel Holtmann
  3 siblings, 1 reply; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2017-04-03 14:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: aar, jukka.rissanen, linux-wpan

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Just keep queueing them into TX queue since the caller might just have
to do the same and there is no impact in adding another packet to the
TX queue even if there aren't any credits to transmit them.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/l2cap_core.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index fc7f321..3a202b0 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -2458,9 +2458,6 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
 		if (len > chan->omtu)
 			return -EMSGSIZE;
 
-		if (!chan->tx_credits)
-			return -EAGAIN;
-
 		__skb_queue_head_init(&seg_queue);
 
 		err = l2cap_segment_le_sdu(chan, &seg_queue, msg, len);
-- 
2.9.3


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

* Re: [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup
  2017-04-03 14:48 [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Luiz Augusto von Dentz
  2017-04-03 14:48 ` [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt Luiz Augusto von Dentz
  2017-04-03 14:48 ` [PATCH 3/3] Bluetooth: L2CAP: Don't return -EAGAIN if out of credits Luiz Augusto von Dentz
@ 2017-04-05 12:23 ` Jukka Rissanen
  2017-04-05 13:47 ` Marcel Holtmann
  3 siblings, 0 replies; 7+ messages in thread
From: Jukka Rissanen @ 2017-04-05 12:23 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth; +Cc: aar, linux-wpan

Hi Luiz,

On Mon, 2017-04-03 at 17:48 +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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>
> ---
>  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;


Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


Cheers,
Jukka



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

* Re: [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt
  2017-04-03 14:48 ` [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt Luiz Augusto von Dentz
@ 2017-04-05 12:23   ` Jukka Rissanen
  0 siblings, 0 replies; 7+ messages in thread
From: Jukka Rissanen @ 2017-04-05 12:23 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth; +Cc: aar, linux-wpan

Hi Luiz,

On Mon, 2017-04-03 at 17:48 +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This makes should make it more clear why a packet is being dropped.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>  net/bluetooth/6lowpan.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index 2063e96..5b91e85 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -337,6 +337,7 @@ static int recv_pkt(struct sk_buff *skb, struct
> net_device *dev,
>  
>  		ret = iphc_decompress(local_skb, dev, peer);
>  		if (ret < 0) {
> +			BT_DBG("iphc_decompress failed: %d", ret);
>  			kfree_skb(local_skb);
>  			goto drop;
>  		}
> @@ -356,6 +357,7 @@ static int recv_pkt(struct sk_buff *skb, struct
> net_device *dev,
>  		consume_skb(local_skb);
>  		consume_skb(skb);
>  	} else {
> +		BT_DBG("unknown packet type");
>  		goto drop;
>  	}
>  

Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


Cheers,
Jukka


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

* Re: [PATCH 3/3] Bluetooth: L2CAP: Don't return -EAGAIN if out of credits
  2017-04-03 14:48 ` [PATCH 3/3] Bluetooth: L2CAP: Don't return -EAGAIN if out of credits Luiz Augusto von Dentz
@ 2017-04-05 12:24   ` Jukka Rissanen
  0 siblings, 0 replies; 7+ messages in thread
From: Jukka Rissanen @ 2017-04-05 12:24 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth; +Cc: aar, linux-wpan

Hi Luiz,

On Mon, 2017-04-03 at 17:48 +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Just keep queueing them into TX queue since the caller might just
> have
> to do the same and there is no impact in adding another packet to the
> TX queue even if there aren't any credits to transmit them.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>  net/bluetooth/l2cap_core.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index fc7f321..3a202b0 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -2458,9 +2458,6 @@ int l2cap_chan_send(struct l2cap_chan *chan,
> struct msghdr *msg, size_t len)
>  		if (len > chan->omtu)
>  			return -EMSGSIZE;
>  
> -		if (!chan->tx_credits)
> -			return -EAGAIN;
> -
>  		__skb_queue_head_init(&seg_queue);
>  
>  		err = l2cap_segment_le_sdu(chan, &seg_queue, msg,
> len);


Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


Cheers,
Jukka


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

* Re: [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup
  2017-04-03 14:48 [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2017-04-05 12:23 ` [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Jukka Rissanen
@ 2017-04-05 13:47 ` Marcel Holtmann
  3 siblings, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2017-04-05 13:47 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Linux Bluetooth, Alexander Aring, Jukka Rissanen, linux-wpan

Hi Luiz,

> 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>
> ---
> net/bluetooth/6lowpan.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)

all 3 patches have been applied to bluetooth-next tree.

Regards

Marcel


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

end of thread, other threads:[~2017-04-05 13:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 14:48 [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Luiz Augusto von Dentz
2017-04-03 14:48 ` [PATCH 2/3] Bluetooth: 6lowpan: Print errors during recv_pkt Luiz Augusto von Dentz
2017-04-05 12:23   ` Jukka Rissanen
2017-04-03 14:48 ` [PATCH 3/3] Bluetooth: L2CAP: Don't return -EAGAIN if out of credits Luiz Augusto von Dentz
2017-04-05 12:24   ` Jukka Rissanen
2017-04-05 12:23 ` [PATCH 1/3] Bluetooth: 6lowpan: Remove unnecessary peer lookup Jukka Rissanen
2017-04-05 13:47 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.