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 BC4D2A0522; Tue, 30 Jun 2020 21:54:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 05B861BED7; Tue, 30 Jun 2020 21:54:36 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130045.outbound.protection.outlook.com [40.107.13.45]) by dpdk.org (Postfix) with ESMTP id 6C9F82AB for ; Tue, 30 Jun 2020 21:54:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LBgMKZ0hn57FUNq2exb4uv6DGX2OFjFuW/dvzgCl3J0CkSM4eCoyxhqNv6vhvj5IEZgIcsYfyKf7SDfSqH0HQzJpkutNGId6GbwLIbKH0qqlj1WigcfeZTH4f35c9n2yDmi4U9yYe52LcaKEMvoJ1HJwA7ZqGKMTp78BRRzVN483QgzwcycekvjZgdJkBOb8NhVLmg5IcEI0tMT07pxjKxQg3YMSn5smqhd2Ba/z5E14XsfVtExvOyOSvPHpfba8ABkYKGXoZCx4qpPhk2iZtgPaQiYKy1zW8u+lTsZ+JvmJHy4ODgQLx64jHpJiVCEvSJTcW6Q9XtWe+xQ7iDZPcw== 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=hc/DZIDUKO2+Ls1e1ARA255kHTmfm6b+SD7GQwHCTZA=; b=W45zUKmhk3w4mZpiradp2dH612KPAOG0NlV7oWy9adpJtT6uEx9hfbUb82fVHGEl9caH4zBE4q3/sVLVjix25t/0xfzbSknqIL+UNAPHxUAaykdipzw3VEZnxdKmyKN+vEJ69uBkPYPH2Dh7eic8xfP1sD+yIh1qJAqSXEsO6de0jxIG/pfBSOL5HLm//KcQMAKe0BDcgS+N93Y8Gru2jAlaGZfSz0LAiuwTZyjJ36h5TF4q0ahL5YL8BszYYzKqjaWlHe+s7LGLfqgx8vFy8STn6D7AreToiCMtjXtgt7S2UfILdP8/m+LdrurCUiCLwpXE9wYgQRnUJprLeeH5Nw== 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=hc/DZIDUKO2+Ls1e1ARA255kHTmfm6b+SD7GQwHCTZA=; b=Vqa9TugsvXFncIEmDZXUx0mvqGO0yYFSxe9XvC2uVkmDh5mf0D+lfDQ9thgXMbeoOS5f2BOlsfycLPfYVdqCXTVyVssFTiOCL3bnLZRu9Y144FnSGjrrxvYU4/rlxZdultcs77IxjqM4GWh/QbCJdscIw3eQMjFhIKNzoqyw5KY= Received: from AM6PR05MB5176.eurprd05.prod.outlook.com (2603:10a6:20b:63::30) by AM6PR05MB5539.eurprd05.prod.outlook.com (2603:10a6:20b:5b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.23; Tue, 30 Jun 2020 19:54:33 +0000 Received: from AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::9024:accb:4d6b:805f]) by AM6PR05MB5176.eurprd05.prod.outlook.com ([fe80::9024:accb:4d6b:805f%3]) with mapi id 15.20.3131.027; Tue, 30 Jun 2020 19:54:33 +0000 From: Ori Kam To: "Jiawei(Jonny) Wang" , Slava Ovsiienko , Matan Azrad CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh , "ian.stokes@intel.com" , "fbl@redhat.com" , "Jiawei(Jonny) Wang" Thread-Topic: [PATCH 6/8] net/mlx5: update translate function for sample action Thread-Index: AQHWSxDD8zXCE+jV7EOd4ReTYoQr/Kjxkb3w Date: Tue, 30 Jun 2020 19:54:32 +0000 Message-ID: References: <1593102379-400132-1-git-send-email-jiaweiw@mellanox.com> <1593102379-400132-7-git-send-email-jiaweiw@mellanox.com> In-Reply-To: <1593102379-400132-7-git-send-email-jiaweiw@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [147.236.152.129] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 54c3fc77-88d3-4220-9a59-08d81d2f68c1 x-ms-traffictypediagnostic: AM6PR05MB5539: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0450A714CB x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pKF7kS57JGQk6wgy/KkqHHqoFVPeUz7UE3PIgv4kZ3WU1k1EQOmVDkY8JXycRpT1xp81mzzM8sp9pYjtxpfRukCeustpi4GnYj7ybQQvQ54cFztRRuKABi2ORskkHjMC/r6X7btdbJjJh2RD/Sy1zlGiFVyMXI3KeYIhIpEhcOcyUye2euzobI+r9JsNdfPOl8jEkiHqWguyUEcM7hFjohq5BXFwj4/hVLW98YEKOdOYck2+5ch7CbiI4KZsz7mZ8EwxKzwAgnBT/E4Zt+QetJHYIY8Zx2CIrOUbrB8lIxBgHS3kU/gbIWyw6vWY6gLN x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR05MB5176.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(366004)(136003)(346002)(376002)(71200400001)(66556008)(76116006)(66476007)(186003)(55016002)(107886003)(83380400001)(33656002)(66946007)(54906003)(110136005)(26005)(66446008)(64756008)(2906002)(9686003)(316002)(15650500001)(86362001)(7696005)(478600001)(4326008)(8676002)(53546011)(6506007)(52536014)(6636002)(8936002)(5660300002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: Rm41Ujs1Yy4wkhVcBUZydp27CMQEOO9Yl1/lRVu6GxMrZQ1tV2rug6iBJsnbu4QGWZGv82Nmr6+7aDusJ+gJa6GDRadDYhdoNiIpQHXseHICO5MNrcntW8UsGahxKcw+cimgeBjWIHwKcPzgbOZ1l8h6ijrIKoSVNvULcsQmRjHE05pHd1pP6BD5inmaTLxIi/Cgqd7ZsaFQR5fN/L1pRZfbDWU06NmWjV+KTuPF86mtjXT3YsY+xLD3ky3DSHjkxLIUdtnRIqYrC18zIPSe1Cn+0htguAM0QsH6ofh2VF8WLdNfsAfG7xGfn12HiQO7/rwsSBwBa3qAyyIbetB7wy0yr706NuznODYBd1zs44dPHZl5K5v7Q9yVbxVfXC2PaDBotyjNlAV3n/PI18nlVsJq5QvgXOjseMpVJ1QG14Jm0+m4hu46nRjFvv6+K2Rl7y6D8E9vK8vgEq9eNsV8Zgw7NoHeUnzj2WekWHW9KgDqnNzjfdJjf0s0V8nlklss Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM6PR05MB5176.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54c3fc77-88d3-4220-9a59-08d81d2f68c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jun 2020 19:54:33.0192 (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: 63ijnoe7bXopZeVC9IX76JuqG171fgOuzJgUjTD+PZgZ7ioCTCMYqx74DB1PFK+p916EHFgR6337SeaAvzgbRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5539 Subject: Re: [dpdk-dev] [PATCH 6/8] net/mlx5: update translate function for sample action 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Jiawei, PSB, Thanks, Ori > -----Original Message----- > From: Jiawei Wang > Sent: Thursday, June 25, 2020 7:26 PM > Subject: [PATCH 6/8] net/mlx5: update translate function for sample actio= n >=20 > Translate the attribute of sample action that include sample ratio > and sub actions list, then create the sample DR action. >=20 > Signed-off-by: Jiawei Wang > --- > drivers/net/mlx5/mlx5_flow.c | 16 +- > drivers/net/mlx5/mlx5_flow.h | 14 +- > drivers/net/mlx5/mlx5_flow_dv.c | 502 > +++++++++++++++++++++++++++++++++++++++- > 3 files changed, 511 insertions(+), 21 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 7c65a9a..73ef290 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -4569,10 +4569,14 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > int hairpin_flow; > uint32_t hairpin_id =3D 0; > struct rte_flow_attr attr_tx =3D { .priority =3D 0 }; > + struct rte_flow_attr attr_factor =3D {0}; > int ret; >=20 > - hairpin_flow =3D flow_check_hairpin_split(dev, attr, actions); > - ret =3D flow_drv_validate(dev, attr, items, p_actions_rx, > + memcpy((void *)&attr_factor, (const void *)attr, sizeof(*attr)); > + if (external) > + attr_factor.group *=3D MLX5_FLOW_TABLE_FACTOR; > + hairpin_flow =3D flow_check_hairpin_split(dev, &attr_factor, actions); > + ret =3D flow_drv_validate(dev, &attr_factor, items, p_actions_rx, > external, hairpin_flow, error); > if (ret < 0) > return 0; > @@ -4591,7 +4595,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > rte_errno =3D ENOMEM; > goto error_before_flow; > } > - flow->drv_type =3D flow_get_drv_type(dev, attr); > + flow->drv_type =3D flow_get_drv_type(dev, &attr_factor); > if (hairpin_id !=3D 0) > flow->hairpin_flow_id =3D hairpin_id; > MLX5_ASSERT(flow->drv_type > MLX5_FLOW_TYPE_MIN && > @@ -4637,7 +4641,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > * depending on configuration. In the simplest > * case it just creates unmodified original flow. > */ > - ret =3D flow_create_split_outer(dev, flow, attr, > + ret =3D flow_create_split_outer(dev, flow, &attr_factor, > buf->entry[i].pattern, > p_actions_rx, external, idx, > error); > @@ -4674,8 +4678,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > * the egress Flows belong to the different device and > * copy table should be updated in peer NIC Rx domain. > */ > - if (attr->ingress && > - (external || attr->group !=3D MLX5_FLOW_MREG_CP_TABLE_GROUP)) > { > + if (attr_factor.ingress && > + (external || attr_factor.group !=3D > MLX5_FLOW_MREG_CP_TABLE_GROUP)) { > ret =3D flow_mreg_update_copy_table(dev, flow, actions, error); > if (ret) > goto error; > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 941de5f..4163183 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -369,6 +369,13 @@ enum mlx5_flow_fate_type { > MLX5_FLOW_FATE_MAX, > }; >=20 > +/* > + * Max number of actions per DV flow. > + * See CREATE_FLOW_MAX_FLOW_ACTIONS_SUPPORTED > + * in rdma-core file providers/mlx5/verbs.c. > + */ > +#define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8 > + > /* Matcher PRM representation */ > struct mlx5_flow_dv_match_params { > size_t size; > @@ -599,13 +606,6 @@ struct mlx5_flow_handle { > #define MLX5_FLOW_HANDLE_VERBS_SIZE (sizeof(struct mlx5_flow_handle)) > #endif >=20 > -/* > - * Max number of actions per DV flow. > - * See CREATE_FLOW_MAX_FLOW_ACTIONS_SUPPORTED > - * in rdma-core file providers/mlx5/verbs.c. > - */ > -#define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8 > - > /** Device flow structure only for DV flow creation. */ > struct mlx5_flow_dv_workspace { > uint32_t group; /**< The group index. */ > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > index 710c0f3..62a4a3b 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -79,6 +79,10 @@ > flow_dv_tbl_resource_release(struct rte_eth_dev *dev, > struct mlx5_flow_tbl_resource *tbl); >=20 > +static int > +flow_dv_encap_decap_resource_release(struct rte_eth_dev *dev, > + uint32_t encap_decap_idx); > + > /** > * Initialize flow attributes structure according to flow items' types. > * > @@ -7897,6 +7901,385 @@ struct field_modify_info modify_tcp[] =3D { > } >=20 > /** > + * Create an Rx Hash queue. > + * > + * @param dev > + * Pointer to Ethernet device. > + * @param[in] dev_flow > + * Pointer to the mlx5_flow. > + * @param[in] rss_desc > + * Pointer to the mlx5_flow_rss_desc. > + * @param[in, out] hrxq_idx I think this is only used as out. > + * Hash Rx queue index. > + * @param[out] error > + * Pointer to error structure. > + * > + * @return > + * The Verbs/DevX object initialised, NULL otherwise and rte_errno is = set. > + */ > +static struct mlx5_hrxq * > +flow_dv_handle_rx_queue(struct rte_eth_dev *dev, > + struct mlx5_flow *dev_flow, > + struct mlx5_flow_rss_desc *rss_desc, > + uint32_t *hrxq_idx, > + struct rte_flow_error *error) > +{ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct mlx5_flow_handle *dh =3D dev_flow->handle; > + struct mlx5_hrxq *hrxq; > + > + MLX5_ASSERT(rss_desc->queue_num); > + *hrxq_idx =3D mlx5_hrxq_get(dev, rss_desc->key, > + MLX5_RSS_HASH_KEY_LEN, > + dev_flow->hash_fields, > + rss_desc->queue, > + rss_desc->queue_num); > + if (!*hrxq_idx) { > + *hrxq_idx =3D mlx5_hrxq_new > + (dev, rss_desc->key, > + MLX5_RSS_HASH_KEY_LEN, > + dev_flow->hash_fields, > + rss_desc->queue, > + rss_desc->queue_num, > + !!(dh->layers & > + MLX5_FLOW_LAYER_TUNNEL)); > + } > + hrxq =3D mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_HRXQ], > + *hrxq_idx); Why do you need this line? You can compare the hrxq_idx to check for error. > + if (!hrxq) { > + rte_flow_error_set > + (error, rte_errno, > + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, > + "cannot get hash queue"); > + goto error; > + } > + dh->rix_hrxq =3D *hrxq_idx; > + return hrxq; > +error: > + /* hrxq is union, don't clear it if the flag is not set. */ > + if (dh->rix_hrxq) { > + mlx5_hrxq_release(dev, dh->rix_hrxq); > + dh->rix_hrxq =3D 0; > + } > + return NULL; > +} > + [snap...]