From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20042.outbound.protection.outlook.com [40.107.2.42]) by dpdk.org (Postfix) with ESMTP id A3B02293B for ; Fri, 24 Aug 2018 08:45:26 +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=Hdi6vJHpwjy6eMqjLhWPEX+Dv7Xw/rEg7PswIyrToYI=; b=DIO2zuHSnh0DEkJgLTq6DjlnUxUH1ohpIWVU/TZQKMoiaFHmXx9l7X4M81iT99TQgT73/C5fd7I1n1z+lk2fYrYZ0v4QQLltPQm7oLIixAn2OfUJsacWg0rZUOJ2Y63G3UNXjYwr/dkJUGQbZlgxPZok2HpW1ZUEmTlEmyV/7hk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; Received: from MTBC-JACKMIN.mtl.com (58.37.21.118) by VI1PR0501MB2031.eurprd05.prod.outlook.com (2603:10a6:800:36::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Fri, 24 Aug 2018 06:45:22 +0000 Date: Fri, 24 Aug 2018 14:45:00 +0800 From: Jack MIN To: Yongseok Koh Cc: Shahaf Shuler , dev@dpdk.org, xuemingl@mellanox.com Message-ID: <20180824064500.uopotkliiaygvvny@MTBC-JACKMIN.mtl.com> Mail-Followup-To: Yongseok Koh , Shahaf Shuler , dev@dpdk.org, xuemingl@mellanox.com References: <20180823063851.32559-1-jackmin@mellanox.com> <20180823210808.GA31847@yongseok-MBP.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180823210808.GA31847@yongseok-MBP.local> User-Agent: NeoMutt/20180622 X-Originating-IP: [58.37.21.118] X-ClientProxiedBy: HK0P153CA0048.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::36) To VI1PR0501MB2031.eurprd05.prod.outlook.com (2603:10a6:800:36::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 367f8531-fe2b-445a-1fa2-08d6098d2b53 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2031; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2031; 3:Sz5xBKFvzWJC+txQnXj9vHac8+oZC70ayDxbkPnz2fNuDwbCMjS4ssxK0pTC8JbJo9H/AOCgyzY7aJItjjFVm7YqVe3HJX/y9OzaBFpXcekE7gxZAYhmSRgieMGdI4LtaY2F1HytuZxDScN07P1xhDe9rd9bvl2HarfiaVaKd0kLv59pHMwhIkWSFnYqcgVIqo15RYZQIiO4v95IVWUCmKm1bnlSHs8qBN6Jh6vOdQXBaS2aV/phxYkZid/pXNf9; 25:NnDmUXLXSQl/4r913VpWIM2ab1POv3EJmqf2U/yaN3RShj6y9ydIqMMQmigMsjKfn1iLvgVFzAl8Coy+PJR31jOuu5h9TSd4pbJzABeXEttIqElboXK3Du33sg71xkdZEpK6VXRPuvwATPkg4Rm5HyHiLFBvZiOWIz1qUHUgbgt2kz4uSMP6Av98FBTReWotYa1YIyb4FRMWjvuJqGYk88gYLa7b9Hc9yinQxwf8fg2feB1+ok7BXKXsSaohnWaO+NPX36gcILZ7EuAhI6XnXi2S28asT2yns59/3jKBRyhe9alopVZmnje0cPP0jeZmngKZ2o2oWsrCmfuJ1s2yAQ==; 31:hrsmrrV9HjPXaGFypC0SGZrUV0R568b3h7XB4aCao3UAEbPOWlP+LRJM459CHijylEUSxkhIFKWI1Namg/PAQlJ1/UTlJWyxHEpSu/kVeMtuqFaOhcyOg+aYQbgNaeQfqDCxNVW/1Q3VTK+/VoaJRZUNZztHo9VOm/5SEsvV4BvOSgBtY6ZeYofHhjq3v9bnno0ryrQyJtmTGJJZS4Zr0+5IMH+bITH6MjpkBxE88vw= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2031: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2031; 20:Uvh925GyjdCG+HQ2Qnsak/VB3E/TacUgiS2cFyl/AkbzaD/EtegK9RFmr4wgA3YQyKYVfK/ZTxQQeR0blLpAY8h7r3h2wSAbMRS5EmlN1OUumA7Ryr4Vql4yTXrxuV8RFsvZYcc2XLb7zu0Twy2FQgtrNDtKubEUOEvNR+Me+An66JnnAzkCzfRI+IVjbRrgxs1NcjZi1uqbmWSJ4D4UtZuY39sCdi+X8soYNeE6hzhBY9A7EGYt4ebS8UrPvURowntS1h5NnGRxEjzGjLbx06qbXIDiaFnHOOPo4B6jQU2Co/2Q8YdetrNtqAjDy/N59iStlsxzjapNXncF+261z1AhNP29wIlPogyDJg3IuV+Xa3uop3HOVoLAkn42pf/prCDhVvXmD+vyLyNTtVbWrii2aizYqKv75YpWoxoUcGx0ptwqSt9KMjKxj1LzaMfcG175XhU0yjgJqpRNTLSWKbHgOKPRvZREBlCFZ+OgGXDQLbgQppzigZy/rXicXz3E; 4:clVLXma/DyTQelq8WpPo2JhWz7ViqdoCbs3rSlvSdIllgP1cBnSwBSPSHiP6l2VtGgkb2KlU/lV+ubuzIcKMQmzUBX3RmtAalVhQI2u3d7lVMFm99K9RuEYJhoXYObSExtydNtwRv+qGpjvTINvUW/3/yAedN+W/80PyqbA8heKzrTR1kVOxSQZslHgXgLcjZhAUqLr/UQK6+h8EsiNTVZ9GU5j2rJgdNusZd2W4GFTeMs4lCcNmR7Ql0jrO72LlHwvrR7On8pqobPPKlG/Y1g== 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)(5005006)(8121501046)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699016); SRVR:VI1PR0501MB2031; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2031; X-Forefront-PRVS: 07749F8C42 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39850400004)(346002)(376002)(366004)(396003)(136003)(199004)(189003)(6506007)(386003)(9686003)(446003)(55016002)(16526019)(23726003)(1076002)(478600001)(476003)(486006)(53936002)(11346002)(86362001)(68736007)(26005)(8936002)(14444005)(956004)(7736002)(229853002)(305945005)(3716004)(58126008)(47776003)(97736004)(81166006)(50466002)(6116002)(2906002)(3846002)(4326008)(66066001)(25786009)(6666003)(6636002)(53416004)(52116002)(81156014)(316002)(6862004)(76176011)(7696005)(106356001)(107886003)(105586002)(6246003)(5660300001)(8676002)(16586007); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2031; H:MTBC-JACKMIN.mtl.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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2031; 23:eUluthY5mD+6QKRppYBNVuVWQJD7MBknmDBKnov?= =?us-ascii?Q?h2XSA4+sDCvb0tNPS9eCHUs0JX5wVkuGqBxy0Nnojykr87gZJjAMRTH8gTn6?= =?us-ascii?Q?6HcOD2CkEZXjtyAgmB1w/XwbQXRkrcA36zZMOQUXD9uWYw3Uu+KO3fFzrvKL?= =?us-ascii?Q?vGB3aW0zCVCO18l9/8z5Wtt4p4J2sTbks5AKbk6Nzr4hDuoflpjQj/mfzozc?= =?us-ascii?Q?Wo6HmjmWtqGUpPQI4XT4d50NRngjIogScpBaiIO6ilEj6HlIO6DkTc1xEDVP?= =?us-ascii?Q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Xyq4PVdCQm/7aDJNkbKLP7TuiSs6KyyBi44bSy+BHtVug5hECO37xXcnlCZv8C/LOrR9Dlm8YgWNn8wSqhsfZOuLZo0VCazNxjren2VZrbHk682hjtj8ct5MxA5FdCJT9hqNl5jLU03i4AaAoJc=; 7:o24rjmaoJYzQwDr4vX4ran2Nu6A2E5HJkPdUJfdCh3mmp+aNwjObI57HX/RDpZjpdPcLLTwjKkwqyi3MlfX+WEs7G93d8eKGBOXyT+oX4eRLQiWjUvXbdAsfoWfx1cuE18BOjpIkxmiqoXacMrYOR4PygXOWwuZOB5j0CE0JUo5QPW/pEotAJgyAZKnT4a/+vZTjzGdhAKfiPn1nisPLF5+pvaSo51AZdixRQuXLGpeHEA5VudhQJfU3kZ1qXiZc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2018 06:45:22.4256 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 367f8531-fe2b-445a-1fa2-08d6098d2b53 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2031 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: Fri, 24 Aug 2018 06:45:26 -0000 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;_ 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? -Jack > > Thanks, > Yongseok > > > + } else { > > + mlx5_rxq_release(dev, idx); > > } > > - mlx5_rxq_release(dev, idx); > > rxq_ctrl = mlx5_rxq_new(dev, idx, desc, socket, conf, mp); > > if (!rxq_ctrl) { > > DRV_LOG(ERR, "port %u unable to allocate queue index %u", > > @@ -1543,11 +1552,12 @@ struct mlx5_rxq_ctrl * > > * @param dev > > * Pointer to Ethernet device. > > * @param idx > > - * TX queue index. > > + * RX queue index. > > * > > * @return > > - * 1 if the queue can be released, negative errno otherwise and rte_errno is > > - * set. > > + * 1 if the queue can be released > > + * 0 if the queue can not be released > > + * -EINVAL if the queue doesn't exist > > */ > > int > > mlx5_rxq_releasable(struct rte_eth_dev *dev, uint16_t idx) > > -- > > 1.8.3.1 > >