net: flow_offload: skip hw stats check for FLOW_ACTION_HW_STATS_DONT_CARE
This patch adds FLOW_ACTION_HW_STATS_DONT_CARE which tells the driver
that the frontend does not need counters, this hw stats type request
never fails. The FLOW_ACTION_HW_STATS_DISABLED type explicitly requests
the driver to disable the stats, however, if the driver cannot disable
counters, it bails out.
TCA_ACT_HW_STATS_* maintains the 1:1 mapping with FLOW_ACTION_HW_STATS_*
except by disabled which is mapped to FLOW_ACTION_HW_STATS_DISABLED
(this is 0 in tc). Add tc_act_hw_stats() to perform the mapping between
TCA_ACT_HW_STATS_* and FLOW_ACTION_HW_STATS_*.
Fixes: 319a1d1947
("flow_offload: check for basic action hw stats type")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
b0956956bb
commit
16f8036086
@@ -3523,6 +3523,16 @@ static void tcf_sample_get_group(struct flow_action_entry *entry,
|
||||
#endif
|
||||
}
|
||||
|
||||
static enum flow_action_hw_stats tc_act_hw_stats(u8 hw_stats)
|
||||
{
|
||||
if (WARN_ON_ONCE(hw_stats > TCA_ACT_HW_STATS_ANY))
|
||||
return FLOW_ACTION_HW_STATS_DONT_CARE;
|
||||
else if (!hw_stats)
|
||||
return FLOW_ACTION_HW_STATS_DISABLED;
|
||||
|
||||
return hw_stats;
|
||||
}
|
||||
|
||||
int tc_setup_flow_action(struct flow_action *flow_action,
|
||||
const struct tcf_exts *exts)
|
||||
{
|
||||
@@ -3546,7 +3556,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
|
||||
if (err)
|
||||
goto err_out_locked;
|
||||
|
||||
entry->hw_stats = act->hw_stats;
|
||||
entry->hw_stats = tc_act_hw_stats(act->hw_stats);
|
||||
|
||||
if (is_tcf_gact_ok(act)) {
|
||||
entry->id = FLOW_ACTION_ACCEPT;
|
||||
@@ -3614,7 +3624,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
|
||||
entry->mangle.mask = tcf_pedit_mask(act, k);
|
||||
entry->mangle.val = tcf_pedit_val(act, k);
|
||||
entry->mangle.offset = tcf_pedit_offset(act, k);
|
||||
entry->hw_stats = act->hw_stats;
|
||||
entry->hw_stats = tc_act_hw_stats(act->hw_stats);
|
||||
entry = &flow_action->entries[++j];
|
||||
}
|
||||
} else if (is_tcf_csum(act)) {
|
||||
|
Reference in New Issue
Block a user