From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0050.outbound.protection.outlook.com [104.47.0.50]) by dpdk.org (Postfix) with ESMTP id AB24C2BB1 for ; Tue, 28 Aug 2018 22:42:12 +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=eUJoav1RNW2fgdhkISENTDjrkRA2L1kqsWD0iB6mJzE=; b=noQn7BiD4qgIRNNeQr9H6AZBlUAFNexvHN1r/ZMU6tcoq/j5JbHe9c/aK+MtVluo+FC+Hqvz8umLIepBF0IBRn1I3lDl8XYx56yBYjV4diSKgXipCEY9fd1xT+I5GDLADV+d5/hBsJqEohENojuDdh9kXJ18wYDxNtK2IkLI0ss= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (2607:fb90:284d:e2ac:e972:b551:d6d4:d5c8) by VI1PR0502MB3984.eurprd05.prod.outlook.com (2603:10a6:803:24::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Tue, 28 Aug 2018 20:42:09 +0000 Date: Tue, 28 Aug 2018 13:42:18 -0700 From: Yongseok Koh To: Shahaf Shuler , dev@dpdk.org, xuemingl@mellanox.com Message-ID: <20180828204217.GA45628@yongseok-MBP.local> References: <20180823063851.32559-1-jackmin@mellanox.com> <20180823210808.GA31847@yongseok-MBP.local> <20180824064500.uopotkliiaygvvny@MTBC-JACKMIN.mtl.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180824064500.uopotkliiaygvvny@MTBC-JACKMIN.mtl.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [2607:fb90:284d:e2ac:e972:b551:d6d4:d5c8] X-ClientProxiedBy: CY4PR13CA0015.namprd13.prod.outlook.com (2603:10b6:903:32::25) To VI1PR0502MB3984.eurprd05.prod.outlook.com (2603:10a6:803:24::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0fbb1ff-a27a-430c-5f7e-08d60d26babb X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0502MB3984; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3984; 3:eSqTdPOz9mMAAMXQakRdnicVfLSC5Wiqryrw1zIhSJPyviT/CL16GeI8iPdTRTZiTKBbgwMhoQm7flQgevXSF5q/mQJlI7OqKybJSWltHz5VH9uTT1b7WCp+vVDkRC4TrBpX/UvVPSsjZLMwtXXSohgBQ9NmXT/kRg9g4fo3uqYDkExtkXQPUu5k4Qv42zXpoLxhsEwRwDGxEz4LqX5BFeKdv4iuNHGhABzeZcttmIULoMzKM8GiZdeVXhyHKBy9; 25:qdJl7qdR7JjhKAIPqANlqKmn/qP9f97tvAQrGBNbL65P+UMvMvYjf1iu4pmDZkhLRJqAfxa42eqmqPXorzrsgPFaC/CPjdGxq43YfxTDt5llqWojrWErGmPIs5a+zvd+y00aJXRNR38ZDU/yEjkuFd4DJeL3ItkjcTxt3wpahFJoSTiCL/5805KilKjGYk97j8CR+eA3xKAueZbSUlvAWbwDJdQzMQPonN4K1ELxFbruG1PcMouEwFfMdTLxCOyXd7QlH31KFH726zcCsusZrf+i8/peu8ZDv5TnVGLcLIv+BLvjftBbjSUG9woJWK4bIGTFVSvHyYp9wYgp+ZKB1g==; 31:sY2M4MmCBX4v/JlEBuxdB7slxdHv+t0yYqqwZiQhYuYktCToQs1p97XBUvzkOqH7EVtY8zwTVPlpxoKat7BnHNlIQxt1auKkagv4QrspXUcGvHtxwUjC5vWHmHof+Cpf+GGjn9ECsX4ylk59A8BPA0rqYXTEci+nbEk8XWR8R6ZXu+zz+1yK2ZyYYyPIoTtiEuatlu7oWtBrEd2Fso+fHMRaGX0Df+0DDLmB4OuPgDs= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3984: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3984; 20:2mS2vRAWKnPDfH08YjQX/OtT6cnzNGGX3Pm6hm/BlnWCCVxSB3AZlmniLnHnlIjW8tJzTtqvxyTYclibLkGKPuNUHjwoNCJe4Xmx3g/aHnE9lYQLNwGaN6LPNL6nUe0T1F2xnu/rLIusBMuqdSmi+69eueLQo4wtDMHDUA+MrPIYMjQBcIN7xgb9iLqahkKPU8r8ItSq+YREegonpojaP4ZuM/0VcaITh7PWndcqK+jEJCk2hian7V7R1IFzb2kheMK0kgtpG12Pk7Hez0S45IvyHF2u8ECZTgtASZ1tjx+V1SKR274PcFRbBpom0m/mbgz/2fdKwjyVnkMpdvkvtltcYmDzHPf9m7qq37DVRToHWe6QS68KnXkHIEGAjatcbvMaMlaYdWCTprETbAP6COVMSDkZVqTdKhgXcVQrwH8EPE+ny0iA48aHKk2OE9/IQNlkyH+Eqil5sT2Kg2Ni1LiVp4SQAIdYSL2iRmELIo2tMDGi2US0rxUk88Z/Bx2P; 4:Rsy6n3I/d8zOIhXa5bjKQg9HILNqfctpf9ncRn/LwUn5AF1bAUHK+H9uf6BsDADD1Pmh8UHseHNYqouYcC0MDTpOJQs7z5P3PfCPfjTxRIijD47gESAIz2rW40buqUcKDKg/UKj/zIykAk0Pc0BkHd4XCn+5ytuepocBAqFrsM0WRrXvgiOdRn3A8q6cK6BlMpECW7eKUkdUGGpWZucS42GY2SMi3dHhtz5SJwFX2cOogmkLRkxOp0suyfL5xoHT/aSDluCGi/tbD2KpzZ5Vsg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(201708071742011)(7699016); SRVR:VI1PR0502MB3984; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB3984; X-Forefront-PRVS: 077884B8B5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(346002)(136003)(396003)(366004)(199004)(189003)(446003)(486006)(5660300001)(8676002)(81156014)(81166006)(11346002)(68736007)(6666003)(33656002)(98436002)(97736004)(476003)(2906002)(6636002)(25786009)(55016002)(23726003)(6246003)(1076002)(46003)(105586002)(47776003)(6116002)(8936002)(14444005)(106356001)(53936002)(9686003)(16526019)(33896004)(52116002)(52396003)(50466002)(478600001)(7696005)(305945005)(7736002)(316002)(58126008)(16586007)(76176011)(386003)(229853002)(6506007)(86362001)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3984; H:yongseok-MBP.local; 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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0502MB3984; 23:XC0zDi9nMXvFl5NP0RCGIdrHcqCrkGDvZMXDotf?= =?us-ascii?Q?AkaCfl+22Dru82I/xQOoXuJKV8sgUNNZFc7t8nYx/UFkSfd4eA5ujSGftunS?= =?us-ascii?Q?fxMDkvF61paFga9by/xjK8lKR3+26z6p0n7V31LKINLDzvM/+u801/FCEAJV?= =?us-ascii?Q?g/DRhTlLBLCAIGpwmvxSSwm8YEyvyRqtUU2AEOPoeWD4sWG9I1HkUegM52X6?= =?us-ascii?Q?dTlWTqjVfdw/FNFsibmm8dMhxD29RDmhAl60ZIm7aESDZsNR58IZXHHwZcVl?= =?us-ascii?Q?JBa/VpDpG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9AmsKCQxQw16VbjMVaMaih3Sy/1N2I4gq1sxFgv1tyMLza0s37U00/qSg/v3p3atTXBrWqUVmji6wldcpZ7++okhw+j3DukkYA=; 7:/6t6rvKn6djmKPBHK74RPmZ+ZsQYQ/wTgHXiQWJwa1CmSCFfoTlN2137dNT2sY2tFWvhJnSla5HVSOMMIyysgvofjFdKLRHQZW3oLWovmmWT3vgtGa2vitkehOQCqnOGKqgRU5HXckU3jUO7wwpR7odttVSki1AVPG8NLgRbLrb/Uc7TZwtKgABx+DMXPIbeBdZkhMvIRSQz9b3mVyQ9jEcCwXdIiOorXuBOTt0ZeBV5Z/7KkW0+A27tylkG1sbq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2018 20:42:09.0318 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0fbb1ff-a27a-430c-5f7e-08d60d26babb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3984 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: handle expected errno properly 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: Tue, 28 Aug 2018 20:42:13 -0000 On Fri, Aug 24, 2018 at 02:45:00PM +0800, Jack MIN wrote: > On Thu, Aug 23, 2018 at 02:08:09PM -0700, Yongseok Koh wrote: > > On Thu, Aug 23, 2018 at 02:38:51PM +0800, Xiaoyu Min wrote: > > > rte_errno is a per thread variable and is widely used as an > > > error indicator, which means a function could affect > > > other functions' results by setting rte_errno carelessly > > > > > > During rxq setup, an EINVAL rte_errno is expected since > > > the queues are not created yet > > > So rte_errno is cleared when it is EINVAL as expected > > > > > > Signed-off-by: Xiaoyu Min > > > --- > > > drivers/net/mlx5/mlx5_rxq.c | 20 +++++++++++++++----- > > > 1 file changed, 15 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c > > > index 1f7bfd4..e7056e8 100644 > > > --- a/drivers/net/mlx5/mlx5_rxq.c > > > +++ b/drivers/net/mlx5/mlx5_rxq.c > > > @@ -443,6 +443,7 @@ > > > struct mlx5_rxq_data *rxq = (*priv->rxqs)[idx]; > > > struct mlx5_rxq_ctrl *rxq_ctrl = > > > container_of(rxq, struct mlx5_rxq_ctrl, rxq); > > > + int ret = 0; > > > > > > if (!rte_is_power_of_2(desc)) { > > > desc = 1 << log2above(desc); > > > @@ -459,13 +460,21 @@ > > > rte_errno = EOVERFLOW; > > > return -rte_errno; > > > } > > > - if (!mlx5_rxq_releasable(dev, idx)) { > > > + ret = mlx5_rxq_releasable(dev, idx); > > > + if (!ret) { > > > DRV_LOG(ERR, "port %u unable to release queue index %u", > > > dev->data->port_id, idx); > > > rte_errno = EBUSY; > > > return -rte_errno; > > > + } else if (ret == -EINVAL) { > > > + /** > > > + * on the first time, rx queue doesn't exist, > > > + * so just ignore this error and reset rte_errno. > > > + */ > > > + rte_errno = 0; > > > > Unless this function returns failure, the rte_errno will be ignored by caller > > and caller shouldn't assume rte_errno has 0. Caller will assume it is garbage > > data in case of success. So we can silently ignore this case. Does it cause any > > issue in application side? > > > Not application side but mlx5 PMD this time: > **mlx5_fdir_filter_delete** > which just _return -rte_errno;_ Looks like an error. mlx5_fdir_filter_delete() can't be like that. We seem to have lost the code while refactoring it. Let take it offline. > For sure, _mlx5_fdir_filter_delete_ should be more defensive, should not assume > rte_errno is zero if no error happened. > However if the caller know that an error will happen and rte_errno will become > meaningless (garbage) for the succeeding functions, Catching the expected error > and resetting rte_errno will be better. What do you think? Still don't understand clearly. There would be many other similar cases where we don't clear rte_errno when returning success. I don't understand why this case should be taken as a special one?? Thanks Yongseok