6lowpan: Don't set IFF_NO_QUEUE
Subsystems (5)
Luiz Augusto von Dentz
maintainerPATCH 1/6 6lowpan: Don't set IFF_NO_QUEUE
From: Luiz Augusto von Dentz <[email protected]>
There is no point in setting IFF_NO_QUEUE should already have taken care of setting it if tx_queue_len is not set, in fact this may actually disable queue for interfaces that require it and do set tx_queue_len.
--- net/6lowpan/core.c | 1 - 1 file changed, 1 deletion(-)
net/6lowpan/core.c +0 -1
@@ -35,7 +35,6 @@ int lowpan_register_netdevice(struct net_device *dev, dev->type =ARPHRD_6LOWPAN ; dev->mtu =IPV6_MIN_MTU ; - dev->priv_flags |=IFF_NO_QUEUE ;lowpan_dev (dev)->lltype = lltype;
Signature · 1 line
2.9.3
Luiz Augusto von Dentz
maintainerPATCH 2/6 Bluetooth: 6lowpan: Don't drop packets when run out of credits
From: Luiz Augusto von Dentz <[email protected]>
Since l2cap_chan_send will now queue the packets there is no point in checking the credits anymore.
--- net/bluetooth/6lowpan.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
net/bluetooth/6lowpan.c +2 -9
@@ -478,15 +478,8 @@ static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb,return 0 ; } -if (!err) - err = (!chan->tx_credits ? -EAGAIN :0 ); - -if (err <0 ) { -if (err == -EAGAIN ) - netdev->stats.tx_dropped++; -else - netdev->stats.tx_errors++; - } +if (err <0 ) + netdev->stats.tx_errors++;return err; }
Signature · 1 line
2.9.3
Luiz Augusto von Dentz
maintainerPATCH 3/6 Bluetooth: 6lowpan: Use netif APIs to flow control
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Rely on netif_wake_queue and netif_stop_queue to flow control when transmit resources are unavailable.
--- net/bluetooth/6lowpan.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/bluetooth/6lowpan.c +16 -0
@@ -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)
Signature · 1 line
2.9.3
Luiz Augusto von Dentz
maintainerPATCH 4/6 Bluetooth: L2CAP: Add l2cap_le_flowctl_send
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Consolidate code sending data to LE CoC channels and adds proper accounting of packets sent, the remaining credits and how many packets are queued.
--- net/bluetooth/l2cap_core.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
net/bluetooth/l2cap_core.c +19 -8
@@ -2425,6 +2425,22 @@ static int l2cap_segment_le_sdu(struct l2cap_chan *chan,return 0 ; } +static void l2cap_le_flowctl_send (struct l2cap_chan *chan) +{ +int sent =0 ; + +BT_DBG ("chan %p" , chan); + +while (chan->tx_credits && !skb_queue_empty (&chan->tx_q)) { +l2cap_do_send (chan,skb_dequeue (&chan->tx_q)); + chan->tx_credits--; + sent++; + } + +BT_DBG ("Sent %d credits %u queued %u" , sent, chan->tx_credits, +skb_queue_len (&chan->tx_q)); +} +int l2cap_chan_send (struct l2cap_chan *chan,struct msghdr *msg,size_t len) {struct sk_buff *skb;
@@ -2472,10 +2488,7 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)skb_queue_splice_tail_init (&seg_queue, &chan->tx_q); -while (chan->tx_credits && !skb_queue_empty (&chan->tx_q)) { -l2cap_do_send (chan,skb_dequeue (&chan->tx_q)); - chan->tx_credits--; - } +l2cap_le_flowctl_send (chan);if (!chan->tx_credits) chan->ops->suspend (chan);
@@ -5567,10 +5580,8 @@ static inline int l2cap_le_credits(struct l2cap_conn *conn, chan->tx_credits += credits; -while (chan->tx_credits && !skb_queue_empty (&chan->tx_q)) { -l2cap_do_send (chan,skb_dequeue (&chan->tx_q)); - chan->tx_credits--; - } +/* Resume sending */ +l2cap_le_flowctl_send (chan);if (chan->tx_credits) chan->ops->resume (chan);
Signature · 1 line
2.9.3
Luiz Augusto von Dentz
maintainerPATCH 5/6 Bluetooth: 6lowpan: Set tx_queue_len to DEFAULT_TX_QUEUE_LEN
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Make netdev queue packets if we run out of credits.
--- net/bluetooth/6lowpan.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/6lowpan.c +2 -0
@@ -20,6 +20,7 @@#include <net/ipv6.h> #include <net/ip6_route.h> #include <net/addrconf.h> +#include <net/pkt_sched.h> #include <net/bluetooth/bluetooth.h> #include <net/bluetooth/hci_core.h>
@@ -594,6 +595,7 @@ static void netdev_setup(struct net_device *dev) dev->flags =IFF_RUNNING |IFF_POINTOPOINT |IFF_MULTICAST ; dev->watchdog_timeo =0 ; + dev->tx_queue_len =DEFAULT_TX_QUEUE_LEN ; dev->netdev_ops = &netdev_ops; dev->header_ops = &header_ops;
Signature · 1 line
2.9.3
Luiz Augusto von Dentz
maintainerPATCH 6/6 bluetooth: Do not set IFF_POINTOPOINT
In reply to Luiz Augusto von DentzFrom: Patrik Flykt <[email protected]>
The IPv6 stack needs to send and receive Neighbor Discovery messages. Remove the IFF_POINTOPOINT flag.
--- net/bluetooth/6lowpan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/bluetooth/6lowpan.c +1 -2
@@ -592,8 +592,7 @@ static void netdev_setup(struct net_device *dev) { dev->hard_header_len =0 ; dev->needed_tailroom =0 ; - dev->flags =IFF_RUNNING |IFF_POINTOPOINT | -IFF_MULTICAST ; + dev->flags =IFF_RUNNING |IFF_MULTICAST ; dev->watchdog_timeo =0 ; dev->tx_queue_len =DEFAULT_TX_QUEUE_LEN ;
Signature · 1 line
2.9.3
Hi Luiz,
Quoted 22 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
There is no point in setting
IFF_NO_QUEUEshould already have taken care of setting it iftx_queue_lenis not set, in fact this may actually disable queue for interfaces that require it and do settx_queue_len.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/6lowpan/core.c | 1 -1 file changed, 1 deletion(-)net/6lowpan/core.c +0
-0@@ -35,7 +35,6 @@ int lowpan_register_netdevice(struct net_device *dev,
dev->type=ARPHRD_6LOWPAN;
dev->mtu=IPV6_MIN_MTU;net/6lowpan/core.c +0
-1- dev->priv_flags |=IFF_NO_QUEUE ;
Quoted 3 lines
lowpan_dev(dev)->lltype = lltype;
Cheers,
Jukka
Re: [PATCH 2/6] Bluetooth: 6lowpan: Don't drop packets when run out of credits
In reply to Luiz Augusto von DentzHi Luiz,
Quoted 30 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Since
l2cap_chan_sendwill now queue the packets there is no point in checking the credits anymore.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/6lowpan.c | 11 ++---------1 file changed, 2 insertions(+), 9 deletions(-)net/bluetooth/6lowpan.c +0
-0@@ -478,15 +478,8 @@ static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb, return 0; }net/bluetooth/6lowpan.c +2
-9-if (!err) - err = (!chan->tx_credits ? -EAGAIN :0 ); - -if (err <0 ) { -if (err == -EAGAIN ) - netdev->stats.tx_dropped++; -else - netdev->stats.tx_errors++; - } +if (err <0 ) + netdev->stats.tx_errors++;
Quoted 3 lines
return err;
}
Cheers,
Jukka
Re: [PATCH 3/6] Bluetooth: 6lowpan: Use netif APIs to flow control
In reply to Luiz Augusto von DentzHi Luiz,
Quoted 41 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Rely on
netif_wake_queueandnetif_stop_queueto flow control when transmit resources are unavailable.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/6lowpan.c | 16 ++++++++++++++++1 file changed, 16 insertions(+)net/bluetooth/6lowpan.c +0
-0@@ -867,12 +867,28 @@ static struct sk_buff *chan_alloc_skb_cb(struct l2cap_chan *chan,
static voidchan_suspend_cb(struct l2cap_chan *chan){net/bluetooth/6lowpan.c +2
-0+struct lowpan_btle_dev *dev; +
BT_DBG("chan %p suspend", chan);net/bluetooth/6lowpan.c +6
-0+ + dev =lookup_dev (chan->conn); +if (!dev || !dev->netdev) +return ; + +netif_stop_queue (dev->netdev);}
static voidchan_resume_cb(struct l2cap_chan *chan){net/bluetooth/6lowpan.c +2
-0+struct lowpan_btle_dev *dev; +
BT_DBG("chan %p resume", chan);net/bluetooth/6lowpan.c +6
-0+ + dev =lookup_dev (chan->conn); +if (!dev || !dev->netdev) +return ; + +netif_wake_queue (dev->netdev);
Quoted 3 lines
}
static longchan_get_sndtimeo_cb(struct l2cap_chan *chan)
Cheers,
Jukka
Re: [PATCH 4/6] Bluetooth: L2CAP: Add l2cap_le_flowctl_send
In reply to Luiz Augusto von DentzHi Luiz,
Quoted 68 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Consolidate code sending data to LE CoC channels and adds proper accounting of packets sent, the remaining credits and how many packets
are queued.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/l2cap_core.c | 27 +++++++++++++++++++--------1 file changed, 19 insertions(+), 8 deletions(-)net/bluetooth/l2cap_core.c +0
-0@@ -2425,6 +2425,22 @@ static int l2cap_segment_le_sdu(struct l2cap_chan *chan, return 0; }net/bluetooth/l2cap_core.c +13
-0+static void l2cap_le_flowctl_send (struct l2cap_chan *chan) +{ +int sent =0 ; + +BT_DBG ("chan %p" , chan); + +while (chan->tx_credits && !skb_queue_empty (&chan->tx_q)) { +l2cap_do_send (chan,skb_dequeue (&chan->tx_q)); + chan->tx_credits--; + sent++; + } + + BT_DBG("Sent %d credits %u queued %u", sent, chan-Quoted 1 line
tx_credits,net/bluetooth/l2cap_core.c +3
-0+ skb_queue_len(&chan->tx_q)); +} +int
l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
{
structsk_buff*skb;net/bluetooth/l2cap_core.c +0
-0@@ -2472,10 +2488,7 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len)
skb_queue_splice_tail_init(&seg_queue, &chan->tx_q);net/bluetooth/l2cap_core.c +0
-1- while (chan->tx_credits && !skb_queue_empty(&chan-Quoted 1 line
tx_q)) {net/bluetooth/l2cap_core.c +0
-1- l2cap_do_send(chan, skb_dequeue(&chan-Quoted 1 line
tx_q));net/bluetooth/l2cap_core.c +1
-2- chan->tx_credits--; - } +l2cap_le_flowctl_send (chan);
if (!chan->tx_credits)
chan->ops->suspend(chan);net/bluetooth/l2cap_core.c +0
-0@@ -5567,10 +5580,8 @@ static inline int l2cap_le_credits(struct l2cap_conn *conn,
chan->tx_credits+= credits;net/bluetooth/l2cap_core.c +2
-4-while (chan->tx_credits && !skb_queue_empty (&chan->tx_q)) { -l2cap_do_send (chan,skb_dequeue (&chan->tx_q)); - chan->tx_credits--; - } +/* Resume sending */ +l2cap_le_flowctl_send (chan);
Quoted 3 lines
if (chan->tx_credits)
chan->ops->resume(chan);
Cheers,
Jukka
Re: [PATCH 5/6] Bluetooth: 6lowpan: Set tx_queue_len to DEFAULT_TX_QUEUE_LEN
In reply to Luiz Augusto von DentzHi Luiz,
Quoted 26 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
Make netdev queue packets if we run out of credits.
Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/6lowpan.c | 2 ++1 file changed, 2 insertions(+)net/bluetooth/6lowpan.c +1
-0@@ -20,6 +20,7 @@ #include <net/ipv6.h> #include <net/ip6_route.h> #include <net/addrconf.h> +#include <net/pkt_sched.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>net/bluetooth/6lowpan.c +0
-0@@ -594,6 +595,7 @@ static void netdev_setup(struct net_device *dev)
dev->flags=IFF_RUNNING|IFF_POINTOPOINT|
IFF_MULTICAST;
dev->watchdog_timeo= 0;net/bluetooth/6lowpan.c +1
-0+ dev->tx_queue_len =DEFAULT_TX_QUEUE_LEN ;
Quoted 3 lines
dev->netdev_ops=&netdev_ops;
dev->header_ops=&header_ops;
Cheers,
Jukka
Re: [PATCH 6/6] bluetooth: Do not set IFF_POINTOPOINT
In reply to Luiz Augusto von DentzQuoted 24 lines · Luiz Augusto von Dentz
From: Patrik Flykt <[email protected]>
The IPv6 stack needs to send and receive Neighbor Discovery messages. Remove the
IFF_POINTOPOINTflag.Signed-off-by Patrik Flykt <[email protected]>Reviewed-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/6lowpan.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)net/bluetooth/6lowpan.c +1
-2@@ -592,8 +592,7 @@ static void netdev_setup(struct net_device *dev) { dev->hard_header_len = 0; dev->needed_tailroom = 0; - dev->flags =IFF_RUNNING |IFF_POINTOPOINT | - IFF_MULTICAST; + dev->flags =IFF_RUNNING |IFF_MULTICAST ; dev->watchdog_timeo = 0; dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
Quoted 1 line
Cheers,
Jukka
Marcel Holtmann
maintainerHi Luiz,
Quoted 9 lines
There is no point in setting
IFF_NO_QUEUEshould already have taken care of setting it iftx_queue_lenis not set, in fact this may actually disable queue for interfaces that require it and do settx_queue_len.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/6lowpan/core.c| 1 -1 file changed, 1 deletion(-)
all 6 patches have been applied to bluetooth-next tree.
Regards
Marcel