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 C2898A04DD for ; Wed, 18 Nov 2020 17:37:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BAD29160; Wed, 18 Nov 2020 17:37:14 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 8E2A1160 for ; Wed, 18 Nov 2020 17:37:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605717432; 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=gpd8gWS2/Rp+GXnT6d3TUlwc6TyhLDoyXlF3jyW/SSs=; b=gvOCLVdN4Fk/NfcpBaK5/h8FNRyCmGst2ikGlzSxF0LhWeNSPie9Q64yBdCbLdpqwvzAlw c0EXbDzXedySKJPK5vPawsbosuux3ezBl6lZtb7UVQP1EWfWYabSmPtEa6rb9FGcQrdU/h 0GflJhq/DB2jLOtnVM4Jr1M5rw8ahw8= 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-575-mKuktgrEOPeSSqZI13-CnA-1; Wed, 18 Nov 2020 11:37:08 -0500 X-MC-Unique: mKuktgrEOPeSSqZI13-CnA-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 5E553CE1DA; Wed, 18 Nov 2020 16:36:36 +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 295A35C1A3; Wed, 18 Nov 2020 16:36:33 +0000 (UTC) From: Kevin Traynor To: RongQing Li Cc: Dongsheng Rong , Wei Hu , dpdk stable Date: Wed, 18 Nov 2020 16:34:56 +0000 Message-Id: <20201118163558.1101823-10-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/bonding: fix possible unbalanced packet receiving' 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/4a4dfbc01d277e32d83f99d8ddcedb057755084e Thanks. Kevin. --- >From 4a4dfbc01d277e32d83f99d8ddcedb057755084e Mon Sep 17 00:00:00 2001 From: RongQing Li Date: Tue, 22 Sep 2020 18:29:31 +0800 Subject: [PATCH] net/bonding: fix possible unbalanced packet receiving [ upstream commit 97602faa9e03c91465fc55f5464762796ce641c7 ] Current Rx round robin policy for the slaves has two issue: 1. active_slave in bond_dev_private is shared by multiple PMDS which maybe cause some slave Rx hungry, for example, there is two PMD and two slave port, both PMDs start to receive, and see that active_slave is 0, and receive from slave 0, after complete, they increase active_slave by one, totally active_slave are increased by two, next time, they will start to receive from slave 0 again, at last, slave 1 maybe drop packets during to not be polled by PMD 2. active_slave is shared and written by multiple PMD in RX path for every time RX, this is a kind of cache false share, low performance. So move active_slave from bond_dev_private to bond_rx_queue make it as per queue variable Fixes: ae2a04864a9a ("net/bonding: reduce slave starvation on Rx poll") Signed-off-by: RongQing Li Signed-off-by: Dongsheng Rong Reviewed-by: Wei Hu (Xavier) --- drivers/net/bonding/rte_eth_bond_api.c | 6 ------ drivers/net/bonding/rte_eth_bond_pmd.c | 14 +++++++------- drivers/net/bonding/rte_eth_bond_private.h | 3 ++- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 7bbe9724a0..27b099205b 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -130,10 +130,4 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id) internals->active_slave_count = active_count; - /* Resetting active_slave when reaches to max - * no of slaves in active list - */ - if (internals->active_slave >= active_count) - internals->active_slave = 0; - if (eth_dev->data->dev_started) { if (internals->mode == BONDING_MODE_8023AD) { diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 0189a3d446..340bee3bb9 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -69,5 +69,5 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) internals = bd_rx_q->dev_private; slave_count = internals->active_slave_count; - active_slave = internals->active_slave; + active_slave = bd_rx_q->active_slave; for (i = 0; i < slave_count && nb_pkts; i++) { @@ -86,6 +86,6 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } - if (++internals->active_slave >= slave_count) - internals->active_slave = 0; + if (++bd_rx_q->active_slave >= slave_count) + bd_rx_q->active_slave = 0; return num_rx_total; } @@ -283,7 +283,7 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, sizeof(internals->active_slaves[0]) * slave_count); - idx = internals->active_slave; + idx = bd_rx_q->active_slave; if (idx >= slave_count) { - internals->active_slave = 0; + bd_rx_q->active_slave = 0; idx = 0; } @@ -343,6 +343,6 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, } - if (++internals->active_slave >= slave_count) - internals->active_slave = 0; + if (++bd_rx_q->active_slave >= slave_count) + bd_rx_q->active_slave = 0; return num_rx_total; diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 8afef39baa..854ba8cd4a 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -51,4 +51,6 @@ extern const struct rte_flow_ops bond_flow_ops; struct bond_rx_queue { uint16_t queue_id; + /**< Next active_slave to poll */ + uint16_t active_slave; /**< Queue Id */ struct bond_dev_private *dev_private; @@ -136,5 +138,4 @@ struct bond_dev_private { uint16_t nb_tx_queues; /**< Total number of tx queues*/ - uint16_t active_slave; /**< Next active_slave to poll */ uint16_t active_slave_count; /**< Number of active slaves */ uint16_t active_slaves[RTE_MAX_ETHPORTS]; /**< Active slave list */ -- 2.26.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-18 16:33:38.175272335 +0000 +++ 0010-net-bonding-fix-possible-unbalanced-packet-receiving.patch 2020-11-18 16:33:37.911215050 +0000 @@ -1 +1 @@ -From 97602faa9e03c91465fc55f5464762796ce641c7 Mon Sep 17 00:00:00 2001 +From 4a4dfbc01d277e32d83f99d8ddcedb057755084e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 97602faa9e03c91465fc55f5464762796ce641c7 ] + @@ -23 +24,0 @@ -Cc: stable@dpdk.org @@ -29,3 +30,3 @@ - drivers/net/bonding/eth_bond_private.h | 3 ++- - drivers/net/bonding/rte_eth_bond_api.c | 6 ------ - drivers/net/bonding/rte_eth_bond_pmd.c | 14 +++++++------- + drivers/net/bonding/rte_eth_bond_api.c | 6 ------ + drivers/net/bonding/rte_eth_bond_pmd.c | 14 +++++++------- + drivers/net/bonding/rte_eth_bond_private.h | 3 ++- @@ -34,17 +34,0 @@ -diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h -index 0a0034705d..62e3a9dbf3 100644 ---- a/drivers/net/bonding/eth_bond_private.h -+++ b/drivers/net/bonding/eth_bond_private.h -@@ -51,4 +51,6 @@ extern const struct rte_flow_ops bond_flow_ops; - struct bond_rx_queue { - uint16_t queue_id; -+ /**< Next active_slave to poll */ -+ uint16_t active_slave; - /**< Queue Id */ - struct bond_dev_private *dev_private; -@@ -133,5 +135,4 @@ struct bond_dev_private { - uint16_t nb_tx_queues; /**< Total number of tx queues*/ - -- uint16_t active_slave; /**< Next active_slave to poll */ - uint16_t active_slave_count; /**< Number of active slaves */ - uint16_t active_slaves[RTE_MAX_ETHPORTS]; /**< Active slave list */ @@ -52 +36 @@ -index 97c667e007..a4007fe07c 100644 +index 7bbe9724a0..27b099205b 100644 @@ -67 +51 @@ -index 1f761c7c9e..05ac25fcad 100644 +index 0189a3d446..340bee3bb9 100644 @@ -70 +54 @@ -@@ -70,5 +70,5 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +@@ -69,5 +69,5 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) @@ -77 +61 @@ -@@ -87,6 +87,6 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +@@ -86,6 +86,6 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) @@ -86 +70 @@ -@@ -304,7 +304,7 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, +@@ -283,7 +283,7 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, @@ -96 +80 @@ -@@ -368,6 +368,6 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, +@@ -343,6 +343,6 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, @@ -104,0 +89,17 @@ +diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h +index 8afef39baa..854ba8cd4a 100644 +--- a/drivers/net/bonding/rte_eth_bond_private.h ++++ b/drivers/net/bonding/rte_eth_bond_private.h +@@ -51,4 +51,6 @@ extern const struct rte_flow_ops bond_flow_ops; + struct bond_rx_queue { + uint16_t queue_id; ++ /**< Next active_slave to poll */ ++ uint16_t active_slave; + /**< Queue Id */ + struct bond_dev_private *dev_private; +@@ -136,5 +138,4 @@ struct bond_dev_private { + uint16_t nb_tx_queues; /**< Total number of tx queues*/ + +- uint16_t active_slave; /**< Next active_slave to poll */ + uint16_t active_slave_count; /**< Number of active slaves */ + uint16_t active_slaves[RTE_MAX_ETHPORTS]; /**< Active slave list */