From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0060.outbound.protection.outlook.com [104.47.34.60]) by dpdk.org (Postfix) with ESMTP id 94F7B1CDF0 for ; Fri, 8 Jun 2018 19:10:30 +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=UF/qoI72TBjnH4XwaVN04/xhPtoDXTRtcgLmvEmnyKo=; b=cMknDrcLyqzZ4Z6mIi8Oe334MaHI7H2HHoigumZdNR0YGgfn1/PXdwWCKIKuePisygycgfRRshyNj9Dm2pmTwwanht2N5krz6QWH5fbeD5uDkC5es0uQ0fz6eNPBY9sDzt5IDESPZgVwbDgddmYVaUnKV8ILPmYuZ47EWxN5QKU= 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 SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.15; Fri, 8 Jun 2018 17:10:26 +0000 From: Anoob Joseph To: Bruce Richardson , Pablo de Lara Cc: Anoob Joseph , Jerin Jacob , Narayana Prasad , dev@dpdk.org Date: Fri, 8 Jun 2018 22:39:15 +0530 Message-Id: <1528477766-15788-5-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-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: BM1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::27) To SN6PR07MB4911.namprd07.prod.outlook.com (2603:10b6:805:3c::29) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN6PR07MB4911; X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 3:gDW7ucTxEsvN2A3mRnq89UQE23c/D8jWKyX5sA4fWV9KIsCAtgKdwpvu3l7K/Qa9XSCIUdR+Tq9gTsGwIG259H0xc9+ltn8isBh5RqH58OxWPZKzCGLe8Yl1tIGZgFprBRXvQ87YmV+LzWD2ebXUZGITCoMeLt8asmajf9CPmaT3d44GEoDQABqjEf7rp/d9Hm06gEBjFY5NnzzETMvHOg9TQ1iMzEpk2ucS0fJewvPHc59TymQfbPQ9l2F4hwRN; 25:mp+u+Yn4mlJPUsuoOsAvZaknheqpAYDwF6JpkBbeTkhHG7r7TPa8dSvw+9XNiDjiidH4IQ9kx1TGVNsAis3DJ3TVf7ApkAVlE99kb8HV1cUbtJ3xK7ZhBaQ+opYmaRoo/7dw6gD5UHxkUTgi/CK2QfNJf3YGwuTHZb7PDIjDJcZQ+AJ5MzfwxNtlxPiTxWd0D/2UH6T5ETZGvDr49hlGxDnUESpz8i7aLOwYabJhhhm1eYh5SyZeLv3R9A0k2jBpUzPbKHpYfqBP5Ye9zDDIJSBvG7iUi/LIWoHSUIw4tvbZN1LwC4MAzywV+eapjZ5Rck+xbCJ3h7s81ELNNWrlMQ==; 31:KwDe3qRmhdCcYkTaI/aI+UDJMJ87cZ25vuTGKGrbrRBemWzfmxUSjW5O1YBv33v6IeUtnKQOajWVXgyETmrtSFofWratd+93pqhnKdEfeGxSKbBazur+YClNMb+LB4AhhN0Fo2QpRMuDp/bwpu9DZRVD+zbj+hEcYw1g2diRbg0vkQcN70h1XS87xpExKWr9kVekpkN8kv8tMLrrG3aOtAQDNR2ftLIh+32T6wYtLmI= X-MS-TrafficTypeDiagnostic: SN6PR07MB4911: X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 20:lV4t36Ac+N561S1bhYXpxPU0aOk/cASFyWpsXHunYAw7EMHeLMZGmCwoWuTDXrh/wAwG7dpv2LhyKadgVsr/g2KDRwHTJeyshGz9kA6J8M61y25ck7FUniyrH1bXBOE2nl9DRpEV6jFUZCXbWUSJu/AWcaM+BUu8rwbqY9pLWNuYgkDkS6T1Zkm0e7A1Oa0sBXRYgj2g2W3d+U2+dv0WGLo9QWoUDBvUkxVAKhwHgMkHYMwGynkZkHz0s/cY6UZ/+9CZMf+RBNWcWWdS1KoYJh4EBnuaeUtrrOlOIook4JVkE+kDODbqa+Glbj9gcyfitzDPyExbHue5GXdzpog0m36XtfE0+nP42xBSOf3IKrNzKHZC+fkZovuTqdjTXvSSO/hw8FThfl2ocugxq9Kq0MW8NInrcU81eW5rJBLXODD6r100Pj4mG53jh+0slDuI6VMgaa1yPcRj1uW69nsUlAwpwlAxQspNVkr1NRfUdO5HplYX+e7Nuz0cXKlzzHg2gKoHYEr6jTnK4uWBp1L5p8+EcDwFMTm2eL3ESxuMB83elc4MIqwQxwfnOZtMxAYd9zBvktJvJjXl4/PeUTBEXGy7aZvchsjILce4S4h080g=; 4:E8k1WNDjy3dcuBcJPN48RazmfXnWAuFzocMYxYSYPFu5ISplyZriO+/Te5GzVhZbtL0uW7FKBybzcaOlQx5gPYQz8oLrvR/YhZSzAi3N7ErANJBHWmd0awghl+5jnpe8lDaEkPvHnyM5ac5HYj5S1RCnNmqL3N0jr8YlyWLaaNO0jGbellCIHypi1YVBKYN/PdCSSe4dP+Lnqj8NMiW5aX/ZVL3AkHyoBsv6B4RxUOr1eGKYaXXgDU699VT9LHayc9FhRHNT2Y/hQ1CAntXtfA== 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)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:SN6PR07MB4911; BCL:0; PCL:0; RULEID:; SRVR:SN6PR07MB4911; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39380400002)(39860400002)(376002)(396003)(346002)(199004)(189003)(6666003)(4326008)(54906003)(76176011)(5660300001)(25786009)(48376002)(50466002)(446003)(386003)(186003)(11346002)(16526019)(2616005)(42882007)(44832011)(51416003)(476003)(66066001)(110136005)(36756003)(316002)(55236004)(2906002)(7736002)(81156014)(81166006)(8936002)(50226002)(106356001)(105586002)(68736007)(52116002)(26005)(956004)(8676002)(305945005)(53936002)(6512007)(47776003)(486006)(478600001)(6486002)(6116002)(72206003)(3846002)(16586007)(6506007)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR07MB4911; H:ajoseph83.caveonetworks.com.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN6PR07MB4911; 23:OSX2h/lqMQy18q4x65Y3qYVKYxFrOw4g7XZE/ALlJ?= =?us-ascii?Q?qxSrRkci13hNHxXem9qKZUQBYO/B6/7jxENx9Ox2HtY2A1TTI8rVofAi7vQV?= =?us-ascii?Q?DCiIEQqHH/oeG7AUXdr6xf+yZumpY82jv7u8jV/wFMKqlNkJ/LLJqKgGOcOS?= =?us-ascii?Q?AmRrLOxDchEYXX5FGJIMTkl65zCMKjjutfMhxNRHBZkB8reY8cZW92jVb16A?= =?us-ascii?Q?EXG0b37HyTZCk5X+urAnEOiE4v6jljDWiO39FEm3U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Hd1N5Px0ss=; 24:jF+hpSzDhPhk4tFGavOzI4zeS3wgYqa9TEWGREA84WBrNS4RrU69/fNoydEjfR2RBYrXIS1NIQ6EppuvZQS/f9Rli98AgL+RSl0NEjW3lN4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN6PR07MB4911; 7:FdjgI4E16ZC05wlrLNiSCvSQXfqsvL8l2WxGHUegYoiY4HOd6u/hsDI1Qfm7hMQi1N/ZzAzywfdh11Qoo2Ci5NDBdJNLB1IRfnOMnoTssDibTxnK3uN7Z7HCn+eSr91ZBQ03FMYMahOhJsYZ2fHJiCVbOQiv3sN8B137g6W09YsOZnNhZTISc1XkmSDaX0QXXP2zEYJWl+ljGYMcFXwQH1eFJfid7wz/Ql133wP7NqVCxlmbHWYYf5XhY9TQXn5D X-MS-Office365-Filtering-Correlation-Id: 0befa1a7-192a-40cd-68b1-08d5cd62bbeb X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 17:10:26.3943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0befa1a7-192a-40cd-68b1-08d5cd62bbeb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4911 Subject: [dpdk-dev] [PATCH 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: Fri, 08 Jun 2018 17:10:32 -0000 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 40979fd..3e940e1 100644 --- a/examples/l2fwd/l2fwd_common.h +++ b/examples/l2fwd/l2fwd_common.h @@ -4,6 +4,10 @@ #ifndef _L2FWD_COMMON_H_ #define _L2FWD_COMMON_H_ +#include + +#include + #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 #define MAX_PKT_BURST 32 @@ -33,4 +37,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