Skip to contentSkip to conversation

whitespace around keywords

PATCH Superseded Stephen Hemminger 4 participants 52 messages Nov 9, 2022 – Nov 11, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

cover whitespace around keywords

The DPDK standard now enforced through checkpatch is to use a space after keywords. Much of the older code that was grandfathered in doesn't follow that, so fix it.

No urgency to this patchset, and it might just be viewed as churn. But I prefer to read code that looks all the same.

“A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. He may as well concern himself with his shadow on the wall." -- Ralph Waldo Emerson

Stephen Hemminger (14):
eal: fix whitespace
cmdline: fix whitespace
timer: fix whitespace
ip_frag: fix whitespace
testpmd: fix whitspace
test: fix whitespace
examples/qos_sched: fix whitespace
examples/vhost: fix whitespace
l3fwd: fix whitespace
examples: fix whitespace
bus/pci: fix whitespace
net/e1000: fix whitespace
net/i40e: fix whitespace
net/bnx2x: fix whitespace

 app/test-pmd/cmdline.c                     | 30 +++++++++++-----------
 app/test-pmd/parameters.c                  |  8 +++---
 app/test-pmd/testpmd.c                     |  2 +-
 app/test/test_cmdline_cirbuf.c             |  4 +--
 app/test/test_debug.c                      |  4 +--
 app/test/test_hash.c                       |  8 +++---
 app/test/test_lpm6_perf.c                  |  2 +-
 app/test/test_malloc.c                     | 14 +++++-----
 app/test/test_mbuf.c                       | 12 ++++-----
 app/test/test_spinlock.c                   |  2 +-
 drivers/bus/pci/bsd/pci.c                  |  2 +-
 drivers/net/bnx2x/bnx2x.h                  |  2 +-
 drivers/net/e1000/em_ethdev.c              |  4 +--
 drivers/net/e1000/igb_ethdev.c             |  8 +++---
 drivers/net/i40e/i40e_pf.c                 |  8 +++---
 examples/cmdline/parse_obj_list.c          |  2 +-
 examples/ip_reassembly/main.c              |  2 +-
 examples/l3fwd-power/main.c                |  6 ++---
 examples/l3fwd/main.c                      |  6 ++---
 examples/multi_process/symmetric_mp/main.c |  6 ++---
 examples/qos_sched/app_thread.c            |  6 ++---
 examples/qos_sched/args.c                  |  2 +-
 examples/qos_sched/init.c                  |  2 +-
 examples/qos_sched/main.c                  |  4 +--
 examples/vhost/main.c                      |  6 ++---
 lib/cmdline/cmdline_parse_string.c         | 10 ++++----
 lib/cmdline/cmdline_rdline.c               |  6 ++---
 lib/eal/linux/eal_hugepage_info.c          |  6 ++---
 lib/eal/linux/eal_interrupts.c             |  2 +-
 lib/ip_frag/rte_ipv4_reassembly.c          |  2 +-
 lib/timer/rte_timer.c                      |  2 +-
 31 files changed, 90 insertions(+), 90 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/14 eal: fix whitespace

Add space after keywords.

---
 lib/eal/linux/eal_hugepage_info.c | 6 +++---
 lib/eal/linux/eal_interrupts.c    | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
lib/eal/linux/eal_hugepage_info.c +3 -3
index a1b6cb31ff1a..b6d751a2ee97 100644
@@ -180,8 +180,8 @@ get_default_hp_size(void)
 	FILE *fd = fopen(proc_meminfo, "r");
 	if (fd == NULL)
 		rte_panic("Cannot open %s\n", proc_meminfo);
-	while(fgets(buffer, sizeof(buffer), fd)){
-		if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0){
+	while (fgets(buffer, sizeof(buffer), fd)) {
+		if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0) {
 			size = rte_str_to_size(&buffer[hugepagesz_len]);
 			break;
 		}
@@ -231,7 +231,7 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len)
 	if (default_size == 0)
 		default_size = get_default_hp_size();
 
