From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0068.outbound.protection.outlook.com [104.47.38.68]) by dpdk.org (Postfix) with ESMTP id 961B71DF21 for ; Thu, 14 Jun 2018 13:50:06 +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=mi9tUuG2T1L5m5t+BcU31x3aIOley/wN1skpCjGZHT0=; b=UevydOqwPwArEV3fmtG9hNO4alHN7RODi+eOr27ILmyPjC5XhT2ceWcqTaeA9vVS5lRqz2VxVnGtZxkB78hwvJtNNM6i2sdbfWVLOADAJ47VgDdrqxa5+hQxqO1DVDMZzJn3pL7bcl1cbvf2A6ucegZo04XNsQBC+7t6NRgya80= 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.863.16; Thu, 14 Jun 2018 11:50:04 +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 17:18:55 +0530 Message-Id: <1528976946-14396-5-git-send-email-anoob.joseph@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528976946-14396-1-git-send-email-anoob.joseph@caviumnetworks.com> References: <1528477766-15788-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528976946-14396-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: PN1PR01CA0095.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00::11) To BN7PR07MB4898.namprd07.prod.outlook.com (2603:10b6:406:ef::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81d9ad4a-a87b-4a21-844e-08d5d1ecf8b1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN7PR07MB4898; X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 3:bA6nsNYgeUXP83tQHJJGgSSa9Tfnr/pp0gAaTe6tbugmNODscS2MtO5vnrscYmvwIVlJwcdFLi2bCOd+Q1F5JPP0eY/lpfJhKO9X0Y6+mfIMz8mI2Va/jUy6zAd9lGephZ82CpfbPBCFFylgs/jFwEZHIzxXENTquLgStscT9l4KOTIe5lUtJ/RVX20jxILS47lxzKF4A5AkniLTOdS8AC61nPWQuV1YE7Vc+9Q9xNTqbCtpew5uZwwaYZWjIGFj; 25:bUuoSe+W0Dn/Y4dJWvkEg4C9JPGdxcPW25TMbA5JjHyNRTxnF+TqqrQzdywDb8NxN9Jztq9XQL8Jn1+0jEpCOQmm/HbzfBpkbQdK34PoEr9wfrYocZG9yc3sGjEgOB6xTJye0Mcz338G9+d2/Hxd+1AZyAskTsw+3wzqbdtUc48kvI3EuTu5LsXpaCP2sF25M5XT4r15MXNxbiZU4aZrwbdFwN8U4Wo9VwgLA1R1mSMIT6QBO4zUd5KcHqHRKPOeetYuUo0CjzAyWuU7wOOOp5V9g0M9xLIKfXGNcqR/+CTpwPy6/s/5X5uu25ERPqOC8GN5vRr4AGdIi0HhVf6YRg==; 31:BAi4ea2dK40El3ayVYDM+aIuveavwFK9CD7TuESaaoIk1+RMDCO7Jv3hvErB8HZzvkH56CEX+OZm/XLarcynlbhnVVpEG5T/7JIjr9d4HgM6GPTz6e6Um43HmDPUr6o9sDrOgeYI10dbmy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ispam-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)(10201501046)(3231254)(944501410)(52105095)(93006095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:BN7PR07MB4898; BCL:0; PCL:0; RULEID:; SRVR:BN7PR07MB4898; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(376002)(346002)(366004)(199004)(189003)(446003)(956004)(2616005)(305945005)(6666003)(47776003)(476003)(54906003)(44832011)(53936002)(68736007)(486006)(110136005)(8936002)(8676002)(81156014)(16586007)(316002)(81166006)(25786009)(4326008)(7736002)(6116002)(3846002)(11346002)(97736004)(36756003)(106356001)(478600001)(105586002)(42882007)(52116002)(51416003)(26005)(16526019)(186003)(50226002)(66066001)(72206003)(6486002)(2906002)(55236004)(50466002)(6512007)(386003)(6506007)(5660300001)(76176011)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR07MB4898; 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; BN7PR07MB4898; 23:Tvhy4YTM6rv75GTeCE2w1IxBcaFF11+BW8AFX3yxF?= =?us-ascii?Q?efKclsOenbkefcNqtUxF6fdeZFwTg9EgXi8D62w1OivWjxb62Gl1/RmM6Kz5?= =?us-ascii?Q?sF1aHKCdUFm2xTMXICRfZyqowxw/IwQLBRaBkdd/0mmFDlWtdKRu3nmQZIPu?= =?us-ascii?Q?WDPz4ugKVmyapMKS2ke+kSwhVdc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?Q?ll5fUqx/yWHaPo2jNbjB734Uxf7XJXDY7rMlI2rzboLmQKvVZvtMsZpGNK5c?= =?us-ascii?Q?MFpLsNgOe81J68GKUcWzGN2XR6SkD5jYfLKuB2tzd5izOW/poBgyPyR3QkbY?= =?us-ascii?Q?jiBu1sdaBOWxUu5gcgobTMzP2dKL5ojGpLd60isDQXQ2VWdj4D5CxMpBNE9y?= =?us-ascii?Q?HJDVkGjZpTgCuboSLchRgsQm9SlFSOXbdWQXFyY?= X-Microsoft-Antispam-Message-Info: e0SlcGHwNrsI3Lxd3I+BSyt0a545cHt5K8op7HlRfNZ9zUPgMZaoQYnr2gAxJFlWz4NdA6IClS2fdVwuY9yZij6/nYOoITSZK1pevdlru8TIS1zdOXnM8hxT5sUE85ajnucalN6HgbEd2rqC4x+LxSBycFc0rwPniNcMcMd0xzEIGNQE+WxyOJr9NEx4Ir5U X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 6:TWfuOGMEcQLxYIKrSETX3IFNYyn/k02o+7gvgYqt/HMH15pejAIelrf+84AsjfGG5l/EuRJXy767P0BIfjkygGgz3NKuqcDchHr8YYqvTad67sGNgYKT/51icOuYAkRnNkbK/vfReGKJx13RsBw1LUhQHPyulyEqeqpbH8ntNdaA8nC2dmxC7fl5fLVDBDetj6/KbS5M0+LV0eLP7nM1bOn6ENznPZ9wCPTI9CvkA26p3U2+g86s9Ggl1VzDvPlxn+KKJIJvQ/I8XpQN/so3dKFzh6kPzlrLugRFVQEWPtL3g+C2qSVgYHzXWW2aDXI9yLsBLEU5Qc0mUnYUKzxpGPmeGGjDPGESlT7lImsoJrnkBkHFg525dkd7FnlobzMds9YgNQAFKLhbor70XyCHRUZojn2nOJQ6bdfw2jqcesf1p6kGL56sLw6+DrmVsPbKzEHx8BEvERWpuaHLbeoeag==; 5:tRC7dsAbcvKaieiDWoq5luEJyvce0SuYdb++Gh78EV7jpZsIiY1q+35JPA26ngWvn6IRfxyF75MrVcod7mBcyQ1BlFE55RAtdqiNZPor5/H6EGwNK0R1PdJ2/qyhPVybNPVsqZ/zisOU+iiNFnCUgGNOdnLetvgA0DjDOdjh7wY=; 24:jRyYQceh7Ixo7+QMWnSnNo0Pusz4TxwsP16K/VwHUuuhJYatg3NJn96nLAsnJPY3by3Np1tsMJiKQsmVKWr8BfegRGU14Pt3tfYaKVoc6js= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN7PR07MB4898; 7:g0w5rqc8vBqwEHuLsU39me2UkLhRHk0hX5RQUvEuR8RkrXWVIckrstnjYxuORP31CZK+nJYvG7t8OfhIddAEBOxGSDRIUERv5H86rSxivKFjcWtXnUYsTZiNsxoIEt4HS/Vl+gwiwabKmDWNB/9OJ6HwMm3ChTcbfxdXPpBovKIs/C3tWBi4etiM1oEby9FSgghRHYldSKZO4qVgwT0SVZxlKmb7fqyJTiwKxdBXOyxr2klhJmexQ1BDXMyjgc9c X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 11:50:04.0281 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81d9ad4a-a87b-4a21-844e-08d5d1ecf8b1 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 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 11:50:07 -0000 Signed-off-by: Anoob Joseph --- 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