|
@@ -118,10 +118,8 @@ void tcf_police_destroy(struct tcf_police *p)
|
|
write_lock_bh(&police_lock);
|
|
write_lock_bh(&police_lock);
|
|
*p1p = p->tcf_next;
|
|
*p1p = p->tcf_next;
|
|
write_unlock_bh(&police_lock);
|
|
write_unlock_bh(&police_lock);
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
gen_kill_estimator(&p->tcf_bstats,
|
|
gen_kill_estimator(&p->tcf_bstats,
|
|
&p->tcf_rate_est);
|
|
&p->tcf_rate_est);
|
|
-#endif
|
|
|
|
if (p->tcfp_R_tab)
|
|
if (p->tcfp_R_tab)
|
|
qdisc_put_rtab(p->tcfp_R_tab);
|
|
qdisc_put_rtab(p->tcfp_R_tab);
|
|
if (p->tcfp_P_tab)
|
|
if (p->tcfp_P_tab)
|
|
@@ -227,7 +225,6 @@ override:
|
|
police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu);
|
|
police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu);
|
|
police->tcf_action = parm->action;
|
|
police->tcf_action = parm->action;
|
|
|
|
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (tb[TCA_POLICE_AVRATE-1])
|
|
if (tb[TCA_POLICE_AVRATE-1])
|
|
police->tcfp_ewma_rate =
|
|
police->tcfp_ewma_rate =
|
|
*(u32*)RTA_DATA(tb[TCA_POLICE_AVRATE-1]);
|
|
*(u32*)RTA_DATA(tb[TCA_POLICE_AVRATE-1]);
|
|
@@ -235,7 +232,6 @@ override:
|
|
gen_replace_estimator(&police->tcf_bstats,
|
|
gen_replace_estimator(&police->tcf_bstats,
|
|
&police->tcf_rate_est,
|
|
&police->tcf_rate_est,
|
|
police->tcf_stats_lock, est);
|
|
police->tcf_stats_lock, est);
|
|
-#endif
|
|
|
|
|
|
|
|
spin_unlock_bh(&police->tcf_lock);
|
|
spin_unlock_bh(&police->tcf_lock);
|
|
if (ret != ACT_P_CREATED)
|
|
if (ret != ACT_P_CREATED)
|
|
@@ -281,14 +277,12 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
|
|
police->tcf_bstats.bytes += skb->len;
|
|
police->tcf_bstats.bytes += skb->len;
|
|
police->tcf_bstats.packets++;
|
|
police->tcf_bstats.packets++;
|
|
|
|
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (police->tcfp_ewma_rate &&
|
|
if (police->tcfp_ewma_rate &&
|
|
police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
|
|
police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
|
|
police->tcf_qstats.overlimits++;
|
|
police->tcf_qstats.overlimits++;
|
|
spin_unlock(&police->tcf_lock);
|
|
spin_unlock(&police->tcf_lock);
|
|
return police->tcf_action;
|
|
return police->tcf_action;
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
|
|
|
|
if (skb->len <= police->tcfp_mtu) {
|
|
if (skb->len <= police->tcfp_mtu) {
|
|
if (police->tcfp_R_tab == NULL) {
|
|
if (police->tcfp_R_tab == NULL) {
|
|
@@ -348,10 +342,8 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
|
|
if (police->tcfp_result)
|
|
if (police->tcfp_result)
|
|
RTA_PUT(skb, TCA_POLICE_RESULT, sizeof(int),
|
|
RTA_PUT(skb, TCA_POLICE_RESULT, sizeof(int),
|
|
&police->tcfp_result);
|
|
&police->tcfp_result);
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (police->tcfp_ewma_rate)
|
|
if (police->tcfp_ewma_rate)
|
|
RTA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate);
|
|
RTA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate);
|
|
-#endif
|
|
|
|
return skb->len;
|
|
return skb->len;
|
|
|
|
|
|
rtattr_failure:
|
|
rtattr_failure:
|
|
@@ -477,14 +469,12 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est)
|
|
goto failure;
|
|
goto failure;
|
|
police->tcfp_result = *(u32*)RTA_DATA(tb[TCA_POLICE_RESULT-1]);
|
|
police->tcfp_result = *(u32*)RTA_DATA(tb[TCA_POLICE_RESULT-1]);
|
|
}
|
|
}
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (tb[TCA_POLICE_AVRATE-1]) {
|
|
if (tb[TCA_POLICE_AVRATE-1]) {
|
|
if (RTA_PAYLOAD(tb[TCA_POLICE_AVRATE-1]) != sizeof(u32))
|
|
if (RTA_PAYLOAD(tb[TCA_POLICE_AVRATE-1]) != sizeof(u32))
|
|
goto failure;
|
|
goto failure;
|
|
police->tcfp_ewma_rate =
|
|
police->tcfp_ewma_rate =
|
|
*(u32*)RTA_DATA(tb[TCA_POLICE_AVRATE-1]);
|
|
*(u32*)RTA_DATA(tb[TCA_POLICE_AVRATE-1]);
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
police->tcfp_toks = police->tcfp_burst = parm->burst;
|
|
police->tcfp_toks = police->tcfp_burst = parm->burst;
|
|
police->tcfp_mtu = parm->mtu;
|
|
police->tcfp_mtu = parm->mtu;
|
|
if (police->tcfp_mtu == 0) {
|
|
if (police->tcfp_mtu == 0) {
|
|
@@ -498,11 +488,9 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est)
|
|
police->tcf_index = parm->index ? parm->index :
|
|
police->tcf_index = parm->index ? parm->index :
|
|
tcf_police_new_index();
|
|
tcf_police_new_index();
|
|
police->tcf_action = parm->action;
|
|
police->tcf_action = parm->action;
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (est)
|
|
if (est)
|
|
gen_new_estimator(&police->tcf_bstats, &police->tcf_rate_est,
|
|
gen_new_estimator(&police->tcf_bstats, &police->tcf_rate_est,
|
|
police->tcf_stats_lock, est);
|
|
police->tcf_stats_lock, est);
|
|
-#endif
|
|
|
|
h = tcf_hash(police->tcf_index, POL_TAB_MASK);
|
|
h = tcf_hash(police->tcf_index, POL_TAB_MASK);
|
|
write_lock_bh(&police_lock);
|
|
write_lock_bh(&police_lock);
|
|
police->tcf_next = tcf_police_ht[h];
|
|
police->tcf_next = tcf_police_ht[h];
|
|
@@ -528,14 +516,12 @@ int tcf_police(struct sk_buff *skb, struct tcf_police *police)
|
|
police->tcf_bstats.bytes += skb->len;
|
|
police->tcf_bstats.bytes += skb->len;
|
|
police->tcf_bstats.packets++;
|
|
police->tcf_bstats.packets++;
|
|
|
|
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (police->tcfp_ewma_rate &&
|
|
if (police->tcfp_ewma_rate &&
|
|
police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
|
|
police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
|
|
police->tcf_qstats.overlimits++;
|
|
police->tcf_qstats.overlimits++;
|
|
spin_unlock(&police->tcf_lock);
|
|
spin_unlock(&police->tcf_lock);
|
|
return police->tcf_action;
|
|
return police->tcf_action;
|
|
}
|
|
}
|
|
-#endif
|
|
|
|
if (skb->len <= police->tcfp_mtu) {
|
|
if (skb->len <= police->tcfp_mtu) {
|
|
if (police->tcfp_R_tab == NULL) {
|
|
if (police->tcfp_R_tab == NULL) {
|
|
spin_unlock(&police->tcf_lock);
|
|
spin_unlock(&police->tcf_lock);
|
|
@@ -591,10 +577,8 @@ int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police)
|
|
if (police->tcfp_result)
|
|
if (police->tcfp_result)
|
|
RTA_PUT(skb, TCA_POLICE_RESULT, sizeof(int),
|
|
RTA_PUT(skb, TCA_POLICE_RESULT, sizeof(int),
|
|
&police->tcfp_result);
|
|
&police->tcfp_result);
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
if (police->tcfp_ewma_rate)
|
|
if (police->tcfp_ewma_rate)
|
|
RTA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate);
|
|
RTA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate);
|
|
-#endif
|
|
|
|
return skb->len;
|
|
return skb->len;
|
|
|
|
|
|
rtattr_failure:
|
|
rtattr_failure:
|
|
@@ -612,9 +596,7 @@ int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *police)
|
|
goto errout;
|
|
goto errout;
|
|
|
|
|
|
if (gnet_stats_copy_basic(&d, &police->tcf_bstats) < 0 ||
|
|
if (gnet_stats_copy_basic(&d, &police->tcf_bstats) < 0 ||
|
|
-#ifdef CONFIG_NET_ESTIMATOR
|
|
|
|
gnet_stats_copy_rate_est(&d, &police->tcf_rate_est) < 0 ||
|
|
gnet_stats_copy_rate_est(&d, &police->tcf_rate_est) < 0 ||
|
|
-#endif
|
|
|
|
gnet_stats_copy_queue(&d, &police->tcf_qstats) < 0)
|
|
gnet_stats_copy_queue(&d, &police->tcf_qstats) < 0)
|
|
goto errout;
|
|
goto errout;
|
|
|
|
|