act_police.c (5a2dd72abdae75ea2960145e0549635ce4e0be96) act_police.c (a883bf564ea555447a76682bb2d8d4bc92e23e0e)
1/*
2 * net/sched/police.c Input police filter.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 169 unchanged lines hidden (view full) ---

178 police->tcf_bindcnt = 1;
179override:
180 if (parm->rate.rate) {
181 err = -ENOMEM;
182 R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE]);
183 if (R_tab == NULL)
184 goto failure;
185
1/*
2 * net/sched/police.c Input police filter.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 169 unchanged lines hidden (view full) ---

178 police->tcf_bindcnt = 1;
179override:
180 if (parm->rate.rate) {
181 err = -ENOMEM;
182 R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE]);
183 if (R_tab == NULL)
184 goto failure;
185
186 if (!est && (ret == ACT_P_CREATED ||
187 !gen_estimator_active(&police->tcf_bstats,
188 &police->tcf_rate_est))) {
189 err = -EINVAL;
190 goto failure;
191 }
192
193 if (parm->peakrate.rate) {
194 P_tab = qdisc_get_rtab(&parm->peakrate,
195 tb[TCA_POLICE_PEAKRATE]);
196 if (P_tab == NULL)
197 goto failure;
198 }
199 }
200
201 spin_lock_bh(&police->tcf_lock);
202 if (est) {
203 err = gen_replace_estimator(&police->tcf_bstats,
204 &police->tcf_rate_est,
205 &police->tcf_lock, est);
206 if (err)
207 goto failure_unlock;
186 if (parm->peakrate.rate) {
187 P_tab = qdisc_get_rtab(&parm->peakrate,
188 tb[TCA_POLICE_PEAKRATE]);
189 if (P_tab == NULL)
190 goto failure;
191 }
192 }
193
194 spin_lock_bh(&police->tcf_lock);
195 if (est) {
196 err = gen_replace_estimator(&police->tcf_bstats,
197 &police->tcf_rate_est,
198 &police->tcf_lock, est);
199 if (err)
200 goto failure_unlock;
201 } else if (tb[TCA_POLICE_AVRATE] &&
202 (ret == ACT_P_CREATED ||
203 !gen_estimator_active(&police->tcf_bstats,
204 &police->tcf_rate_est))) {
205 err = -EINVAL;
206 goto failure_unlock;
208 }
209
210 /* No failure allowed after this point */
211 if (R_tab != NULL) {
212 qdisc_put_rtab(police->tcfp_R_tab);
213 police->tcfp_R_tab = R_tab;
214 }
215 if (P_tab != NULL) {

--- 184 unchanged lines hidden ---
207 }
208
209 /* No failure allowed after this point */
210 if (R_tab != NULL) {
211 qdisc_put_rtab(police->tcfp_R_tab);
212 police->tcfp_R_tab = R_tab;
213 }
214 if (P_tab != NULL) {

--- 184 unchanged lines hidden ---