All of lore.kernel.org
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Subject: [PATCH v1 1/2] l2fwd: Fix coding standard errors
Date: Wed, 30 Sep 2015 07:18:48 +0100	[thread overview]
Message-ID: <1443593929-1804-2-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1443593929-1804-1-git-send-email-remy.horton@intel.com>

Fixes to l2fwd code that were causing checkpatch.pl to fail.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 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

  reply	other threads:[~2015-09-30  6:18 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30  6:18 [PATCH v1 0/2] User-space ethtool sample application Remy Horton
2015-09-30  6:18 ` Remy Horton [this message]
2015-09-30  6:18 ` [PATCH v1 2/2] " Remy Horton
2015-10-26 15:59 ` [PATCH v2 0/2] " Remy Horton
2015-10-26 15:59   ` [PATCH v2 1/2] example: " Remy Horton
2015-10-26 15:59   ` [PATCH v2 2/2] doc: " Remy Horton
2015-10-28 11:12   ` [PATCH v3 0/2] " Remy Horton
2015-10-28 11:12     ` [PATCH v3 1/2] example: add user-space " Remy Horton
2015-10-28 11:12     ` [PATCH v3 2/2] doc: add user-space ethtool sample app guide Remy Horton
2015-10-28 13:52     ` [PATCH v3 0/2] User-space ethtool sample application Ananyev, Konstantin
2015-10-29 12:11     ` [PATCH v4 " Remy Horton
2015-10-29 12:11       ` [PATCH v4 1/2] example: add user-space " Remy Horton
2015-10-29 12:11       ` [PATCH v4 2/2] doc: add user-space ethtool sample app guide Remy Horton
2015-10-29 14:14       ` [PATCH v5 0/2] User-space ethtool sample application Remy Horton
2015-10-29 14:14         ` [PATCH v5 1/2] example: add user-space " Remy Horton
2015-10-29 14:14         ` [PATCH v5 2/2] doc: add user-space ethtool sample app guide Remy Horton
2015-10-29 14:19         ` [PATCH v5 0/2] User-space ethtool sample application Ananyev, Konstantin
2015-11-06 16:11         ` [PATCH v6 " Remy Horton
2015-11-06 16:11           ` [PATCH v6 1/2] example: add user-space " Remy Horton
2015-11-06 16:11           ` [PATCH v6 2/2] doc: add user-space ethtool sample app guide Remy Horton
2015-11-13 16:52             ` Mcnamara, John
2015-11-16 10:56               ` Remy Horton
2015-11-06 16:38           ` [PATCH v6 0/2] User-space ethtool sample application Ananyev, Konstantin
2015-11-16 13:30           ` [PATCH v7 " Remy Horton
2015-11-16 13:30             ` [PATCH v7 1/2] example: add user-space " Remy Horton
2015-11-16 13:30             ` [PATCH v7 2/2] doc: add user-space ethtool sample app guide Remy Horton
2015-11-16 13:42             ` [PATCH v8 0/2] User-space ethtool sample application Remy Horton
2015-11-16 13:42               ` [PATCH v8 1/2] example: add user-space " Remy Horton
2015-11-16 13:42               ` [PATCH v8 2/2] doc: add user-space ethtool sample app guide Remy Horton
2015-11-16 14:16                 ` Mcnamara, John
2015-11-16 13:50               ` [PATCH v8 0/2] User-space ethtool sample application Thomas Monjalon
2015-11-20 15:34               ` [PATCH v9 0/3] " Remy Horton
2015-11-20 15:34                 ` [PATCH v9 1/3] Remove ABI requirement for external library builds Remy Horton
     [not found]                   ` <2601191342CEEE43887BDE71AB97725836ACAB5A@irsmsx105.ger.corp.intel.com>
2015-11-20 16:32                     ` Wang, Liang-min
2015-11-20 15:34                 ` [PATCH v9 2/3] example: add user-space ethtool sample application Remy Horton
2015-11-20 17:15                   ` Ananyev, Konstantin
2015-12-07  2:29                   ` Thomas Monjalon
2015-12-07 11:54                     ` Remy Horton
2015-11-20 15:34                 ` [PATCH v9 3/3] doc: add user-space ethtool sample app guide Remy Horton
2015-11-20 17:16                   ` Ananyev, Konstantin
2015-12-01 12:05                     ` Mcnamara, John
2015-11-24  3:05                 ` [PATCH v9 0/3] User-space ethtool sample application Liu, Yong
2015-12-07 13:48                 ` [PATCH v10 0/4] " Remy Horton
2015-12-07 13:48                   ` [PATCH v10 1/4] Remove ABI requirement for external library builds Remy Horton
2015-12-07 13:48                   ` [PATCH v10 2/4] mk: Fix missing directory with combined extlib build Remy Horton
2015-12-08  0:49                     ` Thomas Monjalon
2015-12-07 13:48                   ` [PATCH v10 3/4] example: add user-space ethtool sample application Remy Horton
2015-12-07 13:49                   ` [PATCH v10 4/4] doc: add user-space ethtool sample app guide Remy Horton
2015-12-08  0:30                     ` Thomas Monjalon
2015-12-08  0:33                   ` [PATCH v10 0/4] User-space ethtool sample application Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443593929-1804-2-git-send-email-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.