[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7147daf1-2546-a6b5-a1ba-78dfb4af408a@mojatatu.com>
Date: Sat, 30 Oct 2021 06:54:25 -0400
From: Jamal Hadi Salim <jhs@...atatu.com>
To: Vlad Buslov <vladbu@...dia.com>,
Simon Horman <simon.horman@...igine.com>
Cc: netdev@...r.kernel.org, Roi Dayan <roid@...dia.com>,
Ido Schimmel <idosch@...dia.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
Baowen Zheng <notifications@...hub.com>,
Louis Peens <louis.peens@...igine.com>,
oss-drivers@...igine.com, Baowen Zheng <baowen.zheng@...igine.com>
Subject: Re: [RFC/PATCH net-next v3 8/8] flow_offload: validate flags of
filter and actions
On 2021-10-29 14:01, Vlad Buslov wrote:
> On Thu 28 Oct 2021 at 14:06, Simon Horman <simon.horman@...igine.com> wrote:
>> From: Baowen Zheng <baowen.zheng@...igine.com>
>>
>> Add process to validate flags of filter and actions when adding
>> a tc filter.
>>
>> We need to prevent adding filter with flags conflicts with its actions.
>>
>> Signed-off-by: Baowen Zheng <baowen.zheng@...igine.com>
>> Signed-off-by: Louis Peens <louis.peens@...igine.com>
>> Signed-off-by: Simon Horman <simon.horman@...igine.com>
>> ---
>> net/sched/cls_api.c | 26 ++++++++++++++++++++++++++
>> net/sched/cls_flower.c | 3 ++-
>> net/sched/cls_matchall.c | 4 ++--
>> net/sched/cls_u32.c | 7 ++++---
>> 4 files changed, 34 insertions(+), 6 deletions(-)
>>
>> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
>> index 351d93988b8b..80647da9713a 100644
>> --- a/net/sched/cls_api.c
>> +++ b/net/sched/cls_api.c
>> @@ -3025,6 +3025,29 @@ void tcf_exts_destroy(struct tcf_exts *exts)
>> }
>> EXPORT_SYMBOL(tcf_exts_destroy);
>>
>> +static bool tcf_exts_validate_actions(const struct tcf_exts *exts, u32 flags)
>> +{
>> +#ifdef CONFIG_NET_CLS_ACT
>> + bool skip_sw = tc_skip_sw(flags);
>> + bool skip_hw = tc_skip_hw(flags);
>> + int i;
>> +
>> + if (!(skip_sw | skip_hw))
>> + return true;
>> +
>> + for (i = 0; i < exts->nr_actions; i++) {
>> + struct tc_action *a = exts->actions[i];
>> +
>> + if ((skip_sw && tc_act_skip_hw(a->tcfa_flags)) ||
>> + (skip_hw && tc_act_skip_sw(a->tcfa_flags)))
>> + return false;
>> + }
>> + return true;
>> +#else
>> + return true;
>> +#endif
>> +}
>> +
>
> I know Jamal suggested to have skip_sw for actions, but it complicates
> the code and I'm still not entirely understand why it is necessary.
If the hardware can independently accept an action offload then
skip_sw per action makes total sense. BTW, my understanding is
_your_ hardware is capable as such at least for policers ;->
And such policers are then shared across filters.
Other than the architectural reason I may have missed something
because I dont see much complexity added as a result.
Are you more worried about slowing down the update rate?
cheers,
jamal
Powered by blists - more mailing lists