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 975F3A2EEB for ; Tue, 10 Sep 2019 10:13:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CDD01ECC1; Tue, 10 Sep 2019 10:13:05 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50073.outbound.protection.outlook.com [40.107.5.73]) by dpdk.org (Postfix) with ESMTP id EF5C91ECC1 for ; Tue, 10 Sep 2019 10:13:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VGe7Kr8WHywbh4zzGvRQgQx0DuWYOt0OhCnxlkhAh8opVUCVBvG/pMzm88YeO+0qC2mkrxuVbuvDTTqR6bNjQm4j0b7mDjgLhSJYA69c/kXh+c4FsNxlitD/asA0ho6ylGM/F4TuMuRmURdX+9N4BRVJlSJGt+VVFc/xHybHTSNFqw0gP0ebq1t8B04Kp4Hj1M1DWhYgq9B+EiLHp394Zay3XzirN7DUr6V1PAslATasYuVgWfBZvy5OZ0zA/nruT1Aflvy8alNOPRWwfXzvp4WlNRasjiQwnFRlRhPEQtCc29tJYLGa6faIrW+rv/UjmTEqgD3E1GEWdd+Vv135Vw== 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=ydYPBudf41oEoAMYAJupG9iwfMqbsKqccCSLsrptNQM=; b=aThFGmHz80/hYX0VzNVd43MyvbpV/91ySlBL+U1LGDhbVRRri7uJqe8MxjapkA9tVmD1BUwd9dAhnfNYwpJEyfJnf+atH8NYoKS9dpJl9vs9F/35yy2ai88psGbuQlBUQPMao4JdR7I1Rme9q/gYbUgwXd25rndOKjJY9TpsRJkMTFUspk1xW93lRHJz/r+xVQnVtMOBJYaWesUASkGEU4b4zskCXxd9T0MH0hR2P+LwionbNhTLCMkPvLQ7bArMIS/5VdJKg8FKsTz9RVCNiiJQfyw5CybGUQoQNjlIZRgwbg1G6s1ZWmQOYED7t4HkGqcZm0gKpctsayc7MuHSjg== 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=ydYPBudf41oEoAMYAJupG9iwfMqbsKqccCSLsrptNQM=; b=qIK621vrlU0SIikxvpOWH69E+dxD8IPJGMw2KTL6Yw4T9di3Kmnn9wKFXmanH7M59qDWoXpAHeFGmvxCEqsIyJ+go9/DibIh+/F+hhzxyfdNMn6+c8z+UYvSd4yXg7zy4dzHze8lm8ED5BLVAwjUGhpxo9YECmvDetPrnzuoRHE= 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:03 +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:03 +0000 From: Slava Ovsiienko To: Moti Haimovsky , Raslan Darawsheh CC: "dev@dpdk.org" Thread-Topic: [PATCH v5 3/7] net/mlx5: support pop flow action on VLAN header Thread-Index: AQHVZyc1lgDGL8zGtE+t1m54SUu526ckkMmQ Date: Tue, 10 Sep 2019 08:13:02 +0000 Message-ID: References: <734d78cf0f69ef27150d086dc7853f0cbf53be9b.1567951423.git.motih@mellanox.com> In-Reply-To: <734d78cf0f69ef27150d086dc7853f0cbf53be9b.1567951423.git.motih@mellanox.com> 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: 9f1a7e3d-e918-4df5-ab9d-08d735c6b3aa 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:416; x-forefront-prvs: 01565FED4C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(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); 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: nr/0XvcZpN7XCw9Cb6cFXT2n6+773ebeeQLjl9/wZQttxQZ2V3yDQZjnXBiPnCLhFaj3dWcFDZgQFq6yCHpZHc+vIikTU7z2RSVtN2+1Kj3jNsy2UP4Ew6AESNNKbfhIA7XQ91nuuEx57oldHgeklguFCMQmF64WuRFqE8HyMAQcpXEGfurf+ivR7HSfqoZi1b2uRfx4pasL6ciRbvNBE2b8jWEii3kVqOLC6BUe/UGS16UZramcE9f2XGNV/8sDXXKYHkq2u+Vv/nQ4Qvywez9Cq5m0RB4FPIRSa2l4ak+faqkULhWUH0bUxMZ8zhO/7K+Qan1558lwBMHPdKK8xyrHNQ7XBnd+TCBz5ptyqLPhU0Lp7z/4g07tWYqquX2Yszg4pVSYFdq6YO298t7bKR9VbAqrT6OZdKJ0bbtu+ck= 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: 9f1a7e3d-e918-4df5-ab9d-08d735c6b3aa X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Sep 2019 08:13:02.9138 (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: ebDAs/IB2hLv52KZIYJdQVOfg074KBwSmj7vOvSjZBy06FAlybH68/ap2/kHpeZnwHoS6lDA92Or73DQJ3aY/ukxGBEuH/5PcbtUVj3sDZ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4189 Subject: Re: [dpdk-dev] [PATCH v5 3/7] net/mlx5: support pop flow action on VLAN header 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 3/7] net/mlx5: support pop flow action on VLAN header >=20 > This commit adds support for RTE_FLOW_ACTION_TYPE_OF_POP_VLAN via > direct verbs flow rules. >=20 > Signed-off-by: Moti Haimovsky Acked-by: Viacheslav Ovsiienko > --- > doc/guides/nics/mlx5.rst | 10 +++++ > doc/guides/rel_notes/release_19_11.rst | 6 +++ > drivers/net/mlx5/mlx5.c | 9 ++++ > drivers/net/mlx5/mlx5.h | 2 + > drivers/net/mlx5/mlx5_flow.h | 5 ++- > drivers/net/mlx5/mlx5_flow_dv.c | 78 > ++++++++++++++++++++++++++++++++++ > 6 files changed, 109 insertions(+), 1 deletion(-) >=20 > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index > 4115520..2ae2e8f 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -124,6 +124,12 @@ Limitations >=20 > Will match any ipv4 packet (VLAN included). >=20 > +- VLAN pop offload command: > + > + - Flow rules having a VLAN pop offload command as one of their actions > and > + are lacking a match on VLAN as one of their items are not supported. > + - The command is not supported on egress traffic. > + > - 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 @@ -1032,6 +1038,10 @@ Supported hardware offloads > | | | rdma-core 24 | | N/A | > | | | ConnectX-5 | | N/A | > +-----------------------+-----------------+-----------------+ > + | | VLAN | | DPDK 19.11 | | DPDK 19.11 | > + | | (of_pop_vlan) | | OFED 4.6-4 | | OFED 4.6-4 | > + | | | ConnectX-5 | | ConnectX-5 | > + +-----------------------+-----------------+-----------------+ >=20 > Notes for testpmd > ----------------- > diff --git a/doc/guides/rel_notes/release_19_11.rst > b/doc/guides/rel_notes/release_19_11.rst > index 27cfbd9..5c2ac15 100644 > --- a/doc/guides/rel_notes/release_19_11.rst > +++ b/doc/guides/rel_notes/release_19_11.rst > @@ -223,3 +223,9 @@ Tested Platforms > Also, make sure to start the actual text at the margin. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > +* **Updated Mellanox mlx5 driver.** > + > + Updated Mellanox mlx5 driver with new features and improvements, > including: > + > + * Added support for VLAN pop flow offload command. > + > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > dc7b10b..8e10932 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -549,6 +549,7 @@ struct mlx5_dev_spawn_data { > sh->esw_drop_action =3D mlx5_glue- > >dr_create_flow_action_drop(); > } > #endif > + sh->pop_vlan_action =3D mlx5_glue- > >dr_create_flow_action_pop_vlan(); > sh->dv_refcnt++; > priv->dr_shared =3D 1; > return 0; > @@ -571,6 +572,10 @@ struct mlx5_dev_spawn_data { > mlx5_glue->destroy_flow_action(sh->esw_drop_action); > sh->esw_drop_action =3D NULL; > } > + if (sh->pop_vlan_action) { > + mlx5_glue->destroy_flow_action(sh->pop_vlan_action); > + sh->pop_vlan_action =3D NULL; > + } > return err; > #else > (void)priv; > @@ -616,6 +621,10 @@ struct mlx5_dev_spawn_data { > sh->esw_drop_action =3D NULL; > } > #endif > + if (sh->pop_vlan_action) { > + mlx5_glue->destroy_flow_action(sh->pop_vlan_action); > + sh->pop_vlan_action =3D NULL; > + } > pthread_mutex_destroy(&sh->dv_mutex); > #else > (void)priv; > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > 09ca4b1..a18f588 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -570,6 +570,8 @@ struct mlx5_ibv_shared { > struct mlx5_flow_tbl_resource tx_tbl[MLX5_MAX_TABLES]; > /* TX Direct Rules tables. */ > void *esw_drop_action; /* Pointer to DR E-Switch drop action. */ > + void *pop_vlan_action; /* Pointer to DR pop VLAN action. */ > + /* TX Direct Rules tables/ */ > LIST_HEAD(matchers, mlx5_flow_dv_matcher) matchers; > LIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) > encaps_decaps; > LIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) > modify_cmds; diff --git a/drivers/net/mlx5/mlx5_flow.h > b/drivers/net/mlx5/mlx5_flow.h index 8d193b6..06b0470 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -154,7 +154,8 @@ >=20 > #define MLX5_FLOW_DECAP_ACTIONS > (MLX5_FLOW_ACTION_VXLAN_DECAP | \ > MLX5_FLOW_ACTION_NVGRE_DECAP | \ > - MLX5_FLOW_ACTION_RAW_DECAP) > + MLX5_FLOW_ACTION_RAW_DECAP | \ > + MLX5_FLOW_ACTION_OF_POP_VLAN) >=20 > #define MLX5_FLOW_MODIFY_HDR_ACTIONS > (MLX5_FLOW_ACTION_SET_IPV4_SRC | \ > MLX5_FLOW_ACTION_SET_IPV4_DST | \ > @@ -171,6 +172,8 @@ > MLX5_FLOW_ACTION_INC_TCP_ACK | \ > MLX5_FLOW_ACTION_DEC_TCP_ACK) >=20 > +#define MLX5_FLOW_VLAN_ACTIONS > (MLX5_FLOW_ACTION_OF_POP_VLAN) > + > #ifndef IPPROTO_MPLS > #define IPPROTO_MPLS 137 > #endif > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index 7b2ba07..fd2e810 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -815,6 +815,61 @@ struct field_modify_info modify_tcp[] =3D { } >=20 > /** > + * Validate the pop VLAN action. > + * > + * @param[in] action_flags > + * Holds the actions detected until now. > + * @param[in] action > + * Pointer to the pop vlan action. > + * @param[in] item_flags > + * The items found in this flow rule. > + * @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 set= . > + */ > +static int > +flow_dv_validate_action_pop_vlan(struct rte_eth_dev *dev, > + uint64_t action_flags, > + const struct rte_flow_action *action, > + uint64_t item_flags, > + const struct rte_flow_attr *attr, > + struct rte_flow_error *error) > +{ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + > + (void)action; > + (void)attr; > + if (!priv->sh->pop_vlan_action) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "pop vlan action is not supported"); > + /* > + * Check for inconsistencies: > + * fail strip_vlan in a flow that matches packets without VLAN tags. > + * fail strip_vlan in a flow that matches packets without explicitly a > + * matching on VLAN tag ? > + */ > + if (action_flags & MLX5_FLOW_ACTION_OF_POP_VLAN) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "no support for multiple vlan pop " > + "actions"); > + if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN)) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > + NULL, > + "cannot pop vlan without a " > + "match on (outer) vlan in the flow"); > + return 0; > +} > + > +/** > * Validate count action. > * > * @param[in] dev > @@ -3109,6 +3164,16 @@ struct field_modify_info modify_tcp[] =3D { > action_flags |=3D MLX5_FLOW_ACTION_COUNT; > ++actions_n; > break; > + case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: > + if (flow_dv_validate_action_pop_vlan(dev, > + action_flags, > + actions, > + item_flags, attr, > + error)) > + return -rte_errno; > + action_flags |=3D > MLX5_FLOW_ACTION_OF_POP_VLAN; > + ++actions_n; > + break; > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > ret =3D > flow_dv_validate_action_l2_encap(action_flags, > @@ -3283,6 +3348,13 @@ struct field_modify_info modify_tcp[] =3D { > "action not supported"); > } > } > + if ((action_flags & MLX5_FLOW_LAYER_TUNNEL) && > + (action_flags & MLX5_FLOW_VLAN_ACTIONS)) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + actions, > + "can't have vxlan and vlan" > + " actions in the same rule"); > /* Eswitch has few restrictions on using items and actions */ > if (attr->transfer) { > if (action_flags & MLX5_FLOW_ACTION_FLAG) @@ -4801,6 > +4873,12 @@ struct field_modify_info modify_tcp[] =3D { > action, > "cannot create counter" > " object."); > + break; > + case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: > + dev_flow->dv.actions[actions_n++] =3D > + priv->sh->pop_vlan_action; > + action_flags |=3D > MLX5_FLOW_ACTION_OF_POP_VLAN; > + break; > case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: > case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: > if (flow_dv_create_action_l2_encap(dev, actions, > -- > 1.8.3.1