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 C383E42C08 for ; Thu, 1 Jun 2023 22:01:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDD8142D0C; Thu, 1 Jun 2023 22:01:49 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 59A8642B8B for ; Thu, 1 Jun 2023 22:01:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685649707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WSObR6QqxJAkVMiEboTOTgYf6WAaHLwC2kYTs3sLVAs=; b=AS4aDIqjR22i+Q++aRY4+M4tgpCV6bFC7EpNLTqbb5fsasIS1UPoqEfZQKD+aCBpdYKLt3 av8Rxkt5US9yhZFn2iajkGDuqlsHxwa6MKe0YvPpRthsWyUK2oywQaCYlC4IbGxzVLsKgc HYDBpnoI58IyKi02R8X5NkfOssG3up4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-633-P2wFZx3VOEuWzF92_drAxw-1; Thu, 01 Jun 2023 16:01:46 -0400 X-MC-Unique: P2wFZx3VOEuWzF92_drAxw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4CA23C025AD; Thu, 1 Jun 2023 20:01:45 +0000 (UTC) Received: from [10.39.208.25] (unknown [10.39.208.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 048F9112132C; Thu, 1 Jun 2023 20:01:43 +0000 (UTC) Message-ID: <64169775-3f9b-989c-5c85-3e74802b62b4@redhat.com> Date: Thu, 1 Jun 2023 22:01:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 2/2] net/virtio: fix device init to return negative errno To: Boleslav Stankevich , dev@dpdk.org Cc: stable@dpdk.org, Andrew Rybchenko , Chenbo Xia , Jianfeng Tan , Yuanhan Liu , Tetsuya Mukawa , Huawei Xie References: <20230322102325.1739053-1-boleslav.stankevich@oktetlabs.ru> <20230322102325.1739053-2-boleslav.stankevich@oktetlabs.ru> From: Maxime Coquelin In-Reply-To: <20230322102325.1739053-2-boleslav.stankevich@oktetlabs.ru> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 3/22/23 11:23, Boleslav Stankevich wrote: > 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. > > 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 > > Signed-off-by: Boleslav Stankevich > Signed-off-by: Andrew Rybchenko > --- > drivers/net/virtio/virtio_ethdev.c | 33 +++++++++++++++++------------- > 1 file changed, 19 insertions(+), 14 deletions(-) > > 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; > } > > - if (rte_intr_efd_enable(dev->intr_handle, dev->data->nb_rx_queues)) { > + ret = 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; > } > > ret = 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; > } > > - if (virtio_queues_bind_intr(dev) < 0) { > + ret = virtio_queues_bind_intr(dev); > + if (ret < 0) { > PMD_INIT_LOG(ERR, "Failed to bind queue/interrupt"); > - return -1; > + return ret; > } > > 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; > } > } > > @@ -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; > } > > hw->rss_rx_queues = 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; > > hw->weak_barriers = !virtio_with_feature(hw, VIRTIO_F_ORDER_PLATFORM); > > @@ -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; > } > > hw->max_mtu = config->mtu; > @@ -1913,9 +1915,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) > } > > hw->rss_hash_types = 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 = virtio_dev_rss_init(eth_dev); > + if (ret < 0) > + return ret; > + } > > PMD_INIT_LOG(DEBUG, "config->max_virtqueue_pairs=%d", > config->max_virtqueue_pairs); > @@ -1937,10 +1941,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) > return ret; > > if (eth_dev->data->dev_conf.intr_conf.rxq) { > - if (virtio_configure_intr(eth_dev) < 0) { > + ret = virtio_configure_intr(eth_dev); > + if (ret < 0) { > PMD_INIT_LOG(ERR, "failed to configure interrupt"); > virtio_free_queues(hw); > - return -1; > + return ret; > } > } > Applied to dpdk-next-virtio/main. Thanks, Maxime