From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00088.outbound.protection.outlook.com [40.107.0.88]) by dpdk.org (Postfix) with ESMTP id 6B8D31B9C4 for ; Thu, 18 Apr 2019 14:17:43 +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=WBvLV0atobCbEuiimQD1+nj51qT2MyXntK79RcB1shk=; b=RDPiTGbHtmUGscvpfoijYpLOixbYe4HelH4pH0yJJXTO9KHoINfk2pgkvtys07Tm5RM8Kg+qG+p38M2rY5enFw2hlMG/jeJF6SobUAa3GT+ESF3iNqTOZxF3vU3lImwYfAqxukROVgM3ASJQ1ik78SoJCQHvIoYgi08CaftEJIk= Received: from AM0PR0502MB3971.eurprd05.prod.outlook.com (52.133.40.151) by AM0PR0502MB3748.eurprd05.prod.outlook.com (52.133.47.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.11; Thu, 18 Apr 2019 12:17:42 +0000 Received: from AM0PR0502MB3971.eurprd05.prod.outlook.com ([fe80::7da6:9e13:922a:9d88]) by AM0PR0502MB3971.eurprd05.prod.outlook.com ([fe80::7da6:9e13:922a:9d88%5]) with mapi id 15.20.1813.013; Thu, 18 Apr 2019 12:17:42 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH v2 5/9] net/mlx5: add port ID item to Direct Verbs Thread-Index: AQHU9dn/NC3uasPTokK/J1EWx3Lnf6ZB1bMA Date: Thu, 18 Apr 2019 12:17:42 +0000 Message-ID: <20190418121733.GK31179@mtidpdk.mti.labs.mlnx> References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555586930-109097-1-git-send-email-orika@mellanox.com> <1555586930-109097-6-git-send-email-orika@mellanox.com> In-Reply-To: <1555586930-109097-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: BYAPR11CA0103.namprd11.prod.outlook.com (2603:10b6:a03:f4::44) To AM0PR0502MB3971.eurprd05.prod.outlook.com (2603:10a6:208:11::23) 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: 16705ab2-f078-45ac-d543-08d6c3f7db11 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:AM0PR0502MB3748; x-ms-traffictypediagnostic: AM0PR0502MB3748: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(346002)(366004)(136003)(199004)(189003)(97736004)(71190400001)(76176011)(229853002)(6436002)(14454004)(3846002)(7736002)(6116002)(2906002)(316002)(71200400001)(9686003)(5660300002)(6512007)(6636002)(6486002)(52116002)(53936002)(6246003)(86362001)(305945005)(99286004)(68736007)(256004)(66066001)(8936002)(6506007)(33656002)(478600001)(4326008)(102836004)(11346002)(446003)(8676002)(26005)(386003)(6862004)(476003)(54906003)(1076003)(486006)(186003)(81166006)(25786009)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3748; H:AM0PR0502MB3971.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: GyBLQJ2jq1yyfazVPpEHfn095RDGREVYuw/4/xPETsLCp+QhwU0EMlwRsNlqrRBA5Ha32XFPdYU0FfyxrTVLn/7FIidLw+S/q39RpqN9JgNwvYm97d9RS+doUinBrUSG2A4k1feO9IoPHxnVmoIf6MXKwSRaWe27QUF4wKJysZM8MXjRgR3wu/+CP9+jk84qqBHKJIBoTNZnj+vuZcXAp2wSQ5bUdlCjrV9xZuES2ZXXIjdyPkINSiDE70CLM8JlFI5fqiJYx7VnLbPA8MaGAYdAYw4rTmuIvLGTnnl4S968fb84dObDpIfbq5E/Yfkg9OEvJlYQwQigQ8gg7fr1807woJG/xH9LTc3jQxfCPyPqVP2uPxyBR1QOYuTO7yDHNGKdTEI2dYAyr0Ve+d12zQeeuLCU4+mKBkGzCUT/k2k= Content-Type: text/plain; charset="us-ascii" Content-ID: <767F76A8AA7CCE49873CEAF4F4E8160A@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16705ab2-f078-45ac-d543-08d6c3f7db11 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 12:17:42.3534 (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: AM0PR0502MB3748 Subject: Re: [dpdk-dev] [PATCH v2 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 12:17:43 -0000 On Thu, Apr 18, 2019 at 11:28:46AM +0000, Ori Kam wrote: > Adds the port ID item to the DV steering code. >=20 > Signed-off-by: Ori Kam > --- Acked-by: Yongseok Koh > v2: > * Address ML comments. > --- > drivers/net/mlx5/mlx5_flow_dv.c | 84 ++++++++++++++++++++++++++++++-----= ------ > 1 file changed, 61 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow= _dv.c > index b819359..e3d9aa2 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -3086,6 +3086,62 @@ 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_translate_item_port_id(struct rte_eth_dev *dev, 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; > + 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) \ > @@ -3296,29 +3352,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] > @@ -3724,6 +3757,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_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 64601A00E6 for ; Thu, 18 Apr 2019 14:17:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D58F1B9C8; Thu, 18 Apr 2019 14:17:44 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00088.outbound.protection.outlook.com [40.107.0.88]) by dpdk.org (Postfix) with ESMTP id 6B8D31B9C4 for ; Thu, 18 Apr 2019 14:17:43 +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=WBvLV0atobCbEuiimQD1+nj51qT2MyXntK79RcB1shk=; b=RDPiTGbHtmUGscvpfoijYpLOixbYe4HelH4pH0yJJXTO9KHoINfk2pgkvtys07Tm5RM8Kg+qG+p38M2rY5enFw2hlMG/jeJF6SobUAa3GT+ESF3iNqTOZxF3vU3lImwYfAqxukROVgM3ASJQ1ik78SoJCQHvIoYgi08CaftEJIk= Received: from AM0PR0502MB3971.eurprd05.prod.outlook.com (52.133.40.151) by AM0PR0502MB3748.eurprd05.prod.outlook.com (52.133.47.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.11; Thu, 18 Apr 2019 12:17:42 +0000 Received: from AM0PR0502MB3971.eurprd05.prod.outlook.com ([fe80::7da6:9e13:922a:9d88]) by AM0PR0502MB3971.eurprd05.prod.outlook.com ([fe80::7da6:9e13:922a:9d88%5]) with mapi id 15.20.1813.013; Thu, 18 Apr 2019 12:17:42 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , Matan Azrad , Slava Ovsiienko , Moti Haimovsky , "dev@dpdk.org" Thread-Topic: [PATCH v2 5/9] net/mlx5: add port ID item to Direct Verbs Thread-Index: AQHU9dn/NC3uasPTokK/J1EWx3Lnf6ZB1bMA Date: Thu, 18 Apr 2019 12:17:42 +0000 Message-ID: <20190418121733.GK31179@mtidpdk.mti.labs.mlnx> References: <1555276357-4892-1-git-send-email-orika@mellanox.com> <1555586930-109097-1-git-send-email-orika@mellanox.com> <1555586930-109097-6-git-send-email-orika@mellanox.com> In-Reply-To: <1555586930-109097-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: BYAPR11CA0103.namprd11.prod.outlook.com (2603:10b6:a03:f4::44) To AM0PR0502MB3971.eurprd05.prod.outlook.com (2603:10a6:208:11::23) 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: 16705ab2-f078-45ac-d543-08d6c3f7db11 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:AM0PR0502MB3748; x-ms-traffictypediagnostic: AM0PR0502MB3748: x-microsoft-antispam-prvs: x-forefront-prvs: 0011612A55 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(346002)(366004)(136003)(199004)(189003)(97736004)(71190400001)(76176011)(229853002)(6436002)(14454004)(3846002)(7736002)(6116002)(2906002)(316002)(71200400001)(9686003)(5660300002)(6512007)(6636002)(6486002)(52116002)(53936002)(6246003)(86362001)(305945005)(99286004)(68736007)(256004)(66066001)(8936002)(6506007)(33656002)(478600001)(4326008)(102836004)(11346002)(446003)(8676002)(26005)(386003)(6862004)(476003)(54906003)(1076003)(486006)(186003)(81166006)(25786009)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3748; H:AM0PR0502MB3971.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: GyBLQJ2jq1yyfazVPpEHfn095RDGREVYuw/4/xPETsLCp+QhwU0EMlwRsNlqrRBA5Ha32XFPdYU0FfyxrTVLn/7FIidLw+S/q39RpqN9JgNwvYm97d9RS+doUinBrUSG2A4k1feO9IoPHxnVmoIf6MXKwSRaWe27QUF4wKJysZM8MXjRgR3wu/+CP9+jk84qqBHKJIBoTNZnj+vuZcXAp2wSQ5bUdlCjrV9xZuES2ZXXIjdyPkINSiDE70CLM8JlFI5fqiJYx7VnLbPA8MaGAYdAYw4rTmuIvLGTnnl4S968fb84dObDpIfbq5E/Yfkg9OEvJlYQwQigQ8gg7fr1807woJG/xH9LTc3jQxfCPyPqVP2uPxyBR1QOYuTO7yDHNGKdTEI2dYAyr0Ve+d12zQeeuLCU4+mKBkGzCUT/k2k= Content-Type: text/plain; charset="UTF-8" Content-ID: <767F76A8AA7CCE49873CEAF4F4E8160A@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16705ab2-f078-45ac-d543-08d6c3f7db11 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2019 12:17:42.3534 (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: AM0PR0502MB3748 Subject: Re: [dpdk-dev] [PATCH v2 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: <20190418121742.oOS64LrIQQl__jaasZ6QYBLKMaMN7NLHeOwsp7T1PE4@z> On Thu, Apr 18, 2019 at 11:28:46AM +0000, Ori Kam wrote: > Adds the port ID item to the DV steering code. >=20 > Signed-off-by: Ori Kam > --- Acked-by: Yongseok Koh > v2: > * Address ML comments. > --- > drivers/net/mlx5/mlx5_flow_dv.c | 84 ++++++++++++++++++++++++++++++-----= ------ > 1 file changed, 61 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow= _dv.c > index b819359..e3d9aa2 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -3086,6 +3086,62 @@ 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_translate_item_port_id(struct rte_eth_dev *dev, 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; > + 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) \ > @@ -3296,29 +3352,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] > @@ -3724,6 +3757,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_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