From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 493DBA0A0E; Mon, 10 May 2021 14:29:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D8F440140; Mon, 10 May 2021 14:29:39 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2046.outbound.protection.outlook.com [40.107.236.46]) by mails.dpdk.org (Postfix) with ESMTP id 518224003E for ; Mon, 10 May 2021 14:29:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NyAO5VorrGVpzJTlAp7NcMYSNaPfoIpDwuebStPtNO6UIBcGiPBZthhd2lmsElASmsvPnLtlWCE44v8rrU7A3UOfthmPBlMaFp3Phfpfji31IvFxvqpafJwMLfitN++iYC8Mg5kl+bhUMFbkJkbYuVkG3zXDc/1P1ZRGwP2qaq+xrQSQCSA/A7Urjv0r52GPRIgtNKBRoap0lgBYtSOSWF7FOiDiCscTKD1RNbqTL0StVH5xNziRHvW85qeTUkh3lDEd4dSsz6hkU7TKx+hXE8m9u6af3aa/ozDztF+5RHlu1Zabj+N2dLrP51w4zLiHqwnk0F5JIYpyg0pDqo0s6w== 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=wV0U9dhG1zioobAceQL5Hr43aoNNEpWugJExesh7PsQ=; b=XWi2acF2W473y14OEAG4FCOZXuj39Iz/X32QiFxkb1ADD0/K7UKur5tPr4xJPlMMmhrYhcNNad2eU6pCmK8Nwpp+9N+T50aUY06HtAZXaUjGdrZ0WRPubkGhOgXgwiLotDn5ge3Ef2FUxF5JtIOUzTHBltz0XJJugNRCvrob0IegxpUJuVs036iKwdvQSiAO1fqLSEypixqU7UUXsmA/4m7L16H2wbXa/Prn4blcmKOddL8+fMaB8uE8U5Txa2WxftMRtwn0uxdEde2xnDl/caoH9wBqUChbRcwLwKCsl7v+z0cjz2VZhsyjfpp2i43tmVH5DXSJKOMPs4Ax3Xt5Tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wV0U9dhG1zioobAceQL5Hr43aoNNEpWugJExesh7PsQ=; b=Golh3Byvt04ru85dQS76ALpFCJvFJVVJcecHYo44vrKkVOgDT4bMeaeD6ExZhLrQKjkxj+CjYu5o+nAtFBrUYINoBRLHUFNqLRKcnWdfCEG/+8OFghiWzRuFe1yR9Zu2peT1kZIDewhWi+pHEf7tJWp/0ks5NIAr7WpbXjr8Ru2T3PsigrhUvQKtCFcy1AdgfL6o1+0BI6Rg1KjQmL2va10wlgu/8mJAXo/KjO81rzpiIBONoiz0+uU4kB086wc63FBeK4Jz+dPckdVaT3oeGIS12Ggp2BlvDrYqXM3KbihIIxnYJB/fngmZlTuPHNJunE2s+Nfk84jbYSQbiEL4WQ== Received: from BY5PR12MB4834.namprd12.prod.outlook.com (2603:10b6:a03:1b2::17) by BY5PR12MB3906.namprd12.prod.outlook.com (2603:10b6:a03:1a9::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.29; Mon, 10 May 2021 12:29:35 +0000 Received: from BY5PR12MB4834.namprd12.prod.outlook.com ([fe80::45ab:9d36:e3f8:40e2]) by BY5PR12MB4834.namprd12.prod.outlook.com ([fe80::45ab:9d36:e3f8:40e2%3]) with mapi id 15.20.4108.031; Mon, 10 May 2021 12:29:35 +0000 From: Gregory Etelson To: "ferruh.yigit@intel.com" CC: Raslan Darawsheh , Slava Ovsiienko , "dev@dpdk.org" Thread-Topic: [PATCH v4] net/mlx5: fix tunnel offload private items location Thread-Index: AQHXQl5ZwqgqSSuXNkKXPUhygX1th6rcqbrg Date: Mon, 10 May 2021 12:29:35 +0000 Message-ID: References: <20210419130204.24348-1-getelson@nvidia.com> <20210506095751.5689-1-getelson@nvidia.com> In-Reply-To: <20210506095751.5689-1-getelson@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e2a87065-55f7-46e3-4712-08d913af4596 x-ms-traffictypediagnostic: BY5PR12MB3906: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MUvjGgcrmpYKZ+8O24/b07MuRZheJeJ5BqRVjcZvzkweYASc+dQw8og7Ci8ZmQxQIvgTt5qt930vV3jRmTp11c+CW0kwLBmaTb/9yM710pFiAbcUa38dUXip0hIvQP3HBJxPms2d9+vV+NPrvIpsR3bJASPPY6aZ4MNNhCHK5zdCbGXumuh+f4RWP7SPEcfM/JTdE4mKyZjzQEBRayeMnz8SO9s5L24JRDZO6mpLzZXbMvkgtO3n3nboqL0QOWADoC+2KrQKwCqLdZ07nJkOpsO8/pb6U7b6cIKUBn00Z03uApR9viN/RmRUNj9sUeUP6jH/YN44cn9ALikYrFr+xi0hgYEJR8jrTq4BwdrytoYnHskVltrxkIPAdnXbaBwN4yaThmbUydJzCIfPABJFVZNuV3Y/qMnR+kAjyA2AVLZTK2IZ7ivk99blY3DwoncuHNBBgX1gkfXb2QEUoGJo4wO6qfaVQxEoaZoKy3r8kF7nA1ZZ/iYdVo2kjzh5E2dCNmF0S0HcaO8k/hgVeeQaUIXTJjzHQzJCIhnKeAU7Wgx56Zxdkitn9UT/uU1tNNy8jECYczLj3g81pno3upUhi/iztPkbjrN5w9b5AAdQmRgTeWoUsTvgRjzR1RZKhhNbp+5pVLKM8f7WUlz104Galz252Hg7TM3CIeA2/rFk6uOWP/+FH5l+fpkKFJfCxwCde6g7t5Xx3iu02ZlEFtK7zd4wnV4puKA1qX33yLxSKlk= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR12MB4834.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(346002)(376002)(396003)(366004)(53546011)(2906002)(186003)(71200400001)(66446008)(26005)(54906003)(6506007)(33656002)(30864003)(316002)(55016002)(9686003)(4326008)(5660300002)(76116006)(64756008)(7696005)(66556008)(66476007)(66946007)(83380400001)(52536014)(6916009)(478600001)(8676002)(86362001)(122000001)(38100700002)(8936002)(579004)(309714004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?L2yRD9kXNnxHt5g9/PjBTFJwLokOuO6/RObgBqYPEg63pajLOgiopY0VIA6a?= =?us-ascii?Q?6ybB6sy+kJVmURixpZLExDinly40aA5PH868bIMWz86ysYPhwrqp+Luu9BEd?= =?us-ascii?Q?hjKdIaIWiPiyLXE2GO6D6abVsTjH9GPEflHzI0gYufZbo7VDwGgAQG7rWZzV?= =?us-ascii?Q?eVRURkJNlXCeEh5S9dNqbogE2rm++GFRhFDxjSYS4auVDEQVgPglNY2vd+/F?= =?us-ascii?Q?/lciolnnUG8WlCFG5GstpsHr6Ro+57MtkBhb/HohMVI+qlUSg89lMWbJ5HYt?= =?us-ascii?Q?AtpXHcNaovzRqhGNwVZb1kkIvFXZJUpIA9rAT9w+RGn4EETJHmBqWFj0rkgs?= =?us-ascii?Q?BG87XxmPzEG6BsufK35i8b6zXib7rZAQLgdiJaSh6ulvi4+5UMpXv4AuYrtz?= =?us-ascii?Q?hGsZadx6f/r1yc5X3wfeU6A0/wja2PbFbZxu5LuT6nWEPVB8jDmSZ/n4tiPR?= =?us-ascii?Q?WSLrGAPInu4v9V2CXnJE0LrBIBs+3CfFX7ZdNKfrTzdVsY9rVXhJh1WN750q?= =?us-ascii?Q?bS1M/dcSeqV69BATCpzjLEsHJGRG9SHAuknaXEhhbcoM4jJinhOmSOKoK+ot?= =?us-ascii?Q?nJ8OISjkXG+G+4SKYp+NkPMQnVY5iZD27Fgq4T35zQts1hKnsDTe0Mi26Pa9?= =?us-ascii?Q?fZiMI5SlFKoF2cZnk0HAj6wC8uxQ2RljGilzHuhWRu8mL16UdlVbjOJV2JU5?= =?us-ascii?Q?6t0UCdr2V1IOwldZq4tBa04jyRjOwhS+z/0+70EDqOrjilNe+RP5+0wXwHMH?= =?us-ascii?Q?RZi+08h5UU6lYqohjzRKYpsIMy3JJUy5c4MDf2ecWdYCDd40MxJuO7YNQ3g6?= =?us-ascii?Q?wAoJFbIzYGt8bPVERSJrd9kkBQp3CkjF7MNwcHPUTfbSdr8OXSdETR8rCnYD?= =?us-ascii?Q?RKllW6/W4URdBeYCJhd5z36LtJSEhtUQuoKLS5ejAqlIEKKJk8VXmjdeSpvi?= =?us-ascii?Q?Yd3hloxC0uXeew1FXgQyINLwjgcYDR8v5xSN6Ss9lSdS/qkSZCZ0vkzC50wM?= =?us-ascii?Q?3n0KLh53qJBkRv7xmvQkrz6dtkXnvZp/z1I1DKbIBop9DRsgNtqvx/+hyr72?= =?us-ascii?Q?2Vtkq6xp90t7wz9NMfCpiKJ25fGiSZgV34gI2yiCnMiEZ+0+6ud7mwSZZqxL?= =?us-ascii?Q?lJOTlgPxlQH9zcOF6fVvBEfa2RFNoe3NV6jz7JJkO3sF8s+WMeTILaTEEvYa?= =?us-ascii?Q?pMq2ExTh5nAAck2E8JbQwbQPW2RSAz/GVVaHfY6TiZv+RsKN9J9iWQV8i1qW?= =?us-ascii?Q?us0m6YWxkF8m2nlBNaYcPCzU0YJDXPz/mqy3fWClxsSiVAk/TE5ftNKXTVIV?= =?us-ascii?Q?0pBZWnH1YhNS8/lljyb9a30f?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2a87065-55f7-46e3-4712-08d913af4596 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2021 12:29:35.5188 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 5Ao0d4CzMAG4TaNf1qqkoZKk21njmUAA7xdtxD1iy0iPtsEXNgbYI7BOmFydZDI3lw4cWvNzZznJKBUNk3RbHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3906 Subject: Re: [dpdk-dev] [PATCH v4] net/mlx5: fix tunnel offload private items location X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello Ferruh, The patch has failed ci/Intel-compilation test. (http://mails.dpdk.org/archives/test-report/2021-May/193327.html) I've checked that with Thomas. He confirmed that was a known fault and=20 should not affect the current patch. Can we proceed with the patch integration ? Thank you. Regards, Gregory=20 > -----Original Message----- > From: Gregory Etelson > Sent: Thursday, May 6, 2021 12:58 > To: dev@dpdk.org > Cc: Gregory Etelson ; Matan Azrad > ; Ori Kam ; Raslan Darawsheh > ; ferruh.yigit@intel.com; stable@dpdk.org; Slava > Ovsiienko ; Shahaf Shuler > > Subject: [PATCH v4] net/mlx5: fix tunnel offload private items location >=20 > Tunnel offload API requires application to query PMD for specific flow it= ems > and actions. Application uses these PMD specific elements to build flow > rules according to the tunnel offload model. > The model does not restrict private elements location in a flow rule, but= the > current MLX5 PMD implementation expects that tunnel offload rule will > begin with PMD specific elements. > The patch removes that placement limitation. >=20 > Cc: stable@dpdk.org >=20 > Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload") >=20 > Signed-off-by: Gregory Etelson > Acked-by: Viacheslav Ovsiienko > --- > v2: Update the patch comment. > v3: Remove testpmd patch from the series. > v4: Remove redundant verifications in flow_dv_validate. > --- > drivers/net/mlx5/mlx5_flow.c | 48 ++++++++++++------ > drivers/net/mlx5/mlx5_flow.h | 46 ++++++++++------- > drivers/net/mlx5/mlx5_flow_dv.c | 88 ++++++++++++++++----------------- > 3 files changed, 102 insertions(+), 80 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 3194cd5633..f464271d42 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -50,6 +50,7 @@ flow_tunnel_add_default_miss(struct rte_eth_dev > *dev, > const struct rte_flow_attr *attr, > const struct rte_flow_action *app_actions, > uint32_t flow_idx, > + const struct mlx5_flow_tunnel *tunnel, > struct tunnel_default_miss_ctx *ctx, > struct rte_flow_error *error); > static struct mlx5_flow_tunnel * > @@ -5958,22 +5959,14 @@ flow_create_split_outer(struct rte_eth_dev > *dev, > return ret; > } >=20 > -static struct mlx5_flow_tunnel * > -flow_tunnel_from_rule(struct rte_eth_dev *dev, > - const struct rte_flow_attr *attr, > - const struct rte_flow_item items[], > - const struct rte_flow_action actions[]) > +static inline struct mlx5_flow_tunnel * flow_tunnel_from_rule(const > +struct mlx5_flow *flow) > { > struct mlx5_flow_tunnel *tunnel; >=20 > #pragma GCC diagnostic push > #pragma GCC diagnostic ignored "-Wcast-qual" > - if (is_flow_tunnel_match_rule(dev, attr, items, actions)) > - tunnel =3D (struct mlx5_flow_tunnel *)items[0].spec; > - else if (is_flow_tunnel_steer_rule(dev, attr, items, actions)) > - tunnel =3D (struct mlx5_flow_tunnel *)actions[0].conf; > - else > - tunnel =3D NULL; > + tunnel =3D (typeof(tunnel))flow->tunnel; > #pragma GCC diagnostic pop >=20 > return tunnel; > @@ -6168,12 +6161,11 @@ flow_list_create(struct rte_eth_dev *dev, > uint32_t *list, > error); > if (ret < 0) > goto error; > - if (is_flow_tunnel_steer_rule(dev, attr, > - buf->entry[i].pattern, > - p_actions_rx)) { > + if (is_flow_tunnel_steer_rule(wks->flows[0].tof_type)) { > ret =3D flow_tunnel_add_default_miss(dev, flow, attr, > p_actions_rx, > idx, > + wks- > >flows[0].tunnel, > &default_miss_ctx, > error); > if (ret < 0) { > @@ -6237,7 +6229,7 @@ flow_list_create(struct rte_eth_dev *dev, > uint32_t *list, > } > flow_rxq_flags_set(dev, flow); > rte_free(translated_actions); > - tunnel =3D flow_tunnel_from_rule(dev, attr, items, actions); > + tunnel =3D flow_tunnel_from_rule(wks->flows); > if (tunnel) { > flow->tunnel =3D 1; > flow->tunnel_id =3D tunnel->tunnel_id; > @@ -8152,6 +8144,28 @@ int rte_pmd_mlx5_sync_flow(uint16_t port_id, > uint32_t domains) > return ret; > } >=20 > +const struct mlx5_flow_tunnel * > +mlx5_get_tof(const struct rte_flow_item *item, > + const struct rte_flow_action *action, > + enum mlx5_tof_rule_type *rule_type) { > + for (; item->type !=3D RTE_FLOW_ITEM_TYPE_END; item++) { > + if (item->type =3D=3D (typeof(item->type)) > + MLX5_RTE_FLOW_ITEM_TYPE_TUNNEL) { > + *rule_type =3D > MLX5_TUNNEL_OFFLOAD_MATCH_RULE; > + return flow_items_to_tunnel(item); > + } > + } > + for (; action->conf !=3D RTE_FLOW_ACTION_TYPE_END; action++) { > + if (action->type =3D=3D (typeof(action->type)) > + > MLX5_RTE_FLOW_ACTION_TYPE_TUNNEL_SET) { > + *rule_type =3D MLX5_TUNNEL_OFFLOAD_SET_RULE; > + return flow_actions_to_tunnel(action); > + } > + } > + return NULL; > +} > + > /** > * tunnel offload functionalilty is defined for DV environment only > */ > @@ -8182,13 +8196,13 @@ flow_tunnel_add_default_miss(struct > rte_eth_dev *dev, > const struct rte_flow_attr *attr, > const struct rte_flow_action *app_actions, > uint32_t flow_idx, > + const struct mlx5_flow_tunnel *tunnel, > struct tunnel_default_miss_ctx *ctx, > struct rte_flow_error *error) > { > struct mlx5_priv *priv =3D dev->data->dev_private; > struct mlx5_flow *dev_flow; > struct rte_flow_attr miss_attr =3D *attr; > - const struct mlx5_flow_tunnel *tunnel =3D app_actions[0].conf; > const struct rte_flow_item miss_items[2] =3D { > { > .type =3D RTE_FLOW_ITEM_TYPE_ETH, > @@ -8274,6 +8288,7 @@ flow_tunnel_add_default_miss(struct > rte_eth_dev *dev, > dev_flow->flow =3D flow; > dev_flow->external =3D true; > dev_flow->tunnel =3D tunnel; > + dev_flow->tof_type =3D MLX5_TUNNEL_OFFLOAD_MISS_RULE; > /* Subflow object was created, we must include one in the list. */ > SILIST_INSERT(&flow->dev_handles, dev_flow->handle_idx, > dev_flow->handle, next); > @@ -8887,6 +8902,7 @@ flow_tunnel_add_default_miss(__rte_unused > struct rte_eth_dev *dev, > __rte_unused const struct rte_flow_attr *attr, > __rte_unused const struct rte_flow_action > *actions, > __rte_unused uint32_t flow_idx, > + __rte_unused const struct mlx5_flow_tunnel > *tunnel, > __rte_unused struct tunnel_default_miss_ctx > *ctx, > __rte_unused struct rte_flow_error *error) { diff > --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 5365699426..04c8806bf6 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -819,6 +819,16 @@ struct mlx5_flow_verbs_workspace { > /** Maximal number of device sub-flows supported. */ #define > MLX5_NUM_MAX_DEV_FLOWS 32 >=20 > +/** > + * tunnel offload rules type > + */ > +enum mlx5_tof_rule_type { > + MLX5_TUNNEL_OFFLOAD_NONE =3D 0, > + MLX5_TUNNEL_OFFLOAD_SET_RULE, > + MLX5_TUNNEL_OFFLOAD_MATCH_RULE, > + MLX5_TUNNEL_OFFLOAD_MISS_RULE, > +}; > + > /** Device flow structure. */ > __extension__ > struct mlx5_flow { > @@ -854,6 +864,7 @@ struct mlx5_flow { > struct mlx5_flow_handle *handle; > uint32_t handle_idx; /* Index of the mlx5 flow handle memory. */ > const struct mlx5_flow_tunnel *tunnel; > + enum mlx5_tof_rule_type tof_type; > }; >=20 > /* Flow meter state. */ > @@ -949,10 +960,10 @@ mlx5_tunnel_hub(struct rte_eth_dev *dev) } >=20 > static inline bool > -is_tunnel_offload_active(struct rte_eth_dev *dev) > +is_tunnel_offload_active(const struct rte_eth_dev *dev) > { > #ifdef HAVE_IBV_FLOW_DV_SUPPORT > - struct mlx5_priv *priv =3D dev->data->dev_private; > + const struct mlx5_priv *priv =3D dev->data->dev_private; > return !!priv->config.dv_miss_info; > #else > RTE_SET_USED(dev); > @@ -961,23 +972,15 @@ is_tunnel_offload_active(struct rte_eth_dev > *dev) } >=20 > static inline bool > -is_flow_tunnel_match_rule(__rte_unused struct rte_eth_dev *dev, > - __rte_unused const struct rte_flow_attr *attr, > - __rte_unused const struct rte_flow_item items[], > - __rte_unused const struct rte_flow_action > actions[]) > +is_flow_tunnel_match_rule(enum mlx5_tof_rule_type tof_rule_type) > { > - return (items[0].type =3D=3D (typeof(items[0].type)) > - MLX5_RTE_FLOW_ITEM_TYPE_TUNNEL); > + return tof_rule_type =3D=3D MLX5_TUNNEL_OFFLOAD_MATCH_RULE; > } >=20 > static inline bool > -is_flow_tunnel_steer_rule(__rte_unused struct rte_eth_dev *dev, > - __rte_unused const struct rte_flow_attr *attr, > - __rte_unused const struct rte_flow_item items[], > - __rte_unused const struct rte_flow_action > actions[]) > +is_flow_tunnel_steer_rule(enum mlx5_tof_rule_type tof_rule_type) > { > - return (actions[0].type =3D=3D (typeof(actions[0].type)) > - > MLX5_RTE_FLOW_ACTION_TYPE_TUNNEL_SET); > + return tof_rule_type =3D=3D MLX5_TUNNEL_OFFLOAD_SET_RULE; > } >=20 > static inline const struct mlx5_flow_tunnel * @@ -1273,11 +1276,10 @@ > struct flow_grp_info { >=20 > static inline bool > tunnel_use_standard_attr_group_translate > - (struct rte_eth_dev *dev, > - const struct mlx5_flow_tunnel *tunnel, > + (const struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, > - const struct rte_flow_item items[], > - const struct rte_flow_action actions[]) > + const struct mlx5_flow_tunnel *tunnel, > + enum mlx5_tof_rule_type tof_rule_type) > { > bool verdict; >=20 > @@ -1293,7 +1295,7 @@ tunnel_use_standard_attr_group_translate > * method > */ > verdict =3D !attr->group && > - is_flow_tunnel_steer_rule(dev, attr, items, > actions); > + is_flow_tunnel_steer_rule(tof_rule_type); > } else { > /* > * non-tunnel group translation uses standard method for > @@ -1681,4 +1683,10 @@ int mlx5_flow_create_def_policy(struct > rte_eth_dev *dev); void mlx5_flow_destroy_def_policy(struct rte_eth_dev > *dev); void flow_drv_rxq_flags_set(struct rte_eth_dev *dev, > struct mlx5_flow_handle *dev_handle); > +const struct mlx5_flow_tunnel * > +mlx5_get_tof(const struct rte_flow_item *items, > + const struct rte_flow_action *actions, > + enum mlx5_tof_rule_type *rule_type); > + > + > #endif /* RTE_PMD_MLX5_FLOW_H_ */ > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index 70e8d0b113..10ca342edc > 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -6627,10 +6627,12 @@ flow_dv_validate(struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, > uint32_t rw_act_num =3D 0; > uint64_t is_root; > const struct mlx5_flow_tunnel *tunnel; > + enum mlx5_tof_rule_type tof_rule_type; > struct flow_grp_info grp_info =3D { > .external =3D !!external, > .transfer =3D !!attr->transfer, > .fdb_def_rule =3D !!priv->fdb_def_rule, > + .std_tbl_fix =3D true, > }; > const struct rte_eth_hairpin_conf *conf; > const struct rte_flow_item *rule_items =3D items; @@ -6638,23 > +6640,22 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct > rte_flow_attr *attr, >=20 > if (items =3D=3D NULL) > return -1; > - if (is_flow_tunnel_match_rule(dev, attr, items, actions)) { > - tunnel =3D flow_items_to_tunnel(items); > - action_flags |=3D MLX5_FLOW_ACTION_TUNNEL_MATCH | > - MLX5_FLOW_ACTION_DECAP; > - } else if (is_flow_tunnel_steer_rule(dev, attr, items, actions)) { > - tunnel =3D flow_actions_to_tunnel(actions); > - action_flags |=3D MLX5_FLOW_ACTION_TUNNEL_SET; > - } else { > - tunnel =3D NULL; > + tunnel =3D is_tunnel_offload_active(dev) ? > + mlx5_get_tof(items, actions, &tof_rule_type) : NULL; > + if (tunnel) { > + if (priv->representor) > + return rte_flow_error_set > + (error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, "decap not supported for VF > representor"); > + if (tof_rule_type =3D=3D MLX5_TUNNEL_OFFLOAD_SET_RULE) > + action_flags |=3D MLX5_FLOW_ACTION_TUNNEL_SET; > + else if (tof_rule_type =3D=3D > MLX5_TUNNEL_OFFLOAD_MATCH_RULE) > + action_flags |=3D > MLX5_FLOW_ACTION_TUNNEL_MATCH | > + MLX5_FLOW_ACTION_DECAP; > + grp_info.std_tbl_fix =3D > tunnel_use_standard_attr_group_translate > + (dev, attr, tunnel, tof_rule_type); > } > - if (tunnel && priv->representor) > - return rte_flow_error_set(error, ENOTSUP, > - > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > - "decap not supported " > - "for VF representor"); > - grp_info.std_tbl_fix =3D tunnel_use_standard_attr_group_translate > - (dev, tunnel, attr, items, actions); > ret =3D flow_dv_validate_attributes(dev, tunnel, attr, &grp_info, > error); > if (ret < 0) > return ret; > @@ -6668,15 +6669,6 @@ flow_dv_validate(struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, >=20 > RTE_FLOW_ERROR_TYPE_ITEM, > NULL, "item not > supported"); > switch (type) { > - case MLX5_RTE_FLOW_ITEM_TYPE_TUNNEL: > - if (items[0].type !=3D (typeof(items[0].type)) > - > MLX5_RTE_FLOW_ITEM_TYPE_TUNNEL) > - return rte_flow_error_set > - (error, EINVAL, > - > RTE_FLOW_ERROR_TYPE_ITEM, > - NULL, "MLX5 private items " > - "must be the first"); > - break; > case RTE_FLOW_ITEM_TYPE_VOID: > break; > case RTE_FLOW_ITEM_TYPE_PORT_ID: > @@ -6975,6 +6967,11 @@ flow_dv_validate(struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, > if (ret < 0) > return ret; > break; > + case MLX5_RTE_FLOW_ITEM_TYPE_TUNNEL: > + /* tunnel offload item was processed before > + * list it here as a supported type > + */ > + break; > default: > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ITEM, > @@ -7516,17 +7513,6 @@ flow_dv_validate(struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, > action_flags |=3D MLX5_FLOW_ACTION_SAMPLE; > ++actions_n; > break; > - case MLX5_RTE_FLOW_ACTION_TYPE_TUNNEL_SET: > - if (actions[0].type !=3D (typeof(actions[0].type)) > - > MLX5_RTE_FLOW_ACTION_TYPE_TUNNEL_SET) > - return rte_flow_error_set > - (error, EINVAL, > - > RTE_FLOW_ERROR_TYPE_ACTION, > - NULL, "MLX5 private action " > - "must be the first"); > - > - action_flags |=3D MLX5_FLOW_ACTION_TUNNEL_SET; > - break; > case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD: > ret =3D flow_dv_validate_action_modify_field(dev, >=20 > action_flags, > @@ -7551,6 +7537,11 @@ flow_dv_validate(struct rte_eth_dev *dev, > const struct rte_flow_attr *attr, > return ret; > action_flags |=3D MLX5_FLOW_ACTION_CT; > break; > + case MLX5_RTE_FLOW_ACTION_TYPE_TUNNEL_SET: > + /* tunnel offload action was processed before > + * list it here as a supported type > + */ > + break; > default: > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, > @@ -12035,13 +12026,14 @@ flow_dv_translate(struct rte_eth_dev *dev, > int tmp_actions_n =3D 0; > uint32_t table; > int ret =3D 0; > - const struct mlx5_flow_tunnel *tunnel; > + const struct mlx5_flow_tunnel *tunnel =3D NULL; > struct flow_grp_info grp_info =3D { > .external =3D !!dev_flow->external, > .transfer =3D !!attr->transfer, > .fdb_def_rule =3D !!priv->fdb_def_rule, > .skip_scale =3D dev_flow->skip_scale & > (1 << MLX5_SCALE_FLOW_GROUP_BIT), > + .std_tbl_fix =3D true, > }; > const struct rte_flow_item *head_item =3D items; >=20 > @@ -12057,15 +12049,21 @@ flow_dv_translate(struct rte_eth_dev *dev, >=20 > MLX5DV_FLOW_TABLE_TYPE_NIC_RX; > /* update normal path action resource into last index of array */ > sample_act =3D &mdest_res.sample_act[MLX5_MAX_DEST_NUM - > 1]; > - tunnel =3D is_flow_tunnel_match_rule(dev, attr, items, actions) ? > - flow_items_to_tunnel(items) : > - is_flow_tunnel_steer_rule(dev, attr, items, actions) ? > - flow_actions_to_tunnel(actions) : > - dev_flow->tunnel ? dev_flow->tunnel : NULL; > + if (is_tunnel_offload_active(dev)) { > + if (dev_flow->tunnel) { > + RTE_VERIFY(dev_flow->tof_type =3D=3D > + MLX5_TUNNEL_OFFLOAD_MISS_RULE); > + tunnel =3D dev_flow->tunnel; > + } else { > + tunnel =3D mlx5_get_tof(items, actions, > + &dev_flow->tof_type); > + dev_flow->tunnel =3D tunnel; > + } > + grp_info.std_tbl_fix =3D > tunnel_use_standard_attr_group_translate > + (dev, attr, tunnel, dev_flow- > >tof_type); > + } > mhdr_res->ft_type =3D attr->egress ? > MLX5DV_FLOW_TABLE_TYPE_NIC_TX : >=20 > MLX5DV_FLOW_TABLE_TYPE_NIC_RX; > - grp_info.std_tbl_fix =3D tunnel_use_standard_attr_group_translate > - (dev, tunnel, attr, items, actions); > ret =3D mlx5_flow_group_to_table(dev, tunnel, attr->group, &table, > &grp_info, error); > if (ret) > @@ -12075,7 +12073,7 @@ flow_dv_translate(struct rte_eth_dev *dev, > mhdr_res->ft_type =3D MLX5DV_FLOW_TABLE_TYPE_FDB; > /* number of actions must be set to 0 in case of dirty stack. */ > mhdr_res->actions_num =3D 0; > - if (is_flow_tunnel_match_rule(dev, attr, items, actions)) { > + if (is_flow_tunnel_match_rule(dev_flow->tof_type)) { > /* > * do not add decap action if match rule drops packet > * HW rejects rules with decap & drop > -- > 2.31.1