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 BE304A0527 for ; Mon, 9 Nov 2020 19:43:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B55686883; Mon, 9 Nov 2020 19:43:06 +0100 (CET) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id DFE0F6883 for ; Mon, 9 Nov 2020 19:43:04 +0100 (CET) Received: by mail-wm1-f66.google.com with SMTP id s13so433371wmh.4 for ; Mon, 09 Nov 2020 10:43:04 -0800 (PST) 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=eySMjhR5zms6KTws/4iEA2MwcU2LzjcSYaXgUekDkmU=; b=RMN+U8W5oM0IsgsALnpMSN87K8TG+EnWMs8cprbXBwMKovcZ+uGXYi4FyY5UO+FTQz VB/Rn5wWbppLI0TvHavbhXvdDf4YPByKM2LSqx14TW9Nb75qOVhzd1vDJ3bUE0AVPoYf TE7aqD1kPXeAPWE6u/7UeUElrTs4cLRpdsC29eLzxNXLiCyFqk4rpFx4ggzpLphKH6jt 3dyuC5lPFLI/HPy1SOFrlWIiqzlvJjmYNlHNYyO1Mp3gHul71sGp+DYNwcNeEe86RTkp 0uFyqwHW9N4oiW5eLbkUN393OYcIY2FA3L8Uf+Tblfg5tvpCOHLttKZb9Ix6anrTicKA WQIQ== 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=eySMjhR5zms6KTws/4iEA2MwcU2LzjcSYaXgUekDkmU=; b=jAZKM+WLtvCjtIaDHbACiieAHV/t4uV6SxV8qKB9UvGyXBwB9qTA4BZuGLbHEyIZT1 UR9L9kI9s64wWEcvpHJjLynI6ZYxOtauPHBi9KnqOteqRn1D8VoOwTRno8lwSL2KlCGc 9hveeNUlcljns2opJhU6DFR+56XKcLe4upy2+/2sAifEe+VsypU/2QzyQGv5FT60bMFK fk6u0CS9JwTtnzRLk/UwSecYp9Rup7PwL6Nk2mGwYMWcOyLnzMYnR9yxePA3Mz7FomnF twFBLxS4lqEvVDXA8fRTJnfNR6Kr0yVL9WciWCvz9a+B+RAwxeto+m6IsUxGR0V+Ebb0 zaJg== X-Gm-Message-State: AOAM530fAWbcuDG754/aeOvRObvf2rxp6yT5fQhI7XqFoe74HwOUFeGE tvY6krUBM25N6NnceMr1vm4= X-Google-Smtp-Source: ABdhPJzYTaBBW3E18nmdSgnI4+rxrF65yrL5iZK2wpTQZTNbSgv5TcOeC8C4RhzYvqTCSt5ydBmgTA== X-Received: by 2002:a7b:c11a:: with SMTP id w26mr596446wmi.78.1604947384616; Mon, 09 Nov 2020 10:43:04 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id x10sm13618657wrp.62.2020.11.09.10.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:43:03 -0800 (PST) From: luca.boccassi@gmail.com To: Yuying Zhang Cc: Qi Zhang , dpdk stable Date: Mon, 9 Nov 2020 18:40:19 +0000 Message-Id: <20201109184111.3463090-31-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/i40e: fix virtual channel conflict' has been queued to stable release 19.11.6 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.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/11/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. 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/89efff2eebdbce1f7df307e92cc1dd3c9fe3d1a6 Thanks. Luca Boccassi --- >From 89efff2eebdbce1f7df307e92cc1dd3c9fe3d1a6 Mon Sep 17 00:00:00 2001 From: Yuying Zhang Date: Mon, 19 Oct 2020 02:20:25 +0000 Subject: [PATCH] net/i40e: fix virtual channel conflict [ upstream commit 99e47bbe4c074c879bbe5d2c316754859fa00912 ] i40evf_execute_vf_cmd() uses _atomic_set_cmd() to execute virtual channel commands safely in multi-process mode and multi-thread mode. However, it returns error when one process or thread is pending. Add rte_spinlock_trylock() to handle this issue in concurrent scenarios. Fixes: 4861cde46116 ("i40e: new poll mode driver") Signed-off-by: Yuying Zhang Acked-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev.h | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 1cd75b4366..8668dedf9d 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1060,6 +1060,7 @@ struct i40e_vf { bool promisc_unicast_enabled; bool promisc_multicast_enabled; + rte_spinlock_t cmd_send_lock; uint32_t version_major; /* Major version number */ uint32_t version_minor; /* Minor version number */ uint16_t promisc_flags; /* Promiscuous setting */ diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 9feed6222e..4cdffe9127 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -317,7 +317,7 @@ _atomic_set_cmd(struct i40e_vf *vf, enum virtchnl_ops ops) #define ASQ_DELAY_MS 10 static int -i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) +_i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -408,6 +408,19 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) return err | vf->cmd_retval; } +static int +i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) +{ + struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); + int err; + + while (!rte_spinlock_trylock(&vf->cmd_send_lock)) + rte_delay_us_sleep(50); + err = _i40evf_execute_vf_cmd(dev, args); + rte_spinlock_unlock(&vf->cmd_send_lock); + return err; +} + /* * Check API version with sync wait until version read or fail from admin queue */ @@ -1224,6 +1237,7 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); vf->dev_data = dev->data; + rte_spinlock_init(&vf->cmd_send_lock); err = i40e_set_mac_type(hw); if (err) { PMD_INIT_LOG(ERR, "set_mac_type failed: %d", err); -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:12.466735995 +0000 +++ 0031-net-i40e-fix-virtual-channel-conflict.patch 2020-11-09 18:40:11.147311531 +0000 @@ -1 +1 @@ -From 99e47bbe4c074c879bbe5d2c316754859fa00912 Mon Sep 17 00:00:00 2001 +From 89efff2eebdbce1f7df307e92cc1dd3c9fe3d1a6 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 99e47bbe4c074c879bbe5d2c316754859fa00912 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 1466998aa1..508a940dc6 100644 +index 1cd75b4366..8668dedf9d 100644 @@ -25 +26 @@ -@@ -1209,6 +1209,7 @@ struct i40e_vf { +@@ -1060,6 +1060,7 @@ struct i40e_vf { @@ -34 +35 @@ -index 53154c3ef3..6e6eef5a6a 100644 +index 9feed6222e..4cdffe9127 100644 @@ -37 +38 @@ -@@ -314,7 +314,7 @@ _atomic_set_cmd(struct i40e_vf *vf, enum virtchnl_ops ops) +@@ -317,7 +317,7 @@ _atomic_set_cmd(struct i40e_vf *vf, enum virtchnl_ops ops) @@ -46 +47 @@ -@@ -405,6 +405,19 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) +@@ -408,6 +408,19 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) @@ -66 +67 @@ -@@ -1246,6 +1259,7 @@ i40evf_init_vf(struct rte_eth_dev *dev) +@@ -1224,6 +1237,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)