-	while (fgets(buf, sizeof(buf), fd)){
+	while (fgets(buf, sizeof(buf), fd)) {
 		const char *pagesz_str;
 
 		if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX,
lib/eal/linux/eal_interrupts.c +1 -1
index d52ec8eb4cd7..3be1b090be9e 100644
@@ -1073,7 +1073,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
 	struct epoll_event events[totalfds];
 	int nfds = 0;
 
-	for(;;) {
+	for (;;) {
 		nfds = epoll_wait(pfd, events, totalfds,
 			EAL_INTR_EPOLL_WAIT_FOREVER);
 		/* epoll_wait fail */
Signature · 1 line
2.35.1
#2 lore raw

PATCH 2/14 cmdline: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.
Remove unnecessary spaces in if expressions.

---
 lib/cmdline/cmdline_parse_string.c | 10 +++++-----
 lib/cmdline/cmdline_rdline.c       |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
lib/cmdline/cmdline_parse_string.c +5 -5
index d756638905a2..0b53d0c800cc 100644
@@ -77,16 +77,16 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 				continue;
 			}
 
-			if ( strncmp(buf, str, token_len) ) {
+			if (strncmp(buf, str, token_len)) {
 				continue;
 			}
 
-			if ( !cmdline_isendoftoken(*(buf+token_len)) ) {
+			if (!cmdline_isendoftoken(*(buf+token_len))) {
 				continue;
 			}
 
 			break;
-		} while ( (str = get_next_token(str)) != NULL );
+		} while ( (str = get_next_token(str)) != NULL);
 
 		if (!str)
 			return -1;
@@ -108,7 +108,7 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	/* unspecified string (unknown single token) */
 	else {
 		token_len = 0;
-		while(!cmdline_isendoftoken(buf[token_len]) &&
+		while (!cmdline_isendoftoken(buf[token_len]) &&
 		      token_len < (STR_TOKEN_SIZE-1))
 			token_len++;
 
@@ -149,7 +149,7 @@ int cmdline_complete_get_nb_string(cmdline_parse_token_hdr_t *tk)
 		return 0;
 
 	str = sd->str;
-	while( (str = get_next_token(str)) != NULL ) {
+	while ((str = get_next_token(str)) != NULL) {
 		ret++;
 	}
 	return ret;
lib/cmdline/cmdline_rdline.c +3 -3
index 5cf723a0126a..28fc54cdfebf 100644
@@ -301,7 +301,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* delete 1 char from the left */
 		case CMDLINE_KEY_BKSPACE:
 		case CMDLINE_KEY_BKSPACE2:
-			if(!cirbuf_del_tail_safe(&rdl->left)) {
+			if (!cirbuf_del_tail_safe(&rdl->left)) {
 				rdline_puts(rdl, vt100_bs);
 				display_right_buffer(rdl, 1);
 			}
@@ -354,7 +354,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* paste contents of kill buffer to the left side of caret */
 		case CMDLINE_KEY_CTRL_Y:
 			i=0;
-			while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
+			while (CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
 			      RDLINE_BUF_SIZE &&
 			      i < rdl->kill_size) {
 				cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
@@ -404,7 +404,7 @@ rdline_char_in(struct rdline *rdl, char c)
 				/* add chars */
 				if (ret == RDLINE_RES_COMPLETE) {
 					i=0;
-					while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
+					while (CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
 					      RDLINE_BUF_SIZE &&
 					      i < tmp_size) {
 						cirbuf_add_tail(&rdl->left, tmp_buf[i]);
Signature · 1 line
2.35.1
#3 lore raw

PATCH 3/14 timer: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 lib/timer/rte_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/timer/rte_timer.c +1 -1
index 85d67573eb9e..9eb73f1fed13 100644
@@ -350,7 +350,7 @@ timer_get_prev_entries(uint64_t time_val, unsigned tim_lcore,
 {
 	unsigned lvl = priv_timer[tim_lcore].curr_skiplist_depth;
 	prev[lvl] = &priv_timer[tim_lcore].pending_head;
-	while(lvl != 0) {
+	while (lvl != 0) {
 		lvl--;
 		prev[lvl] = prev[lvl+1];
 		while (prev[lvl]->sl_next[lvl] &&
Signature · 1 line
2.35.1
#4 lore raw

PATCH 4/14 ip_frag: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 lib/ip_frag/rte_ipv4_reassembly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ip_frag/rte_ipv4_reassembly.c +1 -1
index 4a89a5f5365a..88ee0aa63f62 100644
@@ -34,7 +34,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp)
 		for (i = n; i != IP_FIRST_FRAG_IDX && ofs != first_len; i--) {
 
 			/* previous fragment found. */
-			if(fp->frags[i].ofs + fp->frags[i].len == ofs) {
+			if (fp->frags[i].ofs + fp->frags[i].len == ofs) {
 
 				RTE_ASSERT(curr_idx != i);
 
Signature · 1 line
2.35.1
#5 lore raw

PATCH 5/14 testpmd: fix whitspace

In reply to Stephen Hemminger

Add space after keywords.

---
 app/test-pmd/cmdline.c    | 30 +++++++++++++++---------------
 app/test-pmd/parameters.c |  8 ++++----
 app/test-pmd/testpmd.c    |  2 +-
 3 files changed, 20 insertions(+), 20 deletions(-)
app/test-pmd/cmdline.c +15 -15
index 8dc60e938830..ff1fd1b470af 100644
@@ -2730,11 +2730,11 @@ parse_reta_config(const char *str,
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		if ((p0 = strchr(p,')')) == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -3242,15 +3242,15 @@ cmd_config_thresh_parsed(void *parsed_result,
 
 	if (!strcmp(res->name, "txpt"))
 		tx_pthresh = res->value;
-	else if(!strcmp(res->name, "txht"))
+	else if (!strcmp(res->name, "txht"))
 		tx_hthresh = res->value;
-	else if(!strcmp(res->name, "txwt"))
+	else if (!strcmp(res->name, "txwt"))
 		tx_wthresh = res->value;
-	else if(!strcmp(res->name, "rxpt"))
+	else if (!strcmp(res->name, "rxpt"))
 		rx_pthresh = res->value;
-	else if(!strcmp(res->name, "rxht"))
+	else if (!strcmp(res->name, "rxht"))
 		rx_hthresh = res->value;
-	else if(!strcmp(res->name, "rxwt"))
+	else if (!strcmp(res->name, "rxwt"))
 		rx_wthresh = res->value;
 	else {
 		fprintf(stderr, "Unknown parameter\n");
@@ -4088,8 +4088,8 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	len = strnlen(str, STR_TOKEN_SIZE);
 	i = 0;
 	/* Get port_id first */
-	while(i < len){
-		if(str[i] == ',')
+	while (i < len){
+		if (str[i] == ',')
 			break;
 
 		i++;
@@ -4097,7 +4097,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	str[i]='\0';
 	tmp = strtoul(str, NULL, 0);
 	/* If port_id greater that what portid_t can represent, return */
-	if(tmp >= RTE_MAX_ETHPORTS)
+	if (tmp >= RTE_MAX_ETHPORTS)
 		return;
 	port_id = (portid_t)tmp;
 
@@ -4108,17 +4108,17 @@ cmd_vlan_offload_parsed(void *parsed_result,
 
 	if (!strcmp(res->what, "strip"))
 		rx_vlan_strip_set(port_id,  on);
-	else if(!strcmp(res->what, "stripq")){
+	else if (!strcmp(res->what, "stripq")){
 		uint16_t queue_id = 0;
 
 		/* No queue_id, return */
-		if(i + 1 >= len) {
+		if (i + 1 >= len) {
 			fprintf(stderr, "must specify (port,queue_id)\n");
 			return;
 		}
 		tmp = strtoul(str + i + 1, NULL, 0);
 		/* If queue_id greater that what 16-bits can represent, return */
-		if(tmp > 0xffff)
+		if (tmp > 0xffff)
 			return;
 
 		queue_id = (uint16_t)tmp;
@@ -7207,7 +7207,7 @@ static void cmd_mac_addr_parsed(void *parsed_result,
 		ret = rte_eth_dev_mac_addr_remove(res->port_num, &res->address);
 
 	/* check the return value and print it if is < 0 */
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
@@ -7780,7 +7780,7 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
 						res->vf_num);
 #endif
 
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
app/test-pmd/parameters.c +4 -4
index aed4cdcb8485..b7372e025ffd 100644
@@ -306,11 +306,11 @@ parse_portnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		if ((p0 = strchr(p,')')) == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -366,11 +366,11 @@ parse_ringnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		if ((p0 = strchr(p,')')) == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
app/test-pmd/testpmd.c +1 -1
index aa7ea29f15ba..04b078a2938b 100644
@@ -2406,7 +2406,7 @@ start_packet_forwarding(int with_tx_first)
 
 	test_done = 0;
 
-	if(!no_flush_rx)
+	if (!no_flush_rx)
 		flush_fwd_rx_queues();
 
 	rxtx_config_display();
Signature · 1 line
2.35.1
#6 lore raw

PATCH 6/14 test: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 app/test/test_cmdline_cirbuf.c |  4 ++--
 app/test/test_debug.c          |  4 ++--
 app/test/test_hash.c           |  8 ++++----
 app/test/test_lpm6_perf.c      |  2 +-
 app/test/test_malloc.c         | 14 +++++++-------
 app/test/test_mbuf.c           | 12 ++++++------
 app/test/test_spinlock.c       |  2 +-
 7 files changed, 23 insertions(+), 23 deletions(-)
app/test/test_cmdline_cirbuf.c +2 -2
index 8ac326cb02e0..6f7aae6df59a 100644
@@ -708,7 +708,7 @@ test_cirbuf_char_fill(void)
 		return -1;
 	}
 	/* delete buffer from tail */
-	for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
+	for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
 		cirbuf_del_tail_safe(&cb);
 	/* try to delete from an empty buffer */
 	if (cirbuf_del_tail_safe(&cb) >= 0) {
@@ -737,7 +737,7 @@ test_cirbuf_char_fill(void)
 		return -1;
 	}
 	/* delete buffer from head */
-	for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
+	for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
 		cirbuf_del_head_safe(&cb);
 	/* try to delete from an empty buffer */
 	if (cirbuf_del_head_safe(&cb) >= 0) {
app/test/test_debug.c +2 -2
index 2704f5b92726..c66748019d9f 100644
@@ -53,7 +53,7 @@ test_panic(void)
 		return -1;
 	}
 	wait(&status);
-	if(status == 0){
+	if (status == 0){
 		printf("Child process terminated normally!\n");
 		return -1;
 	} else
@@ -84,7 +84,7 @@ test_exit_val(int exit_val)
 	}
 	wait(&status);
 	printf("Child process status: %d\n", status);
-	if(!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val){
+	if (!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val){
 		printf("Child process terminated with incorrect status (expected = %d)!\n",
 				exit_val);
 		return -1;
app/test/test_hash.c +4 -4
index 3e45afaa67fc..5e0618f0c340 100644
@@ -72,7 +72,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,
 		rte_free(g_qsv);					\
 		return -1;						\
 	}								\
-} while (0)
+} while(0)
 
 /*
  * 5-tuple key type.
@@ -724,12 +724,12 @@ static int test_five_keys(void)
 	}
 
 	/* Lookup */
-	for(i = 0; i < 5; i++)
+	for (i = 0; i < 5; i++)
 		key_array[i] = &keys[i];
 
 	ret = rte_hash_lookup_bulk(handle, &key_array[0], 5, (int32_t *)pos);
-	if(ret == 0)
-		for(i = 0; i < 5; i++) {
+	if (ret == 0)
+		for (i = 0; i < 5; i++) {
 			print_key_info("Lkp", key_array[i], pos[i]);
 			RETURN_IF_ERROR(pos[i] != expected_pos[i],
 					"failed to find key (pos[%u]=%d)", i, pos[i]);
app/test/test_lpm6_perf.c +1 -1
index aaf2773b6fac..2f9321345e4b 100644
@@ -47,7 +47,7 @@ print_route_distribution(const struct rules_tbl_entry *table, uint32_t n)
 	printf("--------------------------- \n");
 
 	/* Count depths. */
-	for(i = 1; i <= 128; i++) {
+	for (i = 1; i <= 128; i++) {
 		unsigned depth_counter = 0;
 		double percent_hits;
 
app/test/test_malloc.c +7 -7
index de40e506113a..0bb18c8cf7aa 100644
@@ -86,8 +86,8 @@ test_align_overlap_per_lcore(__rte_unused void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
-			if( *(char *)p1 != 0) {
+		for (j = 0; j < 1000 ; j++) {
+			if ( *(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero the allocated memory\n");
 				ret = -1;
 			}
@@ -157,8 +157,8 @@ test_reordered_free_per_lcore(__rte_unused void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
-			if( *(char *)p1 != 0) {
+		for (j = 0; j < 1000 ; j++) {
+			if ( *(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero the allocated memory\n");
 				ret = -1;
 			}
@@ -331,12 +331,12 @@ test_multi_alloc_statistics(void)
 	/* After freeing both allocations check stats return to original */
 	rte_malloc_get_socket_stats(socket, &post_stats);
 
-	if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
+	if (second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
 		printf("Incorrect heap statistics: Total size \n");
 		return -1;
 	}
 	/* Check allocated size is equal to two additions plus overhead */
-	if(second_stats.heap_allocsz_bytes !=
+	if (second_stats.heap_allocsz_bytes !=
 			size + overhead + first_stats.heap_allocsz_bytes) {
 		printf("Incorrect heap statistics: Allocated size \n");
 		return -1;
@@ -495,7 +495,7 @@ test_realloc_socket(int socket)
 		return -1;
 	}
 	/* calc an alignment we don't already have */
-	while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
+	while (RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
 		new_align *= 2;
 	char *ptr8 = rte_realloc_socket(ptr7, size7, new_align, socket);
 	if (!ptr8){
app/test/test_mbuf.c +6 -6
index 53fe898a384c..d505fd25e022 100644
@@ -120,7 +120,7 @@ static unsigned refcnt_lcore[RTE_MAX_LCORE];
 		printf("mbuf test FAILED (l.%d): <" str ">\n",		\
 		       __LINE__,  ##__VA_ARGS__);			\
 		goto fail;						\
-} while(0)
+} while (0)
 
 /*
  * test data manipulation in mbuf with non-ascii data
@@ -154,7 +154,7 @@ test_pktmbuf_with_non_ascii_data(struct rte_mempool *pktmbuf_pool)
 	return 0;
 
 fail:
-	if(m) {
+	if (m) {
 		rte_pktmbuf_free(m);
 	}
 	return -1;
@@ -701,12 +701,12 @@ test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool)
 	}
 	struct rte_mbuf *extra = NULL;
 	extra = rte_pktmbuf_alloc(pktmbuf_pool);
-	if(extra != NULL) {
+	if (extra != NULL) {
 		printf("Error pool not empty");
 		ret = -1;
 	}
 	extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
-	if(extra != NULL) {
+	if (extra != NULL) {
 		printf("Error pool not empty");
 		ret = -1;
 	}
@@ -966,7 +966,7 @@ test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool)
 			struct rte_mbuf *mb, *mt;
 
 			mb = m[i];
-			while(mb != NULL) {
+			while (mb != NULL) {
 				mt = mb;
 				mb = mb->next;
 				rte_pktmbuf_free_seg(mt);
@@ -1195,7 +1195,7 @@ verify_mbuf_check_panics(struct rte_mbuf *buf)
 		return -1;
 	}
 	wait(&status);
-	if(status == 0)
+	if (status == 0)
 		return -1;
 
 	return 0;
app/test/test_spinlock.c +1 -1
index 3f59372300c3..3ee82fa963a5 100644
@@ -237,7 +237,7 @@ test_spinlock(void)
 	/*
 	 * Try to acquire a lock that we already own
 	 */
-	if(!rte_spinlock_recursive_trylock(&slr)) {
+	if (!rte_spinlock_recursive_trylock(&slr)) {
 		printf("rte_spinlock_recursive_trylock failed on a lock that "
 		       "we already own\n");
 		ret = -1;
Signature · 1 line
2.35.1
#7 lore raw

PATCH 7/14 examples/qos_sched: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/qos_sched/app_thread.c | 6 +++---
 examples/qos_sched/args.c       | 2 +-
 examples/qos_sched/init.c       | 2 +-
 examples/qos_sched/main.c       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
examples/qos_sched/app_thread.c +3 -3
index dbc878b55394..a49356fecf5f 100644
@@ -79,7 +79,7 @@ app_rx_thread(struct thread_conf **confs)
 		if (likely(nb_rx != 0)) {
 			APP_STATS_ADD(conf->stat.nb_rx, nb_rx);
 
-			for(i = 0; i < nb_rx; i++) {
+			for (i = 0; i < nb_rx; i++) {
 				get_pkt_sched(rx_mbufs[i],
 						&subport, &pipe, &traffic_class, &queue, &color);
 				rte_sched_port_pkt_write(conf->sched_port,
@@ -91,7 +91,7 @@ app_rx_thread(struct thread_conf **confs)
 
 			if (unlikely(rte_ring_sp_enqueue_bulk(conf->rx_ring,
 					(void **)rx_mbufs, nb_rx, NULL) == 0)) {
-				for(i = 0; i < nb_rx; i++) {
+				for (i = 0; i < nb_rx; i++) {
 					rte_pktmbuf_free(rx_mbufs[i]);
 
 					APP_STATS_ADD(conf->stat.nb_drop, 1);
@@ -137,7 +137,7 @@ app_send_packets(struct thread_conf *qconf, struct rte_mbuf **mbufs, uint32_t nb
 	uint32_t i, len;
 
 	len = qconf->n_mbufs;
-	for(i = 0; i < nb_pkt; i++) {
+	for (i = 0; i < nb_pkt; i++) {
 		qconf->m_table[len] = mbufs[i];
 		len++;
 		/* enough pkts to be sent */
examples/qos_sched/args.c +1 -1
index b2959499ae9a..b752eb221f7c 100644
@@ -451,7 +451,7 @@ app_parse_args(int argc, char **argv)
 	/* sanity check for cores assignment */
 	nb_lcores = app_cpu_core_count();
 
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		if (qos_conf[i].rx_core >= nb_lcores) {
 			RTE_LOG(ERR, APP, "pfc %u: invalid RX lcore index %u\n", i + 1,
 					qos_conf[i].rx_core);
examples/qos_sched/init.c +1 -1
index 0709aec10c31..41b46b296298 100644
@@ -323,7 +323,7 @@ int app_init(void)
 		rte_exit(EXIT_FAILURE, "Invalid configuration profile\n");
 
 	/* Initialize each active flow */
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		uint32_t socket = rte_lcore_to_socket_id(qos_conf[i].rx_core);
 		struct rte_ring *ring;
 
examples/qos_sched/main.c +2 -2
index dc6a17a6464a..7b757df0eb02 100644
@@ -152,7 +152,7 @@ app_stat(void)
 	static struct rte_eth_stats tx_stats[MAX_DATA_STREAMS];
 
 	/* print statistics */
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		struct flow_conf *flow = &qos_conf[i];
 
 		rte_eth_stats_get(flow->rx_port, &stats);
@@ -212,7 +212,7 @@ main(int argc, char **argv)
 	}
 	else {
 		/* print statistics every second */
-		while(1) {
+		while (1) {
 			sleep(1);
 			app_stat();
 		}
Signature · 1 line
2.35.1
Acked-by on v1 7/14
#8 lore raw

RE: [PATCH 07/14] examples/qos_sched: fix whitespace

Quoted 12 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Wednesday, November 9, 2022 7:15 PM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Dumitrescu, Cristian <[email protected]>
Subject: [PATCH 07/14] examples/qos_sched: fix whitespace

Add space after keywords.

Quoted 8 lines
---
 examples/qos_sched/app_thread.c | 6 +++---
 examples/qos_sched/args.c       | 2 +-
 examples/qos_sched/init.c       | 2 +-
 examples/qos_sched/main.c       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
#9 lore raw

PATCH 8/14 examples/vhost: fix whitespace

In reply to Stephen Hemminger

Add space after keywords

---
 examples/vhost/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
examples/vhost/main.c +3 -3
index 42e53a0f9a4f..cabc8682346c 100644
@@ -1491,7 +1491,7 @@ switch_worker(void *arg __rte_unused)
 		}
 	}
 
-	while(1) {
+	while (1) {
 		drain_mbuf_table(tx_q);
 		drain_vhost_table();
 		/*
@@ -1583,7 +1583,7 @@ destroy_device(int vid)
 		return;
 	/*set the remove flag. */
 	vdev->remove = 1;
-	while(vdev->ready != DEVICE_SAFE_REMOVE) {
+	while (vdev->ready != DEVICE_SAFE_REMOVE) {
 		rte_pause();
 	}
 
@@ -1816,7 +1816,7 @@ print_stats(__rte_unused void *arg)
 	const char clr[] = { 27, '[', '2', 'J', '\0' };
 	const char top_left[] = { 27, '[', '1', ';', '1', 'H','\0' };
 
-	while(1) {
+	while (1) {
 		sleep(enable_stats);
 
 		/* Clear screen and move to top left */
Signature · 1 line
2.35.1
#10 lore raw

PATCH 9/14 l3fwd: fix whitespace

In reply to Stephen Hemminger

Add space after keywoords

---
 examples/l3fwd-power/main.c | 6 +++---
 examples/l3fwd/main.c       | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
examples/l3fwd-power/main.c +3 -3
index fd3ade330f82..b2270e1056c8 100644
@@ -1787,11 +1787,11 @@ parse_config(const char *q_arg)
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		if ((p0 = strchr(p,')')) == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -2946,7 +2946,7 @@ main(int argc, char **argv)
 		fflush(stdout);
 
 		/* init RX queues */
-		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
examples/l3fwd/main.c +3 -3
index 5198ff30dd00..2e1c4939f992 100644
@@ -516,11 +516,11 @@ parse_config(const char *q_arg)
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		if ((p0 = strchr(p,')')) == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -1366,7 +1366,7 @@ l3fwd_poll_resource_setup(void)
 		printf("\nInitializing rx queues on lcore %u ... ", lcore_id );
 		fflush(stdout);
 		/* init RX queues */
-		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
Signature · 1 line
2.35.1
#11 lore raw

PATCH 10/14 examples: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/cmdline/parse_obj_list.c          | 2 +-
 examples/ip_reassembly/main.c              | 2 +-
 examples/multi_process/symmetric_mp/main.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
examples/cmdline/parse_obj_list.c +1 -1
index 959bcd14527e..759072d39620 100644
@@ -42,7 +42,7 @@ parse_obj_list(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	if (res && ressize < sizeof(struct object *))
 		return -1;
 
-	while(!cmdline_isendoftoken(buf[token_len]))
+	while (!cmdline_isendoftoken(buf[token_len]))
 		token_len++;
 
 	SLIST_FOREACH(o, tkd->list, next) {
examples/ip_reassembly/main.c +1 -1
index bd0b1d31decf..7e84b4944759 100644
@@ -300,7 +300,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port)
 
 	TX_LCORE_STAT_UPDATE(&qconf->tx_stat, queue, 1);
 	txmb->m_table[txmb->head] = m;
-	if(++txmb->head == len)
+	if (++txmb->head == len)
 		txmb->head = 0;
 
 	return 0;
examples/multi_process/symmetric_mp/main.c +3 -3
index 1ff85875dfdf..9c5348bd36ed 100644
@@ -156,7 +156,7 @@ smp_parse_args(int argc, char **argv)
 
 	/* get the port numbers from the port mask */
 	RTE_ETH_FOREACH_DEV(i)
-		if(port_mask & (1 << i))
+		if (port_mask & (1 << i))
 			ports[num_ports++] = (uint8_t)i;
 
 	ret = optind-1;
@@ -470,8 +470,8 @@ main(int argc, char **argv)
 	/* Primary instance initialized. 8< */
 	if (num_ports & 1)
 		rte_exit(EXIT_FAILURE, "Application must use an even number of ports\n");
-	for(i = 0; i < num_ports; i++){
-		if(proc_type == RTE_PROC_PRIMARY)
+	for (i = 0; i < num_ports; i++){
+		if (proc_type == RTE_PROC_PRIMARY)
 			if (smp_port_init(ports[i], mp, (uint16_t)num_procs) < 0)
 				rte_exit(EXIT_FAILURE, "Error initialising ports\n");
 	}
Signature · 1 line
2.35.1
#12 lore raw

PATCH 11/14 bus/pci: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/bus/pci/bsd/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/pci/bsd/pci.c +1 -1
index 7459d15c7e31..056e2eda2d5f 100644
@@ -368,7 +368,7 @@ rte_pci_scan(void)
 		}
 
 		dev_count += conf_io.num_matches;
-	} while(conf_io.status == PCI_GETCONF_MORE_DEVS);
+	} while (conf_io.status == PCI_GETCONF_MORE_DEVS);
 
 	close(fd);
 
Signature · 1 line
2.35.1
#13 lore raw

PATCH 12/14 net/e1000: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/e1000/em_ethdev.c  | 4 ++--
 drivers/net/e1000/igb_ethdev.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/e1000/em_ethdev.c +2 -2
index 8ee9be12ad19..146e74cfc76e 100644
@@ -872,8 +872,8 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
 			E1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);
 	int pause_frames;
 
-	if(hw->phy.media_type == e1000_media_type_copper ||
-			(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
+	if (hw->phy.media_type == e1000_media_type_copper ||
+	    (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		stats->symerrs += E1000_READ_REG(hw,E1000_SYMERRS);
 		stats->sec += E1000_READ_REG(hw, E1000_SEC);
 	}
drivers/net/e1000/igb_ethdev.c +4 -4
index 8858f975f8cc..5c35b8349063 100644
@@ -1683,7 +1683,7 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
 	uint64_t old_rpthc = stats->rpthc;
 	uint64_t old_hgptc = stats->hgptc;
 
-	if(hw->phy.media_type == e1000_media_type_copper ||
+	if (hw->phy.media_type == e1000_media_type_copper ||
 	    (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		stats->symerrs +=
 		    E1000_READ_REG(hw,E1000_SYMERRS);
@@ -3500,10 +3500,10 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
 
 	for (i = 0; i < IGB_VFTA_SIZE; i++){
 		vfta = shadow_vfta->vfta[i];
-		if(vfta){
+		if (vfta){
 			mask = 1;
 			for (j = 0; j < 32; j++){
-				if(vfta & mask)
+				if (vfta & mask)
 					igbvf_set_vfta(hw,
 						(uint16_t)((i<<5)+j), on);
 				mask<<=1;
@@ -3528,7 +3528,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 
 	/*vind is not used in VF driver, set to 0, check ixgbe_set_vfta_vf*/
 	ret = igbvf_set_vfta(hw, vlan_id, !!on);
-	if(ret){
+	if (ret){
 		PMD_INIT_LOG(ERR, "Unable to set VF vlan");
 		return ret;
 	}
Signature · 1 line
2.35.1
#14 lore raw

PATCH 13/14 net/i40e: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/i40e/i40e_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -4
index 15d9ff868f3a..7050e0057d8e 100644
@@ -956,7 +956,7 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_add_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
 
@@ -996,7 +996,7 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 	vid = vlan_filter_list->vlan_id;
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_delete_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
 
@@ -1577,12 +1577,12 @@ i40e_pf_host_init(struct rte_eth_dev *dev)
 	 * return if SRIOV not enabled, VF number not configured or
 	 * no queue assigned.
 	 */
-	if(!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
 		return I40E_SUCCESS;
 
 	/* Allocate memory to store VF structure */
 	pf->vfs = rte_zmalloc("i40e_pf_vf",sizeof(*pf->vfs) * pf->vf_num, 0);
-	if(pf->vfs == NULL)
+	if (pf->vfs == NULL)
 		return -ENOMEM;
 
 	/* Disable irq0 for VFR event */
Signature · 1 line
2.35.1
#15 lore raw

PATCH 14/14 net/bnx2x: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/bnx2x/bnx2x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnx2x/bnx2x.h +1 -1
index 89414ac88a93..9cb927e25449 100644
@@ -96,7 +96,7 @@ int bnx2x_ilog2(int x)
 	int log = 0;
 	x >>= 1;
 
-	while(x) {
+	while (x) {
 		log++;
 		x >>= 1;
 	}
Signature · 1 line
2.35.1
#16 lore raw

v2 cover whitespace after keywords

In reply to Stephen Hemminger

The DPDK standard now enforced through checkpatch is to use a space after keywords. Much of the older code that was grandfathered in doesn't follow that, so fix it.

No urgency to this patchset, and it might just be viewed as churn. But I prefer to read code that looks all the same.

“A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. He may as well concern himself with his shadow on the wall." -- Ralph Waldo Emerson

v2 - fix related complaints from checkpatch
if you touch a line, then it wants to make all the rules apply.

Stephen Hemminger (14):
eal: fix whitespace
cmdline: fix whitespace
timer: fix whitespace
ip_frag: fix whitespace
testpmd: fix whitespace
test: fix whitespace
examples/qos_sched: fix whitespace
examples/vhost: fix whitespace
l3fwd: fix whitespace
examples: fix whitespace
bus/pci: fix whitespace
net/e1000: fix whitespace
net/i40e: fix whitespace
net/bnx2x: fix whitespace

 app/test-pmd/cmdline.c                     | 31 +++++++++++-----------
 app/test-pmd/parameters.c                  | 10 ++++---
 app/test-pmd/testpmd.c                     |  2 +-
 app/test/test_cmdline_cirbuf.c             |  4 +--
 app/test/test_debug.c                      |  4 +--
 app/test/test_hash.c                       |  6 ++---
 app/test/test_lpm6_perf.c                  |  2 +-
 app/test/test_malloc.c                     | 14 +++++-----
 app/test/test_mbuf.c                       | 14 +++++-----
 app/test/test_spinlock.c                   |  2 +-
 drivers/bus/pci/bsd/pci.c                  |  2 +-
 drivers/net/bnx2x/bnx2x.h                  |  2 +-
 drivers/net/e1000/em_ethdev.c              |  4 +--
 drivers/net/e1000/igb_ethdev.c             |  8 +++---
 drivers/net/i40e/i40e_pf.c                 |  8 +++---
 examples/cmdline/parse_obj_list.c          |  2 +-
 examples/ip_reassembly/main.c              |  2 +-
 examples/l3fwd-power/main.c                |  7 ++---
 examples/l3fwd/main.c                      |  7 ++---
 examples/multi_process/symmetric_mp/main.c |  6 ++---
 examples/qos_sched/app_thread.c            |  6 ++---
 examples/qos_sched/args.c                  |  2 +-
 examples/qos_sched/init.c                  |  2 +-
 examples/qos_sched/main.c                  |  4 +--
 examples/vhost/main.c                      |  7 +++--
 lib/cmdline/cmdline_parse_string.c         | 16 +++++------
 lib/cmdline/cmdline_rdline.c               | 12 ++++-----
 lib/eal/linux/eal_hugepage_info.c          |  6 ++---
 lib/eal/linux/eal_interrupts.c             |  2 +-
 lib/ip_frag/rte_ipv4_reassembly.c          |  2 +-
 lib/timer/rte_timer.c                      |  2 +-
 31 files changed, 99 insertions(+), 99 deletions(-)
Signature · 1 line
2.35.1
#17 lore raw

PATCH v2 1/14 eal: fix whitespace

Add space after keywords.

---
 lib/eal/linux/eal_hugepage_info.c | 6 +++---
 lib/eal/linux/eal_interrupts.c    | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
lib/eal/linux/eal_hugepage_info.c +3 -3
index a1b6cb31ff1a..b6d751a2ee97 100644
@@ -180,8 +180,8 @@ get_default_hp_size(void)
 	FILE *fd = fopen(proc_meminfo, "r");
 	if (fd == NULL)
 		rte_panic("Cannot open %s\n", proc_meminfo);
-	while(fgets(buffer, sizeof(buffer), fd)){
-		if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0){
+	while (fgets(buffer, sizeof(buffer), fd)) {
+		if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0) {
 			size = rte_str_to_size(&buffer[hugepagesz_len]);
 			break;
 		}
@@ -231,7 +231,7 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len)
 	if (default_size == 0)
 		default_size = get_default_hp_size();
 
-	while (fgets(buf, sizeof(buf), fd)){
+	while (fgets(buf, sizeof(buf), fd)) {
 		const char *pagesz_str;
 
 		if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX,
lib/eal/linux/eal_interrupts.c +1 -1
index d52ec8eb4cd7..3be1b090be9e 100644
@@ -1073,7 +1073,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
 	struct epoll_event events[totalfds];
 	int nfds = 0;
 
-	for(;;) {
+	for (;;) {
 		nfds = epoll_wait(pfd, events, totalfds,
 			EAL_INTR_EPOLL_WAIT_FOREVER);
 		/* epoll_wait fail */
Signature · 1 line
2.35.1
#18 lore raw

PATCH v2 2/14 cmdline: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.
Remove unnecessary spaces in if expressions.

---
 lib/cmdline/cmdline_parse_string.c | 16 +++++++---------
 lib/cmdline/cmdline_rdline.c       | 12 ++++++------
 2 files changed, 13 insertions(+), 15 deletions(-)
lib/cmdline/cmdline_parse_string.c +7 -9
index d756638905a2..ab1ef4b22e40 100644
@@ -73,20 +73,18 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 			token_len = get_token_len(str);
 
 			/* if token is too big... */
-			if (token_len >= STR_TOKEN_SIZE - 1) {
+			if (token_len >= STR_TOKEN_SIZE - 1)
 				continue;
 			}
 
-			if ( strncmp(buf, str, token_len) ) {
+			if (strncmp(buf, str, token_len))
 				continue;
-			}
 
-			if ( !cmdline_isendoftoken(*(buf+token_len)) ) {
+			if (!cmdline_isendoftoken(*(buf+token_len)))
 				continue;
-			}
 
 			break;
-		} while ( (str = get_next_token(str)) != NULL );
+		} while ((str = get_next_token(str)) != NULL);
 
 		if (!str)
 			return -1;
@@ -108,7 +106,7 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	/* unspecified string (unknown single token) */
 	else {
 		token_len = 0;
-		while(!cmdline_isendoftoken(buf[token_len]) &&
+		while (!cmdline_isendoftoken(buf[token_len]) &&
 		      token_len < (STR_TOKEN_SIZE-1))
 			token_len++;
 
@@ -149,9 +147,9 @@ int cmdline_complete_get_nb_string(cmdline_parse_token_hdr_t *tk)
 		return 0;
 
 	str = sd->str;
-	while( (str = get_next_token(str)) != NULL ) {
+	while ((str = get_next_token(str)) != NULL)
 		ret++;
-	}
+
 	return ret;
 }
 
lib/cmdline/cmdline_rdline.c +6 -6
index 5cf723a0126a..b5927879d48f 100644
@@ -301,7 +301,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* delete 1 char from the left */
 		case CMDLINE_KEY_BKSPACE:
 		case CMDLINE_KEY_BKSPACE2:
-			if(!cirbuf_del_tail_safe(&rdl->left)) {
+			if (!cirbuf_del_tail_safe(&rdl->left)) {
 				rdline_puts(rdl, vt100_bs);
 				display_right_buffer(rdl, 1);
 			}
@@ -354,7 +354,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* paste contents of kill buffer to the left side of caret */
 		case CMDLINE_KEY_CTRL_Y:
 			i=0;
-			while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
+			while (CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
 			      RDLINE_BUF_SIZE &&
 			      i < rdl->kill_size) {
 				cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
@@ -403,10 +403,10 @@ rdline_char_in(struct rdline *rdl, char c)
 				tmp_size = strnlen(tmp_buf, sizeof(tmp_buf));
 				/* add chars */
 				if (ret == RDLINE_RES_COMPLETE) {
-					i=0;
-					while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
-					      RDLINE_BUF_SIZE &&
-					      i < tmp_size) {
+					i = 0;
+					while (CIRBUF_GET_LEN(&rdl->right) +
+					       CIRBUF_GET_LEN(&rdl->left) <
+					       RDLINE_BUF_SIZE && i < tmp_size) {
 						cirbuf_add_tail(&rdl->left, tmp_buf[i]);
 						rdl->write_char(rdl, tmp_buf[i]);
 						i++;
Signature · 1 line
2.35.1
#19 lore raw

PATCH v2 3/14 timer: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 lib/timer/rte_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/timer/rte_timer.c +1 -1
index 85d67573eb9e..9eb73f1fed13 100644
@@ -350,7 +350,7 @@ timer_get_prev_entries(uint64_t time_val, unsigned tim_lcore,
 {
 	unsigned lvl = priv_timer[tim_lcore].curr_skiplist_depth;
 	prev[lvl] = &priv_timer[tim_lcore].pending_head;
-	while(lvl != 0) {
+	while (lvl != 0) {
 		lvl--;
 		prev[lvl] = prev[lvl+1];
 		while (prev[lvl]->sl_next[lvl] &&
Signature · 1 line
2.35.1
#20 lore raw

PATCH v2 4/14 ip_frag: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 lib/ip_frag/rte_ipv4_reassembly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ip_frag/rte_ipv4_reassembly.c +1 -1
index 4a89a5f5365a..88ee0aa63f62 100644
@@ -34,7 +34,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp)
 		for (i = n; i != IP_FIRST_FRAG_IDX && ofs != first_len; i--) {
 
 			/* previous fragment found. */
-			if(fp->frags[i].ofs + fp->frags[i].len == ofs) {
+			if (fp->frags[i].ofs + fp->frags[i].len == ofs) {
 
 				RTE_ASSERT(curr_idx != i);
 
Signature · 1 line
2.35.1
#21 lore raw

PATCH v2 5/14 testpmd: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 app/test-pmd/cmdline.c    | 31 ++++++++++++++++---------------
 app/test-pmd/parameters.c | 10 ++++++----
 app/test-pmd/testpmd.c    |  2 +-
 3 files changed, 23 insertions(+), 20 deletions(-)
app/test-pmd/cmdline.c +16 -15
index 8dc60e938830..7721006cc310 100644
@@ -2730,11 +2730,12 @@ parse_reta_config(const char *str,
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -3242,15 +3243,15 @@ cmd_config_thresh_parsed(void *parsed_result,
 
 	if (!strcmp(res->name, "txpt"))
 		tx_pthresh = res->value;
-	else if(!strcmp(res->name, "txht"))
+	else if (!strcmp(res->name, "txht"))
 		tx_hthresh = res->value;
-	else if(!strcmp(res->name, "txwt"))
+	else if (!strcmp(res->name, "txwt"))
 		tx_wthresh = res->value;
-	else if(!strcmp(res->name, "rxpt"))
+	else if (!strcmp(res->name, "rxpt"))
 		rx_pthresh = res->value;
-	else if(!strcmp(res->name, "rxht"))
+	else if (!strcmp(res->name, "rxht"))
 		rx_hthresh = res->value;
-	else if(!strcmp(res->name, "rxwt"))
+	else if (!strcmp(res->name, "rxwt"))
 		rx_wthresh = res->value;
 	else {
 		fprintf(stderr, "Unknown parameter\n");
@@ -4088,8 +4089,8 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	len = strnlen(str, STR_TOKEN_SIZE);
 	i = 0;
 	/* Get port_id first */
-	while(i < len){
-		if(str[i] == ',')
+	while (i < len) {
+		if (str[i] == ',')
 			break;
 
 		i++;
@@ -4097,7 +4098,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	str[i]='\0';
 	tmp = strtoul(str, NULL, 0);
 	/* If port_id greater that what portid_t can represent, return */
-	if(tmp >= RTE_MAX_ETHPORTS)
+	if (tmp >= RTE_MAX_ETHPORTS)
 		return;
 	port_id = (portid_t)tmp;
 
@@ -4108,17 +4109,17 @@ cmd_vlan_offload_parsed(void *parsed_result,
 
 	if (!strcmp(res->what, "strip"))
 		rx_vlan_strip_set(port_id,  on);
-	else if(!strcmp(res->what, "stripq")){
+	else if (!strcmp(res->what, "stripq")) {
 		uint16_t queue_id = 0;
 
 		/* No queue_id, return */
-		if(i + 1 >= len) {
+		if (i + 1 >= len) {
 			fprintf(stderr, "must specify (port,queue_id)\n");
 			return;
 		}
 		tmp = strtoul(str + i + 1, NULL, 0);
 		/* If queue_id greater that what 16-bits can represent, return */
-		if(tmp > 0xffff)
+		if (tmp > 0xffff)
 			return;
 
 		queue_id = (uint16_t)tmp;
@@ -7207,7 +7208,7 @@ static void cmd_mac_addr_parsed(void *parsed_result,
 		ret = rte_eth_dev_mac_addr_remove(res->port_num, &res->address);
 
 	/* check the return value and print it if is < 0 */
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
@@ -7780,7 +7781,7 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
 						res->vf_num);
 #endif
 
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
app/test-pmd/parameters.c +6 -4
index aed4cdcb8485..7fc6d91f0210 100644
@@ -306,11 +306,12 @@ parse_portnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -366,11 +367,12 @@ parse_ringnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
app/test-pmd/testpmd.c +1 -1
index aa7ea29f15ba..04b078a2938b 100644
@@ -2406,7 +2406,7 @@ start_packet_forwarding(int with_tx_first)
 
 	test_done = 0;
 
-	if(!no_flush_rx)
+	if (!no_flush_rx)
 		flush_fwd_rx_queues();
 
 	rxtx_config_display();
Signature · 1 line
2.35.1
#22 lore raw

PATCH v2 6/14 test: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 app/test/test_cmdline_cirbuf.c |  4 ++--
 app/test/test_debug.c          |  4 ++--
 app/test/test_hash.c           |  6 +++---
 app/test/test_lpm6_perf.c      |  2 +-
 app/test/test_malloc.c         | 14 +++++++-------
 app/test/test_mbuf.c           | 14 ++++++--------
 app/test/test_spinlock.c       |  2 +-
 7 files changed, 22 insertions(+), 24 deletions(-)
app/test/test_cmdline_cirbuf.c +2 -2
index 8ac326cb02e0..6f7aae6df59a 100644
@@ -708,7 +708,7 @@ test_cirbuf_char_fill(void)
 		return -1;
 	}
 	/* delete buffer from tail */
-	for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
+	for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
 		cirbuf_del_tail_safe(&cb);
 	/* try to delete from an empty buffer */
 	if (cirbuf_del_tail_safe(&cb) >= 0) {
@@ -737,7 +737,7 @@ test_cirbuf_char_fill(void)
 		return -1;
 	}
 	/* delete buffer from head */
-	for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
+	for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
 		cirbuf_del_head_safe(&cb);
 	/* try to delete from an empty buffer */
 	if (cirbuf_del_head_safe(&cb) >= 0) {
app/test/test_debug.c +2 -2
index 2704f5b92726..28fc2180e2b0 100644
@@ -53,7 +53,7 @@ test_panic(void)
 		return -1;
 	}
 	wait(&status);
-	if(status == 0){
+	if (status == 0) {
 		printf("Child process terminated normally!\n");
 		return -1;
 	} else
@@ -84,7 +84,7 @@ test_exit_val(int exit_val)
 	}
 	wait(&status);
 	printf("Child process status: %d\n", status);
-	if(!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val){
+	if (!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val) {
 		printf("Child process terminated with incorrect status (expected = %d)!\n",
 				exit_val);
 		return -1;
app/test/test_hash.c +3 -3
index 3e45afaa67fc..35d9d8a62ef8 100644
@@ -724,12 +724,12 @@ static int test_five_keys(void)
 	}
 
 	/* Lookup */
-	for(i = 0; i < 5; i++)
+	for (i = 0; i < 5; i++)
 		key_array[i] = &keys[i];
 
 	ret = rte_hash_lookup_bulk(handle, &key_array[0], 5, (int32_t *)pos);
-	if(ret == 0)
-		for(i = 0; i < 5; i++) {
+	if (ret == 0)
+		for (i = 0; i < 5; i++) {
 			print_key_info("Lkp", key_array[i], pos[i]);
 			RETURN_IF_ERROR(pos[i] != expected_pos[i],
 					"failed to find key (pos[%u]=%d)", i, pos[i]);
app/test/test_lpm6_perf.c +1 -1
index aaf2773b6fac..2f9321345e4b 100644
@@ -47,7 +47,7 @@ print_route_distribution(const struct rules_tbl_entry *table, uint32_t n)
 	printf("--------------------------- \n");
 
 	/* Count depths. */
-	for(i = 1; i <= 128; i++) {
+	for (i = 1; i <= 128; i++) {
 		unsigned depth_counter = 0;
 		double percent_hits;
 
app/test/test_malloc.c +7 -7
index de40e506113a..8d3750a3f1f0 100644
@@ -86,8 +86,8 @@ test_align_overlap_per_lcore(__rte_unused void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
-			if( *(char *)p1 != 0) {
+		for (j = 0; j < 1000 ; j++) {
+			if (*(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero the allocated memory\n");
 				ret = -1;
 			}
@@ -157,8 +157,8 @@ test_reordered_free_per_lcore(__rte_unused void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
-			if( *(char *)p1 != 0) {
+		for (j = 0; j < 1000 ; j++) {
+			if (*(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero the allocated memory\n");
 				ret = -1;
 			}
@@ -331,12 +331,12 @@ test_multi_alloc_statistics(void)
 	/* After freeing both allocations check stats return to original */
 	rte_malloc_get_socket_stats(socket, &post_stats);
 
-	if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
+	if (second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
 		printf("Incorrect heap statistics: Total size \n");
 		return -1;
 	}
 	/* Check allocated size is equal to two additions plus overhead */
-	if(second_stats.heap_allocsz_bytes !=
+	if (second_stats.heap_allocsz_bytes !=
 			size + overhead + first_stats.heap_allocsz_bytes) {
 		printf("Incorrect heap statistics: Allocated size \n");
 		return -1;
@@ -495,7 +495,7 @@ test_realloc_socket(int socket)
 		return -1;
 	}
 	/* calc an alignment we don't already have */
-	while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
+	while (RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
 		new_align *= 2;
 	char *ptr8 = rte_realloc_socket(ptr7, size7, new_align, socket);
 	if (!ptr8){
app/test/test_mbuf.c +6 -8
index 53fe898a384c..fceacb8fead8 100644
@@ -120,7 +120,7 @@ static unsigned refcnt_lcore[RTE_MAX_LCORE];
 		printf("mbuf test FAILED (l.%d): <" str ">\n",		\
 		       __LINE__,  ##__VA_ARGS__);			\
 		goto fail;						\
-} while(0)
+} while (0)
 
 /*
  * test data manipulation in mbuf with non-ascii data
@@ -154,9 +154,7 @@ test_pktmbuf_with_non_ascii_data(struct rte_mempool *pktmbuf_pool)
 	return 0;
 
 fail:
-	if(m) {
-		rte_pktmbuf_free(m);
-	}
+	rte_pktmbuf_free(m);
 	return -1;
 }
 
@@ -701,12 +699,12 @@ test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool)
 	}
 	struct rte_mbuf *extra = NULL;
 	extra = rte_pktmbuf_alloc(pktmbuf_pool);
-	if(extra != NULL) {
+	if (extra != NULL) {
 		printf("Error pool not empty");
 		ret = -1;
 	}
 	extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
-	if(extra != NULL) {
+	if (extra != NULL) {
 		printf("Error pool not empty");
 		ret = -1;
 	}
@@ -966,7 +964,7 @@ test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool)
 			struct rte_mbuf *mb, *mt;
 
 			mb = m[i];
-			while(mb != NULL) {
+			while (mb != NULL) {
 				mt = mb;
 				mb = mb->next;
 				rte_pktmbuf_free_seg(mt);
@@ -1195,7 +1193,7 @@ verify_mbuf_check_panics(struct rte_mbuf *buf)
 		return -1;
 	}
 	wait(&status);
-	if(status == 0)
+	if (status == 0)
 		return -1;
 
 	return 0;
app/test/test_spinlock.c +1 -1
index 3f59372300c3..3ee82fa963a5 100644
@@ -237,7 +237,7 @@ test_spinlock(void)
 	/*
 	 * Try to acquire a lock that we already own
 	 */
-	if(!rte_spinlock_recursive_trylock(&slr)) {
+	if (!rte_spinlock_recursive_trylock(&slr)) {
 		printf("rte_spinlock_recursive_trylock failed on a lock that "
 		       "we already own\n");
 		ret = -1;
Signature · 1 line
2.35.1
#23 lore raw

PATCH v2 7/14 examples/qos_sched: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/qos_sched/app_thread.c | 6 +++---
 examples/qos_sched/args.c       | 2 +-
 examples/qos_sched/init.c       | 2 +-
 examples/qos_sched/main.c       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
examples/qos_sched/app_thread.c +3 -3
index dbc878b55394..a49356fecf5f 100644
@@ -79,7 +79,7 @@ app_rx_thread(struct thread_conf **confs)
 		if (likely(nb_rx != 0)) {
 			APP_STATS_ADD(conf->stat.nb_rx, nb_rx);
 
-			for(i = 0; i < nb_rx; i++) {
+			for (i = 0; i < nb_rx; i++) {
 				get_pkt_sched(rx_mbufs[i],
 						&subport, &pipe, &traffic_class, &queue, &color);
 				rte_sched_port_pkt_write(conf->sched_port,
@@ -91,7 +91,7 @@ app_rx_thread(struct thread_conf **confs)
 
 			if (unlikely(rte_ring_sp_enqueue_bulk(conf->rx_ring,
 					(void **)rx_mbufs, nb_rx, NULL) == 0)) {
-				for(i = 0; i < nb_rx; i++) {
+				for (i = 0; i < nb_rx; i++) {
 					rte_pktmbuf_free(rx_mbufs[i]);
 
 					APP_STATS_ADD(conf->stat.nb_drop, 1);
@@ -137,7 +137,7 @@ app_send_packets(struct thread_conf *qconf, struct rte_mbuf **mbufs, uint32_t nb
 	uint32_t i, len;
 
 	len = qconf->n_mbufs;
-	for(i = 0; i < nb_pkt; i++) {
+	for (i = 0; i < nb_pkt; i++) {
 		qconf->m_table[len] = mbufs[i];
 		len++;
 		/* enough pkts to be sent */
examples/qos_sched/args.c +1 -1
index b2959499ae9a..b752eb221f7c 100644
@@ -451,7 +451,7 @@ app_parse_args(int argc, char **argv)
 	/* sanity check for cores assignment */
 	nb_lcores = app_cpu_core_count();
 
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		if (qos_conf[i].rx_core >= nb_lcores) {
 			RTE_LOG(ERR, APP, "pfc %u: invalid RX lcore index %u\n", i + 1,
 					qos_conf[i].rx_core);
examples/qos_sched/init.c +1 -1
index 0709aec10c31..41b46b296298 100644
@@ -323,7 +323,7 @@ int app_init(void)
 		rte_exit(EXIT_FAILURE, "Invalid configuration profile\n");
 
 	/* Initialize each active flow */
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		uint32_t socket = rte_lcore_to_socket_id(qos_conf[i].rx_core);
 		struct rte_ring *ring;
 
examples/qos_sched/main.c +2 -2
index dc6a17a6464a..7b757df0eb02 100644
@@ -152,7 +152,7 @@ app_stat(void)
 	static struct rte_eth_stats tx_stats[MAX_DATA_STREAMS];
 
 	/* print statistics */
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		struct flow_conf *flow = &qos_conf[i];
 
 		rte_eth_stats_get(flow->rx_port, &stats);
@@ -212,7 +212,7 @@ main(int argc, char **argv)
 	}
 	else {
 		/* print statistics every second */
-		while(1) {
+		while (1) {
 			sleep(1);
 			app_stat();
 		}
Signature · 1 line
2.35.1
#24 lore raw

PATCH v2 8/14 examples/vhost: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/vhost/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
examples/vhost/main.c +3 -4
index 42e53a0f9a4f..9fee966916e9 100644
@@ -1491,7 +1491,7 @@ switch_worker(void *arg __rte_unused)
 		}
 	}
 
-	while(1) {
+	while (1) {
 		drain_mbuf_table(tx_q);
 		drain_vhost_table();
 		/*
@@ -1583,9 +1583,8 @@ destroy_device(int vid)
 		return;
 	/*set the remove flag. */
 	vdev->remove = 1;
-	while(vdev->ready != DEVICE_SAFE_REMOVE) {
+	while (vdev->ready != DEVICE_SAFE_REMOVE)
 		rte_pause();
-	}
 
 	for (i = 0; i < RTE_MAX_LCORE; i++)
 		rte_free(vhost_txbuff[i * RTE_MAX_VHOST_DEVICE + vid]);
@@ -1816,7 +1815,7 @@ print_stats(__rte_unused void *arg)
 	const char clr[] = { 27, '[', '2', 'J', '\0' };
 	const char top_left[] = { 27, '[', '1', ';', '1', 'H','\0' };
 
-	while(1) {
+	while (1) {
 		sleep(enable_stats);
 
 		/* Clear screen and move to top left */
Signature · 1 line
2.35.1
#25 lore raw

PATCH v2 9/14 l3fwd: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/l3fwd-power/main.c | 7 ++++---
 examples/l3fwd/main.c       | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
examples/l3fwd-power/main.c +4 -3
index fd3ade330f82..7bd5d8cb2281 100644
@@ -1787,11 +1787,12 @@ parse_config(const char *q_arg)
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -2946,7 +2947,7 @@ main(int argc, char **argv)
 		fflush(stdout);
 
 		/* init RX queues */
-		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
examples/l3fwd/main.c +4 -3
index 5198ff30dd00..2b8575137d50 100644
@@ -516,11 +516,12 @@ parse_config(const char *q_arg)
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -1366,7 +1367,7 @@ l3fwd_poll_resource_setup(void)
 		printf("\nInitializing rx queues on lcore %u ... ", lcore_id );
 		fflush(stdout);
 		/* init RX queues */
-		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
Signature · 1 line
2.35.1
#26 lore raw

PATCH v2 10/14 examples: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/cmdline/parse_obj_list.c          | 2 +-
 examples/ip_reassembly/main.c              | 2 +-
 examples/multi_process/symmetric_mp/main.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
examples/cmdline/parse_obj_list.c +1 -1
index 959bcd14527e..759072d39620 100644
@@ -42,7 +42,7 @@ parse_obj_list(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	if (res && ressize < sizeof(struct object *))
 		return -1;
 
-	while(!cmdline_isendoftoken(buf[token_len]))
+	while (!cmdline_isendoftoken(buf[token_len]))
 		token_len++;
 
 	SLIST_FOREACH(o, tkd->list, next) {
examples/ip_reassembly/main.c +1 -1
index bd0b1d31decf..7e84b4944759 100644
@@ -300,7 +300,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port)
 
 	TX_LCORE_STAT_UPDATE(&qconf->tx_stat, queue, 1);
 	txmb->m_table[txmb->head] = m;
-	if(++txmb->head == len)
+	if (++txmb->head == len)
 		txmb->head = 0;
 
 	return 0;
examples/multi_process/symmetric_mp/main.c +3 -3
index 1ff85875dfdf..2f4441049253 100644
@@ -156,7 +156,7 @@ smp_parse_args(int argc, char **argv)
 
 	/* get the port numbers from the port mask */
 	RTE_ETH_FOREACH_DEV(i)
-		if(port_mask & (1 << i))
+		if (port_mask & (1 << i))
 			ports[num_ports++] = (uint8_t)i;
 
 	ret = optind-1;
@@ -470,8 +470,8 @@ main(int argc, char **argv)
 	/* Primary instance initialized. 8< */
 	if (num_ports & 1)
 		rte_exit(EXIT_FAILURE, "Application must use an even number of ports\n");
-	for(i = 0; i < num_ports; i++){
-		if(proc_type == RTE_PROC_PRIMARY)
+	for (i = 0; i < num_ports; i++) {
+		if (proc_type == RTE_PROC_PRIMARY)
 			if (smp_port_init(ports[i], mp, (uint16_t)num_procs) < 0)
 				rte_exit(EXIT_FAILURE, "Error initialising ports\n");
 	}
Signature · 1 line
2.35.1
#27 lore raw

PATCH v2 11/14 bus/pci: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/bus/pci/bsd/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/pci/bsd/pci.c +1 -1
index 7459d15c7e31..056e2eda2d5f 100644
@@ -368,7 +368,7 @@ rte_pci_scan(void)
 		}
 
 		dev_count += conf_io.num_matches;
-	} while(conf_io.status == PCI_GETCONF_MORE_DEVS);
+	} while (conf_io.status == PCI_GETCONF_MORE_DEVS);
 
 	close(fd);
 
Signature · 1 line
2.35.1
#28 lore raw

PATCH v2 12/14 net/e1000: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/e1000/em_ethdev.c  | 4 ++--
 drivers/net/e1000/igb_ethdev.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/e1000/em_ethdev.c +2 -2
index 8ee9be12ad19..146e74cfc76e 100644
@@ -872,8 +872,8 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
 			E1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);
 	int pause_frames;
 
-	if(hw->phy.media_type == e1000_media_type_copper ||
-			(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
+	if (hw->phy.media_type == e1000_media_type_copper ||
+	    (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		stats->symerrs += E1000_READ_REG(hw,E1000_SYMERRS);
 		stats->sec += E1000_READ_REG(hw, E1000_SEC);
 	}
drivers/net/e1000/igb_ethdev.c +4 -4
index 8858f975f8cc..67e82d708964 100644
@@ -1683,7 +1683,7 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
 	uint64_t old_rpthc = stats->rpthc;
 	uint64_t old_hgptc = stats->hgptc;
 
-	if(hw->phy.media_type == e1000_media_type_copper ||
+	if (hw->phy.media_type == e1000_media_type_copper ||
 	    (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		stats->symerrs +=
 		    E1000_READ_REG(hw,E1000_SYMERRS);
@@ -3500,10 +3500,10 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
 
 	for (i = 0; i < IGB_VFTA_SIZE; i++){
 		vfta = shadow_vfta->vfta[i];
-		if(vfta){
+		if (vfta) {
 			mask = 1;
 			for (j = 0; j < 32; j++){
-				if(vfta & mask)
+				if (vfta & mask)
 					igbvf_set_vfta(hw,
 						(uint16_t)((i<<5)+j), on);
 				mask<<=1;
@@ -3528,7 +3528,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 
 	/*vind is not used in VF driver, set to 0, check ixgbe_set_vfta_vf*/
 	ret = igbvf_set_vfta(hw, vlan_id, !!on);
-	if(ret){
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Unable to set VF vlan");
 		return ret;
 	}
Signature · 1 line
2.35.1
#29 lore raw

PATCH v2 13/14 net/i40e: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/i40e/i40e_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -4
index 15d9ff868f3a..7050e0057d8e 100644
@@ -956,7 +956,7 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_add_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
 
@@ -996,7 +996,7 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 	vid = vlan_filter_list->vlan_id;
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_delete_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
 
@@ -1577,12 +1577,12 @@ i40e_pf_host_init(struct rte_eth_dev *dev)
 	 * return if SRIOV not enabled, VF number not configured or
 	 * no queue assigned.
 	 */
-	if(!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
 		return I40E_SUCCESS;
 
 	/* Allocate memory to store VF structure */
 	pf->vfs = rte_zmalloc("i40e_pf_vf",sizeof(*pf->vfs) * pf->vf_num, 0);
-	if(pf->vfs == NULL)
+	if (pf->vfs == NULL)
 		return -ENOMEM;
 
 	/* Disable irq0 for VFR event */
Signature · 1 line
2.35.1
#30 lore raw

PATCH v2 14/14 net/bnx2x: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/bnx2x/bnx2x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnx2x/bnx2x.h +1 -1
index 89414ac88a93..9cb927e25449 100644
@@ -96,7 +96,7 @@ int bnx2x_ilog2(int x)
 	int log = 0;
 	x >>= 1;
 
-	while(x) {
+	while (x) {
 		log++;
 		x >>= 1;
 	}
Signature · 1 line
2.35.1
#31 lore raw

v3 cover whitespace after keywords

In reply to Stephen Hemminger

The DPDK standard now enforced through checkpatch is to use a space after keywords. Much of the older code that was grandfathered in doesn't follow that, so fix it.

No urgency to this patchset, and it might just be viewed as churn. But I prefer to read code that looks all the same.

“A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. He may as well concern himself with his shadow on the wall." -- Ralph Waldo Emerson

v3 - fix typo in previous version (forgot to remove one brace)
and find a few more leftover uses of "for(" and "while("

Stephen Hemminger (14):
eal: fix whitespace
cmdline: fix whitespace
timer: fix whitespace
ip_frag: fix whitespace
testpmd: fix whitespace
test: fix whitespace
examples/qos_sched: fix whitespace
examples/vhost: fix whitespace
l3fwd: fix whitespace
examples: fix whitespace
bus/pci: fix whitespace
net/e1000: fix whitespace
net/i40e: fix whitespace
net/bnx2x: fix whitespace

 app/test-pmd/cmdline.c                     | 31 +++++++++++-----------
 app/test-pmd/parameters.c                  | 10 ++++---
 app/test-pmd/testpmd.c                     |  2 +-
 app/test/test_cmdline_cirbuf.c             |  4 +--
 app/test/test_debug.c                      |  4 +--
 app/test/test_hash.c                       |  6 ++---
 app/test/test_lpm6_perf.c                  |  2 +-
 app/test/test_malloc.c                     | 14 +++++-----
 app/test/test_mbuf.c                       | 14 +++++-----
 app/test/test_ring_perf.c                  |  2 +-
 app/test/test_spinlock.c                   |  2 +-
 drivers/bus/pci/bsd/pci.c                  |  2 +-
 drivers/net/bnx2x/bnx2x.h                  |  2 +-
 drivers/net/e1000/em_ethdev.c              |  4 +--
 drivers/net/e1000/igb_ethdev.c             |  8 +++---
 drivers/net/e1000/igb_pf.c                 |  2 +-
 drivers/net/e1000/igb_rxtx.c               |  2 +-
 drivers/net/i40e/i40e_pf.c                 |  8 +++---
 examples/cmdline/parse_obj_list.c          |  2 +-
 examples/ip_reassembly/main.c              |  2 +-
 examples/l3fwd-power/main.c                |  7 ++---
 examples/l3fwd/main.c                      |  7 ++---
 examples/multi_process/symmetric_mp/main.c |  6 ++---
 examples/qos_sched/app_thread.c            |  6 ++---
 examples/qos_sched/args.c                  |  2 +-
 examples/qos_sched/init.c                  |  2 +-
 examples/qos_sched/main.c                  |  4 +--
 examples/vhost/main.c                      |  7 +++--
 lib/cmdline/cmdline_parse_string.c         | 17 +++++-------
 lib/cmdline/cmdline_rdline.c               | 12 ++++-----
 lib/eal/include/generic/rte_cycles.h       |  4 +--
 lib/eal/linux/eal_hugepage_info.c          |  6 ++---
 lib/eal/linux/eal_interrupts.c             |  2 +-
 lib/ip_frag/rte_ipv4_reassembly.c          |  2 +-
 lib/timer/rte_timer.c                      |  2 +-
 35 files changed, 104 insertions(+), 105 deletions(-)
Signature · 1 line
2.35.1
#32 lore raw

PATCH v3 1/14 eal: fix whitespace

Add space after keywords.

---
 lib/eal/include/generic/rte_cycles.h | 4 ++--
 lib/eal/linux/eal_hugepage_info.c    | 6 +++---
 lib/eal/linux/eal_interrupts.c       | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
lib/eal/include/generic/rte_cycles.h +2 -2
index f4fdca416570..e05b56e2cac6 100644
@@ -94,7 +94,7 @@ static inline uint64_t
 rte_get_timer_cycles(void)
 {
 #ifdef RTE_LIBEAL_USE_HPET
-	switch(eal_timer_source) {
+	switch (eal_timer_source) {
 	case EAL_TIMER_TSC:
 #endif
 		return rte_get_tsc_cycles();
@@ -116,7 +116,7 @@ static inline uint64_t
 rte_get_timer_hz(void)
 {
 #ifdef RTE_LIBEAL_USE_HPET
-	switch(eal_timer_source) {
+	switch (eal_timer_source) {
 	case EAL_TIMER_TSC:
 #endif
 		return rte_get_tsc_hz();
lib/eal/linux/eal_hugepage_info.c +3 -3
index a1b6cb31ff1a..b6d751a2ee97 100644
@@ -180,8 +180,8 @@ get_default_hp_size(void)
 	FILE *fd = fopen(proc_meminfo, "r");
 	if (fd == NULL)
 		rte_panic("Cannot open %s\n", proc_meminfo);
-	while(fgets(buffer, sizeof(buffer), fd)){
-		if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0){
+	while (fgets(buffer, sizeof(buffer), fd)) {
+		if (strncmp(buffer, str_hugepagesz, hugepagesz_len) == 0) {
 			size = rte_str_to_size(&buffer[hugepagesz_len]);
 			break;
 		}
@@ -231,7 +231,7 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len)
 	if (default_size == 0)
 		default_size = get_default_hp_size();
 
-	while (fgets(buf, sizeof(buf), fd)){
+	while (fgets(buf, sizeof(buf), fd)) {
 		const char *pagesz_str;
 
 		if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX,
lib/eal/linux/eal_interrupts.c +1 -1
index d52ec8eb4cd7..3be1b090be9e 100644
@@ -1073,7 +1073,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
 	struct epoll_event events[totalfds];
 	int nfds = 0;
 
-	for(;;) {
+	for (;;) {
 		nfds = epoll_wait(pfd, events, totalfds,
 			EAL_INTR_EPOLL_WAIT_FOREVER);
 		/* epoll_wait fail */
Signature · 1 line
2.35.1
#33 lore raw

PATCH v3 2/14 cmdline: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.
Remove unnecessary spaces in if expressions.

---
 lib/cmdline/cmdline_parse_string.c | 17 +++++++----------
 lib/cmdline/cmdline_rdline.c       | 12 ++++++------
 2 files changed, 13 insertions(+), 16 deletions(-)
lib/cmdline/cmdline_parse_string.c +7 -10
index d756638905a2..4224983d2e73 100644
@@ -73,20 +73,17 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 			token_len = get_token_len(str);
 
 			/* if token is too big... */
-			if (token_len >= STR_TOKEN_SIZE - 1) {
+			if (token_len >= STR_TOKEN_SIZE - 1)
 				continue;
-			}
 
-			if ( strncmp(buf, str, token_len) ) {
+			if (strncmp(buf, str, token_len))
 				continue;
-			}
 
-			if ( !cmdline_isendoftoken(*(buf+token_len)) ) {
+			if (!cmdline_isendoftoken(*(buf+token_len)))
 				continue;
-			}
 
 			break;
-		} while ( (str = get_next_token(str)) != NULL );
+		} while ((str = get_next_token(str)) != NULL);
 
 		if (!str)
 			return -1;
@@ -108,7 +105,7 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	/* unspecified string (unknown single token) */
 	else {
 		token_len = 0;
-		while(!cmdline_isendoftoken(buf[token_len]) &&
+		while (!cmdline_isendoftoken(buf[token_len]) &&
 		      token_len < (STR_TOKEN_SIZE-1))
 			token_len++;
 
@@ -149,9 +146,9 @@ int cmdline_complete_get_nb_string(cmdline_parse_token_hdr_t *tk)
 		return 0;
 
 	str = sd->str;
-	while( (str = get_next_token(str)) != NULL ) {
+	while ((str = get_next_token(str)) != NULL)
 		ret++;
-	}
+
 	return ret;
 }
 
lib/cmdline/cmdline_rdline.c +6 -6
index 5cf723a0126a..b5927879d48f 100644
@@ -301,7 +301,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* delete 1 char from the left */
 		case CMDLINE_KEY_BKSPACE:
 		case CMDLINE_KEY_BKSPACE2:
-			if(!cirbuf_del_tail_safe(&rdl->left)) {
+			if (!cirbuf_del_tail_safe(&rdl->left)) {
 				rdline_puts(rdl, vt100_bs);
 				display_right_buffer(rdl, 1);
 			}
@@ -354,7 +354,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* paste contents of kill buffer to the left side of caret */
 		case CMDLINE_KEY_CTRL_Y:
 			i=0;
-			while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
+			while (CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
 			      RDLINE_BUF_SIZE &&
 			      i < rdl->kill_size) {
 				cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
@@ -403,10 +403,10 @@ rdline_char_in(struct rdline *rdl, char c)
 				tmp_size = strnlen(tmp_buf, sizeof(tmp_buf));
 				/* add chars */
 				if (ret == RDLINE_RES_COMPLETE) {
-					i=0;
-					while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
-					      RDLINE_BUF_SIZE &&
-					      i < tmp_size) {
+					i = 0;
+					while (CIRBUF_GET_LEN(&rdl->right) +
+					       CIRBUF_GET_LEN(&rdl->left) <
+					       RDLINE_BUF_SIZE && i < tmp_size) {
 						cirbuf_add_tail(&rdl->left, tmp_buf[i]);
 						rdl->write_char(rdl, tmp_buf[i]);
 						i++;
Signature · 1 line
2.35.1
#34 lore raw

PATCH v3 3/14 timer: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 lib/timer/rte_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/timer/rte_timer.c +1 -1
index 85d67573eb9e..9eb73f1fed13 100644
@@ -350,7 +350,7 @@ timer_get_prev_entries(uint64_t time_val, unsigned tim_lcore,
 {
 	unsigned lvl = priv_timer[tim_lcore].curr_skiplist_depth;
 	prev[lvl] = &priv_timer[tim_lcore].pending_head;
-	while(lvl != 0) {
+	while (lvl != 0) {
 		lvl--;
 		prev[lvl] = prev[lvl+1];
 		while (prev[lvl]->sl_next[lvl] &&
Signature · 1 line
2.35.1
#35 lore raw

PATCH v3 4/14 ip_frag: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 lib/ip_frag/rte_ipv4_reassembly.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ip_frag/rte_ipv4_reassembly.c +1 -1
index 4a89a5f5365a..88ee0aa63f62 100644
@@ -34,7 +34,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp)
 		for (i = n; i != IP_FIRST_FRAG_IDX && ofs != first_len; i--) {
 
 			/* previous fragment found. */
-			if(fp->frags[i].ofs + fp->frags[i].len == ofs) {
+			if (fp->frags[i].ofs + fp->frags[i].len == ofs) {
 
 				RTE_ASSERT(curr_idx != i);
 
Signature · 1 line
2.35.1
#36 lore raw

PATCH v3 5/14 testpmd: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 app/test-pmd/cmdline.c    | 31 ++++++++++++++++---------------
 app/test-pmd/parameters.c | 10 ++++++----
 app/test-pmd/testpmd.c    |  2 +-
 3 files changed, 23 insertions(+), 20 deletions(-)
app/test-pmd/cmdline.c +16 -15
index 8dc60e938830..7721006cc310 100644
@@ -2730,11 +2730,12 @@ parse_reta_config(const char *str,
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -3242,15 +3243,15 @@ cmd_config_thresh_parsed(void *parsed_result,
 
 	if (!strcmp(res->name, "txpt"))
 		tx_pthresh = res->value;
-	else if(!strcmp(res->name, "txht"))
+	else if (!strcmp(res->name, "txht"))
 		tx_hthresh = res->value;
-	else if(!strcmp(res->name, "txwt"))
+	else if (!strcmp(res->name, "txwt"))
 		tx_wthresh = res->value;
-	else if(!strcmp(res->name, "rxpt"))
+	else if (!strcmp(res->name, "rxpt"))
 		rx_pthresh = res->value;
-	else if(!strcmp(res->name, "rxht"))
+	else if (!strcmp(res->name, "rxht"))
 		rx_hthresh = res->value;
-	else if(!strcmp(res->name, "rxwt"))
+	else if (!strcmp(res->name, "rxwt"))
 		rx_wthresh = res->value;
 	else {
 		fprintf(stderr, "Unknown parameter\n");
@@ -4088,8 +4089,8 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	len = strnlen(str, STR_TOKEN_SIZE);
 	i = 0;
 	/* Get port_id first */
-	while(i < len){
-		if(str[i] == ',')
+	while (i < len) {
+		if (str[i] == ',')
 			break;
 
 		i++;
@@ -4097,7 +4098,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	str[i]='\0';
 	tmp = strtoul(str, NULL, 0);
 	/* If port_id greater that what portid_t can represent, return */
-	if(tmp >= RTE_MAX_ETHPORTS)
+	if (tmp >= RTE_MAX_ETHPORTS)
 		return;
 	port_id = (portid_t)tmp;
 
@@ -4108,17 +4109,17 @@ cmd_vlan_offload_parsed(void *parsed_result,
 
 	if (!strcmp(res->what, "strip"))
 		rx_vlan_strip_set(port_id,  on);
-	else if(!strcmp(res->what, "stripq")){
+	else if (!strcmp(res->what, "stripq")) {
 		uint16_t queue_id = 0;
 
 		/* No queue_id, return */
-		if(i + 1 >= len) {
+		if (i + 1 >= len) {
 			fprintf(stderr, "must specify (port,queue_id)\n");
 			return;
 		}
 		tmp = strtoul(str + i + 1, NULL, 0);
 		/* If queue_id greater that what 16-bits can represent, return */
-		if(tmp > 0xffff)
+		if (tmp > 0xffff)
 			return;
 
 		queue_id = (uint16_t)tmp;
@@ -7207,7 +7208,7 @@ static void cmd_mac_addr_parsed(void *parsed_result,
 		ret = rte_eth_dev_mac_addr_remove(res->port_num, &res->address);
 
 	/* check the return value and print it if is < 0 */
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
@@ -7780,7 +7781,7 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result,
 						res->vf_num);
 #endif
 
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
 
 }
app/test-pmd/parameters.c +6 -4
index aed4cdcb8485..7fc6d91f0210 100644
@@ -306,11 +306,12 @@ parse_portnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -366,11 +367,12 @@ parse_ringnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
app/test-pmd/testpmd.c +1 -1
index aa7ea29f15ba..04b078a2938b 100644
@@ -2406,7 +2406,7 @@ start_packet_forwarding(int with_tx_first)
 
 	test_done = 0;
 
-	if(!no_flush_rx)
+	if (!no_flush_rx)
 		flush_fwd_rx_queues();
 
 	rxtx_config_display();
Signature · 1 line
2.35.1
#37 lore raw

RE: [PATCH v3 05/14] testpmd: fix whitespace

Quoted 10 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 2022年11月10日 7:25
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Subject: [PATCH v3 05/14] testpmd: fix whitespace

Quoted 3 lines

Add space after keywords.

Quoted 157 lines
---
 app/test-pmd/cmdline.c    | 31 ++++++++++++++++---------------
 app/test-pmd/parameters.c | 10 ++++++----
 app/test-pmd/testpmd.c    |  2 +-
 3 files changed, 23 insertions(+), 20 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

8dc60e938830..7721006cc310 100644

app/test-pmd/cmdline.c +3 -2
@@ -2730,11 +2730,12 @@ parse_reta_config(const char *str,
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p); @@ -3242,15 +3243,15

@@ cmd_config_thresh_parsed(void *parsed_result,

app/test-pmd/cmdline.c +5 -5
 	if (!strcmp(res->name, "txpt"))
 		tx_pthresh = res->value;
-	else if(!strcmp(res->name, "txht"))
+	else if (!strcmp(res->name, "txht"))
 		tx_hthresh = res->value;
-	else if(!strcmp(res->name, "txwt"))
+	else if (!strcmp(res->name, "txwt"))
 		tx_wthresh = res->value;
-	else if(!strcmp(res->name, "rxpt"))
+	else if (!strcmp(res->name, "rxpt"))
 		rx_pthresh = res->value;
-	else if(!strcmp(res->name, "rxht"))
+	else if (!strcmp(res->name, "rxht"))
 		rx_hthresh = res->value;
-	else if(!strcmp(res->name, "rxwt"))
+	else if (!strcmp(res->name, "rxwt"))
 		rx_wthresh = res->value;
 	else {
 		fprintf(stderr, "Unknown parameter\n"); @@ -4088,8 +4089,8

@@ cmd_vlan_offload_parsed(void *parsed_result,

app/test-pmd/cmdline.c +7 -7
 	len = strnlen(str, STR_TOKEN_SIZE);
 	i = 0;
 	/* Get port_id first */
-	while(i < len){
-		if(str[i] == ',')
+	while (i < len) {
+		if (str[i] == ',')
 			break;
 
 		i++;
@@ -4097,7 +4098,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	str[i]='\0';
 	tmp = strtoul(str, NULL, 0);
 	/* If port_id greater that what portid_t can represent, return */
-	if(tmp >= RTE_MAX_ETHPORTS)
+	if (tmp >= RTE_MAX_ETHPORTS)
 		return;
 	port_id = (portid_t)tmp;
 
@@ -4108,17 +4109,17 @@ cmd_vlan_offload_parsed(void *parsed_result,
 
 	if (!strcmp(res->what, "strip"))
 		rx_vlan_strip_set(port_id,  on);
-	else if(!strcmp(res->what, "stripq")){
+	else if (!strcmp(res->what, "stripq")) {
 		uint16_t queue_id = 0;
 
 		/* No queue_id, return */
-		if(i + 1 >= len) {
+		if (i + 1 >= len) {
 			fprintf(stderr, "must specify (port,queue_id)\n");
 			return;
 		}
 		tmp = strtoul(str + i + 1, NULL, 0);
 		/* If queue_id greater that what 16-bits can represent, return */
-		if(tmp > 0xffff)
+		if (tmp > 0xffff)
 			return;
 
 		queue_id = (uint16_t)tmp;
@@ -7207,7 +7208,7 @@ static void cmd_mac_addr_parsed(void
 *parsed_result,
 		ret = rte_eth_dev_mac_addr_remove(res->port_num, &res-
 >address);
 
 	/* check the return value and print it if is < 0 */
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));

}

app/test-pmd/cmdline.c +1 -1
@@ -7780,7 +7781,7 @@ static void cmd_vf_mac_addr_parsed(void
 *parsed_result,
 						res->vf_num);
 #endif
 
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
 

}

app/test-pmd/parameters.c index renamed from app/test-pmd/parameters.c +0 -0

aed4cdcb8485..7fc6d91f0210 100644

app/test-pmd/parameters.c +3 -2
@@ -306,11 +306,12 @@ parse_portnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p); @@ -366,11 +367,12 @@

parse_ringnuma_config(const char *q_arg)

app/test-pmd/parameters.c +3 -2
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p); diff --git a/app/test-

pmd/testpmd.c b/app/test-pmd/testpmd.c index aa7ea29f15ba..04b078a2938b 100644

app/test-pmd/testpmd.c +1 -2
@@ -2406,7 +2406,7 @@ start_packet_forwarding(int with_tx_first)
 
 	test_done = 0;
 
-	if(!no_flush_rx)
+	if (!no_flush_rx)
 		flush_fwd_rx_queues();
 
 	rxtx_config_display();
--

2.35.1

Reviewed-by
#38 lore raw

RE: [PATCH v3 05/14] testpmd: fix whitespace

fix

Quoted 20 lines

-----Original Message-----
From: Zhang, Yuying
Sent: 2022年11月11日 14:30
To: Stephen Hemminger <[email protected]>; [email protected]
Cc: Singh, Aman Deep <[email protected]>
Subject: RE: [PATCH v3 05/14] testpmd: fix whitespace

Quoted 11 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 2022年11月10日 7:25
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Singh, Aman Deep <[email protected]>; Zhang, Yuying <[email protected]>
Subject: [PATCH v3 05/14] testpmd: fix whitespace

Add space after keywords.

Quoted 161 lines
Quoted 15 lines
---
 app/test-pmd/cmdline.c    | 31 ++++++++++++++++---------------
 app/test-pmd/parameters.c | 10 ++++++----
 app/test-pmd/testpmd.c    |  2 +-
 3 files changed, 23 insertions(+), 20 deletions(-)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

8dc60e938830..7721006cc310 100644

app/test-pmd/cmdline.c +0 -1
@@ -2730,11 +2730,12 @@ parse_reta_config(const char *str,
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)

app/test-pmd/cmdline.c parse_reta_config(const char *str, · line 2741

Quoted 10 lines
app/test-pmd/cmdline.c +3 -1
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p); @@ -3242,15 +3243,15

@@

Quoted 11 lines

cmd_config_thresh_parsed(void *parsed_result,

app/test-pmd/cmdline.c +2 -3
 	if (!strcmp(res->name, "txpt"))
 		tx_pthresh = res->value;
-	else if(!strcmp(res->name, "txht"))
+	else if (!strcmp(res->name, "txht"))
 		tx_hthresh = res->value;
-	else if(!strcmp(res->name, "txwt"))
+	else if (!strcmp(res->name, "txwt"))
 		tx_wthresh = res->value;
-	else if(!strcmp(res->name, "rxpt"))

app/test-pmd/cmdline.c cmd_config_thresh_parsed(void *parsed_result,

Quoted 10 lines
app/test-pmd/cmdline.c +3 -2
+	else if (!strcmp(res->name, "rxpt"))
 		rx_pthresh = res->value;
-	else if(!strcmp(res->name, "rxht"))
+	else if (!strcmp(res->name, "rxht"))
 		rx_hthresh = res->value;
-	else if(!strcmp(res->name, "rxwt"))
+	else if (!strcmp(res->name, "rxwt"))
 		rx_wthresh = res->value;
 	else {
 		fprintf(stderr, "Unknown parameter\n"); @@ -4088,8 +4089,8

@@

Quoted 113 lines

cmd_vlan_offload_parsed(void *parsed_result,

app/test-pmd/cmdline.c +7 -7
 	len = strnlen(str, STR_TOKEN_SIZE);
 	i = 0;
 	/* Get port_id first */
-	while(i < len){
-		if(str[i] == ',')
+	while (i < len) {
+		if (str[i] == ',')
 			break;
 
 		i++;
@@ -4097,7 +4098,7 @@ cmd_vlan_offload_parsed(void *parsed_result,
 	str[i]='\0';
 	tmp = strtoul(str, NULL, 0);
 	/* If port_id greater that what portid_t can represent, return */
-	if(tmp >= RTE_MAX_ETHPORTS)
+	if (tmp >= RTE_MAX_ETHPORTS)
 		return;
 	port_id = (portid_t)tmp;
 
@@ -4108,17 +4109,17 @@ cmd_vlan_offload_parsed(void *parsed_result,
 
 	if (!strcmp(res->what, "strip"))
 		rx_vlan_strip_set(port_id,  on);
-	else if(!strcmp(res->what, "stripq")){
+	else if (!strcmp(res->what, "stripq")) {
 		uint16_t queue_id = 0;
 
 		/* No queue_id, return */
-		if(i + 1 >= len) {
+		if (i + 1 >= len) {
 			fprintf(stderr, "must specify (port,queue_id)\n");
 			return;
 		}
 		tmp = strtoul(str + i + 1, NULL, 0);
 		/* If queue_id greater that what 16-bits can represent, return */
-		if(tmp > 0xffff)
+		if (tmp > 0xffff)
 			return;
 
 		queue_id = (uint16_t)tmp;
@@ -7207,7 +7208,7 @@ static void cmd_mac_addr_parsed(void
 *parsed_result,
 		ret = rte_eth_dev_mac_addr_remove(res->port_num, &res-
 >address);
 
 	/* check the return value and print it if is < 0 */
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "mac_addr_cmd error: (%s)\n", strerror(-ret));

}

app/test-pmd/cmdline.c +1 -1
@@ -7780,7 +7781,7 @@ static void cmd_vf_mac_addr_parsed(void
 *parsed_result,
 						res->vf_num);
 #endif
 
-	if(ret < 0)
+	if (ret < 0)
 		fprintf(stderr, "vf_mac_addr_cmd error: (%s)\n", strerror(-ret));
 

}

app/test-pmd/parameters.c +0 -0

index
aed4cdcb8485..7fc6d91f0210 100644

app/test-pmd/parameters.c +3 -2
@@ -306,11 +306,12 @@ parse_portnuma_config(const char *q_arg)
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p); @@ -366,11 +367,12 @@

parse_ringnuma_config(const char *q_arg)

app/test-pmd/parameters.c +3 -2
 	/* reset from value set at definition */
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p); diff --git a/app/test-

pmd/testpmd.c b/app/test-pmd/testpmd.c index
aa7ea29f15ba..04b078a2938b
100644

app/test-pmd/testpmd.c +1 -2
@@ -2406,7 +2406,7 @@ start_packet_forwarding(int with_tx_first)
 
 	test_done = 0;
 
-	if(!no_flush_rx)
+	if (!no_flush_rx)
 		flush_fwd_rx_queues();
 
 	rxtx_config_display();
--

2.35.1

#39 lore raw

PATCH v3 6/14 test: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 app/test/test_cmdline_cirbuf.c |  4 ++--
 app/test/test_debug.c          |  4 ++--
 app/test/test_hash.c           |  6 +++---
 app/test/test_lpm6_perf.c      |  2 +-
 app/test/test_malloc.c         | 14 +++++++-------
 app/test/test_mbuf.c           | 14 ++++++--------
 app/test/test_ring_perf.c      |  2 +-
 app/test/test_spinlock.c       |  2 +-
 8 files changed, 23 insertions(+), 25 deletions(-)
app/test/test_cmdline_cirbuf.c +2 -2
index 8ac326cb02e0..6f7aae6df59a 100644
@@ -708,7 +708,7 @@ test_cirbuf_char_fill(void)
 		return -1;
 	}
 	/* delete buffer from tail */
-	for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
+	for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
 		cirbuf_del_tail_safe(&cb);
 	/* try to delete from an empty buffer */
 	if (cirbuf_del_tail_safe(&cb) >= 0) {
@@ -737,7 +737,7 @@ test_cirbuf_char_fill(void)
 		return -1;
 	}
 	/* delete buffer from head */
-	for(i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
+	for (i = 0; i < CMDLINE_TEST_BUFSIZE; i++)
 		cirbuf_del_head_safe(&cb);
 	/* try to delete from an empty buffer */
 	if (cirbuf_del_head_safe(&cb) >= 0) {
app/test/test_debug.c +2 -2
index 2704f5b92726..28fc2180e2b0 100644
@@ -53,7 +53,7 @@ test_panic(void)
 		return -1;
 	}
 	wait(&status);
-	if(status == 0){
+	if (status == 0) {
 		printf("Child process terminated normally!\n");
 		return -1;
 	} else
@@ -84,7 +84,7 @@ test_exit_val(int exit_val)
 	}
 	wait(&status);
 	printf("Child process status: %d\n", status);
-	if(!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val){
+	if (!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val) {
 		printf("Child process terminated with incorrect status (expected = %d)!\n",
 				exit_val);
 		return -1;
app/test/test_hash.c +3 -3
index 3e45afaa67fc..35d9d8a62ef8 100644
@@ -724,12 +724,12 @@ static int test_five_keys(void)
 	}
 
 	/* Lookup */
-	for(i = 0; i < 5; i++)
+	for (i = 0; i < 5; i++)
 		key_array[i] = &keys[i];
 
 	ret = rte_hash_lookup_bulk(handle, &key_array[0], 5, (int32_t *)pos);
-	if(ret == 0)
-		for(i = 0; i < 5; i++) {
+	if (ret == 0)
+		for (i = 0; i < 5; i++) {
 			print_key_info("Lkp", key_array[i], pos[i]);
 			RETURN_IF_ERROR(pos[i] != expected_pos[i],
 					"failed to find key (pos[%u]=%d)", i, pos[i]);
app/test/test_lpm6_perf.c +1 -1
index aaf2773b6fac..2f9321345e4b 100644
@@ -47,7 +47,7 @@ print_route_distribution(const struct rules_tbl_entry *table, uint32_t n)
 	printf("--------------------------- \n");
 
 	/* Count depths. */
-	for(i = 1; i <= 128; i++) {
+	for (i = 1; i <= 128; i++) {
 		unsigned depth_counter = 0;
 		double percent_hits;
 
app/test/test_malloc.c +7 -7
index de40e506113a..8d3750a3f1f0 100644
@@ -86,8 +86,8 @@ test_align_overlap_per_lcore(__rte_unused void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
-			if( *(char *)p1 != 0) {
+		for (j = 0; j < 1000 ; j++) {
+			if (*(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero the allocated memory\n");
 				ret = -1;
 			}
@@ -157,8 +157,8 @@ test_reordered_free_per_lcore(__rte_unused void *arg)
 			ret = -1;
 			break;
 		}
-		for(j = 0; j < 1000 ; j++) {
-			if( *(char *)p1 != 0) {
+		for (j = 0; j < 1000 ; j++) {
+			if (*(char *)p1 != 0) {
 				printf("rte_zmalloc didn't zero the allocated memory\n");
 				ret = -1;
 			}
@@ -331,12 +331,12 @@ test_multi_alloc_statistics(void)
 	/* After freeing both allocations check stats return to original */
 	rte_malloc_get_socket_stats(socket, &post_stats);
 
-	if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
+	if (second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
 		printf("Incorrect heap statistics: Total size \n");
 		return -1;
 	}
 	/* Check allocated size is equal to two additions plus overhead */
-	if(second_stats.heap_allocsz_bytes !=
+	if (second_stats.heap_allocsz_bytes !=
 			size + overhead + first_stats.heap_allocsz_bytes) {
 		printf("Incorrect heap statistics: Allocated size \n");
 		return -1;
@@ -495,7 +495,7 @@ test_realloc_socket(int socket)
 		return -1;
 	}
 	/* calc an alignment we don't already have */
-	while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
+	while (RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
 		new_align *= 2;
 	char *ptr8 = rte_realloc_socket(ptr7, size7, new_align, socket);
 	if (!ptr8){
app/test/test_mbuf.c +6 -8
index 53fe898a384c..fceacb8fead8 100644
@@ -120,7 +120,7 @@ static unsigned refcnt_lcore[RTE_MAX_LCORE];
 		printf("mbuf test FAILED (l.%d): <" str ">\n",		\
 		       __LINE__,  ##__VA_ARGS__);			\
 		goto fail;						\
-} while(0)
+} while (0)
 
 /*
  * test data manipulation in mbuf with non-ascii data
@@ -154,9 +154,7 @@ test_pktmbuf_with_non_ascii_data(struct rte_mempool *pktmbuf_pool)
 	return 0;
 
 fail:
-	if(m) {
-		rte_pktmbuf_free(m);
-	}
+	rte_pktmbuf_free(m);
 	return -1;
 }
 
@@ -701,12 +699,12 @@ test_pktmbuf_pool(struct rte_mempool *pktmbuf_pool)
 	}
 	struct rte_mbuf *extra = NULL;
 	extra = rte_pktmbuf_alloc(pktmbuf_pool);
-	if(extra != NULL) {
+	if (extra != NULL) {
 		printf("Error pool not empty");
 		ret = -1;
 	}
 	extra = rte_pktmbuf_clone(m[0], pktmbuf_pool);
-	if(extra != NULL) {
+	if (extra != NULL) {
 		printf("Error pool not empty");
 		ret = -1;
 	}
@@ -966,7 +964,7 @@ test_pktmbuf_free_segment(struct rte_mempool *pktmbuf_pool)
 			struct rte_mbuf *mb, *mt;
 
 			mb = m[i];
-			while(mb != NULL) {
+			while (mb != NULL) {
 				mt = mb;
 				mb = mb->next;
 				rte_pktmbuf_free_seg(mt);
@@ -1195,7 +1193,7 @@ verify_mbuf_check_panics(struct rte_mbuf *buf)
 		return -1;
 	}
 	wait(&status);
-	if(status == 0)
+	if (status == 0)
 		return -1;
 
 	return 0;
app/test/test_ring_perf.c +1 -1
index 2d8bb675a331..4cac9a94a73c 100644
@@ -190,7 +190,7 @@ enqueue_dequeue_bulk_helper(const unsigned int flag, const int esize,
 #else
 	if (__sync_add_and_fetch(&lcore_count, 1) != 2)
 #endif
-		while(lcore_count != 2)
+		while (lcore_count != 2)
 			rte_pause();
 
 	burst = test_ring_calloc(MAX_BURST, esize);
app/test/test_spinlock.c +1 -1
index 3f59372300c3..3ee82fa963a5 100644
@@ -237,7 +237,7 @@ test_spinlock(void)
 	/*
 	 * Try to acquire a lock that we already own
 	 */
-	if(!rte_spinlock_recursive_trylock(&slr)) {
+	if (!rte_spinlock_recursive_trylock(&slr)) {
 		printf("rte_spinlock_recursive_trylock failed on a lock that "
 		       "we already own\n");
 		ret = -1;
Signature · 1 line
2.35.1
#40 lore raw

PATCH v3 7/14 examples/qos_sched: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/qos_sched/app_thread.c | 6 +++---
 examples/qos_sched/args.c       | 2 +-
 examples/qos_sched/init.c       | 2 +-
 examples/qos_sched/main.c       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
examples/qos_sched/app_thread.c +3 -3
index dbc878b55394..a49356fecf5f 100644
@@ -79,7 +79,7 @@ app_rx_thread(struct thread_conf **confs)
 		if (likely(nb_rx != 0)) {
 			APP_STATS_ADD(conf->stat.nb_rx, nb_rx);
 
-			for(i = 0; i < nb_rx; i++) {
+			for (i = 0; i < nb_rx; i++) {
 				get_pkt_sched(rx_mbufs[i],
 						&subport, &pipe, &traffic_class, &queue, &color);
 				rte_sched_port_pkt_write(conf->sched_port,
@@ -91,7 +91,7 @@ app_rx_thread(struct thread_conf **confs)
 
 			if (unlikely(rte_ring_sp_enqueue_bulk(conf->rx_ring,
 					(void **)rx_mbufs, nb_rx, NULL) == 0)) {
-				for(i = 0; i < nb_rx; i++) {
+				for (i = 0; i < nb_rx; i++) {
 					rte_pktmbuf_free(rx_mbufs[i]);
 
 					APP_STATS_ADD(conf->stat.nb_drop, 1);
@@ -137,7 +137,7 @@ app_send_packets(struct thread_conf *qconf, struct rte_mbuf **mbufs, uint32_t nb
 	uint32_t i, len;
 
 	len = qconf->n_mbufs;
-	for(i = 0; i < nb_pkt; i++) {
+	for (i = 0; i < nb_pkt; i++) {
 		qconf->m_table[len] = mbufs[i];
 		len++;
 		/* enough pkts to be sent */
examples/qos_sched/args.c +1 -1
index b2959499ae9a..b752eb221f7c 100644
@@ -451,7 +451,7 @@ app_parse_args(int argc, char **argv)
 	/* sanity check for cores assignment */
 	nb_lcores = app_cpu_core_count();
 
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		if (qos_conf[i].rx_core >= nb_lcores) {
 			RTE_LOG(ERR, APP, "pfc %u: invalid RX lcore index %u\n", i + 1,
 					qos_conf[i].rx_core);
examples/qos_sched/init.c +1 -1
index 0709aec10c31..41b46b296298 100644
@@ -323,7 +323,7 @@ int app_init(void)
 		rte_exit(EXIT_FAILURE, "Invalid configuration profile\n");
 
 	/* Initialize each active flow */
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		uint32_t socket = rte_lcore_to_socket_id(qos_conf[i].rx_core);
 		struct rte_ring *ring;
 
examples/qos_sched/main.c +2 -2
index dc6a17a6464a..7b757df0eb02 100644
@@ -152,7 +152,7 @@ app_stat(void)
 	static struct rte_eth_stats tx_stats[MAX_DATA_STREAMS];
 
 	/* print statistics */
-	for(i = 0; i < nb_pfc; i++) {
+	for (i = 0; i < nb_pfc; i++) {
 		struct flow_conf *flow = &qos_conf[i];
 
 		rte_eth_stats_get(flow->rx_port, &stats);
@@ -212,7 +212,7 @@ main(int argc, char **argv)
 	}
 	else {
 		/* print statistics every second */
-		while(1) {
+		while (1) {
 			sleep(1);
 			app_stat();
 		}
Signature · 1 line
2.35.1
#41 lore raw

PATCH v3 8/14 examples/vhost: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/vhost/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
examples/vhost/main.c +3 -4
index 42e53a0f9a4f..9fee966916e9 100644
@@ -1491,7 +1491,7 @@ switch_worker(void *arg __rte_unused)
 		}
 	}
 
-	while(1) {
+	while (1) {
 		drain_mbuf_table(tx_q);
 		drain_vhost_table();
 		/*
@@ -1583,9 +1583,8 @@ destroy_device(int vid)
 		return;
 	/*set the remove flag. */
 	vdev->remove = 1;
-	while(vdev->ready != DEVICE_SAFE_REMOVE) {
+	while (vdev->ready != DEVICE_SAFE_REMOVE)
 		rte_pause();
-	}
 
 	for (i = 0; i < RTE_MAX_LCORE; i++)
 		rte_free(vhost_txbuff[i * RTE_MAX_VHOST_DEVICE + vid]);
@@ -1816,7 +1815,7 @@ print_stats(__rte_unused void *arg)
 	const char clr[] = { 27, '[', '2', 'J', '\0' };
 	const char top_left[] = { 27, '[', '1', ';', '1', 'H','\0' };
 
-	while(1) {
+	while (1) {
 		sleep(enable_stats);
 
 		/* Clear screen and move to top left */
Signature · 1 line
2.35.1
Reviewed-by on v3 8/14
#42 lore raw

RE: [PATCH v3 08/14] examples/vhost: fix whitespace

Quoted 49 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, November 10, 2022 7:25 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Maxime Coquelin <[email protected]>; Xia, Chenbo <[email protected]>
Subject: [PATCH v3 08/14] examples/vhost: fix whitespace

Add space after keywords.

---
 examples/vhost/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
examples/vhost/main.c +3 -5
index 42e53a0f9a4f..9fee966916e9 100644
@@ -1491,7 +1491,7 @@ switch_worker(void *arg __rte_unused)
 		}
 	}
 
-	while(1) {
+	while (1) {
 		drain_mbuf_table(tx_q);
 		drain_vhost_table();
 		/*
@@ -1583,9 +1583,8 @@ destroy_device(int vid)
 		return;
 	/*set the remove flag. */
 	vdev->remove = 1;
-	while(vdev->ready != DEVICE_SAFE_REMOVE) {
+	while (vdev->ready != DEVICE_SAFE_REMOVE)
 		rte_pause();
-	}
 
 	for (i = 0; i < RTE_MAX_LCORE; i++)
 		rte_free(vhost_txbuff[i * RTE_MAX_VHOST_DEVICE + vid]);
@@ -1816,7 +1815,7 @@ print_stats(__rte_unused void *arg)
 	const char clr[] = { 27, '[', '2', 'J', '\0' };
 	const char top_left[] = { 27, '[', '1', ';', '1', 'H','\0' };
 
-	while(1) {
+	while (1) {
 		sleep(enable_stats);
 
 		/* Clear screen and move to top left */
--
Quoted 1 line

2.35.1

#43 lore raw

PATCH v3 9/14 l3fwd: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/l3fwd-power/main.c | 7 ++++---
 examples/l3fwd/main.c       | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
examples/l3fwd-power/main.c +4 -3
index fd3ade330f82..7bd5d8cb2281 100644
@@ -1787,11 +1787,12 @@ parse_config(const char *q_arg)
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -2946,7 +2947,7 @@ main(int argc, char **argv)
 		fflush(stdout);
 
 		/* init RX queues */
-		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
examples/l3fwd/main.c +4 -3
index 5198ff30dd00..2b8575137d50 100644
@@ -516,11 +516,12 @@ parse_config(const char *q_arg)
 
 	while ((p = strchr(p0,'(')) != NULL) {
 		++p;
-		if((p0 = strchr(p,')')) == NULL)
+		p0 = strchr(p, ')');
+		if (p0 == NULL)
 			return -1;
 
 		size = p0 - p;
-		if(size >= sizeof(s))
+		if (size >= sizeof(s))
 			return -1;
 
 		snprintf(s, sizeof(s), "%.*s", size, p);
@@ -1366,7 +1367,7 @@ l3fwd_poll_resource_setup(void)
 		printf("\nInitializing rx queues on lcore %u ... ", lcore_id );
 		fflush(stdout);
 		/* init RX queues */
-		for(queue = 0; queue < qconf->n_rx_queue; ++queue) {
+		for (queue = 0; queue < qconf->n_rx_queue; ++queue) {
 			struct rte_eth_rxconf rxq_conf;
 
 			portid = qconf->rx_queue_list[queue].port_id;
Signature · 1 line
2.35.1
#44 lore raw

PATCH v3 10/14 examples: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 examples/cmdline/parse_obj_list.c          | 2 +-
 examples/ip_reassembly/main.c              | 2 +-
 examples/multi_process/symmetric_mp/main.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
examples/cmdline/parse_obj_list.c +1 -1
index 959bcd14527e..759072d39620 100644
@@ -42,7 +42,7 @@ parse_obj_list(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	if (res && ressize < sizeof(struct object *))
 		return -1;
 
-	while(!cmdline_isendoftoken(buf[token_len]))
+	while (!cmdline_isendoftoken(buf[token_len]))
 		token_len++;
 
 	SLIST_FOREACH(o, tkd->list, next) {
examples/ip_reassembly/main.c +1 -1
index bd0b1d31decf..7e84b4944759 100644
@@ -300,7 +300,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port)
 
 	TX_LCORE_STAT_UPDATE(&qconf->tx_stat, queue, 1);
 	txmb->m_table[txmb->head] = m;
-	if(++txmb->head == len)
+	if (++txmb->head == len)
 		txmb->head = 0;
 
 	return 0;
examples/multi_process/symmetric_mp/main.c +3 -3
index 1ff85875dfdf..2f4441049253 100644
@@ -156,7 +156,7 @@ smp_parse_args(int argc, char **argv)
 
 	/* get the port numbers from the port mask */
 	RTE_ETH_FOREACH_DEV(i)
-		if(port_mask & (1 << i))
+		if (port_mask & (1 << i))
 			ports[num_ports++] = (uint8_t)i;
 
 	ret = optind-1;
@@ -470,8 +470,8 @@ main(int argc, char **argv)
 	/* Primary instance initialized. 8< */
 	if (num_ports & 1)
 		rte_exit(EXIT_FAILURE, "Application must use an even number of ports\n");
-	for(i = 0; i < num_ports; i++){
-		if(proc_type == RTE_PROC_PRIMARY)
+	for (i = 0; i < num_ports; i++) {
+		if (proc_type == RTE_PROC_PRIMARY)
 			if (smp_port_init(ports[i], mp, (uint16_t)num_procs) < 0)
 				rte_exit(EXIT_FAILURE, "Error initialising ports\n");
 	}
Signature · 1 line
2.35.1
#45 lore raw

PATCH v3 11/14 bus/pci: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/bus/pci/bsd/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/pci/bsd/pci.c +1 -1
index 7459d15c7e31..056e2eda2d5f 100644
@@ -368,7 +368,7 @@ rte_pci_scan(void)
 		}
 
 		dev_count += conf_io.num_matches;
-	} while(conf_io.status == PCI_GETCONF_MORE_DEVS);
+	} while (conf_io.status == PCI_GETCONF_MORE_DEVS);
 
 	close(fd);
 
Signature · 1 line
2.35.1
#46 lore raw

PATCH v3 12/14 net/e1000: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/e1000/em_ethdev.c  | 4 ++--
 drivers/net/e1000/igb_ethdev.c | 8 ++++----
 drivers/net/e1000/igb_pf.c     | 2 +-
 drivers/net/e1000/igb_rxtx.c   | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/e1000/em_ethdev.c +2 -2
index 8ee9be12ad19..146e74cfc76e 100644
@@ -872,8 +872,8 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
 			E1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);
 	int pause_frames;
 
-	if(hw->phy.media_type == e1000_media_type_copper ||
-			(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
+	if (hw->phy.media_type == e1000_media_type_copper ||
+	    (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		stats->symerrs += E1000_READ_REG(hw,E1000_SYMERRS);
 		stats->sec += E1000_READ_REG(hw, E1000_SEC);
 	}
drivers/net/e1000/igb_ethdev.c +4 -4
index 8858f975f8cc..67e82d708964 100644
@@ -1683,7 +1683,7 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
 	uint64_t old_rpthc = stats->rpthc;
 	uint64_t old_hgptc = stats->hgptc;
 
-	if(hw->phy.media_type == e1000_media_type_copper ||
+	if (hw->phy.media_type == e1000_media_type_copper ||
 	    (E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
 		stats->symerrs +=
 		    E1000_READ_REG(hw,E1000_SYMERRS);
@@ -3500,10 +3500,10 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)
 
 	for (i = 0; i < IGB_VFTA_SIZE; i++){
 		vfta = shadow_vfta->vfta[i];
-		if(vfta){
+		if (vfta) {
 			mask = 1;
 			for (j = 0; j < 32; j++){
-				if(vfta & mask)
+				if (vfta & mask)
 					igbvf_set_vfta(hw,
 						(uint16_t)((i<<5)+j), on);
 				mask<<=1;
@@ -3528,7 +3528,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 
 	/*vind is not used in VF driver, set to 0, check ixgbe_set_vfta_vf*/
 	ret = igbvf_set_vfta(hw, vlan_id, !!on);
-	if(ret){
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Unable to set VF vlan");
 		return ret;
 	}
drivers/net/e1000/igb_pf.c +1 -1
index c7588ea57eaa..b1f74eb841d2 100644
@@ -78,7 +78,7 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
 
 	if (hw->mac.type == e1000_i350)
 		nb_queue = 1;
-	else if(hw->mac.type == e1000_82576)
+	else if (hw->mac.type == e1000_82576)
 		/* per datasheet, it should be 2, but 1 seems correct */
 		nb_queue = 1;
 	else
drivers/net/e1000/igb_rxtx.c +1 -1
index f32dee46df82..f5677da6b931 100644
@@ -2276,7 +2276,7 @@ igb_dev_mq_rx_configure(struct rte_eth_dev *dev)
 		/* 011b Def_Q ignore, according to VT_CTL.DEF_PL */
 		mrqc |= 0x3 << E1000_MRQC_DEF_Q_SHIFT;
 		E1000_WRITE_REG(hw, E1000_MRQC, mrqc);
-	} else if(RTE_ETH_DEV_SRIOV(dev).active == 0) {
+	} else if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
 		/*
 		 * SRIOV inactive scheme
 		 */
Signature · 1 line
2.35.1
#47 lore raw

PATCH v3 13/14 net/i40e: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/i40e/i40e_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -4
index 15d9ff868f3a..7050e0057d8e 100644
@@ -956,7 +956,7 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf *vf,
 
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_add_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
 
@@ -996,7 +996,7 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf *vf,
 	vid = vlan_filter_list->vlan_id;
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_delete_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
 
@@ -1577,12 +1577,12 @@ i40e_pf_host_init(struct rte_eth_dev *dev)
 	 * return if SRIOV not enabled, VF number not configured or
 	 * no queue assigned.
 	 */
-	if(!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
 		return I40E_SUCCESS;
 
 	/* Allocate memory to store VF structure */
 	pf->vfs = rte_zmalloc("i40e_pf_vf",sizeof(*pf->vfs) * pf->vf_num, 0);
-	if(pf->vfs == NULL)
+	if (pf->vfs == NULL)
 		return -ENOMEM;
 
 	/* Disable irq0 for VFR event */
Signature · 1 line
2.35.1
#48 lore raw

RE: [PATCH v3 13/14] net/i40e: fix whitespace

Hi,

Could you add fix line and Cc: [email protected]?
The fix looks good to me.

Quoted 11 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 2022年11月10日 7:25
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v3 13/14] net/i40e: fix whitespace

Add space after keywords.

Quoted 46 lines
---
 drivers/net/i40e/i40e_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c index renamed from drivers/net/i40e/i40e_pf.c +0 -0

15d9ff868f3a..7050e0057d8e 100644

drivers/net/i40e/i40e_pf.c +5 -5
@@ -956,7 +956,7 @@ i40e_pf_host_process_cmd_add_vlan(struct i40e_pf_vf
 *vf,
 
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_add_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
@@ -996,7 +996,7 @@ i40e_pf_host_process_cmd_del_vlan(struct i40e_pf_vf
 *vf,
 	vid = vlan_filter_list->vlan_id;
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_delete_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
@@ -1577,12 +1577,12 @@ i40e_pf_host_init(struct rte_eth_dev *dev)
 	 * return if SRIOV not enabled, VF number not configured or
 	 * no queue assigned.
 	 */
-	if(!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps ==
+0)
 		return I40E_SUCCESS;
 
 	/* Allocate memory to store VF structure */
 	pf->vfs = rte_zmalloc("i40e_pf_vf",sizeof(*pf->vfs) * pf->vf_num, 0);
-	if(pf->vfs == NULL)
+	if (pf->vfs == NULL)
 		return -ENOMEM;
 
 	/* Disable irq0 for VFR event */
--

2.35.1

Reviewed-by
#49 lore raw

RE: [PATCH v3 13/14] net/i40e: fix whitespace

fix

Quoted 7 lines

-----Original Message-----
From: Zhang, Yuying
Sent: 2022年11月11日 14:24
To: Stephen Hemminger <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>
Subject: RE: [PATCH v3 13/14] net/i40e: fix whitespace

Quoted 16 lines

Hi,

Could you add fix line and Cc: [email protected]?
The fix looks good to me.

Quoted 11 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: 2022年11月10日 7:25
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v3 13/14] net/i40e: fix whitespace

Add space after keywords.

Quoted 46 lines
Quoted 46 lines
---
 drivers/net/i40e/i40e_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +5 -5
index 15d9ff868f3a..7050e0057d8e 100644
@@ -956,7 +956,7 @@ i40e_pf_host_process_cmd_add_vlan(struct
 i40e_pf_vf *vf,
 
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_add_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
@@ -996,7 +996,7 @@ i40e_pf_host_process_cmd_del_vlan(struct
 i40e_pf_vf *vf,
 	vid = vlan_filter_list->vlan_id;
 	for (i = 0; i < vlan_filter_list->num_elements; i++) {
 		ret = i40e_vsi_delete_vlan(vf->vsi, vid[i]);
-		if(ret != I40E_SUCCESS)
+		if (ret != I40E_SUCCESS)
 			goto send_msg;
 	}
@@ -1577,12 +1577,12 @@ i40e_pf_host_init(struct rte_eth_dev *dev)
 	 * return if SRIOV not enabled, VF number not configured or
 	 * no queue assigned.
 	 */
-	if(!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps == 0)
+	if (!hw->func_caps.sr_iov_1_1 || pf->vf_num == 0 || pf->vf_nb_qps ==
+0)
 		return I40E_SUCCESS;
 
 	/* Allocate memory to store VF structure */
 	pf->vfs = rte_zmalloc("i40e_pf_vf",sizeof(*pf->vfs) * pf->vf_num, 0);
-	if(pf->vfs == NULL)
+	if (pf->vfs == NULL)
 		return -ENOMEM;
 
 	/* Disable irq0 for VFR event */
--

2.35.1

#51 lore raw

PATCH v3 14/14 net/bnx2x: fix whitespace

In reply to Stephen Hemminger

Add space after keywords.

---
 drivers/net/bnx2x/bnx2x.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnx2x/bnx2x.h +1 -1
index 89414ac88a93..9cb927e25449 100644
@@ -96,7 +96,7 @@ int bnx2x_ilog2(int x)
 	int log = 0;
 	x >>= 1;
 
-	while(x) {
+	while (x) {
 		log++;
 		x >>= 1;
 	}
Signature · 1 line
2.35.1