From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10072.outbound.protection.outlook.com [40.107.1.72]) by dpdk.org (Postfix) with ESMTP id DF62F3237 for ; Thu, 27 Sep 2018 13:27:05 +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=g/DYsoftzTjSm9kwoYWsfbA8hODXFnLH7GerjD1nQ9o=; b=dfrD6tPy9TwDCBVRSUSeRN9FBE3hz5a3IOsDVqbKPRm4rnq93QVHZ3NUjn1PL9IX72krap8zx6QklqcLzMXV6Mq45E0GUck543P1DRQK6fA5UAfsf4wOhHzRKK/n/4GWUyLoLE8keYvIWqISaDIdYuGAiVT/8ur1zwDpakl+uK4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB1260.eurprd05.prod.outlook.com (2a01:111:e400:588a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Thu, 27 Sep 2018 11:27:02 +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:26:53 +0300 Message-Id: <1538047613-27309-1-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: AM4PR05CA0035.eurprd05.prod.outlook.com (2603:10a6:205::48) To HE1PR05MB1260.eurprd05.prod.outlook.com (2a01:111:e400:588a::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a4dc0c7-83ca-434b-f001-08d6246c2615 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:HE1PR05MB1260; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1260; 3:ygeHvi9W2ufyqN+fKq7Ii2ESZkfsMRFFAOa6ZyWl5eJrabq+xljiDDJqGigbysrb01F2dkZOLtLv1B4L5FJmE7H4UIhGYf2uNYaY+wscTGVhY9CnVn7sNSl7/lL+EodNE4BzQzBT+GejTrr00mYVu9h3bZ1ohhVA3BYAfhDrQHhijIbKGe7zgW9pVuHfuT9C9/4VXAH93eksezf4SKJQEG/P/pWArVJCg3uh5hItpzo4SRNr69Vglou8HDBxn5XQ; 25:FxVdX8T+qxAGRGbGFA+lEjWVOgHdPtSntolBxAVIxUqh0tqa35PMRa5qVfcjkBSeUzSyOrzPxo4GNNU8R7AIYNGTMNhU4UEU/Oo4Ko5HRx9UHzUI11W/DXKgIZNEHlqGMi16cZ7GA50yWsrQ431nMngwFQwKjtFeDruSJFOufzofrmV0LHfbQ9i7FhWrHSEyUANIL91Cx2JDcEh32sl4Z7GzG8XIC3KHww2VkpCYPs1EFAg+QxH1pdy4On7nDfMCLvicUOcKFA8sRF01J7xzWF6tkrb3YBQ204s/JssYOsh8QgqGMp9JIj/C/TszI/jnPzPOqkvASXb4sxbZo8DBGyiCcmh2pRVhzxDd+NfLbYY=; 31:iIsDgfTUcpsN6cEw3rJRlpeyfVau6JnhlGZIemL6wn4LSI+kPYVmzZZYTpIPaGvy5k1k9Ai0nr9d1Aktp3Kk4eS0x6A3mgvak042nttS+KwRzb7a/1ZDt+xAkaqgs5GHskz3Rogds7NHMuQertIARx3UBCRj9oc4ucQFISzoi/aShaXFNMpb1oPuoLTVaVKvyYhAa0VtsgpMHb5uKRA1UqTe5Mo7tG2tPzBL6KsWEdA= X-MS-TrafficTypeDiagnostic: HE1PR05MB1260: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1260; 20:KtP72FgcHnth3sT5/g4wVYqVaOW0TuxnVB2/B9MfRqDM24GbIcRCcGosKBccynArUaPIYcoAUc/0RYvUGt6BKGlZc1A9VQ4RkrRxykENarhDEliudIWY3cDiapw0o+eH2IRZw2qGxYnIV9+5TVo7VFRA3jZ0Q/g313bzr4OcjF+wdzHfAETGBfAYZiWJXGrdQzlnVyg3fq+o2OxwoFFjoEipm4vCzTaCYh/eIp/GpYcamqRcUgdVbs3OOQD15kLGdSaoI5Z9Ihl30XtYZ8cYWrVbD1NpdoHg46GxbmBdG4jKjb688tp6ZZ1oYpu6a/GrJI8XCs/BZ9avnpkiCq4R4gVbs4tdgoa9/9A2+Hn2UvQ9b9lBD5fFOGmYFBRlO+AutwZBSAHMquBaIECY2Nv/Mjbh2O2AQONZFTQ9rUDYHyj8JohdeQcQb6yfcuoCCup9OKXUKRu0l24m02CL3YzcBkAZr2D7inDCKliM49fxXqR2yf7snIvrGhlI3A7o3vlS; 4:PsalJZeoLoENkGE1P0gZ1yftVSXibrv2H6rJqqF+gcFTRDXYuC6K14Ju7OXXnprXJsj4ZgCtmbfeaklhBRu9+JwKjeZ4bdzlrC0GZ10L+4Fd8aIHpgCIE5+4rA/OoMVoW92ARfyVn5nEdglOsrG1ZnHplfOiGbazrmIuX+xFGZ+DO3xQMmexY8n882tu5pnJY9nltVRW2q6Q+lAeXmt+rZgGkrRkH1IVbQ6rFSxn+94GfsXWb130vIQ72r0snEPnJrpOWLS5H03zIgIjj1Xcx2sE5K8iPDTAPjCIHhA42xVP6tN8IVpT0cB7lHMzChB0 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)(5005006)(8121501046)(93006095)(93001095)(3231355)(944501410)(52105095)(10201501046)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:HE1PR05MB1260; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB1260; X-Forefront-PRVS: 0808323E97 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(376002)(39860400002)(346002)(189003)(199004)(16586007)(55016002)(53936002)(486006)(51416003)(86362001)(6666003)(21086003)(8886007)(316002)(305945005)(956004)(7736002)(2616005)(36756003)(34290500001)(52116002)(476003)(6916009)(7696005)(97736004)(5660300001)(68736007)(25786009)(47776003)(4326008)(66066001)(16526019)(186003)(3846002)(106356001)(33026002)(107886003)(2351001)(2361001)(478600001)(81166006)(81156014)(26005)(14444005)(8676002)(105586002)(386003)(50226002)(50466002)(8936002)(6116002)(69596002)(2906002)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB1260; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB1260; 23:dkPO5CSfvT+3lT7Ue5sb2JQztp0V6x5Dk+OTXiZfS?= =?us-ascii?Q?lwhoZg4BuZYEzLPkeH7iCxcaN1dJtsLL+DjoPjrmdFzWhcVbzcwcYqR51j7n?= =?us-ascii?Q?IylRl5uKE7Augl4yq/gByRuyjxghSStVyEkJac1MehIbtsuCCZXRYAFJfPyI?= =?us-ascii?Q?U1/kgXeMGDOUwavZRxZ3UbXToqv3yGgSk7I6Eqswu0BwpQqy60QRGfQaFd6r?= =?us-ascii?Q?RSQOdGRyUtyXM1RePGUXJf7wl5u9YvSBSGRHcjQeGk7vAalQvIMsdiwtgGvO?= =?us-ascii?Q?MIuMBEcrn0WHOMSFPFLimgsTwjNyYJjFnUBE4LSTjq3H04QYi8VnvL4h9JAK?= =?us-ascii?Q?KmyiXObYN9YmMN9jEuC8BFc7akaTvdwWJFeNZvF7BusDuzuPoHQFmWxYTOID?= =?us-ascii?Q?W+FF4QnxC6uTcdOwOBN/JrQBNYrz6BnxUSfRwP2e89WL9QpH9vBpLP1sX1CL?= =?us-ascii?Q?U/LGwC3dTsH8dqF1UoCFTpL2TbxAxodvy8+jhMau2k+Q1IGWNQ9SUHXOLLVk?= =?us-ascii?Q?cJVa/cGDJ7GRUWyndvmXCUnyYFMW5AiAI37+c3lQajbv1cEAeEji+0at65DI?= =?us-ascii?Q?TiRizqDUmdFxwktSglbVe0uBX8hc6rdVZ9maf0f9RJT4REO1gE8TIUw28Jia?= =?us-ascii?Q?e67VK3s07JA4SOCampiZG2r3PmykicpBUADGqT03jlST4OxnvWVYg53UYXMr?= =?us-ascii?Q?yXkhe7S0bvAA+evUgfdMXT8pkc8KVgvt9rme2IfLSt4pdGaIqUEpB+meWMVr?= =?us-ascii?Q?Joh2knRA+jionA0uh8PNqlpXFd9XgdqmFfrma5b+CZZPXyvBZ4FsbeVlIy7W?= =?us-ascii?Q?swlnBooffsHEZhCAEYwFhNR2QJwZUXEQ5qa08CmhmuiaFo74PJiJ6sjDnuSU?= =?us-ascii?Q?5ky8VBY8zbVwqFolML9PZTZEfnyPuSmGLki2tswSOIGjSu11UVYFKL+vhLwu?= =?us-ascii?Q?MoB/AROeihI4w5X9wlh+B+qovdonom4ur0Tc/DIbckS4NFingLgBBjAuTuAP?= =?us-ascii?Q?7DPhd2RX9/15huizqczivcAf/iN7y+EPpdicOsJ4VAYbBMp8hp4J1WeO0Es3?= =?us-ascii?Q?d7GMDBmZUzz+l6aqHdfhCH/gijs49Z5947aJGe7OK2wk5knMN6QQcIjofXUE?= =?us-ascii?Q?VHtfyFhe6PzBRw8NUbYVg8HItYp26tlppYFg9OUjiRgQAAj2yskwbFUPKL95?= =?us-ascii?Q?cmyxT6Vc2uMhVJIye3aD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4UuP3FZuR5VhA0E9786EhXKkmRgTQSiqQidovKpdggJH7Pc99ONp5dy9v8NergQ7d+IXfw2YzmVHoKG2/ICyVP3rSyZK03SaknJzKYo9s8CcB2JMeaf1t4=; 7:m+WrYRbr9xNeOU0qHOLiY2yxk80g0M+FWjSXQh4OGU0LNONYfGKSg1NshIAOlmd9Dws8xne+uYWxTHNQOOMhze6+L7WavUAriBXwVV37RjXyZyzKBq9Ho/1gd8CAM+8CLOrECYbSU9Lig7vF7sIAX4L56hc9QIqajhpm9tFrMe1EqPMGPt1JLcWtujrL0YYvKe/N0Cvk4YWPJ0r5Vg8aOjEq+S5R8FhKzUOR0zN4r/Z6XmDrGKXERc+f2ns0xRaw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2018 11:27:02.6697 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a4dc0c7-83ca-434b-f001-08d6246c2615 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1260 Subject: [dpdk-dev] [PATCH v2] 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:27:06 -0000 add sigint handler in the server application to stop and close ports Signed-off-by: Raslan Darawsheh --- v2: - fix includes order --- --- examples/multi_process/client_server_mp/mp_server/main.c | 13 +++++++++++++ 1 file changed, 13 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..16aa944 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -37,6 +37,7 @@ #include "common.h" #include "args.h" #include "init.h" +#include /* * When doing reads from the NIC or the client queues, @@ -264,9 +265,21 @@ 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