space after keyword cleanups
cover space after keyword cleanups
These are the results of a script replacing 'if(' with 'if (' in various places.
Stephen Hemminger (7):
test: fix whitespace
testpmd: fix whitespace
net/e1000: fix whitespace
i40e: fix whitespace
examples: fix whitespace
cmdline: fix whitespace
ip_frag: fix whitespace
app/test-pmd/cmdline.c | 30 +++++++++++----------- app/test-pmd/parameters.c | 8 +++--- app/test-pmd/testpmd.c | 2 +- app/test/test_debug.c | 4 +-- app/test/test_hash.c | 6 ++--- app/test/test_malloc.c | 10 ++++---- app/test/test_mbuf.c | 12 ++++----- app/test/test_spinlock.c | 2 +- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 8 +++--- drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 ++--- drivers/net/i40e/i40e_pf.c | 8 +++--- examples/ip_reassembly/main.c | 2 +- examples/l3fwd-power/main.c | 4 +-- examples/l3fwd/main.c | 4 +-- examples/multi_process/symmetric_mp/main.c | 4 +-- lib/cmdline/cmdline_rdline.c | 6 ++--- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 19 files changed, 61 insertions(+), 61 deletions(-)
Signature · 1 line
2.39.0
PATCH 1/7 test: fix whitespace
The style standard is to use blank after keywords. I.e "if (" not "if("
--- app/test/test_debug.c | 4 ++-- app/test/test_hash.c | 6 +++--- app/test/test_malloc.c | 10 +++++----- app/test/test_mbuf.c | 12 ++++++------ app/test/test_spinlock.c | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-)
app/test/test_debug.c +2 -2
@@ -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
@@ -50,7 +50,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,if (handle)rte_hash_free (handle); \return -1 ; \ } \ -} while(0) +} while (0)#define RETURN_IF_ERROR_FBK (cond, str, ...) do { \ if (cond) { \
@@ -58,7 +58,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,if (handle)rte_fbk_hash_free (handle); \return -1 ; \ } \ -} while(0) +} while (0)#define RETURN_IF_ERROR_RCU_QSBR (cond, str, ...) do { \ if (cond) { \
@@ -728,7 +728,7 @@ static int test_five_keys(void) key_array[i] = &keys[i]; ret =rte_hash_lookup_bulk (handle, &key_array[0 ],5 , (int32_t *)pos); -if (ret ==0 ) +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],
app/test/test_malloc.c +5 -5
@@ -87,7 +87,7 @@ test_align_overlap_per_lcore(__rte_unused void *arg)break ; }for (j =0 ; j <1000 ; j++) { -if ( *(char *)p1 !=0 ) { +if ( *(char *)p1 !=0 ) {printf ("rte_zmalloc didn't zero the allocated memory\n" ); ret =-1 ; }
@@ -158,7 +158,7 @@ test_reordered_free_per_lcore(__rte_unused void *arg)break ; }for (j =0 ; j <1000 ; j++) { -if ( *(char *)p1 !=0 ) { +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
@@ -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
@@ -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.39.0
PATCH 2/7 testpmd: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- 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
@@ -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" );
@@ -4084,8 +4084,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++;
@@ -4093,7 +4093,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;
@@ -4104,17 +4104,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;
@@ -7252,7 +7252,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)); }
@@ -7825,7 +7825,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
@@ -308,11 +308,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);
@@ -368,11 +368,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
@@ -2408,7 +2408,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.39.0
PATCH 3/7 net/e1000: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 8 ++++---- drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/e1000/em_ethdev.c +1 -1
@@ -872,7 +872,7 @@ 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 || +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
@@ -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
@@ -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 +3 -3
@@ -196,13 +196,13 @@ struct igb_tx_queue {#ifdef RTE_PMD_USE_PREFETCH #define rte_igb_prefetch (p) rte_prefetch0(p)#else -#define rte_igb_prefetch (p) do {} while(0) +#define rte_igb_prefetch (p) do {} while (0)#endif #ifdef RTE_PMD_PACKET_PREFETCH #define rte_packet_prefetch (p) rte_prefetch1(p)#else -#define rte_packet_prefetch (p) do {} while(0) +#define rte_packet_prefetch (p) do {} while (0)#endif /*
@@ -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.39.0
PATCH 4/7 i40e: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- drivers/net/i40e/i40e_pf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -4
@@ -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.39.0
PATCH 5/7 examples: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- examples/ip_reassembly/main.c | 2 +- examples/l3fwd-power/main.c | 4 ++-- examples/l3fwd/main.c | 4 ++-- examples/multi_process/symmetric_mp/main.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
examples/ip_reassembly/main.c +1 -1
@@ -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/l3fwd-power/main.c +2 -2
@@ -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);
examples/l3fwd/main.c +2 -2
@@ -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);
examples/multi_process/symmetric_mp/main.c +2 -2
@@ -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 ;
@@ -471,7 +471,7 @@ main(int argc, char **argv)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 ) +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.39.0
PATCH 6/7 cmdline: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- lib/cmdline/cmdline_rdline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/cmdline/cmdline_rdline.c +3 -3
@@ -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.39.0
PATCH 7/7 ip_frag: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ip_frag/rte_ipv4_reassembly.c +1 -1
@@ -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.39.0
v2 cover space after keyword cleanups
In reply to Stephen HemmingerThese are the results of a script replacing 'if(' with 'if (' in various places.
v2 - fix related style changes on same lines reported by checkpatch
Stephen Hemminger (7):
test: fix whitespace
testpmd: fix whitespace
net/e1000: fix whitespace
i40e: fix whitespace
examples: fix whitespace
cmdline: fix whitespace
ip_frag: fix whitespace
app/test-pmd/cmdline.c | 33 +++++++++++----------- app/test-pmd/parameters.c | 11 ++++---- app/test-pmd/testpmd.c | 2 +- app/test/test_cmdline_cirbuf.c | 4 +-- app/test/test_debug.c | 6 ++-- app/test/test_hash.c | 10 +++---- app/test/test_lpm6_perf.c | 2 +- app/test/test_malloc.c | 14 ++++----- app/test/test_mbuf.c | 15 +++++----- app/test/test_ring_perf.c | 2 +- app/test/test_spinlock.c | 2 +- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 16 +++++------ drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 ++-- drivers/net/i40e/i40e_pf.c | 8 +++--- examples/ip_reassembly/main.c | 2 +- examples/l3fwd-power/main.c | 7 +++-- examples/l3fwd/main.c | 7 +++-- examples/multi_process/symmetric_mp/main.c | 4 +-- lib/cmdline/cmdline_rdline.c | 12 ++++---- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 22 files changed, 86 insertions(+), 83 deletions(-)
Signature · 1 line
2.39.0
PATCH v2 1/7 test: fix whitespace
The style standard is to use blank after keywords. I.e "if (" not "if("
--- app/test/test_cmdline_cirbuf.c | 4 ++-- app/test/test_debug.c | 6 +++--- app/test/test_hash.c | 10 +++++----- app/test/test_lpm6_perf.c | 2 +- app/test/test_malloc.c | 14 +++++++------- app/test/test_mbuf.c | 15 +++++++-------- app/test/test_ring_perf.c | 2 +- app/test/test_spinlock.c | 2 +- 8 files changed, 27 insertions(+), 28 deletions(-)
app/test/test_cmdline_cirbuf.c +2 -2
@@ -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 +3 -3
@@ -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
@@ -78,13 +78,13 @@ test_exit_val(int exit_val)if (pid ==0 )rte_exit (exit_val, __func__); -else if (pid <0 ){ +else if (pid <0 ) {printf ("Fork Failed\n" );return -1 ; }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 +5 -5
@@ -50,7 +50,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,if (handle)rte_hash_free (handle); \return -1 ; \ } \ -} while(0) +} while (0)#define RETURN_IF_ERROR_FBK (cond, str, ...) do { \ if (cond) { \
@@ -58,7 +58,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,if (handle)rte_fbk_hash_free (handle); \return -1 ; \ } \ -} while(0) +} while (0)#define RETURN_IF_ERROR_RCU_QSBR (cond, str, ...) do { \ if (cond) { \
@@ -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
@@ -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
@@ -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 +7 -8
@@ -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,8 @@ 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 +700,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 +965,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 +1194,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
@@ -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
@@ -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.39.0
PATCH v2 2/7 testpmd: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- app/test-pmd/cmdline.c | 33 +++++++++++++++++---------------- app/test-pmd/parameters.c | 11 ++++++----- app/test-pmd/testpmd.c | 2 +- 3 files changed, 24 insertions(+), 22 deletions(-)
app/test-pmd/cmdline.c +17 -16
@@ -2728,13 +2728,14 @@ parse_reta_config(const char *str,unsigned long int_fld[_NUM_FLD];char *str_fld[_NUM_FLD]; -while ((p =strchr (p0,'(' )) !=NULL ) { +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" );
@@ -4084,8 +4085,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++;
@@ -4093,7 +4094,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;
@@ -4104,17 +4105,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;
@@ -7252,7 +7253,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)); }
@@ -7825,7 +7826,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 -5
@@ -306,13 +306,14 @@ parse_portnuma_config(const char *q_arg)char *str_fld[_NUM_FLD];/* reset from value set at definition */ -while ((p =strchr (p0,'(' )) !=NULL ) { +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);
@@ -368,11 +369,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
@@ -2408,7 +2408,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.39.0
PATCH v2 3/7 net/e1000: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 16 ++++++++-------- drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/e1000/em_ethdev.c +1 -1
@@ -872,7 +872,7 @@ 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 || +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 +8 -8
@@ -735,7 +735,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ){ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {if (eth_dev->data->scattered_rx) eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts;return 0 ;
@@ -927,7 +927,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ){ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {if (eth_dev->data->scattered_rx) eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts;return 0 ;
@@ -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 );
@@ -3498,12 +3498,12 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)E1000_DEV_PRIVATE_TO_VFTA (dev->data->dev_private);int i =0 , j =0 , vfta =0 , mask =1 ; -for (i =0 ; i <IGB_VFTA_SIZE ; i++){ +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) +for (j =0 ; j <32 ; j++) { +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
@@ -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 +3 -3
@@ -196,13 +196,13 @@ struct igb_tx_queue {#ifdef RTE_PMD_USE_PREFETCH #define rte_igb_prefetch (p) rte_prefetch0(p)#else -#define rte_igb_prefetch (p) do {} while(0) +#define rte_igb_prefetch (p) do {} while (0)#endif #ifdef RTE_PMD_PACKET_PREFETCH #define rte_packet_prefetch (p) rte_prefetch1(p)#else -#define rte_packet_prefetch (p) do {} while(0) +#define rte_packet_prefetch (p) do {} while (0)#endif /*
@@ -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.39.0
PATCH v2 4/7 i40e: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- drivers/net/i40e/i40e_pf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -4
@@ -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.39.0
PATCH v2 5/7 examples: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- examples/ip_reassembly/main.c | 2 +- examples/l3fwd-power/main.c | 7 ++++--- examples/l3fwd/main.c | 7 ++++--- examples/multi_process/symmetric_mp/main.c | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-)
examples/ip_reassembly/main.c +1 -1
@@ -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/l3fwd-power/main.c +4 -3
@@ -1785,13 +1785,14 @@ parse_config(const char *q_arg) nb_lcore_params =0 ; -while ((p =strchr (p0,'(' )) !=NULL ) { +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);
examples/l3fwd/main.c +4 -3
@@ -514,13 +514,14 @@ parse_config(const char *q_arg) nb_lcore_params =0 ; -while ((p =strchr (p0,'(' )) !=NULL ) { +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);
examples/multi_process/symmetric_mp/main.c +2 -2
@@ -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 ;
@@ -471,7 +471,7 @@ main(int argc, char **argv)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 ) +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.39.0
PATCH v2 6/7 cmdline: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- lib/cmdline/cmdline_rdline.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
lib/cmdline/cmdline_rdline.c +6 -6
@@ -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.39.0
PATCH v2 7/7 ip_frag: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ip_frag/rte_ipv4_reassembly.c +1 -1
@@ -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.39.0
v3 cover add space after keywords
In reply to Stephen HemmingerThese are the results of a script replacing 'if(' with 'if (' in various places.
v3 - more checkpatch fallout
also fix places where 'for(' is used.
Stephen Hemminger (7):
test: fix whitespace
testpmd: fix whitespace
net/e1000: fix whitespace
i40e: fix whitespace
examples: fix whitespace
cmdline: fix whitespace
ip_frag: fix whitespace
app/test-pmd/cmdline.c | 33 +++++++++++----------- app/test-pmd/parameters.c | 12 ++++---- app/test-pmd/testpmd.c | 2 +- app/test/test_cmdline_cirbuf.c | 4 +-- app/test/test_debug.c | 6 ++-- app/test/test_hash.c | 10 +++---- app/test/test_lpm6_perf.c | 2 +- app/test/test_malloc.c | 14 ++++----- app/test/test_mbuf.c | 15 +++++----- app/test/test_ring_perf.c | 2 +- app/test/test_spinlock.c | 2 +- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 16 +++++------ drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 ++-- drivers/net/i40e/i40e_pf.c | 8 +++--- examples/ip_reassembly/main.c | 2 +- examples/l3fwd-power/main.c | 9 +++--- examples/l3fwd/main.c | 9 +++--- 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 | 2 +- lib/cmdline/cmdline_rdline.c | 12 ++++---- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 26 files changed, 96 insertions(+), 92 deletions(-)
Signature · 1 line
2.39.0
PATCH v3 1/7 test: fix whitespace
The style standard is to use blank after keywords. I.e "if (" not "if("
--- app/test/test_cmdline_cirbuf.c | 4 ++-- app/test/test_debug.c | 6 +++--- app/test/test_hash.c | 10 +++++----- app/test/test_lpm6_perf.c | 2 +- app/test/test_malloc.c | 14 +++++++------- app/test/test_mbuf.c | 15 +++++++-------- app/test/test_ring_perf.c | 2 +- app/test/test_spinlock.c | 2 +- 8 files changed, 27 insertions(+), 28 deletions(-)
app/test/test_cmdline_cirbuf.c +2 -2
@@ -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 +3 -3
@@ -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
@@ -78,13 +78,13 @@ test_exit_val(int exit_val)if (pid ==0 )rte_exit (exit_val, __func__); -else if (pid <0 ){ +else if (pid <0 ) {printf ("Fork Failed\n" );return -1 ; }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 +5 -5
@@ -50,7 +50,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,if (handle)rte_hash_free (handle); \return -1 ; \ } \ -} while(0) +} while (0)#define RETURN_IF_ERROR_FBK (cond, str, ...) do { \ if (cond) { \
@@ -58,7 +58,7 @@ static uint32_t hashtest_key_lens[] = {0, 2, 4, 5, 6, 7, 8, 10, 11, 15, 16, 21,if (handle)rte_fbk_hash_free (handle); \return -1 ; \ } \ -} while(0) +} while (0)#define RETURN_IF_ERROR_RCU_QSBR (cond, str, ...) do { \ if (cond) { \
@@ -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
@@ -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
@@ -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 +7 -8
@@ -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,8 @@ 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 +700,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 +965,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 +1194,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
@@ -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
@@ -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.39.0
PATCH v3 2/7 testpmd: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- app/test-pmd/cmdline.c | 33 +++++++++++++++++---------------- app/test-pmd/parameters.c | 12 +++++++----- app/test-pmd/testpmd.c | 2 +- 3 files changed, 25 insertions(+), 22 deletions(-)
app/test-pmd/cmdline.c +17 -16
@@ -2728,13 +2728,14 @@ parse_reta_config(const char *str,unsigned long int_fld[_NUM_FLD];char *str_fld[_NUM_FLD]; -while ((p =strchr (p0,'(' )) !=NULL ) { +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" );
@@ -4084,8 +4085,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++;
@@ -4093,7 +4094,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;
@@ -4104,17 +4105,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;
@@ -7252,7 +7253,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)); }
@@ -7825,7 +7826,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 +7 -5
@@ -306,13 +306,14 @@ parse_portnuma_config(const char *q_arg)char *str_fld[_NUM_FLD];/* reset from value set at definition */ -while ((p =strchr (p0,'(' )) !=NULL ) { +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);
@@ -368,11 +369,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
@@ -2408,7 +2408,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.39.0
Re: [PATCH v3 2/7] testpmd: fix whitespace
Quoted 4 lines · Stephen Hemminger
The style standard is to use blank after keywords. I.e "if (" not "if("
Signed-off-by Stephen Hemminger <[email protected]>
<snip>
PATCH v3 3/7 net/e1000: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 16 ++++++++-------- drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/e1000/em_ethdev.c +1 -1
@@ -872,7 +872,7 @@ 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 || +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 +8 -8
@@ -735,7 +735,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ){ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {if (eth_dev->data->scattered_rx) eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts;return 0 ;
@@ -927,7 +927,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ){ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {if (eth_dev->data->scattered_rx) eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts;return 0 ;
@@ -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 );
@@ -3498,12 +3498,12 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on)E1000_DEV_PRIVATE_TO_VFTA (dev->data->dev_private);int i =0 , j =0 , vfta =0 , mask =1 ; -for (i =0 ; i <IGB_VFTA_SIZE ; i++){ +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) +for (j =0 ; j <32 ; j++) { +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
@@ -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 +3 -3
@@ -196,13 +196,13 @@ struct igb_tx_queue {#ifdef RTE_PMD_USE_PREFETCH #define rte_igb_prefetch (p) rte_prefetch0(p)#else -#define rte_igb_prefetch (p) do {} while(0) +#define rte_igb_prefetch (p) do {} while (0)#endif #ifdef RTE_PMD_PACKET_PREFETCH #define rte_packet_prefetch (p) rte_prefetch1(p)#else -#define rte_packet_prefetch (p) do {} while(0) +#define rte_packet_prefetch (p) do {} while (0)#endif /*
@@ -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.39.0
RE: [PATCH v3 3/7] net/e1000: fix whitespace
Quoted 11 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, January 17, 2023 8:15 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Su, Simei <[email protected]>; Wu, Wenjun1 <[email protected]>; Burakov, Anatoly <[email protected]>
Subject: [PATCH v3 3/7] net/e1000: fix whitespace
Quoted 4 lines
The style standard is to use blank after keywords. I.e "if (" not "if("
Signed-off-by Stephen Hemminger <[email protected]>
RE: [PATCH v3 3/7] net/e1000: fix whitespace
In reply to Stephen HemmingerQuoted 136 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, January 17, 2023 8:15 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Su, Simei <[email protected]>; Wu, Wenjun1 <[email protected]>; Burakov, Anatoly <[email protected]>
Subject: [PATCH v3 3/7] net/e1000: fix whitespaceThe style standard is to use blank after keywords. I.e "if (" not "if("
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 16 ++++++++-------- drivers/net/e1000/igb_pf.c | 2 +- drivers/net/e1000/igb_rxtx.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-)drivers/net/e1000/em_ethdev.c +1
-1@@ -872,7 +872,7 @@ 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 || +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); diff --gita/drivers/net/e1000/igb_ethdev.cb/drivers/net/e1000/igb_ethdev.cindex8858f975f8cc..e89bfa248fb0100644drivers/net/e1000/igb_ethdev.c +3
-3@@ -735,7 +735,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ){ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {if (eth_dev->data->scattered_rx) eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts;return 0 ;@@ -927,7 +927,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)/* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different * RX function */ -if (rte_eal_process_type () !=RTE_PROC_PRIMARY ){ +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) {if (eth_dev->data->scattered_rx) eth_dev->rx_pkt_burst = ð_igb_recv_scattered_pkts;return 0 ;@@ -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 +=drivers/net/e1000/igb_ethdev.c +6
-5E1000_READ_REG(hw,E1000_SYMERRS); @@ -3498,12 +3498,12 @@ static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on) E1000_DEV_PRIVATE_TO_VFTA(dev->data->dev_private);int i =0 , j =0 , vfta =0 , mask =1 ; -for (i =0 ; i <IGB_VFTA_SIZE ; i++){ +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) +for (j =0 ; j <32 ; j++) { +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_ethdev.c +0
-0}drivers/net/e1000/igb_pf.c index renamed from drivers/net/e1000/igb_pf.c +0
-0
c7588ea57eaa..b1f74eb841d2100644drivers/net/e1000/igb_pf.c +1
-1@@ -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 index renamed from drivers/net/e1000/igb_rxtx.c +0
-0
f32dee46df82..2d4a1292053e100644drivers/net/e1000/igb_rxtx.c +0
-0@@ -196,13 +196,13 @@ struct igb_tx_queue { #ifdef
RTE_PMD_USE_PREFETCH
#definerte_igb_prefetch(p)rte_prefetch0(p)
#elsedrivers/net/e1000/igb_rxtx.c +3
-4-#define rte_igb_prefetch (p) do {} while(0) +#define rte_igb_prefetch (p) do {} while (0)#endif #ifdef RTE_PMD_PACKET_PREFETCH #define rte_packet_prefetch (p) rte_prefetch1(p) #else -#define rte_packet_prefetch (p) do {} while(0) +#define rte_packet_prefetch (p) do {} while (0)#endif /* @@ -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 */ --
Quoted 1 line
2.39.0
Thanks
Simei
PATCH v3 4/7 i40e: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- drivers/net/i40e/i40e_pf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/i40e/i40e_pf.c +4 -4
@@ -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.39.0
RE: [PATCH v3 4/7] i40e: fix whitespace
Quoted 10 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, January 17, 2023 8:15 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v3 4/7] i40e: fix whitespace
Quoted 4 lines
The style standard is to use blank after keywords. I.e "if (" not "if("
Signed-off-by Stephen Hemminger <[email protected]>
PATCH v3 5/7 examples: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- examples/ip_reassembly/main.c | 2 +- examples/l3fwd-power/main.c | 9 +++++---- examples/l3fwd/main.c | 9 +++++---- 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 | 2 +- 8 files changed, 20 insertions(+), 18 deletions(-)
examples/ip_reassembly/main.c +1 -1
@@ -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/l3fwd-power/main.c +5 -4
@@ -1785,13 +1785,14 @@ parse_config(const char *q_arg) nb_lcore_params =0 ; -while ((p =strchr (p0,'(' )) !=NULL ) { +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 +5 -4
@@ -514,13 +514,14 @@ parse_config(const char *q_arg) nb_lcore_params =0 ; -while ((p =strchr (p0,'(' )) !=NULL ) { +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;
examples/multi_process/symmetric_mp/main.c +3 -3
@@ -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" ); }
examples/qos_sched/app_thread.c +3 -3
@@ -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 nbuint32_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
@@ -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
@@ -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 +1 -1
@@ -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);
Signature · 1 line
2.39.0
PATCH v3 6/7 cmdline: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- lib/cmdline/cmdline_rdline.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
lib/cmdline/cmdline_rdline.c +6 -6
@@ -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.39.0
PATCH v3 7/7 ip_frag: fix whitespace
In reply to Stephen HemmingerThe style standard is to use blank after keywords. I.e "if (" not "if("
--- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ip_frag/rte_ipv4_reassembly.c +1 -1
@@ -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.39.0
Re: [PATCH v3 7/7] ip_frag: fix whitespace
17/01/2023 00:14, Stephen Hemminger пишет:
Quoted 13 lines
The style standard is to use blank after keywords. I.e "if (" not "if("
Signed-off-by Stephen Hemminger <[email protected]>--- lib/ip_frag/rte_ipv4_reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/ip_frag/rte_ipv4_reassembly.c +0
-0
lib/ip_frag/rte_ipv4_reassembly.c ipv4_frag_reassemble(struct ip_frag_pkt *fp) · line 40
Quoted 8 lines
lib/ip_frag/rte_ipv4_reassembly.c +1
-1@@ -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);
Re: [PATCH v3 0/7] add space after keywords
In reply to Stephen Hemminger17/01/2023 01:14, Stephen Hemminger:
Quoted 8 lines
Stephen Hemminger (7):
test: fix whitespace
testpmd: fix whitespace
net/e1000: fix whitespace
i40e: fix whitespace
examples: fix whitespace
cmdline: fix whitespace
ip_frag: fix whitespace
Why these patches are marked as rejected in patchwork?
Re: [PATCH v3 0/7] add space after keywords
Quoted 10 lines · On Sun, 12 Mar 2023 12:28:22 +0100 Thomas Monjalon <[email protected]> wrote:
17/01/2023 01:14, Stephen Hemminger:
Quoted 8 lines
Stephen Hemminger (7):
test: fix whitespace
testpmd: fix whitespace
net/e1000: fix whitespace
i40e: fix whitespace
examples: fix whitespace
cmdline: fix whitespace
ip_frag: fix whitespace
Quoted 3 lines
Why these patches are marked as rejected in patchwork?
I marked them as rejected since there were so many other patches that were more important. Plan to redo similar pass over all of DPDK by using clang format to look for all whitespace issues.
Re: [PATCH v3 0/7] add space after keywords
14/03/2023 19:06, Stephen Hemminger:
Quoted 13 lines
Quoted 10 lines · On Sun, 12 Mar 2023 12:28:22 +0100 Thomas Monjalon <[email protected]> wrote:
17/01/2023 01:14, Stephen Hemminger:
Quoted 8 lines
Stephen Hemminger (7):
test: fix whitespace
testpmd: fix whitespace
net/e1000: fix whitespace
i40e: fix whitespace
examples: fix whitespace
cmdline: fix whitespace
ip_frag: fix whitespace
Quoted 7 lines
Quoted 3 lines
Why these patches are marked as rejected in patchwork?
I marked them as rejected since there were so many other patches that were more important. Plan to redo similar pass over all of DPDK by using clang format to look for all whitespace issues.
OK, you can probably squash all in one patch.