From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70081.outbound.protection.outlook.com [40.107.7.81]) by dpdk.org (Postfix) with ESMTP id 196FE1B45F for ; Thu, 27 Sep 2018 13:52:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PLqZ5eDpT4Ann51VKzcvvIvzsJUN+aAyFnNqXMz8C8g=; b=ylLqkAjZEAn2AoALUmAonXSAGvpo/w1VEmXVJbWu+DS5hcvqe8YGwKZA7KwwFIrJkPDcct9w0r9wgpu8I1sxN/hJiVGKXICEQpCgKnaqZmsXBWLA0B1rLJnPJoWa+aeKjb3t/WLUcQdylQlVCMNxXwKWsbiuZ9KsYmvGGH9ua+8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB1259.eurprd05.prod.outlook.com (2a01:111:e400:588a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Thu, 27 Sep 2018 11:52:20 +0000 From: Raslan Darawsheh To: thomas@monjalon.net Cc: dev@dpdk.org, shahafs@mellanox.com, rasland@mellanox.com, orika@mellanox.com Date: Thu, 27 Sep 2018 14:51:44 +0300 Message-Id: <1538049104-23277-1-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538047613-27309-1-git-send-email-rasland@mellanox.com> References: <1538047613-27309-1-git-send-email-rasland@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: LO2P265CA0064.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::28) To HE1PR05MB1259.eurprd05.prod.outlook.com (2a01:111:e400:588a::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9fc23e94-182d-435e-c745-08d6246faede X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR05MB1259; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1259; 3:puGa9f80MjeEobWTUPvKi82WRU7epkaYtZLEJ1iRC5uX8DiuESqNSfoY8RJwE0HnAMmN4v6zCl6tXAn2TWVa1pETMZzIBdcNmKT74J/Kqc9WBulA/Pge9U8CB2KH7zGM+5CUyz1xaUhnJsE796REV1qxS/4OVj7N4AH81+LxyAl9KGbbDkPCq7YxXQjweWLAr6dzBWgyIYlxOvOIGIzjlYrNzD6fXUPlnvcV3+gbec778md5NL3zbKSbIEZ3t7RA; 25:qpjNEar9t8/+Hn4MTU/AWc+Y+pUHH56sCJfpLuUIjdWYwgA+rcrUwdp9VxuqbeKETDmTCIsnHNnBsdbv84d3fxmbeWSThruU3ofu4+KDdBZorbdZCHr+/c4Lu6crx32RI/nixg5oe0dq2poNDf83ixZoV8AqHDZUECnwNNIFQj94pT2AaLz7t6Nb1l6h/ZXq/l1PtQntqbFLw39x4aL3s6zKqYoAG0fx0GFn40tcvoycSmwxVVMostVittd+nGNzN93E6/gl+b4FAM1PWfT1vMi9z2vf+hos35kEOYJojx/Q2WZ0z3knkUPqjv/uKItYzMUGfR5sogGe7d8C70dUbJll20KVgA6PxMQWnM3Av0U=; 31:to+iddGF3RLps9oZY+D7995NwTzI/P9QkD5KUZic+/lHiI1ysleejjIGKPF1smA0sIYQGs5YG36hJFjbRahBmZJf6zd7Hiv1fQIXHh1y1a6HtFpMoGyVUgyy0r7k5nf9IPGmxuwBHK8Mb1jWjAqKaGHqI6uxWD4JS0HbKIv57GlJ85h2TNQlHKtkolfG2dTEqcJ91CSpNagS3uX59pwugx6bOqLPqXxxGTAZHG4kbdY= X-MS-TrafficTypeDiagnostic: HE1PR05MB1259: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1259; 20:p3f1figSlp0xaMRossG9k4v+wyYCl2LR8X3u4kk9/2Z+kLnRbDpXP6Se3EozBnBiWT1c2s/v+msKJ6VgczXCJEyFRPI2t/Fe9csaKLMh6ARVqootFS3PB0XY3z3NaB66JNjSVwZprWoTpBZmgOFMBVEIGo9mbnkbYR4ir4AeUP4VeIVoS97Og/NiLQhYXqWRgOAABLySXu5/+0phRTpZixbHTN36b95uVksoE1Qk3PMMmwr6jf2JRTHnmy2P+A8cGtbowk+PWYZ/dK5NFbbMUa4yVlozmDx50P9r2nhG6JfB50DQO1ty6kqO8xS4ujVWn4STDVOklq5xrCKIjWLccoZp4R+qicvLyDGjfbAbu6tfIb3xO9tKX9/RHiAnlLWySJd4lCt2rBVkxNM4Jg1lNWwPXhKP+GdAcNztL7SPHVjzTsucN3mnqvkuyw1loDuHGzxWuO7WqnnT/jvE7IEvBm9nubVY91RlkO9nrPQuj6h89eXkf80MZf995WJUEfzZ; 4:Tke56/ylvRvhQcgbiVpOeuwLpplkWWbkcaIF3CfZPp3O+FUZdV4+xpp889pu95+fh2dvQPYURJ6ZAtfcOQ98sHsFJln7/MV/pheBqfWIK0228HDjEH+iXnVOz5UlSp2pegQFjXWtwmYMBZrwe9BiLluSQbWqXgSHpnbf+7ExeG7qSRqnUeYutSYAwnB9ceay/kR26HbBUQvWC/odgMTQQ14X4dvU/xwexwRF/Q93l0BZwnJmPsHU4VbvBLNiP9erSgDeoat878mY0oga7hZCKKEwCoxU4O60O9H46dEDf6det4vEMgp7Mx3plQeVm3hj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051); SRVR:HE1PR05MB1259; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB1259; X-Forefront-PRVS: 0808323E97 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(396003)(39860400002)(136003)(346002)(199004)(189003)(97736004)(106356001)(81156014)(2351001)(16526019)(81166006)(33026002)(68736007)(51416003)(7696005)(2906002)(4326008)(5660300001)(8886007)(6666003)(105586002)(7736002)(8936002)(55016002)(305945005)(6916009)(186003)(26005)(86362001)(8676002)(14444005)(446003)(2361001)(69596002)(36756003)(486006)(476003)(478600001)(50226002)(956004)(2616005)(16586007)(11346002)(21086003)(52116002)(50466002)(48376002)(34290500001)(316002)(25786009)(386003)(107886003)(76176011)(6116002)(3846002)(47776003)(66066001)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB1259; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB1259; 23:yJ7UKrbl6CDZ/qFT0CWose4Fk61T93AyCtTjsIom3?= =?us-ascii?Q?op1xUvYfVyrc1BNUApIGx5a/bLgSHDpxIc5PzoM8MQmFav/5HSpe6VpfO9hZ?= =?us-ascii?Q?YQkblHtL6AjLQ5mBpQX/ANIBMETgfIyOHS8XGIBTjVuAumQeAAQFR4dRFhHQ?= =?us-ascii?Q?ZcYPftkpwohIJjTrF/BSOAQNOkleb//S+edvKfizlPKajQ20dnL/gOoN+uSJ?= =?us-ascii?Q?2fu1HJRWBDo+Ozbu4aZPRRXMEGLcVICw6hMfBhjKz679Bwayq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ro0yz+4yLdlKKOP2dFP/SN15VkwWdJPQvr+8RMPegNEx0HHWNXuPQc1+kIgKNvlTQg==; 5:lKbUyWamWFVVr0JeBGr677neWtz2aZU7s+GoOuCXFSmBlykrNy2/ey2nF7Uo/Ala9pDKjL8tL13+822ZB4P/KgC+KlKk6znCf48FBey9UGFXTKuE99ARih6sW2x3U+AIGp6VZGCrJoARE5aQWTTqs0dmgj0/CBb/+A4YeGTIWis=; 7:6SwfyqoOe5G0HNwuQAdrFMEs2T8u48hDZ5i+f+FQmQ6tZGfmXhcvKUaaEMUp82Vpw13jfhOazDhfzEZm/UTRIgSw5ZiMJFjWV6qA3AssU8VtkamUBi3XWFAv5jAHCWEFqt34uWE7IQgNUI9wZXlfIssorQzer402VogEt6RuZHqxruLdwt1z6ybfcR6fusNcEz7rHrhrZ2mA6FPmC4HpSvh/aT26SzlmenHE+NODVgfud6zrAO3me8uHbhZaPh8b SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2018 11:52:20.6121 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fc23e94-182d-435e-c745-08d6246faede X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1259 Subject: [dpdk-dev] [PATCH v3] examples/client_server_mp: add sigint handler to server 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: , X-List-Received-Date: Thu, 27 Sep 2018 11:52:23 -0000 add sigint handler in the server application to stop and close ports Signed-off-by: Raslan Darawsheh --- v2: - fix includes order v3: - fix spacing --- --- examples/multi_process/client_server_mp/mp_server/main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 93a9a08..0ddc63e 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -264,9 +265,23 @@ do_packet_forwarding(void) } } +static void +signal_handler(int signal) +{ + uint16_t port_id; + + if (signal == SIGINT) + RTE_ETH_FOREACH_DEV(port_id) { + rte_eth_dev_stop(port_id); + rte_eth_dev_close(port_id); + } + exit(0); +} + int main(int argc, char *argv[]) { + signal(SIGINT, signal_handler); /* initialise the system */ if (init(argc, argv) < 0 ) return -1; -- 2.7.4