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 17C62A0032; Mon, 15 Nov 2021 14:02:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6BA340E01; Mon, 15 Nov 2021 14:02:00 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 5354340141 for ; Mon, 15 Nov 2021 14:01:58 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10168"; a="220643440" X-IronPort-AV: E=Sophos;i="5.87,236,1631602800"; d="scan'208";a="220643440" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2021 05:01:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,236,1631602800"; d="scan'208";a="454016780" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga006.jf.intel.com with ESMTP; 15 Nov 2021 05:01:53 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 15 Nov 2021 05:01:53 -0800 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 15 Nov 2021 05:01:52 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 15 Nov 2021 05:01:52 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 15 Nov 2021 05:01:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PYx0nWS9XVPy6TFiE0ZXj8B1uTWBYFe39aIVVdiQu2B0H3tP/qr1A8OTzxltzcB9I2fAY0nmXWXRkZBlaGS9/Ye1CMmkPzSXij75hk2kzo/J8nGVmJDkWvhR+VZ588MYi30Lu+a4NrSRrQKCORAFBWh7x9wXdr+poQ5dEes1Arn8D5LGGcunKktb8CrEZZGcl3CbbrQ+uYcj2anXCErpM8wpSGsESn7dTPUIeJ+/yiY+LU9o5gfMQKFL969eWAG2fnsE0w+YajCGel0nRQINMxMMKm8I+4FIKitHyxyr7WKcU3H/LVO2gs2kYZhX3zf5H3M4oc0SVNz2dE3z/C8W/w== 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=bDyWZ9/tY9MgKwSmYyqIfZFm7knMzRgIrYVvQ0L+eac=; b=QR5ZaEcIhSWGMKkXkjNtbkzgWmrDcJsAbZHsPWVgMBBrbfezvErui6h6By+IwQA4iLwi52jNgaYUbX+T5hHpV/WXPFfC6ujP5EUoRD41W1sML8BK1RCmRrDCZ8wmri5Knewb9wXrdPwkBXdR5TKmF5ubGzS6e+TqVfvlBPMF8ccpWNsIPOolZoli+i3SI5pz8gBW6cpuEB++590/qHAFmM19Im+jkgM1LlHIt78TLTY0Ftva895kZxPhkMP1D1lO/Dj7Jv8eBDCr8vVsFjn8/bfDQ7z8JpA32/xXxtuVBtQEA/zPYRz7Aolg1XPZlLNHXRjcBkIJasFjMkKIO4sKgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bDyWZ9/tY9MgKwSmYyqIfZFm7knMzRgIrYVvQ0L+eac=; b=v+TYGf0cSSY723XEbhu2aG3emIZuDsuxdSgiul7776DLU9NOZ5oPzBdDeCIQGX9wuZsicIlllvxc482Q9aiJs+xTR6qlm1NVq1auxputzYqAwm3EPRNtFKHNzfuQlSGRIBJQyuzNyUFqTqm8MiWebgWL70Fvl/NoOtrhdQjW5C8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) by MWHPR11MB1245.namprd11.prod.outlook.com (2603:10b6:300:28::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Mon, 15 Nov 2021 13:01:51 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::8ded:1b78:a4ab:1505]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::8ded:1b78:a4ab:1505%3]) with mapi id 15.20.4669.022; Mon, 15 Nov 2021 13:01:51 +0000 Message-ID: Date: Mon, 15 Nov 2021 18:31:41 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.3.0 Subject: Re: [dpdk-dev] [PATCH 1/3] app/testpmd: fix port status of active slave device To: "Min Hu (Connor)" , CC: , , References: <20211025063922.34066-1-humin29@huawei.com> <20211025063922.34066-2-humin29@huawei.com> From: "Singh, Aman Deep" In-Reply-To: <20211025063922.34066-2-humin29@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BM1PR0101CA0028.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::14) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 Received: from [192.168.1.18] (223.178.208.161) by BM1PR0101CA0028.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19 via Frontend Transport; Mon, 15 Nov 2021 13:01:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7577376-d4b7-4814-478c-08d9a8381747 X-MS-TrafficTypeDiagnostic: MWHPR11MB1245: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: USn3gk4pTxPpCvkcjWqQyaFInm6xE+/zdkPxPdLt06msoJ+nJ57JI+f5tf9TIyUE9SRLng+b0oKfJoRHlImjy0Sqh3RehFzvjrY+h/Y3WqiyL5uUxkghX9MBKuxFEpEkJLijwKSjHvY4UAGbqee3LxVKdMFCXpEHIgY6RMETs2NO11W1lyy50fh8c/jIaUQAAzv2WfSsTc920jIHQDqI6rUaPtgzcJ09QJaLPng2lJ5gqnBh1TjLDg6Ct9TSNpFkHzUvdVBlcjSObDIZAwO59b8F1zQITCcFg6m3QdOUcScnVO8bWBUDtR1TtBFmWK1y7sQFBpb/JBXuX36J5oV9IMz20NK3CxxNCrwZSHQow+mmAEBDete0A35EeOPJeH3Zp1NEYI0k8AxMCk2N99jS7HhkmQ2YFBOs2FTbUGSvO/oAIirqDQ341wSNf5kNhLQ2TVwBuUyIscYU0327Hfvq/VhUqjeryOkgJmU9qC/D9SP8LP84bc8ISwVkwzKv61aYiAiASX56mKD9Ijj3E/EXIG3KsfAPfsu+RedoulRJm0sSl5kntAI0T4Eyq5z5ISa003Rom5kzdJlx7ihWX1rCm9hWdqaADWHc/3m3Uu0IG+8kVrY9rCN+83+6gmsJeu9LznwT8kkCYRxpFzhY95v9BZTJ6dEZI1JzD+7ST5fhq2eA6KQG49XpOIrA5NbLREpPjL9dZ3Uer+XEjveputHzOYA/0FdP2k/WabqRBO6GC4Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB0062.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(86362001)(66556008)(26005)(38100700002)(508600001)(31686004)(6666004)(16576012)(31696002)(2906002)(66476007)(66946007)(82960400001)(8676002)(6486002)(53546011)(186003)(36756003)(316002)(107886003)(2616005)(5660300002)(8936002)(83380400001)(956004)(4326008)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UG9uL3Q4bnBhb2dLZlVTVnVKWWpQWGRBM05sTDkyYUN2WWNpeGxnYml3MDhE?= =?utf-8?B?UjFSRTdJM2YvUzVXajJla2dSYWFESVJ1dFVXQmhaeW5jRzJ5YTYzWGFPajFk?= =?utf-8?B?UEtHN20vNU9POGM3dHNoMDdTL3JoWnU5V3pQa3d5YUJOaW03K3lMakM2SDQz?= =?utf-8?B?L3AvTzVFTkFRS1FRTUYreEZYY2FmemIrNFUyMVZjV1grNEFsQ1ZnZ0ZJTmtS?= =?utf-8?B?RllqeGxCa3AvY3VodFZ0elRNaU9heUtvVmJTempqSzNEVGlLcWlnZjRhSnQ3?= =?utf-8?B?L05QWU93bTRTYUVM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EpiempraGJNaGd0dFVS?= =?utf-8?B?MkJVUnQ3VDF3QVI4UjB2LzBUYmJ2TkhmaURaOWNFa004QTQrSW9mS0oybTM0?= =?utf-8?B?d1NQNWdnSFhjY0IzdUx0Vzc0U1V3K1dZMlBnWFloN0Myek5TVk5vM2IyVVhK?= =?utf-8?Q?DRc9CJunuZDn2XhHBGqVwYwdhQYO9SnYyUPBAWSWOQ=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e7577376-d4b7-4814-478c-08d9a8381747 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2021 13:01:51.5056 (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: yXTcmdHVHB6SzOuyGpASkq7kIoVMvrit5XUbadVWcyt+QzT9za03I5h5bEsGlfy1bvnKer8hK9682z8HNkvwIKGgRZ7SxXxv92MkmnmDaTE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1245 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 12:09 PM, 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) > --- Hi Huisong, Just wanted to check, if this behaviour can be taken care-off in bonding PMD itself. Or each application will need to in-corporate this change. Thanks > 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) > +{ > + 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); > + 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); > + } > > 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 */ > struct port_flow *flow_list; /**< Associated flows. */ > struct port_indirect_action *actions_list; > /**< Associated indirect actions. */