@@ -95,8 +95,8 @@ int del_flow(struct store_pid *pid_value, struct store_flow *value);
9595static int add_flow_egress (struct store_pid * pid_value , struct store_flow * value );
9696static inline void get_htid (struct flow_ctx * ctx , int prio , int * ht_krn , int * ht_id );
9797static inline void free_htid (struct flow_ctx * ctx , int ht_id );
98- static inline void add_pending_list (pid_t pid , struct flow_ctx * ctx , char * if_name , int ht_id , int prio , int * rc );
99- static inline void free_pending_list (pid_t pid , struct flow_ctx * ctx , char * if_name );
98+ static inline void add_pending_list (pid_t pid , struct flow_ctx * ctx , int if_index , int ht_id , int prio , int * rc );
99+ static inline void free_pending_list (pid_t pid , struct flow_ctx * ctx , int if_index );
100100static inline int get_prio (struct store_flow * value );
101101static inline int get_bkt (struct store_flow * value );
102102static inline int get_protocol (struct store_flow * value );
@@ -133,7 +133,6 @@ int add_flow(struct store_pid *pid_value, struct store_flow *value)
133133 struct list_head * cur_head = NULL ;
134134 struct flow_element * cur_element = NULL ;
135135 struct list_head * cur_entry = NULL ;
136- char if_name [IF_NAMESIZE ];
137136 uint32_t ip = value -> flow .dst_ip ;
138137 int ht = HANDLE_HT (value -> handle );
139138 int bkt = HANDLE_BKT (value -> handle );
@@ -148,12 +147,6 @@ int add_flow(struct store_pid *pid_value, struct store_flow *value)
148147 }
149148
150149 errno = 0 ;
151- if (NULL == if_indextoname (value -> if_id , if_name )) {
152- log_error ("[%d] network interface is not found by index %d errno %d (%s)\n" ,
153- pid , value -> if_id , errno , strerror (errno ));
154- rc = - errno ;
155- goto err ;
156- }
157150
158151 /* interface list processing
159152 * use interface index as unique identifier
@@ -356,7 +349,7 @@ int add_flow(struct store_pid *pid_value, struct store_flow *value)
356349 log_debug ("[%d] add flow (node): 0x%p value: %d ref: %d\n" ,
357350 pid , cur_element , cur_element -> value [0 ], cur_element -> ref );
358351
359- free_pending_list (pid , ctx , if_name );
352+ free_pending_list (pid , ctx , value -> if_id );
360353
361354err :
362355
@@ -376,7 +369,6 @@ int del_flow(struct store_pid *pid_value, struct store_flow *value)
376369 struct list_head * cur_entry = NULL ;
377370 struct flow_element * save_element [3 ];
378371 struct list_head * save_entry [3 ];
379- char if_name [IF_NAMESIZE ];
380372 uint32_t ip = value -> flow .dst_ip ;
381373 int ht = HANDLE_HT (value -> handle );
382374 int bkt = HANDLE_BKT (value -> handle );
@@ -386,12 +378,6 @@ int del_flow(struct store_pid *pid_value, struct store_flow *value)
386378 int found = 0 ;
387379
388380 errno = 0 ;
389- if (NULL == if_indextoname (value -> if_id , if_name )) {
390- log_error ("[%d] network interface is not found by index %d errno %d (%s)\n" ,
391- pid , value -> if_id , errno , strerror (errno ));
392- rc = - errno ;
393- goto err ;
394- }
395381
396382 /* interface list processing */
397383 found = 0 ;
@@ -501,7 +487,7 @@ int del_flow(struct store_pid *pid_value, struct store_flow *value)
501487 }
502488
503489 /* Device busy error is returned while trying to remove table in this location */
504- add_pending_list (pid , ctx , if_name , ht , get_prio (value ), & rc );
490+ add_pending_list (pid , ctx , value -> if_id , ht , get_prio (value ), & rc );
505491
506492 list_del_init (cur_entry );
507493 free (cur_element );
@@ -528,9 +514,7 @@ int del_flow(struct store_pid *pid_value, struct store_flow *value)
528514 }
529515 }
530516
531- free_pending_list (pid , ctx , if_name );
532-
533- err :
517+ free_pending_list (pid , ctx , value -> if_id );
534518
535519 log_debug ("[%d] del flow filter: %x:%x:%x rc=%d\n" ,
536520 pid , ht , bkt , id , rc );
@@ -643,7 +627,7 @@ static inline void get_htid(struct flow_ctx *ctx, int prio, int *ht_krn, int *ht
643627 }
644628}
645629
646- static inline void free_pending_list (pid_t pid , struct flow_ctx * ctx , char * if_name )
630+ static inline void free_pending_list (pid_t pid , struct flow_ctx * ctx , int if_index )
647631{
648632 struct htid_node_t * cur_element = NULL ;
649633 struct list_head * cur_entry = NULL , * tmp_entry = NULL ;
@@ -652,12 +636,12 @@ static inline void free_pending_list(pid_t pid, struct flow_ctx *ctx, char* if_n
652636 list_for_each_safe (cur_entry , tmp_entry , & ctx -> pending_list ) {
653637 cur_element = list_entry (cur_entry , struct htid_node_t , node );
654638
655- if (tc_del_filter (tc , if_nametoindex ( if_name ) , cur_element -> prio , cur_element -> htid , 0 , 0 ) < 0 ) {
639+ if (tc_del_filter (tc , if_index , cur_element -> prio , cur_element -> htid , 0 , 0 ) < 0 ) {
656640 continue ;
657641 }
658642
659- log_debug ("[%d] del flow request was removed successfully : dev %s htid %d prio %d\n" ,
660- pid , if_name , cur_element -> htid , cur_element -> prio );
643+ log_debug ("[%d] del flow request was removed successfully: if %d htid %d prio %d\n" ,
644+ pid , if_index , cur_element -> htid , cur_element -> prio );
661645
662646 list_del_init (& cur_element -> node );
663647 free_htid (ctx , cur_element -> htid );
@@ -666,7 +650,7 @@ static inline void free_pending_list(pid_t pid, struct flow_ctx *ctx, char* if_n
666650 }
667651}
668652
669- static inline void add_pending_list (pid_t pid , struct flow_ctx * ctx , char * if_name , int ht_id , int prio , int * rc )
653+ static inline void add_pending_list (pid_t pid , struct flow_ctx * ctx , int if_index , int ht_id , int prio , int * rc )
670654{
671655 struct htid_node_t * htid_node = (void * )calloc (1 , sizeof (struct htid_node_t ));
672656 if (NULL == htid_node ) {
@@ -680,8 +664,8 @@ static inline void add_pending_list(pid_t pid, struct flow_ctx *ctx, char* if_na
680664
681665 list_add (& htid_node -> node , & ctx -> pending_list );
682666
683- log_debug ("[%d] del flow request was added to the pending list : dev %s htid %d prio %d\n" ,
684- pid , if_name , ht_id , prio );
667+ log_debug ("[%d] del flow request was added to the pending list: if %d htid %d prio %d\n" ,
668+ pid , if_index , ht_id , prio );
685669}
686670
687671static inline void free_htid (struct flow_ctx * ctx , int ht_id )
0 commit comments