From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C1A641E63 for ; Thu, 11 May 2023 10:21:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6801842D6C; Thu, 11 May 2023 10:21:46 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 8C4B842D5D; Thu, 11 May 2023 10:21:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683793304; x=1715329304; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ph/LuuCoDwJgyDp9W6Yj7tsP2yv2IuWdzhM5tNUZB/o=; b=Yl5RxsqplCJ8IjzVEM/AMROWOHmtvZoGyM6EpBqDxWtJnbNBSeb5sEjm V/j37RuVRW6RXJsiV7c96SBDHfVmD/ZDtVONZu3RvGcIcbn+mDoqwt0ZQ 8oM9ErTnlk3HN1Fyr9VNCaq2tabJ2ITz0CIGDQbxc7X7RmsMP/lDEbBF7 CzgGWv4nW3OAYOTabABqf3G/7vU4yANAD91dHKulT1OHwrfS6dmNyNlI5 AE4edHn3VQJHLz1ltqKZ+ufuhzKwBavApijOi5KbeXYLMIFPHSdcaeQ9Y vtxxUGSIrZcD+zaHHRRPPmDDDUWZnRJ6fYuJUjl0s1pJDWrnN5QagudPW g==; X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="378555385" X-IronPort-AV: E=Sophos;i="5.99,266,1677571200"; d="scan'208";a="378555385" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2023 01:21:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="811496695" X-IronPort-AV: E=Sophos;i="5.99,266,1677571200"; d="scan'208";a="811496695" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 11 May 2023 01:21:43 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 11 May 2023 01:21:43 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 11 May 2023 01:21:42 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 11 May 2023 01:21:42 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.48) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 11 May 2023 01:21:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aoQscWY3eBz5W8bGGRvISXWEaTxz87DAVhl/uWogichs9WiNuquL9Nfic59bdjAnvMT05bROHT5Ephhd3C6ONgr7aJnXLX44ZWV2IugNNg545AqxHZ5+3ouqJT/FNscz3nHQ/lSKTPyf0Oh+b8AQHwWkLVxvgwSU4NkvmYj3FD1QbCo2KA5lKB3HUqDPEwsHRNhNeJaBExeqB5jQ30J9PrYinosEt+Mb/Dly5I8D7fj7T9C4OiuSV8fnQCW8fHkWSPLbzkixmmTf5wjjgjVGpxij0TibNdGEwUQpd4xBORqWrNxwNbcv6qu8RLJ3AtYeJPjuBdxGyNlqHcXovmpoBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=96pZl5Upc/ZbcMgCQoYSM9AbFr0l4a0a2GN/SH9nQRo=; b=OKrWaZtAiubdmU/HWCVWsDQ7YRJ8/cGFFHECmBYPt3XQlj1SWneC1fpg4toe2H+zDaV9436RYdXLRdTUtd9Igq2crMwaekIuGur69ucTAIueLn1BbdPuFy2QbkFL7UFp0WABya/cflxbzwb5sgzhWGFVYhUBJxkNHJvX3f3xLacelzV1KBTKXE6LOQiMg+RS/sE5MSgQNgyism+KHL4STPcKaZ9Ujk6DtAExFnas6UWboiA+lP0C+sgeJM3RQs9gLBKxlFmpa6DKp1kN3c+nUNdrczXiLh+t5h91YLzSzm2EBEwzBQcqiIxK008EyWlICi3mW9BHz0Lc0F12yGxcLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB3504.namprd11.prod.outlook.com (2603:10b6:805:d0::17) by IA1PR11MB7890.namprd11.prod.outlook.com (2603:10b6:208:3ff::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Thu, 11 May 2023 08:20:16 +0000 Received: from SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::e427:f0a6:8472:d0f6]) by SN6PR11MB3504.namprd11.prod.outlook.com ([fe80::e427:f0a6:8472:d0f6%6]) with mapi id 15.20.6387.019; Thu, 11 May 2023 08:20:16 +0000 From: "Xia, Chenbo" To: Boleslav Stankevich , "dev@dpdk.org" CC: "stable@dpdk.org" , Andrew Rybchenko , Maxime Coquelin , Jianfeng Tan , "Yuanhan Liu" , Tetsuya Mukawa , Huawei Xie Subject: RE: [PATCH 2/2] net/virtio: fix device init to return negative errno Thread-Topic: [PATCH 2/2] net/virtio: fix device init to return negative errno Thread-Index: AQHZXKhzWXhSfQmxfEOndW5o4Lg7sq9VCXfw Date: Thu, 11 May 2023 08:20:16 +0000 Message-ID: References: <20230322102325.1739053-1-boleslav.stankevich@oktetlabs.ru> <20230322102325.1739053-2-boleslav.stankevich@oktetlabs.ru> In-Reply-To: <20230322102325.1739053-2-boleslav.stankevich@oktetlabs.ru> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3504:EE_|IA1PR11MB7890:EE_ x-ms-office365-filtering-correlation-id: 0e162153-5227-4fc6-eab7-08db51f88d0f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rL8xuY8xVJ44z2iP2SoI7N8EUzU0jGQAG8tziwTs4INe0LIujrdg+7tY77EU0R/oPeNrrPuVtVfN9wvvWdd09BAwN3JiYWO2Eu0Ec/BdFgVVI/SlwFPf7sygGyNSxp85qz6nh20PW30Onwqr5CKarRz+y/0PYiCqIwgoRh5VG6cWSRn+6yVq4w8YqF4HSkU/HQ0NZlotkfmu+wnfAfJn5lDny6JmldoWjhB3jR98yvaQHzWw6jSspaGw4ec7ZfKm1P3z8gXhLOdg1I99870dGmzwPNjhZ4TSyMoNognSRD9corA/HNd+Xf6kdtm0QuYzqXb7GD3FmAShIQk7m3ITCJvaBGT7lr76Y/nN4ExLfzNZNQIfczTGqJbHzqva+BRuburTENxl8EKOeMIw+1RSeuzxgr3MNeoXiuKP0fTEOgz2vbBVYqKKOmR4N0DYmA8Cvwd0i8HviPvAdE7wkcMrqK+4VW/nWn+gTAimvDUqSW/+lTgFZfhXIDkt6UfcmaJLmfrerSrU0l0kxFJElYt8H1WFMB5jbcaL5S2pHwJPFBARkQnFvjDbiJjVocsURf+9JI1DCiZYrIqREtdgO7QiHs0gE692S30bGHsRfjt6XaU0nTtdUhPByj/COH8sC79z x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3504.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(346002)(396003)(376002)(39860400002)(366004)(451199021)(7696005)(26005)(53546011)(86362001)(38100700002)(41300700001)(55016003)(71200400001)(33656002)(82960400001)(186003)(9686003)(6506007)(83380400001)(122000001)(64756008)(66476007)(66446008)(66946007)(66556008)(76116006)(54906003)(110136005)(478600001)(38070700005)(4326008)(52536014)(8936002)(316002)(8676002)(5660300002)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AwZOw/dUasn25RhSPS+C3c/O49Kz/i7xmxdSfVsNfLv0INZzZKr3/f1sYzdp?= =?us-ascii?Q?AgkWYUHbPzzRIrTF7VhNglUKi8r6BrMEbDznGu8JYu4K9pVRzpRTcyKQKPfn?= =?us-ascii?Q?6RPgXGh3nvrmWVPctSLNmskRm4MDYvNhUGyUxofXYfBAZ+beSMiPlqmBy0Q9?= =?us-ascii?Q?q0XI1afCkYTZgfKYX9IVwv7+xbXCszC92YIQ0ZJJP6iGYzoFu1TGqZvDxFH5?= =?us-ascii?Q?FTd4AtZY9D8dHVLNKYRcyl7j/WXoupj1iPGms26iQjGar3yU3+bCkHeXRz0p?= =?us-ascii?Q?/rkaHw5FZaetNbG6VjvFZk/+Y6VQOXdPDyKLGPtKaPcZ13TcbzWmoXAKNt9U?= =?us-ascii?Q?m0/l4XbI2ol6g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=?us-ascii?Q?JJCu2Jrjmy5hFMmrEe9mBYytW6c/qb6x6nInmWbKDxwY1Nm5pykHhUFDdFRP?= =?us-ascii?Q?NHv//nB3g6KiRtYwZzV77V2O93aIKyJaTB9BNgqD/8hHGfGqYuAsEMoG30qa?= =?us-ascii?Q?Z209l4qCGAw/Idbg/CpReUHeP39cav23epu9+RtMhjVdAvAenv71qR0usHUL?= =?us-ascii?Q?GBA33+TI1u7TnsbjcVUrlr6h5owi3D6TzAUHkru+Hi5pldMxA5dvm0gHXdfH?= =?us-ascii?Q?y7nU0BGKcUQtt9yBC+J1jt8GKQ9HyeNMVsjUmJQIcpPjzWCkBXSftnxRzzug?= =?us-ascii?Q?HIpmuKNGuhDUok2eRlwdDvxOiWdRS1DOU5jeiz0U?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3504.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e162153-5227-4fc6-eab7-08db51f88d0f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2023 08:20:16.3023 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wBotHWGTLN9RkduJM5kluGaLMWvJ3B4CBPRkUA8V7YDQnNKqcpeau2wb5kBOYEQgI7VTyzhwC7R07HPSWs/YZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7890 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Boleslav Stankevich > Sent: Wednesday, March 22, 2023 6:23 PM > To: dev@dpdk.org > Cc: Boleslav Stankevich ; > stable@dpdk.org; Andrew Rybchenko ; Maxime > Coquelin ; Xia, Chenbo = ; > Jianfeng Tan ; Yuanhan Liu = ; > Tetsuya Mukawa ; Huawei Xie inc.com> > Subject: [PATCH 2/2] net/virtio: fix device init to return negative errno >=20 > virtio_init_device() and called helper functions sometimes return -1 > when return code should be negative errno. Fix all such cases to return > correct negative errno instead. >=20 > Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts") > Fixes: 0c9d66207054 ("net/virtio: support RSS") > Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0") > Fixes: 49d26d9e3f47 ("net/virtio: support MTU feature") > Cc: stable@dpdk.org >=20 > Signed-off-by: Boleslav Stankevich > Signed-off-by: Andrew Rybchenko > --- > drivers/net/virtio/virtio_ethdev.c | 33 +++++++++++++++++------------- > 1 file changed, 19 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_ethdev.c > b/drivers/net/virtio/virtio_ethdev.c > index 5c8b7b95e9..ca4ade9ff2 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1397,9 +1397,10 @@ virtio_configure_intr(struct rte_eth_dev *dev) > return -ENOTSUP; > } >=20 > - if (rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues)) > { > + ret =3D rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues); > + if (ret < 0) { > PMD_INIT_LOG(ERR, "Fail to create eventfd"); > - return -1; > + return ret; > } >=20 > ret =3D rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec", > @@ -1428,12 +1429,13 @@ virtio_configure_intr(struct rte_eth_dev *dev) > */ > if (virtio_intr_enable(dev) < 0) { > PMD_DRV_LOG(ERR, "interrupt enable failed"); > - return -1; > + return -EINVAL; > } >=20 > - if (virtio_queues_bind_intr(dev) < 0) { > + ret =3D virtio_queues_bind_intr(dev); > + if (ret < 0) { > PMD_INIT_LOG(ERR, "Failed to bind queue/interrupt"); > - return -1; > + return ret; > } >=20 > return 0; > @@ -1756,7 +1758,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev) > eth_dev->device->numa_node); > if (!hw->rss_key) { > PMD_INIT_LOG(ERR, "Failed to allocate RSS key"); > - return -1; > + return -ENOMEM; > } > } >=20 > @@ -1778,7 +1780,7 @@ virtio_dev_rss_init(struct rte_eth_dev *eth_dev) > eth_dev->device->numa_node); > if (!hw->rss_reta) { > PMD_INIT_LOG(ERR, "Failed to allocate RSS reta"); > - return -1; > + return -ENOMEM; > } >=20 > hw->rss_rx_queues =3D 0; > @@ -1818,7 +1820,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, > uint64_t req_features) > /* Tell the host we've known how to drive the device. */ > virtio_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); > if (virtio_ethdev_negotiate_features(hw, req_features) < 0) > - return -1; > + return -EINVAL; >=20 > hw->weak_barriers =3D !virtio_with_feature(hw, > VIRTIO_F_ORDER_PLATFORM); >=20 > @@ -1900,7 +1902,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, > uint64_t req_features) > if (config->mtu < RTE_ETHER_MIN_MTU) { > PMD_INIT_LOG(ERR, "invalid max MTU value (%u)", > config->mtu); > - return -1; > + return -EINVAL; > } >=20 > hw->max_mtu =3D config->mtu; > @@ -1913,9 +1915,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, > uint64_t req_features) > } >=20 > hw->rss_hash_types =3D 0; > - if (virtio_with_feature(hw, VIRTIO_NET_F_RSS)) > - if (virtio_dev_rss_init(eth_dev)) > - return -1; > + if (virtio_with_feature(hw, VIRTIO_NET_F_RSS)) { > + ret =3D virtio_dev_rss_init(eth_dev); > + if (ret < 0) > + return ret; > + } >=20 > PMD_INIT_LOG(DEBUG, "config->max_virtqueue_pairs=3D%d", > config->max_virtqueue_pairs); > @@ -1937,10 +1941,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, > uint64_t req_features) > return ret; >=20 > if (eth_dev->data->dev_conf.intr_conf.rxq) { > - if (virtio_configure_intr(eth_dev) < 0) { > + ret =3D virtio_configure_intr(eth_dev); > + if (ret < 0) { > PMD_INIT_LOG(ERR, "failed to configure interrupt"); > virtio_free_queues(hw); > - return -1; > + return ret; > } > } >=20 > -- > 2.30.2 Reviewed-by: Chenbo Xia =20