From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00085.outbound.protection.outlook.com [40.107.0.85]) by dpdk.org (Postfix) with ESMTP id F0CE15F35 for ; Wed, 3 Oct 2018 18:14:44 +0200 (CEST) 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=dUQ1NH3kmpv00podQnmb37sleDbkrseCwM9LiCpfVlI=; b=LQ1A+vHo3cgBdelUpsBwoaOJ4CgmZn7um5/exjidbqfJqD4Iyps4/wJA7De1uQS54R/v1lrD0b3JCxPsjlHwynfgE7Y+Ek1tjDRX00Ubd7/8rX7JC09SHpdYOds9dqrukjxXBDtHhwPEPDV2076Sx8wyCUoktagEvEoRkdBAzt8= Received: from VI1PR05MB4224.eurprd05.prod.outlook.com (52.133.12.13) by VI1PR05MB3423.eurprd05.prod.outlook.com (10.170.239.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.25; Wed, 3 Oct 2018 16:14:43 +0000 Received: from VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::f911:fe8:927d:400b]) by VI1PR05MB4224.eurprd05.prod.outlook.com ([fe80::f911:fe8:927d:400b%3]) with mapi id 15.20.1207.018; Wed, 3 Oct 2018 16:14:43 +0000 From: Dekel Peled To: Yongseok Koh CC: "dev@dpdk.org" , Shahaf Shuler , Ori Kam Thread-Topic: [PATCH 4/4] net/mlx5: add DV decap L2 and L3 operations Thread-Index: AQHUVnG3K4am5DOJiUioz/vOV9a6MqUNIpWAgACYmRA= Date: Wed, 3 Oct 2018 16:14:43 +0000 Message-ID: References: <1538059845-35896-1-git-send-email-dekelp@mellanox.com> <1538059845-35896-5-git-send-email-dekelp@mellanox.com> <20181003070716.GA21743@mtidpdk.mti.labs.mlnx> In-Reply-To: <20181003070716.GA21743@mtidpdk.mti.labs.mlnx> 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; VI1PR05MB3423; 6:mVY0zKlPUjPYiwmici4fBuD+nMErtTmsxlSvZNiJenXYBNlA+onlzOTdzwUOsgx11oMlJP3YrO26rDSfE27AlveoEssX1GAZHUCxOHvh/v3GQavZaxVF2gVqyOVpZX2t7tg0/bSW+6n901CCV3S7G/+Vm0J/VIwIOgfa3LZmrZA5wfk+8s0O1xok7g4u8wSgZ+Cy5ZSU4fAvXzLeLrjdRtHsLi2GUJlJr+RB8RnNZKqFd4AUSfZoGHyHJezKSQwrRq/VTnIYxueJGHcfsHLN8v0ABX27O8m6yIh/Kf0AVT7n38xz4CxMAocQe6fUX/cJN/FpSHQeUPACrIpq4tQHz5uPOSwO6wKrF05vGqnwkMAR4J+LxFMAe+oeokWn4XVuUScvrkXb8uzDFpxPLNfDktXbCZMhD1wsMezVNblO8au2U8BdZEn7vwzpR42gN9GJMnkgZ522F4oGFJXf0eW4PQ==; 5:39Np4aoxq9nqOxWZE7us9iT9OCPK3O8bZc6kVdM4KVBPW6aKB1JnBeZAro4+AuJBFv72i4b7OjWrNgP9nYGcOXTv2GAlSEm/HONt6lKtsX5XQNWcUYESEwZ3zv8CJR+pmBCVyWliMLrKZKKqJY16lirJcQwRr8f57bUEf1M9iFI=; 7:PmdH6qAtomdfA6xpi0VAf554EX87oM/n9h7ffYE89v4VC0hD/nQ8HZMLyEbrGNEfYWoEp+d7DLpbsYRkDnwMaJARy2eHoTU5DXQQCYFTQyQpsCUl+eqRbo9/Iam90vS/1alqOSdaR0wbCJsxQbj1ZoS4CANUYDItpr+d+hCIo8EO4lgxdcIzW460bJ5w5VReuD/JHhAxZOS9ncijE7wHk2X9ekfn6zRUNRbvyVjfH6RPfG/ScMVfzSo5jepskBfG x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 19ecbb49-1f6e-4d45-cccb-08d6294b5472 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:VI1PR05MB3423; x-ms-traffictypediagnostic: VI1PR05MB3423: 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)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:VI1PR05MB3423; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB3423; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(396003)(136003)(366004)(39860400002)(13464003)(189003)(199004)(4744004)(11346002)(105586002)(476003)(446003)(25786009)(53546011)(7736002)(4326008)(305945005)(102836004)(106356001)(6506007)(26005)(186003)(229853002)(74316002)(6436002)(71190400001)(478600001)(76176011)(71200400001)(14454004)(86362001)(7696005)(14444005)(256004)(53936002)(6862004)(55016002)(9686003)(99286004)(81156014)(81166006)(8936002)(5250100002)(8676002)(107886003)(316002)(2900100001)(6246003)(97736004)(2906002)(3846002)(6116002)(486006)(54906003)(66066001)(33656002)(5660300001)(6636002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3423; 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: OPLpnR2hPI12zl/mDvWHObugZJi+JQTcphQu3wAkCVfkNZcaZMjoemnuAO0J4DxrN9fM/b3m1m/zPaKiuYQqptyR+pH7NdbRo0HlH6Rvu8ahiPXz50xLFfS7RSmaYG4Guf03u1cpE6uI2Gv3Q3Ny4K+lLDi/06yeD5UkRWa47/9JdeSf5pxvXg17l05Z8e3aJE/2p5lKz2WXfTd8Xp6Qi2qvt4hweQLIjBUUqRuZr04QWHnG5fKTL8N6EGiQWYuMEjcWnMCdO1wpETjEkWCBfjGTI+rmgCrwmEx3HWBOM31ibRzA/ijx4SksSP5h80wiSsqnYKa1Yf8Nt0SkRcoMS4te8djK7YAQNjogGVO3Ob8= 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: 19ecbb49-1f6e-4d45-cccb-08d6294b5472 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 16:14:43.4037 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3423 Subject: Re: [dpdk-dev] [PATCH 4/4] net/mlx5: add DV decap L2 and L3 operations 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: Wed, 03 Oct 2018 16:14:45 -0000 Thanks, PSB. > -----Original Message----- > From: Yongseok Koh > Sent: Wednesday, October 3, 2018 10:07 AM > To: Dekel Peled > Cc: dev@dpdk.org; Shahaf Shuler ; Ori Kam > > Subject: Re: [PATCH 4/4] net/mlx5: add DV decap L2 and L3 operations >=20 > On Thu, Sep 27, 2018 at 05:50:45PM +0300, Dekel Peled wrote: > > This patch adds support for Direct Verbs decap operations, L2 and L3. > > >=20 > Almost same code as encap, so I also have the same comments. :-) One > more. In the title, we can't use vendor specific acronyms. >=20 > net/mlx5: add DV decap L2 and L3 operations >=20 > DV -> Direct Verbs >=20 > How about something like this? > net/mlx5: add L2/L3 encap to Direct Verbs flow Done. >=20 > > Signed-off-by: Dekel Peled > > --- > > drivers/net/mlx5/mlx5_flow_dv.c | 258 > > ++++++++++++++++++++++++++++++++++++++-- > > 1 file changed, 248 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > > b/drivers/net/mlx5/mlx5_flow_dv.c index 50925ac..ca44f13 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -126,12 +126,20 @@ > > NULL, > > "can't have 2 encap actions in same" > > " flow"); > > + if (action_flags & (MLX5_ACTION_TUNNEL_DECAP | > > + MLX5_ACTION_TUNNEL_DECAP_L3)) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't encap and decap in same" > > + " flow"); > > if (attr->ingress) > > return rte_flow_error_set(error, ENOTSUP, > > - > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > - NULL, > > - "encap action not supported for " > > - "ingress"); > > + > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > + NULL, > > + "encap action not supported for " > > + "ingress"); > > return 0; > > } > > > > @@ -178,12 +186,130 @@ > > NULL, > > "can't have 2 encap actions in same" > > " flow"); > > + if (action_flags & (MLX5_ACTION_TUNNEL_DECAP | > > + MLX5_ACTION_TUNNEL_DECAP_L3)) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't encap and decap in same" > > + " flow"); > > if (attr->ingress) > > return rte_flow_error_set(error, ENOTSUP, > > - > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > - NULL, > > - "encap action not supported for " > > - "ingress"); > > + > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > + NULL, > > + "encap action not supported for " > > + "ingress"); > > + return 0; > > +} > > + > > +/** > > + * Validate the tunnel decap action > > + * > > + * @param[in] action_flags > > + * holds the actions detected until now. > > + * @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_ernno is s= et. > > + */ > > +static int > > +mlx5_flow_validate_action_tunnel_decap(uint64_t action_flags, > > + const struct rte_flow_attr *attr, > > + struct rte_flow_error *error) { > > + if (action_flags & MLX5_ACTION_DROP) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't drop and decap in same > flow"); > > + if (action_flags & (MLX5_ACTION_TUNNEL_DECAP | > > + MLX5_ACTION_TUNNEL_DECAP_L3)) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't have 2 decap actions in same" > > + " flow"); > > + if (action_flags & (MLX5_ACTION_TUNNEL_ENCAP | > > + MLX5_ACTION_TUNNEL_ENCAP_L3)) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't encap and decap in same" > > + " 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; > > +} > > + > > +/** > > + * Validate the tunnel decap L3 action > > + * > > + * @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_ernno is s= et. > > + */ > > +static int > > +mlx5_flow_validate_action_tunnel_decap_l3(uint64_t action_flags, > > + const struct rte_flow_action *action, > > + const struct rte_flow_attr *attr, > > + struct rte_flow_error *error) > > +{ > > + const struct rte_flow_action_tunnel_decap_l3 *tunnel_decap_l3 =3D > > + action->conf; > > + > > + if (!tunnel_decap_l3 || !(tunnel_decap_l3->buf)) > > + > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + action, > > + "configuration cannot be null"); > > + if (action_flags & MLX5_ACTION_DROP) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't drop and decap in same > flow"); > > + if (action_flags & (MLX5_ACTION_TUNNEL_DECAP | > > + MLX5_ACTION_TUNNEL_DECAP_L3)) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't have 2 decap actions in same" > > + " flow"); > > + if (action_flags & (MLX5_ACTION_TUNNEL_ENCAP | > > + MLX5_ACTION_TUNNEL_ENCAP_L3)) > > + return rte_flow_error_set(error, > > + ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "can't encap and decap in same" > > + " 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; > > } > > > > @@ -257,6 +383,72 @@ > > } > > > > /** > > + * Convert decap action to DV specification. > > + * > > + * @param[in] action > > + * Pointer to action structure. > > + * @param[in] ctx > > + * Verbs context. > > + * @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 * > > +mlx5_flow_dv_create_decap(const struct rte_flow_action *action > __rte_unused, > > + struct ibv_context *ctx, > > + struct rte_flow_error *error) > > +{ > > + struct ibv_flow_action *decap_verb =3D NULL; > > + > > + decap_verb =3D mlx5_glue- > >dv_create_flow_action_packet_reformat(ctx, > > + 0, NULL, > > + > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_T > O_L2, > > + MLX5DV_FLOW_TABLE_TYPE_NIC_RX); > > + if (!decap_verb) > > + rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, "cannot create decap action"); > > + return decap_verb; > > +} > > + > > +/** > > + * Convert decap L3 action to DV specification. > > + * > > + * @param[in] action > > + * Pointer to action structure. > > + * @param[in] ctx > > + * Verbs context. > > + * @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 * > > +mlx5_flow_dv_create_decap_l3(const struct rte_flow_action *action, > > + struct ibv_context *ctx, > > + struct rte_flow_error *error) { > > + struct ibv_flow_action *decap_l3_verb =3D NULL; > > + const struct rte_flow_action_tunnel_decap_l3 *decap_l3_data; > > + > > + decap_l3_data =3D > > + (const struct rte_flow_action_tunnel_decap_l3 *)action- > >conf; > > + decap_l3_verb =3D mlx5_glue- > >dv_create_flow_action_packet_reformat(ctx, > > + decap_l3_data->size, > > + decap_l3_data->size ? decap_l3_data->buf : > > + NULL, > > + > MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L3_TUNNEL_T > O_L2, > > + MLX5DV_FLOW_TABLE_TYPE_NIC_RX); > > + if (!decap_l3_verb) > > + rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, "cannot create decap L3 action"); > > + > > + return decap_l3_verb; > > +} > > + > > +/** > > * Verify the @p attributes will be correctly understood by the NIC an= d > store > > * them in the @p flow if everything is correct. > > * > > @@ -529,6 +721,25 @@ > > return ret; > > action_flags |=3D MLX5_ACTION_TUNNEL_ENCAP_L3; > > break; > > + case RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP: > > + ret =3D mlx5_flow_validate_action_tunnel_decap > > + (action_flags, > > + attr, > > + error); > > + if (ret < 0) > > + return ret; > > + action_flags |=3D MLX5_ACTION_TUNNEL_DECAP; > > + break; > > + case RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP_L3: > > + ret =3D mlx5_flow_validate_action_tunnel_decap_l3 > > + (action_flags, > > + actions, > > + attr, > > + error); > > + if (ret < 0) > > + return ret; > > + action_flags |=3D MLX5_ACTION_TUNNEL_DECAP_L3; > > + break; > > default: > > return rte_flow_error_set(error, ENOTSUP, > > > RTE_FLOW_ERROR_TYPE_ACTION, > > @@ -1320,6 +1531,30 @@ > > flow->actions |=3D MLX5_ACTION_TUNNEL_ENCAP_L3; > > actions_n++; > > break; > > + case RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP: > > + dev_flow->dv.actions[actions_n].type =3D > > + MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; > > + dev_flow->dv.actions[actions_n].action =3D > > + mlx5_flow_dv_create_decap(action, ctx, error); > > + if (!(dev_flow->dv.actions[actions_n].action)) > > + return -rte_errno; > > + dev_flow->dv.decap_verb =3D > > + dev_flow->dv.actions[actions_n].action; > > + flow->actions |=3D MLX5_ACTION_TUNNEL_DECAP; > > + actions_n++; > > + break; > > + case RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP_L3: > > + dev_flow->dv.actions[actions_n].type =3D > > + MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION; > > + dev_flow->dv.actions[actions_n].action =3D > > + mlx5_flow_dv_create_decap_l3(action, ctx, error); > > + if (!(dev_flow->dv.actions[actions_n].action)) > > + return -rte_errno; > > + dev_flow->dv.decap_verb =3D > > + dev_flow->dv.actions[actions_n].action; > > + flow->actions |=3D MLX5_ACTION_TUNNEL_DECAP_L3; > > + actions_n++; > > + break; > > default: > > break; > > } > > @@ -1679,13 +1914,16 @@ > > LIST_REMOVE(dev_flow, next); > > if (dev_flow->dv.matcher) > > flow_dv_matcher_release(dev, dev_flow- > >dv.matcher); > > - >=20 > Looks like it is a mistake on rebasing. Redundant blank line removed. >=20 > > if (dev_flow->dv.encap_verb) { > > claim_zero(mlx5_glue->destroy_flow_action > > (dev_flow->dv.encap_verb)); > > dev_flow->dv.encap_verb =3D NULL; > > } > > - > > + if (dev_flow->dv.decap_verb) { > > + claim_zero(mlx5_glue->destroy_flow_action > > + (dev_flow->dv.decap_verb)); > > + dev_flow->dv.decap_verb =3D NULL; > > + } > > rte_free(dev_flow); > > } > > } > > -- > > 1.8.3.1 > >