@@ -292,15 +292,16 @@ void ice_release_change_lock(struct ice_hw *hw)
292292 ice_release_res (hw , ICE_CHANGE_LOCK_RES_ID );
293293}
294294
295+
295296/**
296297 * ice_get_open_tunnel_port - retrieve an open tunnel port
297298 * @hw: pointer to the HW structure
299+ * @type: tunnel type (TNL_ALL will return any open port)
298300 * @port: returns open port
299- * @type: type of tunnel, can be TNL_LAST if it doesn't matter
300301 */
301302bool
302- ice_get_open_tunnel_port (struct ice_hw * hw , u16 * port ,
303- enum ice_tunnel_type type )
303+ ice_get_open_tunnel_port (struct ice_hw * hw , enum ice_tunnel_type type ,
304+ u16 * port )
304305{
305306 bool res = false;
306307 u16 i ;
@@ -1232,7 +1233,7 @@ ice_find_prof_id_with_mask(struct ice_hw *hw, enum ice_block blk,
12321233 /* For FD, we don't want to re-use a existed profile with the same
12331234 * field vector and mask. This will cause rule interference.
12341235 */
1235- if (blk == ICE_BLK_FD )
1236+ if (blk == ICE_BLK_FD || blk == ICE_BLK_RSS )
12361237 return - ENOENT ;
12371238
12381239 for (i = 0 ; i < (u8 )es -> count ; i ++ ) {
@@ -3043,16 +3044,16 @@ ice_disable_fd_swap(struct ice_hw *hw, u8 prof_id)
30433044 * the ID value used here.
30443045 */
30453046int
3046- ice_add_prof (struct ice_hw * hw , enum ice_block blk , u64 id , u8 ptypes [],
3047- const struct ice_ptype_attributes * attr , u16 attr_cnt ,
3048- struct ice_fv_word * es , u16 * masks , bool symm , bool fd_swap )
3047+ ice_add_prof (struct ice_hw * hw , enum ice_block blk , u64 id ,
3048+ unsigned long * ptypes , const struct ice_ptype_attributes * attr ,
3049+ u16 attr_cnt , struct ice_fv_word * es , u16 * masks , bool symm ,
3050+ bool fd_swap )
30493051{
3050- u32 bytes = DIV_ROUND_UP (ICE_FLOW_PTYPE_MAX , BITS_PER_BYTE );
30513052 DECLARE_BITMAP (ptgs_used , ICE_XLT1_CNT );
30523053 struct ice_prof_map * prof ;
3053- u8 byte = 0 ;
3054- u8 prof_id ;
30553054 int status ;
3055+ u8 prof_id ;
3056+ u16 ptype ;
30563057
30573058 bitmap_zero (ptgs_used , ICE_XLT1_CNT );
30583059
@@ -3102,57 +3103,35 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
31023103 prof -> context = 0 ;
31033104
31043105 /* build list of ptgs */
3105- while ( bytes && prof -> ptg_cnt < ICE_MAX_PTG_PER_PROFILE ) {
3106- u8 bit ;
3106+ for_each_set_bit ( ptype , ptypes , ICE_FLOW_PTYPE_MAX ) {
3107+ u8 ptg ;
31073108
3108- if (!ptypes [byte ]) {
3109- bytes -- ;
3110- byte ++ ;
3109+ /* The package should place all ptypes in a non-zero
3110+ * PTG, so the following call should never fail.
3111+ */
3112+ if (ice_ptg_find_ptype (hw , blk , ptype , & ptg ))
31113113 continue ;
3112- }
3113-
3114- /* Examine 8 bits per byte */
3115- for_each_set_bit (bit , (unsigned long * )& ptypes [byte ],
3116- BITS_PER_BYTE ) {
3117- u16 ptype ;
3118- u8 ptg ;
31193114
3120- ptype = byte * BITS_PER_BYTE + bit ;
3121-
3122- /* The package should place all ptypes in a non-zero
3123- * PTG, so the following call should never fail.
3124- */
3125- if (ice_ptg_find_ptype (hw , blk , ptype , & ptg ))
3126- continue ;
3115+ /* If PTG is already added, skip and continue */
3116+ if (test_bit (ptg , ptgs_used ))
3117+ continue ;
31273118
3128- /* If PTG is already added, skip and continue */
3129- if (test_bit (ptg , ptgs_used ))
3130- continue ;
3119+ set_bit (ptg , ptgs_used );
3120+ /* Check to see there are any attributes for this ptype, and
3121+ * add them if found.
3122+ */
3123+ status = ice_add_prof_attrib (prof , ptg , ptype , attr , attr_cnt );
3124+ if (status == - ENOSPC )
3125+ break ;
3126+ if (status ) {
3127+ /* This is simple a ptype/PTG with no attribute */
3128+ prof -> ptg [prof -> ptg_cnt ] = ptg ;
3129+ prof -> attr [prof -> ptg_cnt ].flags = 0 ;
3130+ prof -> attr [prof -> ptg_cnt ].mask = 0 ;
31313131
3132- __set_bit (ptg , ptgs_used );
3133- /* Check to see there are any attributes for
3134- * this PTYPE, and add them if found.
3135- */
3136- status = ice_add_prof_attrib (prof , ptg , ptype ,
3137- attr , attr_cnt );
3138- if (status == - ENOSPC )
3132+ if (++ prof -> ptg_cnt >= ICE_MAX_PTG_PER_PROFILE )
31393133 break ;
3140- if (status ) {
3141- /* This is simple a PTYPE/PTG with no
3142- * attribute
3143- */
3144- prof -> ptg [prof -> ptg_cnt ] = ptg ;
3145- prof -> attr [prof -> ptg_cnt ].flags = 0 ;
3146- prof -> attr [prof -> ptg_cnt ].mask = 0 ;
3147-
3148- if (++ prof -> ptg_cnt >=
3149- ICE_MAX_PTG_PER_PROFILE )
3150- break ;
3151- }
31523134 }
3153-
3154- bytes -- ;
3155- byte ++ ;
31563135 }
31573136
31583137 list_add (& prof -> list , & hw -> blk [blk ].es .prof_map );
@@ -4145,6 +4124,55 @@ ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)
41454124 return status ;
41464125}
41474126
4127+ /**
4128+ * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow entry
4129+ * @hw: pointer to the HW struct
4130+ * @blk: HW block
4131+ * @dest_vsi_handle: dest VSI handle
4132+ * @fdir_vsi_handle: fdir programming VSI handle
4133+ * @id: profile id (handle)
4134+ *
4135+ * Calling this function will update the hardware tables to enable the
4136+ * profile indicated by the ID parameter for the VSIs specified in the VSI
4137+ * array. Once successfully called, the flow will be enabled.
4138+ */
4139+ int
4140+ ice_flow_assoc_hw_prof (struct ice_hw * hw , enum ice_block blk ,
4141+ u16 dest_vsi_handle , u16 fdir_vsi_handle , int id )
4142+ {
4143+ int status = 0 ;
4144+ u16 vsi_num ;
4145+
4146+ vsi_num = ice_get_hw_vsi_num (hw , dest_vsi_handle );
4147+ status = ice_add_prof_id_flow (hw , blk , vsi_num , id );
4148+ if (status ) {
4149+ ice_debug (hw , ICE_DBG_FLOW , "HW profile add failed for main VSI flow entry, %d\n" ,
4150+ status );
4151+ goto err_add_prof ;
4152+ }
4153+
4154+ if (blk != ICE_BLK_FD )
4155+ return status ;
4156+
4157+ vsi_num = ice_get_hw_vsi_num (hw , fdir_vsi_handle );
4158+ status = ice_add_prof_id_flow (hw , blk , vsi_num , id );
4159+ if (status ) {
4160+ ice_debug (hw , ICE_DBG_FLOW , "HW profile add failed for ctrl VSI flow entry, %d\n" ,
4161+ status );
4162+ goto err_add_entry ;
4163+ }
4164+
4165+ return status ;
4166+
4167+ err_add_entry :
4168+ vsi_num = ice_get_hw_vsi_num (hw , dest_vsi_handle );
4169+ ice_rem_prof_id_flow (hw , blk , vsi_num , id );
4170+ err_add_prof :
4171+ ice_flow_rem_prof (hw , blk , id );
4172+
4173+ return status ;
4174+ }
4175+
41484176/**
41494177 * ice_flow_assoc_fdir_prof - add an FDIR profile for main/ctrl VSI
41504178 * @hw: pointer to the HW struct
0 commit comments