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 2D8A3A034C; Mon, 30 May 2022 12:22:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1AE6442B8B; Mon, 30 May 2022 12:22:10 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 18FEC400D6; Mon, 30 May 2022 12:22:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653906128; x=1685442128; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=16GPhym3+5rDcAFJRjZMwFGYrFDssofq+4m6DifuYCI=; b=hLpEeR5Xfx3BHYg1PbeMkXgZBPUDgxI/jsFhwftVE3zkxMW1WYOz0v5h gtSl51Ib+Ue2/t695lmP2vhDqVPwfPTF7bzdiiudACxU8vmWjfDwNsxjh DRbvyvRVxgTF/Z09960QoTFW6j1/a8Umc6RsasF+7Z6u28BJbNuY4VTFE vT6jQX68+bf96IrQnOcmsqs3obqdenU+YMM8sXuqe8NWEjoAKqvqHvnsK LORVzVQoue53JaDc1pLTZU77KwMpW86SK4UORrnSU0zl9cazG1nWw5fXT xmHO5Qk2glOT0VX5NbA4he8b6H01fmVMyFS/MrYJd/pAPuIQFACgNS/b1 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10362"; a="255448504" X-IronPort-AV: E=Sophos;i="5.91,262,1647327600"; d="scan'208";a="255448504" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 03:22:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,262,1647327600"; d="scan'208";a="529118630" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga003.jf.intel.com with ESMTP; 30 May 2022 03:22:06 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 30 May 2022 03:22:06 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.27 via Frontend Transport; Mon, 30 May 2022 03:22:06 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) 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.27; Mon, 30 May 2022 03:22:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y4oaHQe9LmAXFndde30s2x4s99uJ2E6gE8fiYedsDbu8gytr5Hlw2E6cA88A04YQgtlDHdvfka3v3UkwS8eaJsN3ONJmF54W24yfurDSxerJy1ksWu/4qtX0jeGfVNk4D9l2k4eHpdwfU+NNBeVFc7pdZKByQcdQATUC9ldzKd98/pkq123FcGot2Z3fPEILlK1rlXqOxUkNJE5POyEaAx5aIbXYxhOgL8w0g+bqOyRhsrW1wB+jHq5G7SVdxTd5mBpfwHKkkagsoPHoi7zUkJgM/gLffu72rlWLT8y5+Y7qsqj6hOJ+sP8p9TylM4yTMpZK9yJ7YsbPpRav+YTtDA== 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=Lnv+x8h8pSsxRFSJfoxVO8hdGAZdOyHrRwbCHKA253k=; b=UYFdJWW824Ywl6HCJd6kpQXTiBBxLqxyOS/DlyNUfLIFt4Fy47hOsiuKc6o2JyjbbjmPvp3SuzN/rJDCB8ySl6HyuO+G+lUV2ZzRN7yCn7A1rY4LvviU6xXXUHOo/4mcNnvTVpDzr2hZW4z63PDEdPOAwUEmBMmtKn9owPT+6TclJufEIKVN+pVQFFULkWTYCcUzRWwm1v+Y9DKKmhYOt4o03FzfXAEaRdZng2feOpg5/FWsQd9jYPqIAgMAYuXqDWcU7b9F7NjmU8yo8YRvrHTA3iGS6jM3eN6LCBaFrYZhJd3ZGCbNqCQ805+araA0uWnR0A/9e+kQEB2Z8nKFiA== 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 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 DM6PR11MB2633.namprd11.prod.outlook.com (2603:10b6:5:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.15; Mon, 30 May 2022 10:22:03 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::28de:cb68:fa21:3225]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::28de:cb68:fa21:3225%6]) with mapi id 15.20.5293.017; Mon, 30 May 2022 10:22:03 +0000 Message-ID: <1c5e01dd-7a27-f9c7-656f-671242263602@intel.com> Date: Mon, 30 May 2022 15:51:53 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH V2 4/4] app/testpmd: fix slave device isn't released Content-Language: en-US To: "Min Hu (Connor)" , CC: Huisong Li , , Xiaoyun Li , Yuying Zhang , Pablo de Lara , Bernard Iremonger , Ferruh Yigit References: <20211025063922.34066-1-humin29@huawei.com> <20220324030036.4761-1-humin29@huawei.com> <20220324030036.4761-5-humin29@huawei.com> <7e71fe75-776a-d68a-6a8a-e0f227367d97@huawei.com> From: "Singh, Aman Deep" In-Reply-To: <7e71fe75-776a-d68a-6a8a-e0f227367d97@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PN3PR01CA0029.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:97::18) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a0135f9-a055-4c39-4f6b-08da42263d59 X-MS-TrafficTypeDiagnostic: DM6PR11MB2633:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QgdmN0c2z6WZ7a8VYRzgvKuiFpNZifU/iShzkNUw8Ea/HY9e8Anau4shTeX5uWXdrG7+i+5+PnLynviWCq2MSK5gw5C/BGVOGvWK1Ji+jxNTRCn814jnQ24KVbdzL4blfGHnpSkWVGWGEsXdm73/T2Q6YRY7GpYDINuU8r9Y2w1m+RhSNtdQ1mxt1nuHtIJ8UAsN8Sit5IsB3hjPSunSBuC3SJhZrwrrnBzXry8QXrLEXMmx/D2pYLi4c13ItZ4tyiEm3wzM9MnAL9QcREHW/H85ffWXyX2YaDAtJhEHeIUGsocspX7ftlBbB9M9Zf05Hc4mIqvRhIboR7vsQpUofHqY4Z3ufun78eN0I2ldBRjXX5p0BbGSW6ZEwK1GqOXmu23KhnLKymd3d+G1md8sNZXYx8zFOqfeSwrpFQMMLoV6qz37B9BzSNx0HNQAXbZDow0pwtUk4sP8rtjFsVxUMDFbDHOb8C0e6WHO7aqR/Om8q+gfGKWn800K8EK+d2BFA33CaPBgFp5orF7X0jWH6Di2umgtSOelf/I7vo4wrzp9XqNbmIIAhVxwKdKcgtDh3FlZazRoDj1G5JxujmpLDu4aYUHDBUQoY2SgOb60Fo188FC6y+2n60OsdaBUDEullfn0MsiWZGDZ5VPm3Wh6bcFbx7OKVFOYE4Bun42CNeX8nHSv6BVH4x2xRp8jw21Pzc/qRZnagzDk8ZeY+T3RBAaOUsqXuORrOd65jnyfWcM= 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:(13230001)(366004)(36756003)(83380400001)(66476007)(54906003)(31686004)(66946007)(31696002)(82960400001)(186003)(8936002)(2906002)(38100700002)(2616005)(86362001)(26005)(8676002)(66556008)(6666004)(53546011)(6512007)(508600001)(6486002)(5660300002)(316002)(4326008)(6506007)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bE54M0JMa092ZEtQMlQrWE96dDdVWkw4TlJ5c2doL21LaUp0OExSREc5bnBh?= =?utf-8?B?dGFHUktPSjM3UkRVSVkvZ25yL1NIQm9YOFlyMXNvNVoyczJsOW9KaUtNYzdO?= =?utf-8?B?VnZjV1doYklCajBHVEFyTzY2VGZ0bXJpL2ZXem1LWUVqS1ZWR01nbnYzaGJW?= =?utf-8?B?cXJjSzZmSEswZFNNMUdpbEh0NFhvVEZLdFBtbDh0RVJ4eEI5N3ZDSUY5T0lJ?= =?utf-8?B?UmI0eE1EQ0tidXkwUWdkekJDQ0dUSi9MZzJtU25KVGErMHgrWUl4cFhWZHhH?= =?utf-8?B?a2NBNWg1cE9xQ2RyUEpIWXBZT0RRYWVUU3Y5bW0yYnBSd3E2bklNYmd3SU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UY3Rk9ZNjl5Z2V0SW1semwzNnhsVEhG?= =?utf-8?B?bUtDRno5TmR3MnNxM3RNQk9GUWxGeGJZeCtkNitKWlVsQ0xDaUszZk5QT3NW?= =?utf-8?B?d1ZocFkrbXBlcmhIZ2NpUkRGeUpTR0laUlpOK1dzSnh1OTZLZDhDYUQ4QzYz?= =?utf-8?B?RXN5UzJPRitNYW5YaGp4Z3Z2aVZUV2pBOEpaWjdCK3dVOHMzeDNIeC9pMXJN?= =?utf-8?Q?P9jTPMaJyC52JZ+A=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0a0135f9-a055-4c39-4f6b-08da42263d59 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 10:22:03.5081 (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: nh5tZyKzBnkpeBRiLR0/avkuaOjWHHqneKoKQlAtCDkcghEk/V64N/v0RJ4z1aZPSSnxpRsf7cNyTkHARthDlpYdjWe9CkJR0ktO7IflYr8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2633 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 Hi Connor, On 5/30/2022 11:31 AM, Min Hu (Connor) wrote: > Hi, all, >     any comments for this patch? > > 在 2022/3/24 11:00, Min Hu (Connor) 写道: >> From: Huisong Li >> >> Currently, some eth devices are added to bond device, these devices >> are not >> released when the quit command is executed in testpmd. This patch >> adds the >> release operation for all active slaves under a bond device. >> >> 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 | 48 ++++++++++++++++++++++++++++++++++++++++++ >>   app/test-pmd/testpmd.h |  2 ++ >>   3 files changed, 51 insertions(+) >> >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >> index f0efcf09f0..cd3873e1e0 100644 >> --- a/app/test-pmd/cmdline.c >> +++ b/app/test-pmd/cmdline.c >> @@ -8891,6 +8891,7 @@ static void cmd_quit_parsed(__rte_unused void >> *parsed_result, >>                   __rte_unused void *data) >>   { >>       cmdline_quit(cl); >> +    cl_quit = 1; >>   } >>     cmdline_parse_token_string_t cmd_quit_quit = >> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c >> index dc90600787..22700e073d 100644 >> --- a/app/test-pmd/testpmd.c >> +++ b/app/test-pmd/testpmd.c >> @@ -229,6 +229,7 @@ unsigned int xstats_display_num; /**< Size of >> extended statistics to show */ >>    * option. Set flag to exit stats period loop after received >> SIGINT/SIGTERM. >>    */ >>   uint8_t f_quit; >> +uint8_t cl_quit; /* Quit testpmd from cmdline. */ >>     /* >>    * Max Rx frame size, set by '--max-pkt-len' parameter. >> @@ -3167,11 +3168,43 @@ remove_invalid_ports(void) >>       nb_cfg_ports = nb_fwd_ports; >>   } >>   +#ifdef RTE_NET_BOND >> +static void >> +clear_bonding_slave_device(portid_t *slave_pids, uint16_t num_slaves) >> +{ >> +    struct rte_port *port; >> +    portid_t slave_pid; >> +    uint16_t i; >> + >> +    for (i = 0; i < num_slaves; i++) { >> +        slave_pid = slave_pids[i]; >> +        if (port_is_started(slave_pid) == 1) { >> +            if (rte_eth_dev_stop(slave_pid) != 0) >> +                fprintf(stderr, "rte_eth_dev_stop failed for port >> %u\n", >> +                    slave_pid); >> + >> +            port = &ports[slave_pid]; >> +            port->port_status = RTE_PORT_STOPPED; >> +        } >> + >> +        clear_port_slave_flag(slave_pid); >> + >> +        /* Close slave device when testpmd quit or is killed. */ >> +        if (cl_quit == 1 || f_quit == 1) >> +            rte_eth_dev_close(slave_pid); When we close the bond device, shouldn't we close all slave ports also with it. Just to avoid usage of  global flag "cl_quit" >> +    } >> +} >> +#endif >> + >>   void >>   close_port(portid_t pid) >>   { >>       portid_t pi; >>       struct rte_port *port; >> +#ifdef RTE_NET_BOND >> +    portid_t slave_pids[RTE_MAX_ETHPORTS]; >> +    int num_slaves = 0; >> +#endif >>         if (port_id_is_invalid(pid, ENABLED_WARN)) >>           return; >> @@ -3205,7 +3238,22 @@ close_port(portid_t pid) >>           if (is_proc_primary()) { >>               port_flow_flush(pi); >>               port_flex_item_flush(pi); >> +#ifdef RTE_NET_BOND >> +            if (port->bond_flag == 1) >> +                num_slaves = rte_eth_bond_slaves_get(pi, >> +                            slave_pids, >> +                            RTE_MAX_ETHPORTS); >> +#endif >>               rte_eth_dev_close(pi); >> +#ifdef RTE_NET_BOND >> +            /* >> +             * If this port is bonded device, all slaves under the >> +             * device need to be removed or closed. >> +             */ >> +            if (port->bond_flag == 1 && num_slaves > 0) >> +                clear_bonding_slave_device(slave_pids, >> +                            num_slaves); >> +#endif Can we merge these two #ifdef sections, like move _close() below. >>           } >>             free_xstats_display_info(pi); >> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h >> index 67f253b30e..5af9455012 100644 >> --- a/app/test-pmd/testpmd.h >> +++ b/app/test-pmd/testpmd.h >> @@ -32,6 +32,8 @@ >>   #define RTE_PORT_CLOSED         (uint16_t)2 >>   #define RTE_PORT_HANDLING       (uint16_t)3 >>   +extern uint8_t cl_quit; >> + >>   /* >>    * It is used to allocate the memory for hash key. >>    * The hash key size is NIC dependent. >>