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 69C5442CBC for ; Thu, 15 Jun 2023 03:35:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FE4942D55; Thu, 15 Jun 2023 03:35:17 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id 8DD5740DDA for ; Thu, 15 Jun 2023 03:35:16 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-30adc51b65cso6939199f8f.0 for ; Wed, 14 Jun 2023 18:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686792916; x=1689384916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZRDmX+B5NJGk+F8si4omozu6aqvHTxtUfrjPj7NuOpQ=; b=kzNOltCDzZ5913u+9TOS2jTPa9SalDB2IwPSgRgPtRXjmxzjeAjGxzZGbbW1pa2q9/ N/2QIAxiWDYsxDg5lu/AYkJXl5r0/Lm8ODkaK81sGsR/7wo8z6VC6iMre8OjMqCXpvqZ aI+QoADCtAtwx1PspvF4UB9vQXKxnykjsFQg9dN5EFM4nJlhHeCuDFOG15hcVR5zitvn RRnCmk/z2Dh5VO/Egdan2A+lfZtiSkydFnAxkgIFwgCNlhzHqR1nJCtipW3S7If/Ee14 n7RprYboSWKf1Wc18IpNiQvBLUVPevgBGW+heQ9sLydl7zmXnLzvYf4wMbaUySp3hFg8 9B7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686792916; x=1689384916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZRDmX+B5NJGk+F8si4omozu6aqvHTxtUfrjPj7NuOpQ=; b=PqVUycDNPu+Cek+S+c2ng1NnfBvVkfT3HsR+4lPSCZyja2Y05AZc2PNU46JLNo+dJR QiX90OtRYuv/V41UHn6Oxk9LrOsxuJE7vhrcUwypBl2l5R/In/jN7//gb/Gcdyc2XzRg Aq+g2W64pBT7noYO39/vSsCG+gUynBQVC8JLe49Foj9o4I8kZ5KclLBO9Rfqs8PPTKVX 7QFdnGAHRerSo2svOLL/pqnrnmimfAaazonkCdlIzE8XgOTr4cjYfyti2PRS3HhLTmsg 7LuDJ4KBrEdhKlYeawdPaGiW2i3yvyJWGIshSYCQGQzvTlXYvEu585jO6EXd+zJh2HVD DfWQ== X-Gm-Message-State: AC+VfDypWrSpA/Ke6S5mYxBOVRcJYV3wtPgXwqlIqV7szRENheDg4pnp i0ZcKiGryJaw/vd2prG0bx8m2VqkU6hHg5ua X-Google-Smtp-Source: ACHHUZ7VX7iNbXYC5wXIiIV8LYSfiA5f99WkEK3XRH5GQtaDpDjiLFBhe5edvxCn+eQ89/TGkpDJ7A== X-Received: by 2002:adf:cc90:0:b0:309:4eef:5300 with SMTP id p16-20020adfcc90000000b003094eef5300mr11968432wrj.20.1686792916158; Wed, 14 Jun 2023 18:35:16 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id e6-20020a5d5306000000b003110ab70a4fsm2933243wrv.83.2023.06.14.18.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 18:35:15 -0700 (PDT) From: luca.boccassi@gmail.com To: Boleslav Stankevich Cc: Andrew Rybchenko , Chenbo Xia , dpdk stable Subject: patch 'net/virtio: fix initialization to return negative errno' has been queued to stable release 20.11.9 Date: Thu, 15 Jun 2023 02:32:40 +0100 Message-Id: <20230615013258.1439718-45-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230615013258.1439718-1-luca.boccassi@gmail.com> References: <20230615013258.1439718-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 20.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/17/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/08faea99b9c9334771c5e39373fefeef12fde63a Thanks. Luca Boccassi --- >From 08faea99b9c9334771c5e39373fefeef12fde63a Mon Sep 17 00:00:00 2001 From: Boleslav Stankevich Date: Wed, 22 Mar 2023 13:23:25 +0300 Subject: [PATCH] net/virtio: fix initialization to return negative errno [ upstream commit 55e19d06f8a8a865297532071453c10544a07a24 ] 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") Signed-off-by: Boleslav Stankevich Signed-off-by: Andrew Rybchenko Reviewed-by: Chenbo Xia --- drivers/net/virtio/virtio_ethdev.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 011130c61f..1ee738f8cc 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1695,15 +1695,17 @@ static int virtio_configure_intr(struct rte_eth_dev *dev) { struct virtio_hw *hw = dev->data->dev_private; + int ret; if (!rte_intr_cap_multiple(dev->intr_handle)) { PMD_INIT_LOG(ERR, "Multiple intr vector not supported"); 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; } if (!dev->intr_handle->intr_vec) { @@ -1735,12 +1737,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; @@ -1796,7 +1799,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. */ vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); if (virtio_negotiate_features(hw, req_features) < 0) - return -1; + return -EINVAL; hw->weak_barriers = !vtpci_with_feature(hw, VIRTIO_F_ORDER_PLATFORM); @@ -1881,7 +1884,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,10 +1916,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; } } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-15 01:56:36.995835046 +0100 +++ 0045-net-virtio-fix-initialization-to-return-negative-err.patch 2023-06-15 01:56:34.659543314 +0100 @@ -1 +1 @@ -From 55e19d06f8a8a865297532071453c10544a07a24 Mon Sep 17 00:00:00 2001 +From 08faea99b9c9334771c5e39373fefeef12fde63a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 55e19d06f8a8a865297532071453c10544a07a24 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -20,2 +21,2 @@ - drivers/net/virtio/virtio_ethdev.c | 33 +++++++++++++++++------------- - 1 file changed, 19 insertions(+), 14 deletions(-) + drivers/net/virtio/virtio_ethdev.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) @@ -24 +25 @@ -index a81110e70a..2c23f1c00e 100644 +index 011130c61f..1ee738f8cc 100644 @@ -27 +28,8 @@ -@@ -1360,9 +1360,10 @@ virtio_configure_intr(struct rte_eth_dev *dev) +@@ -1695,15 +1695,17 @@ static int + virtio_configure_intr(struct rte_eth_dev *dev) + { + struct virtio_hw *hw = dev->data->dev_private; ++ int ret; + + if (!rte_intr_cap_multiple(dev->intr_handle)) { + PMD_INIT_LOG(ERR, "Multiple intr vector not supported"); @@ -39,2 +47,2 @@ - ret = rte_intr_vec_list_alloc(dev->intr_handle, "intr_vec", -@@ -1391,12 +1392,13 @@ virtio_configure_intr(struct rte_eth_dev *dev) + if (!dev->intr_handle->intr_vec) { +@@ -1735,12 +1737,13 @@ virtio_configure_intr(struct rte_eth_dev *dev) @@ -57,19 +65 @@ -@@ -1719,7 +1721,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; - } - } - -@@ -1741,7 +1743,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; -@@ -1781,7 +1783,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) +@@ -1796,7 +1799,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) @@ -77,2 +67,2 @@ - virtio_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); - if (virtio_ethdev_negotiate_features(hw, req_features) < 0) + vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER); + if (virtio_negotiate_features(hw, req_features) < 0) @@ -82 +72 @@ - hw->weak_barriers = !virtio_with_feature(hw, VIRTIO_F_ORDER_PLATFORM); + hw->weak_barriers = !vtpci_with_feature(hw, VIRTIO_F_ORDER_PLATFORM); @@ -84 +74 @@ -@@ -1863,7 +1865,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) +@@ -1881,7 +1884,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) @@ -93,16 +83 @@ -@@ -1876,9 +1878,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); -@@ -1900,10 +1904,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) +@@ -1913,10 +1916,11 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)