From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by dpdk.org (Postfix) with ESMTP id 33AEB1B46D for ; Wed, 11 Jul 2018 08:08:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VGQoASB3h4xiHsXJsx7zUGKaGa19P6Llsjc5XRlpg/c=; b=VGYsgm4x5EZHbL4BXewAV4UzLmIlGMs8Ty837LNoSv1eoELexrO1cPtwkzNAlA7Ze0UufImoGOwsIVB4NjZyjJvpw6k8VyDrf2jcAJa61GSBKZxvC2qy8+LWc6RKaVuPjfxkLL+seeWx7TNBdUAdKTc1oPviqzvUEZtubQ6KDQw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anoob.Joseph@cavium.com; Received: from ajoseph83.caveonetworks.com.caveonetworks.com (115.113.156.2) by BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Wed, 11 Jul 2018 06:08:04 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Wed, 11 Jul 2018 11:37:19 +0530 Message-Id: <1531289248-20025-4-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531289248-20025-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> <1531289248-20025-1-git-send-email-anoob.joseph@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0027.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::13) To BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bae1a8d5-d9be-44fa-adb0-08d5e6f4ab22 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4898; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 3:V1ux87tqyllOzkbdevrSUfyyYS5AwHn4qLAqx/cYCdo0qdOfgPQDmGI8PAA4WeL0a8a8kR912Casp+sg98zG+TkvoMFYtZDeBQlp33BwHscsh/rPBMQuxfMehJES43jBT5LqcmWuMtMdPxF6HyaKmgDjY2q/9EPXl6b7qq3EmU4spnNW9cE8H5/f0ENSG/lQPgXjxTIxCA7Xwj2bD9C5qtFNGqqjR2v12DuYujRBgVkBtsMAsPAvm3MFkVYP4evG; 25:/I/DMjqLiVhb7clFi+80K2e2tguzmVluSGWpq3MUgYSgDm5b2Sf2EpFLJXaOOFc+UjLbL6ABvDyL4CEBdAViA3yyojLZrpuy/qY1kJj9FMPiWPcLY/e5PTMFNiJ5y3TPk1kSPO6V0AWnE4I7QY7H6vCYn5B0rE2lFl3nprLIEk8hpExiL+cvLoqD/NwIm1JU6mj/KpSjzt2Td33fGEd4+u6Dsomf2AvNehncebpMyRgHfz7z4HFhi4zrahwTkvJ6CV9u3jlzPmD/VSSFesQXepwp1F9ztHHMT3DBbAdgcDiRT1mfJK0ZYAK6wKqhFO0c/wYrDcuVWJOadSDf0Xa5HA==; 31:oGz01M3V9BZFGazqEZvTvH7M5SXmikixS8q8SKLfjERE+WSMijW8Lo5CRmHDsszeV2nePaHxuo1o+CxyLrfBpwkZNLSKEn+d9Zay3y+Nn3zq8yTftontCAeVKeQ2637W7Ha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aHw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(10201501046)(93006095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4898; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4898; X-Forefront-PRVS: 0730093765 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(366004)(396003)(189003)(199004)(68736007)(81166006)(8676002)(81156014)(44832011)(50466002)(6666003)(25786009)(6512007)(7736002)(4326008)(6486002)(48376002)(8936002)(2906002)(3846002)(478600001)(72206003)(305945005)(6116002)(486006)(16586007)(2616005)(54906003)(110136005)(316002)(36756003)(476003)(956004)(446003)(11346002)(47776003)(26005)(42882007)(52116002)(105586002)(186003)(76176011)(16526019)(66066001)(106356001)(51416003)(97736004)(6506007)(55236004)(50226002)(53936002)(5660300001)(386003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4898; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN7PR07MB4898; 23:G0jTG+ch+vOjfqqxV5Vf3kkITCPRtipyYbSqB0TEl?= =?us-ascii?Q?CDDBkEkq6gsg/g6l+T/JJ1IU7bgaiD8nGDebYPsO3ulEuhun1XGgeQ4obHbw?= =?us-ascii?Q?v7/bAjT52JEL6llxOaf1fT9+S/JAGbmz1mDXBwfZ2pVbGm4EMxwIrdbmoLUT?= =?us-ascii?Q?U6o1lcob6MC5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QwBiWsoP00Wk5dCTgvjj3hxI6FrKh68C9Tb5EGaCuqKXFzCAl9L1BoXO09E5ubWAzIgyD57Gkge5Q==; 5:Xb4gKfYZy0IfWv43iHeWw5XGiTv43olqvrpacVWZ9bo/Ye+GChh+GjD2ziUtEOUgUXf8PFcd1uvEcadMjfRZW5PJJbwJV2dH4orqWNu19xvSBHeksMy8c3krM1owfyJqyxBTq3cWGIGLyGUGl1AFjvEXNU6d3kWLDtCxABGlwfA=; 24:HyHW2D5iDm3d/9rb3Zh7j5Qtr0qiX1srwrJCD7FVTdG8pfTgViGmUNx6CZj+TfHO0H797CW340O/0/1pCy0Qp7LdNikyLS4db6/dmBf0P8c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:2XGE7QpO9/X+3BvMMJdH/9Fjv0gG//fPWIITmlG47ly2MNdyQpYToVP9gWQNSUGWYkEElpgH8b9Dpr+ww8agoIUbFQkf6/5VGHRgKuUD/fJcDbon1Mx9YLepDdc6g1lfl2n+I2B7Hi0D8R7Z0vg7diO6dBReZ/Cx588pFtJMdoCSVrNNDzpNisqxFP0LcCvaZf8W8wtM3iBh/3jqxIIzfilQcYHX/tgiAPe1Ag5Q3xdkEqI3m2XKKVHuilG8dBr8 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2018 06:08:04.1835 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bae1a8d5-d9be-44fa-adb0-08d5e6f4ab22 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR07MB4898 Subject: [dpdk-dev] [PATCH v2 03/12] examples/l2fwd: move globally accessed vars to common header 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: Wed, 11 Jul 2018 06:08:07 -0000 Signed-off-by: Anoob Joseph --- v2: * No change v1: * No change examples/l2fwd/l2fwd_common.h | 26 ++++++++++++++++++++++++++ examples/l2fwd/main.c | 41 +++++++++++++++++------------------------ 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/examples/l2fwd/l2fwd_common.h b/examples/l2fwd/l2fwd_common.h index ca82e29..dd9f268 100644 --- a/examples/l2fwd/l2fwd_common.h +++ b/examples/l2fwd/l2fwd_common.h @@ -5,6 +5,10 @@ #ifndef _L2FWD_COMMON_H_ #define _L2FWD_COMMON_H_ +#include + +#include + #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 #define MAX_PKT_BURST 32 @@ -34,4 +38,26 @@ struct l2fwd_port_statistics { uint64_t dropped; } __rte_cache_aligned; +volatile bool force_quit; + +int mac_updating; + +/* ethernet addresses of ports */ +struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; + +/* mask of enabled ports */ +uint32_t l2fwd_enabled_port_mask; + +/* list of enabled ports */ +uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS]; + +struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE]; + +struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; + +struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; + +/* A tsc-based timer responsible for triggering statistics printout */ +uint64_t timer_period; + #endif /* _L2FWD_COMMON_H_ */ diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 11ca170..a6089a1 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -41,29 +41,11 @@ #include "l2fwd_common.h" -static volatile bool force_quit; - -/* MAC updating enabled by default */ -static int mac_updating = 1; - static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; -/* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; - -/* mask of enabled ports */ -static uint32_t l2fwd_enabled_port_mask = 0; - -/* list of enabled ports */ -static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS]; - static unsigned int l2fwd_rx_queue_per_lcore = 1; -struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE]; - -static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; - static struct rte_eth_conf port_conf = { .rxmode = { .split_hdr_size = 0, @@ -77,11 +59,6 @@ static struct rte_eth_conf port_conf = { struct rte_mempool * l2fwd_pktmbuf_pool = NULL; -struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; - -/* 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 print_stats(void) @@ -489,6 +466,20 @@ signal_handler(int signum) } } +static void +l2fwd_init_global_vars(void) +{ + force_quit = false; + + /* MAC updating enabled by default */ + mac_updating = 1; + + /* Default period is 10 seconds */ + timer_period = 10; + + l2fwd_enabled_port_mask = 0; +} + int main(int argc, char **argv) { @@ -502,6 +493,9 @@ main(int argc, char **argv) unsigned int nb_lcores = 0; unsigned int nb_mbufs; + /* Set default values for global vars */ + l2fwd_init_global_vars(); + /* init EAL */ ret = rte_eal_init(argc, argv); if (ret < 0) @@ -509,7 +503,6 @@ main(int argc, char **argv) argc -= ret; argv += ret; - force_quit = false; signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); -- 2.7.4