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 C1EE5A0503; Wed, 18 May 2022 06:23:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4E0F4281D; Wed, 18 May 2022 06:23:02 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150083.outbound.protection.outlook.com [40.107.15.83]) by mails.dpdk.org (Postfix) with ESMTP id 28AB340685 for ; Wed, 18 May 2022 06:23:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NJboCb1xsDTuRrJf2fFmhHL+hO+efdVk2F1RH4Ae0vSBMtt5r7sIXU21kc8A3OMJ2n7aQVMC9JjLFeIzyd43joZGwqhoRtBr3/4y5pm3CXGU8DMY++27Ab6/VqFm7AHjKXwo86YAfQzmQFViuZKHwo+queJeN3ZwVAJo14L4KYo/vIUWJm9o9dRfGYp1xoXnCUW6Oa9ojj4XmMVFrfQ923kRyn5ER0G/q4dHa8iutZToFD/3/edgUWas3aZDaLaKkRvip4FmXaFUNXgKzmPQqjfVOGvWRa64D1r/41CeMnRV42bSOOv2ex9lxGXpufJgnqMgrQQW46YdMnrsb7SP3A== 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=vOBSC1EE8LlkJtNo8e4ecxyRoqRsgsbw1zaCLCLz4cI=; b=jijN+/Y51dC7TaXq6QkfZzxd8buyY/X9H2jqM6wa1eVvmxEI9QWcDsl/YmzCz2nwnrjKzd6GfCdFp2wFWjC0q/6wP3CvzgbY9BHQ2WtdC+n0HHybZY3aP6tCUyFzSw76Rj58m63ucH00RypF1H9C+t58PYHeaFK1fW9Iwfeks9Gcysz/0g8WYE+jqXlABaV0Pe7QMX11+UjH0ML9dv0RRE+MJW482y62b5N37sWV1m+8YJtUyTSl+KF2aSjTeo5DB8QX2Dufr2mF8PYcJMGVDlZlCvDsPy2+9qKRxrGLqRH+E4s1eDrx5baqNqYq04nrGO2wEBMa7bQLll2oPFLkNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vOBSC1EE8LlkJtNo8e4ecxyRoqRsgsbw1zaCLCLz4cI=; b=TswKYIso0F+4ognlbkypuND2lw75cYC/cIPlzBdT3hvVqVnvJZkRR+i4exFD6D3nGX+Dy14csEPHvdH1SvaapXDgX4vL0qjklGsYUnZfWA4Igxc2NwJ/yEzFUAFg5evxXJYe/wfN4DOiGxyelRXvKtnVd8wm7FwlGEh2DsPizEg= Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM0PR0402MB3492.eurprd04.prod.outlook.com (2603:10a6:208:1b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Wed, 18 May 2022 04:23:00 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::8cf1:93b:c340:3be2%9]) with mapi id 15.20.5250.018; Wed, 18 May 2022 04:23:00 +0000 From: Gagandeep Singh To: Stephen Hemminger CC: "gakhil@marvell.com" , "dev@dpdk.org" Subject: RE: [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for exit Thread-Topic: [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for exit Thread-Index: AQHYaZ+yluJDFNPqv0CWkvCZqKEcPq0jRBIAgADGaVA= Date: Wed, 18 May 2022 04:23:00 +0000 Message-ID: References: <20220425041423.2232034-1-g.singh@nxp.com> <20220517033858.40394-1-g.singh@nxp.com> <20220517033858.40394-4-g.singh@nxp.com> <20220517093212.71b8019c@hermes.local> In-Reply-To: <20220517093212.71b8019c@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4e896d5f-8438-46c3-f801-08da388617f2 x-ms-traffictypediagnostic: AM0PR0402MB3492: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: yR9tCuguM++ZJYju1SVb8qnGTP97y5DbRyC5EFAgweJFLgEG5MxwJKnQ3m/8HDBOUwz6hW8PFVfXwWKyA9bAYtpuMpOymis5Axu76R4sBW5vMvKaI4QNRBmkGB5QGjpN5+4+9qrrSxZJdhiVegZvHthNbNzFoAfIiRFSJQfzvEAC36lmeAAPUp8Acjachj5wxw7iAbNMEPZABIlSW6ECs0ZxdLFH1FHPc7AoNSJSTizPrbErI52oBnk6+ZU0O/mSyga6yYYl8wETLkCWI9LO3cUxCm9qtMQ6lBGMpfpthIuzhGRiOh6fMBDGWicJnK4cr6aoa0YAHPa1BvUfzBr/qMytf0h8VC+9XcY9uygDkGpgZZmlgeTTSogxN+3kyGnOCv53CtOy4ojU9PS/UW5Z7/SRJY7ktn2WOAkF2cRyFWcHsjXjuXyf3uzJa4CR5A1y7cAN8MSC4rgffXXGrmhGTXLpR6nhryQTjdSGYXlyFg6bXGc5Vw16Xh/dyX9FX0ya5tAvYdq/6QvgiB2Tg7fqsDq0Fd/vqyGgGpAUylPUoRF1vqnovPdQspojuHk8uz5kO/vGBBIX1KkNUsxmHu+h+x/fviqBb3MEMu97tqID6sg/PgL7ZbzSKUlp76oKqo2+3clxuWoAwtTqF/lV/NQVKeyGR7T6Bg04RE560LOQ1xfImNGYddiOupO39dC71udL1VFNUmA1RRzRbiz7t6mBgA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(186003)(86362001)(8936002)(6506007)(71200400001)(26005)(38100700002)(38070700005)(5660300002)(316002)(83380400001)(7696005)(122000001)(66556008)(54906003)(76116006)(66476007)(64756008)(66946007)(66446008)(33656002)(55236004)(53546011)(2906002)(6916009)(55016003)(8676002)(52536014)(508600001)(9686003)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?v2gswmUKBrLjvy+xVAzfcIPcNjYSIHXH7QWRur4kLMy/4B0f7003yvg3I/7d?= =?us-ascii?Q?ViZNIMDf6B1ajfjpqUjLHltQJU/dUWDgQKOZ2lWsVhFhvCMbfvQTzdkwHHGp?= =?us-ascii?Q?nMgE8dvIbHg/kc2bQRwIOtf4iSC1hJecuwDUElY0sp9YrayW+zY3uF0hruaC?= =?us-ascii?Q?3IRcVGPTRXkeZpLes97G/px+XoqUJWGkB/F4ZlQreHSzFGNAKeEvZ7DMpmUD?= =?us-ascii?Q?TX7j99lMy6EA2/YK2ImN34VAYDxBwX0e/yG7yT1WMyiHyUEIc4vi8+k25zxr?= =?us-ascii?Q?82n0RUubVUlVP0OuaorD6vIOkuvtMdHfQRwprTy8CjMeUuFE0N1BRs3NWGGa?= =?us-ascii?Q?P2uF0JE2ZKAseNpanwG8hknZsfSn0Sba45Wrcs8MRNER/f4wvPvAcMYjMSml?= =?us-ascii?Q?vXrK75xrEQdD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Ox8r?= =?us-ascii?Q?bu39OynQW9SEjPKZl6iG6lNke4fvo0T4jc8W+OjqXGnvnitCnP+4Olb3I4tQ?= =?us-ascii?Q?2oeeM9fcEnQ1LYwVTpsM7xT7qLsFPHXBfJkWRaTxUX7PUzQfKGdtH/aejEAn?= =?us-ascii?Q?y5DnelnM9bo6lOB69dcLBv8VBbAhoBGeJ0Ime23hbazpl4+e0CERkNbnBfS8?= =?us-ascii?Q?qiEhD8BN8ak35nWkBB/32JKjyAzcUY/b9vXGyQUKYpiJpYWn7xgpQDqOqFyN?= =?us-ascii?Q?YxOw35H84fuT7+JCMObbCSj9Wo+7VqjJuO5ppVIpboYbOwjlLer9BLk4gyYK?= =?us-ascii?Q?zbEcUYjqQ+NaQlw4WoZ0YZ4pMMxlBKWj3mjZdKTVJNchboSo+Zdoy8gzcoq/?= =?us-ascii?Q?Ty6rsBYMIvC/+RlkVCSBRqIS6MPPXFwc/J7qqq20UJwpGBcz?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e896d5f-8438-46c3-f801-08da388617f2 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 May 2022 04:23:00.4762 (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: RG06I1AGZhDMIqkJnLryfLBxoLd5kVITPNKWU7W0sLceJ5arrVYTQWP0aTtiWGPh X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3492 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, > -----Original Message----- > From: Stephen Hemminger > Sent: Tuesday, May 17, 2022 10:02 PM > To: Gagandeep Singh > Cc: gakhil@marvell.com; dev@dpdk.org > Subject: Re: [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for= exit >=20 > On Tue, 17 May 2022 09:08:54 +0530 > Gagandeep Singh wrote: >=20 > > Handle SIGINT and SIGTERM signals. > > > > Signed-off-by: Gagandeep Singh > > --- > > examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/examples/l2fwd-crypto/main.c > > b/examples/l2fwd-crypto/main.c index b1e2613ccf..0a1fc790fc 100644 > > --- a/examples/l2fwd-crypto/main.c > > +++ b/examples/l2fwd-crypto/main.c > > @@ -18,6 +18,7 @@ > > #include > > #include > > #include > > +#include > > > > #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 > > > > +/* Global signal */ > > +unsigned int signal_received; >=20 > This won't work as expected. >=20 > This kind of flag needs to either be volatile or use explicit atomic buil= tins > because the compiler and CPU are free to believe that it never changes. >=20 > Traditional way to address this would be: >=20 > static volatile bool signal_received; >=20 > More advanced way would be to use __atomic_load/store builtin. >=20 > Also printf() is not technically safe to call from a signal handler. Ok, I will update it to "static volatile bool signal_received;" .