From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yliu@fridaylinux.org>
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com
 [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 2A7571B1B8
 for <stable@dpdk.org>; Wed, 24 Jan 2018 16:37:10 +0100 (CET)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id D174722391;
 Wed, 24 Jan 2018 10:37:09 -0500 (EST)
Received: from frontend1 ([10.202.2.160])
 by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:37:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org;
 h=cc:date:from:in-reply-to:message-id:references:subject:to
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=n7TtsERePAE0Az/wo
 qCzgZ5bcY0kM0TZFbTPIsS3/HY=; b=kqTJjYzCDPsN9VLiOykS1EP0lC3IwzEl5
 LP3e9/Pm9HdInL0Lumb2cBRp+amH1eyjTGBiN2ORB+aVBnayp3VYngOCbgv5ujEO
 A3DxEN7AHvDsYXwiWwet98g5bJ1+mzzZUiQfgt2+ay2502uCBpkVjwrlxBbKmF86
 8YvY0oZT/vjIMQw942ZUOdSwkATw9usd6lClmR4Wc8Dhs506qW/vNvx9qT3cTOu6
 1BQ7vPJ9EArPVTKBBRfGYOcEltgA26KDiqiDhHKFb36rIrB0rsCOBUGDT7PvEz/o
 Xu9ND+5PhQcGprEhh1FTyCUYLiBaUE5ToRawtTfRBasEG4RbRhgzg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:date:from:in-reply-to:message-id
 :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm1; bh=n7TtsERePAE0Az/woqCzgZ5bcY0kM0TZFbTPIsS3/HY=; b=mj2kJIcE
 xYjPXmzbR2bTwfJm2B4UGnyADscuV04CbYX2WBGBBO3YloosatAbud/JLBCOcq7G
 wxGXEmCRAEBc0VV7VTGNgf70TTFtv6RPh6+p8TTtEK/P/qOza9tFY5PD3cCSeU+P
 +VTK081Wl5xjbW2+p0xZumYzOr2buULCUap/DMBuQxeO3txkqEorvgqYWGq3fS2/
 74Z973sboRZdhhK7No6V3aJHD0YaG60yHO4l8WBmNHPhZQfLJ471pwuCGuX+HqX/
 1Kk8o/eIYFXgv2zXexYCRJVicPHKJdFz7KXWJUgSTzFTTGeqkKogpDwRQDSWcmPq
 7w4k4ZFyjGLNgQ==
X-ME-Sender: <xms:JahoWu7dm_OorzLI33Jo8HgJtR4zmFMTHz3qaSeeMTXneyeYyC-cZw>
Received: from localhost.localdomain (unknown [115.150.27.206])
 by mail.messagingengine.com (Postfix) with ESMTPA id B469C7E1A2;
 Wed, 24 Jan 2018 10:37:07 -0500 (EST)
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Jacek Piasecki <jacekx.piasecki@intel.com>
Cc: Radu Nicolau <radu.nicolau@intel.com>,
	dpdk stable <stable@dpdk.org>
Date: Wed, 24 Jan 2018 23:31:38 +0800
Message-Id: <1516808026-25523-30-git-send-email-yliu@fridaylinux.org>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org>
References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org>
Subject: [dpdk-stable] patch 'net/bonding: fix bonding in 8023ad mode' has
	been queued to LTS release 17.11.1
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 24 Jan 2018 15:37:10 -0000

Hi,

FYI, your patch has been queued to LTS release 17.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 01/26/18. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>>From 577e1ac277f053df2e6c2608f84226c3c88c1e23 Mon Sep 17 00:00:00 2001
From: Jacek Piasecki <jacekx.piasecki@intel.com>
Date: Tue, 8 Aug 2017 14:56:43 +0200
Subject: [PATCH] net/bonding: fix bonding in 8023ad mode

[ upstream commit 1184582b5f80b2915d45e4015fb4e762954119e3 ]

This patch blocks possibility to set master bonding by
rte_eth_bond_mode_set() in 802.3ad mode, as the API
doesn't prevent this.

Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes")

Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
Reviewed-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/bonding/rte_eth_bond_api.c     | 29 ++++++++++++++++++++++++++++-
 drivers/net/bonding/rte_eth_bond_private.h |  3 +++
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 980e636..703bb39 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -63,6 +63,25 @@ valid_bonded_port_id(uint16_t port_id)
 }
 
 int
+check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev)
+{
+	int i;
+	struct bond_dev_private *internals;
+
+	if (check_for_bonded_ethdev(eth_dev) != 0)
+		return 0;
+
+	internals = eth_dev->data->dev_private;
+
+	/* Check if any of slave devices is a bonded device */
+	for (i = 0; i < internals->slave_count; i++)
+		if (valid_bonded_port_id(internals->slaves[i].port_id) == 0)
+			return 1;
+
+	return 0;
+}
+
+int
 valid_slave_port_id(uint16_t port_id, uint8_t mode)
 {
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
@@ -496,10 +515,18 @@ rte_eth_bond_slave_remove(uint16_t bonded_port_id, uint16_t slave_port_id)
 int
 rte_eth_bond_mode_set(uint16_t bonded_port_id, uint8_t mode)
 {
+	struct rte_eth_dev *bonded_eth_dev;
+
 	if (valid_bonded_port_id(bonded_port_id) != 0)
 		return -1;
 
-	return bond_ethdev_mode_set(&rte_eth_devices[bonded_port_id], mode);
+	bonded_eth_dev = &rte_eth_devices[bonded_port_id];
+
+	if (check_for_master_bonded_ethdev(bonded_eth_dev) != 0 &&
+			mode == BONDING_MODE_8023AD)
+		return -1;
+
+	return bond_ethdev_mode_set(bonded_eth_dev, mode);
 }
 
 int
diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h
index 1392da9..a5cfa6a 100644
--- a/drivers/net/bonding/rte_eth_bond_private.h
+++ b/drivers/net/bonding/rte_eth_bond_private.h
@@ -183,6 +183,9 @@ struct bond_dev_private {
 extern const struct eth_dev_ops default_dev_ops;
 
 int
+check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev);
+
+int
 check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev);
 
 /* Search given slave array to find position of given id.
-- 
2.7.4