From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8518DA0C4D; Tue, 12 Oct 2021 23:23:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4707B410DA; Tue, 12 Oct 2021 23:23:22 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2070.outbound.protection.outlook.com [40.107.236.70]) by mails.dpdk.org (Postfix) with ESMTP id 81C054003C for ; Tue, 12 Oct 2021 23:23:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LJ3dX+VW6Ww00IjH5qORQuv8cM/CJ9e2OjOn8MlUEpFwZOzHsOH7Me3mRMRra39a9lC+elj3mRfnxEzZ2Mf1AU3HcabNyk8fmsCsU8OKrw723QIuP2loBBQxukQVT5TjtuqANpgKn/+jkBINg9X+UwWgVDZrAlJ2LV1BeleGXn+0/oyFx63NQTdkpSuNMfcr/R81Kg4vnbucGsRo7S242V4lXS/vbQxpPkanq7IUpo0YiWV7TyGXOP1+COgv0R/206EwkTVbANgv840InS+31RR86FbmOgp3l2Aum11/Aqo2hA1IG6NJxv83UjPHVMYX6Ep3DyPvVfAx+BhaVKy2Zg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R5g0mEDnMV1hyMJOG5DYqFoGeCveFPdHlIUZdxtWxXo=; b=dxEFM9XxIwUCp+pi+krVG+0cEIwAjs+ec3tDedv3XQH2gWVFZYvdYkuo/q2h4bh7XjIkGVrTauSd/2VBsKJq3ShTL3lXWahcDl83ThnH0WBh5C0KeY2TPMx65TAcBSgBn9Mw3KzOllk868Xc35LWk4Xl4bg568efATQUkVBym+yVNHbr8AvRsVZdW4LVXI3B22lsdAxzoxcRobr8s/K0h5W6SZFYPyVsN9wvt4s/TLoTvF6FziiBNdYzRRQVx84DHxfgZcTuHKSSyEPM0W5RXBV2mG/Ls6gAtferzg+0epW8Z0YY70HIuHpyLfGUrNV7qDvRjO1168hdmms48UixQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R5g0mEDnMV1hyMJOG5DYqFoGeCveFPdHlIUZdxtWxXo=; b=ZjbRYnQDhRK9p3Eu00j3WwCneIYkFVjKK0joawOP5H0aXY0Mfg0ofegzlkMUWjCvVVC0T+FxHfZtusvFrFWK1urwHWIWjtLhu5l/NZ8p04FzfmXvGrxJ13jf0XoJaCh5JW5r7uWIQtPSXYwS54U8TkNqxAIRMk8VgAdeFP5Ko3dcQx4veOiB54FwtzMsoGMz9zzFJ+0tLvESQ7kZ1W82COSROD9KaCdchgtWWwqHny1uBdvL1JvYa7FSlJrEJpPJg9oLUuuzavcleZvq6+PxHpsrr6FpusOLf8xqiFxMiMvZbPm0p20u93pcyAX8uWVeZsUkEyiRGHhN1kA8eViSSg== Received: from DM6PR12MB3753.namprd12.prod.outlook.com (2603:10b6:5:1c7::18) by DM5PR12MB1916.namprd12.prod.outlook.com (2603:10b6:3:112::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.24; Tue, 12 Oct 2021 21:23:15 +0000 Received: from DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::e550:35a2:96e5:657f]) by DM6PR12MB3753.namprd12.prod.outlook.com ([fe80::e550:35a2:96e5:657f%4]) with mapi id 15.20.4587.026; Tue, 12 Oct 2021 21:23:15 +0000 From: Slava Ovsiienko To: Ivan Malov , "dev@dpdk.org" CC: NBU-Contact-Thomas Monjalon , Ori Kam , Andrew Rybchenko , Matan Azrad Thread-Topic: [PATCH v3 10/12] net/mlx5: support represented port flow action Thread-Index: AQHXveS3e5CWw1lnR0yR289yUZ/xV6vP4hsA Date: Tue, 12 Oct 2021 21:23:15 +0000 Message-ID: References: <20211001134716.1608857-1-andrew.rybchenko@oktetlabs.ru> <20211010143930.4985-1-ivan.malov@oktetlabs.ru> <20211010143930.4985-11-ivan.malov@oktetlabs.ru> In-Reply-To: <20211010143930.4985-11-ivan.malov@oktetlabs.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f5d226aa-4fbf-4054-70c6-08d98dc68102 x-ms-traffictypediagnostic: DM5PR12MB1916: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zAaN9sjW2DmTMpgOUBylrgFR0ekvLkgRRUu6F1A+U/hNJL2A/h7tBeBfu7WHWnirmhn+dyCiwC/76BPIbYmGM/hBm83cvi4NYstB69IsuIFuU042seveaM3GCNliR+Ua7kchwdEe3gCu94n1uNisUHqFVpTbL6itYISA92NjzDKXE+SNWyE9BK0XfSuGypFC40gAG7OG+Q/szzEh5FCJipJAwgrhHFgBzCL6zL6PEPw+b1gtevbL9qdWd68TnAL6IRzRE1lqq/mU1wHzHa++rDjPdkoSoTxIjcTdRzZNHBmRunb2MawVZGLscxe2yns+6BBoZ4sMV5TvWc9tjdl7KXn8XweEWn5COYF0SOjpTkJnrOxpLdUsUC9IEFJX+Uvhrsbs5HYaluDs0LdYMk8MpixvzvtdLyfLPeQP3Y+MAgNeY3lPDnwGJBnS06RYbfsfxf56Bt7MrR9keGOS2vjkxA9PLdc5Kg2qafmzZaAfY3Nm/OO733q4WVsoW7XLV6inK08MwXayvAZ4MhXvao0UMC6eM6pcMLKTWV4XtZGQ+l4Nlkml1g0chkTlMRCYO2ncGLlygBcI/lEglo9/4zCGGg2nYp6JWJV1ZtqUY7e6oP8UoEec2L7Evmom2ZxDYTM3vq8SeVdzYW2qfFThRyt3wkS88s9XwJJSaUXJ8z8hKijEwYYEI0k8yRn+c+kG9rVrZoXDc1O3kqsi5Xi46UDWPLCl3NQTaogFSj/uUlyHtek= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3753.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66446008)(66476007)(66556008)(66946007)(122000001)(4326008)(38070700005)(53546011)(71200400001)(76116006)(9686003)(8936002)(55016002)(8676002)(86362001)(38100700002)(64756008)(186003)(52536014)(54906003)(26005)(6506007)(508600001)(33656002)(110136005)(7696005)(83380400001)(316002)(2906002)(5660300002)(107886003)(21314003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Yn1VxUDL/XL1Rukm4y05DJ6Dj7rsonuwAi6UwhlFgpXE7EHbx0equDRzW+cc?= =?us-ascii?Q?pLf2u8cYrcG4jjeAbx7c6wlqwaSlm5SOlJwqa6prdrRRK8WN4IzNmtDxnVzK?= =?us-ascii?Q?UzhCGUQTpVm6dgEAv3VHAzK5Y+dCFd8VFI30a2EWye4cFaKJi3EKNGWB+ztK?= =?us-ascii?Q?tuYvrYpjpJOjcHw+S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O?= =?us-ascii?Q?0JzDtuZhgBOQ+FN5DmIg4ADeHLWCnyAxX/eguxbFwyN4dR7WMWm6XQU8jVST?= =?us-ascii?Q?mI0BLh8sh0EDODuwlr159d7ratPutjCuHhfk4elv95Y4UuttPBcNxFDWxrAX?= =?us-ascii?Q?5EZCcssyWJ1X8LvECq7fxVCFwKpPeMkdvjffAVZjUXluvhvwMpQTutvvzLBH?= =?us-ascii?Q?l5Nz0hKx/4H/Kao+5BSQCKjmc/AVnmUgyVHBFvCNDDWzJfduBucuKnu4l1mL?= =?us-ascii?Q?d1k=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3753.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5d226aa-4fbf-4054-70c6-08d98dc68102 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2021 21:23:15.6208 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Up+nnKXFJKzLsMz9+aqnJ0u5sKexXHbciTiJ87cPjm98qLX857vsJ/x3p5g4WHXqRTVF9enBmgbX1RtF7GA2gA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1916 Subject: Re: [dpdk-dev] [PATCH v3 10/12] net/mlx5: support represented port flow action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Hi, Ivan > -----Original Message----- > From: Ivan Malov > Sent: Sunday, October 10, 2021 17:39 > To: dev@dpdk.org > Cc: NBU-Contact-Thomas Monjalon ; Ori Kam > ; Andrew Rybchenko ; > Matan Azrad ; Slava Ovsiienko > > Subject: [PATCH v3 10/12] net/mlx5: support represented port flow action >=20 > From: Andrew Rybchenko >=20 > Semantics of the existing support for action PORT_ID suggests that suppor= t > for equal action REPRESENTED_PORT be implemented. >=20 > Helper functions keep port_id suffix since action > MLX5_FLOW_ACTION_PORT_ID is still used internally. >=20 > Signed-off-by: Andrew Rybchenko > --- > doc/guides/nics/mlx5.rst | 4 +-- > drivers/net/mlx5/mlx5_flow_dv.c | 62 ++++++++++++++++++++++++++------- > 2 files changed, 52 insertions(+), 14 deletions(-) >=20 > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index > bae73f42d8..b76e979f47 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -431,8 +431,8 @@ Limitations > - yellow: NULL or END. > - RED: DROP / END. > - The only supported meter policy actions: > - - green: QUEUE, RSS, PORT_ID, JUMP, DROP, MARK and SET_TAG. > - - yellow: QUEUE, RSS, PORT_ID, JUMP, DROP, MARK and SET_TAG. > + - green: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, MARK > and SET_TAG. > + - yellow: QUEUE, RSS, PORT_ID, REPRESENTED_PORT, JUMP, DROP, > MARK and SET_TAG. > - RED: must be DROP. > - Policy actions of RSS for green and yellow should have the same > configuration except queues. > - meter profile packet mode is supported. > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index c6370cd1d6..835cc5018c 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -5048,14 +5048,14 @@ flow_dv_validate_action_jump(struct > rte_eth_dev *dev, } >=20 > /* > - * Validate the port_id action. > + * Validate action PORT_ID / REPRESENTED_PORT. > * > * @param[in] dev > * Pointer to rte_eth_dev structure. > * @param[in] action_flags > * Bit-fields that holds the actions detected until now. > * @param[in] action > - * Port_id RTE action structure. > + * PORT_ID / REPRESENTED_PORT action structure. > * @param[in] attr > * Attributes of flow that includes this action. > * @param[out] error > @@ -5072,6 +5072,7 @@ flow_dv_validate_action_port_id(struct > rte_eth_dev *dev, > struct rte_flow_error *error) > { > const struct rte_flow_action_port_id *port_id; > + const struct rte_flow_action_ethdev *ethdev; > struct mlx5_priv *act_priv; > struct mlx5_priv *dev_priv; > uint16_t port; > @@ -5080,13 +5081,13 @@ flow_dv_validate_action_port_id(struct > rte_eth_dev *dev, > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, > - "port id action is valid in transfer" > + "port action is valid in transfer" > " mode only"); > if (!action || !action->conf) > return rte_flow_error_set(error, ENOTSUP, >=20 > RTE_FLOW_ERROR_TYPE_ACTION_CONF, > NULL, > - "port id action parameters must be" > + "port action parameters must be" > " specified"); > if (action_flags & (MLX5_FLOW_FATE_ACTIONS | > MLX5_FLOW_FATE_ESWITCH_ACTIONS)) @@ - > 5100,13 +5101,26 @@ flow_dv_validate_action_port_id(struct rte_eth_dev > *dev, >=20 > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > NULL, > "failed to obtain E-Switch info"); > - port_id =3D action->conf; > - port =3D port_id->original ? dev->data->port_id : port_id->id; > + switch (action->type) { > + case RTE_FLOW_ACTION_TYPE_PORT_ID: > + port_id =3D action->conf; > + port =3D port_id->original ? dev->data->port_id : port_id->id; > + break; > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > + ethdev =3D action->conf; > + port =3D ethdev->port_id; > + break; > + default: I would add MLX5_ASSERT(false) here. It is not supposed to call flow_dv_validate_action_port_id() for other acti= on types but PORT_xxx only. > + return rte_flow_error_set > + (error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, action, > + "unknown E-Switch action"); > + } > act_priv =3D mlx5_port_to_eswitch_info(port, false); > if (!act_priv) > return rte_flow_error_set > (error, rte_errno, > - RTE_FLOW_ERROR_TYPE_ACTION_CONF, > port_id, > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, > action->conf, > "failed to obtain E-Switch port id for port"); > if (act_priv->domain_id !=3D dev_priv->domain_id) > return rte_flow_error_set > @@ -5669,6 +5683,7 @@ flow_dv_validate_action_sample(uint64_t > *action_flags, > ++actions_n; > break; > case RTE_FLOW_ACTION_TYPE_PORT_ID: > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > ret =3D flow_dv_validate_action_port_id(dev, > sub_action_flags, > act, > @@ -7296,6 +7311,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const > struct rte_flow_attr *attr, > case RTE_FLOW_ACTION_TYPE_VOID: > break; > case RTE_FLOW_ACTION_TYPE_PORT_ID: > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > ret =3D flow_dv_validate_action_port_id(dev, > action_flags, > actions, > @@ -10770,12 +10786,12 @@ flow_dv_tag_release(struct rte_eth_dev *dev, > } >=20 > /** > - * Translate port ID action to vport. > + * Translate action PORT_ID / REPRESENTED_PORT to vport. > * > * @param[in] dev > * Pointer to rte_eth_dev structure. > * @param[in] action > - * Pointer to the port ID action. > + * Pointer to action PORT_ID / REPRESENTED_PORT. > * @param[out] dst_port_id > * The target port ID. > * @param[out] error > @@ -10792,10 +10808,28 @@ flow_dv_translate_action_port_id(struct > rte_eth_dev *dev, { > uint32_t port; > struct mlx5_priv *priv; > - const struct rte_flow_action_port_id *conf =3D > - (const struct rte_flow_action_port_id *)action->conf; >=20 > - port =3D conf->original ? dev->data->port_id : conf->id; > + switch (action->type) { > + case RTE_FLOW_ACTION_TYPE_PORT_ID: { > + const struct rte_flow_action_port_id *conf; > + > + conf =3D (const struct rte_flow_action_port_id *)action->conf; > + port =3D conf->original ? dev->data->port_id : conf->id; > + break; > + } > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: { > + const struct rte_flow_action_ethdev *ethdev; > + > + ethdev =3D (const struct rte_flow_action_ethdev *)action->conf; > + port =3D ethdev->port_id; > + break; > + } > + default: I would add MLX5_ASSERT(false) here as well. With best regards, Slava > + return rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ACTION, > action, > + "unknown E-Switch action"); > + } > + > priv =3D mlx5_port_to_eswitch_info(port, false); > if (!priv) > return rte_flow_error_set(error, -rte_errno, @@ -11634,6 > +11668,7 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev, > break; > } > case RTE_FLOW_ACTION_TYPE_PORT_ID: > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > { > struct mlx5_flow_dv_port_id_action_resource > port_id_resource; > @@ -12714,6 +12749,7 @@ flow_dv_translate(struct rte_eth_dev *dev, > case RTE_FLOW_ACTION_TYPE_VOID: > break; > case RTE_FLOW_ACTION_TYPE_PORT_ID: > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > if (flow_dv_translate_action_port_id(dev, action, > &port_id, error)) > return -rte_errno; > @@ -15475,6 +15511,7 @@ __flow_dv_create_domain_policy_acts(struct > rte_eth_dev *dev, > break; > } > case RTE_FLOW_ACTION_TYPE_PORT_ID: > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > { > struct mlx5_flow_dv_port_id_action_resource > port_id_resource; > @@ -17683,6 +17720,7 @@ flow_dv_validate_mtr_policy_acts(struct > rte_eth_dev *dev, > NULL, "too many actions"); > switch (act->type) { > case RTE_FLOW_ACTION_TYPE_PORT_ID: > + case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: > if (!priv->config.dv_esw_en) > return -rte_mtr_error_set(error, > ENOTSUP, > -- > 2.20.1