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=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS 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 08B63C282D7 for ; Sat, 2 Feb 2019 15:10:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC1A020857 for ; Sat, 2 Feb 2019 15:10:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eSTaJX6P" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727974AbfBBPKZ (ORCPT ); Sat, 2 Feb 2019 10:10:25 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:46783 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727778AbfBBPKZ (ORCPT ); Sat, 2 Feb 2019 10:10:25 -0500 Received: by mail-ot1-f68.google.com with SMTP id w25so8581031otm.13; Sat, 02 Feb 2019 07:10:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VNPOXPgqEnG1MrVag+Y5X8DevioKTd3lE745qg3v6Jo=; b=eSTaJX6P6juCIfieJyNqNW3Ut9aMx/W9Yhp/Ucyz9UE8zAp+RCgxGU+D6ZUmsT8bn4 hNrL3+leCBYfig2pRLuKQ49XVUdnYETnCnz7JwMUuZwR7mxxpX4pYA8ocp+cXSNj1Cdo 3LuXgoEG+I1sYN/Lsqafgez77vMGe1z5iUGfqDtUBNUqxPyhHXeyQBK0d/pcc9yWaHDm cPGl88UJId1v9Igz7boXOynvi6NNQUNHNH5NMel8HhIW6AMDupX8NG7+LOjeDptbAhcW SXFBjcbLZbVzODsV9O8GkovSsjeiG2tpBYegGDurYbNcQuxHobnYM3DS/7gtUmVD0HaB ItIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VNPOXPgqEnG1MrVag+Y5X8DevioKTd3lE745qg3v6Jo=; b=sJzl94KTMVH/zDWviXCpTeey2WTDebDZ0YcwNGjTF2pi/+nbxd7EKkORDyIln8agQz iBS5ztzDpM5rU1XM9+lNelKZDkv+MzD3H4sh85vYzSOrHwPMH2v1i1eZGbQiaQTbJeLA aRyNcYi0K7zYWBGLbR1VGmsEqiFQQbj54byUvhE6fYZFvS1YAxzCMc8vAoJrTu8NeVwE hD+P/Hlq9f0Af1D70bUK3G99ejMVB2R3Dwcw2din1uG42PlWtJRrXkvnZDWAQ0qyb3lP zTET8vfUJg0xfK5USHWqp4U6KvYTX7x/tcEeMI8TFi8G6EOnnJml03CDuvDW5c+1IWvD 7Bog== X-Gm-Message-State: AJcUukdrpgAWYbrz22O8UyZ0zSgJOxWFgkMfHOBM01Kk9VBOdANjiRbm sQ4XnnS6MnWy0BbGppo35/2gwD0T5f92HjWWVh4= X-Google-Smtp-Source: ALg8bN7HhckKQ4ZgaGkg7gCOaCuglL6LYbJOM6aZeQ6QtE2he/4CTk8+5fSUpcveN4ZylDaEpCCSgSJhl9xUBVmpNnY= X-Received: by 2002:a9d:6d95:: with SMTP id x21mr29929544otp.99.1549120223900; Sat, 02 Feb 2019 07:10:23 -0800 (PST) MIME-Version: 1.0 References: <20190202115054.4880-1-pablo@netfilter.org> <20190202115054.4880-3-pablo@netfilter.org> In-Reply-To: <20190202115054.4880-3-pablo@netfilter.org> From: Tonghao Zhang Date: Sat, 2 Feb 2019 23:09:47 +0800 Message-ID: Subject: Re: [PATCH 02/12 net-next,v7] net/mlx5e: support for two independent packet edit actions To: Pablo Neira Ayuso Cc: Linux Kernel Network Developers , David Miller , thomas.lendacky@amd.com, f.fainelli@gmail.com, ariel.elior@cavium.com, michael.chan@broadcom.com, santosh@chelsio.com, madalin.bucur@nxp.com, yisen.zhuang@huawei.com, salil.mehta@huawei.com, jeffrey.t.kirsher@intel.com, tariqt@mellanox.com, Saeed Mahameed , jiri@mellanox.com, idosch@mellanox.com, jakub.kicinski@netronome.com, peppe.cavallaro@st.com, grygorii.strashko@ti.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, alexandre.torgue@st.com, joabreu@synopsys.com, linux-net-drivers@solarflare.com, ganeshgr@chelsio.com, Or Gerlitz , Manish.Chopra@cavium.com, marcelo.leitner@gmail.com, mkubecek@suse.cz, venkatkumar.duvvuru@broadcom.com, julia.lawall@lip6.fr, john.fastabend@gmail.com, netfilter-devel@vger.kernel.org, cphealy@gmail.com Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, Feb 2, 2019 at 8:11 PM Pablo Neira Ayuso wrote: > > This patch adds pedit_headers_action structure to store the result of > parsing tc pedit actions. Then, it calls alloc_tc_pedit_action() to > populate the mlx5e hardware intermediate representation once all actions > have been parsed. > > This patch comes in preparation for the new flow_action infrastructure, > where each packet mangling comes in an separated action, ie. not packed > as in tc pedit. > > Signed-off-by: Pablo Neira Ayuso > Acked-by: Jiri Pirko > Acked-by: Saeed Mahameed > --- > v7: rebase on top of net-next. > > drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 81 ++++++++++++++++++------- > 1 file changed, 59 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > index cd289ce0582d..1c8e8da166bd 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > @@ -1804,6 +1804,12 @@ struct pedit_headers { > struct udphdr udp; > }; > > +struct pedit_headers_action { > + struct pedit_headers vals; > + struct pedit_headers masks; > + u32 pedits; > +}; > + > static int pedit_header_offsets[] = { > [TCA_PEDIT_KEY_EX_HDR_TYPE_ETH] = offsetof(struct pedit_headers, eth), > [TCA_PEDIT_KEY_EX_HDR_TYPE_IP4] = offsetof(struct pedit_headers, ip4), > @@ -1815,16 +1821,15 @@ static int pedit_header_offsets[] = { > #define pedit_header(_ph, _htype) ((void *)(_ph) + pedit_header_offsets[_htype]) > > static int set_pedit_val(u8 hdr_type, u32 mask, u32 val, u32 offset, > - struct pedit_headers *masks, > - struct pedit_headers *vals) > + struct pedit_headers_action *hdrs) > { > u32 *curr_pmask, *curr_pval; > > if (hdr_type >= __PEDIT_HDR_TYPE_MAX) > goto out_err; > > - curr_pmask = (u32 *)(pedit_header(masks, hdr_type) + offset); > - curr_pval = (u32 *)(pedit_header(vals, hdr_type) + offset); > + curr_pmask = (u32 *)(pedit_header(&hdrs->masks, hdr_type) + offset); > + curr_pval = (u32 *)(pedit_header(&hdrs->vals, hdr_type) + offset); > > if (*curr_pmask & mask) /* disallow acting twice on the same location */ > goto out_err; > @@ -1880,8 +1885,7 @@ static struct mlx5_fields fields[] = { > * max from the SW pedit action. On success, it says how many HW actions were > * actually parsed. > */ > -static int offload_pedit_fields(struct pedit_headers *masks, > - struct pedit_headers *vals, > +static int offload_pedit_fields(struct pedit_headers_action *hdrs, > struct mlx5e_tc_flow_parse_attr *parse_attr, > struct netlink_ext_ack *extack) > { > @@ -1896,10 +1900,10 @@ static int offload_pedit_fields(struct pedit_headers *masks, > __be16 mask_be16; > void *action; > > - set_masks = &masks[TCA_PEDIT_KEY_EX_CMD_SET]; > - add_masks = &masks[TCA_PEDIT_KEY_EX_CMD_ADD]; > - set_vals = &vals[TCA_PEDIT_KEY_EX_CMD_SET]; > - add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD]; > + set_masks = &hdrs[TCA_PEDIT_KEY_EX_CMD_SET].masks; > + add_masks = &hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].masks; > + set_vals = &hdrs[TCA_PEDIT_KEY_EX_CMD_SET].vals; > + add_vals = &hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].vals; > > action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); > action = parse_attr->mod_hdr_actions; > @@ -1995,12 +1999,14 @@ static int offload_pedit_fields(struct pedit_headers *masks, > } > > static int alloc_mod_hdr_actions(struct mlx5e_priv *priv, > - const struct tc_action *a, int namespace, > + struct pedit_headers_action *hdrs, > + int namespace, > struct mlx5e_tc_flow_parse_attr *parse_attr) > { > int nkeys, action_size, max_actions; > > - nkeys = tcf_pedit_nkeys(a); > + nkeys = hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits + > + hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits; > action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); > > if (namespace == MLX5_FLOW_NAMESPACE_FDB) /* FDB offloading */ > @@ -2024,18 +2030,15 @@ static const struct pedit_headers zero_masks = {}; > static int parse_tc_pedit_action(struct mlx5e_priv *priv, > const struct tc_action *a, int namespace, > struct mlx5e_tc_flow_parse_attr *parse_attr, > + struct pedit_headers_action *hdrs, > struct netlink_ext_ack *extack) > { > - struct pedit_headers masks[__PEDIT_CMD_MAX], vals[__PEDIT_CMD_MAX], *cmd_masks; > int nkeys, i, err = -EOPNOTSUPP; > u32 mask, val, offset; > u8 cmd, htype; > > nkeys = tcf_pedit_nkeys(a); > > - memset(masks, 0, sizeof(struct pedit_headers) * __PEDIT_CMD_MAX); > - memset(vals, 0, sizeof(struct pedit_headers) * __PEDIT_CMD_MAX); > - > for (i = 0; i < nkeys; i++) { > htype = tcf_pedit_htype(a, i); > cmd = tcf_pedit_cmd(a, i); > @@ -2056,21 +2059,37 @@ static int parse_tc_pedit_action(struct mlx5e_priv *priv, > val = tcf_pedit_val(a, i); > offset = tcf_pedit_offset(a, i); > > - err = set_pedit_val(htype, ~mask, val, offset, &masks[cmd], &vals[cmd]); > + err = set_pedit_val(htype, ~mask, val, offset, &hdrs[cmd]); > if (err) > goto out_err; > + > + hdrs[cmd].pedits++; > } > > - err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr); > + return 0; > +out_err: > + return err; > +} > + > +static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace, > + struct mlx5e_tc_flow_parse_attr *parse_attr, > + struct pedit_headers_action *hdrs, > + struct netlink_ext_ack *extack) > +{ > + struct pedit_headers *cmd_masks; > + int err; > + u8 cmd; > + > + err = alloc_mod_hdr_actions(priv, hdrs, namespace, parse_attr); > if (err) > goto out_err; > > - err = offload_pedit_fields(masks, vals, parse_attr, extack); > + err = offload_pedit_fields(hdrs, parse_attr, extack); > if (err < 0) > goto out_dealloc_parsed_actions; > > for (cmd = 0; cmd < __PEDIT_CMD_MAX; cmd++) { > - cmd_masks = &masks[cmd]; > + cmd_masks = &hdrs[cmd].masks; > if (memcmp(cmd_masks, &zero_masks, sizeof(zero_masks))) { > NL_SET_ERR_MSG_MOD(extack, > "attempt to offload an unsupported field"); > @@ -2211,6 +2230,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > struct mlx5e_tc_flow *flow, > struct netlink_ext_ack *extack) > { > + struct pedit_headers_action hdrs[__PEDIT_CMD_MAX] = {}; > struct mlx5_nic_flow_attr *attr = flow->nic_attr; > const struct tc_action *a; > u32 action = 0; > @@ -2232,7 +2252,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > > if (is_tcf_pedit(a)) { > err = parse_tc_pedit_action(priv, a, MLX5_FLOW_NAMESPACE_KERNEL, > - parse_attr, extack); > + parse_attr, hdrs, extack); > if (err) > return err; > > @@ -2286,6 +2306,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > return -EINVAL; > } > > + if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || > + hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { > + err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, > + parse_attr, hdrs, extack); > + if (err) > + return err; > + } > + > attr->action = action; > if (!actions_match_supported(priv, exts, parse_attr, flow, extack)) > return -EOPNOTSUPP; > @@ -2446,6 +2474,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > struct mlx5e_tc_flow *flow, > struct netlink_ext_ack *extack) > { > + struct pedit_headers_action hdrs[__PEDIT_CMD_MAX] = {}; > struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; > struct mlx5_esw_flow_attr *attr = flow->esw_attr; > struct mlx5e_rep_priv *rpriv = priv->ppriv; > @@ -2470,7 +2499,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > > if (is_tcf_pedit(a)) { > err = parse_tc_pedit_action(priv, a, MLX5_FLOW_NAMESPACE_FDB, > - parse_attr, extack); > + parse_attr, hdrs, extack); > if (err) > return err; > > @@ -2605,6 +2634,14 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > return -EINVAL; > } > > + if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || > + hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { > + err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, > + parse_attr, hdrs, extack); > + if (err) > + return err; > + } > + > attr->action = action; > if (!actions_match_supported(priv, exts, parse_attr, flow, extack)) > return -EOPNOTSUPP; > -- > 2.11.0 > The patch [1] is ready too. David may decide which one will be applied firstly. and other is rebased ?. [1] http://patchwork.ozlabs.org/patch/1032952/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tonghao Zhang Subject: Re: [PATCH 02/12 net-next,v7] net/mlx5e: support for two independent packet edit actions Date: Sat, 2 Feb 2019 23:09:47 +0800 Message-ID: References: <20190202115054.4880-1-pablo@netfilter.org> <20190202115054.4880-3-pablo@netfilter.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Linux Kernel Network Developers , David Miller , thomas.lendacky@amd.com, f.fainelli@gmail.com, ariel.elior@cavium.com, michael.chan@broadcom.com, santosh@chelsio.com, madalin.bucur@nxp.com, yisen.zhuang@huawei.com, salil.mehta@huawei.com, jeffrey.t.kirsher@intel.com, tariqt@mellanox.com, Saeed Mahameed , jiri@mellanox.com, idosch@mellanox.com, jakub.kicinski@netronome.com, peppe.cavallaro@st.com, grygorii.strashko@ti.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, alexandre.torgue@st.com, joabreu@synopsys.com, linux-net-drivers@solarflare.com, ganeshgr@chelsio.com, Or Gerlitz , Manish.Chopra@cavium.com, marcelo.leitner@gmail.com, mkubecek@suse.cz, venkatkumar.duvvuru@broadcom To: Pablo Neira Ayuso Return-path: In-Reply-To: <20190202115054.4880-3-pablo@netfilter.org> Sender: netdev-owner@vger.kernel.org List-Id: netfilter-devel.vger.kernel.org On Sat, Feb 2, 2019 at 8:11 PM Pablo Neira Ayuso wrote: > > This patch adds pedit_headers_action structure to store the result of > parsing tc pedit actions. Then, it calls alloc_tc_pedit_action() to > populate the mlx5e hardware intermediate representation once all actions > have been parsed. > > This patch comes in preparation for the new flow_action infrastructure, > where each packet mangling comes in an separated action, ie. not packed > as in tc pedit. > > Signed-off-by: Pablo Neira Ayuso > Acked-by: Jiri Pirko > Acked-by: Saeed Mahameed > --- > v7: rebase on top of net-next. > > drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 81 ++++++++++++++++++------- > 1 file changed, 59 insertions(+), 22 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > index cd289ce0582d..1c8e8da166bd 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > @@ -1804,6 +1804,12 @@ struct pedit_headers { > struct udphdr udp; > }; > > +struct pedit_headers_action { > + struct pedit_headers vals; > + struct pedit_headers masks; > + u32 pedits; > +}; > + > static int pedit_header_offsets[] = { > [TCA_PEDIT_KEY_EX_HDR_TYPE_ETH] = offsetof(struct pedit_headers, eth), > [TCA_PEDIT_KEY_EX_HDR_TYPE_IP4] = offsetof(struct pedit_headers, ip4), > @@ -1815,16 +1821,15 @@ static int pedit_header_offsets[] = { > #define pedit_header(_ph, _htype) ((void *)(_ph) + pedit_header_offsets[_htype]) > > static int set_pedit_val(u8 hdr_type, u32 mask, u32 val, u32 offset, > - struct pedit_headers *masks, > - struct pedit_headers *vals) > + struct pedit_headers_action *hdrs) > { > u32 *curr_pmask, *curr_pval; > > if (hdr_type >= __PEDIT_HDR_TYPE_MAX) > goto out_err; > > - curr_pmask = (u32 *)(pedit_header(masks, hdr_type) + offset); > - curr_pval = (u32 *)(pedit_header(vals, hdr_type) + offset); > + curr_pmask = (u32 *)(pedit_header(&hdrs->masks, hdr_type) + offset); > + curr_pval = (u32 *)(pedit_header(&hdrs->vals, hdr_type) + offset); > > if (*curr_pmask & mask) /* disallow acting twice on the same location */ > goto out_err; > @@ -1880,8 +1885,7 @@ static struct mlx5_fields fields[] = { > * max from the SW pedit action. On success, it says how many HW actions were > * actually parsed. > */ > -static int offload_pedit_fields(struct pedit_headers *masks, > - struct pedit_headers *vals, > +static int offload_pedit_fields(struct pedit_headers_action *hdrs, > struct mlx5e_tc_flow_parse_attr *parse_attr, > struct netlink_ext_ack *extack) > { > @@ -1896,10 +1900,10 @@ static int offload_pedit_fields(struct pedit_headers *masks, > __be16 mask_be16; > void *action; > > - set_masks = &masks[TCA_PEDIT_KEY_EX_CMD_SET]; > - add_masks = &masks[TCA_PEDIT_KEY_EX_CMD_ADD]; > - set_vals = &vals[TCA_PEDIT_KEY_EX_CMD_SET]; > - add_vals = &vals[TCA_PEDIT_KEY_EX_CMD_ADD]; > + set_masks = &hdrs[TCA_PEDIT_KEY_EX_CMD_SET].masks; > + add_masks = &hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].masks; > + set_vals = &hdrs[TCA_PEDIT_KEY_EX_CMD_SET].vals; > + add_vals = &hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].vals; > > action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); > action = parse_attr->mod_hdr_actions; > @@ -1995,12 +1999,14 @@ static int offload_pedit_fields(struct pedit_headers *masks, > } > > static int alloc_mod_hdr_actions(struct mlx5e_priv *priv, > - const struct tc_action *a, int namespace, > + struct pedit_headers_action *hdrs, > + int namespace, > struct mlx5e_tc_flow_parse_attr *parse_attr) > { > int nkeys, action_size, max_actions; > > - nkeys = tcf_pedit_nkeys(a); > + nkeys = hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits + > + hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits; > action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); > > if (namespace == MLX5_FLOW_NAMESPACE_FDB) /* FDB offloading */ > @@ -2024,18 +2030,15 @@ static const struct pedit_headers zero_masks = {}; > static int parse_tc_pedit_action(struct mlx5e_priv *priv, > const struct tc_action *a, int namespace, > struct mlx5e_tc_flow_parse_attr *parse_attr, > + struct pedit_headers_action *hdrs, > struct netlink_ext_ack *extack) > { > - struct pedit_headers masks[__PEDIT_CMD_MAX], vals[__PEDIT_CMD_MAX], *cmd_masks; > int nkeys, i, err = -EOPNOTSUPP; > u32 mask, val, offset; > u8 cmd, htype; > > nkeys = tcf_pedit_nkeys(a); > > - memset(masks, 0, sizeof(struct pedit_headers) * __PEDIT_CMD_MAX); > - memset(vals, 0, sizeof(struct pedit_headers) * __PEDIT_CMD_MAX); > - > for (i = 0; i < nkeys; i++) { > htype = tcf_pedit_htype(a, i); > cmd = tcf_pedit_cmd(a, i); > @@ -2056,21 +2059,37 @@ static int parse_tc_pedit_action(struct mlx5e_priv *priv, > val = tcf_pedit_val(a, i); > offset = tcf_pedit_offset(a, i); > > - err = set_pedit_val(htype, ~mask, val, offset, &masks[cmd], &vals[cmd]); > + err = set_pedit_val(htype, ~mask, val, offset, &hdrs[cmd]); > if (err) > goto out_err; > + > + hdrs[cmd].pedits++; > } > > - err = alloc_mod_hdr_actions(priv, a, namespace, parse_attr); > + return 0; > +out_err: > + return err; > +} > + > +static int alloc_tc_pedit_action(struct mlx5e_priv *priv, int namespace, > + struct mlx5e_tc_flow_parse_attr *parse_attr, > + struct pedit_headers_action *hdrs, > + struct netlink_ext_ack *extack) > +{ > + struct pedit_headers *cmd_masks; > + int err; > + u8 cmd; > + > + err = alloc_mod_hdr_actions(priv, hdrs, namespace, parse_attr); > if (err) > goto out_err; > > - err = offload_pedit_fields(masks, vals, parse_attr, extack); > + err = offload_pedit_fields(hdrs, parse_attr, extack); > if (err < 0) > goto out_dealloc_parsed_actions; > > for (cmd = 0; cmd < __PEDIT_CMD_MAX; cmd++) { > - cmd_masks = &masks[cmd]; > + cmd_masks = &hdrs[cmd].masks; > if (memcmp(cmd_masks, &zero_masks, sizeof(zero_masks))) { > NL_SET_ERR_MSG_MOD(extack, > "attempt to offload an unsupported field"); > @@ -2211,6 +2230,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > struct mlx5e_tc_flow *flow, > struct netlink_ext_ack *extack) > { > + struct pedit_headers_action hdrs[__PEDIT_CMD_MAX] = {}; > struct mlx5_nic_flow_attr *attr = flow->nic_attr; > const struct tc_action *a; > u32 action = 0; > @@ -2232,7 +2252,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > > if (is_tcf_pedit(a)) { > err = parse_tc_pedit_action(priv, a, MLX5_FLOW_NAMESPACE_KERNEL, > - parse_attr, extack); > + parse_attr, hdrs, extack); > if (err) > return err; > > @@ -2286,6 +2306,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > return -EINVAL; > } > > + if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || > + hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { > + err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, > + parse_attr, hdrs, extack); > + if (err) > + return err; > + } > + > attr->action = action; > if (!actions_match_supported(priv, exts, parse_attr, flow, extack)) > return -EOPNOTSUPP; > @@ -2446,6 +2474,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > struct mlx5e_tc_flow *flow, > struct netlink_ext_ack *extack) > { > + struct pedit_headers_action hdrs[__PEDIT_CMD_MAX] = {}; > struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; > struct mlx5_esw_flow_attr *attr = flow->esw_attr; > struct mlx5e_rep_priv *rpriv = priv->ppriv; > @@ -2470,7 +2499,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > > if (is_tcf_pedit(a)) { > err = parse_tc_pedit_action(priv, a, MLX5_FLOW_NAMESPACE_FDB, > - parse_attr, extack); > + parse_attr, hdrs, extack); > if (err) > return err; > > @@ -2605,6 +2634,14 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, > return -EINVAL; > } > > + if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits || > + hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) { > + err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL, > + parse_attr, hdrs, extack); > + if (err) > + return err; > + } > + > attr->action = action; > if (!actions_match_supported(priv, exts, parse_attr, flow, extack)) > return -EOPNOTSUPP; > -- > 2.11.0 > The patch [1] is ready too. David may decide which one will be applied firstly. and other is rebased ?. [1] http://patchwork.ozlabs.org/patch/1032952/