Commit 37d9cf1a authored by Toke Høiland-Jørgensen's avatar Toke Høiland-Jørgensen Committed by David S. Miller

sched: Fix detection of empty queues in child qdiscs

Several qdiscs check on enqueue whether the packet was enqueued to a class
with an empty queue, in which case the class is activated. This is done by
checking if the qlen is exactly 1 after enqueue. However, if GSO splitting
is enabled in the child qdisc, a single packet can result in a qlen longer
than 1. This means the activation check fails, leading to a stalled queue.

Fix this by checking if the queue is empty *before* enqueue, and running
the activation logic if this was the case.
Reported-by: default avatarPete Heist <pete@heistp.net>
Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f6bab199
...@@ -354,6 +354,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -354,6 +354,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
struct drr_sched *q = qdisc_priv(sch); struct drr_sched *q = qdisc_priv(sch);
struct drr_class *cl; struct drr_class *cl;
int err = 0; int err = 0;
bool first;
cl = drr_classify(skb, sch, &err); cl = drr_classify(skb, sch, &err);
if (cl == NULL) { if (cl == NULL) {
...@@ -363,6 +364,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -363,6 +364,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
return err; return err;
} }
first = !cl->qdisc->q.qlen;
err = qdisc_enqueue(skb, cl->qdisc, to_free); err = qdisc_enqueue(skb, cl->qdisc, to_free);
if (unlikely(err != NET_XMIT_SUCCESS)) { if (unlikely(err != NET_XMIT_SUCCESS)) {
if (net_xmit_drop_count(err)) { if (net_xmit_drop_count(err)) {
...@@ -372,7 +374,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -372,7 +374,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch,
return err; return err;
} }
if (cl->qdisc->q.qlen == 1) { if (first) {
list_add_tail(&cl->alist, &q->active); list_add_tail(&cl->alist, &q->active);
cl->deficit = cl->quantum; cl->deficit = cl->quantum;
} }
......
...@@ -1542,6 +1542,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) ...@@ -1542,6 +1542,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
unsigned int len = qdisc_pkt_len(skb); unsigned int len = qdisc_pkt_len(skb);
struct hfsc_class *cl; struct hfsc_class *cl;
int uninitialized_var(err); int uninitialized_var(err);
bool first;
cl = hfsc_classify(skb, sch, &err); cl = hfsc_classify(skb, sch, &err);
if (cl == NULL) { if (cl == NULL) {
...@@ -1551,6 +1552,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) ...@@ -1551,6 +1552,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
return err; return err;
} }
first = !cl->qdisc->q.qlen;
err = qdisc_enqueue(skb, cl->qdisc, to_free); err = qdisc_enqueue(skb, cl->qdisc, to_free);
if (unlikely(err != NET_XMIT_SUCCESS)) { if (unlikely(err != NET_XMIT_SUCCESS)) {
if (net_xmit_drop_count(err)) { if (net_xmit_drop_count(err)) {
...@@ -1560,7 +1562,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) ...@@ -1560,7 +1562,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
return err; return err;
} }
if (cl->qdisc->q.qlen == 1) { if (first) {
if (cl->cl_flags & HFSC_RSC) if (cl->cl_flags & HFSC_RSC)
init_ed(cl, len); init_ed(cl, len);
if (cl->cl_flags & HFSC_FSC) if (cl->cl_flags & HFSC_FSC)
......
...@@ -1215,6 +1215,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -1215,6 +1215,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
struct qfq_class *cl; struct qfq_class *cl;
struct qfq_aggregate *agg; struct qfq_aggregate *agg;
int err = 0; int err = 0;
bool first;
cl = qfq_classify(skb, sch, &err); cl = qfq_classify(skb, sch, &err);
if (cl == NULL) { if (cl == NULL) {
...@@ -1236,6 +1237,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -1236,6 +1237,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
} }
gso_segs = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1; gso_segs = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
first = !cl->qdisc->q.qlen;
err = qdisc_enqueue(skb, cl->qdisc, to_free); err = qdisc_enqueue(skb, cl->qdisc, to_free);
if (unlikely(err != NET_XMIT_SUCCESS)) { if (unlikely(err != NET_XMIT_SUCCESS)) {
pr_debug("qfq_enqueue: enqueue failed %d\n", err); pr_debug("qfq_enqueue: enqueue failed %d\n", err);
...@@ -1253,7 +1255,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, ...@@ -1253,7 +1255,7 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
agg = cl->agg; agg = cl->agg;
/* if the queue was not empty, then done here */ /* if the queue was not empty, then done here */
if (cl->qdisc->q.qlen != 1) { if (!first) {
if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) && if (unlikely(skb == cl->qdisc->ops->peek(cl->qdisc)) &&
list_first_entry(&agg->active, struct qfq_class, alist) list_first_entry(&agg->active, struct qfq_class, alist)
== cl && cl->deficit < len) == cl && cl->deficit < len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment