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 AD3B8A0350; Wed, 1 Jul 2020 17:06:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1E17F1D172; Wed, 1 Jul 2020 17:06:30 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2070.outbound.protection.outlook.com [40.107.21.70]) by dpdk.org (Postfix) with ESMTP id A13C81C1BB for ; Wed, 1 Jul 2020 17:06:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O1TPEztYaAb2RyEXVbcAPNDW8IP6JFc9bSMsfcXWQVGfvr64eVuYw8fCAVoWbYDWZcpjVjdugpvifcwmdFobw8k+K62UsnJhFmv0dY4J964y26bzI3g19UtHvsuZU2BY1/JFv3iD9QZdOIe0ZtjtwIQKyqL85/lQEInwSF+ASCjWgCea6h/qY6P+SbaPzfq1fAXqLCaRgx5TUtpCKRpKkAmeBfq8iKojaNszCRptBIdf7JJfb4tM2MvVSVOkq/aqdDhIUbxbBs650xqm43OH86KYdBXQAJfTfqwZj4+FPPzOLk0mzj3HzlupiHO+0W5tfzBe3a9xn0G1uy8nO+Y5dg== 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=0Rhvemjbj+Spv9ohMUXOgiUgAeqxnogrZ0OvTrfu1iI=; b=RvovYgoIJyBMLRfKFMatsCBPft1VTjaZpXOvbGe2NxKp7eQwOJEVz2PVPNmaW9FJL7xFADM8K6KmYlvIlDy2ypXtdWe+bz9LwS8Kv47zVZRddKxjSL4D91X0A/J9fVYwuQa0/VML5blXt5ddPtjA55mBDync4UsiZFGPBSR2RuLGRyAoBbZKKZn8MDHxS/UdMdfH2wUweXblQlLdEmfisgN0BJH0EbcT8iqa3xNHU7fd2zXFMpCkuRuAOqjXYgMqKIjcHEEWoAMHEqDainQrTN9Adb/vQmmV6iJ72bR9kpNokUsPmKXtrXDLZRmatnhvqEVWi20Arj7Aem/goKdHbg== 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=0Rhvemjbj+Spv9ohMUXOgiUgAeqxnogrZ0OvTrfu1iI=; b=XNq41XdOQsXNqfw2k/C7S1vuxn8Jk7YzW+xL+L9a28ZEptNXbc6q2Q5fRFtXQI2tMPnLWz1LUJgmKSdwCS7ckN2CecAf1ZTkmxo8L8No602ft2FV73kXoeJAgsoY3zuUlNklbaujBDAFyiQpZC0k4iOGp0YvwsTUKjFVN5xtLqQ= Received: from VI1PR05MB3133.eurprd05.prod.outlook.com (2603:10a6:802:19::14) by VI1PR05MB5469.eurprd05.prod.outlook.com (2603:10a6:803:8d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.26; Wed, 1 Jul 2020 15:06:25 +0000 Received: from VI1PR05MB3133.eurprd05.prod.outlook.com ([fe80::f042:8394:8c25:a10b]) by VI1PR05MB3133.eurprd05.prod.outlook.com ([fe80::f042:8394:8c25:a10b%3]) with mapi id 15.20.3153.022; Wed, 1 Jul 2020 15:06:25 +0000 From: "Jiawei(Jonny) Wang" To: Ori Kam , Slava Ovsiienko , Matan Azrad CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh , "ian.stokes@intel.com" , "fbl@redhat.com" Thread-Topic: [PATCH 6/8] net/mlx5: update translate function for sample action Thread-Index: AQHWSxDDa7C620/HwUKOX2X5QxdomqjxmmkAgAE80CA= Date: Wed, 1 Jul 2020 15:06:25 +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: 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: [27.38.113.38] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 273ab6f5-ecf3-439b-8969-08d81dd05329 x-ms-traffictypediagnostic: VI1PR05MB5469: 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:6790; x-forefront-prvs: 04519BA941 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CCL0xjDQE0pTpcs9+cPciK/cnwq1Swj4PBYqPvksWgU1OObIGEKWKZrE3vqpz0YjU4e3im0KsT1szbvKbpbZ8hQW0sbuI+6daeOZUdQduIqJuOerMnCZzQ0vw/MZ9rOhc2G4IUColwqSJf6HgzETmQ5S0NxG2e2gAyheImxJ/3cu6stwrtXQxHq5rjgDjMIsa1t/nrjfJv4wEJF8sTBqXeDeSqyUAcLMy9ydldRIbnbkR+bwvTGvXsUQ5JEcZ368CWPfbZrdSjWfNeC53iqdJ2aQPMcNaMaaDIH5NPyWvHw5hI6HZTQDhjqYp9o2YBfpYLTz6JQoEf68AdkpJx/tGA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB3133.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(39860400002)(346002)(136003)(396003)(366004)(26005)(6636002)(8676002)(55016002)(76116006)(5660300002)(7696005)(15650500001)(478600001)(9686003)(6506007)(8936002)(4326008)(71200400001)(316002)(186003)(83380400001)(110136005)(66446008)(2906002)(66946007)(66556008)(64756008)(53546011)(86362001)(52536014)(33656002)(54906003)(66476007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: hysBAbcGB3YEv/A22OH0JVPaC3+40TLde1tzTSx095PdkmeNWyybdzNAa578dm0CKATGlzgnVLSZpK4q0zUwlVPY7lVKUSbeFWZXTxAdtu8Y9pbekJExOAgFSzIjBlHZm6PpdtI2yvL18EPMICeIDchnz/ZfbD8/2lz/r2z/bykLF4vHNzjp2j/yMfDMlhD/9fn/pVYzefYv6HxnC4zBimMEYYIW5Bay0Mes3VfIj7NxKNmRj5dEDEpSmrq2+P85oTAa+FyrQqkGv34r0eLhEdmKzSnM9zPwvgsBlu1wYA9zGkNcLz/ns1jUE0vBU0t0iN2dAZPc+y7zwHRNMnaBkdMXXJ3Gh02EZE14h1yerfi7gtnDntcMmYQxNusSbrjVyfwM4s1tJ7hPZ6wiUeQrBPbEQvpeNXq2Maeswo+7e8v6ss0BSVRluT9qVBvDpqv7lp2S/TIRUplDq7jI0xdybV8ZPnffa8KWvOIdGk4tkQo= 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: VI1PR05MB3133.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 273ab6f5-ecf3-439b-8969-08d81dd05329 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2020 15:06:25.6670 (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: tevrjPU3L7VXg3s54TTxprsTgi025T78eNcgTyY97c5tlPbEgTjfYQ3QlBsMfL4Iz4grIw2gvSxrW4IBKe+Hlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5469 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" > -----Original Message----- > From: Ori Kam > Sent: Wednesday, July 1, 2020 3:55 AM > 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 > Subject: RE: [PATCH 6/8] net/mlx5: update translate function for sample > action >=20 > Hi Jiawei, > PSB, >=20 > Thanks, > Ori >=20 > > -----Original Message----- > > From: Jiawei Wang > > Sent: Thursday, June 25, 2020 7:26 PM > > Subject: [PATCH 6/8] net/mlx5: update translate function for sample > > action > > > > Translate the attribute of sample action that include sample ratio and > > sub actions list, then create the sample DR action. > > > > 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(-) > > > > 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; > > > > - 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, > > }; > > > > +/* > > + * 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 > > > > -/* > > - * 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); > > > > +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 { } > > > > /** > > + * 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 >=20 > I think this is only used as out. >=20 right, will change it. > > + * Hash Rx queue index. > > + * @param[out] error > > + * Pointer to error structure. > > + * > > + * @return > > + * The Verbs/DevX object initialised, NULL otherwise and rte_errno i= s 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); >=20 > Why do you need this line? You can compare the hrxq_idx to check for erro= r. >=20 Yes, we can check by *hrxq_idx=3D=3D0 for error, or return corresponding ha= sh rx queue object if no error. Thanks. =20 > > + 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; > > +} > > + >=20 >=20 > [snap...]