net: Remove unnecessary returns from void function()s
[safe/jmp/linux-2.6] / net / sched / act_police.c
index 5c72a11..654f73d 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/skbuff.h>
 #include <linux/rtnetlink.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 #include <net/act_api.h>
 #include <net/netlink.h>
 
@@ -183,13 +184,6 @@ override:
                if (R_tab == NULL)
                        goto failure;
 
-               if (!est && (ret == ACT_P_CREATED ||
-                            !gen_estimator_active(&police->tcf_bstats,
-                                                  &police->tcf_rate_est))) {
-                       err = -EINVAL;
-                       goto failure;
-               }
-
                if (parm->peakrate.rate) {
                        P_tab = qdisc_get_rtab(&parm->peakrate,
                                               tb[TCA_POLICE_PEAKRATE]);
@@ -205,6 +199,12 @@ override:
                                            &police->tcf_lock, est);
                if (err)
                        goto failure_unlock;
+       } else if (tb[TCA_POLICE_AVRATE] &&
+                  (ret == ACT_P_CREATED ||
+                   !gen_estimator_active(&police->tcf_bstats,
+                                         &police->tcf_rate_est))) {
+               err = -EINVAL;
+               goto failure_unlock;
        }
 
        /* No failure allowed after this point */
@@ -295,6 +295,8 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
        if (police->tcfp_ewma_rate &&
            police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
                police->tcf_qstats.overlimits++;
+               if (police->tcf_action == TC_ACT_SHOT)
+                       police->tcf_qstats.drops++;
                spin_unlock(&police->tcf_lock);
                return police->tcf_action;
        }
@@ -328,6 +330,8 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
        }
 
        police->tcf_qstats.overlimits++;
+       if (police->tcf_action == TC_ACT_SHOT)
+               police->tcf_qstats.drops++;
        spin_unlock(&police->tcf_lock);
        return police->tcf_action;
 }