From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20085.outbound.protection.outlook.com [40.107.2.85]) by dpdk.org (Postfix) with ESMTP id 784524F98 for ; Mon, 29 Oct 2018 11:03:19 +0100 (CET) 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=izTgPAabXLUi1QY/ySOdspXkxPEH3pPXQNCW0i/LRT4=; b=Il97oVBJQmn72luMTV26Jw5v4LszYMA82vvuXwspjyM1S5URpujOe6QLo3k+gZE4x0uflhUGoYUSzO2tsIz8mp6yoltWGK2hv9W6jZ81Y9RD/0xRvFkPxZG8tsiLoRQXqboCq9Ar6KLwb46ZU/wpAFQLOcZy9/1JUvpBljyKe5o= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB5463.eurprd05.prod.outlook.com (20.177.192.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.27; Mon, 29 Oct 2018 10:03:18 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973%3]) with mapi id 15.20.1273.027; Mon, 29 Oct 2018 10:03:18 +0000 From: Shahaf Shuler To: Dekel Peled , Yongseok Koh CC: "dev@dpdk.org" , Ori Kam Thread-Topic: [dpdk-dev] [PATCH v6 3/6] net/mlx5: add VXLAN decap action to Direct Verbs Thread-Index: AQHUbJ6qhavlG7qy4ki85EZwk4eGTqU14/lA Date: Mon, 29 Oct 2018 10:03:18 +0000 Message-ID: References: <1539259967-10975-1-git-send-email-dekelp@mellanox.com> <1540498108-18358-4-git-send-email-dekelp@mellanox.com> In-Reply-To: <1540498108-18358-4-git-send-email-dekelp@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=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB5463; 6:iZBCIV34M/WMUrAf5gZA4pYzHeUzlgZtB9tZx3hC/2GpJ6HRHnIRniLTGguaGMcpGFi60fPxk4obt+0MelA4Ur2XhUaA1YLueSj9zqZeyApJblg0msW9jmBlzjPOTwtVPmXp48JWqg1TJhFyWM0bTEd1ZSyjRw4+nYs/mfgrZ87WJ8K2498O73zxjLXCyaV85eERpZc6wFyUqi5pRSkmSLbh9/uZjHV3dO92gMv9TiABOkjiJNoWAxtPdRan/EQJgcv1+4caEyOv7s2sqO6ZE93G9Ck3sSh4oJjcMCx/Cx8gGZL07QiyXMy4A8cOfeiAOTnYCFahOq0rHS1QdRS3sHAa332Hg+3QrXW83iHpU6QRqJO3o9wmd4aci+NmQbFGo4L8kLyTg0YPcuO628kCxz+n3ig92IawBgyQu+99+z1KH48mGqxiPu60v2CZHEq50jLcUen+HV8Az1B04+R5IQ==; 5:dUjx9c77Om7tp2QaP07U6GOqzu01GiCdjOwVrDxwkNl3Hxneg+GYqGRZaTLO75XtZnHgevXaZVr+xPAZe30k0zhtz+Hhlj0WmC5L3Z/bqsEnfWEM2RHGTYz9v7Ha87nKQ1WTUc5CK32wp1H7vjqfXTwGISJIceyQgSI5uLnnQ0c=; 7:QFMdbOOOzVgrK/V+HNKfJibi52JbOF/3APKyLaQZxMbNPNi2pcUUNcXrq2Scf8M0RmzDxAu0YU2WaYGco1Oew2IQm3qXCNvHzEQpMTFR8yZ1p+iM40FKRxTFu2W/3e6xRppNjZ/mkU1CAPa5r1xUig== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 37fdec68-a14c-4ccb-3162-08d63d85c024 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB5463; x-ms-traffictypediagnostic: DB7PR05MB5463: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231382)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB5463; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB5463; x-forefront-prvs: 084080FC15 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(136003)(346002)(396003)(39860400002)(366004)(199004)(189003)(229853002)(26005)(7696005)(6506007)(5250100002)(76176011)(2900100001)(186003)(55016002)(4326008)(6436002)(256004)(14454004)(14444005)(97736004)(478600001)(2906002)(81166006)(81156014)(74316002)(66066001)(8936002)(86362001)(68736007)(110136005)(305945005)(106356001)(6246003)(9686003)(105586002)(476003)(53936002)(7736002)(54906003)(11346002)(446003)(6636002)(25786009)(6116002)(3846002)(5660300001)(102836004)(33656002)(486006)(71190400001)(107886003)(71200400001)(316002)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5463; H:DB7PR05MB4426.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-microsoft-antispam-message-info: uirXiUzjsEB1InUq1z5bkJYuMCClRlapF9BYjFrRBIyH3kAkhJ6jHsxi5SHzZ30h+pYLx3BTfiWofQMk37k8ijCyFppkDu7LU0R1qhJh3OlsK00CBtyOl+8JFDTPAeq73JmS/P8g6wcFcS47ieIciYxmc4MAHnVe7WKfHreo1sEdMG9ctH4m+OfXsdefkHTg5C9cFz4fLLjk7bpdTC6mfw9Uxl5V7izG0NrYDoRe7jHU9L0T9IMA5j1meOBzTw+p/O51B0GyxdUkKQTd5BXjmvHZuE/RvaU6Ii19WIo0Ax5eRWaB/7U5fOai796XnN8MIEs8LgGaD6G/z8Vd7F87BVXJMOQaT5dHllf2ciTnj98= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 37fdec68-a14c-4ccb-3162-08d63d85c024 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Oct 2018 10:03:18.1605 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5463 Subject: Re: [dpdk-dev] [PATCH v6 3/6] net/mlx5: add VXLAN decap action to Direct Verbs 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: , X-List-Received-Date: Mon, 29 Oct 2018 10:03:19 -0000 Thursday, October 25, 2018 11:08 PM, Dekel Peled: > Subject: [dpdk-dev] [PATCH v6 3/6] net/mlx5: add VXLAN decap action to > Direct Verbs >=20 > This patch implements the VXLAN decap action in DV flow for MLX5 PMD. >=20 > Signed-off-by: Dekel Peled > --- > drivers/net/mlx5/mlx5_flow.h | 1 + > drivers/net/mlx5/mlx5_flow_dv.c | 103 > ++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 100 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 6e92afe..3795644 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -93,6 +93,7 @@ > #define MLX5_FLOW_ACTION_SET_MAC_SRC (1u << 20) #define > MLX5_FLOW_ACTION_SET_MAC_DST (1u << 21) #define > MLX5_FLOW_ACTION_VXLAN_ENCAP (1u << 22) > +#define MLX5_FLOW_ACTION_VXLAN_DECAP (1u << 23) >=20 > #define MLX5_FLOW_FATE_ACTIONS \ > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | > MLX5_FLOW_ACTION_RSS) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index 14110c5..e84a2b6 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -131,11 +131,12 @@ > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > "can't drop and encap in same > flow"); > - if (action_flags & MLX5_FLOW_ACTION_VXLAN_ENCAP) > + if (action_flags & (MLX5_FLOW_ACTION_VXLAN_ENCAP | > + MLX5_FLOW_ACTION_VXLAN_DECAP)) > return rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > - "can only have a single encap" > - " action in a flow"); > + "can only have a single encap or" > + " decap action in a flow"); > if (attr->ingress) > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, @@ -146,6 +147,47 @@ } >=20 > /** > + * Validate the L2 decap action. > + * Used for VXLAN decap action. Same like before > + * > + * @param[in] action_flags > + * Holds the actions detected until now. > + * @param[in] action > + * Pointer to the decap action. > + * @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_l2_decap(uint64_t action_flags, > + const struct rte_flow_action *action __rte_unused, > + const struct rte_flow_attr *attr, > + struct rte_flow_error *error) > +{ > + if (action_flags & MLX5_FLOW_ACTION_DROP) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "can't drop and decap in same > flow"); > + if (action_flags & (MLX5_FLOW_ACTION_VXLAN_ENCAP | > + MLX5_FLOW_ACTION_VXLAN_DECAP)) > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > + "can only have a single encap or" > + " decap action in a flow"); > + if (attr->egress) > + return rte_flow_error_set(error, ENOTSUP, > + > RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, > + NULL, > + "decap action not supported for " > + "egress"); > + return 0; > +} > + > +/** > * Get the size of specific rte_flow_item_type > * > * @param[in] item_type > @@ -396,6 +438,38 @@ > } >=20 > /** > + * Convert L2 decap action to DV specification. > + * Used for VXLAN decap action. Same=20 > + * > + * @param[in] dev > + * Pointer to rte_eth_dev structure. > + * @param[in] action > + * Pointer to action structure. > + * @param[out] error > + * Pointer to the error structure. > + * > + * @return > + * Pointer to action on success, NULL otherwise and rte_errno is set. > + */ > +static struct ibv_flow_action * > +flow_dv_create_action_l2_decap(struct rte_eth_dev *dev, > + const struct rte_flow_action *action __rte_unused, > + struct rte_flow_error *error) > +{ > + struct ibv_flow_action *verbs_action =3D NULL; > + struct priv *priv =3D dev->data->dev_private; > + > + verbs_action =3D mlx5_glue- > >dv_create_flow_action_packet_reformat > + (priv->ctx, 0, NULL, > + > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2, > + MLX5DV_FLOW_TABLE_TYPE_NIC_RX); > + if (!verbs_action) > + rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > + NULL, "cannot create L2 decap action"); > + return verbs_action; > +} > + > +/** > * Verify the @p attributes will be correctly understood by the NIC and = store > * them in the @p flow if everything is correct. > * > @@ -648,7 +722,15 @@ > action_flags |=3D > MLX5_FLOW_ACTION_VXLAN_ENCAP; > ++actions_n; > break; > - > + case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: > + ret =3D > flow_dv_validate_action_l2_decap(action_flags, > + actions, attr, > + error); > + if (ret < 0) > + return ret; > + action_flags |=3D > MLX5_FLOW_ACTION_VXLAN_DECAP; > + ++actions_n; > + break; > default: > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ACTION, > @@ -1435,6 +1517,19 @@ > flow->actions |=3D MLX5_FLOW_ACTION_VXLAN_ENCAP; > actions_n++; > break; > + case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: > + dev_flow->dv.actions[actions_n].type =3D > + MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; > + dev_flow->dv.actions[actions_n].action =3D > + flow_dv_create_action_l2_decap(dev, > action, > + error); > + if (!(dev_flow->dv.actions[actions_n].action)) > + return -rte_errno; > + dev_flow->dv.verbs_action =3D > + dev_flow->dv.actions[actions_n].action; > + flow->actions |=3D MLX5_FLOW_ACTION_VXLAN_DECAP; > + actions_n++; > + break; > default: > break; > } > -- > 1.8.3.1