@@ -1082,44 +1082,44 @@ init_flow(uint16_t port_id, uint16_t tcp_port) {
10821082#endif 
10831083
10841084#ifdef  FF_FLOW_IPIP 
1085- static  int   
1085+ static  int 
10861086create_ipip_flow (uint16_t  port_id ) {
10871087    struct  rte_flow_attr  attr  =  {.ingress  =  1 };
10881088    struct  ff_port_cfg  * pconf  =  & ff_global_cfg .dpdk .port_cfgs [port_id ];
10891089    int  nb_queues  =  pconf -> nb_lcores ;
10901090    uint16_t  queue [RTE_MAX_QUEUES_PER_PORT ];
10911091    // 1. Queue configuration check 
10921092    if  (nb_queues  >  RTE_MAX_QUEUES_PER_PORT ) {
1093-         rte_exit (EXIT_FAILURE , "Queue count exceeds limit (%d > %d)\n" ,  
1093+         rte_exit (EXIT_FAILURE , "Queue count exceeds limit (%d > %d)\n" ,
10941094                nb_queues , RTE_MAX_QUEUES_PER_PORT );
10951095    }
1096-     for  (int  i  =  0 ; i  <  nb_queues ; i ++ )  
1096+     for  (int  i  =  0 ; i  <  nb_queues ; i ++ )
10971097        queue [i ] =  i ;
10981098
10991099    // 2. Get device info and check return value 
11001100    struct  rte_eth_dev_info  dev_info ;
11011101    int  ret  =  rte_eth_dev_info_get (port_id , & dev_info );
11021102    if  (ret  !=  0 ) {
1103-         rte_exit (EXIT_FAILURE , "Error during getting device (port %u) info: %s\n" ,  
1103+         rte_exit (EXIT_FAILURE , "Error during getting device (port %u) info: %s\n" ,
11041104                port_id , strerror (- ret ));
11051105    }
11061106    // 3. RSS config - key: set inner hash 
11071107    struct  rte_flow_action_rss  rss  =  {
11081108        .func  =  RTE_ETH_HASH_FUNCTION_DEFAULT ,
11091109        .level  =  2 ,  // inner encapsulation layer RSS - hash based on inner protocol 
1110-         .types  =  ETH_RSS_NONFRAG_IPV4_TCP ,  // inner IPv4+TCP hash 
1110+         .types  =  RTE_ETH_RSS_NONFRAG_IPV4_TCP ,  // inner IPv4+TCP hash 
11111111        .key_len  =  rsskey_len ,
11121112        .key  =  rsskey ,
11131113        .queue_num  =  nb_queues ,
11141114        .queue  =  queue ,
11151115    };
11161116    // 4. Hardware capability check and fallback handling 
1117-     if  (!(dev_info .flow_type_rss_offloads  &  ETH_RSS_NONFRAG_IPV4_TCP )) {   
1118-         // printf("warning: inner TCP RSS not supported, fallback to outer RSS\n");   
1117+     if  (!(dev_info .flow_type_rss_offloads  &  RTE_ETH_RSS_NONFRAG_IPV4_TCP )) {
1118+         // printf("warning: inner TCP RSS not supported, fallback to outer RSS\n"); 
11191119        fprintf (stderr , "Fallback handling!!!\n" );
1120-         printf ("I'm three,Warning: inner TCP RSS is not supported, falling back to outer RSS.\n" );  
1121-         rss .level  =  0 ;  // fallback to outer RSS    
1122-         rss .types  =  RTE_ETH_FLOW_IPV4 ;  // update to outer protocol type    
1120+         printf ("I'm three,Warning: inner TCP RSS is not supported, falling back to outer RSS.\n" );
1121+         rss .level  =  0 ;  // fallback to outer RSS 
1122+         rss .types  =  RTE_ETH_FLOW_IPV4 ;  // update to outer protocol type 
11231123    }
11241124
11251125    // 5. Outer IPv4 matches IPIP protocol 
@@ -1345,7 +1345,7 @@ ff_dpdk_init(int argc, char **argv)
13451345
13461346#ifdef  FF_FLOW_ISOLATE 
13471347    // run once in primary process 
1348-     if  (0  ==  lcore_conf . tx_queue_id [ 0 ] ){
1348+     if  (rte_eal_process_type ()  ==  RTE_PROC_PRIMARY ){
13491349        ret  =  port_flow_isolate (0 , 1 );
13501350        if  (ret  <  0 )
13511351            rte_exit (EXIT_FAILURE , "init_port_isolate failed\n" );
@@ -1369,10 +1369,9 @@ ff_dpdk_init(int argc, char **argv)
13691369    }
13701370#endif 
13711371
1372- 
13731372#ifdef  FF_FLOW_IPIP 
13741373    // create ipip flow for port 0 
1375-     if  (0  ==  lcore_conf . tx_queue_id [ 0 ] ){
1374+     if  (rte_eal_process_type ()  ==  RTE_PROC_PRIMARY ){
13761375        ret  =  create_ipip_flow (0 );
13771376        if  (ret  !=  0 ) {
13781377            rte_exit (EXIT_FAILURE , "create_ipip_flow failed\n" );
0 commit comments