From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10065.outbound.protection.outlook.com [40.107.1.65]) by dpdk.org (Postfix) with ESMTP id A16341B8CC for ; Thu, 18 Apr 2019 02:19:58 +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=SKqjhrw5PPjE4uXQsojoQ94kN7Jrv1oGzj2aa104Du8=; b=kLsdq5Nz+EOE62M3vQ2oE46K43HZ5SJ24Dnblczj3L8n+/akyl0mfDYUKXwe8YZcveEjE1SCUAJpgOQuPFB7SXfAZ7V110biWUSi82ikxvLJzdmqZPWysF75h3WzMu6wY4mgFRhq0g9I2aea8tRhL5xueZBlieCyDuPoI665RZI= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4059.eurprd05.prod.outlook.com (52.134.66.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.17; Thu, 18 Apr 2019 00:19:54 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1813.011; Thu, 18 Apr 2019 00:19:54 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs Thread-Index: AQHU8wbxlyg+y0/rokG5LXwOhztUW6ZBEsoA Date: Thu, 18 Apr 2019 00:19:54 +0000 Message-ID: <20190418001944.GB31179@mtidpdk.mti.labs.mlnx> References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-6-git-send-email-orika@mellanox.com> In-Reply-To: <1555276357-4892-6-git-send-email-orika@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BY5PR16CA0025.namprd16.prod.outlook.com (2603:10b6:a03:1a0::38) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d6d6c01f-3375-48fb-109e-08d6c3939465 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:DB3PR0502MB4059; x-ms-traffictypediagnostic: DB3PR0502MB4059: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(376002)(366004)(136003)(189003)(199004)(25786009)(6116002)(3846002)(316002)(54906003)(7736002)(52116002)(102836004)(305945005)(386003)(186003)(66066001)(76176011)(99286004)(97736004)(71200400001)(71190400001)(446003)(11346002)(6506007)(476003)(4326008)(6512007)(256004)(9686003)(68736007)(486006)(26005)(229853002)(53936002)(6636002)(81166006)(8676002)(14444005)(6862004)(81156014)(478600001)(2906002)(1076003)(6436002)(8936002)(5660300002)(14454004)(6486002)(6246003)(33656002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4059; H:DB3PR0502MB3980.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: qOrW/tkdXepmjPTxXNKl3LNcp34xKQN/Vk+1qgqPDRGxrlbi4aL9ACQ46dRK4z/QJPe1pj/V06TQ267FoZvXcA3egEUZ85GN07cO0KNpic4FA23aD7Uy0OuPBKf0tRP7nMkMfyWdbJYh74pb/JKmcc6QEufDJvU6kmTleJl6NMNwFMVjBuoB6sbDz4HruSQ/vNm56EgVn5+oWv2mej68e/B+phYUCtLCmwSLJK+c1j/SnpBXc81QLlqhhAa7bQjEQoZ0NW7KfdX2Fd5mdcM6+x1DWU3oqZ9rYVGOJejlw+bohb6083eyuKy0GB9GTK5j8KQE6HZZpvNAJKRGKYQrsVWuVE+2RcM/7jStmTQbbBrpbeqsKj6bRQ+pmrduJt9i7bYoozOTURnJ8+5gJKBjXe3dI7xZvB6fiM+sZjITiS8= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6d6c01f-3375-48fb-109e-08d6c3939465 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 00:19:54.0846 (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: DB3PR0502MB4059 Subject: Re: [dpdk-dev] [PATCH 5/9] net/mlx5: add port ID item 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: Thu, 18 Apr 2019 00:19:59 -0000 On Sun, Apr 14, 2019 at 09:12:33PM +0000, Ori Kam wrote: > Adds the port ID item to the DV steering code. >=20 > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5_flow_dv.c | 86 ++++++++++++++++++++++++++++++-----= ------ > 1 file changed, 63 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow= _dv.c > index fedc6cb..e66ee34 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -3095,6 +3095,64 @@ struct field_modify_info modify_tcp[] =3D { > } > } > =20 > +/** > + * Add source vport match to the specified matcher. > + * > + * @param[in, out] matcher > + * Flow matcher. > + * @param[in, out] key > + * Flow matcher value. > + * @param[in] port > + * Source vport value to match > + * @param[in] mask > + * Mask > + */ > +static void > +flow_dv_translate_item_source_vport(void *matcher, void *key, > + int16_t port, uint16_t mask) > +{ > + void *misc_m =3D MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters= ); > + void *misc_v =3D MLX5_ADDR_OF(fte_match_param, key, misc_parameters); > + > + MLX5_SET(fte_match_set_misc, misc_m, source_port, mask); > + MLX5_SET(fte_match_set_misc, misc_v, source_port, port); > +} > + > +/** > + * Translate port-id item to eswitch match on port-id. > + * > + * @param[in] dev > + * The devich to configure through. > + * @param[in, out] matcher > + * Flow matcher. > + * @param[in, out] key > + * Flow matcher value. > + * @param[in] item > + * Flow pattern to translate. > + * > + * @return > + * 0 on success, a negative errno value otherwise. > + */ > +static int > +flow_dv_eswitch_translate_item_port_id(struct rte_eth_dev *dev, Why did you put _eswitch in the function name unlike flow_dv_validate_item_port_id()? It sounds awkward. > + void *matcher, void *key, > + const struct rte_flow_item *item) > +{ > + const struct rte_flow_item_port_id *pid_m =3D item ? item->mask : NULL; > + const struct rte_flow_item_port_id *pid_v =3D item ? item->spec : NULL; > + uint16_t mask, val, id; > + int ret; > + > + mask =3D pid_m ? pid_m->id : 0xffff; > + id =3D pid_v ? pid_v->id : dev->data->port_id; > + id =3D mask ? id : dev->data->port_id; Again, doesn't zero mask mean 'any' value? Thanks, Yongseok > + ret =3D mlx5_port_to_eswitch_info(id, NULL, &val); > + if (ret) > + return ret; > + flow_dv_translate_item_source_vport(matcher, key, val, mask); > + return 0; > +} > + > static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] =3D { 0 }; > =20 > #define HEADER_IS_ZERO(match_criteria, headers) \ > @@ -3305,29 +3363,6 @@ struct field_modify_info modify_tcp[] =3D { > } > =20 > /** > - * Add source vport match to the specified matcher. > - * > - * @param[in, out] matcher > - * Flow matcher. > - * @param[in, out] key > - * Flow matcher value. > - * @param[in] port > - * Source vport value to match > - * @param[in] mask > - * Mask > - */ > -static void > -flow_dv_translate_item_source_vport(void *matcher, void *key, > - int16_t port, uint16_t mask) > -{ > - void *misc_m =3D MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters= ); > - void *misc_v =3D MLX5_ADDR_OF(fte_match_param, key, misc_parameters); > - > - MLX5_SET(fte_match_set_misc, misc_m, source_port, mask); > - MLX5_SET(fte_match_set_misc, misc_v, source_port, port); > -} > - > -/** > * Find existing tag resource or create and register a new one. > * > * @param dev[in, out] > @@ -3733,6 +3768,11 @@ struct field_modify_info modify_tcp[] =3D { > void *match_value =3D dev_flow->dv.value.buf; > =20 > switch (items->type) { > + case RTE_FLOW_ITEM_TYPE_PORT_ID: > + flow_dv_eswitch_translate_item_port_id > + (dev, match_mask, match_value, items); > + last_item =3D MLX5_FLOW_ITEM_PORT_ID; > + break; > case RTE_FLOW_ITEM_TYPE_ETH: > flow_dv_translate_item_eth(match_mask, match_value, > items, tunnel); > --=20 > 1.8.3.1 >=20 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 219AFA00E6 for ; Thu, 18 Apr 2019 02:20:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 45EA01B8D1; Thu, 18 Apr 2019 02:20:00 +0200 (CEST) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10065.outbound.protection.outlook.com [40.107.1.65]) by dpdk.org (Postfix) with ESMTP id A16341B8CC for ; Thu, 18 Apr 2019 02:19:58 +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=SKqjhrw5PPjE4uXQsojoQ94kN7Jrv1oGzj2aa104Du8=; b=kLsdq5Nz+EOE62M3vQ2oE46K43HZ5SJ24Dnblczj3L8n+/akyl0mfDYUKXwe8YZcveEjE1SCUAJpgOQuPFB7SXfAZ7V110biWUSi82ikxvLJzdmqZPWysF75h3WzMu6wY4mgFRhq0g9I2aea8tRhL5xueZBlieCyDuPoI665RZI= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4059.eurprd05.prod.outlook.com (52.134.66.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.17; Thu, 18 Apr 2019 00:19:54 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::6072:43be:7c2d:103a%3]) with mapi id 15.20.1813.011; Thu, 18 Apr 2019 00:19:54 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs Thread-Index: AQHU8wbxlyg+y0/rokG5LXwOhztUW6ZBEsoA Date: Thu, 18 Apr 2019 00:19:54 +0000 Message-ID: <20190418001944.GB31179@mtidpdk.mti.labs.mlnx> References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555276357-4892-6-git-send-email-orika@mellanox.com> In-Reply-To: <1555276357-4892-6-git-send-email-orika@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BY5PR16CA0025.namprd16.prod.outlook.com (2603:10b6:a03:1a0::38) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d6d6c01f-3375-48fb-109e-08d6c3939465 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:DB3PR0502MB4059; x-ms-traffictypediagnostic: DB3PR0502MB4059: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(376002)(366004)(136003)(189003)(199004)(25786009)(6116002)(3846002)(316002)(54906003)(7736002)(52116002)(102836004)(305945005)(386003)(186003)(66066001)(76176011)(99286004)(97736004)(71200400001)(71190400001)(446003)(11346002)(6506007)(476003)(4326008)(6512007)(256004)(9686003)(68736007)(486006)(26005)(229853002)(53936002)(6636002)(81166006)(8676002)(14444005)(6862004)(81156014)(478600001)(2906002)(1076003)(6436002)(8936002)(5660300002)(14454004)(6486002)(6246003)(33656002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4059; H:DB3PR0502MB3980.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: qOrW/tkdXepmjPTxXNKl3LNcp34xKQN/Vk+1qgqPDRGxrlbi4aL9ACQ46dRK4z/QJPe1pj/V06TQ267FoZvXcA3egEUZ85GN07cO0KNpic4FA23aD7Uy0OuPBKf0tRP7nMkMfyWdbJYh74pb/JKmcc6QEufDJvU6kmTleJl6NMNwFMVjBuoB6sbDz4HruSQ/vNm56EgVn5+oWv2mej68e/B+phYUCtLCmwSLJK+c1j/SnpBXc81QLlqhhAa7bQjEQoZ0NW7KfdX2Fd5mdcM6+x1DWU3oqZ9rYVGOJejlw+bohb6083eyuKy0GB9GTK5j8KQE6HZZpvNAJKRGKYQrsVWuVE+2RcM/7jStmTQbbBrpbeqsKj6bRQ+pmrduJt9i7bYoozOTURnJ8+5gJKBjXe3dI7xZvB6fiM+sZjITiS8= Content-Type: text/plain; charset="UTF-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6d6c01f-3375-48fb-109e-08d6c3939465 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 00:19:54.0846 (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: DB3PR0502MB4059 Subject: Re: [dpdk-dev] [PATCH 5/9] net/mlx5: add port ID item 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190418001954.4Ywp-5RP9U7zprJXGclYm2_GnvNADJIHvWFmyoKfr0Q@z> On Sun, Apr 14, 2019 at 09:12:33PM +0000, Ori Kam wrote: > Adds the port ID item to the DV steering code. >=20 > Signed-off-by: Ori Kam > --- > drivers/net/mlx5/mlx5_flow_dv.c | 86 ++++++++++++++++++++++++++++++-----= ------ > 1 file changed, 63 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow= _dv.c > index fedc6cb..e66ee34 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -3095,6 +3095,64 @@ struct field_modify_info modify_tcp[] =3D { > } > } > =20 > +/** > + * Add source vport match to the specified matcher. > + * > + * @param[in, out] matcher > + * Flow matcher. > + * @param[in, out] key > + * Flow matcher value. > + * @param[in] port > + * Source vport value to match > + * @param[in] mask > + * Mask > + */ > +static void > +flow_dv_translate_item_source_vport(void *matcher, void *key, > + int16_t port, uint16_t mask) > +{ > + void *misc_m =3D MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters= ); > + void *misc_v =3D MLX5_ADDR_OF(fte_match_param, key, misc_parameters); > + > + MLX5_SET(fte_match_set_misc, misc_m, source_port, mask); > + MLX5_SET(fte_match_set_misc, misc_v, source_port, port); > +} > + > +/** > + * Translate port-id item to eswitch match on port-id. > + * > + * @param[in] dev > + * The devich to configure through. > + * @param[in, out] matcher > + * Flow matcher. > + * @param[in, out] key > + * Flow matcher value. > + * @param[in] item > + * Flow pattern to translate. > + * > + * @return > + * 0 on success, a negative errno value otherwise. > + */ > +static int > +flow_dv_eswitch_translate_item_port_id(struct rte_eth_dev *dev, Why did you put _eswitch in the function name unlike flow_dv_validate_item_port_id()? It sounds awkward. > + void *matcher, void *key, > + const struct rte_flow_item *item) > +{ > + const struct rte_flow_item_port_id *pid_m =3D item ? item->mask : NULL; > + const struct rte_flow_item_port_id *pid_v =3D item ? item->spec : NULL; > + uint16_t mask, val, id; > + int ret; > + > + mask =3D pid_m ? pid_m->id : 0xffff; > + id =3D pid_v ? pid_v->id : dev->data->port_id; > + id =3D mask ? id : dev->data->port_id; Again, doesn't zero mask mean 'any' value? Thanks, Yongseok > + ret =3D mlx5_port_to_eswitch_info(id, NULL, &val); > + if (ret) > + return ret; > + flow_dv_translate_item_source_vport(matcher, key, val, mask); > + return 0; > +} > + > static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] =3D { 0 }; > =20 > #define HEADER_IS_ZERO(match_criteria, headers) \ > @@ -3305,29 +3363,6 @@ struct field_modify_info modify_tcp[] =3D { > } > =20 > /** > - * Add source vport match to the specified matcher. > - * > - * @param[in, out] matcher > - * Flow matcher. > - * @param[in, out] key > - * Flow matcher value. > - * @param[in] port > - * Source vport value to match > - * @param[in] mask > - * Mask > - */ > -static void > -flow_dv_translate_item_source_vport(void *matcher, void *key, > - int16_t port, uint16_t mask) > -{ > - void *misc_m =3D MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters= ); > - void *misc_v =3D MLX5_ADDR_OF(fte_match_param, key, misc_parameters); > - > - MLX5_SET(fte_match_set_misc, misc_m, source_port, mask); > - MLX5_SET(fte_match_set_misc, misc_v, source_port, port); > -} > - > -/** > * Find existing tag resource or create and register a new one. > * > * @param dev[in, out] > @@ -3733,6 +3768,11 @@ struct field_modify_info modify_tcp[] =3D { > void *match_value =3D dev_flow->dv.value.buf; > =20 > switch (items->type) { > + case RTE_FLOW_ITEM_TYPE_PORT_ID: > + flow_dv_eswitch_translate_item_port_id > + (dev, match_mask, match_value, items); > + last_item =3D MLX5_FLOW_ITEM_PORT_ID; > + break; > case RTE_FLOW_ITEM_TYPE_ETH: > flow_dv_translate_item_eth(match_mask, match_value, > items, tunnel); > --=20 > 1.8.3.1 >=20