From patchwork Fri Mar 6 13:28:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 222934 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 0BF7CC10F25 for ; Fri, 6 Mar 2020 13:29:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0A0921739 for ; Fri, 6 Mar 2020 13:29:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="erdj4lQJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727121AbgCFN3C (ORCPT ); Fri, 6 Mar 2020 08:29:02 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34211 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgCFN3B (ORCPT ); Fri, 6 Mar 2020 08:29:01 -0500 Received: by mail-wr1-f67.google.com with SMTP id z15so2387976wrl.1 for ; Fri, 06 Mar 2020 05:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lycBKI84VMyP9zCQGJ187EcaOsc3LOmwAgIixJQgN6I=; b=erdj4lQJhMoQhMgxRbdnzTHBTRoyCAxUvl16bwOd+wpscUy6WzqDThFRHXm8vBtR8A jUt2xHLCoMp6kG33EoBKo0DnKB5Ry+Gq4/TDIvpKB8vzgkTVVk92gHJc4dyh47dLfN0P lWGPqEEy+a9zEiMFTLtL3z9noW8aNfBjQMkdyF45Ge08ny4EYa9ftGw41FR9yBGv5RZc Y0uMga6Ay2uzNWWAY+tQAAQLBCSuMr9GXbzdr2sS8zZl3kXRvGLWM9RGuIOi2ugRpaZX BIUAc1L57hv5frBpaH7BVBKrG0dn7bLR2jd3vNAgGTBBDWolH1u8cgGXPdURpN043VQG W4yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lycBKI84VMyP9zCQGJ187EcaOsc3LOmwAgIixJQgN6I=; b=hJoRGiI7VmJn2J7aqxPG6mXneLWqMLewrFVbLYQ64MdKAGcaCEUNkRpAN1oI4lGufx YaBgXfZcJ8oFNM+E4596j5zUb//fq92TakTVTzMT54hFGVQNbODNQr4ExLiiaCuivtQ/ VN3n6R4FjfL3v6iHlNMwImL4pXlRh/8bTW9FlN9bk0Fzyuz1pNcTjhYLzTkECRyY3ocU kKUu0EgHitGONoHEia4nwHNcdKA6ru3rEKiVG3U6ooj8ZRWg8UV/hOuwYl+F1Vk/cdy8 liBIe8XiPMBgrKmi+2SAzReoPUbkCePJ6sdJQRJQzriDw6VMs3OFmwCp9i+euqTeViHk 3/UQ== X-Gm-Message-State: ANhLgQ2yc1m1f0qlfnd5wU3Yb4Qo3ytl++Ukd0/R692h4Inur3vVWv9f W1/zqy+blsqjSednklMveNMnhQGf+N4= X-Google-Smtp-Source: ADFU+vvDEnXdXf5M2H+LFBtfJyxCKsxAgV9UBz5H77SCbHZwkOvinpueEm046F4cGlEgzVY3sx7Pag== X-Received: by 2002:a5d:6284:: with SMTP id k4mr4227971wru.398.1583501339505; Fri, 06 Mar 2020 05:28:59 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id f127sm14032809wma.4.2020.03.06.05.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 05:28:59 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, saeedm@mellanox.com, leon@kernel.org, michael.chan@broadcom.com, vishal@chelsio.com, jeffrey.t.kirsher@intel.com, idosch@mellanox.com, aelior@marvell.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, ecree@solarflare.com, mlxsw@mellanox.com Subject: [patch net-next v3 01/10] flow_offload: Introduce offload of HW stats type Date: Fri, 6 Mar 2020 14:28:47 +0100 Message-Id: <20200306132856.6041-2-jiri@resnulli.us> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200306132856.6041-1-jiri@resnulli.us> References: <20200306132856.6041-1-jiri@resnulli.us> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Initially, pass "ANY" (struct is zeroed) to the drivers as that is the current implicit value coming down to flow_offload. Add a bool indicating that entries have mixed HW stats type. Signed-off-by: Jiri Pirko --- v2->v3: - moved to bitfield - removed "mixed" bool v1->v2: - moved to actions - add mixed bool --- include/net/flow_offload.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index cd3510ac66b0..3afd270eb135 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -154,6 +154,8 @@ enum flow_action_mangle_base { FLOW_ACT_MANGLE_HDR_TYPE_UDP, }; +#define FLOW_ACTION_HW_STATS_TYPE_ANY 0 + typedef void (*action_destr)(void *priv); struct flow_action_cookie { @@ -168,6 +170,7 @@ void flow_action_cookie_destroy(struct flow_action_cookie *cookie); struct flow_action_entry { enum flow_action_id id; + u8 hw_stats_type; action_destr destructor; void *destructor_priv; union { From patchwork Fri Mar 6 13:28:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 222933 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 B05CBC10DCE for ; Fri, 6 Mar 2020 13:29:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 786C021739 for ; Fri, 6 Mar 2020 13:29:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="CBIQzXlD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727368AbgCFN3F (ORCPT ); Fri, 6 Mar 2020 08:29:05 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34217 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgCFN3F (ORCPT ); Fri, 6 Mar 2020 08:29:05 -0500 Received: by mail-wr1-f68.google.com with SMTP id z15so2388165wrl.1 for ; Fri, 06 Mar 2020 05:29:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A+xIyyEn/dgm09itwnEz9Whra3slf7CrDH5N9RRBVME=; b=CBIQzXlDh5RfzZbpVUVuxKStJqITIJ83VV3hO0LDpSpKlYbkh/VgSFz9i24XbL1RwQ s4hAqxRn3VJn4JSOWMYJ1QEl34VYmSPLO9fPnxsq33mesqXgQF83ggcSqf6pHegOE44k 3ElyVBY3BG77v4w79zdDPlrdcxpCeNldfMmuch/rDWDK+w04H3ipxCiMFK6cVo7agQVX Lf5DdT6yfvCvkzVxdSCUGoq5bN87d9lbKNNwKZcCAWqwpkc6IhjlS+ResxPnBBMMfE9K iPD3RgFfw9ywN/L0iHeu9U7gKrSH6S6KZrVTTt3Qd0OoJbG2Z2/I6jy8U2x5EZf3uh0+ EmNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A+xIyyEn/dgm09itwnEz9Whra3slf7CrDH5N9RRBVME=; b=YnGXVf3UxUJvyq8Hf8F55gkiy8Kxl+qLTaRmFCiSQ5VCJuVdLmN6/ZfRKhS+3vpcrP vWtFgBhNW+OYjORB1Ik1NGAGBD8XiaF0vYu4ZYnhBWS2A2Sj5lY8zxu5yRxxkjxPQhTk EdtEMsx9B6j4NI6g7tvapRworMCReS0GDu7G4Jncr0u7hZqicgrnKRFAKRQC46hL1AJv 6DvPywfQtHb5EVPd12nQCuPjOW4O5op+5XtqHW5RWsJjlUu3Yd3Eq9K4Crfr4dPSNzhy EfwcErB7KnQNKH02bZJyhCOhpwA349QFnOd2jN7DlefXgwxVoURMvJTj8r7YN+PUOYvt 6Y9w== X-Gm-Message-State: ANhLgQ1StWVKoiOqRGkOU+49AjBJZ9fJjhcOLApyAnpk/JUYexOEFbuV lcPJ0BUp3IWfqgYLzQcr4kpm6SrKeFM= X-Google-Smtp-Source: ADFU+vt5CsPQQEkTHnV8SPi6e5RyUGVudzDKMDRej8DRNF0prhYvA0TiqrauB15evIOjGRhsa62tNQ== X-Received: by 2002:adf:f7c9:: with SMTP id a9mr4092643wrq.225.1583501341940; Fri, 06 Mar 2020 05:29:01 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id b203sm467555wme.32.2020.03.06.05.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 05:29:01 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, saeedm@mellanox.com, leon@kernel.org, michael.chan@broadcom.com, vishal@chelsio.com, jeffrey.t.kirsher@intel.com, idosch@mellanox.com, aelior@marvell.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, ecree@solarflare.com, mlxsw@mellanox.com Subject: [patch net-next v3 03/10] flow_offload: check for basic action hw stats type Date: Fri, 6 Mar 2020 14:28:49 +0100 Message-Id: <20200306132856.6041-4-jiri@resnulli.us> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200306132856.6041-1-jiri@resnulli.us> References: <20200306132856.6041-1-jiri@resnulli.us> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Introduce flow_action_basic_hw_stats_types_check() helper and use it in drivers. That sanitizes the drivers which do not have support for action HW stats types. Signed-off-by: Jiri Pirko --- v2->v3: - added flow_action_hw_stats_types_check() to pass allowed types - "mixed" bool got remove, iterate entries in check - added mlx5 checking instead of separate patches (will be changed by later patch to flow_action_hw_stats_types_check() v1->v2: - new patch --- drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 9 ++- .../ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 8 ++- .../ethernet/chelsio/cxgb4/cxgb4_tc_flower.h | 3 +- .../chelsio/cxgb4/cxgb4_tc_matchall.c | 3 +- .../net/ethernet/marvell/mvpp2/mvpp2_cls.c | 6 ++ .../net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +++ drivers/net/ethernet/mscc/ocelot_flower.c | 4 ++ .../ethernet/netronome/nfp/flower/action.c | 4 ++ .../net/ethernet/qlogic/qede/qede_filter.c | 10 ++- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 9 ++- include/net/flow_offload.h | 61 +++++++++++++++++++ net/dsa/slave.c | 4 ++ 12 files changed, 119 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c index 9bec256b0934..523bf4be43cc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c @@ -279,7 +279,8 @@ bnxt_tc_parse_pedit(struct bnxt *bp, struct bnxt_tc_actions *actions, static int bnxt_tc_parse_actions(struct bnxt *bp, struct bnxt_tc_actions *actions, - struct flow_action *flow_action) + struct flow_action *flow_action, + struct netlink_ext_ack *extack) { /* Used to store the L2 rewrite mask for dmac (6 bytes) followed by * smac (6 bytes) if rewrite of both is specified, otherwise either @@ -299,6 +300,9 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, return -EINVAL; } + if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, act, flow_action) { switch (act->id) { case FLOW_ACTION_DROP: @@ -491,7 +495,8 @@ static int bnxt_tc_parse_flow(struct bnxt *bp, flow->tun_mask.tp_src = match.mask->src; } - return bnxt_tc_parse_actions(bp, &flow->actions, &rule->action); + return bnxt_tc_parse_actions(bp, &flow->actions, &rule->action, + tc_flow_cmd->common.extack); } static int bnxt_hwrm_cfa_flow_free(struct bnxt *bp, diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c index bb5513bdd293..cc46277e98de 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c @@ -544,7 +544,8 @@ static bool valid_pedit_action(struct net_device *dev, } int cxgb4_validate_flow_actions(struct net_device *dev, - struct flow_action *actions) + struct flow_action *actions, + struct netlink_ext_ack *extack) { struct flow_action_entry *act; bool act_redir = false; @@ -552,6 +553,9 @@ int cxgb4_validate_flow_actions(struct net_device *dev, bool act_vlan = false; int i; + if (!flow_action_basic_hw_stats_types_check(actions, extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, act, actions) { switch (act->id) { case FLOW_ACTION_ACCEPT: @@ -642,7 +646,7 @@ int cxgb4_tc_flower_replace(struct net_device *dev, struct filter_ctx ctx; int fidx, ret; - if (cxgb4_validate_flow_actions(dev, &rule->action)) + if (cxgb4_validate_flow_actions(dev, &rule->action, extack)) return -EOPNOTSUPP; if (cxgb4_validate_flow_match(dev, cls)) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.h index e132516e9868..0a30c96b81ff 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.h @@ -112,7 +112,8 @@ void cxgb4_process_flow_actions(struct net_device *in, struct flow_action *actions, struct ch_filter_specification *fs); int cxgb4_validate_flow_actions(struct net_device *dev, - struct flow_action *actions); + struct flow_action *actions, + struct netlink_ext_ack *extack); int cxgb4_tc_flower_replace(struct net_device *dev, struct flow_cls_offload *cls); diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c index 1b7681a4eb32..d80dee4d316d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_matchall.c @@ -286,7 +286,8 @@ int cxgb4_tc_matchall_replace(struct net_device *dev, } ret = cxgb4_validate_flow_actions(dev, - &cls_matchall->rule->action); + &cls_matchall->rule->action, + extack); if (ret) return ret; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c index 35478cba2aa5..0a0c6ec2336c 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c @@ -1082,6 +1082,9 @@ static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port, u8 qh, ql, pmap; int index, ctx; + if (!flow_action_basic_hw_stats_types_check(&rule->flow->action, NULL)) + return -EOPNOTSUPP; + memset(&c2, 0, sizeof(c2)); index = mvpp2_cls_c2_port_flow_index(port, rule->loc); @@ -1305,6 +1308,9 @@ static int mvpp2_cls_rfs_parse_rule(struct mvpp2_rfs_rule *rule) struct flow_rule *flow = rule->flow; struct flow_action_entry *act; + if (!flow_action_basic_hw_stats_types_check(&rule->flow->action, NULL)) + return -EOPNOTSUPP; + act = &flow->action.entries[0]; if (act->id != FLOW_ACTION_QUEUE && act->id != FLOW_ACTION_DROP) return -EOPNOTSUPP; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 4eb2f2392d2d..cfe393cb4026 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -2878,6 +2878,9 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, if (!flow_action_has_entries(flow_action)) return -EINVAL; + if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) + return -EOPNOTSUPP; + attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG; flow_action_for_each(i, act, flow_action) { @@ -3330,6 +3333,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, if (!flow_action_has_entries(flow_action)) return -EINVAL; + if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, act, flow_action) { switch (act->id) { case FLOW_ACTION_DROP: @@ -4148,6 +4154,9 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv, return -EOPNOTSUPP; } + if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, act, flow_action) { switch (act->id) { case FLOW_ACTION_POLICE: diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c index 8986f209e981..6d84173373c7 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -17,6 +17,10 @@ static int ocelot_flower_parse_action(struct flow_cls_offload *f, if (!flow_offload_has_one_action(&f->rule->action)) return -EOPNOTSUPP; + if (!flow_action_basic_hw_stats_types_check(&f->rule->action, + f->common.extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, a, &f->rule->action) { switch (a->id) { case FLOW_ACTION_DROP: diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c index c06600fb47ff..4aa7346cb040 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/action.c +++ b/drivers/net/ethernet/netronome/nfp/flower/action.c @@ -1207,6 +1207,10 @@ int nfp_flower_compile_action(struct nfp_app *app, bool pkt_host = false; u32 csum_updated = 0; + if (!flow_action_basic_hw_stats_types_check(&flow->rule->action, + extack)) + return -EOPNOTSUPP; + memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ); nfp_flow->meta.act_len = 0; tun_type = NFP_FL_TUNNEL_NONE; diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index d1ce4531d01a..6505f7e2d1db 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -1746,7 +1746,8 @@ int qede_get_arfs_filter_count(struct qede_dev *edev) } static int qede_parse_actions(struct qede_dev *edev, - struct flow_action *flow_action) + struct flow_action *flow_action, + struct netlink_ext_ack *extack) { const struct flow_action_entry *act; int i; @@ -1756,6 +1757,9 @@ static int qede_parse_actions(struct qede_dev *edev, return -EINVAL; } + if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, act, flow_action) { switch (act->id) { case FLOW_ACTION_DROP: @@ -1970,7 +1974,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto, } /* parse tc actions and get the vf_id */ - if (qede_parse_actions(edev, &f->rule->action)) + if (qede_parse_actions(edev, &f->rule->action, f->common.extack)) goto unlock; if (qede_flow_find_fltr(edev, &t)) { @@ -2038,7 +2042,7 @@ static int qede_flow_spec_validate(struct qede_dev *edev, return -EINVAL; } - if (qede_parse_actions(edev, flow_action)) + if (qede_parse_actions(edev, flow_action, NULL)) return -EINVAL; return 0; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 7a01dee2f9a8..a0e6118444b0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -367,7 +367,8 @@ static int tc_setup_cbs(struct stmmac_priv *priv, static int tc_parse_flow_actions(struct stmmac_priv *priv, struct flow_action *action, - struct stmmac_flow_entry *entry) + struct stmmac_flow_entry *entry, + struct netlink_ext_ack *extack) { struct flow_action_entry *act; int i; @@ -375,6 +376,9 @@ static int tc_parse_flow_actions(struct stmmac_priv *priv, if (!flow_action_has_entries(action)) return -EINVAL; + if (!flow_action_basic_hw_stats_types_check(action, extack)) + return -EOPNOTSUPP; + flow_action_for_each(i, act, action) { switch (act->id) { case FLOW_ACTION_DROP: @@ -530,7 +534,8 @@ static int tc_add_flow(struct stmmac_priv *priv, return -ENOENT; } - ret = tc_parse_flow_actions(priv, &rule->action, entry); + ret = tc_parse_flow_actions(priv, &rule->action, entry, + cls->common.extack); if (ret) return ret; diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 3afd270eb135..2dc0332a44c3 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -251,6 +252,66 @@ static inline bool flow_offload_has_one_action(const struct flow_action *action) return action->num_entries == 1; } +static inline bool +flow_action_mixed_hw_stats_types_check(const struct flow_action *action, + struct netlink_ext_ack *extack) +{ + const struct flow_action_entry *action_entry; + u8 uninitialized_var(last_hw_stats_type); + int i; + + if (flow_offload_has_one_action(action)) + return true; + + for (i = 0; i < action->num_entries; i++) { + action_entry = &action->entries[0]; + if (i && action_entry->hw_stats_type != last_hw_stats_type) { + NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported"); + return false; + } + last_hw_stats_type = action_entry->hw_stats_type; + } + return true; +} + +static inline const struct flow_action_entry * +flow_action_first_entry_get(const struct flow_action *action) +{ + WARN_ON(!flow_action_has_entries(action)); + return &action->entries[0]; +} + +static inline bool +flow_action_hw_stats_types_check(const struct flow_action *action, + struct netlink_ext_ack *extack, + u8 allowed_hw_stats_type) +{ + const struct flow_action_entry *action_entry; + + if (!flow_action_has_entries(action)) + return true; + if (!flow_action_mixed_hw_stats_types_check(action, extack)) + return false; + action_entry = flow_action_first_entry_get(action); + if (!allowed_hw_stats_type && + action_entry->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_ANY) { + NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\""); + return false; + } else if (allowed_hw_stats_type && + action_entry->hw_stats_type != allowed_hw_stats_type) { + NL_SET_ERR_MSG_MOD(extack, "Driver does not support selected HW stats type"); + return false; + } + return true; +} + +static inline bool +flow_action_basic_hw_stats_types_check(const struct flow_action *action, + struct netlink_ext_ack *extack) +{ + return flow_action_hw_stats_types_check(action, extack, 0); +} + #define flow_action_for_each(__i, __act, __actions) \ for (__i = 0, __act = &(__actions)->entries[0]; __i < (__actions)->num_entries; __act = &(__actions)->entries[++__i]) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 79d9b4384d7b..fca9bfa8437e 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -865,6 +865,10 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, if (!flow_offload_has_one_action(&cls->rule->action)) return err; + if (!flow_action_basic_hw_stats_types_check(&cls->rule->action, + cls->common.extack)) + return err; + act = &cls->rule->action.entries[0]; if (act->id == FLOW_ACTION_MIRRED && protocol == htons(ETH_P_ALL)) { From patchwork Fri Mar 6 13:28:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 222932 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 AF762C10F26 for ; Fri, 6 Mar 2020 13:29:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8928520848 for ; Fri, 6 Mar 2020 13:29:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="Sud+4nwL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbgCFN3H (ORCPT ); Fri, 6 Mar 2020 08:29:07 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40894 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgCFN3H (ORCPT ); Fri, 6 Mar 2020 08:29:07 -0500 Received: by mail-wr1-f65.google.com with SMTP id p2so1555573wrw.7 for ; Fri, 06 Mar 2020 05:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1qadHUzF6uBqddy9Kzt+/fH81WIcmaGNA6CeSTeDuQw=; b=Sud+4nwL6Mg1LaQYdYdf1Rf3sv1E5EMvKHV2HAHMrOsfUpXCXA0lEIvqO36assOFVo 5omNuLoKtl2hqGiAXuA6Ce6Gqq2MCiR/7jKbCB9VWYFve3/ItxUCavqAaPanabfJCJ/J dKQfxy6bWKzHHghIajiV58eQrX+uQOWhNCBQtGlTokzY2h9sOcVbMw0N4FcRNbdzJugQ VDn6LBxyvNC9BtujwVnuCVevSSG87K4l02NGvxPnChFYWqW6JobTPkGBfjfFn67XFWEV 9OZERRJISLitNGhveLuVAJBr2lluC/HuTyg5IK7uJ9ZtiPyBBAfahuWjLX5IZEBP10sr 2htQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1qadHUzF6uBqddy9Kzt+/fH81WIcmaGNA6CeSTeDuQw=; b=aHZ7qL6HRoqIkACrsoa6kXpM0lZbllkZgdgxpLD4ELGPeOc2xVVG1dO7mwH922kwVN M4L4yfYBTDnWXlMTZBiJukF+9P7oe+A1lZMpxe/Qfn4MIdKkCp/ehKIW0NgG77He39Wh dDjkE/fOy0YC1wiL5GQIpcuEvgQ73TIK75L238oPFc4ADFru7+BbguVu+ALEwHYHq9si gLrQ8SDzA4O3Bp16/dHvmPJMdbyVLlIl0pcSNQNGQrtjpJ/19V67AddRAAZk5OOH0GKp xondDxF3YS5rMMBoTbgGG3McAJtobpz2ar6NvQmTYCdXthciEiQ3tLFN4zFL+TKqAtWY QWBA== X-Gm-Message-State: ANhLgQ1hTrixz1Hl2YViL7AfmhLq2W+aDfvo3VuRAh7s+td8NClyCVe0 hFFEHfZa3dudRzuTncdk16aVgw79XBE= X-Google-Smtp-Source: ADFU+vvBrmKNw4CGPZBH2OC6EYsLKRQ9vW/0XE1mBcfTFBaNiXsPBh84k/k6vUxEOLD+IQH7a3hwAQ== X-Received: by 2002:a5d:5512:: with SMTP id b18mr4017862wrv.215.1583501344939; Fri, 06 Mar 2020 05:29:04 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id g129sm15719110wmg.12.2020.03.06.05.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 05:29:04 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, saeedm@mellanox.com, leon@kernel.org, michael.chan@broadcom.com, vishal@chelsio.com, jeffrey.t.kirsher@intel.com, idosch@mellanox.com, aelior@marvell.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, ecree@solarflare.com, mlxsw@mellanox.com Subject: [patch net-next v3 05/10] mlxsw: restrict supported HW stats type to "any" Date: Fri, 6 Mar 2020 14:28:51 +0100 Message-Id: <20200306132856.6041-6-jiri@resnulli.us> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200306132856.6041-1-jiri@resnulli.us> References: <20200306132856.6041-1-jiri@resnulli.us> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Currently don't allow actions with any other type to be inserted. Signed-off-by: Jiri Pirko --- v2->v3: - moved to bitfield v1->v2: - move the code to the first action processing --- .../net/ethernet/mellanox/mlxsw/spectrum_flower.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c index 7435629c9e65..588d374531cc 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c @@ -29,10 +29,16 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, if (!flow_action_mixed_hw_stats_types_check(flow_action, extack)) return -EOPNOTSUPP; - /* Count action is inserted first */ - err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack); - if (err) - return err; + act = flow_action_first_entry_get(flow_action); + if (act->hw_stats_type == FLOW_ACTION_HW_STATS_TYPE_ANY) { + /* Count action is inserted first */ + err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack); + if (err) + return err; + } else { + NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type"); + return -EOPNOTSUPP; + } flow_action_for_each(i, act, flow_action) { switch (act->id) { From patchwork Fri Mar 6 13:28:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 222931 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 89505C10F00 for ; Fri, 6 Mar 2020 13:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62FC4208C3 for ; Fri, 6 Mar 2020 13:29:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="tQ6LXrR4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727407AbgCFN3K (ORCPT ); Fri, 6 Mar 2020 08:29:10 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:56108 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbgCFN3K (ORCPT ); Fri, 6 Mar 2020 08:29:10 -0500 Received: by mail-wm1-f65.google.com with SMTP id 6so2410231wmi.5 for ; Fri, 06 Mar 2020 05:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XC3MOYrsHIJz6yAyoMDyFHWk/L6tyCnnjSyXPN5344c=; b=tQ6LXrR41ShqB0CL9DkntwMKrlo1/4u7Dy5t3RUxxNdyurk+TfHWqgvlHlKFE7yLqD 9MRUV0VDFuW+rcqPDDjL6sN5o6m8mgN7ZpKYAUIAliUxIUDpZDBM0UejRn8lyo/ek8S7 chNXKNIVMNhOwaE7VwNax52tqCi9EuXsOFQNrv2lKNCx2ALxzcvO10AyLzT/+PIAVxOf QKoUZaCxCFMQRQ/vHpqGPJIyjK+X6KfBLf4cBdZLHs0vO/Ndne4rPnpZnf4m+gSYSueL EHLSTGuVR+h6bs7dn54IQ5NvOlcqM9f+tzbxdStvr4G/zeV6U/bOLBHriH8zRQsTAdwv gE6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XC3MOYrsHIJz6yAyoMDyFHWk/L6tyCnnjSyXPN5344c=; b=RM4Tw/tleFmMQnq7TpFI8h2bx2T9iKAs8ktaFoFrQPFCuB6R8js6aQMQVxbADTJjAz NT0kglbGKf3Lv6zL0MrFVNhVzypQx8ALy9LPRYYunZYUbbb8aiCq35WXGXz8TkE3MLfk 49Vb34wKH9dFjJozsQ6+b7ZNuBFmYEC8placP8o12JwMHSZgPFrXodINlgtV9FS3W6Wx 0ICi8CPcsFWNROFR2vnsTC1Q02HF1cFwpZdAmdDGiet8i/lPqIdskO/hhOHCX6nkpRNv 3ckJ5UiGFk5sBkTH5nY8TB3QSBFvy0rdFXuVjKNS47DS2tULq7vXaEbMUgYf7ZO2z/hX j6wQ== X-Gm-Message-State: ANhLgQ1HQhOd/k/iWziEswXjc8pqXGCWe3iAWl7ebukWICHQnfryTqeM Cp/lqXWuksBX8vDeBPATZxawN+Eevc8= X-Google-Smtp-Source: ADFU+vtT98xrQvkA5VgfqwixEW7920+K0RUPAwS630eEgkQVKUOuULD66lFKCahzU/1ZHxgZfGUTJQ== X-Received: by 2002:a05:600c:410a:: with SMTP id j10mr4199821wmi.59.1583501348411; Fri, 06 Mar 2020 05:29:08 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id y3sm14470029wmi.14.2020.03.06.05.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 05:29:08 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, saeedm@mellanox.com, leon@kernel.org, michael.chan@broadcom.com, vishal@chelsio.com, jeffrey.t.kirsher@intel.com, idosch@mellanox.com, aelior@marvell.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, ecree@solarflare.com, mlxsw@mellanox.com Subject: [patch net-next v3 08/10] mlxsw: spectrum_acl: Ask device for rule stats only if counter was created Date: Fri, 6 Mar 2020 14:28:54 +0100 Message-Id: <20200306132856.6041-9-jiri@resnulli.us> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200306132856.6041-1-jiri@resnulli.us> References: <20200306132856.6041-1-jiri@resnulli.us> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Set a flag in case rule counter was created. Only query the device for stats of a rule, which has the valid counter assigned. Signed-off-by: Jiri Pirko --- v2->v3: - init current values to 0 in case of disabled counters. v1->v2: - new patch --- .../net/ethernet/mellanox/mlxsw/spectrum.h | 3 ++- .../ethernet/mellanox/mlxsw/spectrum_acl.c | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ff61cad74bb0..81801c6fb941 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h @@ -641,7 +641,8 @@ struct mlxsw_sp_acl_rule_info { struct mlxsw_afa_block *act_block; u8 action_created:1, ingress_bind_blocker:1, - egress_bind_blocker:1; + egress_bind_blocker:1, + counter_valid:1; unsigned int counter_index; }; diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c index 36b264798f04..6f8d5005ff36 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c @@ -642,8 +642,14 @@ int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_acl_rule_info *rulei, struct netlink_ext_ack *extack) { - return mlxsw_afa_block_append_counter(rulei->act_block, - &rulei->counter_index, extack); + int err; + + err = mlxsw_afa_block_append_counter(rulei->act_block, + &rulei->counter_index, extack); + if (err) + return err; + rulei->counter_valid = true; + return 0; } int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp, @@ -857,16 +863,18 @@ int mlxsw_sp_acl_rule_get_stats(struct mlxsw_sp *mlxsw_sp, { struct mlxsw_sp_acl_rule_info *rulei; - u64 current_packets; - u64 current_bytes; + u64 current_packets = 0; + u64 current_bytes = 0; int err; rulei = mlxsw_sp_acl_rule_rulei(rule); - err = mlxsw_sp_flow_counter_get(mlxsw_sp, rulei->counter_index, - ¤t_packets, ¤t_bytes); - if (err) - return err; - + if (rulei->counter_valid) { + err = mlxsw_sp_flow_counter_get(mlxsw_sp, rulei->counter_index, + ¤t_packets, + ¤t_bytes); + if (err) + return err; + } *packets = current_packets - rule->last_packets; *bytes = current_bytes - rule->last_bytes; *last_use = rule->last_used; From patchwork Fri Mar 6 13:28:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 222930 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 98E17C10F00 for ; Fri, 6 Mar 2020 13:29:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 708672084E for ; Fri, 6 Mar 2020 13:29:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="0jkz8v3e" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727412AbgCFN3M (ORCPT ); Fri, 6 Mar 2020 08:29:12 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40464 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726167AbgCFN3L (ORCPT ); Fri, 6 Mar 2020 08:29:11 -0500 Received: by mail-wm1-f67.google.com with SMTP id e26so2362465wme.5 for ; Fri, 06 Mar 2020 05:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VU33TGmAHDRw9cxZMdyOnE87qrhlGEYqfNtmeKEMiFk=; b=0jkz8v3eGwX7p0hagdU9dR3P+pgWQ945Rmbiz0+XAy/Ka6GtTxJfc9gVJCku7WLzMp e6gQQQVgJXeKt7O6cX7t0aGDElFo2JQ3F3/9LilVHvj7AZrmp1nNnnLHnML96DBG3hZW jbJGB7xxfElGqudRpvZ0FRVtVzY5N+TiMjEghZyqkYzP6ise4CpuE7KHQUaWSMDyjmKu 81J1ZJqJ8Sy9ellT6OFO6QS4dUam88D/O9OkamJ9v/Nzx6tOLW7DVDXLTIbbN5w0FmL9 teDudj9Fw2Ckdh8xYch5xR9FpGFWB4SjuZt+lPeed41HWFH5Aio/0Yha5puSJiYxBx7I AaDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VU33TGmAHDRw9cxZMdyOnE87qrhlGEYqfNtmeKEMiFk=; b=FP1mY/Or3jZaIBY9+iDghF/zYPQ3WRTe72Np254AHJnW+0M3S3m/bcK/XJqVWax9OR vSbMmD0+89AdPp7qgKjLJY8BpivDm716h23Drga4DNnnBfzfV/CrqtDRjbAzh2iOd2nj x9M9SjrYISG0cWO90YxK5Vp3mQBZUQ1xZnTQ+XL21DlVq+e6dScWKEDWALGavFSwzEaS zpL/v/FkDqHTaZ7FT/DG426TiHHblSCiAqbRnQvFyOqM748sZUabG1oQ1KEFQMWnWMR6 8KshAosfrs8MIPJlFUZgrZNyd8jI6UHOylLo4xzIhKtXxCtC3++Y5tGVOe2NWrDu4yfA aAJg== X-Gm-Message-State: ANhLgQ1U14Ru6FFdDgNYVI6un2+cRy3lcw+6jCO0Qd0wh4PcjUoIRGlI 6JpnvZKdm8K/qsO3c1K9ENWD7RjcrZQ= X-Google-Smtp-Source: ADFU+vuoPX0NHw12OU/r3Ye/j+NB7So/OLTqFNXPO1pKpwsRzyaSBRVdTyry7oYXQSd3Q1DKM+6wlg== X-Received: by 2002:a7b:c2a2:: with SMTP id c2mr3986760wmk.19.1583501349501; Fri, 06 Mar 2020 05:29:09 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id t14sm16919542wrp.63.2020.03.06.05.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 05:29:09 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, saeedm@mellanox.com, leon@kernel.org, michael.chan@broadcom.com, vishal@chelsio.com, jeffrey.t.kirsher@intel.com, idosch@mellanox.com, aelior@marvell.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, ecree@solarflare.com, mlxsw@mellanox.com Subject: [patch net-next v3 09/10] flow_offload: introduce "disabled" HW stats type and allow it in mlxsw Date: Fri, 6 Mar 2020 14:28:55 +0100 Message-Id: <20200306132856.6041-10-jiri@resnulli.us> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200306132856.6041-1-jiri@resnulli.us> References: <20200306132856.6041-1-jiri@resnulli.us> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jiri Pirko Introduce new type for disabled HW stats and allow the value in mlxsw offload. Signed-off-by: Jiri Pirko --- v2->v3: - moved to bitfield v1->v2: - moved to action --- drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 2 +- include/net/flow_offload.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c index 4bf3ac1cb20d..88aa554415df 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c @@ -36,7 +36,7 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack); if (err) return err; - } else { + } else if (act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_DISABLED) { NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type"); return -EOPNOTSUPP; } diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index d597d500a5df..b700c570f7f1 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -159,6 +159,7 @@ enum flow_action_mangle_base { #define FLOW_ACTION_HW_STATS_TYPE_DELAYED BIT(1) #define FLOW_ACTION_HW_STATS_TYPE_ANY (FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE | \ FLOW_ACTION_HW_STATS_TYPE_DELAYED) +#define FLOW_ACTION_HW_STATS_TYPE_DISABLED 0 typedef void (*action_destr)(void *priv);