From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0052.outbound.protection.outlook.com [104.47.0.52]) by dpdk.org (Postfix) with ESMTP id 9ED5C5681 for ; Mon, 5 Nov 2018 08:32:33 +0100 (CET) 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=gxd0mZo6g8bAR2etO8Xx2Kg2nfObKWfuEe6nvx/jP48=; b=XAeP3CUYiNhj9uW93yvq9Ueoo5Ey9p4iT9pmLabZvFDk+84dgubFpHp5fBxD5vcDsLprKFmgGQrpvzwmSuvsXbtMvHO4R4slbQNab9lQYMIm8LnPp5YPu8Am77uPf/uDeO48wA0UKGh5DEde2ZxvqMhV/LU+tAuFcnQXFjd1syE= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3393.eurprd05.prod.outlook.com (10.171.187.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Mon, 5 Nov 2018 07:32:31 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::61ec:ffec:5ebf:7bd6]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::61ec:ffec:5ebf:7bd6%3]) with mapi id 15.20.1294.028; Mon, 5 Nov 2018 07:32:31 +0000 From: Ori Kam To: Yongseok Koh , Shahaf Shuler CC: "dev@dpdk.org" Thread-Topic: [PATCH v2 3/3] net/mlx5: remove flags setting from flow preparation Thread-Index: AQHUdNgSBPnjJDitSUi2M57Zd/Ewa6VAyaaw Date: Mon, 5 Nov 2018 07:32:31 +0000 Message-ID: References: <20181102210801.28370-1-yskoh@mellanox.com> <20181105072032.42374-1-yskoh@mellanox.com> <20181105072032.42374-4-yskoh@mellanox.com> In-Reply-To: <20181105072032.42374-4-yskoh@mellanox.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=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3393; 6:AmqH/XBlLL19NdvaPF3biyCMvGfYrbPf6CecVAy71zapWT6lFJrgMecwpfmLY6plpdwCdZIO60zN7AnSu/zqugh3N6r+aIXIOJeHkIS+qvFUyQNWCS8YgwU1BdWieX8YZ+W9kLgTA1z4DQtUZpvBPHJu/U2W3XVeSBP/L0tLTZNm2tqN6Uhar84LvVR25S0pi3orhxzLHymm9Y7+2qeYNcfHueIXXTZlXr4VnG2oQIc6DstogUQ0lJb0NnuSU8O7KLlvOzF+OzioC/VbeSP6TjSknc3rCaZKbs8Kw9x3xWz+LQ5xZgQdmeNJ8uz8wKZI9IMNtp0VCVyiyPXojE/IWTzjT6ziD14MiySyc27gHgV808P4RfuV1Eeg4atfAiIWjncV8LQp4vOjCa6zEeKsSRgie1zpFfDYtNNYlYMdtPDciUzITnWutsLrRLmSs39O3MrWLdr3NlZ+j/p1LuiCWA==; 5:m9+0Kk+fOMeVrLV4lTDkL8ViZBX8BTIrq9aTK6ZlVBBq3TUDMTEYtyRQGR68zS/zbUMQD6YPXuEHrmtFe90xEHrPxxfBgjo94gNw2Itm6IfnpvxgJ2wur7PJz8U9/yVy4OtxtHFgo+zMfq7ib8DmsBUYrukgq51ZNKqZlaTWbRM=; 7:EHYODKNd/lnHvKMnBe3253ThkHTGU2aJFVGrVn9X4rdzYt9dD2J58KDjw/QqqJUhgtrri+FUWKJZs/fr/GGkdMcjeFzqCqFA2j9NcfW7k9hfKuhl10vsCDI/Oe1AhNaCTFZXBs9DBxYZLXnNuNRRZQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 7ac65d46-8576-41c9-cc28-08d642f0d8df x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3393; x-ms-traffictypediagnostic: AM4PR05MB3393: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3393; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3393; x-forefront-prvs: 08476BC6EF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(136003)(396003)(366004)(39860400002)(346002)(376002)(51234002)(199004)(189003)(13464003)(74316002)(476003)(305945005)(99286004)(8936002)(3846002)(6116002)(81166006)(446003)(81156014)(8676002)(256004)(105586002)(14444005)(11346002)(2906002)(486006)(6506007)(229853002)(2900100001)(53546011)(106356001)(7696005)(7736002)(76176011)(71190400001)(66066001)(186003)(102836004)(575784001)(55016002)(86362001)(4744004)(53946003)(9686003)(71200400001)(316002)(53936002)(5660300001)(97736004)(68736007)(110136005)(6436002)(4326008)(478600001)(25786009)(33656002)(6246003)(14454004)(6636002)(26005)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3393; H:AM4PR05MB3425.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-microsoft-antispam-message-info: 6mnMsWBBDUMudGTYEVQY6b7P6bbUs9aVod2EmAPqh2Emci/i/PdRhE6JM/cDCTRqunTbZJUQkpEPRM8/dgORL2IiyYQM6C3CmsJiVmdemzY13NYIV0nOXwBOUT6GafeW2+tq3YtInf1o8aLajCnf8/QvhAadYZ9b44YEUhZ3Mt2eQ1vjzzdoA8mmLatP5MJTTYwl+an1bdPvi7luf3irGo4m6ulm9XmIRlikP0aPl/uoGzPogyN/LxnanUoG0TGmJS5y/MrtvwLKSvYKBcx5cweTQPt9kbgZXcAZXiWrJpdOqjpLPDFhDTIcsyedzgFkhQBt/mwHu5f3qhyevj2175X8YDjebzbHyJJmwm/L/fM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 7ac65d46-8576-41c9-cc28-08d642f0d8df X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2018 07:32:31.5812 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3393 Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/mlx5: remove flags setting from flow preparation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2018 07:32:34 -0000 > -----Original Message----- > From: Yongseok Koh > Sent: Monday, November 5, 2018 9:21 AM > To: Shahaf Shuler > Cc: dev@dpdk.org; Ori Kam ; Yongseok Koh > > Subject: [PATCH v2 3/3] net/mlx5: remove flags setting from flow preparat= ion >=20 > Even though flow_drv_prepare() takes item_flags and action_flags to be > filled in, those are not used and will be overwritten by parsing of > flow_drv_translate(). There's no reason to keep the flags and fill it. > Appropriate notes are added to the documentation of flow_drv_prepare() an= d > flow_drv_translate(). >=20 > Signed-off-by: Yongseok Koh > --- > drivers/net/mlx5/mlx5_flow.c | 38 ++++++++++------------ > drivers/net/mlx5/mlx5_flow.h | 3 +- > drivers/net/mlx5/mlx5_flow_dv.c | 6 ---- > drivers/net/mlx5/mlx5_flow_tcf.c | 39 +++++++---------------- > drivers/net/mlx5/mlx5_flow_verbs.c | 64 +++++---------------------------= ------ > 5 files changed, 37 insertions(+), 113 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index be2cc6b93f..3c2ac4b377 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -1663,8 +1663,6 @@ static struct mlx5_flow * > flow_null_prepare(const struct rte_flow_attr *attr __rte_unused, > const struct rte_flow_item items[] __rte_unused, > const struct rte_flow_action actions[] __rte_unused, > - uint64_t *item_flags __rte_unused, > - uint64_t *action_flags __rte_unused, > struct rte_flow_error *error __rte_unused) > { > rte_errno =3D ENOTSUP; > @@ -1792,16 +1790,19 @@ flow_drv_validate(struct rte_eth_dev *dev, > * calculates the size of memory required for device flow, allocates the > memory, > * initializes the device flow and returns the pointer. > * > + * @note > + * This function initializes device flow structure such as dv, tcf or = verbs in > + * struct mlx5_flow. However, it is caller's responsibility to initial= ize the > + * rest. For example, adding returning device flow to flow->dev_flow l= ist and > + * setting backward reference to the flow should be done out of this f= unction. > + * layers field is not filled either. > + * > * @param[in] attr > * Pointer to the flow attributes. > * @param[in] items > * Pointer to the list of items. > * @param[in] actions > * Pointer to the list of actions. > - * @param[out] item_flags > - * Pointer to bit mask of all items detected. > - * @param[out] action_flags > - * Pointer to bit mask of all actions detected. > * @param[out] error > * Pointer to the error structure. > * > @@ -1809,12 +1810,10 @@ flow_drv_validate(struct rte_eth_dev *dev, > * Pointer to device flow on success, otherwise NULL and rte_ernno is = set. > */ > static inline struct mlx5_flow * > -flow_drv_prepare(struct rte_flow *flow, > +flow_drv_prepare(const struct rte_flow *flow, > const struct rte_flow_attr *attr, > const struct rte_flow_item items[], > const struct rte_flow_action actions[], > - uint64_t *item_flags, > - uint64_t *action_flags, > struct rte_flow_error *error) > { > const struct mlx5_flow_driver_ops *fops; > @@ -1822,8 +1821,7 @@ flow_drv_prepare(struct rte_flow *flow, >=20 > assert(type > MLX5_FLOW_TYPE_MIN && type < > MLX5_FLOW_TYPE_MAX); > fops =3D flow_get_drv_ops(type); > - return fops->prepare(attr, items, actions, item_flags, action_flags, > - error); > + return fops->prepare(attr, items, actions, error); > } >=20 > /** > @@ -1832,6 +1830,12 @@ flow_drv_prepare(struct rte_flow *flow, > * translates a generic flow into a driver flow. flow_drv_prepare() must > * precede. > * > + * @note > + * dev_flow->layers could be filled as a result of parsing during tran= slation > + * if needed by flow_drv_apply(). dev_flow->flow->actions can also be = filled > + * if necessary. As a flow can have multiple dev_flows by RSS flow exp= ansion, > + * flow->actions could be overwritten even though all the expanded > dev_flows > + * have the same actions. > * > * @param[in] dev > * Pointer to the rte dev structure. > @@ -1895,7 +1899,7 @@ flow_drv_apply(struct rte_eth_dev *dev, struct > rte_flow *flow, > * Flow driver remove API. This abstracts calling driver specific functi= ons. > * Parent flow (rte_flow) should have driver type (drv_type). It removes= a flow > * on device. All the resources of the flow should be freed by calling > - * flow_dv_destroy(). > + * flow_drv_destroy(). > * > * @param[in] dev > * Pointer to Ethernet device. > @@ -2026,8 +2030,6 @@ flow_list_create(struct rte_eth_dev *dev, struct > mlx5_flows *list, > { > struct rte_flow *flow =3D NULL; > struct mlx5_flow *dev_flow; > - uint64_t action_flags =3D 0; > - uint64_t item_flags =3D 0; > const struct rte_flow_action_rss *rss; > union { > struct rte_flow_expand_rss buf; > @@ -2070,16 +2072,10 @@ flow_list_create(struct rte_eth_dev *dev, struct > mlx5_flows *list, > } > for (i =3D 0; i < buf->entries; ++i) { > dev_flow =3D flow_drv_prepare(flow, attr, buf->entry[i].pattern, > - actions, &item_flags, &action_flags, > - error); > + actions, error); > if (!dev_flow) > goto error; > dev_flow->flow =3D flow; > - dev_flow->layers =3D item_flags; > - /* Store actions once as expanded flows have same actions. */ > - if (i =3D=3D 0) > - flow->actions =3D action_flags; > - assert(flow->actions =3D=3D action_flags); > LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next); > ret =3D flow_drv_translate(dev, dev_flow, attr, > buf->entry[i].pattern, > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 2a3ce44b0b..51ab47fe44 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -302,8 +302,7 @@ typedef int (*mlx5_flow_validate_t)(struct rte_eth_de= v > *dev, > struct rte_flow_error *error); > typedef struct mlx5_flow *(*mlx5_flow_prepare_t) > (const struct rte_flow_attr *attr, const struct rte_flow_item items[], > - const struct rte_flow_action actions[], uint64_t *item_flags, > - uint64_t *action_flags, struct rte_flow_error *error); > + const struct rte_flow_action actions[], struct rte_flow_error *error); > typedef int (*mlx5_flow_translate_t)(struct rte_eth_dev *dev, > struct mlx5_flow *dev_flow, > const struct rte_flow_attr *attr, > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index 8b4d5956ba..7909615360 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1014,10 +1014,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > * Pointer to the list of items. > * @param[in] actions > * Pointer to the list of actions. > - * @param[out] item_flags > - * Pointer to bit mask of all items detected. > - * @param[out] action_flags > - * Pointer to bit mask of all actions detected. > * @param[out] error > * Pointer to the error structure. > * > @@ -1029,8 +1025,6 @@ static struct mlx5_flow * > flow_dv_prepare(const struct rte_flow_attr *attr __rte_unused, > const struct rte_flow_item items[] __rte_unused, > const struct rte_flow_action actions[] __rte_unused, > - uint64_t *item_flags __rte_unused, > - uint64_t *action_flags __rte_unused, > struct rte_flow_error *error) > { > uint32_t size =3D sizeof(struct mlx5_flow); > diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c > b/drivers/net/mlx5/mlx5_flow_tcf.c > index ee614b3f1d..fb817b2311 100644 > --- a/drivers/net/mlx5/mlx5_flow_tcf.c > +++ b/drivers/net/mlx5/mlx5_flow_tcf.c > @@ -2370,24 +2370,21 @@ flow_tcf_validate(struct rte_eth_dev *dev, > } >=20 > /** > - * Calculate maximum size of memory for flow items of Linux TC flower an= d > - * extract specified items. > + * Calculate maximum size of memory for flow items of Linux TC flower. > * > + * @param[in] attr > + * Pointer to the flow attributes. > * @param[in] items > * Pointer to the list of items. > - * @param[out] item_flags > - * Pointer to the detected items. > * > * @return > * Maximum size of memory for items. > */ > static int > -flow_tcf_get_items_and_size(const struct rte_flow_attr *attr, > - const struct rte_flow_item items[], > - uint64_t *item_flags) > +flow_tcf_get_items_size(const struct rte_flow_attr *attr, > + const struct rte_flow_item items[]) > { > int size =3D 0; > - uint64_t flags =3D 0; >=20 > size +=3D SZ_NLATTR_STRZ_OF("flower") + > SZ_NLATTR_NEST + /* TCA_OPTIONS. */ > @@ -2404,7 +2401,6 @@ flow_tcf_get_items_and_size(const struct > rte_flow_attr *attr, > size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. > */ > SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) * 4; > /* dst/src MAC addr and mask. */ > - flags |=3D MLX5_FLOW_LAYER_OUTER_L2; > break; > case RTE_FLOW_ITEM_TYPE_VLAN: > size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. > */ > @@ -2412,37 +2408,31 @@ flow_tcf_get_items_and_size(const struct > rte_flow_attr *attr, > /* VLAN Ether type. */ > SZ_NLATTR_TYPE_OF(uint8_t) + /* VLAN prio. > */ > SZ_NLATTR_TYPE_OF(uint16_t); /* VLAN ID. */ > - flags |=3D MLX5_FLOW_LAYER_OUTER_VLAN; > break; > case RTE_FLOW_ITEM_TYPE_IPV4: > size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. > */ > SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ > SZ_NLATTR_TYPE_OF(uint32_t) * 4; > /* dst/src IP addr and mask. */ > - flags |=3D MLX5_FLOW_LAYER_OUTER_L3_IPV4; > break; > case RTE_FLOW_ITEM_TYPE_IPV6: > size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. > */ > SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ > SZ_NLATTR_DATA_OF(IPV6_ADDR_LEN) * 4; > /* dst/src IP addr and mask. */ > - flags |=3D MLX5_FLOW_LAYER_OUTER_L3_IPV6; > break; > case RTE_FLOW_ITEM_TYPE_UDP: > size +=3D SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ > SZ_NLATTR_TYPE_OF(uint16_t) * 4; > /* dst/src port and mask. */ > - flags |=3D MLX5_FLOW_LAYER_OUTER_L4_UDP; > break; > case RTE_FLOW_ITEM_TYPE_TCP: > size +=3D SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ > SZ_NLATTR_TYPE_OF(uint16_t) * 4; > /* dst/src port and mask. */ > - flags |=3D MLX5_FLOW_LAYER_OUTER_L4_TCP; > break; > case RTE_FLOW_ITEM_TYPE_VXLAN: > size +=3D SZ_NLATTR_TYPE_OF(uint32_t); > - flags |=3D MLX5_FLOW_LAYER_VXLAN; > break; > default: > DRV_LOG(WARNING, > @@ -2452,7 +2442,6 @@ flow_tcf_get_items_and_size(const struct > rte_flow_attr *attr, > break; > } > } > - *item_flags =3D flags; > return size; > } >=20 > @@ -2668,10 +2657,6 @@ flow_tcf_nl_brand(struct nlmsghdr *nlh, uint32_t > handle) > * Pointer to the list of items. > * @param[in] actions > * Pointer to the list of actions. > - * @param[out] item_flags > - * Pointer to bit mask of all items detected. > - * @param[out] action_flags > - * Pointer to bit mask of all actions detected. > * @param[out] error > * Pointer to the error structure. > * > @@ -2683,7 +2668,6 @@ static struct mlx5_flow * > flow_tcf_prepare(const struct rte_flow_attr *attr, > const struct rte_flow_item items[], > const struct rte_flow_action actions[], > - uint64_t *item_flags, uint64_t *action_flags, > struct rte_flow_error *error) > { > size_t size =3D RTE_ALIGN_CEIL > @@ -2692,12 +2676,13 @@ flow_tcf_prepare(const struct rte_flow_attr *attr= , > MNL_ALIGN(sizeof(struct nlmsghdr)) + > MNL_ALIGN(sizeof(struct tcmsg)); > struct mlx5_flow *dev_flow; > + uint64_t action_flags =3D 0; > struct nlmsghdr *nlh; > struct tcmsg *tcm; > uint8_t *sp, *tun =3D NULL; >=20 > - size +=3D flow_tcf_get_items_and_size(attr, items, item_flags); > - size +=3D flow_tcf_get_actions_and_size(actions, action_flags); > + size +=3D flow_tcf_get_items_size(attr, items); > + size +=3D flow_tcf_get_actions_and_size(actions, &action_flags); > dev_flow =3D rte_zmalloc(__func__, size, MNL_ALIGNTO); > if (!dev_flow) { > rte_flow_error_set(error, ENOMEM, > @@ -2706,7 +2691,7 @@ flow_tcf_prepare(const struct rte_flow_attr *attr, > return NULL; > } > sp =3D (uint8_t *)(dev_flow + 1); > - if (*action_flags & MLX5_FLOW_ACTION_VXLAN_ENCAP) { > + if (action_flags & MLX5_FLOW_ACTION_VXLAN_ENCAP) { > sp =3D RTE_PTR_ALIGN > (sp, alignof(struct flow_tcf_tunnel_hdr)); > tun =3D sp; > @@ -2718,7 +2703,7 @@ flow_tcf_prepare(const struct rte_flow_attr *attr, > (sizeof(struct flow_tcf_vxlan_encap), > MNL_ALIGNTO); > #endif > - } else if (*action_flags & MLX5_FLOW_ACTION_VXLAN_DECAP) { > + } else if (action_flags & MLX5_FLOW_ACTION_VXLAN_DECAP) { > sp =3D RTE_PTR_ALIGN > (sp, alignof(struct flow_tcf_tunnel_hdr)); > tun =3D sp; > @@ -2747,9 +2732,9 @@ flow_tcf_prepare(const struct rte_flow_attr *attr, > .tcm =3D tcm, > }, > }; > - if (*action_flags & MLX5_FLOW_ACTION_VXLAN_DECAP) > + if (action_flags & MLX5_FLOW_ACTION_VXLAN_DECAP) > dev_flow->tcf.tunnel->type =3D > FLOW_TCF_TUNACT_VXLAN_DECAP; > - else if (*action_flags & MLX5_FLOW_ACTION_VXLAN_ENCAP) > + else if (action_flags & MLX5_FLOW_ACTION_VXLAN_ENCAP) > dev_flow->tcf.tunnel->type =3D > FLOW_TCF_TUNACT_VXLAN_ENCAP; > /* > * Generate a reasonably unique handle based on the address of the > diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c > b/drivers/net/mlx5/mlx5_flow_verbs.c > index 43fcd0d29e..699cc88c8c 100644 > --- a/drivers/net/mlx5/mlx5_flow_verbs.c > +++ b/drivers/net/mlx5/mlx5_flow_verbs.c > @@ -1209,23 +1209,18 @@ flow_verbs_validate(struct rte_eth_dev *dev, >=20 > /** > * Calculate the required bytes that are needed for the action part of t= he verbs > - * flow, in addtion returns bit-fields with all the detected action, in = order to > - * avoid another interation over the actions. > + * flow. > * > * @param[in] actions > * Pointer to the list of actions. > - * @param[out] action_flags > - * Pointer to the detected actions. > * > * @return > * The size of the memory needed for all actions. > */ > static int > -flow_verbs_get_actions_and_size(const struct rte_flow_action actions[], > - uint64_t *action_flags) > +flow_verbs_get_actions_size(const struct rte_flow_action actions[]) > { > int size =3D 0; > - uint64_t detected_actions =3D 0; >=20 > for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) { > switch (actions->type) { > @@ -1233,128 +1228,89 @@ flow_verbs_get_actions_and_size(const struct > rte_flow_action actions[], > break; > case RTE_FLOW_ACTION_TYPE_FLAG: > size +=3D sizeof(struct ibv_flow_spec_action_tag); > - detected_actions |=3D MLX5_FLOW_ACTION_FLAG; > break; > case RTE_FLOW_ACTION_TYPE_MARK: > size +=3D sizeof(struct ibv_flow_spec_action_tag); > - detected_actions |=3D MLX5_FLOW_ACTION_MARK; > break; > case RTE_FLOW_ACTION_TYPE_DROP: > size +=3D sizeof(struct ibv_flow_spec_action_drop); > - detected_actions |=3D MLX5_FLOW_ACTION_DROP; > break; > case RTE_FLOW_ACTION_TYPE_QUEUE: > - detected_actions |=3D MLX5_FLOW_ACTION_QUEUE; > break; > case RTE_FLOW_ACTION_TYPE_RSS: > - detected_actions |=3D MLX5_FLOW_ACTION_RSS; > break; > case RTE_FLOW_ACTION_TYPE_COUNT: > #if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ > defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) > size +=3D sizeof(struct ibv_flow_spec_counter_action); > #endif > - detected_actions |=3D MLX5_FLOW_ACTION_COUNT; > break; > default: > break; > } > } > - *action_flags =3D detected_actions; > return size; > } >=20 > /** > * Calculate the required bytes that are needed for the item part of the= verbs > - * flow, in addtion returns bit-fields with all the detected action, in = order to > - * avoid another interation over the actions. > + * flow. > * > - * @param[in] actions > + * @param[in] items > * Pointer to the list of items. > - * @param[in, out] item_flags > - * Pointer to the detected items. > * > * @return > * The size of the memory needed for all items. > */ > static int > -flow_verbs_get_items_and_size(const struct rte_flow_item items[], > - uint64_t *item_flags) > +flow_verbs_get_items_size(const struct rte_flow_item items[]) > { > int size =3D 0; > - uint64_t detected_items =3D 0; >=20 > for (; items->type !=3D RTE_FLOW_ITEM_TYPE_END; items++) { > - int tunnel =3D !!(detected_items & > MLX5_FLOW_LAYER_TUNNEL); > - > switch (items->type) { > case RTE_FLOW_ITEM_TYPE_VOID: > break; > case RTE_FLOW_ITEM_TYPE_ETH: > size +=3D sizeof(struct ibv_flow_spec_eth); > - detected_items |=3D tunnel ? > MLX5_FLOW_LAYER_INNER_L2 : > - > MLX5_FLOW_LAYER_OUTER_L2; > break; > case RTE_FLOW_ITEM_TYPE_VLAN: > size +=3D sizeof(struct ibv_flow_spec_eth); > - detected_items |=3D > - tunnel ? (MLX5_FLOW_LAYER_INNER_L2 | > - MLX5_FLOW_LAYER_INNER_VLAN) : > - (MLX5_FLOW_LAYER_OUTER_L2 | > - MLX5_FLOW_LAYER_OUTER_VLAN); > break; > case RTE_FLOW_ITEM_TYPE_IPV4: > size +=3D sizeof(struct ibv_flow_spec_ipv4_ext); > - detected_items |=3D tunnel ? > - MLX5_FLOW_LAYER_INNER_L3_IPV4 > : > - > MLX5_FLOW_LAYER_OUTER_L3_IPV4; > break; > case RTE_FLOW_ITEM_TYPE_IPV6: > size +=3D sizeof(struct ibv_flow_spec_ipv6); > - detected_items |=3D tunnel ? > - MLX5_FLOW_LAYER_INNER_L3_IPV6 > : > - > MLX5_FLOW_LAYER_OUTER_L3_IPV6; > break; > case RTE_FLOW_ITEM_TYPE_UDP: > size +=3D sizeof(struct ibv_flow_spec_tcp_udp); > - detected_items |=3D tunnel ? > - MLX5_FLOW_LAYER_INNER_L4_UDP > : > - > MLX5_FLOW_LAYER_OUTER_L4_UDP; > break; > case RTE_FLOW_ITEM_TYPE_TCP: > size +=3D sizeof(struct ibv_flow_spec_tcp_udp); > - detected_items |=3D tunnel ? > - MLX5_FLOW_LAYER_INNER_L4_TCP : > - > MLX5_FLOW_LAYER_OUTER_L4_TCP; > break; > case RTE_FLOW_ITEM_TYPE_VXLAN: > size +=3D sizeof(struct ibv_flow_spec_tunnel); > - detected_items |=3D MLX5_FLOW_LAYER_VXLAN; > break; > case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: > size +=3D sizeof(struct ibv_flow_spec_tunnel); > - detected_items |=3D MLX5_FLOW_LAYER_VXLAN_GPE; > break; > #ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT > case RTE_FLOW_ITEM_TYPE_GRE: > size +=3D sizeof(struct ibv_flow_spec_gre); > - detected_items |=3D MLX5_FLOW_LAYER_GRE; > break; > case RTE_FLOW_ITEM_TYPE_MPLS: > size +=3D sizeof(struct ibv_flow_spec_mpls); > - detected_items |=3D MLX5_FLOW_LAYER_MPLS; > break; > #else > case RTE_FLOW_ITEM_TYPE_GRE: > size +=3D sizeof(struct ibv_flow_spec_tunnel); > - detected_items |=3D MLX5_FLOW_LAYER_TUNNEL; > break; > #endif > default: > break; > } > } > - *item_flags =3D detected_items; > return size; > } >=20 > @@ -1369,10 +1325,6 @@ flow_verbs_get_items_and_size(const struct > rte_flow_item items[], > * Pointer to the list of items. > * @param[in] actions > * Pointer to the list of actions. > - * @param[out] item_flags > - * Pointer to bit mask of all items detected. > - * @param[out] action_flags > - * Pointer to bit mask of all actions detected. > * @param[out] error > * Pointer to the error structure. > * > @@ -1384,15 +1336,13 @@ static struct mlx5_flow * > flow_verbs_prepare(const struct rte_flow_attr *attr __rte_unused, > const struct rte_flow_item items[], > const struct rte_flow_action actions[], > - uint64_t *item_flags, > - uint64_t *action_flags, > struct rte_flow_error *error) > { > uint32_t size =3D sizeof(struct mlx5_flow) + sizeof(struct ibv_flow_att= r); > struct mlx5_flow *flow; >=20 > - size +=3D flow_verbs_get_actions_and_size(actions, action_flags); > - size +=3D flow_verbs_get_items_and_size(items, item_flags); > + size +=3D flow_verbs_get_actions_size(actions); > + size +=3D flow_verbs_get_items_size(items); > flow =3D rte_calloc(__func__, 1, size, 0); > if (!flow) { > rte_flow_error_set(error, ENOMEM, > -- > 2.11.0 Acked-by: Ori Kam Thanks, Ori