From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10066.outbound.protection.outlook.com [40.107.1.66]) by dpdk.org (Postfix) with ESMTP id B03121B907 for ; Thu, 18 Apr 2019 06:40:16 +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=QmAaiYeq8Ef5px+GJI6kmtuuSXs4pUvGifljWKyGols=; b=mLKGGzG9LRsRGnfrARx4GQXkO/Fb00ynnYeewnK2KHnIqaSoY+3AjkEDLCxp8kAO0ISdypQsCfX0k5007rFKNG1if7hXkjc2Yr4SwHVWDI/Pa/DZoKpJ5tD9SsDADxQ0SoDf0xhnDrc+p7k9F3bpHVX/1Tb9VYtljjYkEVtrXgs= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3282.eurprd05.prod.outlook.com (10.171.187.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.19; Thu, 18 Apr 2019 04:40:14 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8%6]) with mapi id 15.20.1813.013; Thu, 18 Apr 2019 04:40:14 +0000 From: Ori Kam To: Yongseok Koh CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switch Thread-Index: AQHU9XmfY/9+Kp+zX024WNKInGCf0KZBTJjA Date: Thu, 18 Apr 2019 04:40:14 +0000 Message-ID: References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-5-git-send-email-orika@mellanox.com> <20190417235928.GA31179@mtidpdk.mti.labs.mlnx> In-Reply-To: <20190417235928.GA31179@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=orika@mellanox.com; x-originating-ip: [185.175.35.255] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 53d34655-c915-4990-1ff4-08d6c3b7f31b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM4PR05MB3282; x-ms-traffictypediagnostic: AM4PR05MB3282: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(39860400002)(376002)(346002)(199004)(13464003)(189003)(55016002)(74316002)(478600001)(11346002)(8676002)(14454004)(8936002)(99286004)(476003)(26005)(81156014)(186003)(6246003)(7696005)(9686003)(6636002)(2906002)(71190400001)(6116002)(25786009)(446003)(3846002)(76176011)(305945005)(53546011)(52536014)(4326008)(68736007)(53946003)(71200400001)(66066001)(229853002)(54906003)(486006)(33656002)(53936002)(6436002)(316002)(14444005)(7736002)(97736004)(6506007)(102836004)(30864003)(6862004)(5660300002)(256004)(86362001)(81166006)(7756004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3282; H:AM4PR05MB3425.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: kJGfzzFwELAgfFU9RFF7uArqUOj6DYmhaNxeObTmdPmIlwnVIBh1u2EjSIp4qBMFezbGc7HrN+tEV92VndGDspGrSKRM2BmxfVLwByjOuHtDaS7f1jB81qbGb/LlKswuEVfcu+s+WPxC8JH0XGKzfkBtkg2rpOoH7v9BN1hMLNhR9BRoBrXwz4pl8I7mcjsRChz0QZ5nkD1HasrNRV3w2EsNvuTx1M1dG1U+mdSIWLgW/araY2ysTDrNb3pUH6Z7mqrZAkjtMlh9Gse/QAr0Fpy53NnDu3G81ZUdDQqB0tSHQUv0RfipGxIeuvqmaGmdroeNSucbwLV+jmyA3pGOYIxw55IK7FwQIkt7XuBinmzZ7M/MbrlZKsFgE6IGNrTp44DVk9q9BMTDCGuX7KBHqUmsAa3Z8hBoIhpLfK7vln0= 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: 53d34655-c915-4990-1ff4-08d6c3b7f31b X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 04:40:14.3225 (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-Transport-CrossTenantHeadersStamped: AM4PR05MB3282 Subject: Re: [dpdk-dev] [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switch 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: Thu, 18 Apr 2019 04:40:17 -0000 Hi Koh, PSB > -----Original Message----- > From: Yongseok Koh > Sent: Thursday, April 18, 2019 3:00 AM > To: Ori Kam > Cc: Shahaf Shuler ; Matan Azrad > ; Slava Ovsiienko ; Moti > Haimovsky ; dev@dpdk.org > Subject: Re: [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switc= h >=20 > On Sun, Apr 14, 2019 at 09:12:32PM +0000, Ori Kam wrote: > > Add validation logic for E-Switch using Direct Rules. > > > > Signed-off-by: Ori Kam > > --- > > drivers/net/mlx5/mlx5.h | 2 + > > drivers/net/mlx5/mlx5_ethdev.c | 39 +++++++ > > drivers/net/mlx5/mlx5_flow.h | 5 + > > drivers/net/mlx5/mlx5_flow_dv.c | 252 > ++++++++++++++++++++++++++++++++++++++-- > > 4 files changed, 287 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > > index 33a4127..8d63575 100644 > > --- a/drivers/net/mlx5/mlx5.h > > +++ b/drivers/net/mlx5/mlx5.h > > @@ -412,6 +412,8 @@ int mlx5_ibv_device_to_pci_addr(const struct > ibv_device *device, > > unsigned int mlx5_dev_to_port_id(const struct rte_device *dev, > > uint16_t *port_list, > > unsigned int port_list_n); > > +int mlx5_port_to_eswitch_info(uint16_t port, uint16_t *es_domain_id, > > + uint16_t *es_port_id); > > int mlx5_sysfs_switch_info(unsigned int ifindex, > > struct mlx5_switch_info *info); > > bool mlx5_translate_port_name(const char *port_name_in, > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > b/drivers/net/mlx5/mlx5_ethdev.c > > index 3992918..c821772 100644 > > --- a/drivers/net/mlx5/mlx5_ethdev.c > > +++ b/drivers/net/mlx5/mlx5_ethdev.c > > @@ -1376,6 +1376,45 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, > char *fw_ver, size_t fw_size) > > } > > > > /** > > + * Get the e-switch domain id this port belongs to. >=20 > E-Switch Will fix. >=20 > > + * > > + * @param[in] port > > + * Device port id. > > + * @param[out] es_domain_id > > + * e-switch domain id. >=20 > E-Switch > Please correct in the entire patchset. >=20 > > + * @param[out] es_port_id > > + * The port id of the port in the switch. > > + * > > + * @return > > + * 0 on success, Negative error otherwise. >=20 > From looking at the use-cases below, rte_errno must be set. >=20 Will fix. > > + */ > > +int > > +mlx5_port_to_eswitch_info(uint16_t port, > > + uint16_t *es_domain_id, uint16_t *es_port_id) > > +{ > > + struct rte_eth_dev *dev; > > + struct mlx5_priv *priv; > > + > > + if (port >=3D RTE_MAX_ETHPORTS) > > + return -EINVAL; > > + dev =3D &rte_eth_devices[port]; > > + if (dev =3D=3D NULL) > > + return -ENODEV; >=20 > dev is an l-value, it cannot be null. > The above two checks can be replaced with rte_eth_dev_is_valid_port(). >=20 Will fix. > > + if (!dev->device || > > + !dev->device->driver || > > + strcmp(dev->device->driver->name, MLX5_DRIVER_NAME)) > > + return -EINVAL; >=20 > Looks too paranoid. The function is just PMD-internal. >=20 Will delete. > > + priv =3D dev->data->dev_private; > > + if (!(priv->representor || priv->master)) > > + return -EINVAL; > > + if (es_domain_id) > > + *es_domain_id =3D priv->domain_id; > > + if (es_port_id) > > + *es_port_id =3D priv->vport_id; >=20 > It is okay for now but we need to define a new struct like esw_info next = time. > This info should be grouped in the priv. >=20 I think I need a new member to mark it is pf or vd, can we in this patch se= t add it as is? I will create a patch to move all of the E-Switch variables to dedicated st= ructure for next version. > > + return 0; > > +} > > + > > +/** > > * Get switch information associated with network interface. > > * > > * @param ifindex > > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.= h > > index 9f47fd4..85954c2 100644 > > --- a/drivers/net/mlx5/mlx5_flow.h > > +++ b/drivers/net/mlx5/mlx5_flow.h > > @@ -48,6 +48,7 @@ > > > > /* General pattern items bits. */ > > #define MLX5_FLOW_ITEM_METADATA (1u << 16) > > +#define MLX5_FLOW_ITEM_PORT_ID (1u << 17) > > > > /* Outer Masks. */ > > #define MLX5_FLOW_LAYER_OUTER_L3 \ > > @@ -118,6 +119,10 @@ > > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \ > > MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP) > > > > +#define MLX5_FLOW_FATE_ESWITCH_ACTIONS \ > > + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \ > > + MLX5_FLOW_ACTION_JUMP) > > + > > #define MLX5_FLOW_ENCAP_ACTIONS > (MLX5_FLOW_ACTION_VXLAN_ENCAP | \ > > MLX5_FLOW_ACTION_NVGRE_ENCAP | \ > > MLX5_FLOW_ACTION_RAW_ENCAP) > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > > index 7b582f0..fedc6cb 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -613,6 +613,92 @@ struct field_modify_info modify_tcp[] =3D { > > } > > > > /** > > + * Validate vport item. > > + * > > + * @param[in] dev > > + * Pointer to the rte_eth_dev structure. > > + * @param[in] item > > + * Item specification. > > + * @param[in] attr > > + * Attributes of flow that includes this item. > > + * @param[in] item_flags > > + * Bit-fields that holds the items detected until now. > > + * @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_item_port_id(struct rte_eth_dev *dev, > > + const struct rte_flow_item *item, > > + const struct rte_flow_attr *attr, > > + uint64_t item_flags, > > + struct rte_flow_error *error) > > +{ > > + const struct rte_flow_item_port_id *spec =3D item->spec; > > + const struct rte_flow_item_port_id *mask =3D item->mask; > > + const struct rte_flow_item_port_id switch_mask =3D { > > + .id =3D 0xffffffff, > > + }; > > + uint16_t esw_domain_id; > > + uint16_t item_port_esw_domain_id; > > + uint16_t item_port_esw_port_id; > > + uint16_t port; > > + int ret; > > + > > + if (!attr->transfer) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ITEM, > > + NULL, > > + "match on port id is valid for" > > + " eswitch only"); >=20 > Need to mention about 'transfer' flag here instead of esw. BTW, is it oka= y to > speak in PMD specific language for error messages? Even if so, 'eswitch' = should > be fixed. Please re-visit all the error messages again. >=20 I think the correct message should be that the eswitch should be replaced = by E-Switch Other option is to say something like this "matching on port id must have t= he transfer attribute" Which do you prefer? > > + if (item_flags & MLX5_FLOW_ITEM_PORT_ID) > > + return rte_flow_error_set(error, ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ITEM, > item, > > + "multiple source vport are not" > > + " supported"); >=20 > Same here. 'vport' doesn't look appropriate. > Will change from vport to ports. =20 > > + if (!mask) > > + mask =3D &switch_mask; > > + if (mask->id && mask->id !=3D 0xffffffff) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ITEM_MASK, > > + mask, > > + "no support for partial mask on" > > + " \"id\" field"); > > + ret =3D mlx5_flow_item_acceptable > > + (item, (const uint8_t *)mask, > > + (const uint8_t > *)&rte_flow_item_port_id_mask, > > + sizeof(struct rte_flow_item_port_id), > > + error); > > + if (ret) > > + return ret; > > + if (!spec) > > + return 0; > > + port =3D mask->id ? spec->id : 0; >=20 > Non-masked value means 'any' value. Is it correct to set port 0 in > this case? >=20 Will check again. > > + ret =3D mlx5_port_to_eswitch_info(port, &item_port_esw_domain_id, > > + &item_port_esw_port_id); >=20 > item_port_esw_port_id is of no use here; >=20 Will remove the variable. > > + if (ret) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec, > > + "failed to obtain eswitch info for" > > + " port"); > > + ret =3D mlx5_port_to_eswitch_info(dev->data->port_id, > > + &esw_domain_id, NULL); > > + if (ret < 0) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "failed to obtain eswitch info"); > > + if (item_port_esw_domain_id !=3D esw_domain_id) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec, > > + "cannot match on a port from a" > > + " different eswitch"); > > + return 0; > > +} > > + > > +/** > > * Validate count action. > > * > > * @param[in] dev > > @@ -622,6 +708,7 @@ struct field_modify_info modify_tcp[] =3D { > > * > > * @return > > * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > + * w >=20 > What is this change? >=20 Will fix > > */ > > static int > > flow_dv_validate_action_count(struct rte_eth_dev *dev, > > @@ -676,7 +763,7 @@ struct field_modify_info modify_tcp[] =3D { > > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > > "can only have a single encap or" > > " decap action in a flow"); > > - if (attr->ingress) > > + if (!attr->transfer && attr->ingress) > > return rte_flow_error_set(error, ENOTSUP, > > > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > NULL, > > @@ -761,7 +848,8 @@ struct field_modify_info modify_tcp[] =3D { > > "can only have a single encap" > > " action in a flow"); > > /* encap without preceding decap is not supported for ingress */ > > - if (attr->ingress && !(action_flags & > MLX5_FLOW_ACTION_RAW_DECAP)) > > + if (!attr->transfer && attr->ingress && > > + !(action_flags & MLX5_FLOW_ACTION_RAW_DECAP)) > > return rte_flow_error_set(error, ENOTSUP, > > > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > NULL, > > @@ -1561,6 +1649,77 @@ struct field_modify_info modify_tcp[] =3D { > > return 0; > > } > > > > +/* > > + * Validate the port_id action. > > + * > > + * @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. > > + * @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_port_id(struct rte_eth_dev *dev, > > + 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_port_id *port_id; > > + uint16_t port; > > + uint16_t esw_domain_id; > > + uint16_t act_port_domain_id; > > + int ret; > > + > > + if (!attr->transfer) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "port id action is valid in transfer" > > + " mode only"); > > + if (!action || !action->conf) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION_CONF, > > + NULL, > > + "port id action parameters must be" > > + " specified"); > > + if (action_flags & (MLX5_FLOW_FATE_ACTIONS | > > + MLX5_FLOW_FATE_ESWITCH_ACTIONS)) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > > + "can have only one fate actions in" > > + " a flow"); > > + ret =3D mlx5_port_to_eswitch_info(dev->data->port_id, > > + &esw_domain_id, NULL); > > + if (ret < 0) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "failed to obtain eswitch info"); > > + port_id =3D action->conf; > > + port =3D port_id->original ? dev->data->port_id : port_id->id; > > + ret =3D mlx5_port_to_eswitch_info(port, &act_port_domain_id, NULL); > > + if (ret) > > + return rte_flow_error_set > > + (error, -ret, > > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, > port_id, > > + "failed to obtain eswitch port-id for port"); > > + if (act_port_domain_id !=3D esw_domain_id) > > + return rte_flow_error_set > > + (error, -ret, > > + RTE_FLOW_ERROR_TYPE_ACTION, NULL, > > + "port does not belong to" > > + " eswitch being configured"); > > + return 0; > > +} > > > > /** > > * Find existing modify-header resource or create and register a new o= ne. > > @@ -1759,11 +1918,34 @@ struct field_modify_info modify_tcp[] =3D { > > > RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, > > NULL, > > "priority out of range"); > > - if (attributes->transfer) > > - return rte_flow_error_set(error, ENOTSUP, > > - > RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, > > - NULL, > > - "transfer is not supported"); > > + if (attributes->transfer) { > > + if (!priv->config.dv_eswitch_en) > > + return rte_flow_error_set > > + (error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "eswitch dr is not supported"); >=20 > If you open a parenthesis in a new line, you should indent by a tab. >=20 Missed that, fill fix. > > + if (!(priv->representor || priv->master)) > > + return rte_flow_error_set > > + (error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "eswitch configurationd can only be" > > + " done by a master or a representor" > > + " device"); > > + if (attributes->egress) > > + return rte_flow_error_set > > + (error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, > > + attributes, "egress is not supported"); > > + if (attributes->group >=3D MLX5_MAX_TABLES_FDB) > > + return rte_flow_error_set > > + (error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, > > + NULL, > > + "group must be smaller than " > > + RTE_STR(MLX5_MAX_FDB_TABLES)); > > + } > > if (!(attributes->egress ^ attributes->ingress)) > > return rte_flow_error_set(error, ENOTSUP, > > RTE_FLOW_ERROR_TYPE_ATTR, > NULL, > > @@ -1812,6 +1994,13 @@ struct field_modify_info modify_tcp[] =3D { > > switch (items->type) { > > case RTE_FLOW_ITEM_TYPE_VOID: > > break; > > + case RTE_FLOW_ITEM_TYPE_PORT_ID: > > + ret =3D flow_dv_validate_item_port_id > > + (dev, items, attr, item_flags, error); > > + if (ret < 0) > > + return ret; > > + item_flags |=3D MLX5_FLOW_ITEM_PORT_ID; > > + break; >=20 > Shouldn't it use last_item? >=20 Good question, should the port id be in some specific order?=20 We can force it to be first or last the which makes sense. I will change to last_item. =20 > > case RTE_FLOW_ITEM_TYPE_ETH: > > ret =3D mlx5_flow_validate_item_eth(items, item_flags, > > error); > > @@ -1943,6 +2132,17 @@ struct field_modify_info modify_tcp[] =3D { > > switch (actions->type) { > > case RTE_FLOW_ACTION_TYPE_VOID: > > break; > > + case RTE_FLOW_ACTION_TYPE_PORT_ID: > > + ret =3D flow_dv_validate_action_port_id(dev, > > + action_flags, > > + actions, > > + attr, > > + error); > > + if (ret) > > + return ret; > > + action_flags |=3D MLX5_FLOW_ACTION_PORT_ID; > > + ++actions_n; > > + break; > > case RTE_FLOW_ACTION_TYPE_FLAG: > > ret =3D mlx5_flow_validate_action_flag(action_flags, > > attr, error); > > @@ -2133,10 +2333,40 @@ struct field_modify_info modify_tcp[] =3D { > > "action not supported"); > > } > > } > > - if (!(action_flags & MLX5_FLOW_FATE_ACTIONS) && attr->ingress) > > - return rte_flow_error_set(error, EINVAL, > > - RTE_FLOW_ERROR_TYPE_ACTION, > actions, > > - "no fate action is found"); > > + /* Eswitch has few restrictions on using items and actions */ > > + if (attr->transfer) { > > + if (action_flags & MLX5_FLOW_ACTION_FLAG) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action FLAG"); > > + if (action_flags & MLX5_FLOW_ACTION_MARK) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action MARK"); > > + if (action_flags & MLX5_FLOW_ACTION_QUEUE) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action > QUEUE"); > > + if (action_flags & MLX5_FLOW_ACTION_RSS) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action RSS"); > > + if (!(action_flags & MLX5_FLOW_FATE_ESWITCH_ACTIONS)) > > + return rte_flow_error_set(error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + actions, > > + "no fate action is found"); > > + } else { > > + if (!(action_flags & MLX5_FLOW_FATE_ACTIONS) && attr- > >ingress) > > + return rte_flow_error_set(error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + actions, > > + "no fate action is found"); > > + } > > return 0; > > } > > > > -- > > 1.8.3.1 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 85149A00E6 for ; Thu, 18 Apr 2019 06:40:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 37A491B91C; Thu, 18 Apr 2019 06:40:18 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10066.outbound.protection.outlook.com [40.107.1.66]) by dpdk.org (Postfix) with ESMTP id B03121B907 for ; Thu, 18 Apr 2019 06:40:16 +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=QmAaiYeq8Ef5px+GJI6kmtuuSXs4pUvGifljWKyGols=; b=mLKGGzG9LRsRGnfrARx4GQXkO/Fb00ynnYeewnK2KHnIqaSoY+3AjkEDLCxp8kAO0ISdypQsCfX0k5007rFKNG1if7hXkjc2Yr4SwHVWDI/Pa/DZoKpJ5tD9SsDADxQ0SoDf0xhnDrc+p7k9F3bpHVX/1Tb9VYtljjYkEVtrXgs= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3282.eurprd05.prod.outlook.com (10.171.187.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.19; Thu, 18 Apr 2019 04:40:14 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8%6]) with mapi id 15.20.1813.013; Thu, 18 Apr 2019 04:40:14 +0000 From: Ori Kam To: Yongseok Koh CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switch Thread-Index: AQHU9XmfY/9+Kp+zX024WNKInGCf0KZBTJjA Date: Thu, 18 Apr 2019 04:40:14 +0000 Message-ID: References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-5-git-send-email-orika@mellanox.com> <20190417235928.GA31179@mtidpdk.mti.labs.mlnx> In-Reply-To: <20190417235928.GA31179@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=orika@mellanox.com; x-originating-ip: [185.175.35.255] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 53d34655-c915-4990-1ff4-08d6c3b7f31b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM4PR05MB3282; x-ms-traffictypediagnostic: AM4PR05MB3282: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(39860400002)(376002)(346002)(199004)(13464003)(189003)(55016002)(74316002)(478600001)(11346002)(8676002)(14454004)(8936002)(99286004)(476003)(26005)(81156014)(186003)(6246003)(7696005)(9686003)(6636002)(2906002)(71190400001)(6116002)(25786009)(446003)(3846002)(76176011)(305945005)(53546011)(52536014)(4326008)(68736007)(53946003)(71200400001)(66066001)(229853002)(54906003)(486006)(33656002)(53936002)(6436002)(316002)(14444005)(7736002)(97736004)(6506007)(102836004)(30864003)(6862004)(5660300002)(256004)(86362001)(81166006)(7756004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3282; H:AM4PR05MB3425.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: kJGfzzFwELAgfFU9RFF7uArqUOj6DYmhaNxeObTmdPmIlwnVIBh1u2EjSIp4qBMFezbGc7HrN+tEV92VndGDspGrSKRM2BmxfVLwByjOuHtDaS7f1jB81qbGb/LlKswuEVfcu+s+WPxC8JH0XGKzfkBtkg2rpOoH7v9BN1hMLNhR9BRoBrXwz4pl8I7mcjsRChz0QZ5nkD1HasrNRV3w2EsNvuTx1M1dG1U+mdSIWLgW/araY2ysTDrNb3pUH6Z7mqrZAkjtMlh9Gse/QAr0Fpy53NnDu3G81ZUdDQqB0tSHQUv0RfipGxIeuvqmaGmdroeNSucbwLV+jmyA3pGOYIxw55IK7FwQIkt7XuBinmzZ7M/MbrlZKsFgE6IGNrTp44DVk9q9BMTDCGuX7KBHqUmsAa3Z8hBoIhpLfK7vln0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53d34655-c915-4990-1ff4-08d6c3b7f31b X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 04:40:14.3225 (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-Transport-CrossTenantHeadersStamped: AM4PR05MB3282 Subject: Re: [dpdk-dev] [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switch 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" Message-ID: <20190418044014.QIUNLB8zQGb6taoHk-KXvr7mOSYfhNLf13FQKInt_R8@z> Hi Koh, PSB > -----Original Message----- > From: Yongseok Koh > Sent: Thursday, April 18, 2019 3:00 AM > To: Ori Kam > Cc: Shahaf Shuler ; Matan Azrad > ; Slava Ovsiienko ; Moti > Haimovsky ; dev@dpdk.org > Subject: Re: [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switc= h >=20 > On Sun, Apr 14, 2019 at 09:12:32PM +0000, Ori Kam wrote: > > Add validation logic for E-Switch using Direct Rules. > > > > Signed-off-by: Ori Kam > > --- > > drivers/net/mlx5/mlx5.h | 2 + > > drivers/net/mlx5/mlx5_ethdev.c | 39 +++++++ > > drivers/net/mlx5/mlx5_flow.h | 5 + > > drivers/net/mlx5/mlx5_flow_dv.c | 252 > ++++++++++++++++++++++++++++++++++++++-- > > 4 files changed, 287 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > > index 33a4127..8d63575 100644 > > --- a/drivers/net/mlx5/mlx5.h > > +++ b/drivers/net/mlx5/mlx5.h > > @@ -412,6 +412,8 @@ int mlx5_ibv_device_to_pci_addr(const struct > ibv_device *device, > > unsigned int mlx5_dev_to_port_id(const struct rte_device *dev, > > uint16_t *port_list, > > unsigned int port_list_n); > > +int mlx5_port_to_eswitch_info(uint16_t port, uint16_t *es_domain_id, > > + uint16_t *es_port_id); > > int mlx5_sysfs_switch_info(unsigned int ifindex, > > struct mlx5_switch_info *info); > > bool mlx5_translate_port_name(const char *port_name_in, > > diff --git a/drivers/net/mlx5/mlx5_ethdev.c > b/drivers/net/mlx5/mlx5_ethdev.c > > index 3992918..c821772 100644 > > --- a/drivers/net/mlx5/mlx5_ethdev.c > > +++ b/drivers/net/mlx5/mlx5_ethdev.c > > @@ -1376,6 +1376,45 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, > char *fw_ver, size_t fw_size) > > } > > > > /** > > + * Get the e-switch domain id this port belongs to. >=20 > E-Switch Will fix. >=20 > > + * > > + * @param[in] port > > + * Device port id. > > + * @param[out] es_domain_id > > + * e-switch domain id. >=20 > E-Switch > Please correct in the entire patchset. >=20 > > + * @param[out] es_port_id > > + * The port id of the port in the switch. > > + * > > + * @return > > + * 0 on success, Negative error otherwise. >=20 > From looking at the use-cases below, rte_errno must be set. >=20 Will fix. > > + */ > > +int > > +mlx5_port_to_eswitch_info(uint16_t port, > > + uint16_t *es_domain_id, uint16_t *es_port_id) > > +{ > > + struct rte_eth_dev *dev; > > + struct mlx5_priv *priv; > > + > > + if (port >=3D RTE_MAX_ETHPORTS) > > + return -EINVAL; > > + dev =3D &rte_eth_devices[port]; > > + if (dev =3D=3D NULL) > > + return -ENODEV; >=20 > dev is an l-value, it cannot be null. > The above two checks can be replaced with rte_eth_dev_is_valid_port(). >=20 Will fix. > > + if (!dev->device || > > + !dev->device->driver || > > + strcmp(dev->device->driver->name, MLX5_DRIVER_NAME)) > > + return -EINVAL; >=20 > Looks too paranoid. The function is just PMD-internal. >=20 Will delete. > > + priv =3D dev->data->dev_private; > > + if (!(priv->representor || priv->master)) > > + return -EINVAL; > > + if (es_domain_id) > > + *es_domain_id =3D priv->domain_id; > > + if (es_port_id) > > + *es_port_id =3D priv->vport_id; >=20 > It is okay for now but we need to define a new struct like esw_info next = time. > This info should be grouped in the priv. >=20 I think I need a new member to mark it is pf or vd, can we in this patch se= t add it as is? I will create a patch to move all of the E-Switch variables to dedicated st= ructure for next version. > > + return 0; > > +} > > + > > +/** > > * Get switch information associated with network interface. > > * > > * @param ifindex > > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.= h > > index 9f47fd4..85954c2 100644 > > --- a/drivers/net/mlx5/mlx5_flow.h > > +++ b/drivers/net/mlx5/mlx5_flow.h > > @@ -48,6 +48,7 @@ > > > > /* General pattern items bits. */ > > #define MLX5_FLOW_ITEM_METADATA (1u << 16) > > +#define MLX5_FLOW_ITEM_PORT_ID (1u << 17) > > > > /* Outer Masks. */ > > #define MLX5_FLOW_LAYER_OUTER_L3 \ > > @@ -118,6 +119,10 @@ > > (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \ > > MLX5_FLOW_ACTION_RSS | MLX5_FLOW_ACTION_JUMP) > > > > +#define MLX5_FLOW_FATE_ESWITCH_ACTIONS \ > > + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \ > > + MLX5_FLOW_ACTION_JUMP) > > + > > #define MLX5_FLOW_ENCAP_ACTIONS > (MLX5_FLOW_ACTION_VXLAN_ENCAP | \ > > MLX5_FLOW_ACTION_NVGRE_ENCAP | \ > > MLX5_FLOW_ACTION_RAW_ENCAP) > > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c > > index 7b582f0..fedc6cb 100644 > > --- a/drivers/net/mlx5/mlx5_flow_dv.c > > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > > @@ -613,6 +613,92 @@ struct field_modify_info modify_tcp[] =3D { > > } > > > > /** > > + * Validate vport item. > > + * > > + * @param[in] dev > > + * Pointer to the rte_eth_dev structure. > > + * @param[in] item > > + * Item specification. > > + * @param[in] attr > > + * Attributes of flow that includes this item. > > + * @param[in] item_flags > > + * Bit-fields that holds the items detected until now. > > + * @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_item_port_id(struct rte_eth_dev *dev, > > + const struct rte_flow_item *item, > > + const struct rte_flow_attr *attr, > > + uint64_t item_flags, > > + struct rte_flow_error *error) > > +{ > > + const struct rte_flow_item_port_id *spec =3D item->spec; > > + const struct rte_flow_item_port_id *mask =3D item->mask; > > + const struct rte_flow_item_port_id switch_mask =3D { > > + .id =3D 0xffffffff, > > + }; > > + uint16_t esw_domain_id; > > + uint16_t item_port_esw_domain_id; > > + uint16_t item_port_esw_port_id; > > + uint16_t port; > > + int ret; > > + > > + if (!attr->transfer) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ITEM, > > + NULL, > > + "match on port id is valid for" > > + " eswitch only"); >=20 > Need to mention about 'transfer' flag here instead of esw. BTW, is it oka= y to > speak in PMD specific language for error messages? Even if so, 'eswitch' = should > be fixed. Please re-visit all the error messages again. >=20 I think the correct message should be that the eswitch should be replaced = by E-Switch Other option is to say something like this "matching on port id must have t= he transfer attribute" Which do you prefer? > > + if (item_flags & MLX5_FLOW_ITEM_PORT_ID) > > + return rte_flow_error_set(error, ENOTSUP, > > + RTE_FLOW_ERROR_TYPE_ITEM, > item, > > + "multiple source vport are not" > > + " supported"); >=20 > Same here. 'vport' doesn't look appropriate. > Will change from vport to ports. =20 > > + if (!mask) > > + mask =3D &switch_mask; > > + if (mask->id && mask->id !=3D 0xffffffff) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ITEM_MASK, > > + mask, > > + "no support for partial mask on" > > + " \"id\" field"); > > + ret =3D mlx5_flow_item_acceptable > > + (item, (const uint8_t *)mask, > > + (const uint8_t > *)&rte_flow_item_port_id_mask, > > + sizeof(struct rte_flow_item_port_id), > > + error); > > + if (ret) > > + return ret; > > + if (!spec) > > + return 0; > > + port =3D mask->id ? spec->id : 0; >=20 > Non-masked value means 'any' value. Is it correct to set port 0 in > this case? >=20 Will check again. > > + ret =3D mlx5_port_to_eswitch_info(port, &item_port_esw_domain_id, > > + &item_port_esw_port_id); >=20 > item_port_esw_port_id is of no use here; >=20 Will remove the variable. > > + if (ret) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec, > > + "failed to obtain eswitch info for" > > + " port"); > > + ret =3D mlx5_port_to_eswitch_info(dev->data->port_id, > > + &esw_domain_id, NULL); > > + if (ret < 0) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "failed to obtain eswitch info"); > > + if (item_port_esw_domain_id !=3D esw_domain_id) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, spec, > > + "cannot match on a port from a" > > + " different eswitch"); > > + return 0; > > +} > > + > > +/** > > * Validate count action. > > * > > * @param[in] dev > > @@ -622,6 +708,7 @@ struct field_modify_info modify_tcp[] =3D { > > * > > * @return > > * 0 on success, a negative errno value otherwise and rte_errno is s= et. > > + * w >=20 > What is this change? >=20 Will fix > > */ > > static int > > flow_dv_validate_action_count(struct rte_eth_dev *dev, > > @@ -676,7 +763,7 @@ struct field_modify_info modify_tcp[] =3D { > > RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > > "can only have a single encap or" > > " decap action in a flow"); > > - if (attr->ingress) > > + if (!attr->transfer && attr->ingress) > > return rte_flow_error_set(error, ENOTSUP, > > > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > NULL, > > @@ -761,7 +848,8 @@ struct field_modify_info modify_tcp[] =3D { > > "can only have a single encap" > > " action in a flow"); > > /* encap without preceding decap is not supported for ingress */ > > - if (attr->ingress && !(action_flags & > MLX5_FLOW_ACTION_RAW_DECAP)) > > + if (!attr->transfer && attr->ingress && > > + !(action_flags & MLX5_FLOW_ACTION_RAW_DECAP)) > > return rte_flow_error_set(error, ENOTSUP, > > > RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, > > NULL, > > @@ -1561,6 +1649,77 @@ struct field_modify_info modify_tcp[] =3D { > > return 0; > > } > > > > +/* > > + * Validate the port_id action. > > + * > > + * @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. > > + * @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_port_id(struct rte_eth_dev *dev, > > + 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_port_id *port_id; > > + uint16_t port; > > + uint16_t esw_domain_id; > > + uint16_t act_port_domain_id; > > + int ret; > > + > > + if (!attr->transfer) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "port id action is valid in transfer" > > + " mode only"); > > + if (!action || !action->conf) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION_CONF, > > + NULL, > > + "port id action parameters must be" > > + " specified"); > > + if (action_flags & (MLX5_FLOW_FATE_ACTIONS | > > + MLX5_FLOW_FATE_ESWITCH_ACTIONS)) > > + return rte_flow_error_set(error, EINVAL, > > + RTE_FLOW_ERROR_TYPE_ACTION, > NULL, > > + "can have only one fate actions in" > > + " a flow"); > > + ret =3D mlx5_port_to_eswitch_info(dev->data->port_id, > > + &esw_domain_id, NULL); > > + if (ret < 0) > > + return rte_flow_error_set(error, -ret, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "failed to obtain eswitch info"); > > + port_id =3D action->conf; > > + port =3D port_id->original ? dev->data->port_id : port_id->id; > > + ret =3D mlx5_port_to_eswitch_info(port, &act_port_domain_id, NULL); > > + if (ret) > > + return rte_flow_error_set > > + (error, -ret, > > + RTE_FLOW_ERROR_TYPE_ACTION_CONF, > port_id, > > + "failed to obtain eswitch port-id for port"); > > + if (act_port_domain_id !=3D esw_domain_id) > > + return rte_flow_error_set > > + (error, -ret, > > + RTE_FLOW_ERROR_TYPE_ACTION, NULL, > > + "port does not belong to" > > + " eswitch being configured"); > > + return 0; > > +} > > > > /** > > * Find existing modify-header resource or create and register a new o= ne. > > @@ -1759,11 +1918,34 @@ struct field_modify_info modify_tcp[] =3D { > > > RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, > > NULL, > > "priority out of range"); > > - if (attributes->transfer) > > - return rte_flow_error_set(error, ENOTSUP, > > - > RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, > > - NULL, > > - "transfer is not supported"); > > + if (attributes->transfer) { > > + if (!priv->config.dv_eswitch_en) > > + return rte_flow_error_set > > + (error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "eswitch dr is not supported"); >=20 > If you open a parenthesis in a new line, you should indent by a tab. >=20 Missed that, fill fix. > > + if (!(priv->representor || priv->master)) > > + return rte_flow_error_set > > + (error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_UNSPECIFIED, > > + NULL, > > + "eswitch configurationd can only be" > > + " done by a master or a representor" > > + " device"); > > + if (attributes->egress) > > + return rte_flow_error_set > > + (error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, > > + attributes, "egress is not supported"); > > + if (attributes->group >=3D MLX5_MAX_TABLES_FDB) > > + return rte_flow_error_set > > + (error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, > > + NULL, > > + "group must be smaller than " > > + RTE_STR(MLX5_MAX_FDB_TABLES)); > > + } > > if (!(attributes->egress ^ attributes->ingress)) > > return rte_flow_error_set(error, ENOTSUP, > > RTE_FLOW_ERROR_TYPE_ATTR, > NULL, > > @@ -1812,6 +1994,13 @@ struct field_modify_info modify_tcp[] =3D { > > switch (items->type) { > > case RTE_FLOW_ITEM_TYPE_VOID: > > break; > > + case RTE_FLOW_ITEM_TYPE_PORT_ID: > > + ret =3D flow_dv_validate_item_port_id > > + (dev, items, attr, item_flags, error); > > + if (ret < 0) > > + return ret; > > + item_flags |=3D MLX5_FLOW_ITEM_PORT_ID; > > + break; >=20 > Shouldn't it use last_item? >=20 Good question, should the port id be in some specific order?=20 We can force it to be first or last the which makes sense. I will change to last_item. =20 > > case RTE_FLOW_ITEM_TYPE_ETH: > > ret =3D mlx5_flow_validate_item_eth(items, item_flags, > > error); > > @@ -1943,6 +2132,17 @@ struct field_modify_info modify_tcp[] =3D { > > switch (actions->type) { > > case RTE_FLOW_ACTION_TYPE_VOID: > > break; > > + case RTE_FLOW_ACTION_TYPE_PORT_ID: > > + ret =3D flow_dv_validate_action_port_id(dev, > > + action_flags, > > + actions, > > + attr, > > + error); > > + if (ret) > > + return ret; > > + action_flags |=3D MLX5_FLOW_ACTION_PORT_ID; > > + ++actions_n; > > + break; > > case RTE_FLOW_ACTION_TYPE_FLAG: > > ret =3D mlx5_flow_validate_action_flag(action_flags, > > attr, error); > > @@ -2133,10 +2333,40 @@ struct field_modify_info modify_tcp[] =3D { > > "action not supported"); > > } > > } > > - if (!(action_flags & MLX5_FLOW_FATE_ACTIONS) && attr->ingress) > > - return rte_flow_error_set(error, EINVAL, > > - RTE_FLOW_ERROR_TYPE_ACTION, > actions, > > - "no fate action is found"); > > + /* Eswitch has few restrictions on using items and actions */ > > + if (attr->transfer) { > > + if (action_flags & MLX5_FLOW_ACTION_FLAG) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action FLAG"); > > + if (action_flags & MLX5_FLOW_ACTION_MARK) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action MARK"); > > + if (action_flags & MLX5_FLOW_ACTION_QUEUE) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action > QUEUE"); > > + if (action_flags & MLX5_FLOW_ACTION_RSS) > > + return rte_flow_error_set(error, ENOTSUP, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + NULL, > > + "unsupported action RSS"); > > + if (!(action_flags & MLX5_FLOW_FATE_ESWITCH_ACTIONS)) > > + return rte_flow_error_set(error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + actions, > > + "no fate action is found"); > > + } else { > > + if (!(action_flags & MLX5_FLOW_FATE_ACTIONS) && attr- > >ingress) > > + return rte_flow_error_set(error, EINVAL, > > + > RTE_FLOW_ERROR_TYPE_ACTION, > > + actions, > > + "no fate action is found"); > > + } > > return 0; > > } > > > > -- > > 1.8.3.1 > >