aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_gact.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /net/sched/act_gact.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'net/sched/act_gact.c')
-rw-r--r--net/sched/act_gact.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 05d60859d8e..b77f5a06a65 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -67,9 +67,6 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
67 struct tcf_common *pc; 67 struct tcf_common *pc;
68 int ret = 0; 68 int ret = 0;
69 int err; 69 int err;
70#ifdef CONFIG_GACT_PROB
71 struct tc_gact_p *p_parm = NULL;
72#endif
73 70
74 if (nla == NULL) 71 if (nla == NULL)
75 return -EINVAL; 72 return -EINVAL;
@@ -85,12 +82,6 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
85#ifndef CONFIG_GACT_PROB 82#ifndef CONFIG_GACT_PROB
86 if (tb[TCA_GACT_PROB] != NULL) 83 if (tb[TCA_GACT_PROB] != NULL)
87 return -EOPNOTSUPP; 84 return -EOPNOTSUPP;
88#else
89 if (tb[TCA_GACT_PROB]) {
90 p_parm = nla_data(tb[TCA_GACT_PROB]);
91 if (p_parm->ptype >= MAX_RAND)
92 return -EINVAL;
93 }
94#endif 85#endif
95 86
96 pc = tcf_hash_check(parm->index, a, bind, &gact_hash_info); 87 pc = tcf_hash_check(parm->index, a, bind, &gact_hash_info);
@@ -112,7 +103,8 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
112 spin_lock_bh(&gact->tcf_lock); 103 spin_lock_bh(&gact->tcf_lock);
113 gact->tcf_action = parm->action; 104 gact->tcf_action = parm->action;
114#ifdef CONFIG_GACT_PROB 105#ifdef CONFIG_GACT_PROB
115 if (p_parm) { 106 if (tb[TCA_GACT_PROB] != NULL) {
107 struct tc_gact_p *p_parm = nla_data(tb[TCA_GACT_PROB]);
116 gact->tcfg_paction = p_parm->paction; 108 gact->tcfg_paction = p_parm->paction;
117 gact->tcfg_pval = p_parm->pval; 109 gact->tcfg_pval = p_parm->pval;
118 gact->tcfg_ptype = p_parm->ptype; 110 gact->tcfg_ptype = p_parm->ptype;
@@ -141,7 +133,7 @@ static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
141 133
142 spin_lock(&gact->tcf_lock); 134 spin_lock(&gact->tcf_lock);
143#ifdef CONFIG_GACT_PROB 135#ifdef CONFIG_GACT_PROB
144 if (gact->tcfg_ptype) 136 if (gact->tcfg_ptype && gact_rand[gact->tcfg_ptype] != NULL)
145 action = gact_rand[gact->tcfg_ptype](gact); 137 action = gact_rand[gact->tcfg_ptype](gact);
146 else 138 else
147 action = gact->tcf_action; 139 action = gact->tcf_action;
@@ -170,8 +162,7 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
170 }; 162 };
171 struct tcf_t t; 163 struct tcf_t t;
172 164
173 if (nla_put(skb, TCA_GACT_PARMS, sizeof(opt), &opt)) 165 NLA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt);
174 goto nla_put_failure;
175#ifdef CONFIG_GACT_PROB 166#ifdef CONFIG_GACT_PROB
176 if (gact->tcfg_ptype) { 167 if (gact->tcfg_ptype) {
177 struct tc_gact_p p_opt = { 168 struct tc_gact_p p_opt = {
@@ -180,15 +171,13 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
180 .ptype = gact->tcfg_ptype, 171 .ptype = gact->tcfg_ptype,
181 }; 172 };
182 173
183 if (nla_put(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt)) 174 NLA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt);
184 goto nla_put_failure;
185 } 175 }
186#endif 176#endif
187 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install); 177 t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
188 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse); 178 t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
189 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires); 179 t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
190 if (nla_put(skb, TCA_GACT_TM, sizeof(t), &t)) 180 NLA_PUT(skb, TCA_GACT_TM, sizeof(t), &t);
191 goto nla_put_failure;
192 return skb->len; 181 return skb->len;
193 182
194nla_put_failure: 183nla_put_failure: