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 0C5ADA2EEB for ; Tue, 10 Sep 2019 10:13:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DE9091EC6A; Tue, 10 Sep 2019 10:13:32 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50087.outbound.protection.outlook.com [40.107.5.87]) by dpdk.org (Postfix) with ESMTP id 5F9A61EC65 for ; Tue, 10 Sep 2019 10:13:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IAGbCx/WxUuC5RWR/Uv0AW5jH+JyOHpSdNCvwgB9D5UuMw2F+CZr8iv5zbCI8qlRcp8VeOp8Fgg7jVd9X15oKUefI2cMR21VXzav8kHScgfRhjEE5Pe3gDRtrQ+n4UfxyhdzyiWb9W7/g0EkfeNoiKGpq1S22eou+rJvA7O0/beQ4oVkaFX48VottDOZX2mqJQvJvbqrwTcmUlKHNink+vHQkoR27AYrYOqhxBvbwMCjIpDIGYr4qG69AXeUnomhiHRgmfG+v8b3cA6y51WHgg3TYmEjhAzzCNpqoKgB7BfnmNzlAUHQYBW9sD+D23Bj2sMZbIB4At8/VzFJ72HQSQ== 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=8mSea5pCDri8zTs9FxIFmtCpzArUidTYXe7dF9FC5ho=; b=NjZgGVNrHsYpLj35liOr+d+DaDMTMWJ1mmjbkc8tL5Pe3aevlBntDHNb1EmkK1GqY8fiECMb+1N8l+BN4NdeXpLet6AFLZ2M0laMYyuU7HAJZ8h26b9KhLaoKLKgGuOeNxr8H9UJ4tEvhchQ2qVP89Ysk+tY9kcAHTYvN6WMzi7q4tAuBqGyU4gELD0yaExuM2CUsb8/rlp9B8RC/JIfiL+eZMq5s7hpkngZWI4zTHDmRv+Q575wjDHhMJnVsmal0fqK25YxUoSNj48QeBuZTq+KE4UjVFOjMqEI8/EWnKEsAeoneYL/lTA50hZuMGnP2NKS1tah8egVsXy8bjUPSQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8mSea5pCDri8zTs9FxIFmtCpzArUidTYXe7dF9FC5ho=; b=mZVyxXn+92+5aajIvV8mwwZ5JHpahvgSFFqQ0GNcpEHk2HS7g5YKo+a1yL3SW/gRvx4EaL8l753gn07iajL/kMRG/aOYkvwtB8a1UZ3ASXHS5+9AJt8PxjLLdWLGPrWDS9Iac6lUa269YEv4DG3b++FHy9zmy5ZO7gooi4J+DME= Received: from VI1PR05MB3278.eurprd05.prod.outlook.com (10.170.238.23) by VI1PR05MB4189.eurprd05.prod.outlook.com (10.171.183.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.20; Tue, 10 Sep 2019 08:13:31 +0000 Received: from VI1PR05MB3278.eurprd05.prod.outlook.com ([fe80::d4c:75b4:c928:3890]) by VI1PR05MB3278.eurprd05.prod.outlook.com ([fe80::d4c:75b4:c928:3890%7]) with mapi id 15.20.2241.018; Tue, 10 Sep 2019 08:13:31 +0000 From: Slava Ovsiienko To: Moti Haimovsky , Raslan Darawsheh CC: "dev@dpdk.org" Thread-Topic: [PATCH v5 7/7] net/mlx5: supp modify VLAN ID on existing VLAN hdr Thread-Index: AQHVZyc2GoqTjUGZiEmnAlPUmSC1kqckkO2w Date: Tue, 10 Sep 2019 08:13:31 +0000 Message-ID: References: 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=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: db1746d4-bf48-42cb-9157-08d735c6c49c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VI1PR05MB4189; x-ms-traffictypediagnostic: VI1PR05MB4189:|VI1PR05MB4189: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:421; x-forefront-prvs: 01565FED4C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(4636009)(366004)(376002)(39860400002)(396003)(136003)(346002)(13464003)(199004)(189003)(14444005)(64756008)(66066001)(33656002)(256004)(4326008)(25786009)(53546011)(52536014)(6436002)(86362001)(229853002)(74316002)(305945005)(8676002)(9686003)(6506007)(55016002)(7736002)(7696005)(81166006)(316002)(8936002)(76176011)(110136005)(6246003)(3846002)(476003)(186003)(2906002)(486006)(66946007)(81156014)(66476007)(66556008)(14454004)(66446008)(6636002)(102836004)(6116002)(99286004)(76116006)(71190400001)(71200400001)(5660300002)(26005)(446003)(11346002)(478600001)(53936002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4189; H:VI1PR05MB3278.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: lXiTw1gAE8pkGf3Yb0gDpLm2SxrA96cV+2y/Mm2vix8dFg8rFfx+KP1ez2MlT0sYq6SQJymt03Gx/jlFf/NTtu8xo6j8dvTb3dW0YSenX13HEDY3kl2aSM7j7P8MKCFkBJ/m7G4BMOFH3YxDjx37zHvt0tSGmDykDhRptxVF7QfxHvCelZWlSgX4pTjSTUuKWOExg9a841TDd4IJXSM1kUzdAZzDmEZ3ib2e1aWiF7Cm09E7m1YeXIT+/QDKG5AyJ7gLavLeFUWjLIQuVgpcK/RrjGCJpHxoCDREtpm+pecGelqJagmeBSLFURq2yEjA7XBrgpNI6xkH0t8S50Oz5HjvcHTQFm2DuvB2oormxoBdN29KRBZZCnelEp+FdUb1yGWN2wDIu6auYgOiiUHdt/wIiV0UydoeXZGOsK0tzi0= 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: db1746d4-bf48-42cb-9157-08d735c6c49c X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Sep 2019 08:13:31.2687 (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: oPrumkGkBmKP8yFJ7ULEV4cL4NaiSmcSgh9/EZMVQOaM1EbOjx8aYyei4gdaQ01ZvQqWScJJBnQHAu54hVmKusv5PZXLpR9qwBSWJ2DV5H0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4189 Subject: Re: [dpdk-dev] [PATCH v5 7/7] net/mlx5: supp modify VLAN ID on existing VLAN hdr 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: Moti Haimovsky > Sent: Monday, September 9, 2019 18:57 > To: Slava Ovsiienko ; Raslan Darawsheh > > Cc: dev@dpdk.org > Subject: [PATCH v5 7/7] net/mlx5: supp modify VLAN ID on existing VLAN hd= r >=20 > This commit adds support for modifying the VID of the outermost VLAN > header already present in the packet. >=20 > Signed-off-by: Moti Haimovsky Acked-by: Viacheslav Ovsiienko > --- > doc/guides/nics/mlx5.rst | 20 ++++----- > drivers/net/mlx5/mlx5_flow.h | 3 +- > drivers/net/mlx5/mlx5_flow_dv.c | 89 > ++++++++++++++++++++++++++++++++++++----- > drivers/net/mlx5/mlx5_prm.h | 1 + > 4 files changed, 92 insertions(+), 21 deletions(-) >=20 > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index > 3a2a366..c2e9003 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -134,8 +134,6 @@ Limitations >=20 > - VLAN set PCP offload is not supported on existing headers. >=20 > -- VLAN set VID offload is not supported on existing headers. > - > - A multi segment packet must have not more segments than reported by > dev_infos_get() > in tx_desc_lim.nb_seg_max field. This value depends on maximal support= ed > Tx descriptor > size and ``txq_inline_min`` settings and may be from 2 (worst case for= ced > by maximal @@ -1021,13 +1019,17 @@ Supported hardware offloads > | | (set_ipv4_src / | | OFED 4.6-2 | | OFED 4.6-2 | > | | set_ipv4_dst / | | rdma-core 24 | | rdma-core 23 | > | | set_ipv6_src / | | ConnectX-5 | | ConnectX-5 | > - | | set_ipv6_dst / | | | > - | | set_tp_src / | | | > - | | set_tp_dst / | | | > - | | dec_ttl / | | | > - | | set_ttl / | | | > - | | set_mac_src / | | | > - | | set_mac_dst) | | | > + | | set_ipv6_dst / | | | | | > + | | set_tp_src / | | | | | > + | | set_tp_dst / | | | | | > + | | dec_ttl / | | | | | > + | | set_ttl / | | | | | > + | | set_mac_src / | | | | | > + | | set_mac_dst) | | | | | > + | | | | | | | > + | | (of_set_vlan_vid) | | DPDK 19.11 | | DPDK 19.11 | > + | | | OFED 4.6-4 | | OFED 4.6-4 | > + | | | ConnectX-5 | | ConnectX-5 | > +-----------------------+-----------------+-----------------+ > | Jump | | DPDK 19.05 | | DPDK 19.02 | > | | | OFED 4.6-4 | | OFED 4.6-4 | > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 15c9c04..95abbb8 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -171,7 +171,8 @@ > MLX5_FLOW_ACTION_INC_TCP_SEQ | \ > MLX5_FLOW_ACTION_DEC_TCP_SEQ | \ > MLX5_FLOW_ACTION_INC_TCP_ACK | \ > - MLX5_FLOW_ACTION_DEC_TCP_ACK) > + MLX5_FLOW_ACTION_DEC_TCP_ACK | \ > + > MLX5_FLOW_ACTION_OF_SET_VLAN_VID) >=20 > #define MLX5_FLOW_VLAN_ACTIONS > (MLX5_FLOW_ACTION_OF_POP_VLAN | \ > MLX5_FLOW_ACTION_OF_PUSH_VLAN) > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index 4b68aa6..330a868 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -115,6 +115,12 @@ struct field_modify_info modify_eth[] =3D { > {0, 0, 0}, > }; >=20 > +struct field_modify_info modify_vlan_out_first_vid[] =3D { > + /* Size in bits !!! */ > + {12, 0, MLX5_MODI_OUT_FIRST_VID}, > + {0, 0, 0}, > +}; > + > struct field_modify_info modify_ipv4[] =3D { > {1, 8, MLX5_MODI_OUT_IPV4_TTL}, > {4, 12, MLX5_MODI_OUT_SIPV4}, > @@ -397,6 +403,46 @@ struct field_modify_info modify_tcp[] =3D { } >=20 > /** > + * Convert modify-header set VLAN VID action to DV specification. > + * > + * @param[in,out] resource > + * Pointer to the modify-header resource. > + * @param[in] action > + * Pointer to action specification. > + * @param[out] error > + * Pointer to the error structure. > + * > + * @return > + * 0 on success, a negative errno value otherwise and rte_errno is set= . > + */ > +static int > +flow_dv_convert_action_modify_vlan_vid > + (struct mlx5_flow_dv_modify_hdr_resource > *resource, > + const struct rte_flow_action *action, > + struct rte_flow_error *error) > +{ > + const struct rte_flow_action_of_set_vlan_vid *conf =3D > + (const struct rte_flow_action_of_set_vlan_vid *)(action- > >conf); > + int i =3D resource->actions_num; > + struct mlx5_modification_cmd *actions =3D &resource->actions[i]; > + struct field_modify_info *field =3D modify_vlan_out_first_vid; > + > + if (i >=3D MLX5_MODIFY_NUM) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, NULL, > + "too many items to modify"); > + actions[i].action_type =3D MLX5_MODIFICATION_TYPE_SET; > + actions[i].field =3D field->id; > + actions[i].length =3D field->size; > + actions[i].offset =3D field->offset; > + actions[i].data0 =3D rte_cpu_to_be_32(actions[i].data0); > + actions[i].data1 =3D conf->vlan_vid; > + actions[i].data1 =3D actions[i].data1 << 16; > + resource->actions_num =3D ++i; > + return 0; > +} > + > +/** > * Convert modify-header set TP action to DV specification. > * > * @param[in,out] resource > @@ -1017,8 +1063,8 @@ struct field_modify_info modify_tcp[] =3D { > /** > * Validate the set VLAN VID. > * > - * @param[in] action_flags > - * Holds the actions detected until now. > + * @param[in] item_flags > + * Holds the items detected in this rule. > * @param[in] actions > * Pointer to the list of actions remaining in the flow rule. > * @param[in] attr > @@ -1030,7 +1076,7 @@ struct field_modify_info modify_tcp[] =3D { > * 0 on success, a negative errno value otherwise and rte_errno is set= . > */ > static int > -flow_dv_validate_action_set_vlan_vid(uint64_t action_flags, > +flow_dv_validate_action_set_vlan_vid(uint64_t item_flags, > const struct rte_flow_action actions[], > struct rte_flow_error *error) > { > @@ -1041,17 +1087,27 @@ struct field_modify_info modify_tcp[] =3D { > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > action, > "VLAN VID value is too big"); > + /* If a push VLAN action follows then it will handle this action */ > if (mlx5_flow_find_action(actions, > - > RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN) =3D=3D NULL) > + > RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN)) > + return 0; > + > + /* > + * Action is on an existing VLAN header: > + * Need to verify this is a single modify CID action. > + * Rule mast include a match on outer VLAN. > + */ > + if (mlx5_flow_find_action(++action, > + > RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID)) > return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ACTION, > action, > - "set VLAN VID can only be used " > - "with push VLAN action"); > - if (action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) > - return rte_flow_error_set(error, ENOTSUP, > + "Multiple VLAN VID modifications > are " > + "not supported"); > + if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN)) > + return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > action, > - "set VLAN VID action must precede > " > - "the push VLAN action"); > + "match on VLAN is required in order > " > + "to set VLAN VID"); > return 0; > } >=20 > @@ -3487,7 +3543,7 @@ struct field_modify_info modify_tcp[] =3D { > break; > case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: > ret =3D flow_dv_validate_action_set_vlan_vid > - (action_flags, actions, error); > + (item_flags, actions, error); > if (ret < 0) > return ret; > /* Count VID with push_vlan command. */ @@ - > 5214,6 +5270,8 @@ struct field_modify_info modify_tcp[] =3D { > dev_flow->dv.actions[actions_n++] =3D > dev_flow->dv.push_vlan_res- > >action; > action_flags |=3D > MLX5_FLOW_ACTION_OF_PUSH_VLAN; > + /* Push VLAN command is also handling this > VLAN_VID */ > + action_flags &=3D > ~MLX5_FLOW_ACTION_OF_SET_VLAN_VID; > break; > case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: > if (!vlan_inherited) { > @@ -5238,6 +5296,15 @@ struct field_modify_info modify_tcp[] =3D { > (((const struct rte_flow_action_of_set_vlan_vid *) > actions->conf)->vlan_vid); > /* Push VLAN command will use this value */ > + if (mlx5_flow_find_action > + (actions, > + > RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN)) > + break; > + /* If no VLAN push - this is a modify header action */ > + if (flow_dv_convert_action_modify_vlan_vid > + (&res, actions, error)) > + return -rte_errno; > + action_flags |=3D > MLX5_FLOW_ACTION_OF_SET_VLAN_VID; > break; > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > diff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h > index d62837e..e5afc1c 100644 > --- a/drivers/net/mlx5/mlx5_prm.h > +++ b/drivers/net/mlx5/mlx5_prm.h > @@ -413,6 +413,7 @@ enum mlx5_modification_field { > MLX5_MODI_OUT_DIPV6_31_0, > MLX5_MODI_OUT_SIPV4, > MLX5_MODI_OUT_DIPV4, > + MLX5_MODI_OUT_FIRST_VID, > MLX5_MODI_IN_SMAC_47_16 =3D 0x31, > MLX5_MODI_IN_SMAC_15_0, > MLX5_MODI_IN_ETHERTYPE, > -- > 1.8.3.1