net: flow_offload: skip hw stats check for FLOW_ACTION_HW_STATS_DISABLED
Subsystems (3)
Pablo Neira Ayuso
maintainerPATCH 1/1 net: flow_offload: skip hw stats check for FLOW_ACTION_HW_STATS_DISABLED
If the frontend requests no stats through FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.
--- include/net/flow_offload.h | 3 +++ 1 file changed, 3 insertions(+)
include/net/flow_offload.h +3 -0
@@ -326,6 +326,9 @@ __flow_action_hw_stats_check(const struct flow_action *action,if (!flow_action_mixed_hw_stats_check (action, extack))return false; action_entry =flow_action_first_entry_get (action); +if (action_entry->hw_stats ==FLOW_ACTION_HW_STATS_DISABLED ) +return true; +if (!check_allow_bit && action_entry->hw_stats !=FLOW_ACTION_HW_STATS_ANY ) {NL_SET_ERR_MSG_MOD (extack,"Driver supports only default HW stats type \"any\"" );
Signature · 1 line
2.11.0
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.
Wait, that was a point. Driver has to support stats disabling.
Quoted 24 lines
Fixes 319a1d19471e ("flow_offload: check for basic action hw stats type")Signed-off-by Pablo Neira Ayuso <[email protected]>---
include/net/flow_offload.h| 3 +++1 file changed, 3 insertions(+)include/net/flow_offload.h +3
-0@@ -326,6 +326,9 @@ __flow_action_hw_stats_check(const struct flow_action *action,if (!flow_action_mixed_hw_stats_check (action, extack))return false; action_entry =flow_action_first_entry_get (action); +if (action_entry->hw_stats ==FLOW_ACTION_HW_STATS_DISABLED ) +return true; +if (!check_allow_bit && action_entry->hw_stats !=FLOW_ACTION_HW_STATS_ANY ) {NL_SET_ERR_MSG_MOD (extack,"Driver supports only default HW stats type \"any\"" );Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerQuoted 6 lines · Jiri Pirko
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.Wait, that was a point. Driver has to support stats disabling.
Hm, some drivers used to accept FLOW_ACTION_HW_STATS_DISABLED, now rulesets that used to work don't work anymore.
Quoted 10 lines · Mon, Apr 20, 2020 at 11:05:05AM CEST, [email protected] wrote:
Quoted 6 lines · Jiri Pirko
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.Wait, that was a point. Driver has to support stats disabling.
Hm, some drivers used to accept
FLOW_ACTION_HW_STATS_DISABLED, now rulesets that used to work don't work anymore.
How? This check is here since the introduction of hw stats types.
Pablo Neira Ayuso
maintainerQuoted 7 lines · Jiri Pirko
Quoted 6 lines · Mon, Apr 20, 2020 at 11:05:05AM CEST, [email protected] wrote:
Quoted 5 lines · Jiri Pirko
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Wait, that was a point. Driver has to support stats disabling.
Hm, some drivers used to accept
FLOW_ACTION_HW_STATS_DISABLED, now rulesets that used to work don't work anymore.How? This check is here since the introduction of hw stats types.
Netfilter is setting the counter support to FLOW_ACTION_HW_STATS_DISABLED in this example below:
table netdev filter {
chain ingress {
type filter hook ingress device eth0 priority 0; flags offload; tcp dport 22 drop
}
}
The user did not specify a counter in this case.
I think __flow_action_hw_stats_check() cannot work with FLOW_ACTION_HW_STATS_DISABLED.
If check_allow_bit is false and FLOW_ACTION_HW_STATS_DISABLED is specified, then this always evaluates true:
if (!check_allow_bit &&
action_entry->hw_stats != FLOW_ACTION_HW_STATS_ANY) {Similarly:
} else if (check_allow_bit &&
!(action_entry->hw_stats & BIT(allow_bit))) {evaluates true for FLOW_ACTION_HW_STATS_DISABLED, assuming allow_bit is set, which I think it is the intention.
Another suggestion: This is control plane code and this __flow_action_hw_stats_check() function is relatively large, I'd suggest to move it to net/core/flow_offload.c at some point.
Thank you!
Quoted 18 lines · Mon, Apr 20, 2020 at 12:03:41PM CEST, [email protected] wrote:
Quoted 7 lines · Jiri Pirko
Quoted 6 lines · Mon, Apr 20, 2020 at 11:05:05AM CEST, [email protected] wrote:
Quoted 5 lines · Jiri Pirko
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Wait, that was a point. Driver has to support stats disabling.
Hm, some drivers used to accept
FLOW_ACTION_HW_STATS_DISABLED, now rulesets that used to work don't work anymore.How? This check is here since the introduction of hw stats types.
Netfilter is setting the counter support to
FLOW_ACTION_HW_STATS_DISABLEDin this example below:
Quoted 7 lines
table netdev filter { chain ingress { type filter hook ingress device eth0 priority 0; flags offload; tcp dport 22 drop }}
Hmm. In TC the HW_STATS_DISABLED has to be explicitly asked by the user, as the sw stats are always on. Your case is different. However so far (before HW_STATS patchset), the offload just did the stats and you ignored them in netfilter code, correct?
Perhaps we need another value of this, like "HW_STATS_MAY_DISABLED" for such case. Because you don't care if the HW actually does the stats or not. It is an optimization for you.
However for TC, when user specifies "HW_STATS_DISABLED", the driver should not do stats.
Quoted 12 lines
The user did not specify a counter in this case.
I think
__flow_action_hw_stats_check()cannot work withFLOW_ACTION_HW_STATS_DISABLED.If
check_allow_bitis false andFLOW_ACTION_HW_STATS_DISABLEDis specified, then this always evaluates true:if (!check_allow_bit && action_entry->hw_stats != FLOW_ACTION_HW_STATS_ANY) {
Quoted 7 lines
Similarly:
} else if (check_allow_bit && !(action_entry->hw_stats & BIT(allow_bit))) {evaluates true for
FLOW_ACTION_HW_STATS_DISABLED, assumingallow_bitis set, which I think it is the intention.
That is correct. __flow_action_hw_stats_check() helper is here for simple drivers that support just one type of hw stats (immediate/delayed).
Quoted 4 lines
Another suggestion: This is control plane code and this
__flow_action_hw_stats_check()function is relatively large, I'd suggest to move it tonet/core/flow_offload.cat some point.
Sure, why not.
Quoted 2 lines
Thank you!
Pablo Neira Ayuso
maintainerQuoted 23 lines · Jiri Pirko
Quoted 22 lines · Mon, Apr 20, 2020 at 12:03:41PM CEST, [email protected] wrote:
Quoted 7 lines · Jiri Pirko
Quoted 6 lines · Mon, Apr 20, 2020 at 11:05:05AM CEST, [email protected] wrote:
Quoted 5 lines · Jiri Pirko
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Wait, that was a point. Driver has to support stats disabling.
Hm, some drivers used to accept
FLOW_ACTION_HW_STATS_DISABLED, now rulesets that used to work don't work anymore.How? This check is here since the introduction of hw stats types.
Netfilter is setting the counter support to
FLOW_ACTION_HW_STATS_DISABLEDin this example below:table netdev filter { chain ingress { type filter hook ingress device eth0 priority 0; flags offload;
Quoted 6 lines
Quoted 3 lines
tcp dport 22 drop
}
}Hmm. In TC the
HW_STATS_DISABLEDhas to be explicitly asked by the user, as the sw stats are always on. Your case is different.
I see, I think requesting HW_STATS_DISABLED in tc fails with the existing code though.
Quoted 2 lines
However so far (before
HW_STATSpatchset), the offload just did the stats and you ignored them in netfilter code, correct?
Yes, netfilter is not collecting stats yet.
Quoted 2 lines
Perhaps we need another value of this, like "
HW_STATS_MAY_DISABLED" for such case.
Or just redefine FLOW_ACTION_HW_STATS_DISABLED to define a bit in enum flow_action_hw_stats_bit.
enum flow_action_hw_stats_bit {
FLOW_ACTION_HW_STATES_DISABLED_BIT,
FLOW_ACTION_HW_STATS_IMMEDIATE_BIT,
FLOW_ACTION_HW_STATS_DELAYED_BIT,
};
Then update:
FLOW_ACTION_HW_STATS_ANY = FLOW_ACTION_HW_STATS_DISABLED |
FLOW_ACTION_HW_STATS_IMMEDIATE | FLOW_ACTION_HW_STATS_DELAYED,
?
Quoted 5 lines
Because you don't care if the HW actually does the stats or not. It is an optimization for you.
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.
My interpretation is that _DISABLED means that front-end does not request counters to the driver.
Quoted 16 lines
Quoted 16 lines
The user did not specify a counter in this case.
I think
__flow_action_hw_stats_check()cannot work withFLOW_ACTION_HW_STATS_DISABLED.If
check_allow_bitis false andFLOW_ACTION_HW_STATS_DISABLEDis specified, then this always evaluates true:if (!check_allow_bit && action_entry->hw_stats != FLOW_ACTION_HW_STATS_ANY) {Similarly:
} else if (check_allow_bit && !(action_entry->hw_stats & BIT(allow_bit))) {
Quoted 6 lines
Quoted 2 lines
evaluates true for
FLOW_ACTION_HW_STATS_DISABLED, assumingallow_bitis set, which I think it is the intention.That is correct.
__flow_action_hw_stats_check()helper is here for simple drivers that support just one type of hw stats (immediate/delayed).
If this is solved as I'm proposing above, then __flow_action_hw_stats_check() need to take a bitmask instead of enum flow_action_hw_stats_bit as parameter, because a driver need to specify what they support, eg.
if (!__flow_action_hw_stats_check(action, &extack,
FLOW_ACTION_HW_STATS_DISABLED | FLOW_ACTION_HW_STATS_DELAYED))
return -EOPNOSUPP;
or alternatively, if the driver supports any case:
if (!__flow_action_hw_stats_check(action, &extack,
FLOW_ACTION_HW_STATS_ANY))
return -EOPNOSUPP;
Quoted 51 lines · Mon, Apr 20, 2020 at 02:13:51PM CEST, [email protected] wrote:
Quoted 23 lines · Jiri Pirko
Quoted 22 lines · Mon, Apr 20, 2020 at 12:03:41PM CEST, [email protected] wrote:
Quoted 7 lines · Jiri Pirko
Quoted 6 lines · Mon, Apr 20, 2020 at 11:05:05AM CEST, [email protected] wrote:
Quoted 5 lines · Jiri Pirko
Quoted 3 lines · Sun, Apr 19, 2020 at 01:53:38PM CEST, [email protected] wrote:
If the frontend requests no stats through
FLOW_ACTION_HW_STATS_DISABLED, drivers that are checking for the hw stats configuration bail out with EOPNOTSUPP.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Wait, that was a point. Driver has to support stats disabling.
Hm, some drivers used to accept
FLOW_ACTION_HW_STATS_DISABLED, now rulesets that used to work don't work anymore.How? This check is here since the introduction of hw stats types.
Netfilter is setting the counter support to
FLOW_ACTION_HW_STATS_DISABLEDin this example below:table netdev filter { chain ingress { type filter hook ingress device eth0 priority 0; flags offload;Quoted 6 lines
Quoted 3 lines
tcp dport 22 drop
}
}Hmm. In TC the
HW_STATS_DISABLEDhas to be explicitly asked by the user, as the sw stats are always on. Your case is different.I see, I think requesting
HW_STATS_DISABLEDin tc fails with the existing code though.Quoted 2 lines
However so far (before
HW_STATSpatchset), the offload just did the stats and you ignored them in netfilter code, correct?Yes, netfilter is not collecting stats yet.
Quoted 2 lines
Perhaps we need another value of this, like "
HW_STATS_MAY_DISABLED" for such case.Or just redefine
FLOW_ACTION_HW_STATS_DISABLEDto define a bit in enumflow_action_hw_stats_bit.enum
flow_action_hw_stats_bit{
FLOW_ACTION_HW_STATES_DISABLED_BIT,
FLOW_ACTION_HW_STATS_IMMEDIATE_BIT,
FLOW_ACTION_HW_STATS_DELAYED_BIT,
};
Quoted 5 lines
Then update:
FLOW_ACTION_HW_STATS_ANY=FLOW_ACTION_HW_STATS_DISABLED|
FLOW_ACTION_HW_STATS_IMMEDIATE|FLOW_ACTION_HW_STATS_DELAYED,
No! That would break the default. "ANY" can never mean "disabled".
Quoted 50 lines
?
Quoted 5 lines
Because you don't care if the HW actually does the stats or not. It is an optimization for you.
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.My interpretation is that
_DISABLEDmeans that front-end does not request counters to the driver.Quoted 16 lines
Quoted 16 lines
The user did not specify a counter in this case.
I think
__flow_action_hw_stats_check()cannot work withFLOW_ACTION_HW_STATS_DISABLED.If
check_allow_bitis false andFLOW_ACTION_HW_STATS_DISABLEDis specified, then this always evaluates true:if (!check_allow_bit && action_entry->hw_stats != FLOW_ACTION_HW_STATS_ANY) {Similarly:
} else if (check_allow_bit && !(action_entry->hw_stats & BIT(allow_bit))) {Quoted 6 lines
Quoted 2 lines
evaluates true for
FLOW_ACTION_HW_STATS_DISABLED, assumingallow_bitis set, which I think it is the intention.That is correct.
__flow_action_hw_stats_check()helper is here for simple drivers that support just one type of hw stats (immediate/delayed).If this is solved as I'm proposing above, then
__flow_action_hw_stats_check()need to take a bitmask instead of enumflow_action_hw_stats_bitas parameter, because a driver need to specify what they support, eg.if (!__flow_action_hw_stats_check(action, &extack,
FLOW_ACTION_HW_STATS_DISABLED|FLOW_ACTION_HW_STATS_DELAYED))
return-EOPNOSUPP;or alternatively, if the driver supports any case:
if (!__flow_action_hw_stats_check(action, &extack,
FLOW_ACTION_HW_STATS_ANY))
return-EOPNOSUPP;
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.
What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
-ed
Quoted 8 lines · Mon, Apr 20, 2020 at 02:28:22PM CEST, [email protected] wrote:
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
If internally needed, it means they cannot be disabled. So returning error would make sense, as what the user requested is not supported.
Quoted 2 lines
-ed
Pablo Neira Ayuso
maintainerQuoted 4 lines · Jiri Pirko
Quoted 3 lines · Mon, Apr 20, 2020 at 02:28:22PM CEST, [email protected] wrote:
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.
Quoted 8 lines
Quoted 5 lines
What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
If internally needed, it means they cannot be disabled. So returning error would make sense, as what the user requested is not supported.
Hm.
Then, if the user disables counters but there is internal dependency on them, the tc rule fails to be loaded for this reason.
After this the user is forced to re-load the rule, specifying enable counters.
Why does the user need to force in this case to reload? It seems more natural to me to give the user what it is requesting (disabled counters / front-end doesn't care) and the driver internally allocates the resources that it needs (actually turn them on if there is a dependency like tunneling).
Quoted 11 lines · Mon, Apr 20, 2020 at 02:49:20PM CEST, [email protected] wrote:
Quoted 10 lines · Jiri Pirko
Quoted 8 lines · Mon, Apr 20, 2020 at 02:28:22PM CEST, [email protected] wrote:
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
Quoted 7 lines
Quoted 2 lines
If internally needed, it means they cannot be disabled. So returning error would make sense, as what the user requested is not supported.
Hm.
Then, if the user disables counters but there is internal dependency on them, the tc rule fails to be loaded for this reason.
User asked for disable. They should be disabled. If driver does not support it, should not pretend they are disabled. Does not make sense.
Quoted 9 lines
After this the user is forced to re-load the rule, specifying enable counters.
Why does the user need to force in this case to reload? It seems more natural to me to give the user what it is requesting (disabled counters / front-end doesn't care) and the driver internally allocates the resources that it needs (actually turn them on if there is a dependency like tunneling).
Pablo Neira Ayuso
maintainerQuoted 9 lines · Edward Cree
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
My interpretation is that HW_STATS_DISABLED means that the front-end does not care / does not need counters. The driver can still allocate them if needed. So the enum flow_action_hw_stats flags represent what the front-end requires.
Quoted 5 lines · Mon, Apr 20, 2020 at 02:39:15PM CEST, [email protected] wrote:
Quoted 4 lines · Edward Cree
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.
Quoted 8 lines
Quoted 5 lines
What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
My interpretation is that
HW_STATS_DISABLEDmeans that the front-end does not care / does not need counters. The driver can still allocate
That is wrong interpretation. If user does not care, he specifies "ANY". That is the default.
When he says "DISABLED" he means disabled. Not "I don't care".
Quoted 2 lines
them if needed. So the enum
flow_action_hw_statsflags represent what the front-end requires.
Florian Westphal
maintainerQuoted 12 lines · Jiri Pirko
Quoted 11 lines · Mon, Apr 20, 2020 at 02:39:15PM CEST, [email protected] wrote:
Quoted 9 lines · Edward Cree
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
Quoted 7 lines
Quoted 2 lines
My interpretation is that
HW_STATS_DISABLEDmeans that the front-end does not care / does not need counters. The driver can still allocateThat is wrong interpretation. If user does not care, he specifies "ANY". That is the default.
When he says "DISABLED" he means disabled. Not "I don't care".
Under what circumstances would the user care about this? Rejecting such config seems to be just to annoy user?
I mean, the user is forced to use SW datapath just because HW can't turn off stats?! Same for a config change, why do i need to change my rules to say 'enable stats' even though I don't need them in first place?
Unlike the inverse (want feature X but HW can't support it), it makes no sense to me to reject with an error here:
stats-off is just a hint that can be safely ignored.
Quoted 16 lines · Mon, Apr 20, 2020 at 03:57:54PM CEST, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
Quoted 13 lines · Mon, Apr 20, 2020 at 02:39:15PM CEST, [email protected] wrote:
Quoted 9 lines · Edward Cree
Quoted 2 lines · Jiri Pirko
However for TC, when user specifies "
HW_STATS_DISABLED", the driver should not do stats.What should a driver do if the user specifies DISABLED, but the stats are still needed for internal bookkeeping (e.g. to prod an ARP entry that's in use for encapsulation offload, so that it doesn't get expired out of the cache)? Enable the stats on the HW anyway but not report them to FLOW_CLS_STATS? Or return an error?
My interpretation is that
HW_STATS_DISABLEDmeans that the front-end does not care / does not need counters. The driver can still allocate
Quoted 6 lines
Quoted 4 lines
That is wrong interpretation. If user does not care, he specifies "ANY". That is the default.
When he says "DISABLED" he means disabled. Not "I don't care".
Under what circumstances would the user care about this?
On some HW, the stats are separate resource. The user instructs the stats to be disabled so safe resources. It is explicit. He like to safe the resources for other usage (he can list them in devlink resource).
Quoted 1 line
Rejecting such config seems to be just to annoy user?
Well, the user passed the arg, he should know what is he doing. There's no annoyment.
Quoted 3 lines
I mean, the user is forced to use SW datapath just because HW can't turn off stats?! Same for a config change, why do i need to change my rules
By default, they are on. That is what user should do in most of the cases.
Quoted 1 line
to say 'enable stats' even though I don't need them in first place?
It may require to program HW differently (as in case of mlxsw).
Quoted 4 lines
Unlike the inverse (want feature X but HW can't support it), it makes no sense to me to reject with an error here:
stats-off is just a hint that can be safely ignored.
Pablo Neira Ayuso
maintainerQuoted 1 line · Jiri Pirko
Mon, Apr 20, 2020 at 03:57:54PM CEST, [email protected] wrote:
[...]
Quoted 5 lines
Quoted 2 lines
I mean, the user is forced to use SW datapath just because HW can't turn off stats?! Same for a config change, why do i need to change my rules
By default, they are on. That is what user should do in most of the cases.
Fair enough, I can workaround this problem by using FLOW_ACTION_HW_STATS_ANY. However, I still don't need counters and there is no way to say "I don't care" to the drivers.
Note that the flow_offload infrastructure is used by ethtool, netfilter, flowtable and tc these days.
* ethtool's default behaviour is no counters.
* netfilter's default behaviour is no counters.
* flowtable's default behaviour is no counters.
I understand FLOW_ACTION_HW_STATS_DISABLED means disabled, strictly. But would you allow me to introduce FLOW_ACTION_HW_STATS_DONT_CARE to fix ethtool, netfilter and flowtable? :-)
FLOW_ACTION_HW_STATS_DONT_CARE means "this front-end doesn't need counters, let driver decide what it is best".
Thank you.
include/net/flow_offload.h +5 -1
@@ -164,17 +164,21 @@ enum flow_action_mangle_base { };enum flow_action_hw_stats_bit { +FLOW_ACTION_HW_STATS_DONT_CARE_BIT ,FLOW_ACTION_HW_STATS_IMMEDIATE_BIT ,FLOW_ACTION_HW_STATS_DELAYED_BIT , };enum flow_action_hw_stats {FLOW_ACTION_HW_STATS_DISABLED =0 , +FLOW_ACTION_HW_STATS_DONT_CARE = +BIT (FLOW_ACTION_HW_STATS_DONT_CARE_BIT ),FLOW_ACTION_HW_STATS_IMMEDIATE =BIT (FLOW_ACTION_HW_STATS_IMMEDIATE_BIT ),FLOW_ACTION_HW_STATS_DELAYED =BIT (FLOW_ACTION_HW_STATS_DELAYED_BIT ),FLOW_ACTION_HW_STATS_ANY =FLOW_ACTION_HW_STATS_IMMEDIATE | -FLOW_ACTION_HW_STATS_DELAYED , +FLOW_ACTION_HW_STATS_DELAYED | +FLOW_ACTION_HW_STATS_DONT_CARE , };typedef void (*action_destr )(void *priv);
Quoted 44 lines · Mon, Apr 20, 2020 at 09:18:32PM CEST, [email protected] wrote:
Quoted 1 line · Jiri Pirko
Mon, Apr 20, 2020 at 03:57:54PM CEST, [email protected] wrote:
[...]
Quoted 5 lines
Quoted 2 lines
I mean, the user is forced to use SW datapath just because HW can't turn off stats?! Same for a config change, why do i need to change my rules
By default, they are on. That is what user should do in most of the cases.
Fair enough, I can workaround this problem by using
FLOW_ACTION_HW_STATS_ANY. However, I still don't need counters and there is no way to say "I don't care" to the drivers.Note that the
flow_offloadinfrastructure is used by ethtool, netfilter, flowtable and tc these days.* ethtool's default behaviour is no counters.
* netfilter's default behaviour is no counters.
* flowtable's default behaviour is no counters.I understand
FLOW_ACTION_HW_STATS_DISABLEDmeans disabled, strictly. But would you allow me to introduceFLOW_ACTION_HW_STATS_DONT_CAREto fix ethtool, netfilter and flowtable? :-)
FLOW_ACTION_HW_STATS_DONT_CAREmeans "this front-end doesn't need counters, let driver decide what it is best".Thank you.
include/net/flow_offload.h +1
-0@@ -164,17 +164,21 @@ enum flow_action_mangle_base { };enum flow_action_hw_stats_bit { +FLOW_ACTION_HW_STATS_DONT_CARE_BIT ,FLOW_ACTION_HW_STATS_IMMEDIATE_BIT ,FLOW_ACTION_HW_STATS_DELAYED_BIT , };enum flow_action_hw_stats {
include/net/flow_offload.h enum flow_action_mangle_base { · line 181
Quoted 10 lines
include/net/flow_offload.h +4
-1FLOW_ACTION_HW_STATS_DISABLED =0 , +FLOW_ACTION_HW_STATS_DONT_CARE = +BIT (FLOW_ACTION_HW_STATS_DONT_CARE_BIT ),FLOW_ACTION_HW_STATS_IMMEDIATE =BIT (FLOW_ACTION_HW_STATS_IMMEDIATE_BIT ),FLOW_ACTION_HW_STATS_DELAYED =BIT (FLOW_ACTION_HW_STATS_DELAYED_BIT ),FLOW_ACTION_HW_STATS_ANY =FLOW_ACTION_HW_STATS_IMMEDIATE | - FLOW_ACTION_HW_STATS_DELAYED, +FLOW_ACTION_HW_STATS_DELAYED | + FLOW_ACTION_HW_STATS_DONT_CARE,
"Any" can't be "don't care". TC User expects stats. That's default.
Let's have "don't care" bit only and set it for ethtool/netfilter/flowtable. Don't change any. Teach the drivers to deal with "don't care", most probably using the default checker.
Quoted 3 lines
include/net/flow_offload.h +0
-0};typedef void (*action_destr )(void *priv);
Quoted 5 lines · Jiri Pirko
"Any" can't be "don't care". TC User expects stats. That's default.
Let's have "don't care" bit only and set it for ethtool/netfilter/flowtable. Don't change any. Teach the drivers to deal with "don't care", most probably using the default checker.
I think the right solution is either this, or the semantically-similar approach of "0 means don't care, we have a bit for disabled, and ANY (the TC default) is "all the bits except disabled", i.e. DELAYED | IMMEDIATE. That seems slightly cleaner to me, as then non- zero settings are always "here is a bitmask of options, driver may choose any of them". (And 0 differs from DELAYED | IMMEDIATE | DISABLED only in that if new bits are added to kernel, 0 includes them.) And of course either way the TC uAPI needs to be able to specify the new "don't care" option.
-ed
Jakub Kicinski
maintainerQuoted 6 lines · On Mon, 27 Apr 2020 15:31:48 +0100 Edward Cree wrote:
Quoted 5 lines · Jiri Pirko
"Any" can't be "don't care". TC User expects stats. That's default.
Let's have "don't care" bit only and set it for ethtool/netfilter/flowtable. Don't change any. Teach the drivers to deal with "don't care", most probably using the default checker.
Quoted 7 lines
I think the right solution is either this, or the semantically-similar approach of "0 means don't care, we have a bit for disabled, and ANY (the TC default) is "all the bits except disabled", i.e. DELAYED | IMMEDIATE. That seems slightly cleaner to me, as then non- zero settings are always "here is a bitmask of options, driver may choose any of them". (And 0 differs from DELAYED | IMMEDIATE | DISABLED only in that if new bits are added to kernel, 0 includes them.)
+1
Quoted 2 lines
And of course either way the TC uAPI needs to be able to specify the new "don't care" option.