From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A282EA0351 for ; Thu, 6 Aug 2020 11:59:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9783F1C12D; Thu, 6 Aug 2020 11:59:06 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 5E2611C0AE for ; Thu, 6 Aug 2020 11:59:05 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id y3so43394688wrl.4 for ; Thu, 06 Aug 2020 02:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3X3/gVmvwI3RTKr7EXimkbG5hfVOIjXVN/Bc/Jax2ts=; b=tyBjxoTAuhC2tKy+V0A2UAc+cxmmqyWmc/dJjVdMYx4VNu92H9y8xQEurRDzrhbA4a d5S6UL87rbwbktW0N4CKh6Q8jMDpJGRu/OdOXbnq6j9UIKUACN6HUbIn3AuAF8lkdGeO OrWi+llAy3YcoaW7c5bHr2xWBabKnkjTOCW6CFwzI4AAHkfeksDEK+WKKJQH5EVKIrRQ 8l6eI83TfenPoIJWAcIiSKUikJy1Jb6BxPpG0fDWSn+YZ2cI7t3HPzdgf7MoP7LKCq+p 6d3UmQ+n85FbPe66PRG8dSzP7fnCN203PFjsahAYY6QTLmLNsbD6wHg1p0n2cHG8/Ahc 1Mfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3X3/gVmvwI3RTKr7EXimkbG5hfVOIjXVN/Bc/Jax2ts=; b=o8LgPYYqtvtf1g0UDHYLE3lC0k5/c4RRBi41SrP82cqBaz+GcTDiTJ/hO75sszAHL6 am07BTkgAvNZLG+AeyI0AqUjSCPcbik4YBw+0qsj1GLBn2ifA5qVrXBBvIZ3fOjcUKF1 xxwsq321dMl7lyXVA9mnoWsvTRasxC0SDVFqzSQt042wxiIcCfuwOmtx+sX2tUbCfMPG Rq51BIjn4JRE879PongUqUnwG+tvr5SP7naWp7YQ7VbtlbIKlu8VKsvl8HNfXzNQlpUr Ly+iYN1bsI6ziC/u/56o6lXH9OGpmfp1kWdwrydcmZJx9txll1YzJqXeE3g2qLk2L3R9 nxrg== X-Gm-Message-State: AOAM532EL3wKQUspnDErdfSNvSFDtIGHGlX6RSY0dm7A4fyMfiZ4Q0O9 HFZH19w7IH637VPRuQ474Sl4NIgVGv+TFA== X-Google-Smtp-Source: ABdhPJxpDtbBJXWH6j6i1s2I7248C4SZF4YBAQJl35I4RUp87S4jANixksjE8IDbfCp2pH7VNcsfxw== X-Received: by 2002:adf:bc13:: with SMTP id s19mr6640077wrg.412.1596707945058; Thu, 06 Aug 2020 02:59:05 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t25sm5507984wmj.18.2020.08.06.02.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 02:59:04 -0700 (PDT) From: luca.boccassi@gmail.com To: Xiao Wang Cc: Adrian Moreno , Chenbo Xia , Maxime Coquelin , dpdk stable Date: Thu, 6 Aug 2020 10:53:57 +0100 Message-Id: <20200806095411.774624-29-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806095411.774624-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> <20200806095411.774624-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/virtio-user: fix status management' has been queued to stable release 19.11.4 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/08/20. 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. Thanks. Luca Boccassi --- >From 17e196bd4b4b8296a85c5c8ab4c5d9ba5ad2658d Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Tue, 28 Jul 2020 14:52:12 +0800 Subject: [PATCH] net/virtio-user: fix status management [ upstream commit d0131e49c7fca45f4111eedab71f6dbd73bacd61 ] Apart from the virtio status, there should be also a network related status for link status management, current implementation mixes up these two statuses. One issue caused by this mixup is when virtio-user running in server mode and vhost as a client connects to it, a RARP packet will be generated by virtio-user due to VIRTIO_NET_S_ANNOUNCE bit is detected in the "status" in interrupt handler. VIRTIO_NET_S_LINK_UP and VIRTIO_NET_S_ANNOUNCE should be managed by a separated field. This patch adds a "net_status" field for this purpose. Fixes: e9efa4d93821 ("net/virtio-user: add new virtual PCI driver") Signed-off-by: Adrian Moreno Signed-off-by: Xiao Wang Reviewed-by: Chenbo Xia Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_user/virtio_user_dev.h | 1 + drivers/net/virtio/virtio_user_ethdev.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 3b6b6065a..8937124d9 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -41,6 +41,7 @@ struct virtio_user_dev { uint64_t frontend_features; /* enabled frontend features */ uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; + uint16_t net_status; uint16_t port_id; uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; char path[PATH_MAX]; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index e2cbd2478..4a35fa1c9 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -185,7 +185,7 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, } r = recv(dev->vhostfd, buf, 128, MSG_PEEK); if (r == 0 || (r < 0 && errno != EAGAIN)) { - dev->status &= (~VIRTIO_NET_S_LINK_UP); + dev->net_status &= (~VIRTIO_NET_S_LINK_UP); PMD_DRV_LOG(ERR, "virtio-user port %u is down", hw->port_id); @@ -197,7 +197,7 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, virtio_user_delayed_handler, (void *)hw); } else { - dev->status |= VIRTIO_NET_S_LINK_UP; + dev->net_status |= VIRTIO_NET_S_LINK_UP; } if (fcntl(dev->vhostfd, F_SETFL, flags & ~O_NONBLOCK) == -1) { @@ -205,12 +205,12 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, return; } } else if (dev->is_server) { - dev->status &= (~VIRTIO_NET_S_LINK_UP); + dev->net_status &= (~VIRTIO_NET_S_LINK_UP); if (virtio_user_server_reconnect(dev) >= 0) - dev->status |= VIRTIO_NET_S_LINK_UP; + dev->net_status |= VIRTIO_NET_S_LINK_UP; } - *(uint16_t *)dst = dev->status; + *(uint16_t *)dst = dev->net_status; } if (offset == offsetof(struct virtio_net_config, max_virtqueue_pairs)) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-08-06 10:53:16.928258847 +0100 +++ 0029-net-virtio-user-fix-status-management.patch 2020-08-06 10:53:15.816597718 +0100 @@ -1,8 +1,10 @@ -From d0131e49c7fca45f4111eedab71f6dbd73bacd61 Mon Sep 17 00:00:00 2001 +From 17e196bd4b4b8296a85c5c8ab4c5d9ba5ad2658d Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Tue, 28 Jul 2020 14:52:12 +0800 Subject: [PATCH] net/virtio-user: fix status management +[ upstream commit d0131e49c7fca45f4111eedab71f6dbd73bacd61 ] + Apart from the virtio status, there should be also a network related status for link status management, current implementation mixes up these two statuses. @@ -16,7 +18,6 @@ separated field. This patch adds a "net_status" field for this purpose. Fixes: e9efa4d93821 ("net/virtio-user: add new virtual PCI driver") -Cc: stable@dpdk.org Signed-off-by: Adrian Moreno Signed-off-by: Xiao Wang @@ -28,22 +29,22 @@ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h -index 56e638f8a..554174e81 100644 +index 3b6b6065a..8937124d9 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h -@@ -44,6 +44,7 @@ struct virtio_user_dev { - * (Vhost-user only) - */ +@@ -41,6 +41,7 @@ struct virtio_user_dev { + uint64_t frontend_features; /* enabled frontend features */ + uint64_t unsupported_features; /* unsupported features mask */ uint8_t status; + uint16_t net_status; uint16_t port_id; uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; char path[PATH_MAX]; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c -index e51425c4f..6003f6d50 100644 +index e2cbd2478..4a35fa1c9 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c -@@ -205,7 +205,7 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, +@@ -185,7 +185,7 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, } r = recv(dev->vhostfd, buf, 128, MSG_PEEK); if (r == 0 || (r < 0 && errno != EAGAIN)) { @@ -52,7 +53,7 @@ PMD_DRV_LOG(ERR, "virtio-user port %u is down", hw->port_id); -@@ -217,7 +217,7 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, +@@ -197,7 +197,7 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, virtio_user_delayed_handler, (void *)hw); } else { @@ -61,7 +62,7 @@ } if (fcntl(dev->vhostfd, F_SETFL, flags & ~O_NONBLOCK) == -1) { -@@ -225,12 +225,12 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, +@@ -205,12 +205,12 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, return; } } else if (dev->is_server) {