Return-Path: Received: from mail-sn1nam01on0138.outbound.protection.outlook.com ([104.47.32.138]:29024 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750762AbeBZUMC (ORCPT ); Mon, 26 Feb 2018 15:12:02 -0500 From: Andrew Collins To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, davem@davemloft.net, netdev@vger.kernel.org Cc: Andrew Collins Subject: [PATCH] net: make tc-police action MTU behavior match documentation Date: Mon, 26 Feb 2018 13:10:15 -0700 Message-Id: <20180226201015.29094-1-acollins@cradlepoint.com> MIME-Version: 1.0 Content-Type: text/plain Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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