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.
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
net/6lowpan/core.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c
index 5f9909a..40d3d72 100644
--- a/net/6lowpan/core.c
+++ b/net/6lowpan/core.c
@@ -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;
--
2.9.3
Hi Luiz,
> 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.
>
> 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
On Tue, 2017-04-11 at 22:21 +0300, Luiz Augusto von Dentz wrote:
> From: Patrik Flykt <[email protected]>
>
> The IPv6 stack needs to send and receive Neighbor Discovery
> messages. Remove the IFF_POINTOPOINT flag.
>
> 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(-)
>
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index a4deba6..6089599 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -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;
>
Acked-by: Jukka Rissanen <[email protected]>
Cheers,
Jukka
Hi Luiz,
On Tue, 2017-04-11 at 22:21 +0300, Luiz Augusto von Dentz wrote:
> 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(+)
>
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index dc7fda3..a4deba6 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -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;
Acked-by: Jukka Rissanen <[email protected]>
Cheers,
Jukka
Hi Luiz,
On Tue, 2017-04-11 at 22:21 +0300, Luiz Augusto von Dentz wrote:
> 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(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 3a202b0..f88ac995 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -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);
Acked-by: Jukka Rissanen <[email protected]>
Cheers,
Jukka
Hi Luiz,
On Tue, 2017-04-11 at 22:21 +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> Rely on netif_wake_queue and netif_stop_queue to 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(+)
>
> 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 <[email protected]>
Cheers,
Jukka
Hi Luiz,
On Tue, 2017-04-11 at 22:20 +0300, Luiz Augusto von Dentz wrote:
> 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.
>
> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
> ---
> net/bluetooth/6lowpan.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index 5b91e85..22bd936 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -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;
> }
Acked-by: Jukka Rissanen <[email protected]>
Cheers,
Jukka
Hi Luiz,
On Tue, 2017-04-11 at 22:20 +0300, Luiz Augusto von Dentz wrote:
> 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.
>
> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
> ---
> net/6lowpan/core.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c
> index 5f9909a..40d3d72 100644
> --- a/net/6lowpan/core.c
> +++ b/net/6lowpan/core.c
> @@ -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;
>
Acked-by: Jukka Rissanen <[email protected]>
Cheers,
Jukka
From: Patrik Flykt <[email protected]>
The IPv6 stack needs to send and receive Neighbor Discovery
messages. Remove the IFF_POINTOPOINT flag.
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(-)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index a4deba6..6089599 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -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;
--
2.9.3
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(+)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index dc7fda3..a4deba6 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -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;
--
2.9.3
From: Luiz Augusto von Dentz <[email protected]>
Rely on netif_wake_queue and netif_stop_queue to 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(+)
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)
--
2.9.3
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(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3a202b0..f88ac995 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -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);
--
2.9.3
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.
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
---
net/bluetooth/6lowpan.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 5b91e85..22bd936 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -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;
}
--
2.9.3