From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id EFF758D91 for ; Wed, 30 Sep 2015 08:18:55 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 29 Sep 2015 23:18:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,611,1437462000"; d="scan'208";a="816032260" Received: from rhorton-mobl.ger.corp.intel.com (HELO localhost.ir.intel.com) ([163.33.229.80]) by orsmga002.jf.intel.com with ESMTP; 29 Sep 2015 23:18:54 -0700 From: Remy Horton To: dev@dpdk.org Date: Wed, 30 Sep 2015 07:18:48 +0100 Message-Id: <1443593929-1804-2-git-send-email-remy.horton@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1443593929-1804-1-git-send-email-remy.horton@intel.com> References: <1443593929-1804-1-git-send-email-remy.horton@intel.com> Subject: [dpdk-dev] [PATCH v1 1/2] l2fwd: Fix coding standard errors 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: Wed, 30 Sep 2015 06:18:56 -0000 Fixes to l2fwd code that were causing checkpatch.pl to fail. Fixes: af75078fece3 ("first public release") Signed-off-by: Remy Horton --- examples/l2fwd/main.c | 53 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 720fd5a..2f0841d 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -1,8 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. + * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -88,7 +87,7 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ -static uint32_t l2fwd_enabled_port_mask = 0; +static uint32_t l2fwd_enabled_port_mask; /* list of enabled ports */ static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS]; @@ -124,7 +123,7 @@ static const struct rte_eth_conf port_conf = { }, }; -struct rte_mempool * l2fwd_pktmbuf_pool = NULL; +struct rte_mempool *l2fwd_pktmbuf_pool = NULL; /* Per-port statistics struct */ struct l2fwd_port_statistics { @@ -139,6 +138,7 @@ struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; #define MAX_TIMER_PERIOD 86400 /* 1 day max */ static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; /* default period is 10 seconds */ + /* Print out statistics on packets dropped */ static void print_stats(void) @@ -151,7 +151,7 @@ print_stats(void) total_packets_rx = 0; const char clr[] = { 27, '[', '2', 'J', '\0' }; - const char topLeft[] = { 27, '[', '1', ';', '1', 'H','\0' }; + const char topLeft[] = { 27, '[', '1', ';', '1', 'H', '\0'}; /* Clear screen and move to top left */ printf("%s%s", clr, topLeft); @@ -191,7 +191,7 @@ l2fwd_send_burst(struct lcore_queue_conf *qconf, unsigned n, uint8_t port) { struct rte_mbuf **m_table; unsigned ret; - unsigned queueid =0; + unsigned queueid = 0; m_table = (struct rte_mbuf **)qconf->tx_mbufs[port].m_table; @@ -261,7 +261,8 @@ l2fwd_main_loop(void) uint64_t prev_tsc, diff_tsc, cur_tsc, timer_tsc; unsigned i, j, portid, nb_rx; struct lcore_queue_conf *qconf; - const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; + const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / + US_PER_S * BURST_TX_DRAIN_US; prev_tsc = 0; timer_tsc = 0; @@ -357,7 +358,7 @@ l2fwd_usage(const char *prgname) printf("%s [EAL options] -- -p PORTMASK [-q NQ]\n" " -p PORTMASK: hexadecimal bitmask of ports to configure\n" " -q NQ: number of queue (=ports) per lcore (default is 1)\n" - " -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n", + " -T PERIOD: statistics will be refreshed each PERIOD seconds (0 to disable, 10 default, 86400 maximum)\n", prgname); } @@ -534,6 +535,7 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) } } + int main(int argc, char **argv) { @@ -546,6 +548,8 @@ main(int argc, char **argv) unsigned lcore_id, rx_lcore_id; unsigned nb_ports_in_mask = 0; + l2fwd_enabled_port_mask = 0; + /* init EAL */ ret = rte_eal_init(argc, argv); if (ret < 0) @@ -587,8 +591,7 @@ main(int argc, char **argv) if (nb_ports_in_mask % 2) { l2fwd_dst_ports[portid] = last_port; l2fwd_dst_ports[last_port] = portid; - } - else + } else last_port = portid; nb_ports_in_mask++; @@ -624,7 +627,9 @@ main(int argc, char **argv) qconf->rx_port_list[qconf->n_rx_port] = portid; qconf->n_rx_port++; - printf("Lcore %u: RX port %u\n", rx_lcore_id, (unsigned) portid); + printf("Lcore %u: RX port %u\n", + rx_lcore_id, (unsigned) portid + ); } nb_ports_available = nb_ports; @@ -633,7 +638,8 @@ main(int argc, char **argv) for (portid = 0; portid < nb_ports; portid++) { /* skip ports that are not enabled */ if ((l2fwd_enabled_port_mask & (1 << portid)) == 0) { - printf("Skipping disabled port %u\n", (unsigned) portid); + printf("Skipping disabled port %u\n", + (unsigned) portid); nb_ports_available--; continue; } @@ -642,10 +648,11 @@ main(int argc, char **argv) fflush(stdout); ret = rte_eth_dev_configure(portid, 1, 1, &port_conf); if (ret < 0) - rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n", - ret, (unsigned) portid); + rte_exit(EXIT_FAILURE, + "Cannot configure device: err=%d, port=%u\n", + ret, (unsigned) portid); - rte_eth_macaddr_get(portid,&l2fwd_ports_eth_addr[portid]); + rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]); /* init one RX queue */ fflush(stdout); @@ -654,7 +661,8 @@ main(int argc, char **argv) NULL, l2fwd_pktmbuf_pool); if (ret < 0) - rte_exit(EXIT_FAILURE, "rte_eth_rx_queue_setup:err=%d, port=%u\n", + rte_exit(EXIT_FAILURE, + "rte_eth_rx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); /* init one TX queue on each port */ @@ -663,20 +671,21 @@ main(int argc, char **argv) rte_eth_dev_socket_id(portid), NULL); if (ret < 0) - rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup:err=%d, port=%u\n", + rte_exit(EXIT_FAILURE, + "rte_eth_tx_queue_setup:err=%d, port=%u\n", ret, (unsigned) portid); /* Start device */ ret = rte_eth_dev_start(portid); if (ret < 0) - rte_exit(EXIT_FAILURE, "rte_eth_dev_start:err=%d, port=%u\n", - ret, (unsigned) portid); - - printf("done: \n"); + rte_exit(EXIT_FAILURE, + "rte_eth_dev_start:err=%d, port=%u\n", + ret, (unsigned) portid); rte_eth_promiscuous_enable(portid); - printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", + printf("Port %u," + " MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", (unsigned) portid, l2fwd_ports_eth_addr[portid].addr_bytes[0], l2fwd_ports_eth_addr[portid].addr_bytes[1], -- 1.9.3