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 AB1A5A0555; Thu, 20 Feb 2020 04:54:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9BB751B951; Thu, 20 Feb 2020 04:54:29 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by dpdk.org (Postfix) with ESMTP id 6908E1B13C; Thu, 20 Feb 2020 04:54:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QGSpCp0xcw4ZEJoKt6208MEJ7nMNvN1nYENJ/ElitGTzNWOqRSvSh4u4cKt46Xv1Ax8wyY81fAnuuPTxhZyF9PgzF2OVu1EG/GnHTP5gYRHQ5iK7F32u0k3ztEo32YTU/ApDgUVSK8OtPgan3SP7FspVV/JaqjCOah/pMsybNhk+dB6vUhmTw7Q0dpfBKK+G+44lvPCLJWDtdtMAEYUtS9ztbi/pg+5KDNyDSpoaqYvnoKbgBGi9/Gpw0Pa5iik1GyAXW0FeO8kbigu8uE3V54EBrwwENJ1wd76x/oHddwU25ITngFyztBP/zrbHbJg2DY38mqS0NktZnLYeY7c1zg== 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=WlXJIQsdVujcrqpFKYuSGEJEIiEDNSJtw75pWBgLie4=; b=oG6F4zQSep2yqxmVbi/XyoLpf2iVGsQhRkbpera48DMyt2Q3Ier52Dj3j9HSadal+EYA2veCGa4Vp/8SbVHGtakjP/37NrEWuayP5ILeJ/yQ4L7Iwm/dhUnJ3xuB7et6V4+efcbHtDTNPBNIg2G3P2+ssWZjat2aH8nvANrYysG6+N/kGd14DQwQnXlxF3gj1y47txeGsDQAETCFvNbEBJHDhNTUEscLgDbwaoQuF6K4rEgIRSk8xllETPH5bot/Edo87o5QIfgi3PrWdzzCrOrVNcwZaV2rGnNzyxRafdPLIhHuEb5Y0xS+5kb+1zPOVGG7mwZVQM9/TH1VXxC1/Q== 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=WlXJIQsdVujcrqpFKYuSGEJEIiEDNSJtw75pWBgLie4=; b=WODJUoMpTTT8xNMUy5AtvFOCreurzl1KOWR7XNAulwuWgpGy7airBjnocyNZSwoTK0zwB8Hi0joO4RY4VksnZqWvernMw04PBRbmZIkdzhl4gZrdA73i0juY4Fb1JZmFCojlEYKyqaD8zxV+r4MWVg0swlR2AIrLQ9JdMaTPS2Q= Received: from HE1PR05MB3484.eurprd05.prod.outlook.com (10.170.246.12) by HE1PR05MB3435.eurprd05.prod.outlook.com (10.170.244.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.29; Thu, 20 Feb 2020 03:54:16 +0000 Received: from HE1PR05MB3484.eurprd05.prod.outlook.com ([fe80::540c:c9ae:282d:eaa7]) by HE1PR05MB3484.eurprd05.prod.outlook.com ([fe80::540c:c9ae:282d:eaa7%4]) with mapi id 15.20.2750.016; Thu, 20 Feb 2020 03:54:16 +0000 From: Suanming Mou To: Matan Azrad , Slava Ovsiienko CC: "dev@dpdk.org" , Raslan Darawsheh , "stable@dpdk.org" Thread-Topic: [PATCH 2/2] net/mlx5: fix lack of match information in meter Thread-Index: AQHV5zE9njMpyq20kk21ykT1bnLiTKgipAsAgADQUaA= Date: Thu, 20 Feb 2020 03:54:15 +0000 Message-ID: References: <1582122664-54731-1-git-send-email-suanmingm@mellanox.com> <1582122664-54731-3-git-send-email-suanmingm@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=suanmingm@mellanox.com; x-originating-ip: [39.182.228.100] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ae519e72-c613-4151-692a-08d7b5b88e91 x-ms-traffictypediagnostic: HE1PR05MB3435:|HE1PR05MB3435: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 031996B7EF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(366004)(39860400002)(346002)(136003)(396003)(189003)(199004)(55016002)(9686003)(316002)(54906003)(30864003)(66946007)(66556008)(64756008)(66446008)(110136005)(33656002)(450100002)(4326008)(76116006)(66476007)(186003)(26005)(8936002)(71200400001)(86362001)(81156014)(5660300002)(478600001)(2906002)(6506007)(53546011)(7696005)(8676002)(6636002)(81166006)(52536014); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB3435; H:HE1PR05MB3484.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Tq76BQmBDsb+SZjYmUu0L6wc2iUbBLYHSaLQmuMQ0Zf80f1fmJjM5gk1c2cNzFTD4ezmwksrT/VonoM17hzHIgtGW/1MZHVOsJhCRr/OlYqT6Sn4q6Dtd29wAHY0u4VEOG60fO6aKerZ2/rbo632EYwMfR0dc/5iqI/mAOqybeRiKCJ6AetbJs5HETewCEQ5Oz9H5Vg9R0eVfDe2DtKrbnrdVIcmnufOndDsCNvoB5gi6GRtSAgA/QonxMYttz+qNp4nKOmOz4t71WDz9t7fqE9+DOHzlFGINCOdpO056ip7/BRCRtG7TFUqAX+DDtpwQY8rMd/XE58iMWZO5Db/ItHMQOUzWIFx6xjP7soCglLIPY2UyUHZiVSNjYbjIlBaiYyDggbXDPUjbd11nnK88vqxUMgenAYG3z3O5Yt0B5ZbP08Y5Ku0Zwbn+PoDYmpH x-ms-exchange-antispam-messagedata: IXq7VJST+lfBTz/qwyc2lkh4YKN0k8Liy0Jc0faefM+xHJbOPr23Gs1AzgadOrrJw13UnEJ9RecbhvKn0jrCZNt82Coq5OgkHTy1fHz+H33jpLWyyCLyHAFlZzrxBJglbq0AvJZ6LV1UZGkMKRAW7A== 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: ae519e72-c613-4151-692a-08d7b5b88e91 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2020 03:54:16.3170 (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: AEyM0XXUgns9/wmmBaDpzllNRvgVo+n1C1lPvFnVwdYmSZQivNkTLs/LRLlX4rpV3M9b2mSaGsE6/m9sOo8kpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB3435 Subject: Re: [dpdk-dev] [PATCH 2/2] net/mlx5: fix lack of match information in meter 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: Matan Azrad > Sent: Wednesday, February 19, 2020 11:31 PM > To: Suanming Mou ; Slava Ovsiienko > > Cc: dev@dpdk.org; Raslan Darawsheh ; > stable@dpdk.org > Subject: RE: [PATCH 2/2] net/mlx5: fix lack of match information in meter >=20 >=20 > Hi Mou >=20 > One comment inline. >=20 > From: Suanming Mou > > As meter flows are split into three subflows each, the prefix subflow > > with meter action color the packet, the meter subflow filters out the > > colored packets, the suffix subflow applies all the remaining actions > > to the passed packets. > > > > Currently, all the user defined items are matched in the prefix flow. > > Flow id tag match item is the only item added to the meter suffix subfl= ow. > > Some of the remaining actions to be applied in the suffix subflow > > require more information in the match item, or the suffix subflow will > > not be created successfully. > > > > Actions require the L3/L4 type in the match items as below: > > RTE_FLOW_ACTION_TYPE_SET_TP_SRC > > RTE_FLOW_ACTION_TYPE_SET_TP_DST > > RTE_FLOW_ACTION_TYPE_DEC_TTL > > RTE_FLOW_ACTION_TYPE_SET_TTL > > RTE_FLOW_ACTION_TYPE_RSS > > RTE_FLOW_ACTION_TYPE_QUEUE > > > > Inherit the match item flags from meter prefix subflow to make actions > > in suffix subflow get sufficient information. > > > > Fixes: 9ea9b049a960 ("net/mlx5: split meter flow") > > Cc: stable@dpdk.org > > > > Signed-off-by: Suanming Mou > > --- > > drivers/net/mlx5/mlx5_flow.c | 22 +++++++++++---- > > drivers/net/mlx5/mlx5_flow_dv.c | 62 > > +++++++++++++++++++++++++++++++---------- > > 2 files changed, 65 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5_flow.c > > b/drivers/net/mlx5/mlx5_flow.c index 2f57759..f533f78 100644 > > --- a/drivers/net/mlx5/mlx5_flow.c > > +++ b/drivers/net/mlx5/mlx5_flow.c > > @@ -3440,8 +3440,18 @@ uint32_t mlx5_flow_adjust_priority(struct > > rte_eth_dev *dev, int32_t priority, > > dev_flow->external =3D external; > > /* Subflow object was created, we must include one in the list. */ > > LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next); > > - if (prefix_flow) > > + if (prefix_flow) { > > + /* > > + * Some suffix subflow need the item flags and decap action > > + * flag to know if actions in suffix flow should be applied > > + * to new outer layer or not. > > + * Action flag will be overwritten in tanslate after using. > > + * No need to copy the hash_fields, as it will be generated > > + * by RSS action with the item layer flags. > > + */ > > dev_flow->layers =3D prefix_flow->layers; > > + dev_flow->actions =3D prefix_flow->actions; >=20 > I don't think it is good to move the actions too. > You just need to remove the outer layers here if you see decap, no? > Now we have only one needed param, it is prefix layers only. > please change all the commits to move to prefix_layers instead prefix_flo= w. > in case of decap: > Rss need the inner layers only and modify_actions need the inner layers o= nly. > so you can just zero the outer layers. > please add comment on it in translate - somethink like "layers can be ini= tiated > by the user according to the prefix sub-flow in case of meter and metadat= a > splitters". Good suggestion, will update the V2 version. >=20 > > + } > > if (sub_flow) > > *sub_flow =3D dev_flow; > > return flow_drv_translate(dev, dev_flow, attr, items, actions, > > error); @@ -3737,6 +3747,8 @@ uint32_t > > mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, > > * Pointer to Ethernet device. > > * @param[in] flow > > * Parent flow structure pointer. > > + * @param[in] prefix_flow > > + * Prefix flow structure pointer. > > * @param[in] attr > > * Flow rule attributes. > > * @param[in] items > > @@ -3753,6 +3765,7 @@ uint32_t mlx5_flow_adjust_priority(struct > > rte_eth_dev *dev, int32_t priority, static int > > flow_create_split_metadata(struct rte_eth_dev *dev, > > struct rte_flow *flow, > > + struct mlx5_flow *prefix_flow, > > const struct rte_flow_attr *attr, > > const struct rte_flow_item items[], > > const struct rte_flow_action actions[], @@ -3773,7 > > +3786,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, > > int32_t priority, > > if (!config->dv_flow_en || > > config->dv_xmeta_en =3D=3D MLX5_XMETA_MODE_LEGACY || > > !mlx5_flow_ext_mreg_supported(dev)) > > - return flow_create_split_inner(dev, flow, NULL, NULL, > > + return flow_create_split_inner(dev, flow, NULL, prefix_flow, > > attr, items, actions, external, > > error); > > actions_n =3D flow_parse_qrss_action(actions, &qrss); @@ -3856,7 > > +3869,7 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, > > int32_t priority, > > goto exit; > > } > > /* Add the unmodified original or prefix subflow. */ > > - ret =3D flow_create_split_inner(dev, flow, &dev_flow, NULL, attr, > > + ret =3D flow_create_split_inner(dev, flow, &dev_flow, prefix_flow, > > attr, > > items, ext_actions ? ext_actions : > > actions, external, error); > > if (ret < 0) > > @@ -3892,7 +3905,6 @@ uint32_t mlx5_flow_adjust_priority(struct > > rte_eth_dev *dev, int32_t priority, > > .type =3D RTE_FLOW_ACTION_TYPE_END, > > }, > > }; > > - struct mlx5_flow *prefix_flow; > > > > /* > > * Configure the tag item only if there is no meter subflow. > > @@ -4052,7 +4064,7 @@ uint32_t mlx5_flow_adjust_priority(struct > > rte_eth_dev *dev, int32_t priority, > > MLX5_FLOW_TABLE_LEVEL_SUFFIX; > > } > > /* Add the prefix subflow. */ > > - ret =3D flow_create_split_metadata(dev, flow, &sfx_attr, > > + ret =3D flow_create_split_metadata(dev, flow, dev_flow, &sfx_attr, > > sfx_items ? sfx_items : items, > > sfx_actions ? sfx_actions : actions, > > external, error); > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > > b/drivers/net/mlx5/mlx5_flow_dv.c index c958fca..359a037 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -85,16 +85,44 @@ > > * Pointer to item specification. > > * @param[out] attr > > * Pointer to flow attributes structure. > > + * @param[in] dev_flow > > + * Pointer to the sub flow. > > * @param[in] tunnel_decap > > * Whether action is after tunnel decapsulation. > > */ > > static void > > flow_dv_attr_init(const struct rte_flow_item *item, union > > flow_dv_attr *attr, > > - bool tunnel_decap) > > + struct mlx5_flow *dev_flow, bool tunnel_decap) > > { > > + if (dev_flow->layers) { > > + if (dev_flow->actions & MLX5_FLOW_ACTION_DECAP) { > > + if (dev_flow->layers & > > MLX5_FLOW_LAYER_INNER_L3_IPV4) > > + attr->ipv4 =3D 1; > > + else if (dev_flow->layers & > > + MLX5_FLOW_LAYER_INNER_L3_IPV6) > > + attr->ipv6 =3D 1; > > + if (dev_flow->layers & > > MLX5_FLOW_LAYER_INNER_L4_TCP) > > + attr->tcp =3D 1; > > + else if (dev_flow->layers & > > + MLX5_FLOW_LAYER_INNER_L4_UDP) > > + attr->udp =3D 1; > > + } else { > > + if (dev_flow->layers & > > MLX5_FLOW_LAYER_OUTER_L3_IPV4) > > + attr->ipv4 =3D 1; > > + else if (dev_flow->layers & > > + MLX5_FLOW_LAYER_OUTER_L3_IPV6) > > + attr->ipv6 =3D 1; > > + if (dev_flow->layers & > > MLX5_FLOW_LAYER_OUTER_L4_TCP) > > + attr->tcp =3D 1; > > + else if (dev_flow->layers & > > + MLX5_FLOW_LAYER_OUTER_L4_UDP) > > + attr->udp =3D 1; > > + } > > + attr->valid =3D 1; > > + return; > > + } > > for (; item->type !=3D RTE_FLOW_ITEM_TYPE_END; item++) { > > uint8_t next_protocol =3D 0xff; > > - > > switch (item->type) { > > case RTE_FLOW_ITEM_TYPE_GRE: > > case RTE_FLOW_ITEM_TYPE_NVGRE: > > @@ -640,6 +668,8 @@ struct field_modify_info modify_tcp[] =3D { > > * Pointer to rte_flow_item objects list. > > * @param[in] attr > > * Pointer to flow attributes structure. > > + * @param[in] dev_flow > > + * Pointer to the sub flow. > > * @param[in] tunnel_decap > > * Whether action is after tunnel decapsulation. > > * @param[out] error > > @@ -653,8 +683,8 @@ struct field_modify_info modify_tcp[] =3D { > > (struct mlx5_flow_dv_modify_hdr_resource > *resource, > > const struct rte_flow_action *action, > > const struct rte_flow_item *items, > > - union flow_dv_attr *attr, bool tunnel_decap, > > - struct rte_flow_error *error) > > + union flow_dv_attr *attr, struct mlx5_flow > > *dev_flow, > > + bool tunnel_decap, struct rte_flow_error *error) > > { > > const struct rte_flow_action_set_tp *conf =3D > > (const struct rte_flow_action_set_tp *)(action->conf); @@ - > > 666,7 +696,7 @@ struct field_modify_info modify_tcp[] =3D { > > struct field_modify_info *field; > > > > if (!attr->valid) > > - flow_dv_attr_init(items, attr, tunnel_decap); > > + flow_dv_attr_init(items, attr, dev_flow, tunnel_decap); > > if (attr->udp) { > > memset(&udp, 0, sizeof(udp)); > > memset(&udp_mask, 0, sizeof(udp_mask)); @@ -716,6 > > +746,8 @@ struct field_modify_info modify_tcp[] =3D { > > * Pointer to rte_flow_item objects list. > > * @param[in] attr > > * Pointer to flow attributes structure. > > + * @param[in] dev_flow > > + * Pointer to the sub flow. > > * @param[in] tunnel_decap > > * Whether action is after tunnel decapsulation. > > * @param[out] error > > @@ -729,8 +761,8 @@ struct field_modify_info modify_tcp[] =3D { > > (struct mlx5_flow_dv_modify_hdr_resource > *resource, > > const struct rte_flow_action *action, > > const struct rte_flow_item *items, > > - union flow_dv_attr *attr, bool tunnel_decap, > > - struct rte_flow_error *error) > > + union flow_dv_attr *attr, struct mlx5_flow > > *dev_flow, > > + bool tunnel_decap, struct rte_flow_error *error) > > { > > const struct rte_flow_action_set_ttl *conf =3D > > (const struct rte_flow_action_set_ttl *)(action->conf); @@ - > > 742,7 +774,7 @@ struct field_modify_info modify_tcp[] =3D { > > struct field_modify_info *field; > > > > if (!attr->valid) > > - flow_dv_attr_init(items, attr, tunnel_decap); > > + flow_dv_attr_init(items, attr, dev_flow, tunnel_decap); > > if (attr->ipv4) { > > memset(&ipv4, 0, sizeof(ipv4)); > > memset(&ipv4_mask, 0, sizeof(ipv4_mask)); @@ -778,6 > > +810,8 @@ struct field_modify_info modify_tcp[] =3D { > > * Pointer to rte_flow_item objects list. > > * @param[in] attr > > * Pointer to flow attributes structure. > > + * @param[in] dev_flow > > + * Pointer to the sub flow. > > * @param[in] tunnel_decap > > * Whether action is after tunnel decapsulation. > > * @param[out] error > > @@ -790,8 +824,8 @@ struct field_modify_info modify_tcp[] =3D { > > flow_dv_convert_action_modify_dec_ttl > > (struct mlx5_flow_dv_modify_hdr_resource > *resource, > > const struct rte_flow_item *items, > > - union flow_dv_attr *attr, bool tunnel_decap, > > - struct rte_flow_error *error) > > + union flow_dv_attr *attr, struct mlx5_flow > > *dev_flow, > > + bool tunnel_decap, struct rte_flow_error *error) > > { > > struct rte_flow_item item; > > struct rte_flow_item_ipv4 ipv4; > > @@ -801,7 +835,7 @@ struct field_modify_info modify_tcp[] =3D { > > struct field_modify_info *field; > > > > if (!attr->valid) > > - flow_dv_attr_init(items, attr, tunnel_decap); > > + flow_dv_attr_init(items, attr, dev_flow, tunnel_decap); > > if (attr->ipv4) { > > memset(&ipv4, 0, sizeof(ipv4)); > > memset(&ipv4_mask, 0, sizeof(ipv4_mask)); @@ -7505,7 > > +7539,7 @@ struct field_modify_info modify_tcp[] =3D { > > case RTE_FLOW_ACTION_TYPE_SET_TP_DST: > > if (flow_dv_convert_action_modify_tp > > (mhdr_res, actions, items, > > - &flow_attr, !!(action_flags & > > + &flow_attr, dev_flow, !!(action_flags > > & > > MLX5_FLOW_ACTION_DECAP), > > error)) > > return -rte_errno; > > action_flags |=3D actions->type =3D=3D > > @@ -7515,7 +7549,7 @@ struct field_modify_info modify_tcp[] =3D { > > break; > > case RTE_FLOW_ACTION_TYPE_DEC_TTL: > > if (flow_dv_convert_action_modify_dec_ttl > > - (mhdr_res, items, &flow_attr, > > + (mhdr_res, items, &flow_attr, > > dev_flow, > > !!(action_flags & > > MLX5_FLOW_ACTION_DECAP), > > error)) > > return -rte_errno; > > @@ -7524,7 +7558,7 @@ struct field_modify_info modify_tcp[] =3D { > > case RTE_FLOW_ACTION_TYPE_SET_TTL: > > if (flow_dv_convert_action_modify_ttl > > (mhdr_res, actions, items, > > &flow_attr, > > - !!(action_flags & > > + dev_flow, !!(action_flags & > > MLX5_FLOW_ACTION_DECAP), > > error)) > > return -rte_errno; > > action_flags |=3D MLX5_FLOW_ACTION_SET_TTL; > > -- > > 1.8.3.1