The man page for tc-police states that the MTU defaults to
unlimited if peakrate is not specified, but it actually defaults
to 2047.

This causes issues with GRO enabled interfaces, as >2047 coalesced
packets get dropped and the resulting rate is wildly inaccurate.

Fix by only setting the default MTU when peakrate is specified.

Longer term act_police should likely segment GRO packets like
sch_tbf does, but I see no clear way to accomplish this within
a tc action.

Signed-off-by: Andrew Collins <acoll...@cradlepoint.com>
---
 net/sched/act_police.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 95d3c9097b25..36b8c92f644c 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -149,7 +149,7 @@ static int tcf_act_police_init(struct net *net, struct 
nlattr *nla,
        police->tcfp_mtu = parm->mtu;
        if (police->tcfp_mtu == 0) {
                police->tcfp_mtu = ~0;
-               if (R_tab)
+               if (R_tab && P_tab)
                        police->tcfp_mtu = 255 << R_tab->rate.cell_log;
        }
        if (R_tab) {
-- 
2.14.3

Reply via email to