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 E855AA0350; Wed, 1 Jul 2020 15:55:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 744481D160; Wed, 1 Jul 2020 15:55:53 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50040.outbound.protection.outlook.com [40.107.5.40]) by dpdk.org (Postfix) with ESMTP id 4D8161C1E1 for ; Wed, 1 Jul 2020 15:55:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KuRWjFoZx4x6Xk8e6B3BFA3dziOAhbbod6g/L4d2NRCdzNWhK3AQUHR4p8abSFLE47YUwO+Nl4DZKGguarzX1PeLRM+c+wjz8rbk8nm4hcJGpNrSN3cxb4mC+kFnmAC6tN2yUe2FAOz0Xpf7gJqY5cr/GPee7G13+fJoEfPD5XQ+PCkpodFpM/ra5+MA+ivSWtAX0E7DcuJyTtyxZ87TN/Q0zxryImucYskiyGj8GQhT2MWDrliLWW0fx9Oy58fCHwlPoNX2+vq39pHq9IOSvQRFdQgnAN6322oLSQv20EH6FRzSsp4iBfvXwS5dd4spsD7AqK3SukVK+gb+HX5s/g== 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=n0Q2BP35ahaYcph0BdZpK+zFJi5r1mqC/eGhJUKcvn4=; b=MwEXMDqvk1VrA2srAryp8jXttVLLcb+s4GEr+6RsmR/aWyDZ+mrfaSWSJj9yKcKZSGwWClqcEnVu2vbu0OxuT3qOBcdTgVJfi3t3IT5m1XUxBJ6uM+XhUA6ATZnsaJnHAWykLqUBNqVMT2T2juCaHghJbSTtvZlgCGjerhqvG2MvrAt+rWbN3Loes/1AJlj+0oZwB6Wq6BoROhydTkmSz/AOA59QjvWrhWNvi+/cpizxkYSQueqpximeOdTsjmh5D9pJq+OGWdw1Wab8Z1oodGM6FlLsJHZmK8qFs7wd+i1i3mRcAemN+iiRGZj+nNOdobjtpUEcXaDuqBuSzCkzYA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n0Q2BP35ahaYcph0BdZpK+zFJi5r1mqC/eGhJUKcvn4=; b=ZNWfo7OhcPaXMgwKtjSP/vEaYz+d3h9eAa74ZE0fbKEHnNzRXqrbZQuTiMZfshZQ3soMvdTf5dvZXzdvT7Zrw+y9rEjVIlq2SG/8FuwNKAXkOQJFj/ra5vjjPq8GB//zzvPykrSCFgi+1iF/MEN+aXxYZT41p5t6nM3NUa6UNEg= Received: from VI1PR05MB3133.eurprd05.prod.outlook.com (2603:10a6:802:19::14) by VI1PR05MB5934.eurprd05.prod.outlook.com (2603:10a6:803:e6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21; Wed, 1 Jul 2020 13:55:47 +0000 Received: from VI1PR05MB3133.eurprd05.prod.outlook.com ([fe80::f042:8394:8c25:a10b]) by VI1PR05MB3133.eurprd05.prod.outlook.com ([fe80::f042:8394:8c25:a10b%3]) with mapi id 15.20.3153.022; Wed, 1 Jul 2020 13:55:47 +0000 From: "Jiawei(Jonny) Wang" To: Ori Kam , Slava Ovsiienko , Matan Azrad CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh , "ian.stokes@intel.com" , "fbl@redhat.com" Thread-Topic: [PATCH 4/8] net/mlx5: add the validate sample action Thread-Index: AQHWSxDDc/hvgBDE1UG7pOFFObvS6KjxekeAgAFMMnA= Date: Wed, 1 Jul 2020 13:55:46 +0000 Message-ID: References: <1593102379-400132-1-git-send-email-jiaweiw@mellanox.com> <1593102379-400132-5-git-send-email-jiaweiw@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [27.38.113.38] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 18e90583-eef0-495d-1063-08d81dc6749f x-ms-traffictypediagnostic: VI1PR05MB5934: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:605; x-forefront-prvs: 04519BA941 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EXlsYD58TCg9RM1aTIJNPf7h0qAZmLEMloZt5wgsdWiLrWtcnhQpXBII+VQQmh1eSN9vAEkq7pr3hOkGvwPMsMQz+PaXD1IRA8z3rBWfWN1EAzu2zCUfnEbeJ4xhnc8VWopzS7HQaAKnIbA7wBuWDkpO+xMTpJbqJa97Rn1XrXYYvIlBMWH6mZZOWUKxm+RXMp61XKs4DvJ3/JBafwmAwLQt7L3fr71uCIIUWdMwz0oyvgJ+7S4ERZB1CgxKjXWTslOzTWpOkcEERDx9mOzi9POzNNrSUDmJ8ZoQfPWNBIHmBxM2x2mWeOC1XphBrQqSbvVg1jKX24h+E73VQraYVA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR05MB3133.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(39860400002)(136003)(346002)(396003)(376002)(110136005)(6636002)(54906003)(2906002)(8936002)(4326008)(9686003)(15650500001)(316002)(8676002)(33656002)(52536014)(55016002)(5660300002)(83380400001)(86362001)(7696005)(71200400001)(66476007)(26005)(66946007)(66446008)(76116006)(186003)(6506007)(53546011)(64756008)(478600001)(66556008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: /gulBInCiKoNn2vAFEKel6PTbZHPhNhh21pnXZVU4w0Q1TJM94LUGiRfrbdL5o6PuLxvZ7ohr48sgK91umkfGxSEveQA485BQJFI1FIQoWd3mar10ikq8bAnq/Eck+2MgJkBzPQXKylwTl/m0Ute53qs8E9ufmiO8Y2PGvGXceFrJHvjif1E45RfEcrIlbmyXPaB0lx9oA0a2X6ycsZNyreuUesc+3GqXcPs3y5Inf7pXM+nZXyHRvvWIrzB7VSk4VsUVGpm2ZCEoBytrA0eFXOqHtW+uzlJMckwk91v+s9qwIXWjB1uk3KCUWza9AkfXpQDzOYUytJQHC0h1DXBoUBTYgqMq63YeNl9nluEzzFwdPAbYY4ClOgk9gPoCbpo9dghAn2oRc9m4DMTcZIznDAzn1t0Z1vbUHiPx1V4tcqQN8yvKlx8fCx9aJn4lGLGSl1ZCaWDb/PjTTWOFpo6RuLfvOJpllIp8rDgl5FTcQE= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR05MB3133.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18e90583-eef0-495d-1063-08d81dc6749f X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2020 13:55:46.8417 (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: l73IR5hfnuOcpAhDsfHmGN75yOeuXvdcTnLmpIB/U+b3XHjvZA2crnkhEkb73wKuXxHHY7iirZOPmgZYxwFX6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5934 Subject: Re: [dpdk-dev] [PATCH 4/8] net/mlx5: add the validate sample action 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: Ori Kam > Sent: Wednesday, July 1, 2020 2:00 AM > To: Jiawei(Jonny) Wang ; Slava Ovsiienko > ; Matan Azrad > Cc: dev@dpdk.org; Thomas Monjalon ; Raslan > Darawsheh ; ian.stokes@intel.com; > fbl@redhat.com; Jiawei(Jonny) Wang > Subject: RE: [PATCH 4/8] net/mlx5: add the validate sample action >=20 > Hi Jiawei, >=20 > PSB. >=20 > Best, > Ori >=20 > > -----Original Message----- > > From: Jiawei Wang > > Sent: Thursday, June 25, 2020 7:26 PM > > Subject: [PATCH 4/8] net/mlx5: add the validate sample action > > > > Add sample action validate function. > > > > For Sample flow support NIC-RX and FDB domain, must include an action > > of a dest TIR in NIC_RX or DEFAULT_MISS in FDB. >=20 > What is the DEFAULT_MISS action? > I think from reading the code that you mean that no action is allowed and= it > is always goes to e-switch manager / go to PF, am I correct? >=20 Yes, you're right, For FDB, not addition action be allowed for sampling, t= he default action is go to e-switch manager port. The DEFAULT_MISS is rdma-core action that steering packet to default miss of the steering domain, for FDB domain, it's e-switch manager port. I'll update the commit log description. Thanks. > > > > Only NIC_RX support with addition optinal actions. > > > > Signed-off-by: Jiawei Wang > > --- > > drivers/net/mlx5/linux/mlx5_os.c | 14 +++++ > > drivers/net/mlx5/mlx5.h | 1 + > > drivers/net/mlx5/mlx5_flow.h | 1 + > > drivers/net/mlx5/mlx5_flow_dv.c | 130 > > +++++++++++++++++++++++++++++++++++++++ > > 4 files changed, 146 insertions(+) > > > > diff --git a/drivers/net/mlx5/linux/mlx5_os.c > > b/drivers/net/mlx5/linux/mlx5_os.c > > index f0147e6..5c057d3 100644 > > --- a/drivers/net/mlx5/linux/mlx5_os.c > > +++ b/drivers/net/mlx5/linux/mlx5_os.c > > @@ -878,6 +878,20 @@ > > } > > } > > #endif > > +#if defined(HAVE_MLX5DV_DR) && > > defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE) > > + if (config.hca_attr.log_max_ft_sampler_num > 0 && > > + config.dv_flow_en) { > > + priv->sampler_en =3D 1; > > + DRV_LOG(DEBUG, "The Sampler enabled!\n"); > > + } else { > > + priv->sampler_en =3D 0; > > + if (!config.hca_attr.log_max_ft_sampler_num) > > + DRV_LOG(WARNING, "No available register > > for" > > + " Sampler."); > > + else > > + DRV_LOG(DEBUG, "DV flow is not > > supported!\n"); > > + } > > +#endif > > } > > if (config.mprq.enabled && mprq) { > > if (config.mprq.stride_num_n && > > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index > > 8a09ebc..c2a875c 100644 > > --- a/drivers/net/mlx5/mlx5.h > > +++ b/drivers/net/mlx5/mlx5.h > > @@ -607,6 +607,7 @@ struct mlx5_priv { > > unsigned int counter_fallback:1; /* Use counter fallback management. > > */ > > unsigned int mtr_en:1; /* Whether support meter. */ > > unsigned int mtr_reg_share:1; /* Whether support meter REG_C > share. > > */ > > + unsigned int sampler_en:1; /* Whether support sampler. */ > > uint16_t domain_id; /* Switch domain identifier. */ > > uint16_t vport_id; /* Associated VF vport index (if any). */ > > uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. > > */ diff --git a/drivers/net/mlx5/mlx5_flow.h > > b/drivers/net/mlx5/mlx5_flow.h index 2c96677..902380b 100644 > > --- a/drivers/net/mlx5/mlx5_flow.h > > +++ b/drivers/net/mlx5/mlx5_flow.h > > @@ -200,6 +200,7 @@ enum mlx5_feature_name { #define > > MLX5_FLOW_ACTION_SET_IPV4_DSCP (1ull << 32) #define > > MLX5_FLOW_ACTION_SET_IPV6_DSCP (1ull << 33) #define > > MLX5_FLOW_ACTION_AGE (1ull << 34) > > +#define MLX5_FLOW_ACTION_SAMPLE (1ull << 35) > > > > #define MLX5_FLOW_FATE_ACTIONS \ > > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \ diff > --git > > a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c > > index f174009..710c0f3 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -3925,6 +3925,127 @@ struct field_modify_info modify_tcp[] =3D { } > > > > /** > > + * Validate the sample action. > > + * > > + * @param[in] action_flags > > + * Holds the actions detected until now. > > + * @param[in] action > > + * Pointer to the sample action. > > + * @param[in] dev > > + * Pointer to the Ethernet device structure. > > + * @param[in] attr > > + * Attributes of flow that includes this action. > > + * @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_sample(uint64_t action_flags, > > + const struct rte_flow_action *action, > > + struct rte_eth_dev *dev, > > + const struct rte_flow_attr *attr, > > + struct rte_flow_error *error) { > > + struct mlx5_priv *priv =3D dev->data->dev_private; > > + struct mlx5_dev_config *dev_conf =3D &priv->config; > > + const struct rte_flow_action_sample *sample =3D action->conf; > > + const struct rte_flow_action *act =3D sample->actions; > > + uint64_t sub_action_flags =3D 0; > > + int actions_n =3D 0; > > + int ret; > > + > > + if (!attr->group) > > + return rte_flow_error_set(error, ENOTSUP, > > + > > RTE_FLOW_ERROR_TYPE_ATTR_GROUP, > > + NULL, "root table is not supported"); > > + if (!priv->config.devx || !priv->sampler_en) > > + return rte_flow_error_set(error, ENOTSUP, > > + > > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "sample action not supported"); > > + if (!(action->conf)) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > action, > > + "configuration cannot be null"); > > + if (sample->ratio =3D=3D 0) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > action, > > + "ratio value start from 1"); > > + if (action_flags & MLX5_FLOW_ACTION_SAMPLE) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > NULL, > > + "Duplicate sample actions set"); > > + if (action_flags & MLX5_FLOW_ACTION_METER) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > action, > > + "wrong action order, meter should " > > + "be after sample action"); > > + for (; act->type !=3D RTE_FLOW_ACTION_TYPE_END; act++) { > > + if (actions_n =3D=3D MLX5_DV_MAX_NUMBER_OF_ACTIONS) > > + return rte_flow_error_set(error, ENOTSUP, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + act, "too many actions"); > > + switch (act->type) { > > + case RTE_FLOW_ACTION_TYPE_QUEUE: > > + ret =3D mlx5_flow_validate_action_queue(act, > > + sub_action_flags, > > + dev, > > + attr, error); > > + if (ret < 0) > > + return ret; > > + sub_action_flags |=3D MLX5_FLOW_ACTION_QUEUE; > > + break; > > + case RTE_FLOW_ACTION_TYPE_MARK: > > + ret =3D flow_dv_validate_action_mark(dev, act, > > + sub_action_flags, > > + attr, error); > > + if (ret < 0) > > + return ret; > > + if (dev_conf->dv_xmeta_en !=3D > > MLX5_XMETA_MODE_LEGACY) > > + sub_action_flags |=3D > > MLX5_FLOW_ACTION_MARK | > > + > > MLX5_FLOW_ACTION_MARK_EXT; > > + else > > + sub_action_flags |=3D > > MLX5_FLOW_ACTION_MARK; > > + break; > > + case RTE_FLOW_ACTION_TYPE_COUNT: > > + ret =3D flow_dv_validate_action_count(dev, error); > > + if (ret < 0) > > + return ret; > > + sub_action_flags |=3D MLX5_FLOW_ACTION_COUNT; > > + break; > > + default: > > + return rte_flow_error_set(error, ENOTSUP, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "Doesn't support optional " > > + "action"); > > + } > > + } > > + if (attr->ingress && !attr->transfer) { > > + if (!(sub_action_flags & MLX5_FLOW_ACTION_QUEUE)) > > + return rte_flow_error_set(error, EINVAL, > > + > > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "Ingress must has a dest " > > + "QUEUE for Sample"); > > + } else if (attr->egress && !attr->transfer) { > > + return rte_flow_error_set(error, ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "Sample Only support Ingress " > > + "or E-Switch"); > > + } else if (sample->actions->type !=3D RTE_FLOW_ACTION_TYPE_END) { > > + return rte_flow_error_set(error, ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ACTION, > > NULL, > > + "E-Switch doesn't support any " > > + "optinal action for sampling"); > > + } > > + return 0; > > +} > > + > > +/** > > * Find existing modify-header resource or create and register a new o= ne. > > * > > * @param dev[in, out] > > @@ -5539,6 +5660,15 @@ struct field_modify_info modify_tcp[] =3D { > > action_flags |=3D > MLX5_FLOW_ACTION_SET_IPV6_DSCP; > > rw_act_num +=3D MLX5_ACT_NUM_SET_DSCP; > > break; > > + case RTE_FLOW_ACTION_TYPE_SAMPLE: > > + ret =3D flow_dv_validate_action_sample(action_flags, > > + actions, dev, > > + attr, error); > > + if (ret < 0) > > + return ret; > > + action_flags |=3D MLX5_FLOW_ACTION_SAMPLE; > > + ++actions_n; > > + break; > > default: > > return rte_flow_error_set(error, ENOTSUP, > > > > RTE_FLOW_ERROR_TYPE_ACTION, > > -- > > 1.8.3.1