From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 53811A051C for ; Tue, 11 Feb 2020 14:48:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1658E2B89; Tue, 11 Feb 2020 14:48:30 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2088.outbound.protection.outlook.com [40.107.21.88]) by dpdk.org (Postfix) with ESMTP id 815CC2B89 for ; Tue, 11 Feb 2020 14:48:29 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OII+DJFnhBuF4QTZf0OJNWw14A+MKrFvXhkHkFLkQs+GNC4D9gt3LWWlwHgjBAhW+3MhWe9bWjzrTYROfI7+os9VCqN5ag6AaN7DbvVgmjoeFemCADiJoXdHgAW0hjca8Zozz0fEKIlkgSXofmam1NZp+76TS+WmbRpwBDHyjzhxtgpQYFo2W4bKbF4yASVlbxrybVxJVhEN+C7MDip9C5swu8C0rdHf7IwKtrvVocZMaah5jqv0bUWrcC2Fcbm+P4Aksg0wYFGPfCAhRwvmoykf6euQ5cle3XC3jKb8LuNlrrpQWECVkiEjg+I2cMEf1escWivytJYjd4mlfWA4kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XP6WG+NseQVu0UPbt6Ikhz1qKRYtMHuspSjatgZveRE=; b=bF71NEZl1PZH1X+RL2zHltg8dViegWE38IWaZaW4PTH2eQni1M7v8jIRIa2uTowz5rXjBJXWWLE8buVBvHEfHC29UoUrJAjprJcO69cDbMAb0y3uqVIpvKoK+mvLiCkArOPuoI4f2YTk7t9bnW02T4qdDHrfLja/yLyhVJRK9prOaQeQC8bnKozvG/EboCOjLUysreFsjSfotaMGh2TXJ3tzPSip4+ez3YIYYN+wfjm1/F6SxFIMgGkKMiHRCj1/fGT0KWdcc6HlOib1qyI97fwRfaxGBqyV5GnBxYQDNw7gBBGQKJc3CmfE4anJ3Vnl6zxSdZDVDKMMQ19RwUsIqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XP6WG+NseQVu0UPbt6Ikhz1qKRYtMHuspSjatgZveRE=; b=IaxG0J1tOsqiQUgb5ErVJoreRK+FDJa4BO1CR3FiXElTMLc6I6BzLCjcCUwn9e0RS+bDIlqkMnHkl6NKGtd1klDIOIUqFaE6uju3Q9c9dvy2EPr4bxvGVujh9B4cRq+KvBmoscYguyZ5CxbNfxYK9VlclxeTBvw26MfcEHczooU= Received: from VI1PR05MB4192.eurprd05.prod.outlook.com (10.171.183.18) by VI1PR05MB6368.eurprd05.prod.outlook.com (20.179.26.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.26; Tue, 11 Feb 2020 13:48:27 +0000 Received: from VI1PR05MB4192.eurprd05.prod.outlook.com ([fe80::44e:faeb:1967:44]) by VI1PR05MB4192.eurprd05.prod.outlook.com ([fe80::44e:faeb:1967:44%7]) with mapi id 15.20.2707.030; Tue, 11 Feb 2020 13:48:27 +0000 From: Bing Zhao To: "luca.boccassi@gmail.com" CC: Ori Kam , Slava Ovsiienko , dpdk stable Thread-Topic: patch 'net/mlx5: fix modify actions support limitation' has been queued to stable release 19.11.1 Thread-Index: AQHV4M7HneCBrhy0VE60C8RkM8wOW6gV/YAg Date: Tue, 11 Feb 2020 13:48:27 +0000 Message-ID: References: <20200211112216.3929-1-luca.boccassi@gmail.com> <20200211112216.3929-122-luca.boccassi@gmail.com> In-Reply-To: <20200211112216.3929-122-luca.boccassi@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=bingz@mellanox.com; x-originating-ip: [183.157.49.142] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0c7dbe58-04e3-4455-a4a3-08d7aef91278 x-ms-traffictypediagnostic: VI1PR05MB6368:|VI1PR05MB6368: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0310C78181 x-forefront-antispam-report: SFV:NSPM; SFS:(10001)(10009020)(4636009)(366004)(376002)(346002)(396003)(136003)(39860400002)(199004)(189003)(55016002)(316002)(186003)(54906003)(71200400001)(6506007)(52536014)(26005)(9686003)(7696005)(2906002)(53546011)(81156014)(8936002)(33656002)(81166006)(66946007)(66446008)(8676002)(66476007)(478600001)(45080400002)(30864003)(4326008)(64756008)(66556008)(76116006)(86362001)(6916009)(5660300002)(966005)(559001)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB6368; H:VI1PR05MB4192.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: T75i+J3t/5fK335dEgIrKuBY9vAsfpEVCwVwB5PMBNYn+7eyiCwCKbat9ofxLJeeAkdZdAD/BNOL3Ub6l+Cdsjbq4BVicL3O/ENAt9w5tJN+XKA2unHTEsyFDRMP2Gu5gA/jlAIyRBZ3RbUhpzSptCsbIT82HecDklBmRohhsS7qygaeyO1em9ZRITYU5wev8WPUtgj0VX8a+H4uI83rPlLnNolG3aLliTbGmAdmZeoev5Vka3/MdBE+r+XpW9KeIy6ffqobAEwaifoTJ0b6qYqjfM18iQMtRswK2GgWWDlKLrZgvsrDQ0gQP+TuD2Hi5i2B9/OaH9RVxQA7saOa+e2z4hNUU7uhc/4/P+pPOZ06sreTFRZGYicUj3jGGLlomcYeod6hDEMFCZ++8uGHRAZ2SwJbs5rnFLsQ8GyPFZEDxTNpe01GjsmjjAebI5hjcDb81tAFmMy8V5gWWrnEPMb77uQTIEH38v2Wqi+gJuonVYwkTsDt0OMOAFWgq4KLrU4o7E9CHyKExR99C4NNCGtId13vDsCvLpppzZrTFKUosYkFf8YYlMQ5hqc/Hub1k8OpvzW7142MAvYRQUpLzQ== x-ms-exchange-antispam-messagedata: PvPnurhA2AD7Fg3TfkAvsMvM7DCk0Hl3RSd2wCrMGtcsnOXoI5FAnyHkWmaiEThYNGpAJsDCG/1hET9BSua2Hq1DtUja4VpUODVtLOu0jzbGI/qxW5lPoHVC79ABjDrHokfQbIIJqVCCQdv288GYcQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c7dbe58-04e3-4455-a4a3-08d7aef91278 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Feb 2020 13:48:27.4111 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: T9BNVQ9dTp08S8P+3zWFJdRdvju4DtxNltzFbRfOFe0ZR9+052aR8MnioEBsB7LkTdyeP/TLuozfT1yC1mbCpA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB6368 Subject: Re: [dpdk-stable] patch 'net/mlx5: fix modify actions support limitation' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Luca, Many thanks for your help. Yes, this needs to be also applied to the 19.11 stable branch. I want to rebase it but could not find the branch in http://git.dpdk.org/dpdk-stable/ , so would you please share me the branch information then I can try to finish the rebasing today or early tomorrow. BR. Bing > -----Original Message----- > From: luca.boccassi@gmail.com > Sent: Tuesday, February 11, 2020 7:21 PM > To: Bing Zhao > Cc: Ori Kam ; Slava Ovsiienko > ; dpdk stable > Subject: patch 'net/mlx5: fix modify actions support limitation' has > been queued to stable release 19.11.1 >=20 > Hi, >=20 > FYI, your patch has been queued to stable release 19.11.1 >=20 > Note it hasn't been pushed to > https://eur03.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2F > dpdk.org%2Fbrowse%2Fdpdk- > stable&data=3D02%7C01%7Cbingz%40mellanox.com%7Cf31d20ac8c > 4e427386a108d7aee5e8c2%7Ca652971c7d2e4d9ba6a4d149256f461b% > 7C0%7C0%7C637170174781961835&sdata=3Dno%2BG5nKNzaYL72n > 3vf5v0ZmfmJLRLNcPfwqgf4YJNU0%3D&reserved=3D0 yet. > It will be pushed if I get no objections before 02/13/20. So please shout > if anyone has objections. >=20 > Also note that after the patch there's a diff of the upstream commit vs > the patch applied to the branch. This will indicate if there was any > rebasing needed to apply to the stable branch. If there were code > changes for rebasing > (ie: not only metadata diffs), please double check that the rebase was > correctly done. >=20 > Thanks. >=20 > Luca Boccassi >=20 > --- > From e0de816f945e599a933081c53bb060d5dd4cbf13 Mon Sep 17 > 00:00:00 2001 > From: Bing Zhao > Date: Mon, 20 Jan 2020 11:43:07 +0200 > Subject: [PATCH] net/mlx5: fix modify actions support limitation >=20 > [ upstream commit 024e95759c16c67eee92efffeee34915dc94a9c0 ] >=20 > In the root table, there is some limitation of total number of header > modify actions, 16 or 8 for each. But in other tables, there is no such > strict limitation. In an IPv6 case, the IP fields modifying will occupy > more actions than that in IPv4, so the total support number should be > increased in order to support as many actions as possible for an IPv6 + > TCP packet. > And in the meanwhile, the memory consumption should also be taken > into consideration because sometimes only several actions are needed. > The root table checking could also be done in low layer driver and the > error code will be returned if the actions number is over the maximal > supported value. >=20 > Fixes: 0e9d00027686 ("net/mlx5: check maximum modify actions > number") >=20 > Signed-off-by: Bing Zhao > Acked-by: Ori Kam > Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow.h | 15 +++-- > drivers/net/mlx5/mlx5_flow_dv.c | 104 +++++++++++++++++------------- > -- > 2 files changed, 66 insertions(+), 53 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.h > b/drivers/net/mlx5/mlx5_flow.h index db12715ecc..13bed08d75 > 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -391,11 +391,14 @@ struct mlx5_flow_dv_tag_resource { >=20 > /* > * Number of modification commands. > - * If extensive metadata registers are supported > - * the maximal actions amount is 16 and 8 otherwise. > + * If extensive metadata registers are supported, the maximal actions > + amount is > + * 16 and 8 otherwise on root table. The validation could also be done > + in the > + * lower driver layer. > + * On non-root table, there is no limitation, but 32 is enough right > now. > */ > -#define MLX5_MODIFY_NUM 16 > -#define MLX5_MODIFY_NUM_NO_MREG 8 > +#define MLX5_MAX_MODIFY_NUM 32 > +#define MLX5_ROOT_TBL_MODIFY_NUM 16 > +#define MLX5_ROOT_TBL_MODIFY_NUM_NO_MREG 8 >=20 > /* Modify resource structure */ > struct mlx5_flow_dv_modify_hdr_resource { @@ -406,9 +409,9 @@ > struct mlx5_flow_dv_modify_hdr_resource { > /**< Verbs modify header action object. */ > uint8_t ft_type; /**< Flow table type, Rx or Tx. */ > uint32_t actions_num; /**< Number of modification actions. > */ > - struct mlx5_modification_cmd actions[MLX5_MODIFY_NUM]; > + uint64_t flags; /**< Flags for RDMA API. */ > + struct mlx5_modification_cmd actions[]; > /**< Modification actions. */ > - uint64_t flags; /**< Flags for RDMA API. */ > }; >=20 > /* Jump action resource structure. */ > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index 8f77909419..74d1a68e4a > 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -363,7 +363,7 @@ flow_dv_convert_modify_action(struct > rte_flow_item *item, > uint32_t mask; > uint32_t data; >=20 > - if (i >=3D MLX5_MODIFY_NUM) > + if (i >=3D MLX5_MAX_MODIFY_NUM) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "too many items to modify"); > @@ -404,11 +404,11 @@ flow_dv_convert_modify_action(struct > rte_flow_item *item, > ++i; > ++field; > } while (field->size); > - resource->actions_num =3D i; > - if (!resource->actions_num) > + if (resource->actions_num =3D=3D i) > return rte_flow_error_set(error, EINVAL, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "invalid modification flow > item"); > + resource->actions_num =3D i; > return 0; > } >=20 > @@ -569,7 +569,7 @@ flow_dv_convert_action_modify_vlan_vid > struct mlx5_modification_cmd *actions =3D &resource->actions[i]; > struct field_modify_info *field =3D modify_vlan_out_first_vid; >=20 > - if (i >=3D MLX5_MODIFY_NUM) > + if (i >=3D MLX5_MAX_MODIFY_NUM) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "too many items to modify"); > @@ -902,7 +902,7 @@ flow_dv_convert_action_set_reg > struct mlx5_modification_cmd *actions =3D resource->actions; > uint32_t i =3D resource->actions_num; >=20 > - if (i >=3D MLX5_MODIFY_NUM) > + if (i >=3D MLX5_MAX_MODIFY_NUM) > return rte_flow_error_set(error, EINVAL, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "too many items to modify"); > @@ -914,10 +914,6 @@ flow_dv_convert_action_set_reg > actions[i].data1 =3D rte_cpu_to_be_32(conf->data); > ++i; > resource->actions_num =3D i; > - if (!resource->actions_num) > - return rte_flow_error_set(error, EINVAL, > - > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > - "invalid modification flow > item"); > return 0; > } >=20 > @@ -2256,7 +2252,6 @@ flow_dv_encap_decap_resource_register > domain =3D sh->rx_domain; > else > domain =3D sh->tx_domain; > - > /* Lookup a matching resource from cache. */ > LIST_FOREACH(cache_resource, &sh->encaps_decaps, next) { > if (resource->reformat_type =3D=3D cache_resource- > >reformat_type && @@ -3367,21 +3362,27 @@ > flow_dv_validate_action_port_id(struct rte_eth_dev *dev, > * > * @param dev > * Pointer to rte_eth_dev structure. > + * @param flags > + * Flags bits to check if root level. > * > * @return > * Max number of modify header actions device can support. > */ > static unsigned int > -flow_dv_modify_hdr_action_max(struct rte_eth_dev *dev) > +flow_dv_modify_hdr_action_max(struct rte_eth_dev *dev, uint64_t > flags) > { > /* > * There's no way to directly query the max cap. Although it > has to be > * acquried by iterative trial, it is a safe assumption that more > * actions are supported by FW if extensive metadata register > is > - * supported. > + * supported. (Only in the root table) > */ > - return mlx5_flow_ext_mreg_supported(dev) ? > MLX5_MODIFY_NUM : > - > MLX5_MODIFY_NUM_NO_MREG; > + if (!(flags & MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL)) > + return MLX5_MAX_MODIFY_NUM; > + else > + return mlx5_flow_ext_mreg_supported(dev) ? > + > MLX5_ROOT_TBL_MODIFY_NUM : > + > MLX5_ROOT_TBL_MODIFY_NUM_NO_MREG; > } >=20 > /** > @@ -3472,8 +3473,12 @@ flow_dv_modify_hdr_resource_register > struct mlx5_ibv_shared *sh =3D priv->sh; > struct mlx5_flow_dv_modify_hdr_resource *cache_resource; > struct mlx5dv_dr_domain *ns; > + uint32_t actions_len; >=20 > - if (resource->actions_num > > flow_dv_modify_hdr_action_max(dev)) > + resource->flags =3D > + dev_flow->group ? 0 : > MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL; > + if (resource->actions_num > > flow_dv_modify_hdr_action_max(dev, > + resource->flags)) > return rte_flow_error_set(error, EOVERFLOW, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "too many modify header > items"); @@ -3483,17 +3488,15 @@ > flow_dv_modify_hdr_resource_register > ns =3D sh->tx_domain; > else > ns =3D sh->rx_domain; > - resource->flags =3D > - dev_flow->group ? 0 : > MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL; > /* Lookup a matching resource from cache. */ > + actions_len =3D resource->actions_num * sizeof(resource- > >actions[0]); > LIST_FOREACH(cache_resource, &sh->modify_cmds, next) { > if (resource->ft_type =3D=3D cache_resource->ft_type && > resource->actions_num =3D=3D cache_resource- > >actions_num && > resource->flags =3D=3D cache_resource->flags && > !memcmp((const void *)resource->actions, > (const void *)cache_resource->actions, > - (resource->actions_num * > - sizeof(resource- > >actions[0])))) { > + actions_len)) { > DRV_LOG(DEBUG, "modify-header > resource %p: refcnt %d++", > (void *)cache_resource, > rte_atomic32_read(&cache_resource- > >refcnt)); > @@ -3503,18 +3506,18 @@ flow_dv_modify_hdr_resource_register > } > } > /* Register new modify-header resource. */ > - cache_resource =3D rte_calloc(__func__, 1, > sizeof(*cache_resource), 0); > + cache_resource =3D rte_calloc(__func__, 1, > + sizeof(*cache_resource) + > actions_len, 0); > if (!cache_resource) > return rte_flow_error_set(error, ENOMEM, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > "cannot allocate resource > memory"); > *cache_resource =3D *resource; > + rte_memcpy(cache_resource->actions, resource->actions, > actions_len); > cache_resource->verbs_action =3D > mlx5_glue->dv_create_flow_action_modify_header > - (sh->ctx, cache_resource- > >ft_type, > - ns, cache_resource->flags, > - cache_resource->actions_num > * > - sizeof(cache_resource- > >actions[0]), > + (sh->ctx, cache_resource- > >ft_type, ns, > + cache_resource->flags, > actions_len, > (uint64_t *)cache_resource- > >actions); > if (!cache_resource->verbs_action) { > rte_free(cache_resource); > @@ -6670,10 +6673,13 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > }; > int actions_n =3D 0; > bool actions_end =3D false; > - struct mlx5_flow_dv_modify_hdr_resource mhdr_res =3D { > - .ft_type =3D attr->egress ? > MLX5DV_FLOW_TABLE_TYPE_NIC_TX : > - > MLX5DV_FLOW_TABLE_TYPE_NIC_RX > - }; > + union { > + struct mlx5_flow_dv_modify_hdr_resource res; > + uint8_t len[sizeof(struct > mlx5_flow_dv_modify_hdr_resource) + > + sizeof(struct mlx5_modification_cmd) * > + (MLX5_MAX_MODIFY_NUM + 1)]; > + } mhdr_dummy; > + struct mlx5_flow_dv_modify_hdr_resource *mhdr_res =3D > &mhdr_dummy.res; > union flow_dv_attr flow_attr =3D { .attr =3D 0 }; > uint32_t tag_be; > union mlx5_flow_tbl_key tbl_key; > @@ -6685,15 +6691,19 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > uint32_t table; > int ret =3D 0; >=20 > + mhdr_res->ft_type =3D attr->egress ? > MLX5DV_FLOW_TABLE_TYPE_NIC_TX : > + > MLX5DV_FLOW_TABLE_TYPE_NIC_RX; > ret =3D mlx5_flow_group_to_table(attr, dev_flow->external, attr- > >group, > &table, error); > if (ret) > return ret; > dev_flow->group =3D table; > if (attr->transfer) > - mhdr_res.ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; > + mhdr_res->ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; > if (priority =3D=3D MLX5_FLOW_PRIO_RSVD) > priority =3D dev_conf->flow_prio - 1; > + /* number of actions must be set to 0 in case of dirty stack. */ > + mhdr_res->actions_num =3D 0; > for (; !actions_end ; actions++) { > const struct rte_flow_action_queue *queue; > const struct rte_flow_action_rss *rss; @@ -6731,7 > +6741,7 @@ __flow_dv_translate(struct rte_eth_dev *dev, > }; >=20 > if (flow_dv_convert_action_mark(dev, > &mark, > - > &mhdr_res, > + > mhdr_res, > error)) > return -rte_errno; > action_flags |=3D > MLX5_FLOW_ACTION_MARK_EXT; @@ -6753,7 +6763,7 @@ > __flow_dv_translate(struct rte_eth_dev *dev, > actions->conf; >=20 > if (flow_dv_convert_action_mark(dev, > mark, > - > &mhdr_res, > + > mhdr_res, > error)) > return -rte_errno; > action_flags |=3D > MLX5_FLOW_ACTION_MARK_EXT; @@ -6774,7 +6784,7 @@ > __flow_dv_translate(struct rte_eth_dev *dev, > break; > case RTE_FLOW_ACTION_TYPE_SET_META: > if (flow_dv_convert_action_set_meta > - (dev, &mhdr_res, attr, > + (dev, mhdr_res, attr, > (const struct > rte_flow_action_set_meta *) > actions->conf, error)) > return -rte_errno; > @@ -6782,7 +6792,7 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > break; > case RTE_FLOW_ACTION_TYPE_SET_TAG: > if (flow_dv_convert_action_set_tag > - (dev, &mhdr_res, > + (dev, mhdr_res, > (const struct rte_flow_action_set_tag *) > actions->conf, error)) > return -rte_errno; > @@ -6882,7 +6892,7 @@ cnt_err: > mlx5_update_vlan_vid_pcp(actions, &vlan); > /* If no VLAN push - this is a modify header > action */ > if (flow_dv_convert_action_modify_vlan_vid > - (&mhdr_res, actions, > error)) > + (mhdr_res, actions, > error)) > return -rte_errno; > action_flags |=3D > MLX5_FLOW_ACTION_OF_SET_VLAN_VID; > break; > @@ -6981,7 +6991,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: > case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: > if (flow_dv_convert_action_modify_mac > - (&mhdr_res, actions, error)) > + (mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ? > @@ -6991,7 +7001,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC: > case RTE_FLOW_ACTION_TYPE_SET_IPV4_DST: > if (flow_dv_convert_action_modify_ipv4 > - (&mhdr_res, actions, error)) > + (mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? > @@ -7001,7 +7011,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: > case RTE_FLOW_ACTION_TYPE_SET_IPV6_DST: > if (flow_dv_convert_action_modify_ipv6 > - (&mhdr_res, actions, error)) > + (mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? > @@ -7011,7 +7021,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_TP_SRC: > case RTE_FLOW_ACTION_TYPE_SET_TP_DST: > if (flow_dv_convert_action_modify_tp > - (&mhdr_res, actions, items, > + (mhdr_res, actions, items, > &flow_attr, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D > @@ -7021,13 +7031,13 @@ cnt_err: > break; > case RTE_FLOW_ACTION_TYPE_DEC_TTL: > if (flow_dv_convert_action_modify_dec_ttl > - (&mhdr_res, items, &flow_attr, > error)) > + (mhdr_res, items, &flow_attr, > error)) > return -rte_errno; > action_flags |=3D MLX5_FLOW_ACTION_DEC_TTL; > break; > case RTE_FLOW_ACTION_TYPE_SET_TTL: > if (flow_dv_convert_action_modify_ttl > - (&mhdr_res, actions, items, > + (mhdr_res, actions, items, > &flow_attr, error)) > return -rte_errno; > action_flags |=3D MLX5_FLOW_ACTION_SET_TTL; > @@ -7035,7 +7045,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ: > case RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ: > if (flow_dv_convert_action_modify_tcp_seq > - (&mhdr_res, actions, error)) > + (mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ ? > @@ -7046,7 +7056,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_INC_TCP_ACK: > case RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK: > if (flow_dv_convert_action_modify_tcp_ack > - (&mhdr_res, actions, error)) > + (mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_INC_TCP_ACK ? > @@ -7055,13 +7065,13 @@ cnt_err: > break; > case MLX5_RTE_FLOW_ACTION_TYPE_TAG: > if (flow_dv_convert_action_set_reg > - (&mhdr_res, actions, error)) > + (mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D MLX5_FLOW_ACTION_SET_TAG; > break; > case MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG: > if (flow_dv_convert_action_copy_mreg > - (dev, &mhdr_res, actions, > error)) > + (dev, mhdr_res, actions, error)) > return -rte_errno; > action_flags |=3D MLX5_FLOW_ACTION_SET_TAG; > break; > @@ -7086,10 +7096,10 @@ cnt_err: > break; > case RTE_FLOW_ACTION_TYPE_END: > actions_end =3D true; > - if (mhdr_res.actions_num) { > + if (mhdr_res->actions_num) { > /* create modify action if needed. */ > if > (flow_dv_modify_hdr_resource_register > - (dev, &mhdr_res, dev_flow, > error)) > + (dev, mhdr_res, dev_flow, > error)) > return -rte_errno; > dev_flow- > >dv.actions[modify_action_position] =3D > dev_flow->dv.modify_hdr- > >verbs_action; > @@ -7098,7 +7108,7 @@ cnt_err: > default: > break; > } > - if (mhdr_res.actions_num && > + if (mhdr_res->actions_num && > modify_action_position =3D=3D UINT32_MAX) > modify_action_position =3D actions_n++; > } > -- > 2.20.1 >=20 > --- > Diff of the applied patch vs upstream commit (please double-check if > non-empty: > --- > --- - 2020-02-11 11:17:42.994804790 +0000 > +++ 0122-net-mlx5-fix-modify-actions-support-limitation.patch 2020- > 02-11 11:17:38.612005311 +0000 > @@ -1,8 +1,10 @@ > -From 024e95759c16c67eee92efffeee34915dc94a9c0 Mon Sep 17 > 00:00:00 2001 > +From e0de816f945e599a933081c53bb060d5dd4cbf13 Mon Sep 17 > 00:00:00 2001 > From: Bing Zhao > Date: Mon, 20 Jan 2020 11:43:07 +0200 > Subject: [PATCH] net/mlx5: fix modify actions support limitation >=20 > +[ upstream commit 024e95759c16c67eee92efffeee34915dc94a9c0 ] > + > In the root table, there is some limitation of total number of header > modify actions, 16 or 8 for each. But in other tables, there is no such > strict limitation. In an IPv6 case, the IP fields modifying @@ -16,21 > +18,20 @@ maximal supported value. >=20 > Fixes: 0e9d00027686 ("net/mlx5: check maximum modify actions > number") > -Cc: stable@dpdk.org >=20 > Signed-off-by: Bing Zhao > Acked-by: Ori Kam > Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_flow.h | 15 +++-- > - drivers/net/mlx5/mlx5_flow_dv.c | 108 +++++++++++++++++------------ > --- > - 2 files changed, 68 insertions(+), 55 deletions(-) > + drivers/net/mlx5/mlx5_flow_dv.c | 104 +++++++++++++++++----------- > ---- > + 2 files changed, 66 insertions(+), 53 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.h > b/drivers/net/mlx5/mlx5_flow.h -index a1c7b67488..9832542328 > 100644 > +index db12715ecc..13bed08d75 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > -@@ -392,11 +392,14 @@ struct mlx5_flow_dv_tag_resource { > +@@ -391,11 +391,14 @@ struct mlx5_flow_dv_tag_resource { >=20 > /* > * Number of modification commands. > @@ -49,7 +50,7 @@ >=20 > /* Modify resource structure */ > struct mlx5_flow_dv_modify_hdr_resource { -@@ -407,9 +410,9 @@ > struct mlx5_flow_dv_modify_hdr_resource { > +@@ -406,9 +409,9 @@ struct mlx5_flow_dv_modify_hdr_resource { > /**< Verbs modify header action object. */ > uint8_t ft_type; /**< Flow table type, Rx or Tx. */ > uint32_t actions_num; /**< Number of modification actions. > */ @@ -62,10 +63,10 @@ >=20 > /* Jump action resource structure. */ > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c -index 26dbaaf329..5a1b42698c > 100644 > +index 8f77909419..74d1a68e4a 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > -@@ -366,7 +366,7 @@ flow_dv_convert_modify_action(struct > rte_flow_item *item, > +@@ -363,7 +363,7 @@ flow_dv_convert_modify_action(struct > rte_flow_item > +*item, > uint32_t mask; > uint32_t data; >=20 > @@ -74,7 +75,7 @@ > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "too many items to modify"); > -@@ -407,11 +407,11 @@ flow_dv_convert_modify_action(struct > rte_flow_item *item, > +@@ -404,11 +404,11 @@ flow_dv_convert_modify_action(struct > +rte_flow_item *item, > ++i; > ++field; > } while (field->size); > @@ -88,7 +89,7 @@ > return 0; > } >=20 > -@@ -572,7 +572,7 @@ flow_dv_convert_action_modify_vlan_vid > +@@ -569,7 +569,7 @@ flow_dv_convert_action_modify_vlan_vid > struct mlx5_modification_cmd *actions =3D &resource->actions[i]; > struct field_modify_info *field =3D modify_vlan_out_first_vid; >=20 > @@ -97,7 +98,7 @@ > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "too many items to modify"); > -@@ -905,7 +905,7 @@ flow_dv_convert_action_set_reg > +@@ -902,7 +902,7 @@ flow_dv_convert_action_set_reg > struct mlx5_modification_cmd *actions =3D resource->actions; > uint32_t i =3D resource->actions_num; >=20 > @@ -106,7 +107,7 @@ > return rte_flow_error_set(error, EINVAL, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "too many items to modify"); > -@@ -917,10 +917,6 @@ flow_dv_convert_action_set_reg > +@@ -914,10 +914,6 @@ flow_dv_convert_action_set_reg > actions[i].data1 =3D rte_cpu_to_be_32(conf->data); > ++i; > resource->actions_num =3D i; > @@ -117,7 +118,7 @@ > return 0; > } >=20 > -@@ -2385,7 +2381,6 @@ flow_dv_encap_decap_resource_register > +@@ -2256,7 +2252,6 @@ flow_dv_encap_decap_resource_register > domain =3D sh->rx_domain; > else > domain =3D sh->tx_domain; > @@ -125,7 +126,7 @@ > /* Lookup a matching resource from cache. */ > LIST_FOREACH(cache_resource, &sh->encaps_decaps, next) { > if (resource->reformat_type =3D=3D cache_resource- > >reformat_type && -@@ -3496,21 +3491,27 @@ > flow_dv_validate_action_port_id(struct rte_eth_dev *dev, > +@@ -3367,21 +3362,27 @@ flow_dv_validate_action_port_id(struct > +rte_eth_dev *dev, > * > * @param dev > * Pointer to rte_eth_dev structure. > @@ -157,7 +158,7 @@ > } >=20 > /** > -@@ -3669,8 +3670,12 @@ flow_dv_modify_hdr_resource_register > +@@ -3472,8 +3473,12 @@ flow_dv_modify_hdr_resource_register > struct mlx5_ibv_shared *sh =3D priv->sh; > struct mlx5_flow_dv_modify_hdr_resource *cache_resource; > struct mlx5dv_dr_domain *ns; > @@ -171,7 +172,7 @@ > return rte_flow_error_set(error, EOVERFLOW, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, NULL, > "too many modify header > items"); -@@ -3680,17 +3685,15 @@ > flow_dv_modify_hdr_resource_register > +@@ -3483,17 +3488,15 @@ flow_dv_modify_hdr_resource_register > ns =3D sh->tx_domain; > else > ns =3D sh->rx_domain; > @@ -191,7 +192,7 @@ > DRV_LOG(DEBUG, "modify-header > resource %p: refcnt %d++", > (void *)cache_resource, > rte_atomic32_read(&cache_resource- > >refcnt)); > -@@ -3700,18 +3703,18 @@ flow_dv_modify_hdr_resource_register > +@@ -3503,18 +3506,18 @@ flow_dv_modify_hdr_resource_register > } > } > /* Register new modify-header resource. */ @@ -215,7 +216,7 > @@ > (uint64_t *)cache_resource- > >actions); > if (!cache_resource->verbs_action) { > rte_free(cache_resource); > -@@ -7020,10 +7023,13 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > +@@ -6670,10 +6673,13 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > }; > int actions_n =3D 0; > bool actions_end =3D false; > @@ -233,7 +234,7 @@ > union flow_dv_attr flow_attr =3D { .attr =3D 0 }; > uint32_t tag_be; > union mlx5_flow_tbl_key tbl_key; > -@@ -7035,15 +7041,19 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > +@@ -6685,15 +6691,19 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > uint32_t table; > int ret =3D 0; >=20 > @@ -254,7 +255,7 @@ > for (; !actions_end ; actions++) { > const struct rte_flow_action_queue *queue; > const struct rte_flow_action_rss *rss; -@@ -7081,7 > +7091,7 @@ __flow_dv_translate(struct rte_eth_dev *dev, > +@@ -6731,7 +6741,7 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > }; >=20 > if (flow_dv_convert_action_mark(dev, > &mark, @@ -263,7 +264,7 @@ > error)) > return -rte_errno; > action_flags |=3D > MLX5_FLOW_ACTION_MARK_EXT; -@@ -7103,7 +7113,7 @@ > __flow_dv_translate(struct rte_eth_dev *dev, > +@@ -6753,7 +6763,7 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > actions->conf; >=20 > if (flow_dv_convert_action_mark(dev, > mark, @@ -272,7 +273,7 @@ > error)) > return -rte_errno; > action_flags |=3D > MLX5_FLOW_ACTION_MARK_EXT; -@@ -7124,7 +7134,7 @@ > __flow_dv_translate(struct rte_eth_dev *dev, > +@@ -6774,7 +6784,7 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > break; > case RTE_FLOW_ACTION_TYPE_SET_META: > if (flow_dv_convert_action_set_meta @@ - > 281,7 +282,7 @@ > (const struct > rte_flow_action_set_meta *) > actions->conf, error)) > return -rte_errno; > -@@ -7132,7 +7142,7 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > +@@ -6782,7 +6792,7 @@ __flow_dv_translate(struct rte_eth_dev > *dev, > break; > case RTE_FLOW_ACTION_TYPE_SET_TAG: > if (flow_dv_convert_action_set_tag > @@ -290,7 +291,7 @@ > (const struct rte_flow_action_set_tag *) > actions->conf, error)) > return -rte_errno; > -@@ -7232,7 +7242,7 @@ cnt_err: > +@@ -6882,7 +6892,7 @@ cnt_err: > mlx5_update_vlan_vid_pcp(actions, &vlan); > /* If no VLAN push - this is a modify header > action */ > if (flow_dv_convert_action_modify_vlan_vid > @@ -299,7 +300,7 @@ > return -rte_errno; > action_flags |=3D > MLX5_FLOW_ACTION_OF_SET_VLAN_VID; > break; > -@@ -7331,7 +7341,7 @@ cnt_err: > +@@ -6981,7 +6991,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: > case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: > if (flow_dv_convert_action_modify_mac > @@ -308,7 +309,7 @@ > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ? > -@@ -7341,7 +7351,7 @@ cnt_err: > +@@ -6991,7 +7001,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC: > case RTE_FLOW_ACTION_TYPE_SET_IPV4_DST: > if (flow_dv_convert_action_modify_ipv4 > @@ -317,7 +318,7 @@ > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? > -@@ -7351,7 +7361,7 @@ cnt_err: > +@@ -7001,7 +7011,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: > case RTE_FLOW_ACTION_TYPE_SET_IPV6_DST: > if (flow_dv_convert_action_modify_ipv6 > @@ -326,7 +327,7 @@ > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? > -@@ -7361,7 +7371,7 @@ cnt_err: > +@@ -7011,7 +7021,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_SET_TP_SRC: > case RTE_FLOW_ACTION_TYPE_SET_TP_DST: > if (flow_dv_convert_action_modify_tp @@ - > 335,7 +336,7 @@ > &flow_attr, error)) > return -rte_errno; > action_flags |=3D actions->type =3D=3D > -@@ -7371,13 +7381,13 @@ cnt_err: > +@@ -7021,13 +7031,13 @@ cnt_err: > break; > case RTE_FLOW_ACTION_TYPE_DEC_TTL: > if (flow_dv_convert_action_modify_dec_ttl > @@ -351,7 +352,7 @@ > &flow_attr, error)) > return -rte_errno; > action_flags |=3D MLX5_FLOW_ACTION_SET_TTL; > -@@ -7385,7 +7395,7 @@ cnt_err: > +@@ -7035,7 +7045,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ: > case RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ: > if (flow_dv_convert_action_modify_tcp_seq > @@ -360,7 +361,7 @@ > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ ? > -@@ -7396,7 +7406,7 @@ cnt_err: > +@@ -7046,7 +7056,7 @@ cnt_err: > case RTE_FLOW_ACTION_TYPE_INC_TCP_ACK: > case RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK: > if (flow_dv_convert_action_modify_tcp_ack > @@ -369,7 +370,7 @@ > return -rte_errno; > action_flags |=3D actions->type =3D=3D >=20 > RTE_FLOW_ACTION_TYPE_INC_TCP_ACK ? > -@@ -7405,13 +7415,13 @@ cnt_err: > +@@ -7055,13 +7065,13 @@ cnt_err: > break; > case MLX5_RTE_FLOW_ACTION_TYPE_TAG: > if (flow_dv_convert_action_set_reg > @@ -385,22 +386,7 @@ > return -rte_errno; > action_flags |=3D MLX5_FLOW_ACTION_SET_TAG; > break; > -@@ -7435,23 +7445,23 @@ cnt_err: > - action_flags |=3D MLX5_FLOW_ACTION_METER; > - break; > - case RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP: > -- if > (flow_dv_convert_action_modify_ipv4_dscp(&mhdr_res, > -+ if > (flow_dv_convert_action_modify_ipv4_dscp(mhdr_res, > - actions, > error)) > - return -rte_errno; > - action_flags |=3D > MLX5_FLOW_ACTION_SET_IPV4_DSCP; > - break; > - case RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP: > -- if > (flow_dv_convert_action_modify_ipv6_dscp(&mhdr_res, > -+ if > (flow_dv_convert_action_modify_ipv6_dscp(mhdr_res, > - actions, > error)) > - return -rte_errno; > - action_flags |=3D > MLX5_FLOW_ACTION_SET_IPV6_DSCP; > +@@ -7086,10 +7096,10 @@ cnt_err: > break; > case RTE_FLOW_ACTION_TYPE_END: > actions_end =3D true; > @@ -413,7 +399,7 @@ > return -rte_errno; > dev_flow- > >dv.actions[modify_action_position] =3D > dev_flow->dv.modify_hdr- > >verbs_action; > -@@ -7460,7 +7470,7 @@ cnt_err: > +@@ -7098,7 +7108,7 @@ cnt_err: > default: > break; > }