From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50050.outbound.protection.outlook.com [40.107.5.50]) by dpdk.org (Postfix) with ESMTP id 42FEF1B710 for ; Wed, 10 Oct 2018 18:28:01 +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=g8+cp/OC7vzmDndn7fQiKC5aF0QuYf2lIt+kSjYx3Qk=; b=FzAzI4jWhB5ml2hUBGdXcTzbZMZUuVdy/u0GXPUjEjPzI8zVospnFQRzBgMehjASd+35m/FcV6CDgu5OX5zXvvtSlHtolh1Gu5Yz5WZQaVUTzgi6Hj3PLBpWgjEfgl5BSuPFLQzfEh+0KAXVHXBuCZmlwBh+L1zT8osvlZpKTRM= Received: from AM0PR05MB4435.eurprd05.prod.outlook.com (52.134.92.20) by AM0PR05MB4289.eurprd05.prod.outlook.com (52.134.91.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.26; Wed, 10 Oct 2018 16:28:00 +0000 Received: from AM0PR05MB4435.eurprd05.prod.outlook.com ([fe80::2549:a872:4864:b84e]) by AM0PR05MB4435.eurprd05.prod.outlook.com ([fe80::2549:a872:4864:b84e%6]) with mapi id 15.20.1207.024; Wed, 10 Oct 2018 16:28:00 +0000 From: Mordechay Haimovsky To: Adrien Mazarguil , John Daley CC: "dev@dpdk.org" , Ferruh Yigit Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: fix flow list command Thread-Index: AQHUYCKjv3eD0ZFcQ0y7Pl6PHeDhSaUYKM6AgAB+CVA= Date: Wed, 10 Oct 2018 16:27:59 +0000 Message-ID: References: <20181009225124.25513-1-johndale@cisco.com> <20181010083754.GL18937@6wind.com> In-Reply-To: <20181010083754.GL18937@6wind.com> Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=motih@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR05MB4289; 6:X3B3AWSGUuZ3YJK8rQPYzpNRCzuJPbFtNdUwOJtAmt/3m1Rww2WyN+zxJlYkEU2pcDoaxss4m0UjytSOFOHy+is21HTneEHUUjm55QTV5cEcT56+xG1TFzNTs2jQY0xtSzzjeHpIL5ujHH1eUWqWeSV19S0Kl4dItXFyb8cDhuyKhGh7ZH6bh5Y+zEpGmZg2i80H0AxioD3Zaj7zeX8JHjRZF1e1JaX7jw9vYX20PA86rFExMInGuKvOzfvFj+iFXcVpfW2g18JJbaKwRoASFQx0YMXR5enIRTydZPoOcO3IBkYI3Kw/DUn17ABYaE9MkH2o3sYFKggilnDQvh1/7C9wA7vaFZom/cptdH9BK8xqyVQRUAIBZg3f87RURyy8Ekx0e6xN5dwbS/rL1/uvkIRWvqP7OrQrw/VzDjYPILk/7KIOnMuAavyuYHiu6zipyCopm5DELdrHP0HICnF/0Q==; 5:yCQ30Qf9/zn1nMIcTBbkItAf3bN/Dd0PH/3qezMBLaqZD9MxZr+f6GNg8Poe4JLzmKVJxCPOXU1O8QJ6F60g1zX83cTiYmNoj6Y/x4nKz8z5ERTcl8DI9C0scu96VpDHbxV2fNTA6yfzxvzznV5n3d/GQeA8EKoUIlo1XltwbcM=; 7:yvgYd01bgaTTcYPFoFPseC2MBx9zLbjF71Hw8pu5GWhgV87QCXC3IN8UcFozdWncbv819E0rVFcDMA+QPJBK1AxO6WPcdcpuz0gMevktkVd6y2ks8ngoJ6FMzZhayv1IFgPwdJh2MZW/tV3yvVDHhU6jXvx/wRdlQz/jJYflSbKDbpKzGFx6DaNY2EXO/50AS9xLXsuWz+YVQEW4tUTBCvSTo/UoBUlr5QIHDX/anJWeAVAF3BkzMY7MhT3Kh5Sw x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: c390e59c-b0f0-4c76-025a-08d62ecd5817 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR05MB4289; x-ms-traffictypediagnostic: AM0PR05MB4289: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(45079756050767)(189930954265078)(95692535739014)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231355)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991055); SRVR:AM0PR05MB4289; BCL:0; PCL:0; RULEID:; SRVR:AM0PR05MB4289; x-forefront-prvs: 08213D42D3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(376002)(39860400002)(346002)(13464003)(189003)(199004)(76176011)(305945005)(54906003)(66066001)(476003)(74316002)(2900100001)(26005)(3846002)(25786009)(316002)(53546011)(110136005)(6116002)(446003)(256004)(86362001)(6506007)(5250100002)(68736007)(4326008)(14444005)(7736002)(966005)(99286004)(486006)(11346002)(2906002)(14454004)(33656002)(106356001)(6246003)(105586002)(229853002)(7696005)(6436002)(53936002)(8936002)(71200400001)(81166006)(97736004)(8676002)(71190400001)(5660300001)(186003)(55016002)(6306002)(45080400002)(9686003)(81156014)(478600001)(102836004)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4289; H:AM0PR05MB4435.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-microsoft-antispam-message-info: r1Fk6jTqfkKOZZoaiEtJtP8NQvxJL3o1cY0xpp64A/+Rv/ZYCmw10IK0S6ZFSykpnQ+aLTo98UV+tSSQ8w1dZosQwScSr5pIScQ/Fe3zC5sJF4Pt5WsK4R0GyDss0CrH/rmsCcTPzFqnJWgCO0Q3jqVQRliZFfGvoxAfpZeBkbRWOUFDn76QxbobqGjCw5qVjPZeNpgpYLdhiiaVGIpnjWAsQ6x6MSESiqU6/wTVLFsbgIfizGHjyXFvVu8FX+rB738ARp40pAWIYIt2Krx/tVwfwqnabiO+k0tq9wSL2hQJeN2NVtrcG9ybhGa1mQcjjRnfHVyjQ4aVb6Mg6a0bKxV3KeaCYpqNq8KFsSWG66I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: c390e59c-b0f0-4c76-025a-08d62ecd5817 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2018 16:27:59.9349 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4289 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix flow list command 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: Wed, 10 Oct 2018 16:28:01 -0000 Hi Adrien, You are correct, the bug is not where we thought it is, moreover the fix b= reaks the CLI and should be rejected. We investigated more and found that the bug is in the port_flow_query routi= ne Which passes an incorrect argument to rte_flow_conv as follows: ret =3D rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR, &name, sizeof(name), action, &error); While it should pass onlt the action type as follows: ret =3D rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR, &name, sizeof(name), (void *)(uintptr_t)action->type, &error); As done in port_flow_list routine (which works) if (rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR, &name, sizeof(name), (void *)(uintptr_t)action->type, NULL) <=3D 0) And according to the parameters description of rte_flow_conv_name (called = by rte_flow_conv): * @param[in] src * Depending on @p is_action, source pattern item or action type cast as= a * pointer. Modifying port_flow_query accordingly solves the issue. I will issue a new patch tonight. Moti > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil > Sent: Wednesday, October 10, 2018 11:38 AM > To: John Daley > Cc: dev@dpdk.org; Ferruh Yigit > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix flow list command >=20 > Hi John >=20 > On Tue, Oct 09, 2018 at 03:51:24PM -0700, John Daley wrote: > > This patch fixes the 'flow list ' command which caused a > > segfault when passing the action or item 'type' field instead of the > > action or item struct pointer in the call to rte_flow_conv. > > > > Fixes: 7d94dcedf7ce ("app/testpmd: rely on flow API conversion > > function") > > > > Signed-off-by: John Daley >=20 > That bug was introduced by a broken fix, it wasn't present in the origina= l > patch, please see yesterday's discussion [1]. >=20 > RTE_FLOW_CONV_OP_(ITEM|ACTION)_NAME[_PTR] operations are > documented as using an integer type (enum rte_flow_item_type) cast as > (void *) for src because they convert item/action *types* to correspondin= g > strings, i.e. no need to allocate temporary items/actions just to retriev= e their > names. I thought it would be more versatile and efficient that way. >=20 > [1] "ethdev: fix flow API item/action name conversion" >=20 > https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fma > ils.dpdk.org%2Farchives%2Fdev%2F2018- > October%2F115054.html&data=3D02%7C01%7Cmotih%40mellanox.com%7 > C76b627327b134664eabe08d62e8bba68%7Ca652971c7d2e4d9ba6a4d149256f > 461b%7C0%7C0%7C636747575020110564&sdata=3DnRUfdIhoS%2F2Rm76y > osDvBlttJlvcGJDB1egot8pql%2FY%3D&reserved=3D0 >=20 > > --- > > app/test-pmd/config.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > > 86c205806..2ce40f3e1 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -1354,7 +1354,7 @@ port_flow_list(portid_t port_id, uint32_t n, cons= t > uint32_t group[n]) > > while (item->type !=3D RTE_FLOW_ITEM_TYPE_END) { > > if > (rte_flow_conv(RTE_FLOW_CONV_OP_ITEM_NAME_PTR, > > &name, sizeof(name), > > - (void *)(uintptr_t)item->type, > > + (void *)(uintptr_t)item, >=20 > Also, while it does work because type is the first field, it should have = read > "&item->type" for correctness. Anyway this patch shouldn't be needed > assuming the broken fix is reverted. >=20 > > NULL) <=3D 0) > > name =3D "[UNKNOWN]"; > > if (item->type !=3D RTE_FLOW_ITEM_TYPE_VOID) @@ > -1365,7 +1365,7 @@ > > port_flow_list(portid_t port_id, uint32_t n, const uint32_t group[n]) > > while (action->type !=3D RTE_FLOW_ACTION_TYPE_END) { > > if > (rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR, > > &name, sizeof(name), > > - (void *)(uintptr_t)action->type, > > + (void *)(uintptr_t)action, >=20 > Ditto. >=20 > > NULL) <=3D 0) > > name =3D "[UNKNOWN]"; > > if (action->type !=3D RTE_FLOW_ACTION_TYPE_VOID) > > -- > > 2.16.2 > > >=20 > Thanks. >=20 > -- > Adrien Mazarguil > 6WIND