Bluetooth: 6lowpan: Use netif APIs to flow control
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 11 Apr 2017 19:21:00 +0000 (22:21 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Apr 2017 20:02:40 +0000 (22:02 +0200)
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>
Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/6lowpan.c

index 22bd936..dc7fda3 100644 (file)
@@ -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)