From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690074.outbound.protection.outlook.com [40.107.69.74]) by dpdk.org (Postfix) with ESMTP id D5E441E968 for ; Thu, 14 Jun 2018 12:19:02 +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=HHgbcpjGrPEE9B28MZbxfsbncp21Cp7/5LyHU5jyf58=; b=MGap9x4M+xLdGm+l4tU/HHn73GnatMA7vl6fsMkCihjsNG4cK4tcn1sD0HgT00u8T3D8gggfZN1Zqwyt7k0RGmra18bl5wWqqTG+rzCnZ1qoW3Q1Apptw4jRLYQ19xI6mQPLOuxSqqqG4XP8Gf6ZAcAm2saGqpouQpjjBK+xVFA= 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 BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.19; Thu, 14 Jun 2018 10:18:58 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Thu, 14 Jun 2018 15:47:46 +0530 Message-Id: <1528971477-14156-5-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528971477-14156-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528971477-14156-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: BM1PR0101CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:1a::17) To BYAPR07MB4902.namprd07.prod.outlook.com (2603:10b6:a02:ef::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 775eb2fa-0aa0-4af8-fa87-08d5d1e03f90 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BYAPR07MB4902; X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 3:qJpj9bIBci3oj0L59mQYOOIsISSGLlsSu5tt1PX0vsOBY6CsbbvwRH2QBlZ7nmVy1xY/TMqhqyFNXlvHz+Ldat1IdGkqfxy7m8U0a2jn6fXZ+XQ0GYMUIv6ik0ASL3jko1/H9KBu8oweqQjUrChCFuCfZizgke1LwQduEZAxjcUa8PvMEv+MkyfhdN8VHOVpuQ6WZL9mxfvP8Bh/VWCKgXYebFpCNKe4s4pdsMbxzlAvTWQYRWfpYXs6ec1Kze1d; 25:vpHeFOPUWqT/g94ncnQqEsh4Szx8HXFfPs/mlypjBR7CZHAm5xBZ9E8OKvAE8BZLiIGSV8XigKDCecJjkI71uqJ1VAErWbDXzyJYcOcgCVMDCe3oBI7BRts6gNfp23D1DsSAHgAjiVX4yVa+iwk37DojdF5pdX6KBuquX6ExuC+GcP1X0LLucleEXhsDSp+Wf6e73hTluUaNwZNXKmYe6i42qU8i7icsOhK9rcUKy6eQ9LuVSgTlOSyk2j2/Gf0Jt7FtfoA3sdfga7XEXXN8amO1pZFmMbiv0DfVQ771zTrpo9qKYOU/hpYqjo278UyVHsczVeAkNf8koZH/Y9Td3w==; 31:atbG+btJt1Wa/uhzk/PlUbEYCSw5nVXvpOU55uELemtmGnAzkLu5Ch75P1FEEOztoRVWecDA3a0gSPYEXIQLj3arAJckpxG85Uk9/gqzogW4L5FSKe1TRU7PguyoOan3Qg6a4bx6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HuWu74qUxVEHYa3xDw== 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)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:BYAPR07MB4902; BCL:0; PCL:0; RULEID:; SRVR:BYAPR07MB4902; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39860400002)(39380400002)(376002)(396003)(366004)(189003)(199004)(316002)(6666003)(110136005)(68736007)(2906002)(66066001)(54906003)(47776003)(6512007)(5660300001)(50466002)(72206003)(48376002)(97736004)(6116002)(3846002)(53936002)(16586007)(105586002)(478600001)(6486002)(106356001)(6506007)(36756003)(11346002)(956004)(25786009)(4326008)(50226002)(16526019)(186003)(81156014)(486006)(81166006)(8676002)(7736002)(26005)(8936002)(2616005)(476003)(386003)(44832011)(55236004)(52116002)(42882007)(51416003)(76176011)(446003)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR07MB4902; 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; BYAPR07MB4902; 23:JYQLeZQrYw8jYtUHnHIY/weyeCsFKcspaij3BB8ph?= =?us-ascii?Q?GW7y1Wo/tykucvx8/ABRJkD8dhZBysH+gbUCrGmLYvJKGYlc3egt2xCBOBFT?= =?us-ascii?Q?X2EqULogg3U1jZTru+N2QKOIwLQc9oHGpVNpqy5sRf/P54ibeP3RW9SQGlJi?= =?us-ascii?Q?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wwEc5uYVQkIb+scnpHRj?= =?us-ascii?Q?1LomqOOZiwziadfZ2BPp+8M0j3D+ra3VEonTCnrYiu+pSCYr8VBo/L7+Nhmh?= =?us-ascii?Q?8Cn8o4gWaIw/Hzh00ZqJQVoZZR6T7SF5LBkcjRnpKsOVpKIjriuba91LsQzq?= =?us-ascii?Q?463fna13S6/CSK/N5z4hGS7/A3knu6ocMmq3u4i54PkO/wnhJj6o+8gHKr7S?= =?us-ascii?Q?UbP198AdCghjNETad1xgZC9rlvC/z1cGnPSerHN?= X-Microsoft-Antispam-Message-Info: CtL4ijrDnkY7JE4in9ktKFSK+Wf4MFPFW9vWTnZEYTTbKQFM1DRIUbnQPNYe6Iu0MuRaodSZye0jRbnHFu2DTzjdPTxTpAluNZb3xa6M65WMV9tzBlRtHdLIHTj+LD9288GRifhn2xMnlliMYoyl2NDWC4/zqqLGCyRIO3RBICihxAhj5lgpDAxDN4ildfIx X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 6:6LMXjouqJOEHbXkyvJlg/1Qdt07GKmPm6Y47U5d05MGyGoRTZzyQwBnaH8L5gvDbxSwbtCaQVjIAdEl5wCMjO3FlfPwnDUehwQNoildV0VIthP5TOBGlVGuYUXNrnF35xT1ug+0nYBfG/8Pr1zi47nxuikgI/WNZbJ+spK1X7j6M1pnY4UjUKwzHB6T8FoZQ6bNINr83FT9B8a9daE/DBznakCqJpgqvGqLuHyxb0DUu0rcqlZzzVEMuX7yG8ita99fbrJYaRT7tcj48GUF+IrD/WinwYYX5WoSIKFiiq9XcptM5xXRZT3kIq19cxUkGPJ5QvTTkz0vODIA90eJFzB8/kFev4+maL0jMfFQlaaYzoEMj9O5T9IR376h96y78IPQtJKJjUX/s6w0EaveI6CRvUnfMAKdPcNwgX7ROKL8M8RzVZj3EKztw15u1wwbZhgH0aNuikxviT+/Xlev08A==; 5:jlRfUwbTzalbfXOyf67I7dLodWLNftGjrwh5MlCQ0Po5fmdzsoB6NNGZZisWmQ9kFaUSZMj4/M1BnDOX/DLFXACaGK79RctLo5QGvayKT4iZMLdN178f8MUArcDEqRsPGmxYhqXZQiXCeflNtBTg7qZanoleh7Ys8Ij0Jak5wvg=; 24:qpjUqrhS69neR/kBiEtRdwKGFKqlZGLEamctjSxFIaSW5i0oF0DLaUI3WUI75Calfv1Sv+t94ygkNGMnzUb+MiIPCJ/WBIqsIy0E2N6hoew= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR07MB4902; 7:pJh6ECB80AK57jhD5ynF/kj95H0YI8SmN6CbajvYjQ+5OK3/OpOmsEidJdqHZ9epC3cdYEtZ1HGvAGZ/HSXFtbPPCx6A7KG9CMd5aXuiqyhEp2v+i2Fq1OZOY/PNLnlo2xTN+gLSJ+UxIkigX/m8o92HGn12mooIJCPVmiKsDEtNg/BlhEBm8nwNjJTMy2Q/huPJniLRJio0TYxIsZJTibEPYHarN04X8w83eQcyW87tJ7xAPYei5ySczIsstcAC X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 10:18:58.8932 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 775eb2fa-0aa0-4af8-fa87-08d5d1e03f90 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4902 Subject: [dpdk-dev] [PATCH v1 04/15] 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: Thu, 14 Jun 2018 10:19:03 -0000 v1: * No change Signed-off-by: Anoob Joseph --- 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