From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7193DA034D; Fri, 4 Feb 2022 13:08:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03AD740143; Fri, 4 Feb 2022 13:08:29 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 188154013F for ; Fri, 4 Feb 2022 13:08:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643976507; x=1675512507; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=J4EIXttV4OTNrgzpzIHhk0NcoC0MPBhClHuPCrLX3dQ=; b=LdrbI5+b7pZdXAjEY3nZ3LJ2cIc+tiTErSHz98WEjnMlhr2DNeCZUint eVQc/wOyavsqCtJY+ZiPwNj1mgH+7NxOQqF8/hZ3J01hFQFRlkfpy5XCO J2rqnjGf941CShK3q+ra4L069jPHIwdalOWHQfA6GFvgXKuta8wbAnP8z tqydmRWpjMgoiyDDKdwC3MmOqUIKdFX2AgCXUh8qFTivkMF5ZLrtQ0InW ZH3j003wwhtlBTjDjBGKQnYp9gYzF4yV8jCLyh4njnxnQzohJYQrWcBnk uki4/ZUvjdD2PcoqCuhfvWSHpP3c3MbPeIbvIx8RyLfPNymmCnvVPboXO g==; X-IronPort-AV: E=McAfee;i="6200,9189,10247"; a="248118546" X-IronPort-AV: E=Sophos;i="5.88,342,1635231600"; d="scan'208";a="248118546" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 04:08:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,342,1635231600"; d="scan'208";a="631684307" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga004.jf.intel.com with ESMTP; 04 Feb 2022 04:08:07 -0800 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 4 Feb 2022 04:08:07 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Fri, 4 Feb 2022 04:08:07 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Fri, 4 Feb 2022 04:08:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=msD6O0KbxjNXTq+LbV5szmVR3Bv7gLnK+bziuIWWZgEqdm85sQhULWqE9jp1YPwAaOtMsPWNgBmY7019tJUprqA4eyL2GXNnKG5YEn8BL+Zn6xxI6jmvKW43996g+4sbqtyAOtiu8LyRUcQi9PUuh/JAWyCqvIdOf0sUVBc9OCNzKButQNo83QcWf4qUhmZ7Evfz9t3O4DZ33L8+P4URc1Os9zyZK0gYYsG76vDmMbGemiv37luqw+WIDg9cVRs7N7XxGlgk5pQbbKr8doiYC9GpSxQZEpGWTfWWKoYFAnR1gRlnQWK33Slny+CaQsiGBL0S7b5ZoubonduvQTPJRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tomvJHM4IFpr0KMyMo5fOvQ0MYcSfmJijlUpBwuUxBk=; b=Y9pMkisE9Xuf2XZDZ34S/lJRDeOTOUVJqGT2cSHUDCrYvhu9GFgOK1kIkY7Mj4IpFrvJMRiB2x2GBrlgb++ODZ6qH8y+GkZW0f1kqsV1dsVmPkKTXhxqfHMjAvzoq0Fw6QfL8YpH9K1s6g04cYg+wDW88w3Tru7Z/hbAU+Qkixqepf0qNgtfGLCMRg1IzQ2DSc7RfniEw0Qo0KlG1HhST6RHP5RyZHUMbUVb9iMyAjDoJX9v0GP0v2937qniRf0p+SGX/W1b5zv5moKMba7IyLxf19wrqAKM+o6buTJXRp3QgiP9P2xCXRuFZZyq2eeI4LsEEsLmpo+vW2lGpQWZHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by DM5PR11MB0009.namprd11.prod.outlook.com (2603:10b6:4:69::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.21; Fri, 4 Feb 2022 12:08:05 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e%7]) with mapi id 15.20.4951.012; Fri, 4 Feb 2022 12:08:05 +0000 Message-ID: Date: Fri, 4 Feb 2022 12:07:59 +0000 Subject: Re: [dpdk-dev] [PATCH 1/3] app/testpmd: fix port status of active slave device Content-Language: en-US To: "Min Hu (Connor)" , CC: , References: <20211025063922.34066-1-humin29@huawei.com> <20211025063922.34066-2-humin29@huawei.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: <20211025063922.34066-2-humin29@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0487.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1ab::6) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6de29ad-5752-4497-de56-08d9e7d6ffb6 X-MS-TrafficTypeDiagnostic: DM5PR11MB0009:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vXAD0nTSDrOsKHrUD0EHtoFrNzlkMfv/SPAzyWRsuI6nmlrD44TkISSrvwuoEVuFr2qegjwPdU40LQcEdP79fP22wsDCYx0PepsOkUYD6Cdq6gEcLSNd+K51jaCZ/DCoO8WDXxZAlpq9c8X4QNNpgsf2pDyYhu6wKftg09uzw27h2d612J33dA4Qup9cweWRSYlt3HaXI4rzSsYQSnkjvkKnDe+wKu2+5BLXaTfSPjgqctPuvP7LtzNOoMCDpcYZGWdBKCd0CtNBWWBivEvBXXgYm92qwXQB2EimQtzOxS/q0MzhQyal0pKBn9/b9Cu9Ugow+VgsW1KFaPpGAFmu0t6hNEPKiK1ZdkUJya2lVpDEoobeOL2AIUAjrIyX5bDlJNH1RWhTr29CbIfuZiPqMCrdzc5O8MYXSHF3PDQKoSr+jDVczMi1tsWplEZny0JJoFgBZfbi54J6YMBBxic3qwf+JqrU84j+fLNnypur3StP/Snqg4O40G3MFoJPhlW+3CrIB02zmh3tgWgiT0YJnWDAV8HJ+dX7ksR/KbunSY+w5GrvpeMRivGxr3ZwgA7DT00FsKY7t3Ga3814wUmGHO2uUAH1GW5/Kq2+szOspldbcjMZZrs1F2Q2B6Gu0q05gTBVC7E/b3xOYWHsJYuADMxTezMzh5j98ws12v6PK6b7JtW8a8oeKaHcMpfgVetORLZuYVFIossYspkQnm8QIw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(86362001)(31696002)(8676002)(2616005)(4326008)(8936002)(66476007)(66556008)(44832011)(316002)(83380400001)(2906002)(66946007)(31686004)(53546011)(508600001)(6486002)(107886003)(6512007)(6666004)(6506007)(38100700002)(5660300002)(82960400001)(26005)(36756003)(55236004)(186003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MzRMWGRVdDhvSVRDcEdtendaeXI2SXMyNXAwMjFuK2dvWmxhWmVWMjk5Z2I1?= =?utf-8?B?MGxjcnFOTHJRY2dqRkZTdlp2RVBBQzBjVjZhMzVmRWRldkRBYnpkYTZ4dWg4?= =?utf-8?B?bkM2U2E5TmtLSVJWMFlvL29OcDdsM0VIci9tY1dJeWhwQ1I4M09md1dXZjJR?= =?utf-8?B?Y0xVUGJwSk9FcHR3azlJZGdudWpFa3dXQmdITjFBYndTeEI1cVZiN0NhMHpa?= =?utf-8?B?S1NYS2pTY0RES0g4RmxkVlNSekFub3JLZU1UOWtwam5BUyt3OFphTmc2NHpw?= =?utf-8?B?VkI4ZDhxQU8vRmNmc0w2S0FsejlVMndLajU0bUZIdXJrRzBxaHp4QnlCYk9a?= =?utf-8?B?eTVySm5ZOFJZdkFSMW5iS09ncWxTOGt2a0JONERBbG5nUzllWUlnOGZqdHdY?= =?utf-8?B?MDNUbUM5Vnc3empLSmVsNDFTVjNKZzdFUGlzZTBmZzQ2Zittd1Q1a1VnNUZk?= =?utf-8?B?WWN5WlFlNWxuZno4aFVEcFdFa0ErQTNjVWhIakVORUcrM1NCVUlucXVnelJQ?= =?utf-8?B?Sm42RlJPN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f-8?B?ZWlEVHNTeGZWb3hYUXUyazhoMFpSbkFXNHg3Y2lTTE5zalEvWDJzMXVpK1NM?= =?utf-8?B?bTE0Mm5CcmZVcm04RHhHV291R1p5SVVJZFVTZnRnSDZJeEFLbHlzYnR6K3Z5?= =?utf-8?B?ODdINzFOQ0QxYzdaclRkMWtVS3lUUjQzWVRycGlXa09VUGZLV2VuTEFIcklL?= =?utf-8?B?UWFrMEFHQS9SenVUaEhqTUVmZmxrNlR6SGNucDBsV1RPNHNxVUVvTFVrUXJt?= =?utf-8?B?Q0NIZ3Erb0RmZW9aT25wdkh3YjgrT1JQQk91am1Gd0ZST3dINFdCZlhvT3JZ?= =?utf-8?B?NTF1R1BXL1krai9mbitEUlFnaC9ROTE4VkpaY3BPcU5MTHlvZGIzYnNrcStS?= =?utf-8?B?OWRwVVlGOWdiOG5IbkQ0bU9KY21KcDBGV2dnTXE1N29RcnZpVm10MVZpNVBS?= =?utf-8?B?R0cyQXNDb2phUS9kZ3lRWnlhNGFQZ2xzV3ZucnB4ejlrTUNRWFJMTWZWVCtY?= =?utf-8?B?eTFlMFp3R3U0SzlRKzVRbUNONUx2Ynh3ekczbXhEbHdWUzZ2QkVjMzFONGZI?= =?utf-8?B?OCtCR0h4eDBuSFJJZXozL3g5T2Q1Q2FVRjNodURNUDZsZ3dNWE9hOVZTOHgr?= =?utf-8?B?SjM5S0tvWmVONGg2VUhzYUdvQkR1bG9DZVE1K0FVWklMYVFEODdJSnJVRHJW?= =?utf-8?B?VkZtQnV0bFVRNW1zQjdRNTlCeTdBcE9FdkVxOXZJUnJpcHRCczJxdE5id09j?= =?utf-8?Q?AHbiGlnIv4slgDUVz6PJcs8=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: b6de29ad-5752-4497-de56-08d9e7d6ffb6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2022 12:08:05.2433 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LiNLJ0g9sPPRrLVqIhlGSzpyzNyuwyzSBZA0XoQI/hKkqwrzpSbpig3g4wEiXMtMTci5QWuByK7EiMXkHFLDgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB0009 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 10/25/2021 7:39 AM, Min Hu (Connor) wrote: > From: Huisong Li > > Stopping a bond device also stops all active slaves under the bond device. > If this port is bond device, we need to modify the port status of all > slaves from RTE_PORT_STARTED to RTE_PORT_STOPPED. > > Fixes: 0e545d3047fe ("app/testpmd: check stopping port is not in bonding") > Cc: stable@dpdk.org > > Signed-off-by: Huisong Li > Signed-off-by: Min Hu (Connor) > --- > app/test-pmd/cmdline.c | 1 + > app/test-pmd/testpmd.c | 49 +++++++++++++++++++++++++++++++++++++++--- > app/test-pmd/testpmd.h | 3 ++- > 3 files changed, 49 insertions(+), 4 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 722f4fb9d9..5bfb4b509b 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -6639,6 +6639,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result, > "Failed to enable promiscuous mode for port %u: %s - ignore\n", > port_id, rte_strerror(-ret)); > > + ports[port_id].bond_flag = 1; > ports[port_id].need_setup = 0; > ports[port_id].port_status = RTE_PORT_STOPPED; > } > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index af0e79fe6d..d6b9ebc4dd 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -65,6 +65,9 @@ > #ifdef RTE_EXEC_ENV_WINDOWS > #include > #endif > +#ifdef RTE_NET_BOND > +#include > +#endif > > #include "testpmd.h" > > @@ -2986,6 +2989,35 @@ start_port(portid_t pid) > return 0; > } > > +#ifdef RTE_NET_BOND > +static void > +change_bonding_active_slave_port_status(portid_t bond_pid) The function sets the status explicitly to PORT_STOPPED, but function name is more generic, should we update the function name to reflect the functionality? > +{ > + portid_t slave_pids[RTE_MAX_ETHPORTS]; > + struct rte_port *port; > + int num_active_slaves; > + portid_t slave_pid; > + int i; > + > + num_active_slaves = rte_eth_bond_active_slaves_get(bond_pid, slave_pids, > + RTE_MAX_ETHPORTS); > + if (num_active_slaves < 0) { > + fprintf(stderr, "Failed to get slave list for port = %u\n", > + bond_pid); > + return; > + } > + > + for (i = 0; i < num_active_slaves; i++) { > + slave_pid = slave_pids[i]; > + port = &ports[slave_pid]; > + if (rte_atomic16_cmpset(&(port->port_status), > + RTE_PORT_STARTED, RTE_PORT_STOPPED) == 0) > + fprintf(stderr, "Port %u can not be set into stopped\n", > + slave_pid); > + } > +} > +#endif > + > void > stop_port(portid_t pid) > { > @@ -3042,9 +3074,20 @@ stop_port(portid_t pid) > if (port->flow_list) > port_flow_flush(pi); > > - if (eth_dev_stop_mp(pi) != 0) > - RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n", > - pi); Can you please remove the 'eth_dev_stop_mp()' function in this patch, which is removed in patch 2/3. > + if (is_proc_primary()) { > +#ifdef RTE_NET_BOND > + /* > + * Stopping a bond device also stops all active slaves > + * under the bond device. If this port is bond device, > + * we need to modify the port status of all slaves. > + */ > + if (port->bond_flag == 1) > + change_bonding_active_slave_port_status(pi); > +#endif > + if (rte_eth_dev_stop(pi) != 0) > + RTE_LOG(ERR, EAL, "rte_eth_dev_stop failed for port %u\n", > + pi); Should we roll back the slave port status if 'rte_eth_dev_stop(pi)' fails? > + } > > if (rte_atomic16_cmpset(&(port->port_status), > RTE_PORT_HANDLING, RTE_PORT_STOPPED) == 0) > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index e3995d24ab..ad3b4f875c 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -237,7 +237,8 @@ struct rte_port { > struct rte_eth_txconf tx_conf[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue tx configuration */ > struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ > uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ > - uint8_t slave_flag; /**< bonding slave port */ > + uint8_t slave_flag : 1, /**< bonding slave port */ > + bond_flag : 1; /**< port is bond device */ Can't we detect if the port is a bonding port without introducing a new variable/state? > struct port_flow *flow_list; /**< Associated flows. */ > struct port_indirect_action *actions_list; > /**< Associated indirect actions. */