diff options
| author | Tianyi Gou <tgou@codeaurora.org> | 2012-08-06 17:23:26 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:05:53 -0700 |
| commit | 84b4c1cc42d2e20aeb91d8fac074214563e19153 (patch) | |
| tree | e0aacaa74d11cb59126d752632393048a025ddc0 | |
| parent | 85c61fa3ac0e0176d5a3b8ae829eb1a355dafe38 (diff) | |
net: sched: export an api to enable/disable flow on sch
Export a function from sch_api.c that will look up
desired qdisc and call it's registered change function
to enable/disable flow.
Change-Id: I5b6dc7a6fd2b09b796c92b3770ba83423d19c864
CRs-Fixed: 355156
Acked-by: Jimi Shah <jimis@qualcomm.com>
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
| -rw-r--r-- | include/net/pkt_sched.h | 2 | ||||
| -rw-r--r-- | net/sched/sch_api.c | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 401038d2f9b8..38bca33e27d4 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -124,6 +124,8 @@ static inline __be16 tc_skb_protocol(const struct sk_buff *skb) return skb->protocol; } +extern void tc_qdisc_flow_control(struct net_device *dev, u32 tcm_handle, + int flow_enable); /* Calculate maximal size of packet seen by hard_start_xmit routine of this device. */ diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index b5c2cf2aa6d4..f7e6d13e270f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1171,6 +1171,35 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n) } /* + * enable/disable flow on qdisc. + */ +void +tc_qdisc_flow_control(struct net_device *dev, u32 tcm_handle, int enable_flow) +{ + struct Qdisc *q; + struct __qdisc_change_req { + struct nlattr attr; + struct tc_prio_qopt data; + } req = { + .attr = {sizeof(struct __qdisc_change_req), TCA_OPTIONS}, + .data = {3, {1, 2, 2, 2, 1, 2, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1}, 1} + }; + + /* override flow bit */ + req.data.enable_flow = enable_flow; + + /* look up using tcm handle */ + q = qdisc_lookup(dev, tcm_handle); + + /* call registered change function */ + if (q) { + if (q->ops->change(q, &(req.attr)) != 0) + pr_err("tc_qdisc_flow_control: qdisc change failed"); + } +} +EXPORT_SYMBOL(tc_qdisc_flow_control); + +/* * Create/change qdisc. */ |
