diff mbox

[3/6] Bluetooth: 6lowpan: Use netif APIs to flow control

Message ID 20170411192103.3209-3-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Luiz Augusto von Dentz April 11, 2017, 7:21 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Rely on netif_wake_queue and netif_stop_queue to flow control when
transmit resources are unavailable.

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

Comments

Jukka Rissanen April 12, 2017, 1:57 p.m. UTC | #1
Hi Luiz,


On Tue, 2017-04-11 at 22:21 +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Rely on netif_wake_queue and netif_stop_queue to flow control when
> transmit resources are unavailable.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>  net/bluetooth/6lowpan.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index 22bd936..dc7fda3 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -867,12 +867,28 @@ static struct sk_buff *chan_alloc_skb_cb(struct
> l2cap_chan *chan,
>  
>  static void chan_suspend_cb(struct l2cap_chan *chan)
>  {
> +	struct lowpan_btle_dev *dev;
> +
>  	BT_DBG("chan %p suspend", chan);
> +
> +	dev = lookup_dev(chan->conn);
> +	if (!dev || !dev->netdev)
> +		return;
> +
> +	netif_stop_queue(dev->netdev);
>  }
>  
>  static void chan_resume_cb(struct l2cap_chan *chan)
>  {
> +	struct lowpan_btle_dev *dev;
> +
>  	BT_DBG("chan %p resume", chan);
> +
> +	dev = lookup_dev(chan->conn);
> +	if (!dev || !dev->netdev)
> +		return;
> +
> +	netif_wake_queue(dev->netdev);
>  }
>  
>  static long chan_get_sndtimeo_cb(struct l2cap_chan *chan)


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


Cheers,
Jukka


--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 22bd936..dc7fda3 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -867,12 +867,28 @@  static struct sk_buff *chan_alloc_skb_cb(struct l2cap_chan *chan,
 
 static void chan_suspend_cb(struct l2cap_chan *chan)
 {
+	struct lowpan_btle_dev *dev;
+
 	BT_DBG("chan %p suspend", chan);
+
+	dev = lookup_dev(chan->conn);
+	if (!dev || !dev->netdev)
+		return;
+
+	netif_stop_queue(dev->netdev);
 }
 
 static void chan_resume_cb(struct l2cap_chan *chan)
 {
+	struct lowpan_btle_dev *dev;
+
 	BT_DBG("chan %p resume", chan);
+
+	dev = lookup_dev(chan->conn);
+	if (!dev || !dev->netdev)
+		return;
+
+	netif_wake_queue(dev->netdev);
 }
 
 static long chan_get_sndtimeo_cb(struct l2cap_chan *chan)