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 432E2A053A; Wed, 5 Aug 2020 11:28:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22B4F1BFFA; Wed, 5 Aug 2020 11:28:29 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70071.outbound.protection.outlook.com [40.107.7.71]) by dpdk.org (Postfix) with ESMTP id E9A5F37B4 for ; Wed, 5 Aug 2020 11:28:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b40BHpoYFD18m5vkEnnGGV/20okDLNdJzqr8HKpfY/QgxGu6o//XpdmPGdJY4GEX96HoS6v+Rpccm5+oVnuCmhS44UhwzsI/y7X7yP/YXkqXT1y4qCDuJa46xPpOGJJzcEqQcoW667lNXVnEovUI4aFds8Snvrs8+vdvYWhSD97gSycMgdeCTL1VqcssQgK9CRaIg3kLQzQlBCHL7HnWu6csTd9GR9/XJCJqbq2mr9SwLtD4hqpkwIMmuKsLR98O0H6FJXG4z/ugYbtPA+dPtVjaOtkZHB0++MJy2Ucj5aPL0ZBNf17aRkvUvWumcEsuOiInSUAK+DvpsfrMw7g8ig== 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-SenderADCheck; bh=N2ZsG4NiHqAGI4Xn2/mG9RkAgCRGijHe7Pb4PblB4us=; b=jE4gfacORISca8P5XT3T5DCfLbKROw4Ic99iCD31/XPzYjWkmcY70y292c5y2N3YDwWoZTfBuvIMB97tu8c3GzAxRY153zGD0W9styhBsJoAJMUp2FqEWiNdXBrexX1ZPH9dzdrfqcNTR9zJ04/pEm0n0jC0Gw8QJZ9Qz4hJpYRoG8eq2T3Jh2kqQ7XdbUbw7fvTYLnGK8FeFYieZs5TM+LFL39hzYNq7tVWWjaEcMfms/ch6oIlDu+ilsuK6TjwNUX1Hb99M9K/PB7t3yls4QZsaBcAQIj1xoK6Ag1ET/eJdlC7lCKqTUXRLdDQH53zd4MyC5fJ2iTNNPRj/UBY/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N2ZsG4NiHqAGI4Xn2/mG9RkAgCRGijHe7Pb4PblB4us=; b=LjKJa1RoROXm5sX+MeIP2XeA8aFcBgnvUw0arBRQPOd81z/2ZqUlZMTr/97X/X8TP+8+DR+RO56LhQBiIKPrD0fw2vwe5vOhZO5/Bq3Tqwjjk+nybDb/CHOXHbCPBhF2O9bjaLh3HAGhgbm8F/FGtDaUKeQVnwDMouPwA8dndnY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5837.eurprd04.prod.outlook.com (2603:10a6:803:ec::28) by VI1PR04MB3167.eurprd04.prod.outlook.com (2603:10a6:802:8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.17; Wed, 5 Aug 2020 09:28:25 +0000 Received: from VI1PR04MB5837.eurprd04.prod.outlook.com ([fe80::c506:dc43:37b2:7d52]) by VI1PR04MB5837.eurprd04.prod.outlook.com ([fe80::c506:dc43:37b2:7d52%6]) with mapi id 15.20.3261.018; Wed, 5 Aug 2020 09:28:25 +0000 To: rohit.raj@nxp.com Cc: dev@dpdk.org References: <20200728164252.2000-1-rohit.raj@nxp.com> <20200728164252.2000-2-rohit.raj@nxp.com> From: "Sachin Saxena (OSS)" Message-ID: <9e90fe75-82da-8e77-d135-92a8c984dc67@oss.nxp.com> Date: Wed, 5 Aug 2020 14:58:16 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: <20200728164252.2000-2-rohit.raj@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-ClientProxiedBy: SG2PR0401CA0024.apcprd04.prod.outlook.com (2603:1096:3:1::34) To VI1PR04MB5837.eurprd04.prod.outlook.com (2603:10a6:803:ec::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.10] (171.61.173.213) by SG2PR0401CA0024.apcprd04.prod.outlook.com (2603:1096:3:1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.16 via Frontend Transport; Wed, 5 Aug 2020 09:28:23 +0000 X-Originating-IP: [171.61.173.213] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 585b30d3-3eef-48a1-103d-08d83921e6ce X-MS-TrafficTypeDiagnostic: VI1PR04MB3167: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vcoSpb5+l9kEwf+c/Y22qDa7NDSn/bWBUzaydQf1p55sAUgJR1mvopElBksYIGDJtDIjOyIM9sxK85wuAKOAN4qrfVDujuLGSsxRh2FFGDbytLTlKghPSRovNYZDWX37wiA8X9IMEyFdfjN10cxpsF/7tU4jhsjHUhbYKI0BYJ80EigNwlKBpQzN7jIynk/kxEqn8uCuFBdiGTsM4E/a55WylfqKC7WKRppMKkVISLOTW+9fv8ngCC0xQCA4m/5qp/SFGKu+tEnyEjzP5IMpI8DCeZRVIsafMvVzvQEmLGocU7sq+5jYkr7SZvRcN1ugr9KpYDAopeEV8gBy+UIBvdznkh2dArMhQWIQQU4WyRpf673clz2qfpAeRWXQ+Hh+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5837.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(39860400002)(346002)(376002)(396003)(366004)(26005)(16526019)(956004)(86362001)(52116002)(31686004)(8676002)(8936002)(16576012)(478600001)(316002)(2616005)(186003)(4326008)(83380400001)(66556008)(66476007)(66946007)(2906002)(5660300002)(34206002)(31696002)(6666004)(53546011)(6486002)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: emDMmdi5xCAGlA2bnDClFudhgpTtRNtQNbyXJv1CZ/YugXBqZe2T7DaK62CPAB4IhvkDiYgU5NhE/ruUGP5vhWq/qZ6yoWrXF7jw4BbO0ueNHDrfXUYYjbXFVw0ZJTnOo8QV1i13vv3EveZq0j0H9ePat7OASYPXINkY1/jvHsL8e2uwA51UI9q0Y97F8BM19C2ZJdu8nljoQmgv/eeWtTEdVkS2HBgl3wUCLOqnRq4NNJ2Yxt49j9pU1Nlsg5LkBwphFkb9QOMbDWC5ReVx/24sq69oRZ06PKsyxjTLa3IyHwCZw9UyPnW2cg93ibn4EusDAjzHBzfTGV3eyYoecbz3tKFd0/k1XPkSXY/bQzpvW0KJB78lPzDr/glGev2xAGr7WCTQobJsMxcXOKTK1OHEsiXuzxMHQoIQx5ifgT1TiOO7nEQ5J+UKSjKQkRtFTDJ9VuB9p8P3UD+OugCGbY5YkxQGchBOIIBQ2dfq8/4ZmGi3diLK93LwFB9ZD6nX7on0Kc29UHbAEz1Dy5ApCa/6BI+pVYiJPJpLDk2yhMU/dorBd1fw+kha5OzcEHdwnXxtFYgWePCMeQa1f2IIvhXbLGZd4mYV6ndY5YpHSEt+1jfLZWmhJjybCQts6e3YcPSCCcQCFRBMg7opNdMx5w== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 585b30d3-3eef-48a1-103d-08d83921e6ce X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5837.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2020 09:28:24.9928 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 128m3txyKr27O3IItdEZZvFYXUWfQ15JgWM4vR9GRMhBglGjhrlSwwVWZ3YFKvoyltRs4O//BSL2EH22g3Z2vA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3167 Subject: Re: [dpdk-dev] [PATCH v1 2/3] examples/multi_process: cleanup bus objects while terminating app X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 28-Jul-20 10:12 PM, rohit.raj@nxp.com wrote: > From: Rohit Raj > > Certain bus objects may need to be closed and re-acquired > while terminating and rerunning the client application. > Hence a signal handler is required to catch the termination > of the App and hence closing the bus objects. > > This patch adds the missing signal handler in the client > app and closes the Bus objects in both client and server > applications when the signal Handler is called. > > Signed-off-by: Rohit Raj > --- > .../multi_process/client_server_mp/mp_client/Makefile | 1 + > .../multi_process/client_server_mp/mp_client/client.c | 11 +++++++++++ > .../multi_process/client_server_mp/mp_server/main.c | 4 +++- > 3 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/examples/multi_process/client_server_mp/mp_client/Makefile b/examples/multi_process/client_server_mp/mp_client/Makefile > index 7c447feba..9fdc74e61 100644 > --- a/examples/multi_process/client_server_mp/mp_client/Makefile > +++ b/examples/multi_process/client_server_mp/mp_client/Makefile > @@ -14,6 +14,7 @@ APP = mp_client > # all source are stored in SRCS-y > SRCS-y := client.c > > +CFLAGS += -DALLOW_EXPERIMENTAL_API Duplicate flag as it is already there in list (see below) > CFLAGS += $(WERROR_FLAGS) -O3 > CFLAGS += -I$(SRCDIR)/../shared > CFLAGS += -DALLOW_EXPERIMENTAL_API > diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c > index 361d90b54..a81be8849 100644 > --- a/examples/multi_process/client_server_mp/mp_client/client.c > +++ b/examples/multi_process/client_server_mp/mp_client/client.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -196,6 +197,14 @@ handle_packet(struct rte_mbuf *buf) > > } > > +static void > +signal_handler(int signal) > +{ > + if (signal == SIGINT) > + rte_bus_close(); - Since rte_bus_probe() is wrapped under rte_eal_init(), rte_bus_close() should also be handled in rte_eal_cleanup ( Also indicated by Stephen). - We should call rte_eal_cleanup routine here. - What about Normal exit path of main(), we should also handle this there too. > + exit(0); > +} > + > /* > * Application main function - loops through > * receiving and processing packets. Never returns > @@ -217,6 +226,8 @@ main(int argc, char *argv[]) > argc -= retval; > argv += retval; > > + signal(SIGINT, signal_handler); > + > if (parse_app_args(argc, argv) < 0) > rte_exit(EXIT_FAILURE, "Invalid command-line arguments\n"); > > diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c > index 280dab867..a5ac84d85 100644 > --- a/examples/multi_process/client_server_mp/mp_server/main.c > +++ b/examples/multi_process/client_server_mp/mp_server/main.c > @@ -275,11 +275,13 @@ signal_handler(int signal) > { > uint16_t port_id; > > - if (signal == SIGINT) > + if (signal == SIGINT) { > RTE_ETH_FOREACH_DEV(port_id) { > rte_eth_dev_stop(port_id); > rte_eth_dev_close(port_id); > } > + rte_bus_close(); > + } > exit(0); > } >