lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3e0a559-3a7b-0fd4-5d1f-ccb0aea1dffd@ucloud.cn>
Date:   Fri, 3 Apr 2020 11:31:44 +0800
From:   wenxu <wenxu@...oud.cn>
To:     Saeed Mahameed <saeedm@...lanox.com>,
        Paul Blakey <paulb@...lanox.com>,
        Vlad Buslov <vladbu@...lanox.com>,
        "pablo@...filter.org" <pablo@...filter.org>,
        Oz Shlomo <ozsh@...lanox.com>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net/mlx5e: avoid check the hw_stats of
 flow_action for FT flow


On 4/3/2020 10:59 AM, Saeed Mahameed wrote:
> On Sun, 2020-03-29 at 14:56 +0800, wenxu@...oud.cn wrote:
>> From: wenxu <wenxu@...oud.cn>
>>
>> The hw_stats in flow_action can't be supported in nftable
>> flowtables. This check will lead the nft flowtable offload
>> failed. So don't check the hw_stats of flow_action for FT
>> flow.
>>
> This looks like a work around not a solution .. if the user requested a
> hw_stats action that the hw can't support, no matter what the request
> is, we should fail it even if it was for ft offloads.
>
> if it is not support by nftable, then the caller shouldn't ask for
> hw_stats action in first place.

The action entries in nft didn't set the hw_stats and the vlaue is 0.


The following function check the hw_stats should contain FLOW_ACTION_HW_STATS_DELAYED_BIT.

flow_action_hw_stats_check(flow_action, extack, FLOW_ACTION_HW_STATS_DELAYED_BIT)



Maybe the following patch is better?


__flow_action_hw_stats_check(const struct flow_action *action,
                             struct netlink_ext_ack *extack,
                             bool check_allow_bit,
                             enum flow_action_hw_stats_bit allow_bit)
{
        const struct flow_action_entry *action_entry;

        if (!flow_action_has_entries(action))
                return true;
        if (!flow_action_mixed_hw_stats_check(action, extack))
                return false;
        action_entry = flow_action_first_entry_get(action);
        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\"");
                return false;
-        } else if (check_allow_bit &&
+        } else if (check_allow_bit && action_entry->hw_stats &&
                   !(action_entry->hw_stats & BIT(allow_bit))) {
                NL_SET_ERR_MSG_MOD(extack, "Driver does not support selected HW stats type");
                return false;
        }   
        return true;
}




>> Signed-off-by: wenxu <wenxu@...oud.cn>
>> ---
>>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> index 901b5fa..4666015 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
>> @@ -3703,7 +3703,8 @@ static int parse_tc_fdb_actions(struct
>> mlx5e_priv *priv,
>>  	if (!flow_action_has_entries(flow_action))
>>  		return -EINVAL;
>>  
>> -	if (!flow_action_hw_stats_check(flow_action, extack,
>> +	if (!ft_flow &&
>> +	    !flow_action_hw_stats_check(flow_action, extack,
>>  					FLOW_ACTION_HW_STATS_DELAYED_BI
>> T))
>>  		return -EOPNOTSUPP;
>>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