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>
(cherry picked from commit b8419fe690053b76658d49565c57ac654faf2eaa)
(cherry picked from commit 3a30e7aa4487f56a74f12c12f11cece6ce1f2100)
This commit is contained in:
Tianyi Gou 2012-08-06 17:23:26 -07:00 committed by Stephen Boyd
parent a2738d1460
commit 53261a559d
2 changed files with 31 additions and 1 deletions

View file

@ -103,7 +103,8 @@ extern int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res);
extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res);
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.
*/

View file

@ -1029,6 +1029,35 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
return 0;
}
/*
* 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.
*/