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 7A1E0A0352; Thu, 14 May 2020 15:47:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B2FD01D943; Thu, 14 May 2020 15:47:51 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id AE0DF1D907 for ; Thu, 14 May 2020 15:47:50 +0200 (CEST) IronPort-SDR: KW9XcmgOh2L2NcZwrvnDWFgpMMLarsW/xsVjuHKCNiLPUFurAvvkWvvuSsWYP5mKROBRZcMTui XNkUChgSVVxg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2020 06:47:49 -0700 IronPort-SDR: 1FwWAJfUzgEDZwbEFPFc5YS+a6YWEG2YByE+8fENGAMktRv+DOCSzOFKpZXfvOq7q48RwlYyBJ pLAfy+7JgBnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,391,1583222400"; d="scan'208";a="280860080" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 14 May 2020 06:47:49 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 May 2020 06:47:48 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 14 May 2020 06:47:48 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 14 May 2020 06:47:48 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.49) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 May 2020 06:47:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bDEqo2bwlXpsnO+nzpyhEA0N4SrYebPy8jcyB3gm/fSLkj3rfLiKskiTx2IrCxFmQ9GamCRTBTZIjCJbdi+cokSPV4qjFfhpGrx5vdbSIVBAyDSsEEtKr45MUFPBAZbc06kqRGtca8sqSZFKhpRqKITyPXAT2zkjm+bbf/l4s6dUxIN0lpOt60iQ9PFDOIRofbkGzJAx26Bt4ZGHdfCh4KBjDZo09nbiwDeQoRMddd8LhplCCBok1UPyBH2ccD/zSrxqr/QhqGrg2yTyMg7k07wYzGvlrb3kFnt8TwPRhs0/YbahHsgQrWhGogeiWAbFprIoxp4u1JXMxZX7/zKgsA== 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=tz1mY3bWIwvYS48YvIKj2+kRD5W7bVw2cROlbG4hD98=; b=Xy0jlZOI+DpMww9y9/jeGmA7+OU/ljd/tUGbPhLnnkNKYnkCTudPiugX7cpxTLUxtDRUn//aZHTysujGLXLQDrLC6sFcdFATXFEdc2HzwNTPwxbez46Mx1B4dXBCMlYb/tp5cP28cBd2NzY1l8OYePrfC4zODl7hsNU0k/Scw8EmDuYbGY+N5UllekHthq/vvhxW8CNPMnd+MvK28Z5wUukGr0SDUjXoz9JYibnGiOC2MzIej4kNJIBmw8zPxDZwXeHbouJyHmyJIgjZc8qlDzQHkH5btADQlaW19w60Oz/+PCocPG41iEpmyPFY+9uslYRdVOu7VOoaFG5LBI4cTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tz1mY3bWIwvYS48YvIKj2+kRD5W7bVw2cROlbG4hD98=; b=EGn4i1MP1b6wtqooKTDPeyBMOI/RK1llxFe5ICXp2Q4hF/pBx6UWAl6Yn8zS3TQo7JHkL18eiK5m8TLDHRBlXfeW1KXwYfbcbo5Zuk5KTXR/BKbRAt5+AfUe9A8RgbJXeDZ7fZLbGE9khrBdzX8aoxCltvVwnIZzCI9opHnuwBE= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by BYAPR11MB2632.namprd11.prod.outlook.com (2603:10b6:a02:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24; Thu, 14 May 2020 13:47:44 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f8cb:58cd:e958:fff4]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f8cb:58cd:e958:fff4%6]) with mapi id 15.20.3000.016; Thu, 14 May 2020 13:47:44 +0000 From: "Ananyev, Konstantin" To: Anoob Joseph , Akhil Goyal , "Nicolau, Radu" CC: Narayana Prasad , "dev@dpdk.org" Thread-Topic: [PATCH v4] examples/ipsec-secgw: add per core packet stats Thread-Index: AQHWKU6JIbB7HcgR2UuO5RL8PUuQtainl6Ow Date: Thu, 14 May 2020 13:47:43 +0000 Message-ID: References: <1588769253-10405-1-git-send-email-anoobj@marvell.com> <1589391919-20388-1-git-send-email-anoobj@marvell.com> In-Reply-To: <1589391919-20388-1-git-send-email-anoobj@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.151.164] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9b2579dd-51cc-438e-7d21-08d7f80d60fc x-ms-traffictypediagnostic: BYAPR11MB2632: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:390; x-forefront-prvs: 040359335D x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: A6SlLaGIKIGAwcm8A18XC5Gc2CBnc9ICHMR6tSL8WCgbRK19QxYmrNXc6DVVbBaZnDjG13gYVraBE3emZRl+IyIXYqv5Hc5AyEPoJiNKoqeTGQ5VcK1SzGq1FfioLCUZAwo4a8d6UGEZd6DDghhSY+D2MQpRWCjMv3LYa+fK4BM9rdmkKy8k4XpS68YNy26ihHwblLUD8AIfljq+QRv/HvpXo4RPm97eQdfX6YOvyyGh7rN6pJUcDCtSYjrNv3B3UR9CiyBE93dkCKMlb0rJzZl3B7vlU/zCIJZKrZrC4jw9EpkSH3A7snnDhaXf4CAlOc5TW7b3kRXf8rY0B4SU9xZuSCG2jq3RJTLskne08tYrpqWnPzJ49WM3cN1/0to0z2xIrhLqzWjNxhVCE+8jOW/DhP7eLZYxzM7YijW3APWgjLyY227wlE3VazmWT3Tw x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(366004)(346002)(396003)(376002)(136003)(39860400002)(7696005)(33656002)(76116006)(52536014)(8676002)(66446008)(6506007)(26005)(66946007)(66476007)(55016002)(478600001)(64756008)(8936002)(86362001)(186003)(66556008)(9686003)(71200400001)(4326008)(2906002)(6636002)(110136005)(54906003)(316002)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: dqpWkLNS6RgtqoWqnMAg0xZf50vN8KQ+ASradb3U0F2UrkFqGNmxadFKob3KwtSH6djZkMbHMFUpMM7EYhkft5CwEzyqSDiIF3j9yFwxmv29mJdFcAoY4ofTp0I/zv0xsS0kbbHatW5bKQcJ9YT1SUAaO5+vyBZaBpW5a+MiUnX8cXF7ilo0ZHpwxb2/H+ASblSwyWTUTMkw1jiWhHSKfrW+4OdHXoqg9fGtxbIxLlEY7CCIX7w3pkZn0naM/ld8FqfUq/WtZEVjVpkJZrXxDnUrK7cA9gI/chK4IQ3EdXko0fHE8JPITFJhKn/QMDPkcOX0YzpcmsRx9ZxEkSLt49hz8olj1VZAertbG+HdnMJZHq6981OR7un/MvZPipF7FyDrVIVsQcHBO/agkLceJUev47L/a1gmSM1xz0M901TCiLewprJmb6NDT84e4kmUURODcyQM/fZWQpT1BgeCVKu2Zvb8RgVXkPl0t8icIRPYcwAYUF0t6Th8zQ3rxe32 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9b2579dd-51cc-438e-7d21-08d7f80d60fc X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2020 13:47:43.8789 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Y6o/O94cdy4XZIXwc4NSgPnVzIQhCPn5swBieQ6iEHlk1Srp3d0OdC8MHSCQitOGEVmUc4+OQnIxWDaKVOR6TrTW59qa3KcEZPzu5rv3JTA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2632 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4] examples/ipsec-secgw: add per core packet stats 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" > Adding per core packet handling stats to analyze traffic distribution > when multiple cores are engaged. >=20 > Since aggregating the packet stats across cores would affect > performance, keeping the feature disabled using compile time flags. >=20 > Signed-off-by: Anoob Joseph > --- > v4: > * Moved print stats routine to control thread > * Added stats for rx/tx pkts per call > * Replaced free_pkt(m) with free_pkts(&m, 1) >=20 > v3: > * Added wrapper functions for updating rx, tx & dropped counts > * Updated free_pkts() so that stats is updated internally > * Introduced similar free_pkt() function which updates stats and frees th= e packet > * Moved all inline functions and macros to ipsec-secgw.h > * Made STATS_INTERVAL macro to control the interval of the stats update. > STATS_INTERVAL =3D 0 would disable the feature. >=20 > v2: > * Added lookup failure cases to drop count >=20 > examples/ipsec-secgw/ipsec-secgw.c | 114 ++++++++++++++++++++++++++++-= ------ > examples/ipsec-secgw/ipsec-secgw.h | 66 ++++++++++++++++++++ > examples/ipsec-secgw/ipsec.c | 20 +++--- > examples/ipsec-secgw/ipsec_process.c | 11 +--- > 4 files changed, 170 insertions(+), 41 deletions(-) >=20 > diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ip= sec-secgw.c > index f777ce2..d2b5b2c 100644 > --- a/examples/ipsec-secgw/ipsec-secgw.c > +++ b/examples/ipsec-secgw/ipsec-secgw.c > @@ -47,6 +47,7 @@ > #include > #include > #include > +#include >=20 > #include "event_helper.h" > #include "ipsec.h" > @@ -287,6 +288,70 @@ adjust_ipv6_pktlen(struct rte_mbuf *m, const struct = rte_ipv6_hdr *iph, > } > } >=20 > +#if (STATS_INTERVAL > 0) > + > +/* Print out statistics on packet distribution */ > +static void > +print_stats_cb(__rte_unused void *param) > +{ > + uint64_t total_packets_dropped, total_packets_tx, total_packets_rx; > + float burst_percent, rx_per_call, tx_per_call; > + unsigned int coreid; > + > + total_packets_dropped =3D 0; > + total_packets_tx =3D 0; > + total_packets_rx =3D 0; > + > + const char clr[] =3D { 27, '[', '2', 'J', '\0' }; > + const char topLeft[] =3D { 27, '[', '1', ';', '1', 'H', '\0' }; > + > + /* Clear screen and move to top left */ > + printf("%s%s", clr, topLeft); > + > + printf("\nCore statistics =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D"); > + > + for (coreid =3D 0; coreid < RTE_MAX_LCORE; coreid++) { > + /* skip disabled cores */ > + if (rte_lcore_is_enabled(coreid) =3D=3D 0) > + continue; > + burst_percent =3D (float)(core_statistics[coreid].burst_rx * 100)/ > + core_statistics[coreid].rx; > + rx_per_call =3D (float)(core_statistics[coreid].rx)/ > + core_statistics[coreid].rx_call; As a nit - probably better to use double, and check that divisors are not z= ero. Apart from that - LGTM. Acked-by: Konstantin Ananyev > + tx_per_call =3D (float)(core_statistics[coreid].tx)/ > + core_statistics[coreid].tx_call; > + printf("\nStatistics for core %u ------------------------------" > + "\nPackets received: %20"PRIu64 > + "\nPackets sent: %24"PRIu64 > + "\nPackets dropped: %21"PRIu64 > + "\nBurst percent: %23.2f" > + "\nPackets per Rx call: %17.2f" > + "\nPackets per Tx call: %17.2f", > + coreid, > + core_statistics[coreid].rx, > + core_statistics[coreid].tx, > + core_statistics[coreid].dropped, > + burst_percent, > + rx_per_call, > + tx_per_call); > + > + total_packets_dropped +=3D core_statistics[coreid].dropped; > + total_packets_tx +=3D core_statistics[coreid].tx; > + total_packets_rx +=3D core_statistics[coreid].rx; > + } > + printf("\nAggregate statistics =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" > + "\nTotal packets received: %14"PRIu64 > + "\nTotal packets sent: %18"PRIu64 > + "\nTotal packets dropped: %15"PRIu64, > + total_packets_rx, > + total_packets_tx, > + total_packets_dropped); > + printf("\n=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D\n"); > + > + rte_eal_alarm_set(STATS_INTERVAL * US_PER_S, print_stats_cb, NULL); > +} > +#endif /* STATS_INTERVAL */ > +