From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30061.outbound.protection.outlook.com [40.107.3.61]) by dpdk.org (Postfix) with ESMTP id C3BDC2BF7 for ; Thu, 23 Aug 2018 23:08:24 +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=Pe24GocJbaZgRAfaSz7QreuvR26QiYV98M6Y/q0Ke10=; b=jh19w5Qyk5BlkTaGGP38qHwJkr1vcOFHOiia8BD7DrnIt+MAA0tQfv9IqyGqIpW00c97TSn9qWx4cBQ925dmHol8/neHQKJLp7wgbzmEibGEXvp19Qgih5zq1ZGq06i8Vs85i5C2pSzqRv0I/YKTx4dQb+DMitnLzlbKJ1KEwYk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from yongseok-MBP.local (209.116.155.178) by AM0PR0502MB3971.eurprd05.prod.outlook.com (2603:10a6:208:11::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.24; Thu, 23 Aug 2018 21:08:22 +0000 Date: Thu, 23 Aug 2018 14:08:09 -0700 From: Yongseok Koh To: Xiaoyu Min Cc: Shahaf Shuler , dev@dpdk.org, xuemingl@mellanox.com Message-ID: <20180823210808.GA31847@yongseok-MBP.local> References: <20180823063851.32559-1-jackmin@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180823063851.32559-1-jackmin@mellanox.com> User-Agent: Mutt/1.9.3 (2018-01-21) X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: BN6PR11CA0013.namprd11.prod.outlook.com (2603:10b6:405:2::23) To AM0PR0502MB3971.eurprd05.prod.outlook.com (2603:10a6:208:11::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a375ef6c-2dba-48b9-451b-08d6093c8fd8 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB3971; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3971; 3:Xxw4F3LPYRqSFtAaHNGkIBFuw12KpewHIwAPq5X8Vs89Jye6EbjVPjq6t8b+B4AQ8hHxwC59OzeaYuG9YnDf7THjuSSN2QOWCRJ1iuqBCrFcNMyposrFLN2DfGeSzOm2yVJXDNhYUty1KoV+PHBF6YLZCVvq0sdWHWv6cN+t+VEoniBVc5mm/SEL9Ukj+Rpc7X+S59cgxbtv8QjhjVc/6Rz0bEfaTCGLvTUB7KdOi3PXj/0ayob3EW2R3ZfRCI2N; 25:PP1RGFP2DV3t3lEnJLH2VrlMir/y/qh2EjxQoIM3JIAkYVDPNeDjOLZ0mDS3oUNgMcW9kkkgOzXK2z/jmilFrYOjXxNi0tAHMFObBttPsBbA6xjRlPdTSw5oPfGNWAAS4z7tsX35E9bq2+NAqNbNArWEV1MCzgMJpmQVaGmJUlAx1/9lTmfuxf4s70lXEp2bhSfu5lHyLyZ2aVQqNLzPckUBPnRDZs+K3iLNQ6WpfYcXO38I+bnVkUQ+l7UYPas9xkWMQJmKmRSsWn2xlzKOyecSPLGqcir50xgxY4ZYrfZr3btFN4qIvC2mXcm6ylZXu2nFIMRM+PcDZOzA6W0lkA==; 31:hjt3SUtd2pXiDZAdEXTwDNaNYwRMLVrkWIvR7TIlZSvkMR3v75ZEESwyfxN+9JOaKqP5hQGLXo0s5cYB3lMCQCbs0ZD0fuxGjO4N+TKmQA8k/WiA0+JLwciAqXuuMktK8tK2+jNoSo6aFYg0KJsE6sQZ0Ck/J42coJ42MV9XjP2vNUk2OoX71Pf8hk8FeqIOwDPVqeyzRQadiMYlMJ9boGjPjnmD4uVpKJ+OH9kQqEs= X-MS-TrafficTypeDiagnostic: AM0PR0502MB3971: X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3971; 20:vlY2nfqSZOVlq+BdZ14PgEVUTxmlnPBgI+ZX77sT1ubFUdoz41kr5A37Cvo7WiNF+zLANwZ9EDtzwFcgBIr8DRBLaP1UCfCPwuge/JA7lWmaP2eRIGbA35tngWx1F9eINMvtWIziWa2zErYiT+h5TBqV4Qd5WhCwHPJxwb/S5t9BrCr6wAaSiJVdHFuzrq9GfeNYwEtu8ioJvd3HE6vZ/HdKnaSu1luAUKgETS72nc5Kg4it8XJh3JdX8KZ4yN/JhIdyVZLeMhLomqU5enP9sclR1qkTYWujyfbwORJggptmNLmXwnUe3egBudCnNK7uhkc0mWMH2DkeOGcNc6+9owTOohgbLDzF/ZddH7/kRuYC9TRMoGlJ/ZiKqqItmUHC7g3WYDENXAIXSFpOgo6gPU8X2M9pJOdGGbUXkDeFJ73nJMSzQIN4vy8iHfUcJ9iWX4ijpqEFLcKFvdniyBgh4e93LZrWgqkqNeCu/jv+P7DXhs/mGLX914ebYXPBOxyr; 4:h2azlyaYQmu5wo9/cLjFBSke/5TBF8x0tCAW5sOiCd2m8eszCe0rLJXy4jFBqVAbaYBkafy8AncjIyRxAtJ/CIQ9Jf/2mzIeRb2KRUDdjYXCVkVzGpR29cXbj0aSype+noghPYCJjV3atEyH8ra9L25yfdNj5DzjN3h/avv/pQ+3kJQJagiOPZACEyG9/G2JjgaMhgrHjDMZvdjKBNgW7QW9O/Z9CcPLj/2ZCm0qb99HuL93YBh2o7i1I1rZVmJI2pfrKlSsMtme1ArsuOOhcw== 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)(3231311)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016); SRVR:AM0PR0502MB3971; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0502MB3971; X-Forefront-PRVS: 0773BB46AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(366004)(396003)(136003)(189003)(199004)(81166006)(9686003)(68736007)(55016002)(53936002)(6666003)(106356001)(25786009)(105586002)(6506007)(16526019)(486006)(6862004)(107886003)(33896004)(386003)(6246003)(11346002)(47776003)(26005)(2906002)(476003)(956004)(4326008)(478600001)(6636002)(86362001)(446003)(66066001)(7736002)(52116002)(98436002)(229853002)(305945005)(33656002)(5660300001)(81156014)(8936002)(76176011)(97736004)(8676002)(6116002)(23726003)(3846002)(14444005)(316002)(1076002)(58126008)(50466002)(7696005)(16586007)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3971; H:yongseok-MBP.local; 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-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR0502MB3971; 23:WycoK8niBPEdeZPz8c1R/j1N9Ff0azPG21ze3Ue?= =?us-ascii?Q?Z2iFCAKsYTha1XXlyjUDIEnV1IXBrjTr4oZjRtEkP/Ns38tmxDySfVjKxbKm?= =?us-ascii?Q?FtkcrQZZegaEFI2Wqqq1H1px1WwF8Mu0QW+9EghlZnM0cWSmI7y/YDc98rfX?= =?us-ascii?Q?9+xaHYJ9rXqWqLWSjL2PsQQd78B6nO+SR+E7U0YvMs/Me+ddEyowAFsZipwU?= =?us-ascii?Q?rOJkPxlw0Ib9kW6g3XHeQeeq9qZwegs3LgtXey8SoVmr4FotSGQmgQzO/kpT?= =?us-ascii?Q?M4ZQ/IVcwpK7JC22ccmLCvKo+HLG1XLF7TxXj6jY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OQZKi98LiB5RzKDn8FwfObPAw4VXVikKrV?= =?us-ascii?Q?b6d7BCae3MfkcqBdvs109FYijOokRb9mt8Z5KKeQayKiy4SoktFSKvEq1Spa?= =?us-ascii?Q?38lmQrGxm3QL0Z1oh/TlzFiI=3D?= X-Microsoft-Antispam-Message-Info: aRxmwlxmz0zvdGNe32cCXhwTvDUcNhZMah1R5MFoXiZKWQd9HNrMfsbb1r27DF6JJTrICf1pjeL5vUEsa+O4lOkUuT8950J2N/2trqbBssH7eFWCtZGEvw0TuL6j/3iiBLSP7sQHem084r1skc1JPSL0eUqz7pzIP5XouoP69npuG7AJ8yFsfcTftgiE8UA0VHnke/iJTc193nYtTa8AwMjpatQfqOh3KffOydjRJDL7I1OpiWpYI3Oqpqgn+CKJTgQ3Zt6wdYIJh+1uGHaEWZrkf5iaGuvp6apORCdyB5JK3CKOUNtxwQPKQtgXe19HMEtzeVRUkAj3IaOKxUUrXpfK9xv03LRdYOJgc7DEZYA= X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3971; 6:WQI007TYJITDDd0ap2H7/JE7v3kdu66CaKeWGvAoEwr/c5u/2vORXNPp9G+NDQVMnQHsQK/nvGUiVAlIPLqrldVul4ByxgHGWW639g3jhq2jgRdT/WvmbvHfbghafnV7dNR/nD75UeSztNKk6Ch5TYt242hmZ6ldoI+nbfglUuGWYKnKOARDnGhKHbyD+KAuxDctfaLDW0EoRJ5akOey1lwLcySRvT3AaPtL4QGGufV/+9gJmX6bZt/BWMBtHocWlrFZoVrCGGZv7o2feUVyZYB8iIl4gWhvbtQ9uT4dzyAOjHQH+JliXKxBd68YzI3atHAYSayXcejdoJRe1SjA38GHGmnWl5JM71bmYBwWwd1zcEBAFySM100azLSAWXEdtdlhBGwaNujf14pa+uyRHUFUaUV5NjedlH0OZkVA1KYoYKBpRKzSd+nnE3xlPVbc7RdUHL4DjpANDR48bxEhYA==; 5:oRpHxrDigLuwd0/Uh4RAyRZ1f6Pu4NinUeFe6CwAu8a51gssTn0Rj4T5hYGwMcrrZ9e0Z0416bt9ubw6IdCZDrUKc30w1WbKNWkfQxx5/XkoX2xhNG+ZIHjTSimkrHDop9FsakMsLZF1TPUmkPw7Ipel0mYnxiXyWTE7W19ElN4=; 7:bUq9ITSxQzFzSXnCC8ypdhqvinLGtruG0l+EIQQH42A6M/nGmBhcljc6fIO8U97+QKaJFUiG5hXRbNRUheG2AugG5RUWf/gtdKjmaByBSGpjMJ7tX8j3YoK6b4JYxHLVamyN6IA1jFYswbRiaziMila5OV4+r/ZCZW1waMSatJv3PVJ+ONsRSbb5CJixzMmF558Ewxnwp5XNLf69UUAt1t5gEUNA/SSa9wM3Vnk+gUNMTOm8LblLIwkU2Sc4zHld SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2018 21:08:22.5506 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a375ef6c-2dba-48b9-451b-08d6093c8fd8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3971 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: Thu, 23 Aug 2018 21:08:25 -0000 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? 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 >