Re: [PATCH] net: make tc-police action MTU behavior match documentation
From: Cong Wang > If this is just an iproute2 issue, please fix it there rather in kernel. I'm fine with fixing this as a documentation issue (fix being change man page, MTU "Defaults to unlimited" to "Defaults to 2047"). Note however this does mean that tc-police will keep its (IMO) rather surprising default behavior of dropping coalesced packets on a GRO enabled interface. As mentioned in the commit message, segmenting GRO-ed skbs is a better solution long term, do you have any suggestions for how an action might segment an skb similar to the way tc-tbf does? I didn't see an obvious method, since qdiscs have the advantage of an underlying queue whereas actions don't, but perhaps I missed something obvious.
Re: [PATCH] net: make tc-police action MTU behavior match documentation
On Tue, Feb 27, 2018 at 9:41 AM, Andrew Collins wrote: >> I don't find such statement from the man page: >> http://man7.org/linux/man-pages/man8/tc-police.8.html > > >> What am I missing? > > Under MTU the man page states: > > mtu BYTES[/BYTES] > This is the maximum packet size handled by the policer (larger > ones will be handled like they exceeded the configured rate). Setting this > value correctly will improve the scheduler's precision. > Value formatting is identical to burst above. ->Defaults to > unlimited<-. > > Peakrate requiring MTU isn't mentioned directly in the man page, but if you > provide peakrate without MTU, tc complains: > > "mtu" is required, if "peakrate" is requested. > > The idea here is just to make the actual implementation match these two > statements, MTU is unlimited, unless you use peakrate in which case you have > to provide it (although if you craft netlink messages without tc you can set > peakrate with no mtu, and the action will still default to a reasonable mtu > rather than falling over). > If this is just an iproute2 issue, please fix it there rather in kernel.
Re: [PATCH] net: make tc-police action MTU behavior match documentation
> I don't find such statement from the man page: > http://man7.org/linux/man-pages/man8/tc-police.8.html > What am I missing? Under MTU the man page states: mtu BYTES[/BYTES] This is the maximum packet size handled by the policer (larger ones will be handled like they exceeded the configured rate). Setting this value correctly will improve the scheduler's precision. Value formatting is identical to burst above. ->Defaults to unlimited<-. Peakrate requiring MTU isn't mentioned directly in the man page, but if you provide peakrate without MTU, tc complains: "mtu" is required, if "peakrate" is requested. The idea here is just to make the actual implementation match these two statements, MTU is unlimited, unless you use peakrate in which case you have to provide it (although if you craft netlink messages without tc you can set peakrate with no mtu, and the action will still default to a reasonable mtu rather than falling over). Andrew Collins
Re: [PATCH] net: make tc-police action MTU behavior match documentation
On Mon, Feb 26, 2018 at 12:10 PM, Andrew Collins wrote: > The man page for tc-police states that the MTU defaults to > unlimited if peakrate is not specified, but it actually defaults > to 2047. I don't find such statement from the man page: http://man7.org/linux/man-pages/man8/tc-police.8.html What am I missing?
[PATCH] net: make tc-police action MTU behavior match documentation
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