Lines Matching full:blk
95 * @blk: block type
101 static u32 ice_sect_id(enum ice_block blk, enum ice_sect sect) in ice_sect_id() argument
103 return ice_sect_lkup[blk][sect]; in ice_sect_id()
1589 for (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++) in ice_get_prof_index_max()
1845 for (i = 0; i < hw->blk[ICE_BLK_SW].es.fvw; i++) { in ice_get_sw_prof_type()
1948 for (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++) in ice_get_sw_fv_list()
1953 if (j >= hw->blk[ICE_BLK_SW].es.fvw) in ice_get_sw_fv_list()
2528 * @blk: hardware block
2535 ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx, in ice_find_prot_off() argument
2540 if (prof >= hw->blk[blk].es.count) in ice_find_prot_off()
2543 if (fv_idx >= hw->blk[blk].es.fvw) in ice_find_prot_off()
2546 fv_ext = hw->blk[blk].es.t + (prof * hw->blk[blk].es.fvw); in ice_find_prot_off()
2559 * @blk: HW block
2568 ice_ptg_find_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 *ptg) in ice_ptg_find_ptype() argument
2573 *ptg = hw->blk[blk].xlt1.ptypes[ptype].ptg; in ice_ptg_find_ptype()
2580 * @blk: HW block
2586 static void ice_ptg_alloc_val(struct ice_hw *hw, enum ice_block blk, u8 ptg) in ice_ptg_alloc_val() argument
2588 hw->blk[blk].xlt1.ptg_tbl[ptg].in_use = true; in ice_ptg_alloc_val()
2594 * @blk: HW block
2602 ice_ptg_remove_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 ptg) in ice_ptg_remove_ptype() argument
2610 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].in_use) in ice_ptg_remove_ptype()
2614 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype) in ice_ptg_remove_ptype()
2618 p = hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; in ice_ptg_remove_ptype()
2619 ch = &hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; in ice_ptg_remove_ptype()
2621 if (ptype == (p - hw->blk[blk].xlt1.ptypes)) { in ice_ptg_remove_ptype()
2630 hw->blk[blk].xlt1.ptypes[ptype].ptg = ICE_DEFAULT_PTG; in ice_ptg_remove_ptype()
2631 hw->blk[blk].xlt1.ptypes[ptype].next_ptype = NULL; in ice_ptg_remove_ptype()
2639 * @blk: HW block
2649 ice_ptg_add_mv_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 ptg) in ice_ptg_add_mv_ptype() argument
2657 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].in_use && ptg != ICE_DEFAULT_PTG) in ice_ptg_add_mv_ptype()
2660 status = ice_ptg_find_ptype(hw, blk, ptype, &original_ptg); in ice_ptg_add_mv_ptype()
2670 ice_ptg_remove_ptype(hw, blk, ptype, original_ptg); in ice_ptg_add_mv_ptype()
2677 hw->blk[blk].xlt1.ptypes[ptype].next_ptype = in ice_ptg_add_mv_ptype()
2678 hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; in ice_ptg_add_mv_ptype()
2679 hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype = in ice_ptg_add_mv_ptype()
2680 &hw->blk[blk].xlt1.ptypes[ptype]; in ice_ptg_add_mv_ptype()
2682 hw->blk[blk].xlt1.ptypes[ptype].ptg = ptg; in ice_ptg_add_mv_ptype()
2683 hw->blk[blk].xlt1.t[ptype] = ptg; in ice_ptg_add_mv_ptype()
2786 * @blk: HW block
2794 ice_vsig_find_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 *vsig) in ice_vsig_find_vsi() argument
2803 *vsig = hw->blk[blk].xlt2.vsis[vsi].vsig; in ice_vsig_find_vsi()
2811 * @blk: HW block
2816 static u16 ice_vsig_alloc_val(struct ice_hw *hw, enum ice_block blk, u16 vsig) in ice_vsig_alloc_val() argument
2820 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) { in ice_vsig_alloc_val()
2821 INIT_LIST_HEAD(&hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst); in ice_vsig_alloc_val()
2822 hw->blk[blk].xlt2.vsig_tbl[idx].in_use = true; in ice_vsig_alloc_val()
2831 * @blk: HW block
2836 static u16 ice_vsig_alloc(struct ice_hw *hw, enum ice_block blk) in ice_vsig_alloc() argument
2841 if (!hw->blk[blk].xlt2.vsig_tbl[i].in_use) in ice_vsig_alloc()
2842 return ice_vsig_alloc_val(hw, blk, i); in ice_vsig_alloc()
2850 * @blk: HW block
2863 ice_find_dup_props_vsig(struct ice_hw *hw, enum ice_block blk, in ice_find_dup_props_vsig() argument
2866 struct ice_xlt2 *xlt2 = &hw->blk[blk].xlt2; in ice_find_dup_props_vsig()
2882 * @blk: HW block
2888 static int ice_vsig_free(struct ice_hw *hw, enum ice_block blk, u16 vsig) in ice_vsig_free() argument
2898 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_free()
2901 hw->blk[blk].xlt2.vsig_tbl[idx].in_use = false; in ice_vsig_free()
2903 vsi_cur = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_free()
2919 hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi = NULL; in ice_vsig_free()
2924 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_vsig_free()
2933 INIT_LIST_HEAD(&hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst); in ice_vsig_free()
2941 * @blk: HW block
2949 ice_vsig_remove_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig) in ice_vsig_remove_vsi() argument
2959 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_remove_vsi()
2966 vsi_head = &hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_remove_vsi()
2970 vsi_tgt = &hw->blk[blk].xlt2.vsis[vsi]; in ice_vsig_remove_vsi()
2997 * @blk: HW block
3007 ice_vsig_add_mv_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig) in ice_vsig_add_mv_vsi() argument
3021 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use && in ice_vsig_add_mv_vsi()
3025 status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); in ice_vsig_add_mv_vsi()
3035 status = ice_vsig_remove_vsi(hw, blk, vsi, orig_vsig); in ice_vsig_add_mv_vsi()
3044 hw->blk[blk].xlt2.vsis[vsi].vsig = vsig; in ice_vsig_add_mv_vsi()
3045 hw->blk[blk].xlt2.vsis[vsi].changed = 1; in ice_vsig_add_mv_vsi()
3048 tmp = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_add_mv_vsi()
3049 hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi = in ice_vsig_add_mv_vsi()
3050 &hw->blk[blk].xlt2.vsis[vsi]; in ice_vsig_add_mv_vsi()
3051 hw->blk[blk].xlt2.vsis[vsi].next_vsi = tmp; in ice_vsig_add_mv_vsi()
3052 hw->blk[blk].xlt2.t[vsi] = vsig; in ice_vsig_add_mv_vsi()
3060 * @blk: HW block
3066 ice_prof_has_mask_idx(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 idx, in ice_prof_has_mask_idx() argument
3079 for (i = hw->blk[blk].masks.first; i < hw->blk[blk].masks.first + in ice_prof_has_mask_idx()
3080 hw->blk[blk].masks.count; i++) in ice_prof_has_mask_idx()
3081 if (hw->blk[blk].es.mask_ena[prof] & BIT(i)) in ice_prof_has_mask_idx()
3082 if (hw->blk[blk].masks.masks[i].in_use && in ice_prof_has_mask_idx()
3083 hw->blk[blk].masks.masks[i].idx == idx) { in ice_prof_has_mask_idx()
3085 if (hw->blk[blk].masks.masks[i].mask == mask) in ice_prof_has_mask_idx()
3104 * @blk: HW block
3109 ice_prof_has_mask(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 *masks) in ice_prof_has_mask() argument
3114 for (i = 0; i < hw->blk[blk].es.fvw; i++) in ice_prof_has_mask()
3115 if (!ice_prof_has_mask_idx(hw, blk, prof, i, masks[i])) in ice_prof_has_mask()
3124 * @blk: HW block
3130 ice_find_prof_id_with_mask(struct ice_hw *hw, enum ice_block blk, in ice_find_prof_id_with_mask() argument
3133 struct ice_es *es = &hw->blk[blk].es; in ice_find_prof_id_with_mask()
3139 if (blk == ICE_BLK_FD) in ice_find_prof_id_with_mask()
3149 if (masks && !ice_prof_has_mask(hw, blk, i, masks)) in ice_find_prof_id_with_mask()
3161 * @blk: the block type
3164 static bool ice_prof_id_rsrc_type(enum ice_block blk, u16 *rsrc_type) in ice_prof_id_rsrc_type() argument
3166 switch (blk) { in ice_prof_id_rsrc_type()
3181 * @blk: the block type
3184 static bool ice_tcam_ent_rsrc_type(enum ice_block blk, u16 *rsrc_type) in ice_tcam_ent_rsrc_type() argument
3186 switch (blk) { in ice_tcam_ent_rsrc_type()
3202 * @blk: the block to allocate the TCAM for
3210 ice_alloc_tcam_ent(struct ice_hw *hw, enum ice_block blk, bool btm, in ice_alloc_tcam_ent() argument
3215 if (!ice_tcam_ent_rsrc_type(blk, &res_type)) in ice_alloc_tcam_ent()
3224 * @blk: the block from which to free the TCAM entry
3230 ice_free_tcam_ent(struct ice_hw *hw, enum ice_block blk, u16 tcam_idx) in ice_free_tcam_ent() argument
3234 if (!ice_tcam_ent_rsrc_type(blk, &res_type)) in ice_free_tcam_ent()
3243 * @blk: the block to allocate the profile ID for
3249 static int ice_alloc_prof_id(struct ice_hw *hw, enum ice_block blk, u8 *prof_id) in ice_alloc_prof_id() argument
3255 if (!ice_prof_id_rsrc_type(blk, &res_type)) in ice_alloc_prof_id()
3268 * @blk: the block from which to free the profile ID
3273 static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) in ice_free_prof_id() argument
3278 if (!ice_prof_id_rsrc_type(blk, &res_type)) in ice_free_prof_id()
3287 * @blk: the block from which to free the profile ID
3290 static int ice_prof_inc_ref(struct ice_hw *hw, enum ice_block blk, u8 prof_id) in ice_prof_inc_ref() argument
3292 if (prof_id > hw->blk[blk].es.count) in ice_prof_inc_ref()
3295 hw->blk[blk].es.ref_count[prof_id]++; in ice_prof_inc_ref()
3303 * @blk: hardware block
3309 ice_write_prof_mask_reg(struct ice_hw *hw, enum ice_block blk, u16 mask_idx, in ice_write_prof_mask_reg() argument
3315 switch (blk) { in ice_write_prof_mask_reg()
3328 blk); in ice_write_prof_mask_reg()
3333 ice_debug(hw, ICE_DBG_PKG, "write mask, blk %d (%d): %x = %x\n", in ice_write_prof_mask_reg()
3334 blk, idx, offset, val); in ice_write_prof_mask_reg()
3340 * @blk: hardware block
3345 ice_write_prof_mask_enable_res(struct ice_hw *hw, enum ice_block blk, in ice_write_prof_mask_enable_res() argument
3350 switch (blk) { in ice_write_prof_mask_enable_res()
3359 blk); in ice_write_prof_mask_enable_res()
3364 ice_debug(hw, ICE_DBG_PKG, "write mask enable, blk %d (%d): %x = %x\n", in ice_write_prof_mask_enable_res()
3365 blk, prof_id, offset, enable_mask); in ice_write_prof_mask_enable_res()
3371 * @blk: hardware block
3373 static void ice_init_prof_masks(struct ice_hw *hw, enum ice_block blk) in ice_init_prof_masks() argument
3378 mutex_init(&hw->blk[blk].masks.lock); in ice_init_prof_masks()
3382 hw->blk[blk].masks.count = per_pf; in ice_init_prof_masks()
3383 hw->blk[blk].masks.first = hw->pf_id * per_pf; in ice_init_prof_masks()
3385 memset(hw->blk[blk].masks.masks, 0, sizeof(hw->blk[blk].masks.masks)); in ice_init_prof_masks()
3387 for (i = hw->blk[blk].masks.first; in ice_init_prof_masks()
3388 i < hw->blk[blk].masks.first + hw->blk[blk].masks.count; i++) in ice_init_prof_masks()
3389 ice_write_prof_mask_reg(hw, blk, i, 0, 0); in ice_init_prof_masks()
3405 * @blk: hardware block
3411 ice_alloc_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 idx, u16 mask, in ice_alloc_prof_mask() argument
3419 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_alloc_prof_mask()
3422 mutex_lock(&hw->blk[blk].masks.lock); in ice_alloc_prof_mask()
3424 for (i = hw->blk[blk].masks.first; in ice_alloc_prof_mask()
3425 i < hw->blk[blk].masks.first + hw->blk[blk].masks.count; i++) in ice_alloc_prof_mask()
3426 if (hw->blk[blk].masks.masks[i].in_use) { in ice_alloc_prof_mask()
3430 if (hw->blk[blk].masks.masks[i].mask == mask && in ice_alloc_prof_mask()
3431 hw->blk[blk].masks.masks[i].idx == idx) { in ice_alloc_prof_mask()
3455 hw->blk[blk].masks.masks[i].in_use = true; in ice_alloc_prof_mask()
3456 hw->blk[blk].masks.masks[i].mask = mask; in ice_alloc_prof_mask()
3457 hw->blk[blk].masks.masks[i].idx = idx; in ice_alloc_prof_mask()
3458 hw->blk[blk].masks.masks[i].ref = 0; in ice_alloc_prof_mask()
3459 ice_write_prof_mask_reg(hw, blk, i, idx, mask); in ice_alloc_prof_mask()
3462 hw->blk[blk].masks.masks[i].ref++; in ice_alloc_prof_mask()
3467 mutex_unlock(&hw->blk[blk].masks.lock); in ice_alloc_prof_mask()
3475 * @blk: hardware block
3479 ice_free_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 mask_idx) in ice_free_prof_mask() argument
3481 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_free_prof_mask()
3484 if (!(mask_idx >= hw->blk[blk].masks.first && in ice_free_prof_mask()
3485 mask_idx < hw->blk[blk].masks.first + hw->blk[blk].masks.count)) in ice_free_prof_mask()
3488 mutex_lock(&hw->blk[blk].masks.lock); in ice_free_prof_mask()
3490 if (!hw->blk[blk].masks.masks[mask_idx].in_use) in ice_free_prof_mask()
3493 if (hw->blk[blk].masks.masks[mask_idx].ref > 1) { in ice_free_prof_mask()
3494 hw->blk[blk].masks.masks[mask_idx].ref--; in ice_free_prof_mask()
3499 hw->blk[blk].masks.masks[mask_idx].in_use = false; in ice_free_prof_mask()
3500 hw->blk[blk].masks.masks[mask_idx].mask = 0; in ice_free_prof_mask()
3501 hw->blk[blk].masks.masks[mask_idx].idx = 0; in ice_free_prof_mask()
3504 ice_debug(hw, ICE_DBG_PKG, "Free mask, blk %d, mask %d\n", blk, in ice_free_prof_mask()
3506 ice_write_prof_mask_reg(hw, blk, mask_idx, 0, 0); in ice_free_prof_mask()
3509 mutex_unlock(&hw->blk[blk].masks.lock); in ice_free_prof_mask()
3517 * @blk: hardware block
3521 ice_free_prof_masks(struct ice_hw *hw, enum ice_block blk, u16 prof_id) in ice_free_prof_masks() argument
3526 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_free_prof_masks()
3529 mask_bm = hw->blk[blk].es.mask_ena[prof_id]; in ice_free_prof_masks()
3532 ice_free_prof_mask(hw, blk, i); in ice_free_prof_masks()
3540 * @blk: hardware block
3544 static void ice_shutdown_prof_masks(struct ice_hw *hw, enum ice_block blk) in ice_shutdown_prof_masks() argument
3548 mutex_lock(&hw->blk[blk].masks.lock); in ice_shutdown_prof_masks()
3550 for (i = hw->blk[blk].masks.first; in ice_shutdown_prof_masks()
3551 i < hw->blk[blk].masks.first + hw->blk[blk].masks.count; i++) { in ice_shutdown_prof_masks()
3552 ice_write_prof_mask_reg(hw, blk, i, 0, 0); in ice_shutdown_prof_masks()
3554 hw->blk[blk].masks.masks[i].in_use = false; in ice_shutdown_prof_masks()
3555 hw->blk[blk].masks.masks[i].idx = 0; in ice_shutdown_prof_masks()
3556 hw->blk[blk].masks.masks[i].mask = 0; in ice_shutdown_prof_masks()
3559 mutex_unlock(&hw->blk[blk].masks.lock); in ice_shutdown_prof_masks()
3560 mutex_destroy(&hw->blk[blk].masks.lock); in ice_shutdown_prof_masks()
3578 * @blk: hardware block
3583 ice_update_prof_masking(struct ice_hw *hw, enum ice_block blk, u16 prof_id, in ice_update_prof_masking() argument
3592 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_update_prof_masking()
3595 for (i = 0; i < hw->blk[blk].es.fvw; i++) in ice_update_prof_masking()
3597 if (!ice_alloc_prof_mask(hw, blk, i, masks[i], &idx)) { in ice_update_prof_masking()
3610 ice_free_prof_mask(hw, blk, i); in ice_update_prof_masking()
3616 ice_write_prof_mask_enable_res(hw, blk, prof_id, ena_mask); in ice_update_prof_masking()
3619 hw->blk[blk].es.mask_ena[prof_id] = ena_mask; in ice_update_prof_masking()
3627 * @blk: the block in which to write the extraction sequence
3632 ice_write_es(struct ice_hw *hw, enum ice_block blk, u8 prof_id, in ice_write_es() argument
3637 off = prof_id * hw->blk[blk].es.fvw; in ice_write_es()
3639 memset(&hw->blk[blk].es.t[off], 0, in ice_write_es()
3640 hw->blk[blk].es.fvw * sizeof(*fv)); in ice_write_es()
3641 hw->blk[blk].es.written[prof_id] = false; in ice_write_es()
3643 memcpy(&hw->blk[blk].es.t[off], fv, in ice_write_es()
3644 hw->blk[blk].es.fvw * sizeof(*fv)); in ice_write_es()
3651 * @blk: the block from which to free the profile ID
3655 ice_prof_dec_ref(struct ice_hw *hw, enum ice_block blk, u8 prof_id) in ice_prof_dec_ref() argument
3657 if (prof_id > hw->blk[blk].es.count) in ice_prof_dec_ref()
3660 if (hw->blk[blk].es.ref_count[prof_id] > 0) { in ice_prof_dec_ref()
3661 if (!--hw->blk[blk].es.ref_count[prof_id]) { in ice_prof_dec_ref()
3662 ice_write_es(hw, blk, prof_id, NULL); in ice_prof_dec_ref()
3663 ice_free_prof_masks(hw, blk, prof_id); in ice_prof_dec_ref()
3664 return ice_free_prof_id(hw, blk, prof_id); in ice_prof_dec_ref()
3717 * @blk: the HW block to initialize
3719 static void ice_init_sw_xlt1_db(struct ice_hw *hw, enum ice_block blk) in ice_init_sw_xlt1_db() argument
3723 for (pt = 0; pt < hw->blk[blk].xlt1.count; pt++) { in ice_init_sw_xlt1_db()
3726 ptg = hw->blk[blk].xlt1.t[pt]; in ice_init_sw_xlt1_db()
3728 ice_ptg_alloc_val(hw, blk, ptg); in ice_init_sw_xlt1_db()
3729 ice_ptg_add_mv_ptype(hw, blk, pt, ptg); in ice_init_sw_xlt1_db()
3737 * @blk: the HW block to initialize
3739 static void ice_init_sw_xlt2_db(struct ice_hw *hw, enum ice_block blk) in ice_init_sw_xlt2_db() argument
3743 for (vsi = 0; vsi < hw->blk[blk].xlt2.count; vsi++) { in ice_init_sw_xlt2_db()
3746 vsig = hw->blk[blk].xlt2.t[vsi]; in ice_init_sw_xlt2_db()
3748 ice_vsig_alloc_val(hw, blk, vsig); in ice_init_sw_xlt2_db()
3749 ice_vsig_add_mv_vsi(hw, blk, vsi, vsig); in ice_init_sw_xlt2_db()
3753 hw->blk[blk].xlt2.vsis[vsi].changed = 0; in ice_init_sw_xlt2_db()
3819 sizeof(*hw->blk[block_id].xlt1.t); in ice_fill_tbl()
3820 dst = hw->blk[block_id].xlt1.t; in ice_fill_tbl()
3821 dst_len = hw->blk[block_id].xlt1.count * in ice_fill_tbl()
3822 sizeof(*hw->blk[block_id].xlt1.t); in ice_fill_tbl()
3832 sizeof(*hw->blk[block_id].xlt2.t); in ice_fill_tbl()
3833 dst = (u8 *)hw->blk[block_id].xlt2.t; in ice_fill_tbl()
3834 dst_len = hw->blk[block_id].xlt2.count * in ice_fill_tbl()
3835 sizeof(*hw->blk[block_id].xlt2.t); in ice_fill_tbl()
3845 sizeof(*hw->blk[block_id].prof.t); in ice_fill_tbl()
3846 dst = (u8 *)hw->blk[block_id].prof.t; in ice_fill_tbl()
3847 dst_len = hw->blk[block_id].prof.count * in ice_fill_tbl()
3848 sizeof(*hw->blk[block_id].prof.t); in ice_fill_tbl()
3858 sizeof(*hw->blk[block_id].prof_redir.t); in ice_fill_tbl()
3859 dst = hw->blk[block_id].prof_redir.t; in ice_fill_tbl()
3860 dst_len = hw->blk[block_id].prof_redir.count * in ice_fill_tbl()
3861 sizeof(*hw->blk[block_id].prof_redir.t); in ice_fill_tbl()
3871 hw->blk[block_id].es.fvw) * in ice_fill_tbl()
3872 sizeof(*hw->blk[block_id].es.t); in ice_fill_tbl()
3873 dst = (u8 *)hw->blk[block_id].es.t; in ice_fill_tbl()
3874 dst_len = (u32)(hw->blk[block_id].es.count * in ice_fill_tbl()
3875 hw->blk[block_id].es.fvw) * in ice_fill_tbl()
3876 sizeof(*hw->blk[block_id].es.t); in ice_fill_tbl()
3917 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].xlt1.sid); in ice_fill_blk_tbls()
3918 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].xlt2.sid); in ice_fill_blk_tbls()
3919 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].prof.sid); in ice_fill_blk_tbls()
3920 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].prof_redir.sid); in ice_fill_blk_tbls()
3921 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].es.sid); in ice_fill_blk_tbls()
3934 struct ice_es *es = &hw->blk[blk_idx].es; in ice_free_prof_map()
3979 * @blk: the HW block on which to free the VSIG table entries
3981 static void ice_free_vsig_tbl(struct ice_hw *hw, enum ice_block blk) in ice_free_vsig_tbl() argument
3985 if (!hw->blk[blk].xlt2.vsig_tbl) in ice_free_vsig_tbl()
3989 if (hw->blk[blk].xlt2.vsig_tbl[i].in_use) in ice_free_vsig_tbl()
3990 ice_vsig_free(hw, blk, i); in ice_free_vsig_tbl()
4003 if (hw->blk[i].is_list_init) { in ice_free_hw_tbls()
4004 struct ice_es *es = &hw->blk[i].es; in ice_free_hw_tbls()
4012 hw->blk[i].is_list_init = false; in ice_free_hw_tbls()
4015 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt1.ptypes); in ice_free_hw_tbls()
4016 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt1.ptg_tbl); in ice_free_hw_tbls()
4017 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt1.t); in ice_free_hw_tbls()
4018 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt2.t); in ice_free_hw_tbls()
4019 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt2.vsig_tbl); in ice_free_hw_tbls()
4020 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt2.vsis); in ice_free_hw_tbls()
4021 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].prof.t); in ice_free_hw_tbls()
4022 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].prof_redir.t); in ice_free_hw_tbls()
4023 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.t); in ice_free_hw_tbls()
4024 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.ref_count); in ice_free_hw_tbls()
4025 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.written); in ice_free_hw_tbls()
4026 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.mask_ena); in ice_free_hw_tbls()
4035 memset(hw->blk, 0, sizeof(hw->blk)); in ice_free_hw_tbls()
4058 struct ice_prof_redir *prof_redir = &hw->blk[i].prof_redir; in ice_clear_hw_tbls()
4059 struct ice_prof_tcam *prof = &hw->blk[i].prof; in ice_clear_hw_tbls()
4060 struct ice_xlt1 *xlt1 = &hw->blk[i].xlt1; in ice_clear_hw_tbls()
4061 struct ice_xlt2 *xlt2 = &hw->blk[i].xlt2; in ice_clear_hw_tbls()
4062 struct ice_es *es = &hw->blk[i].es; in ice_clear_hw_tbls()
4064 if (hw->blk[i].is_list_init) { in ice_clear_hw_tbls()
4104 struct ice_prof_redir *prof_redir = &hw->blk[i].prof_redir; in ice_init_hw_tbls()
4105 struct ice_prof_tcam *prof = &hw->blk[i].prof; in ice_init_hw_tbls()
4106 struct ice_xlt1 *xlt1 = &hw->blk[i].xlt1; in ice_init_hw_tbls()
4107 struct ice_xlt2 *xlt2 = &hw->blk[i].xlt2; in ice_init_hw_tbls()
4108 struct ice_es *es = &hw->blk[i].es; in ice_init_hw_tbls()
4111 if (hw->blk[i].is_list_init) in ice_init_hw_tbls()
4117 hw->blk[i].is_list_init = true; in ice_init_hw_tbls()
4119 hw->blk[i].overwrite = blk_sizes[i].overwrite; in ice_init_hw_tbls()
4221 * @blk: the block in which to write profile ID to
4232 ice_prof_gen_key(struct ice_hw *hw, enum ice_block blk, u8 ptg, u16 vsig, in ice_prof_gen_key() argument
4243 switch (hw->blk[blk].prof.cdid_bits) { in ice_prof_gen_key()
4276 * @blk: the block in which to write profile ID to
4288 ice_tcam_write_entry(struct ice_hw *hw, enum ice_block blk, u16 idx, in ice_tcam_write_entry() argument
4297 status = ice_prof_gen_key(hw, blk, ptg, vsig, cdid, flags, vl_msk, in ice_tcam_write_entry()
4298 dc_msk, nm_msk, hw->blk[blk].prof.t[idx].key); in ice_tcam_write_entry()
4300 hw->blk[blk].prof.t[idx].addr = cpu_to_le16(idx); in ice_tcam_write_entry()
4301 hw->blk[blk].prof.t[idx].prof_id = prof_id; in ice_tcam_write_entry()
4310 * @blk: HW block
4315 ice_vsig_get_ref(struct ice_hw *hw, enum ice_block blk, u16 vsig, u16 *refs) in ice_vsig_get_ref() argument
4322 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_get_ref()
4325 ptr = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_get_ref()
4337 * @blk: HW block
4342 ice_has_prof_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl) in ice_has_prof_vsig() argument
4347 list_for_each_entry(ent, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_has_prof_vsig()
4360 * @blk: hardware block
4365 ice_prof_bld_es(struct ice_hw *hw, enum ice_block blk, in ice_prof_bld_es() argument
4368 u16 vec_size = hw->blk[blk].es.fvw * sizeof(struct ice_fv_word); in ice_prof_bld_es()
4373 u16 off = tmp->prof_id * hw->blk[blk].es.fvw; in ice_prof_bld_es()
4377 id = ice_sect_id(blk, ICE_VEC_TBL); in ice_prof_bld_es()
4389 memcpy(p->es, &hw->blk[blk].es.t[off], vec_size); in ice_prof_bld_es()
4398 * @blk: hardware block
4403 ice_prof_bld_tcam(struct ice_hw *hw, enum ice_block blk, in ice_prof_bld_tcam() argument
4413 id = ice_sect_id(blk, ICE_PROF_TCAM); in ice_prof_bld_tcam()
4425 &hw->blk[blk].prof.t[tmp->tcam_idx].key, in ice_prof_bld_tcam()
4426 sizeof(hw->blk[blk].prof.t->key)); in ice_prof_bld_tcam()
4434 * @blk: hardware block
4439 ice_prof_bld_xlt1(enum ice_block blk, struct ice_buf_build *bld, in ice_prof_bld_xlt1() argument
4449 id = ice_sect_id(blk, ICE_XLT1); in ice_prof_bld_xlt1()
4466 * @blk: hardware block
4471 ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld, in ice_prof_bld_xlt2() argument
4484 id = ice_sect_id(blk, ICE_XLT2); in ice_prof_bld_xlt2()
4506 * @blk: hardware block
4510 ice_upd_prof_hw(struct ice_hw *hw, enum ice_block blk, in ice_upd_prof_hw() argument
4560 status = ice_prof_bld_es(hw, blk, b, chgs); in ice_upd_prof_hw()
4566 status = ice_prof_bld_tcam(hw, blk, b, chgs); in ice_upd_prof_hw()
4572 status = ice_prof_bld_xlt1(blk, b, chgs); in ice_upd_prof_hw()
4578 status = ice_prof_bld_xlt2(blk, b, chgs); in ice_upd_prof_hw()
4682 for (i = 0; i < hw->blk[ICE_BLK_FD].es.fvw; i++) { in ice_update_fd_swap()
4738 si = hw->blk[ICE_BLK_FD].es.fvw - 1; in ice_update_fd_swap()
4775 for (j = 0; j < hw->blk[ICE_BLK_FD].es.fvw / 4; j++) { in ice_update_fd_swap()
4865 * @blk: hardware block
4879 ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], in ice_add_prof() argument
4892 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof()
4895 status = ice_find_prof_id_with_mask(hw, blk, es, masks, &prof_id); in ice_add_prof()
4898 status = ice_alloc_prof_id(hw, blk, &prof_id); in ice_add_prof()
4901 if (blk == ICE_BLK_FD) { in ice_add_prof()
4913 status = ice_update_prof_masking(hw, blk, prof_id, masks); in ice_add_prof()
4918 ice_write_es(hw, blk, prof_id, es); in ice_add_prof()
4921 ice_prof_inc_ref(hw, blk, prof_id); in ice_add_prof()
4956 if (ice_ptg_find_ptype(hw, blk, ptype, &ptg)) in ice_add_prof()
4989 list_add(&prof->list, &hw->blk[blk].es.prof_map); in ice_add_prof()
4993 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof()
5000 * @blk: hardware block
5007 ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id) in ice_search_prof_id() argument
5012 list_for_each_entry(map, &hw->blk[blk].es.prof_map, list) in ice_search_prof_id()
5024 * @blk: hardware block
5028 ice_vsig_prof_id_count(struct ice_hw *hw, enum ice_block blk, u16 vsig) in ice_vsig_prof_id_count() argument
5033 list_for_each_entry(p, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_vsig_prof_id_count()
5043 * @blk: hardware block
5046 static int ice_rel_tcam_idx(struct ice_hw *hw, enum ice_block blk, u16 idx) in ice_rel_tcam_idx() argument
5055 status = ice_tcam_write_entry(hw, blk, idx, 0, 0, 0, 0, 0, vl_msk, in ice_rel_tcam_idx()
5061 status = ice_free_tcam_ent(hw, blk, idx); in ice_rel_tcam_idx()
5069 * @blk: hardware block
5073 ice_rem_prof_id(struct ice_hw *hw, enum ice_block blk, in ice_rem_prof_id() argument
5082 status = ice_rel_tcam_idx(hw, blk, in ice_rem_prof_id()
5094 * @blk: hardware block
5099 ice_rem_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, in ice_rem_vsig() argument
5109 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_rem_vsig()
5111 status = ice_rem_prof_id(hw, blk, d); in ice_rem_vsig()
5120 vsi_cur = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_rem_vsig()
5137 p->vsi = vsi_cur - hw->blk[blk].xlt2.vsis; in ice_rem_vsig()
5144 return ice_vsig_free(hw, blk, vsig); in ice_rem_vsig()
5150 * @blk: hardware block
5156 ice_rem_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, in ice_rem_prof_id_vsig() argument
5164 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_rem_prof_id_vsig()
5167 if (ice_vsig_prof_id_count(hw, blk, vsig) == 1) in ice_rem_prof_id_vsig()
5169 return ice_rem_vsig(hw, blk, vsig, chg); in ice_rem_prof_id_vsig()
5171 status = ice_rem_prof_id(hw, blk, p); in ice_rem_prof_id_vsig()
5185 * @blk: hardware block
5188 static int ice_rem_flow_all(struct ice_hw *hw, enum ice_block blk, u64 id) in ice_rem_flow_all() argument
5198 if (hw->blk[blk].xlt2.vsig_tbl[i].in_use) { in ice_rem_flow_all()
5199 if (ice_has_prof_vsig(hw, blk, i, id)) { in ice_rem_flow_all()
5200 status = ice_rem_prof_id_vsig(hw, blk, i, id, in ice_rem_flow_all()
5207 status = ice_upd_prof_hw(hw, blk, &chg); in ice_rem_flow_all()
5221 * @blk: hardware block
5228 int ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id) in ice_rem_prof() argument
5233 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_rem_prof()
5235 pmap = ice_search_prof_id(hw, blk, id); in ice_rem_prof()
5242 status = ice_rem_flow_all(hw, blk, pmap->profile_cookie); in ice_rem_prof()
5247 ice_prof_dec_ref(hw, blk, pmap->prof_id); in ice_rem_prof()
5253 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_rem_prof()
5260 * @blk: hardware block
5265 ice_get_prof(struct ice_hw *hw, enum ice_block blk, u64 hdl, in ice_get_prof() argument
5273 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_get_prof()
5275 map = ice_search_prof_id(hw, blk, hdl); in ice_get_prof()
5282 if (!hw->blk[blk].es.written[map->prof_id]) { in ice_get_prof()
5299 hw->blk[blk].es.written[map->prof_id] = true; in ice_get_prof()
5305 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_get_prof()
5313 * @blk: hardware block
5320 ice_get_profs_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, in ice_get_profs_vsig() argument
5326 list_for_each_entry(ent1, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_get_profs_vsig()
5353 * @blk: hardware block
5358 ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk, in ice_add_prof_to_lst() argument
5366 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_to_lst()
5367 map = ice_search_prof_id(hw, blk, hdl); in ice_add_prof_to_lst()
5392 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_to_lst()
5399 * @blk: hardware block
5405 ice_move_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig, in ice_move_vsi() argument
5416 status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); in ice_move_vsi()
5418 status = ice_vsig_add_mv_vsi(hw, blk, vsi, vsig); in ice_move_vsi()
5456 * @blk: hardware block
5465 ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable, in ice_prof_tcam_ena_dis() argument
5478 status = ice_rel_tcam_idx(hw, blk, tcam->tcam_idx); in ice_prof_tcam_ena_dis()
5495 status = ice_alloc_tcam_ent(hw, blk, tcam->attr.mask == 0, in ice_prof_tcam_ena_dis()
5505 status = ice_tcam_write_entry(hw, blk, tcam->tcam_idx, tcam->prof_id, in ice_prof_tcam_ena_dis()
5533 * @blk: hardware block
5538 ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig, in ice_adj_prof_priorities() argument
5558 list_for_each_entry(t, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_adj_prof_priorities()
5572 status = ice_prof_tcam_ena_dis(hw, blk, false, in ice_adj_prof_priorities()
5583 status = ice_prof_tcam_ena_dis(hw, blk, true, in ice_adj_prof_priorities()
5602 * @blk: hardware block
5609 ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, in ice_add_prof_id_vsig() argument
5623 if (ice_has_prof_vsig(hw, blk, vsig, hdl)) in ice_add_prof_id_vsig()
5631 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
5633 map = ice_search_prof_id(hw, blk, hdl); in ice_add_prof_id_vsig()
5659 status = ice_alloc_tcam_ent(hw, blk, map->attr[i].mask == 0, in ice_add_prof_id_vsig()
5680 status = ice_tcam_write_entry(hw, blk, t->tcam[i].tcam_idx, in ice_add_prof_id_vsig()
5697 &hw->blk[blk].xlt2.vsig_tbl[vsig_idx].prop_lst); in ice_add_prof_id_vsig()
5700 &hw->blk[blk].xlt2.vsig_tbl[vsig_idx].prop_lst); in ice_add_prof_id_vsig()
5702 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
5706 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
5715 * @blk: hardware block
5721 ice_create_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl, in ice_create_prof_id_vsig() argument
5732 new_vsig = ice_vsig_alloc(hw, blk); in ice_create_prof_id_vsig()
5738 status = ice_move_vsi(hw, blk, vsi, new_vsig, chg); in ice_create_prof_id_vsig()
5742 status = ice_add_prof_id_vsig(hw, blk, new_vsig, hdl, false, chg); in ice_create_prof_id_vsig()
5764 * @blk: hardware block
5771 ice_create_vsig_from_lst(struct ice_hw *hw, enum ice_block blk, u16 vsi, in ice_create_vsig_from_lst() argument
5779 vsig = ice_vsig_alloc(hw, blk); in ice_create_vsig_from_lst()
5783 status = ice_move_vsi(hw, blk, vsi, vsig, chg); in ice_create_vsig_from_lst()
5789 status = ice_add_prof_id_vsig(hw, blk, vsig, t->profile_cookie, in ice_create_vsig_from_lst()
5803 * @blk: hardware block
5808 ice_find_prof_vsig(struct ice_hw *hw, enum ice_block blk, u64 hdl, u16 *vsig) in ice_find_prof_vsig() argument
5823 status = ice_find_dup_props_vsig(hw, blk, &lst, vsig); in ice_find_prof_vsig()
5834 * @blk: hardware block
5843 ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl) in ice_add_prof_id_flow() argument
5856 status = ice_get_prof(hw, blk, hdl, &chg); in ice_add_prof_id_flow()
5861 status = ice_vsig_find_vsi(hw, blk, vsi, &vsig); in ice_add_prof_id_flow()
5874 if (ice_has_prof_vsig(hw, blk, vsig, hdl)) { in ice_add_prof_id_flow()
5880 status = ice_vsig_get_ref(hw, blk, vsig, &ref); in ice_add_prof_id_flow()
5888 status = ice_get_profs_vsig(hw, blk, vsig, &union_lst); in ice_add_prof_id_flow()
5892 status = ice_add_prof_to_lst(hw, blk, &union_lst, hdl); in ice_add_prof_id_flow()
5897 status = ice_find_dup_props_vsig(hw, blk, &union_lst, &vsig); in ice_add_prof_id_flow()
5900 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_add_prof_id_flow()
5908 status = ice_rem_vsig(hw, blk, or_vsig, &chg); in ice_add_prof_id_flow()
5918 status = ice_add_prof_id_vsig(hw, blk, vsig, hdl, false, in ice_add_prof_id_flow()
5924 status = ice_adj_prof_priorities(hw, blk, vsig, &chg); in ice_add_prof_id_flow()
5929 status = ice_create_vsig_from_lst(hw, blk, vsi, in ice_add_prof_id_flow()
5936 status = ice_adj_prof_priorities(hw, blk, vsig, &chg); in ice_add_prof_id_flow()
5943 if (ice_find_prof_vsig(hw, blk, hdl, &vsig)) { in ice_add_prof_id_flow()
5946 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_add_prof_id_flow()
5952 status = ice_create_prof_id_vsig(hw, blk, vsi, hdl, in ice_add_prof_id_flow()
5961 status = ice_upd_prof_hw(hw, blk, &chg); in ice_add_prof_id_flow()
6001 * @blk: hardware block
6010 ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl) in ice_rem_prof_id_flow() argument
6022 status = ice_vsig_find_vsi(hw, blk, vsi, &vsig); in ice_rem_prof_id_flow()
6029 last_profile = ice_vsig_prof_id_count(hw, blk, vsig) == 1; in ice_rem_prof_id_flow()
6030 status = ice_vsig_get_ref(hw, blk, vsig, &ref); in ice_rem_prof_id_flow()
6046 status = ice_rem_vsig(hw, blk, vsig, &chg); in ice_rem_prof_id_flow()
6050 status = ice_rem_prof_id_vsig(hw, blk, vsig, in ice_rem_prof_id_flow()
6056 status = ice_adj_prof_priorities(hw, blk, vsig, in ice_rem_prof_id_flow()
6064 status = ice_get_profs_vsig(hw, blk, vsig, ©); in ice_rem_prof_id_flow()
6074 status = ice_move_vsi(hw, blk, vsi, in ice_rem_prof_id_flow()
6079 } else if (!ice_find_dup_props_vsig(hw, blk, ©, in ice_rem_prof_id_flow()
6088 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_rem_prof_id_flow()
6096 status = ice_create_vsig_from_lst(hw, blk, vsi, in ice_rem_prof_id_flow()
6103 status = ice_adj_prof_priorities(hw, blk, vsig, in ice_rem_prof_id_flow()
6115 status = ice_upd_prof_hw(hw, blk, &chg); in ice_rem_prof_id_flow()