summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTianyi Gou <tgou@codeaurora.org>2011-05-31 13:23:01 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:05:53 -0700
commita4dc73226985d6226a3e7a04089f6ec5754a7c6d (patch)
treedafdad95a424ed37b1091531f8af1f949882579c /net
parent84b4c1cc42d2e20aeb91d8fac074214563e19153 (diff)
net_sched: Add flow control support to prio qdisc
Add enable_flow flag to the prio qdisc. Packet flow is enabled by default, but can be disabled from userspace (e.g. IPROUTE2 tc tool). This allows for suspending packet dequeue on a per-qdisc basis, which is needed to supprot Quality of Service (QOS) when using WWAN modem. Change-Id: I932f296be946f1acc3b00c7d8569bbb733d33622 Acked-by: Andrew Richardson <randrew@qualcomm.com> CRs-Fixed: 283471 Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
Diffstat (limited to 'net')
-rw-r--r--net/sched/sch_prio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index ba6487f2741f..a8891a51af34 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -27,6 +27,7 @@ struct prio_sched_data {
struct tcf_proto __rcu *filter_list;
u8 prio2band[TC_PRIO_MAX+1];
struct Qdisc *queues[TCQ_PRIO_BANDS];
+ u8 enable_flow;
};
@@ -98,6 +99,9 @@ static struct sk_buff *prio_peek(struct Qdisc *sch)
struct prio_sched_data *q = qdisc_priv(sch);
int prio;
+ if (!q->enable_flow)
+ return NULL;
+
for (prio = 0; prio < q->bands; prio++) {
struct Qdisc *qdisc = q->queues[prio];
struct sk_buff *skb = qdisc->ops->peek(qdisc);
@@ -112,6 +116,9 @@ static struct sk_buff *prio_dequeue(struct Qdisc *sch)
struct prio_sched_data *q = qdisc_priv(sch);
int prio;
+ if (!q->enable_flow)
+ return NULL;
+
for (prio = 0; prio < q->bands; prio++) {
struct Qdisc *qdisc = q->queues[prio];
struct sk_buff *skb = qdisc_dequeue_peeked(qdisc);
@@ -152,6 +159,7 @@ prio_reset(struct Qdisc *sch)
for (prio = 0; prio < q->bands; prio++)
qdisc_reset(q->queues[prio]);
sch->q.qlen = 0;
+ q->enable_flow = 1;
}
static void
@@ -184,6 +192,7 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt)
}
sch_tree_lock(sch);
+ q->enable_flow = qopt->enable_flow;
q->bands = qopt->bands;
memcpy(q->prio2band, qopt->priomap, TC_PRIO_MAX+1);
@@ -247,6 +256,7 @@ static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
struct tc_prio_qopt opt;
opt.bands = q->bands;
+ opt.enable_flow = q->enable_flow;
memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX + 1);
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))