From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50053.outbound.protection.outlook.com [40.107.5.53]) by dpdk.org (Postfix) with ESMTP id 492D01F1C for ; Mon, 29 Oct 2018 17:46:13 +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=Bkx8GpwmPOJuYFVSBOBYRp8Zmoa8U3Fo9cmlEf0fK0w=; b=SNbIGZs85fpxYYTvEJ/7KKMKOj/mprUXQOrzS2cLS1g/rgkmrgjBm5id1Nv9xIj33OvOfumk2vlMuZGwiXz40UjqMo7WxN46z54wO2tTAEpnentw+9bDKyxq7I5OUyZ9h4Kv5o6RbidVCLgDHTf2u4aUBRC+UIctTaavs+8mOhQ= Received: from VI1PR05MB4224.eurprd05.prod.outlook.com (52.133.12.13) by VI1SPR01MB023.eurprd05.prod.outlook.com (52.134.18.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.24; Mon, 29 Oct 2018 16:46:12 +0000 Received: from VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::345d:803:9e2:679c]) by VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::345d:803:9e2:679c%4]) with mapi id 15.20.1273.027; Mon, 29 Oct 2018 16:46:12 +0000 From: Dekel Peled To: Shahaf Shuler , 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: AQHUbJ6qNXa4AwodsUieIGLO+8cwB6U2A/0AgABwOdA= Date: Mon, 29 Oct 2018 16:46:11 +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: 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=dekelp@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1SPR01MB023; 6:W0Cy744hfGHdo0+5FeNrqx/hIYEM9TIuw10dNIkO3T0yXCP7eCmZE647CzbUdXQ10wCxpk4uTB6BUQO3d0vj6SnMYep8YwYuLbktY1MNSd/pceI81htpjXCK+H12Pz1NrhYE3QfEdfKkuFTzZ6zajYfXQRt42Smj9ucCfJL4TTEBqskLRA7+AsrsUD6jBlAkMBhMk0W9+dqKqrE3EYT/DAEShV/d0xv/OchkQH0WX6mZC0713FrbcB2lnIdAROUbkJVdzWSlNolDOs/YxRn/o+7WWc/e79zZJKl/c0nutyHv3fD7TUaPmHSzTUc64rkRt0pX8QUvDN6OFJSlqWAU2UYp1DvjE7m8HRydQwy6o8LWInDLcI657tLQ5h58fLIeiwXpHQppkSBYvRMK3GZJfrzgd4/mx/M2jYr2xgbVo0uLGSk4ld95c2eD5PazD37ko2yeECWQO0BWeRwkDs6meQ==; 5:CmcSYFgp0p/6XJgqwUS/dio50cEAgWxhbOmcKt6YfxNXKFvopy/6/xjswMG7gKKq552mGcd4w0XsTv/To2jCmXUgMa/C54Mh4WEm0LhdI8Zu7U5WH6jDgn6Q0/X2r0Q9FNz0zPY64KlJfw/O89cgA2pWDXfs3qyb7+AUjGkDeuw=; 7:ywiu83E4ReNYRkTRRnEnw1sWv9lcRIqPZKgLB4gzAVh3iI3OQvR8htPlhkWC4oOPxx3md6/vEq1wgHmimYFi34Cs+shwrj8NYocr5A7Y/l8X2Nh6zkUzl1/MR3pCiv/cfc1/QZEII1K4pZlmBWujvQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 9bb65ac4-39a3-4d2f-05c5-08d63dbe08db 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:VI1SPR01MB023; x-ms-traffictypediagnostic: VI1SPR01MB023: 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)(8121501046)(5005006)(3002001)(10201501046)(3231382)(944501410)(52105095)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:VI1SPR01MB023; BCL:0; PCL:0; RULEID:; SRVR:VI1SPR01MB023; x-forefront-prvs: 084080FC15 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(136003)(346002)(376002)(366004)(189003)(199004)(13464003)(53936002)(11346002)(5250100002)(86362001)(9686003)(99286004)(6636002)(53546011)(25786009)(4326008)(476003)(6506007)(2906002)(33656002)(486006)(76176011)(7696005)(446003)(102836004)(186003)(229853002)(105586002)(106356001)(26005)(8936002)(478600001)(2900100001)(6116002)(3846002)(316002)(6436002)(66066001)(81156014)(81166006)(68736007)(14444005)(54906003)(110136005)(97736004)(256004)(14454004)(107886003)(6246003)(71200400001)(55016002)(71190400001)(74316002)(305945005)(7736002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1SPR01MB023; H:VI1PR05MB4224.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-microsoft-antispam-message-info: 8WLYkh40bjXvXKQcEecQsDXq0JE/FU0W3TcZ9SBFCzAX4iBglbdRZ3QDbUd20GVLBz9AvPWzByvUU7QlwYw6toh0f7igCVAfoAzHslkJewl+v6eaFJRHJOC3QzkfTESDzWe3vczpkcgJ1NnnzvgcXFa8xxZos0707fKzITF62LJPtFE03vbZYVQENUQhrr4K3B3/P7IW1ct3wVhWNLIU5+fJZp7d2ELue5aqreLipgSMCLWcIKR3cJPsVdbeGcZxwPV5NDhX1fkLZkhAXVHVgmE2TCaGa+66skaEYy5BpiTN9O3AW7OXAHjShTGYk4t8hCT6iv+CQN4rF3PNh6cOQrWINXYde8zF1AKKxLWk4YU= 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: 9bb65ac4-39a3-4d2f-05c5-08d63dbe08db X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Oct 2018 16:46:12.0115 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1SPR01MB023 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 16:46:13 -0000 Thanks, PSB. > -----Original Message----- > From: Shahaf Shuler > Sent: Monday, October 29, 2018 12:03 PM > To: Dekel Peled ; Yongseok Koh > > Cc: dev@dpdk.org; Ori Kam > Subject: RE: [dpdk-dev] [PATCH v6 3/6] net/mlx5: add VXLAN decap action t= o > Direct Verbs >=20 > 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 > > > > This patch implements the VXLAN decap action in DV flow for MLX5 PMD. > > > > 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(-) > > > > 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) > > > > #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, > > > > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, @@ -146,6 +147,47 @@ } > > > > /** > > + * Validate the L2 decap action. > > + * Used for VXLAN decap action. >=20 > Same like before I will remove it. >=20 > > + * > > + * @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 s= et. > > + */ > > +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 @@ > > } > > > > /** > > + * Convert L2 decap action to DV specification. > > + * Used for VXLAN decap action. >=20 > Same I will remove it. >=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 an= d > 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, > > > > 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