@@ -302,9 +302,7 @@ void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx)
302302			continue ;
303303
304304		for  (tun  =  0 ; tun  <  ICE_FD_HW_SEG_MAX ; tun ++ ) {
305- 			u64  prof_id ;
306- 
307- 			prof_id  =  flow  +  tun  *  ICE_FLTR_PTYPE_MAX ;
305+ 			u64  prof_id  =  prof -> prof_id [tun ];
308306
309307			for  (i  =  0 ; i  <  prof -> cnt ; i ++ ) {
310308				if  (prof -> vsi_h [i ] !=  vsi_idx )
@@ -362,10 +360,9 @@ ice_fdir_erase_flow_from_hw(struct ice_hw *hw, enum ice_block blk, int flow)
362360		return ;
363361
364362	for  (tun  =  0 ; tun  <  ICE_FD_HW_SEG_MAX ; tun ++ ) {
365- 		u64  prof_id ;
363+ 		u64  prof_id   =   prof -> prof_id [ tun ] ;
366364		int  j ;
367365
368- 		prof_id  =  flow  +  tun  *  ICE_FLTR_PTYPE_MAX ;
369366		for  (j  =  0 ; j  <  prof -> cnt ; j ++ ) {
370367			u16  vsi_num ;
371368
@@ -439,12 +436,10 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
439436		for  (tun  =  0 ; tun  <  ICE_FD_HW_SEG_MAX ; tun ++ ) {
440437			struct  ice_flow_prof  * hw_prof ;
441438			struct  ice_fd_hw_prof  * prof ;
442- 			u64  prof_id ;
443439			int  j ;
444440
445441			prof  =  hw -> fdir_prof [flow ];
446- 			prof_id  =  flow  +  tun  *  ICE_FLTR_PTYPE_MAX ;
447- 			ice_flow_add_prof (hw , ICE_BLK_FD , ICE_FLOW_RX , prof_id ,
442+ 			ice_flow_add_prof (hw , ICE_BLK_FD , ICE_FLOW_RX ,
448443					  prof -> fdir_seg [tun ], TNL_SEG_CNT (tun ),
449444					  & hw_prof );
450445			for  (j  =  0 ; j  <  prof -> cnt ; j ++ ) {
@@ -454,7 +449,7 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
454449
455450				prio  =  ICE_FLOW_PRIO_NORMAL ;
456451				err  =  ice_flow_add_entry (hw , ICE_BLK_FD ,
457- 							 prof_id ,
452+ 							 hw_prof -> id ,
458453							 prof -> vsi_h [0 ],
459454							 prof -> vsi_h [j ],
460455							 prio , prof -> fdir_seg ,
@@ -464,6 +459,7 @@ void ice_fdir_replay_flows(struct ice_hw *hw)
464459						flow );
465460					continue ;
466461				}
462+ 				prof -> prof_id [tun ] =  hw_prof -> id ;
467463				prof -> entry_h [j ][tun ] =  entry_h ;
468464			}
469465		}
@@ -638,7 +634,6 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
638634	u64  entry1_h  =  0 ;
639635	u64  entry2_h  =  0 ;
640636	bool  del_last ;
641- 	u64  prof_id ;
642637	int  err ;
643638	int  idx ;
644639
@@ -686,23 +681,23 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
686681	 * That is the final parameters are 1 header (segment), no 
687682	 * actions (NULL) and zero actions 0. 
688683	 */ 
689- 	prof_id  =  flow  +  tun  *  ICE_FLTR_PTYPE_MAX ;
690- 	err  =  ice_flow_add_prof (hw , ICE_BLK_FD , ICE_FLOW_RX , prof_id , seg ,
684+ 	err  =  ice_flow_add_prof (hw , ICE_BLK_FD , ICE_FLOW_RX , seg ,
691685				TNL_SEG_CNT (tun ), & prof );
692686	if  (err )
693687		return  err ;
694- 	err  =  ice_flow_add_entry (hw , ICE_BLK_FD , prof_id , main_vsi -> idx ,
688+ 	err  =  ice_flow_add_entry (hw , ICE_BLK_FD , prof -> id , main_vsi -> idx ,
695689				 main_vsi -> idx , ICE_FLOW_PRIO_NORMAL ,
696690				 seg , & entry1_h );
697691	if  (err )
698692		goto err_prof ;
699- 	err  =  ice_flow_add_entry (hw , ICE_BLK_FD , prof_id , main_vsi -> idx ,
693+ 	err  =  ice_flow_add_entry (hw , ICE_BLK_FD , prof -> id , main_vsi -> idx ,
700694				 ctrl_vsi -> idx , ICE_FLOW_PRIO_NORMAL ,
701695				 seg , & entry2_h );
702696	if  (err )
703697		goto err_entry ;
704698
705699	hw_prof -> fdir_seg [tun ] =  seg ;
700+ 	hw_prof -> prof_id [tun ] =  prof -> id ;
706701	hw_prof -> entry_h [0 ][tun ] =  entry1_h ;
707702	hw_prof -> entry_h [1 ][tun ] =  entry2_h ;
708703	hw_prof -> vsi_h [0 ] =  main_vsi -> idx ;
@@ -719,7 +714,7 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
719714
720715		entry1_h  =  0 ;
721716		vsi_h  =  main_vsi -> tc_map_vsi [idx ]-> idx ;
722- 		err  =  ice_flow_add_entry (hw , ICE_BLK_FD , prof_id ,
717+ 		err  =  ice_flow_add_entry (hw , ICE_BLK_FD , prof -> id ,
723718					 main_vsi -> idx , vsi_h ,
724719					 ICE_FLOW_PRIO_NORMAL , seg ,
725720					 & entry1_h );
@@ -756,7 +751,7 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
756751
757752		if  (!hw_prof -> entry_h [idx ][tun ])
758753			continue ;
759- 		ice_rem_prof_id_flow (hw , ICE_BLK_FD , vsi_num , prof_id );
754+ 		ice_rem_prof_id_flow (hw , ICE_BLK_FD , vsi_num , prof -> id );
760755		ice_flow_rem_entry (hw , ICE_BLK_FD , hw_prof -> entry_h [idx ][tun ]);
761756		hw_prof -> entry_h [idx ][tun ] =  0 ;
762757		if  (del_last )
@@ -766,10 +761,10 @@ ice_fdir_set_hw_fltr_rule(struct ice_pf *pf, struct ice_flow_seg_info *seg,
766761		hw_prof -> cnt  =  0 ;
767762err_entry :
768763	ice_rem_prof_id_flow (hw , ICE_BLK_FD ,
769- 			     ice_get_hw_vsi_num (hw , main_vsi -> idx ), prof_id );
764+ 			     ice_get_hw_vsi_num (hw , main_vsi -> idx ), prof -> id );
770765	ice_flow_rem_entry (hw , ICE_BLK_FD , entry1_h );
771766err_prof :
772- 	ice_flow_rem_prof (hw , ICE_BLK_FD , prof_id );
767+ 	ice_flow_rem_prof (hw , ICE_BLK_FD , prof -> id );
773768	dev_err (dev , "Failed to add filter. Flow director filters on each port must have the same input set.\n" );
774769
775770	return  err ;
0 commit comments