From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10086.outbound.protection.outlook.com [40.107.1.86]) by dpdk.org (Postfix) with ESMTP id 0B87E324D for ; Thu, 1 Nov 2018 09:22:58 +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=spgQsD4jQRI8xDPPOQXCrFqbWJCHkFcTc762iMfAo90=; b=A7R/h4u9xC7Z5LXFHTO8JQo3cCdAPjc5OsANH7+20Djuqo5knZd/9k51un3JOA9SrqWuEsIqDWw4yCbEeu7y+C/1aPMkBkhZqB4RarDC2h7tlqxId3kkr80fVeTk51ai8yDXOSqixORaQ6NX5VqJ56YYFes/9Tao+98NpofP1sg= Received: from VI1PR05MB4224.eurprd05.prod.outlook.com (52.133.12.13) by VI1PR05MB1310.eurprd05.prod.outlook.com (10.162.122.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Thu, 1 Nov 2018 08:22:52 +0000 Received: from VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::345d:803:9e2:679c]) by VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::345d:803:9e2:679c%4]) with mapi id 15.20.1294.024; Thu, 1 Nov 2018 08:22:52 +0000 From: Dekel Peled To: Shahaf Shuler , Yongseok Koh CC: "dev@dpdk.org" , Ori Kam Thread-Topic: [PATCH v7 2/7] net/mlx5: add VXLAN encap action to Direct Verbs Thread-Index: AQHUcSvG5X5dwmGadUCnFv+xCyzsx6U6g4rw Date: Thu, 1 Nov 2018 08:22:51 +0000 Message-ID: References: <1540498108-18358-1-git-send-email-dekelp@mellanox.com> <1540969847-48919-3-git-send-email-dekelp@mellanox.com> In-Reply-To: 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=dekelp@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB1310; 6:vqZqN3ivXPsTWmeI7qexxb44iqcgs8xTRrC5B+JoiULepqi0fp64W7qV88vHusxDPSIZeuuT8C2NPJ94WjVhVW/lELj/EP9ttWmxZMCbRGHMnZmQnrOlgSAmhGyhBBoUvO2WySrCqRrPj+rwrtV/z9ZzlrnS5weCCb2Cyc1atU9uQVGMULrkuKpJxT0Ho3ewoWMJJ4d2rlZNZaDIkM5JHH+0OTNslv45f+Tdq8ofIawxy4Wos8xvI1KzG+LIVbfGPX/y4DUmOQjBKPJswPUXuzYbyl3mYcgxO6hJcbmB8BzajhX9F2M5r8FkWJ4fez3uLJ+XZRVNyvP9uh0ksRYxPhmbi9XQu2+57zNLU6LEDwJgLKAH74PJJYEgMZDlkQOtLErZMM1cIuzX7YBgP//HvtHWy8E3xN6iRWtldA/djdl+ieACOfOF7xmWdrIY+IW89urw/MudE+jiPh1Q8QlenQ==; 5:y1MYIGWjtR8q5JgXfQisGpp74JaP3LEgpwxDlzlH/7emZ3QanVEn9oQUz9pjlsdG9VuB83w1udztFGZDjFHYMgK0nEEW+ILj2ogwV13l7XF7XsjcaPgTnJfDVg1PAhlSoy18g7YU0g2WftKZ7cWwKcQhLpXTXBsqiZf4VQCkMyA=; 7:QKx4X9xxX4BDPaOus4c6o0CEp7HN2Kuh0UAGjQiTQLnKnkjTsT7m56zvmQkdN/8er+qOSYnGO+BDRmEqcZpg5RiapQOd5cMl7f1hs2I3OIOcr8BkTXpSqkIz8aB9L66AEP48I4LnbOdfR0Q9AvEyzQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 466a23b4-f425-4eab-dd05-08d63fd33782 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB1310; x-ms-traffictypediagnostic: VI1PR05MB1310: 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)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:VI1PR05MB1310; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB1310; x-forefront-prvs: 0843C17679 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(136003)(366004)(39860400002)(13464003)(189003)(199004)(55016002)(14454004)(66066001)(25786009)(68736007)(2906002)(478600001)(53946003)(316002)(110136005)(5660300001)(9686003)(54906003)(99286004)(6506007)(53546011)(86362001)(4326008)(76176011)(7696005)(6436002)(2900100001)(229853002)(97736004)(33656002)(102836004)(6636002)(575784001)(6116002)(105586002)(4744004)(3846002)(71200400001)(71190400001)(106356001)(5250100002)(486006)(476003)(81166006)(81156014)(8676002)(7736002)(446003)(11346002)(6246003)(26005)(305945005)(8936002)(74316002)(53936002)(107886003)(186003)(256004)(14444005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB1310; H:VI1PR05MB4224.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: QI/RhFJq3pdloTZ35bsGSPEvlYg+48/rRyI860RrKNIenry79MXy86vRBATz0jamhzfEVdcawAhDZy0wsAZSuxlwVTTbZ6KkNGlhCr9T47AdvaurY66Glws4BY0v8XhREYfkm05sF7BXiuT41f5HkGe6WMyzpe+fhkROBlGJjh06LBSGSDW2vCcedF/i+a1UuaC0LvED3NGkP9PVpDZyYABBS3m9d5FM22LuvZBxUG7ZKs1T35VUmgZyEuyj3MFUsG93DKMygb4GmilC4zlF1TIt67q2nUZxv+PvcDh9swCedBDicdjYbG38k+eOg+oaFw2BfOKS7/gHtlNqO8I5YUvVJ7w67Y9PdeHRsfg+088= 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: 466a23b4-f425-4eab-dd05-08d63fd33782 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2018 08:22:52.0315 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB1310 Subject: Re: [dpdk-dev] [PATCH v7 2/7] net/mlx5: add VXLAN encap action to Direct Verbs 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: Thu, 01 Nov 2018 08:22:58 -0000 Thanks, PSB. > -----Original Message----- > From: Shahaf Shuler > Sent: Wednesday, October 31, 2018 5:10 PM > To: Dekel Peled ; Yongseok Koh > > Cc: dev@dpdk.org; Ori Kam > Subject: RE: [PATCH v7 2/7] net/mlx5: add VXLAN encap action to Direct > Verbs >=20 > Wednesday, October 31, 2018 9:11 AM, Dekel Peled: > > Subject: [PATCH v7 2/7] net/mlx5: add VXLAN encap action to Direct > > Verbs > > > > This patch implements the VXLAN encap action in DV flow for MLX5 PMD. > > > > Signed-off-by: Dekel Peled > > --- > > drivers/net/mlx5/mlx5_flow.h | 3 + > > drivers/net/mlx5/mlx5_flow_dv.c | 347 > > +++++++++++++++++++++++++++++++++++++++- > > 2 files changed, 345 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5_flow.h > > b/drivers/net/mlx5/mlx5_flow.h index 61299d6..286d7bb 100644 > > --- a/drivers/net/mlx5/mlx5_flow.h > > +++ b/drivers/net/mlx5/mlx5_flow.h > > @@ -92,6 +92,7 @@ > > #define MLX5_FLOW_ACTION_DEC_TTL (1u << 19) #define > > MLX5_FLOW_ACTION_SET_MAC_SRC (1u << 20) #define > > MLX5_FLOW_ACTION_SET_MAC_DST (1u << 21) > > +#define MLX5_FLOW_ACTION_VXLAN_ENCAP (1u << 22) > > > > #define MLX5_FLOW_FATE_ACTIONS \ > > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | > > MLX5_FLOW_ACTION_RSS) @@ -181,6 +182,8 @@ struct mlx5_flow_dv { > #ifdef > > HAVE_IBV_FLOW_DV_SUPPORT > > struct mlx5dv_flow_action_attr > > actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS]; > > /**< Action list. */ > > + struct ibv_flow_action *encap_decap_verbs_action; > > + /**< Verbs encap/decap object. */ > > #endif > > int actions_n; /**< number of actions. */ }; diff --git > > a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c > > index 8f729f4..1f9a842 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -34,6 +34,8 @@ > > > > #ifdef HAVE_IBV_FLOW_DV_SUPPORT > > > > +#define MLX5_ENCAP_MAX_LEN 132 > > + > > /** > > * Validate META item. > > * > > @@ -96,6 +98,303 @@ > > } > > > > /** > > + * Validate the L2 encap action. > > + * > > + * @param[in] action_flags > > + * Holds the actions detected until now. > > + * @param[in] action > > + * Pointer to the encap action. > > + * @param[in] attr > > + * Pointer to flow attributes > > + * @param[out] error > > + * Pointer to error structure. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > + */ > > +static int > > +flow_dv_validate_action_l2_encap(uint64_t action_flags, > > + const struct rte_flow_action *action, > > + const struct rte_flow_attr *attr, > > + struct rte_flow_error *error) > > +{ > > + if (!(action->conf)) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > action, > > + "configuration cannot be null"); > > + if (action_flags & MLX5_FLOW_ACTION_DROP) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > NULL, > > + "can't drop and encap in same > > flow"); > > + if (action_flags & MLX5_FLOW_ACTION_VXLAN_ENCAP) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > NULL, > > + "can only have a single encap" > > + " action in a flow"); > > + if (attr->ingress) > > + return rte_flow_error_set(error, ENOTSUP, > > + > > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > + NULL, > > + "encap action not supported for " > > + "ingress"); > > + return 0; > > +} > > + > > +/** > > + * Get the size of specific rte_flow_item_type > > + * > > + * @param[in] item_type > > + * Tested rte_flow_item_type. > > + * > > + * @return > > + * sizeof struct item_type, 0 if void or irrelevant. > > + */ > > +static size_t > > +flow_dv_get_item_len(const enum rte_flow_item_type item_type) { > > + size_t retval; > > + > > + switch (item_type) { > > + case RTE_FLOW_ITEM_TYPE_ETH: > > + retval =3D sizeof(struct rte_flow_item_eth); > > + break; > > + case RTE_FLOW_ITEM_TYPE_VLAN: > > + retval =3D sizeof(struct rte_flow_item_vlan); > > + break; > > + case RTE_FLOW_ITEM_TYPE_IPV4: > > + retval =3D sizeof(struct rte_flow_item_ipv4); > > + break; > > + case RTE_FLOW_ITEM_TYPE_IPV6: > > + retval =3D sizeof(struct rte_flow_item_ipv6); > > + break; > > + case RTE_FLOW_ITEM_TYPE_UDP: > > + retval =3D sizeof(struct rte_flow_item_udp); > > + break; > > + case RTE_FLOW_ITEM_TYPE_TCP: > > + retval =3D sizeof(struct rte_flow_item_tcp); > > + break; > > + case RTE_FLOW_ITEM_TYPE_VXLAN: > > + retval =3D sizeof(struct rte_flow_item_vxlan); > > + break; > > + case RTE_FLOW_ITEM_TYPE_GRE: > > + retval =3D sizeof(struct rte_flow_item_gre); > > + break; > > + case RTE_FLOW_ITEM_TYPE_NVGRE: > > + retval =3D sizeof(struct rte_flow_item_nvgre); > > + break; > > + case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: > > + retval =3D sizeof(struct rte_flow_item_vxlan_gpe); > > + break; > > + case RTE_FLOW_ITEM_TYPE_MPLS: > > + retval =3D sizeof(struct rte_flow_item_mpls); > > + break; > > + case RTE_FLOW_ITEM_TYPE_VOID: /* Fall through. */ > > + default: > > + retval =3D 0; > > + break; > > + } > > + return retval; > > +}; > > + > > +#define MLX5_IPV4_VERSION 0x40 > > +#define MLX5_IPV4_IHL_MIN 0x05 > > +#define MLX5_IPV4_TTL_DEF 0x40 > > +#define MLX5_IPV6_VTC_FLOW 0x60000000 > > +#define MLX5_IPV6_HOP_LIMIT 0xff > > +#define MLX5_VXLAN_FLAGS 0x08000000 > > +#define MLX5_VXLAN_GPE_FLAGS 0x0c000003 >=20 > Better to prefix them all w/ MLX5_ENCAP_* Will change. >=20 > > + > > +/** > > + * Convert the encap action data from list of rte_flow_item to raw > > +buffer > > + * > > + * @param[in] items > > + * Pointer to rte_flow_item objects list. > > + * @param[out] buf > > + * Pointer to the output buffer. > > + * @param[out] size > > + * Pointer to the output buffer size. > > + * @param[out] error > > + * Pointer to the error structure. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > + */ > > +static int > > +flow_dv_convert_encap_data(const struct rte_flow_item *item, uint8_t >=20 > Here it is also items Will change. >=20 > > *buf, > > + size_t *size, struct rte_flow_error *error) { > > + struct ether_hdr *eth =3D NULL; > > + struct vlan_hdr *vlan =3D NULL; > > + struct ipv4_hdr *ipv4 =3D NULL; > > + struct ipv6_hdr *ipv6 =3D NULL; > > + struct udp_hdr *udp =3D NULL; > > + struct vxlan_hdr *vxlan =3D NULL; > > + size_t len; > > + size_t temp_size =3D 0; > > + > > + if (!item) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, "invalid empty data"); > > + for (; item->type !=3D RTE_FLOW_ITEM_TYPE_END; item++) { > > + len =3D flow_dv_get_item_len(item->type); > > + if (len + temp_size > MLX5_ENCAP_MAX_LEN) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "items total size is too big" > > + " for encap action"); > > + rte_memcpy((void *)&buf[temp_size], item->spec, len); > > + switch (item->type) { > > + case RTE_FLOW_ITEM_TYPE_ETH: > > + eth =3D (struct ether_hdr *)&buf[temp_size]; > > + break; > > + case RTE_FLOW_ITEM_TYPE_VLAN: > > + vlan =3D (struct vlan_hdr *)&buf[temp_size]; > > + if (!eth) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "eth header not found"); > > + if (!eth->ether_type) > > + eth->ether_type =3D > > RTE_BE16(ETHER_TYPE_VLAN); > > + break; > > + case RTE_FLOW_ITEM_TYPE_IPV4: > > + ipv4 =3D (struct ipv4_hdr *)&buf[temp_size]; > > + if (!vlan && !eth) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "neither eth nor vlan" > > + " header found"); > > + if (vlan && !vlan->eth_proto) > > + vlan->eth_proto =3D > > RTE_BE16(ETHER_TYPE_IPv4); > > + else if (eth && !eth->ether_type) > > + eth->ether_type =3D > > RTE_BE16(ETHER_TYPE_IPv4); > > + if (!ipv4->version_ihl) > > + ipv4->version_ihl =3D MLX5_IPV4_VERSION | > > + MLX5_IPV4_IHL_MIN; > > + if (!ipv4->time_to_live) > > + ipv4->time_to_live =3D MLX5_IPV4_TTL_DEF; > > + break; > > + case RTE_FLOW_ITEM_TYPE_IPV6: > > + ipv6 =3D (struct ipv6_hdr *)&buf[temp_size]; > > + if (!vlan && !eth) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "neither eth nor vlan" > > + " header found"); > > + if (vlan && !vlan->eth_proto) > > + vlan->eth_proto =3D > > RTE_BE16(ETHER_TYPE_IPv6); > > + else if (eth && !eth->ether_type) > > + eth->ether_type =3D > > RTE_BE16(ETHER_TYPE_IPv6); > > + if (!ipv6->vtc_flow) > > + ipv6->vtc_flow =3D > > RTE_BE32(MLX5_IPV6_VTC_FLOW); > > + if (!ipv6->hop_limits) > > + ipv6->hop_limits =3D MLX5_IPV6_HOP_LIMIT; > > + break; > > + case RTE_FLOW_ITEM_TYPE_UDP: > > + udp =3D (struct udp_hdr *)&buf[temp_size]; > > + if (!ipv4 && !ipv6) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "ip header not found"); > > + if (ipv4 && !ipv4->next_proto_id) > > + ipv4->next_proto_id =3D IPPROTO_UDP; > > + else if (ipv6 && !ipv6->proto) > > + ipv6->proto =3D IPPROTO_UDP; >=20 > This is not what I meant. I meant to check the vxlan GPE next protocol. T= his > one must be set by the App Will change. >=20 > > + break; > > + case RTE_FLOW_ITEM_TYPE_VXLAN: > > + vxlan =3D (struct vxlan_hdr *)&buf[temp_size]; > > + if (!udp) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "udp header not found"); > > + if (!udp->dst_port) > > + udp->dst_port =3D > > RTE_BE16(MLX5_UDP_PORT_VXLAN); > > + if (!vxlan->vx_flags) > > + vxlan->vx_flags =3D > > RTE_BE32(MLX5_VXLAN_FLAGS); > > + break; > > + case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: > > + vxlan =3D (struct vxlan_hdr *)&buf[temp_size]; > > + if (!udp) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "udp header not found"); > > + if ((ipv4 && !ipv4->next_proto_id) || > > + (ipv6 && !ipv6->proto)) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "next protocol not found"); > > + if (!udp->dst_port) > > + udp->dst_port =3D > > + > > RTE_BE16(MLX5_UDP_PORT_VXLAN_GPE); > > + if (!vxlan->vx_flags) > > + vxlan->vx_flags =3D > > + > > RTE_BE32(MLX5_VXLAN_GPE_FLAGS); > > + break; > > + case RTE_FLOW_ITEM_TYPE_VOID: > > + break; > > + default: > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + (void *)item->type, > > + "unsupported item type"); > > + break; > > + } > > + temp_size +=3D len; > > + } > > + *size =3D temp_size; > > + return 0; > > +} > > + > > +/** > > + * Convert L2 encap action to DV specification. > > + * > > + * @param[in] dev > > + * Pointer to rte_eth_dev structure. > > + * @param[in] action > > + * Pointer to action structure. > > + * @param[out] error > > + * Pointer to the error structure. > > + * > > + * @return > > + * Pointer to action on success, NULL otherwise and rte_errno is set= . > > + */ > > +static struct ibv_flow_action * > > +flow_dv_create_action_l2_encap(struct rte_eth_dev *dev, > > + const struct rte_flow_action *action, > > + struct rte_flow_error *error) { > > + struct ibv_flow_action *verbs_action =3D NULL; > > + const struct rte_flow_item *encap_data; > > + struct priv *priv =3D dev->data->dev_private; > > + uint8_t buf[MLX5_ENCAP_MAX_LEN]; > > + size_t size =3D 0; > > + int convert_result =3D 0; > > + > > + encap_data =3D ((const struct rte_flow_action_vxlan_encap *) > > + action->conf)->definition; > > + convert_result =3D flow_dv_convert_encap_data(encap_data, buf, > > + &size, error); > > + if (convert_result) > > + return NULL; > > + verbs_action =3D mlx5_glue- > > >dv_create_flow_action_packet_reformat > > + (priv->ctx, size, buf, > > + > > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TO_L2_TUNNEL, > > + MLX5DV_FLOW_TABLE_TYPE_NIC_TX); > > + if (!verbs_action) > > + rte_flow_error_set(error, EINVAL, > > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, "cannot create L2 encap action"); > > + return verbs_action; > > +} > > + > > +/** > > * Verify the @p attributes will be correctly understood by the NIC an= d > store > > * them in the @p flow if everything is correct. > > * > > @@ -339,6 +638,16 @@ > > action_flags |=3D MLX5_FLOW_ACTION_COUNT; > > ++actions_n; > > break; > > + case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > > + ret =3D > > flow_dv_validate_action_l2_encap(action_flags, > > + actions, attr, > > + error); > > + if (ret < 0) > > + return ret; > > + action_flags |=3D > > MLX5_FLOW_ACTION_VXLAN_ENCAP; > > + ++actions_n; > > + break; > > + > > default: > > return rte_flow_error_set(error, ENOTSUP, > > > > RTE_FLOW_ERROR_TYPE_ACTION, > > @@ -1045,14 +1354,23 @@ > > /** > > * Store the requested actions in an array. > > * > > + * @param[in] dev > > + * Pointer to rte_eth_dev structure. > > * @param[in] action > > * Flow action to translate. > > * @param[in, out] dev_flow > > * Pointer to the mlx5_flow. > > + * @param[out] error > > + * Pointer to the error structure. > > + * > > + * @return > > + * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > */ > > -static void > > -flow_dv_create_action(const struct rte_flow_action *action, > > - struct mlx5_flow *dev_flow) > > +static int > > +flow_dv_create_action(struct rte_eth_dev *dev, > > + const struct rte_flow_action *action, > > + struct mlx5_flow *dev_flow, > > + struct rte_flow_error *error) > > { > > const struct rte_flow_action_queue *queue; > > const struct rte_flow_action_rss *rss; @@ -1100,10 +1418,24 @@ > > /* Added to array only in apply since we need the QP */ > > flow->actions |=3D MLX5_FLOW_ACTION_RSS; > > break; > > + case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > > + dev_flow->dv.actions[actions_n].type =3D > > + MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; > > + dev_flow->dv.actions[actions_n].action =3D > > + flow_dv_create_action_l2_encap(dev, > > action, > > + error); > > + if (!(dev_flow->dv.actions[actions_n].action)) > > + return -rte_errno; > > + dev_flow->dv.encap_decap_verbs_action =3D > > + dev_flow->dv.actions[actions_n].action; > > + flow->actions |=3D MLX5_FLOW_ACTION_VXLAN_ENCAP; > > + actions_n++; > > + break; > > default: > > break; > > } > > dev_flow->dv.actions_n =3D actions_n; > > + return 0; > > } > > > > static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] =3D { 0 }= ; > > @@ -1217,7 +1549,6 @@ > > return 0; > > } > > > > - > > /** > > * Fill the flow with DV spec. > > * > > @@ -1272,7 +1603,8 @@ > > if (flow_dv_matcher_register(dev, &matcher, dev_flow, error)) > > return -rte_errno; > > for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) > > - flow_dv_create_action(actions, dev_flow); > > + if (flow_dv_create_action(dev, actions, dev_flow, error)) > > + return -rte_errno; > > return 0; > > } > > > > @@ -1457,6 +1789,11 @@ > > LIST_REMOVE(dev_flow, next); > > if (dev_flow->dv.matcher) > > flow_dv_matcher_release(dev, dev_flow); > > + if (dev_flow->dv.encap_decap_verbs_action) { > > + claim_zero(mlx5_glue->destroy_flow_action > > + (dev_flow->dv.encap_decap_verbs_action)); > > + dev_flow->dv.encap_decap_verbs_action =3D NULL; > > + } > > rte_free(dev_flow); > > } > > } > > -- > > 1.8.3.1