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 C2994A04DD for ; Wed, 18 Nov 2020 17:38:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5056C8E0; Wed, 18 Nov 2020 17:37:48 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 02D44C9A6 for ; Wed, 18 Nov 2020 17:37:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605717464; 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=8aNQLjaz7FZoXvUE41Eg5U1vzm4T8DNlJFITmel8Ssc=; b=b/AGLZQG8Puz1tM/cTaB58ju9P5hfXUyfq4LqXW0l2OhYJlmoPLceSvhKYkvBGr4738AeL wYnaBux+7+RTUbhIEGRrH/my2kIZZro7SQr1LWTY1iwFWPrOF0mvkI+qn1fKOuluaxi3+Z wiT7Mi3K2mtkATRoJgUfO3aMWSJXIoU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-6VwtQy3rNk-XDuu3pZig4A-1; Wed, 18 Nov 2020 11:37:40 -0500 X-MC-Unique: 6VwtQy3rNk-XDuu3pZig4A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4FDA1922960; Wed, 18 Nov 2020 16:37:39 +0000 (UTC) Received: from rh.redhat.com (ovpn-113-249.ams2.redhat.com [10.36.113.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFEDD5C1A3; Wed, 18 Nov 2020 16:37:38 +0000 (UTC) From: Kevin Traynor To: Yuying Zhang Cc: Qi Zhang , dpdk stable Date: Wed, 18 Nov 2020 16:35:36 +0000 Message-Id: <20201118163558.1101823-50-ktraynor@redhat.com> In-Reply-To: <20201118163558.1101823-1-ktraynor@redhat.com> References: <20201118163558.1101823-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-stable] patch 'net/i40e: fix virtual channel conflict' has been queued to LTS release 18.11.11 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 LTS release 18.11.11 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/24/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/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/693cd7919ca616107497c8321af326466162a890 Thanks. Kevin. --- >From 693cd7919ca616107497c8321af326466162a890 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 6cec6cf0c1..3def71bc54 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1029,4 +1029,5 @@ struct i40e_vf { bool promisc_multicast_enabled; + rte_spinlock_t cmd_send_lock; uint32_t version_major; /* Major version number */ uint32_t version_minor; /* Minor version number */ diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index e1ebaa55de..522322d3d7 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -314,5 +314,5 @@ _atomic_set_cmd(struct i40e_vf *vf, enum virtchnl_ops ops) 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); @@ -383,4 +383,17 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) } +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 @@ -1145,4 +1158,5 @@ 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) { -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-18 16:33:38.879944908 +0000 +++ 0050-net-i40e-fix-virtual-channel-conflict.patch 2020-11-18 16:33:37.967215086 +0000 @@ -1 +1 @@ -From 99e47bbe4c074c879bbe5d2c316754859fa00912 Mon Sep 17 00:00:00 2001 +From 693cd7919ca616107497c8321af326466162a890 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 6cec6cf0c1..3def71bc54 100644 @@ -25 +26 @@ -@@ -1210,4 +1210,5 @@ struct i40e_vf { +@@ -1029,4 +1029,5 @@ struct i40e_vf { @@ -32 +33 @@ -index 53154c3ef3..6e6eef5a6a 100644 +index e1ebaa55de..522322d3d7 100644 @@ -35 +36 @@ -@@ -315,5 +315,5 @@ _atomic_set_cmd(struct i40e_vf *vf, enum virtchnl_ops ops) +@@ -314,5 +314,5 @@ _atomic_set_cmd(struct i40e_vf *vf, enum virtchnl_ops ops) @@ -42 +43 @@ -@@ -406,4 +406,17 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) +@@ -383,4 +383,17 @@ i40evf_execute_vf_cmd(struct rte_eth_dev *dev, struct vf_cmd_info *args) @@ -60 +61 @@ -@@ -1247,4 +1260,5 @@ i40evf_init_vf(struct rte_eth_dev *dev) +@@ -1145,4 +1158,5 @@ i40evf_init_vf(struct rte_eth_dev *dev)