From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0076.outbound.protection.outlook.com [65.55.169.76]) by dpdk.org (Postfix) with ESMTP id 2C5BF2E7B for ; Tue, 19 Apr 2016 11:36:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=27A8jyIModorPgQAkQt5PgMVqhciRs4ssBcFPJ0N35c=; b=0WjzR+w07JuBQfMSkAS1AMyjDgA7Vq2BS3d61piM7KRDcKQZF2NKuLnLWJe2KCw//3GNoqSFzLj2eCO15YId2tRbXQ8z+pyNmR+oAKcKl7QibNpDRE2f2/HTXO+VHF4K7HbJE/WNnEr8VhI2cr9YwdUW+oOjV8l1xLIFb+RCukM= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (TLS) id 15.1.453.26; Tue, 19 Apr 2016 09:36:38 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob Date: Tue, 19 Apr 2016 15:05:27 +0530 Message-ID: <1461058528-28435-2-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1461058528-28435-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1461058528-28435-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0049.INDPRD01.PROD.OUTLOOK.COM (10.164.116.149) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 8eaec5c8-086b-4307-32f2-08d368361ca4 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 2:K4ASRAhKvfvthnOm5J8fIcLt36+3bFpW3xZpsCVox1aCBJhK6nmVG8c+pPiE1tseokf+NFKOHLsLPL4ZJRyGOCrsAv2D+TlVBdH6OJAlHgRwJFDSICca3JKzh3W64wg783GPbstCNHB4/5CvDT5sTZVDU2pmVapaPwczRQtgrM6NM2oMt1ZvyvS4nnWUsMyM; 3:iYt1fePWpQ1m8gUPOg5L1TOcnu7wpo810N7cHt450AvSKn55jLmUBPd3bSAC67qJGdgbgOkh44c/kvPZEUsSklbkNLJ894ZgKTsUPprZ39wBX/pR0ayleS/3fUEAgXNo; 25:tHXA/xrHwNWiayDmVO/UKoNE5Z51VHbCHniMkkDNDl2D2e3QtHse8dGJmgqVAcrBERj4oQXEHwOUrZSEV+et4qoxrgJf4RiLn4dNgUua2OHY32C8zHH1UsGM3vtyyTi1Xe94LQ6hSfG4Wt6cfjYccbritCjoMfDBB5QStUJtxnANwo4k3uX2AE0dgEwYfXtnKj/GPlAEFWs2zbyNfiXXWyZQNRtGavl2XOpx3oJtOitYtUqHuBW8qJjr3HLVZ7vKOllRtF4IOdfsqzE/kgZeLhUTbXmGNrZKj5weJ9XfII/GwWqCIu3ydb6u/qrG04f2R0fPHW9g5AR1NcCH9P+VBw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 20:DvZz1sQJOCR1G9NsN1QgT8WCcydWdZy+miDW9lDER8fgQCgaV615k5Jr5vDkNOybLYmVge7wy86xyyf3yjeiQUps1A+W2bx/ZJNPImjBw9wn7PcEp1aW3Ru3LDVZLYLezF6BLrR/snatdlLBJh4yY4qh6AOBqIHajvWP2h5a++1BCMxX8dNR2PCVl4HeDezGV3jg7R7jr8ZhIRlzNiEHA2xW2BTcjQtYYt2w2qEIZrz1fDQZlah02L79nKO3y4GjX8gQiQvcFv29UEMgDkTSbfdlv4UYw2hDh6IxIFONomToYILqBqcx+DsciANUw9sbaRg6XYYXsrdZboSv2IBwOALX4RsyzBwyjgD/R50e8+rT7HpOTl++Dl1irGwB/45b4EoU74GuufVBkOaDj/7jQPN3FR86Aym/fJTWwzw911xvHB7s0nmcvKzyS2kbbTwFdcRqp0UqHja6I+Xo5bnuL4QJ/dI9qlAcytDSEWTZoeNC29Se91nqy4vsZbPIPWIkcZrPIiq3dWtgCjISJFctjV0fbGjBwI5F88zuNTe4+2TYUHN61L5aADaWP/zSGS2KAFqLvEEkPrMXF8pxqf9xyyrO27RJW6Ui7enTVkVZj9Y= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:e8szfW3k9oqcvMSgzfurd1cKfrNlg+WP437n3dqF+gtQ43fgHo8ZbkSv9eSxzt6n2nq2HO2siUTbK/vH5JgLPzNQiVeiFwDe30lMk4NWMqKZU9vp3XHU5YeIkwVeTRa0LKFJcBqkejAVIXUFDMyef5iInHOkJx3qRVJlKzSWPU0h+JFCWZUADyoYH3ZiszjrIoWWZ1aEt8WbxsBtGO+NwZG58W7/wkSwukuC8Fo1rzXZpExyZ912fc4iPv1LIm5yaxAXpOCsCWD/nateAhd2p4tiPWVE731uZvIDN0LwvwGpSG3iUto0wSG2xz37b1lgzaX+1nqjAx6RZl3FGSpHul4wy82UIgV5YiYOJUG+y6/4bDQP8TsIF/j2VEgn5rthroAnE6reMW+dsWnI8E2DVw== X-Forefront-PRVS: 0917DFAC67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(5009440100003)(81166005)(4326007)(36756003)(33646002)(229853001)(50466002)(48376002)(50226001)(2351001)(66066001)(76506005)(53416004)(4001430100002)(92566002)(47776003)(5008740100001)(19580395003)(19580405001)(2906002)(189998001)(3846002)(6116002)(107886002)(110136002)(586003)(86362001)(106356001)(1096002)(42186005)(5003940100001)(76176999)(77096005)(2950100001)(50986999)(5004730100002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:AioO6bnDcakL1jLHGXKuKnn5wj+4d4Urh5odHgg?= =?us-ascii?Q?AdCOs/UExwlXe52Mpg545MA457J2t8QYJKcs/Il3gfiL4DqIM4lfMt2IZvD1?= =?us-ascii?Q?RnMQcm3BY9pAB71tnLy+h/JhRLuKaJnug71BFSyoo+jbkp1vTm9iFzkF4mYO?= =?us-ascii?Q?Oy7K9QZptfhUPk4b1O4TT/9vaslIXibIXKGqLgzwZnYZGXclJlkJja6yQ53J?= =?us-ascii?Q?KINJkVzNHGe2NWNk12pXsyH5Jj9EoWnBBpAU5YcPddA2Cuxe39JvjeTVRieC?= =?us-ascii?Q?fnWMs05nO5m2zH2FgWOTjRAgk5aiWplv+RU1STvVTIwWP1syhO4sxXmd7o7O?= =?us-ascii?Q?JxgU0OjjcRN0nEGClQzwT3pTswY0JvwcxTactzsO02SM8OA1021H5bAxK/It?= =?us-ascii?Q?YOswho8DZhkvfwI5eDHm02+bcbkX+qDTr4PArZQKgOIIy9ZFYQ8mRZZ7+PbO?= =?us-ascii?Q?ZXilxJ+BYs9X3A2jbcU4KtyFKYuQCSYPhYJn3qVKbGuPrxOtCh5a4u+AG5i8?= =?us-ascii?Q?KpUB3Pel4KVDPljwCW89W2Vs9XoRe1JFzLAPxLA7oQFWN4GGnIBEU97Q28+W?= =?us-ascii?Q?BELYbNCHEE8ftoJU1Tj8xapF6z/oBAIsvTgJgx1yXhP7msiL0InD93wpoGDz?= =?us-ascii?Q?XajSsn++AbdpKceEdqobhKwYUESgaqQhDzl5d+NArGsLJLbE03pj9LttOjpO?= =?us-ascii?Q?Eu//3PHCH1R0ugklHjzS3EhnQ/uoR2tVSY9pAdENX5cCXed8qWlIq+BrRSDy?= =?us-ascii?Q?1JZt5Pj7fy2TSDfj6rob8veLfV613+lDmAHMiL07pZVjKBXb7C6YN/KkrFRx?= =?us-ascii?Q?gpa17nPjVaDqPNGLerh8NdS0zfvtvhb9azgvhNZpGv49WjZdRFB5cY7SULY3?= =?us-ascii?Q?dzbu2xZY8fGrQPVZWMkd0z/VXtUU1Bbjm6D0c1ZAXepKDLts/QfnlHq8w9cL?= =?us-ascii?Q?xtzu6VkQF8ZhFK26OYEBK/cDTUudI+y952gQY1CpukLPU6exRwKNKxMakAqd?= =?us-ascii?Q?ZPl4aXT9MJmzZtCqhkrYbufbepXynbGzsw5nE058MTFbMix+AFsIgG+kHSJD?= =?us-ascii?Q?ChCSM5aWDpEbg380+LGeiixZGj5G/?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 5:DL+5qBrWWVK81HIAPB+6ZVSeuFdKvfCangyU0v4jimEN8a7m0BRyJbKvHeEed54bo9d4KLWu17xDS5hKG6HXvIdwUr1GClAwpTzXfeB9T+LK2/ftMmDNcnpMcxVTc0f+ZEVKmDDFtJGCO6dJ5jd51g==; 24:QXzn25VzDK1YL/ELnssW3c2bIUkwT0B3FxDjh8zqq2lA9FPK15oIepcqWfBIQFuHP4BWxjL0KyD7knkhOvHSRHe+cVn+0N9MYlZgPl3+G48= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2016 09:36:38.8979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH 1/2] examples/l2fwd: remove number of cycles per second hardcording X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 09:36:42 -0000 Signed-off-by: Jerin Jacob --- examples/l2fwd/main.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 1ad9488..7bdd1b5 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -134,10 +134,9 @@ struct l2fwd_port_statistics { } __rte_cache_aligned; struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; -/* A tsc-based timer responsible for triggering statistics printout */ -#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */ #define MAX_TIMER_PERIOD 86400 /* 1 day max */ -static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; /* default period is 10 seconds */ +/* A tsc-based timer responsible for triggering statistics printout */ +static uint64_t timer_period = 10; /* default period is 10 seconds */ /* Print out statistics on packets dropped */ static void @@ -274,7 +273,7 @@ l2fwd_main_loop(void) timer_tsc += diff_tsc; /* if timer has reached its timeout */ - if (unlikely(timer_tsc >= (uint64_t) timer_period)) { + if (unlikely(timer_tsc >= timer_period)) { /* do this only on master core */ if (lcore_id == rte_get_master_lcore()) { @@ -381,7 +380,7 @@ l2fwd_parse_timer_period(const char *q_arg) static int l2fwd_parse_args(int argc, char **argv) { - int opt, ret; + int opt, ret, timer_secs; char **argvopt; int option_index; char *prgname = argv[0]; @@ -417,12 +416,13 @@ l2fwd_parse_args(int argc, char **argv) /* timer period */ case 'T': - timer_period = l2fwd_parse_timer_period(optarg) * 1000 * TIMER_MILLISECOND; - if (timer_period < 0) { + timer_secs = l2fwd_parse_timer_period(optarg); + if (timer_secs < 0) { printf("invalid timer period\n"); l2fwd_usage(prgname); return -1; } + timer_period = timer_secs; break; /* long options */ @@ -541,6 +541,9 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n"); + /* convert to number of cycles */ + timer_period *= rte_get_timer_hz(); + /* create the mbuf pool */ l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); -- 2.1.0