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 622CFA034C; Thu, 26 May 2022 15:56:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50AA840151; Thu, 26 May 2022 15:56:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DE85E40150 for ; Thu, 26 May 2022 15:56:09 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24Q9BMX4025529; Thu, 26 May 2022 06:56:09 -0700 Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2042.outbound.protection.outlook.com [104.47.51.42]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g93ty90nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 May 2022 06:56:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QX9iJYPyQaF5j4nYVQj94nNL5lx+tApswP7/oAAAR94ZbPQopHQFQVNsBUy0J3XUoFu/YJ5/g6avvJkaA+J23Nji5TDbI/0jMXRbYrWTwTfGR38mhKsEsCK6puPeyYbRhuBC+0LzpricXSd+xg1x9bHYCFcOsC0f3Zix4xPZiGNqdwlEeKXrMz+tsz8lg0P1oc2Mv8gXKCP5RmMr5OFU7uLgTFSIEvxk4sYGY6jveZBO4TSaJ2Vij0eatrM0Y0CHGSAryEE+5KTY/5gmkUFQ8YJYkJmVrYjq4IvrafbQucZ7c9mtrhccueErKoq0QdBIeGiCNragKxmaUk+ODacGbg== 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=1wpfPk6Dfd4Dr9O/klDRFie8jKwnhJvPcy7fHrLVhAw=; b=UrvJwBtzt5Erev+O0q5Tn3ZOiSeKuLL5ddM8XNr1lJEOuRad8VNlxY5yOyypm7H2+R1HVr4e5Nku0TCl9Z/i9QzQI1WgDiVQYQ6hDc4Q5gYVsBk7QiDnvlaZLjVZIDlig9R3TmiKyylAVUTiv825L84MwPPk9Lp2Sfv/ORYJKGSOQ18TXylg7GdRwUp4MfEg+5668PUgV3UO9p74QWiQ3sXp1D6mAHs9SYRQ6G908AhXhpFXjqbAth0c5WPZzWQ/P20y/NbkvOCFykh9C3kv3kf7q21FsP9TmNatDk6et0GONvNyM0onVpaRe+XuozyvFwIGAG5uPle05tJPvPT6iQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1wpfPk6Dfd4Dr9O/klDRFie8jKwnhJvPcy7fHrLVhAw=; b=ikoWIjt8PzzFswDQlWrCwYJKwry1P8AVdTXMb3d0q7mTWYaIG/z9JKlMW/Y2WurZ0noreu2IKUSsmEiHPlaAceqO0pWUnZjB/qLJpj7oErJ4TdrQynkgkKcukrq4oTEhzCEcI3P+vVB0iOzbVEexAC1coU6KAF6VxD2J47+IHyI= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by DM5PR18MB1228.namprd18.prod.outlook.com (2603:10b6:3:ba::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Thu, 26 May 2022 13:55:40 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::f154:453d:893:f6ce]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::f154:453d:893:f6ce%7]) with mapi id 15.20.5293.013; Thu, 26 May 2022 13:55:40 +0000 From: Akhil Goyal To: Gagandeep Singh , "dev@dpdk.org" , Stephen Hemminger Subject: RE: [EXT] [PATCH v3 3/7] examples/l2fwd-crypto: add signal handler for exit Thread-Topic: [EXT] [PATCH v3 3/7] examples/l2fwd-crypto: add signal handler for exit Thread-Index: AQHYbAEW3hgirkxNzE+zGO8AB3vD1q0xOFdw Date: Thu, 26 May 2022 13:55:39 +0000 Message-ID: References: <20220517033858.40394-2-g.singh@nxp.com> <20220520042104.3784908-1-g.singh@nxp.com> <20220520042104.3784908-4-g.singh@nxp.com> In-Reply-To: <20220520042104.3784908-4-g.singh@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8429aa51-5685-4841-08fa-08da3f1f6b1b x-ms-traffictypediagnostic: DM5PR18MB1228: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: IqNpUTUEMDo40P8GHiQaktr/1CYdaMIISkKHqvP1V/jrAzMGZDg7jUpZOY9rWC0tcGZQYTUeMYHmY9IiWWh8H2sffH0x783MxpwkZZ8Ut4aW69extvu0ed0Mp4cTE5FOjmf/Ol5ku2jaeBTe5w08xeMGNjfPQAfRtpooqrqttHcS1DajpW0MfoS2hCu2zzwr98ATOIe0zry8JJaNjmfLwtuE4rYp86kyPMUoAKkFr3AVxZu4hu+5guRjh7tyz1jEfDtwqqZcBOhibP1VWZNSFu3g9divXgff55wocsY66Ucwf0J2N8rL8oa8sz4t/5lF4rH9b4vpjITnmzmPXFPuJgzfNNTBtvowXRYNY4ASc+8O2lNZ2rnMvXyzsrE/MXAegzlJpdWLq5F+jTPRVtX5kZR/ZT+3DJIIpjOcOZRvflpiQwmVKvvERAT9WlwEWHc4fdvUcMHpiuX7cXCYZhHRuYN1n4fgQEQtuFA6UfV5Jbfo73TiCJr3CZYDLQDb1u6QCOo5CqYeG9MMXA3LF5eTM2nvjKIBdmdMOKfnJ4LthOL5rBFKoc8L39+R2Pb1BgSBUYABJV/emg5WplqPvhWAzADA48nhgKOO2nu/iMhFsJVCp6B2cPFVabbOu65eF3exzomKHgaKxDRLIV/gnncjHZEEBmv6wTZmrYkobyhLBwtvyp4AADNZokA2gLAOMlCMbCvvD5HIC5cvQ+rJ9gCVzg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(508600001)(71200400001)(26005)(186003)(86362001)(33656002)(55016003)(9686003)(2906002)(52536014)(38100700002)(5660300002)(316002)(110136005)(6506007)(7696005)(55236004)(83380400001)(76116006)(66446008)(122000001)(66476007)(8676002)(64756008)(66946007)(66556008)(38070700005)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?jIErl4ms2G7f8HjPHs1B2eBeyEVeOsd6mRLkxWfoFWRUObCtJ7QLAQBMtuGb?= =?us-ascii?Q?cDmjCkPXvtEjxTXSvYVa6biLInw2UOTWAnx07oKkgPvFYLTIAYIWWkudibzZ?= =?us-ascii?Q?8pHe1lBt1m742u2Vx4PMtwlJ/EGADPeKWM9sJp4w+jRMReJ1423JNNh8S05S?= =?us-ascii?Q?KXVW4pZthGndacvHw+ZIPBRfut/ARwyioP8DT4DzQcQU/Yx36y2H7ZvDRVwh?= =?us-ascii?Q?ME7OyVBowlr5A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Y6vjgXWe?= =?us-ascii?Q?PQjNT/ok4N6JPBFBXDNf1+qTGwoN5OHlCPwqDvoEYcM/5fChLs/7Jbmjz8Qn?= =?us-ascii?Q?hgWfyvvoF9Ur7AtwGxp+s+MdRByeJqlnCJI4F7halU1OFIHPYZncKVz1DESu?= =?us-ascii?Q?1FpP5G7e94K9/KrnalDo1ERmuiwDJPxeEtXIvc2vavhjJ7xr/OFbpjyB0Q2Y?= =?us-ascii?Q?g6OLPqPFoeh/5itKPiOrpgveP6CAiYOWo2wVVWhSzNTXYxuN2Ixmvuz3AzQ+?= =?us-ascii?Q?QbS/CxFIORkHXI3BrtZFtB/j8QRYvCDyh+5uzaKewMNJjYJidfFrLJQf5Goo?= =?us-ascii?Q?eejo5rITH0ChajvP/f3lUOVAGlhh5OUauG2Gk1YPKDS088pMwcYeCPTzB0vt?= =?us-ascii?Q?OVHRzkW+eYLGw+NVL7Obu8n3RqBwWCI06o25lJ65stCETGJ+IH0SRcmY9izp?= =?us-ascii?Q?mLZ83FUd1bU0Jd4qgSvCIdQP0uW7esxpdArUKuMRlbjJA5618KQfH6K1R+Xv?= =?us-ascii?Q?oggPPJjK2oj25rfBe5UotF84DLRnA/jxQ2aRhk7QZ/av9M2G/djAfELv2zo6?= =?us-ascii?Q?xo4cz5VV6EGHy1+z4ccIr2HMnSbTRqisXLqFVP3n9UVndtU+YTIH29teteng?= =?us-ascii?Q?c5eMtY1kwA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8429aa51-5685-4841-08fa-08da3f1f6b1b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 May 2022 13:55:39.9191 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Zrg0KM1etZTId3olI0bBv0UdMD6P/1W2JAQIcp/EqmQQECn46wdlxa/xNlGHFfChKhIGaX59eg5LTSWWE3sh2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR18MB1228 X-Proofpoint-GUID: xeZazVmXNZBeZTA1Oszq4sGD6Wtd055L X-Proofpoint-ORIG-GUID: xeZazVmXNZBeZTA1Oszq4sGD6Wtd055L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-26_08,2022-05-25_02,2022-02-23_01 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 Stephen, > Handle SIGINT and SIGTERM signals. >=20 > Signed-off-by: Gagandeep Singh > --- Do you have more comments on this? If not, can you please ack? > examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c > index b1e2613ccf..bf4b862379 100644 > --- a/examples/l2fwd-crypto/main.c > +++ b/examples/l2fwd-crypto/main.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > @@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics > crypto_statistics[RTE_CRYPTO_MAX_DEVS]; > #define MAX_TIMER_PERIOD 86400UL /* 1 day max */ > #define DEFAULT_TIMER_PERIOD 10UL >=20 > +/* Global signal */ > +static volatile bool signal_received; > + > /* Print out statistics on packets dropped */ > static void > print_stats(void) > @@ -922,6 +926,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options > *options) >=20 > nb_rx =3D rte_eth_rx_burst(portid, 0, > pkts_burst, MAX_PKT_BURST); > + if (unlikely(signal_received)) > + return; >=20 > port_statistics[portid].rx +=3D nb_rx; >=20 > @@ -2760,6 +2766,13 @@ reserve_key_memory(struct l2fwd_crypto_options > *options) > options->aad.phys_addr =3D rte_malloc_virt2iova(options->aad.data); > } >=20 > +static void > +raise_signal(int signum) > +{ > + if (signum =3D=3D SIGINT || signum =3D=3D SIGTERM) > + signal_received =3D true; > +} > + > int > main(int argc, char **argv) > { > @@ -2772,6 +2785,9 @@ main(int argc, char **argv) > int ret, enabled_cdevcount, enabled_portcount; > uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS] =3D {0}; >=20 > + signal(SIGINT, raise_signal); > + signal(SIGTERM, raise_signal); > + > /* init EAL */ > ret =3D rte_eal_init(argc, argv); > if (ret < 0) > -- > 2.25.1