From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 609E9C43331 for ; Fri, 3 Apr 2020 03:32:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D61D20675 for ; Fri, 3 Apr 2020 03:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390204AbgDCDb4 (ORCPT ); Thu, 2 Apr 2020 23:31:56 -0400 Received: from m9784.mail.qiye.163.com ([220.181.97.84]:56464 "EHLO m9784.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388951AbgDCDb4 (ORCPT ); Thu, 2 Apr 2020 23:31:56 -0400 Received: from [192.168.188.14] (unknown [120.132.1.226]) by m9784.mail.qiye.163.com (Hmail) with ESMTPA id DBD5940F36; Fri, 3 Apr 2020 11:31:46 +0800 (CST) Subject: Re: [PATCH net-next] net/mlx5e: avoid check the hw_stats of flow_action for FT flow To: Saeed Mahameed , Paul Blakey , Vlad Buslov , "pablo@netfilter.org" , Oz Shlomo Cc: "netdev@vger.kernel.org" References: <1585464960-6204-1-git-send-email-wenxu@ucloud.cn> From: wenxu Message-ID: Date: Fri, 3 Apr 2020 11:31:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZVklVSkpNS0tLT0pIQ0JPTU5ZV1koWU FJQjdXWS1ZQUlXWQkOFx4IWUFZNTQpNjo3JCkuNz5ZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MT46Txw*Fzg*HhUdHE48HSIQ HxoKCUJVSlVKTkNOQ0NPTEtMSkJCVTMWGhIXVQweFQMOOw4YFxQOH1UYFUVZV1kSC1lBWUpJS1VK SElVSlVJSU1ZV1kIAVlBT09CTDcG X-HM-Tid: 0a713e1839082086kuqydbd5940f36 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 4/3/2020 10:59 AM, Saeed Mahameed wrote: > On Sun, 2020-03-29 at 14:56 +0800, wenxu@ucloud.cn wrote: >> From: wenxu >> >> 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 >> --- >> 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; >>