Lines Matching refs:blk
84 static u32 ice_sect_id(enum ice_block blk, enum ice_sect sect) in ice_sect_id() argument
86 return ice_sect_lkup[blk][sect]; in ice_sect_id()
630 ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx, in ice_find_prot_off() argument
635 if (prof >= hw->blk[blk].es.count) in ice_find_prot_off()
638 if (fv_idx >= hw->blk[blk].es.fvw) in ice_find_prot_off()
641 fv_ext = hw->blk[blk].es.t + (prof * hw->blk[blk].es.fvw); in ice_find_prot_off()
663 ice_ptg_find_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 *ptg) in ice_ptg_find_ptype() argument
668 *ptg = hw->blk[blk].xlt1.ptypes[ptype].ptg; in ice_ptg_find_ptype()
681 static void ice_ptg_alloc_val(struct ice_hw *hw, enum ice_block blk, u8 ptg) in ice_ptg_alloc_val() argument
683 hw->blk[blk].xlt1.ptg_tbl[ptg].in_use = true; in ice_ptg_alloc_val()
697 ice_ptg_remove_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 ptg) in ice_ptg_remove_ptype() argument
705 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].in_use) in ice_ptg_remove_ptype()
709 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype) in ice_ptg_remove_ptype()
713 p = hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; in ice_ptg_remove_ptype()
714 ch = &hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; in ice_ptg_remove_ptype()
716 if (ptype == (p - hw->blk[blk].xlt1.ptypes)) { in ice_ptg_remove_ptype()
725 hw->blk[blk].xlt1.ptypes[ptype].ptg = ICE_DEFAULT_PTG; in ice_ptg_remove_ptype()
726 hw->blk[blk].xlt1.ptypes[ptype].next_ptype = NULL; in ice_ptg_remove_ptype()
744 ice_ptg_add_mv_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 ptg) in ice_ptg_add_mv_ptype() argument
752 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].in_use && ptg != ICE_DEFAULT_PTG) in ice_ptg_add_mv_ptype()
755 status = ice_ptg_find_ptype(hw, blk, ptype, &original_ptg); in ice_ptg_add_mv_ptype()
765 ice_ptg_remove_ptype(hw, blk, ptype, original_ptg); in ice_ptg_add_mv_ptype()
772 hw->blk[blk].xlt1.ptypes[ptype].next_ptype = in ice_ptg_add_mv_ptype()
773 hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; in ice_ptg_add_mv_ptype()
774 hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype = in ice_ptg_add_mv_ptype()
775 &hw->blk[blk].xlt1.ptypes[ptype]; in ice_ptg_add_mv_ptype()
777 hw->blk[blk].xlt1.ptypes[ptype].ptg = ptg; in ice_ptg_add_mv_ptype()
778 hw->blk[blk].xlt1.t[ptype] = ptg; in ice_ptg_add_mv_ptype()
888 ice_vsig_find_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 *vsig) in ice_vsig_find_vsi() argument
897 *vsig = hw->blk[blk].xlt2.vsis[vsi].vsig; in ice_vsig_find_vsi()
910 static u16 ice_vsig_alloc_val(struct ice_hw *hw, enum ice_block blk, u16 vsig) in ice_vsig_alloc_val() argument
914 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) { in ice_vsig_alloc_val()
915 INIT_LIST_HEAD(&hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst); in ice_vsig_alloc_val()
916 hw->blk[blk].xlt2.vsig_tbl[idx].in_use = true; in ice_vsig_alloc_val()
930 static u16 ice_vsig_alloc(struct ice_hw *hw, enum ice_block blk) in ice_vsig_alloc() argument
935 if (!hw->blk[blk].xlt2.vsig_tbl[i].in_use) in ice_vsig_alloc()
936 return ice_vsig_alloc_val(hw, blk, i); in ice_vsig_alloc()
957 ice_find_dup_props_vsig(struct ice_hw *hw, enum ice_block blk, in ice_find_dup_props_vsig() argument
960 struct ice_xlt2 *xlt2 = &hw->blk[blk].xlt2; in ice_find_dup_props_vsig()
982 static int ice_vsig_free(struct ice_hw *hw, enum ice_block blk, u16 vsig) in ice_vsig_free() argument
992 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_free()
995 hw->blk[blk].xlt2.vsig_tbl[idx].in_use = false; in ice_vsig_free()
997 vsi_cur = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_free()
1013 hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi = NULL; in ice_vsig_free()
1018 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_vsig_free()
1027 INIT_LIST_HEAD(&hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst); in ice_vsig_free()
1043 ice_vsig_remove_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig) in ice_vsig_remove_vsi() argument
1053 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_remove_vsi()
1060 vsi_head = &hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_remove_vsi()
1064 vsi_tgt = &hw->blk[blk].xlt2.vsis[vsi]; in ice_vsig_remove_vsi()
1101 ice_vsig_add_mv_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig) in ice_vsig_add_mv_vsi() argument
1115 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use && in ice_vsig_add_mv_vsi()
1119 status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); in ice_vsig_add_mv_vsi()
1129 status = ice_vsig_remove_vsi(hw, blk, vsi, orig_vsig); in ice_vsig_add_mv_vsi()
1138 hw->blk[blk].xlt2.vsis[vsi].vsig = vsig; in ice_vsig_add_mv_vsi()
1139 hw->blk[blk].xlt2.vsis[vsi].changed = 1; in ice_vsig_add_mv_vsi()
1142 tmp = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_add_mv_vsi()
1143 hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi = in ice_vsig_add_mv_vsi()
1144 &hw->blk[blk].xlt2.vsis[vsi]; in ice_vsig_add_mv_vsi()
1145 hw->blk[blk].xlt2.vsis[vsi].next_vsi = tmp; in ice_vsig_add_mv_vsi()
1146 hw->blk[blk].xlt2.t[vsi] = vsig; in ice_vsig_add_mv_vsi()
1160 ice_prof_has_mask_idx(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 idx, in ice_prof_has_mask_idx() argument
1173 for (i = hw->blk[blk].masks.first; i < hw->blk[blk].masks.first + in ice_prof_has_mask_idx()
1174 hw->blk[blk].masks.count; i++) in ice_prof_has_mask_idx()
1175 if (hw->blk[blk].es.mask_ena[prof] & BIT(i)) in ice_prof_has_mask_idx()
1176 if (hw->blk[blk].masks.masks[i].in_use && in ice_prof_has_mask_idx()
1177 hw->blk[blk].masks.masks[i].idx == idx) { in ice_prof_has_mask_idx()
1179 if (hw->blk[blk].masks.masks[i].mask == mask) in ice_prof_has_mask_idx()
1203 ice_prof_has_mask(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 *masks) in ice_prof_has_mask() argument
1208 for (i = 0; i < hw->blk[blk].es.fvw; i++) in ice_prof_has_mask()
1209 if (!ice_prof_has_mask_idx(hw, blk, prof, i, masks[i])) in ice_prof_has_mask()
1225 ice_find_prof_id_with_mask(struct ice_hw *hw, enum ice_block blk, in ice_find_prof_id_with_mask() argument
1229 struct ice_es *es = &hw->blk[blk].es; in ice_find_prof_id_with_mask()
1235 if (blk == ICE_BLK_FD) in ice_find_prof_id_with_mask()
1241 if (blk == ICE_BLK_RSS && es->symm[i] != symm) in ice_find_prof_id_with_mask()
1248 if (masks && !ice_prof_has_mask(hw, blk, i, masks)) in ice_find_prof_id_with_mask()
1263 static bool ice_prof_id_rsrc_type(enum ice_block blk, u16 *rsrc_type) in ice_prof_id_rsrc_type() argument
1265 switch (blk) { in ice_prof_id_rsrc_type()
1283 static bool ice_tcam_ent_rsrc_type(enum ice_block blk, u16 *rsrc_type) in ice_tcam_ent_rsrc_type() argument
1285 switch (blk) { in ice_tcam_ent_rsrc_type()
1309 ice_alloc_tcam_ent(struct ice_hw *hw, enum ice_block blk, bool btm, in ice_alloc_tcam_ent() argument
1314 if (!ice_tcam_ent_rsrc_type(blk, &res_type)) in ice_alloc_tcam_ent()
1329 ice_free_tcam_ent(struct ice_hw *hw, enum ice_block blk, u16 tcam_idx) in ice_free_tcam_ent() argument
1333 if (!ice_tcam_ent_rsrc_type(blk, &res_type)) in ice_free_tcam_ent()
1348 static int ice_alloc_prof_id(struct ice_hw *hw, enum ice_block blk, u8 *prof_id) in ice_alloc_prof_id() argument
1354 if (!ice_prof_id_rsrc_type(blk, &res_type)) in ice_alloc_prof_id()
1372 static int ice_free_prof_id(struct ice_hw *hw, enum ice_block blk, u8 prof_id) in ice_free_prof_id() argument
1377 if (!ice_prof_id_rsrc_type(blk, &res_type)) in ice_free_prof_id()
1389 static int ice_prof_inc_ref(struct ice_hw *hw, enum ice_block blk, u8 prof_id) in ice_prof_inc_ref() argument
1391 if (prof_id > hw->blk[blk].es.count) in ice_prof_inc_ref()
1394 hw->blk[blk].es.ref_count[prof_id]++; in ice_prof_inc_ref()
1408 ice_write_prof_mask_reg(struct ice_hw *hw, enum ice_block blk, u16 mask_idx, in ice_write_prof_mask_reg() argument
1414 switch (blk) { in ice_write_prof_mask_reg()
1427 blk); in ice_write_prof_mask_reg()
1433 blk, idx, offset, val); in ice_write_prof_mask_reg()
1444 ice_write_prof_mask_enable_res(struct ice_hw *hw, enum ice_block blk, in ice_write_prof_mask_enable_res() argument
1449 switch (blk) { in ice_write_prof_mask_enable_res()
1458 blk); in ice_write_prof_mask_enable_res()
1464 blk, prof_id, offset, enable_mask); in ice_write_prof_mask_enable_res()
1472 static void ice_init_prof_masks(struct ice_hw *hw, enum ice_block blk) in ice_init_prof_masks() argument
1477 mutex_init(&hw->blk[blk].masks.lock); in ice_init_prof_masks()
1481 hw->blk[blk].masks.count = per_pf; in ice_init_prof_masks()
1482 hw->blk[blk].masks.first = hw->pf_id * per_pf; in ice_init_prof_masks()
1484 memset(hw->blk[blk].masks.masks, 0, sizeof(hw->blk[blk].masks.masks)); in ice_init_prof_masks()
1486 for (i = hw->blk[blk].masks.first; in ice_init_prof_masks()
1487 i < hw->blk[blk].masks.first + hw->blk[blk].masks.count; i++) in ice_init_prof_masks()
1488 ice_write_prof_mask_reg(hw, blk, i, 0, 0); in ice_init_prof_masks()
1510 ice_alloc_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 idx, u16 mask, in ice_alloc_prof_mask() argument
1518 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_alloc_prof_mask()
1521 mutex_lock(&hw->blk[blk].masks.lock); in ice_alloc_prof_mask()
1523 for (i = hw->blk[blk].masks.first; in ice_alloc_prof_mask()
1524 i < hw->blk[blk].masks.first + hw->blk[blk].masks.count; i++) in ice_alloc_prof_mask()
1525 if (hw->blk[blk].masks.masks[i].in_use) { in ice_alloc_prof_mask()
1529 if (hw->blk[blk].masks.masks[i].mask == mask && in ice_alloc_prof_mask()
1530 hw->blk[blk].masks.masks[i].idx == idx) { in ice_alloc_prof_mask()
1554 hw->blk[blk].masks.masks[i].in_use = true; in ice_alloc_prof_mask()
1555 hw->blk[blk].masks.masks[i].mask = mask; in ice_alloc_prof_mask()
1556 hw->blk[blk].masks.masks[i].idx = idx; in ice_alloc_prof_mask()
1557 hw->blk[blk].masks.masks[i].ref = 0; in ice_alloc_prof_mask()
1558 ice_write_prof_mask_reg(hw, blk, i, idx, mask); in ice_alloc_prof_mask()
1561 hw->blk[blk].masks.masks[i].ref++; in ice_alloc_prof_mask()
1566 mutex_unlock(&hw->blk[blk].masks.lock); in ice_alloc_prof_mask()
1578 ice_free_prof_mask(struct ice_hw *hw, enum ice_block blk, u16 mask_idx) in ice_free_prof_mask() argument
1580 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_free_prof_mask()
1583 if (!(mask_idx >= hw->blk[blk].masks.first && in ice_free_prof_mask()
1584 mask_idx < hw->blk[blk].masks.first + hw->blk[blk].masks.count)) in ice_free_prof_mask()
1587 mutex_lock(&hw->blk[blk].masks.lock); in ice_free_prof_mask()
1589 if (!hw->blk[blk].masks.masks[mask_idx].in_use) in ice_free_prof_mask()
1592 if (hw->blk[blk].masks.masks[mask_idx].ref > 1) { in ice_free_prof_mask()
1593 hw->blk[blk].masks.masks[mask_idx].ref--; in ice_free_prof_mask()
1598 hw->blk[blk].masks.masks[mask_idx].in_use = false; in ice_free_prof_mask()
1599 hw->blk[blk].masks.masks[mask_idx].mask = 0; in ice_free_prof_mask()
1600 hw->blk[blk].masks.masks[mask_idx].idx = 0; in ice_free_prof_mask()
1603 ice_debug(hw, ICE_DBG_PKG, "Free mask, blk %d, mask %d\n", blk, in ice_free_prof_mask()
1605 ice_write_prof_mask_reg(hw, blk, mask_idx, 0, 0); in ice_free_prof_mask()
1608 mutex_unlock(&hw->blk[blk].masks.lock); in ice_free_prof_mask()
1620 ice_free_prof_masks(struct ice_hw *hw, enum ice_block blk, u16 prof_id) in ice_free_prof_masks() argument
1625 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_free_prof_masks()
1628 mask_bm = hw->blk[blk].es.mask_ena[prof_id]; in ice_free_prof_masks()
1631 ice_free_prof_mask(hw, blk, i); in ice_free_prof_masks()
1643 static void ice_shutdown_prof_masks(struct ice_hw *hw, enum ice_block blk) in ice_shutdown_prof_masks() argument
1647 mutex_lock(&hw->blk[blk].masks.lock); in ice_shutdown_prof_masks()
1649 for (i = hw->blk[blk].masks.first; in ice_shutdown_prof_masks()
1650 i < hw->blk[blk].masks.first + hw->blk[blk].masks.count; i++) { in ice_shutdown_prof_masks()
1651 ice_write_prof_mask_reg(hw, blk, i, 0, 0); in ice_shutdown_prof_masks()
1653 hw->blk[blk].masks.masks[i].in_use = false; in ice_shutdown_prof_masks()
1654 hw->blk[blk].masks.masks[i].idx = 0; in ice_shutdown_prof_masks()
1655 hw->blk[blk].masks.masks[i].mask = 0; in ice_shutdown_prof_masks()
1658 mutex_unlock(&hw->blk[blk].masks.lock); in ice_shutdown_prof_masks()
1659 mutex_destroy(&hw->blk[blk].masks.lock); in ice_shutdown_prof_masks()
1682 ice_update_prof_masking(struct ice_hw *hw, enum ice_block blk, u16 prof_id, in ice_update_prof_masking() argument
1691 if (blk != ICE_BLK_RSS && blk != ICE_BLK_FD) in ice_update_prof_masking()
1694 for (i = 0; i < hw->blk[blk].es.fvw; i++) in ice_update_prof_masking()
1696 if (!ice_alloc_prof_mask(hw, blk, i, masks[i], &idx)) { in ice_update_prof_masking()
1709 ice_free_prof_mask(hw, blk, i); in ice_update_prof_masking()
1715 ice_write_prof_mask_enable_res(hw, blk, prof_id, ena_mask); in ice_update_prof_masking()
1718 hw->blk[blk].es.mask_ena[prof_id] = ena_mask; in ice_update_prof_masking()
1732 ice_write_es(struct ice_hw *hw, enum ice_block blk, u8 prof_id, in ice_write_es() argument
1737 off = prof_id * hw->blk[blk].es.fvw; in ice_write_es()
1739 memset(&hw->blk[blk].es.t[off], 0, in ice_write_es()
1740 hw->blk[blk].es.fvw * sizeof(*fv)); in ice_write_es()
1741 hw->blk[blk].es.written[prof_id] = false; in ice_write_es()
1743 memcpy(&hw->blk[blk].es.t[off], fv, in ice_write_es()
1744 hw->blk[blk].es.fvw * sizeof(*fv)); in ice_write_es()
1747 if (blk == ICE_BLK_RSS) in ice_write_es()
1748 hw->blk[blk].es.symm[prof_id] = symm; in ice_write_es()
1758 ice_prof_dec_ref(struct ice_hw *hw, enum ice_block blk, u8 prof_id) in ice_prof_dec_ref() argument
1760 if (prof_id > hw->blk[blk].es.count) in ice_prof_dec_ref()
1763 if (hw->blk[blk].es.ref_count[prof_id] > 0) { in ice_prof_dec_ref()
1764 if (!--hw->blk[blk].es.ref_count[prof_id]) { in ice_prof_dec_ref()
1765 ice_write_es(hw, blk, prof_id, NULL, false); in ice_prof_dec_ref()
1766 ice_free_prof_masks(hw, blk, prof_id); in ice_prof_dec_ref()
1767 return ice_free_prof_id(hw, blk, prof_id); in ice_prof_dec_ref()
1822 static void ice_init_sw_xlt1_db(struct ice_hw *hw, enum ice_block blk) in ice_init_sw_xlt1_db() argument
1826 for (pt = 0; pt < hw->blk[blk].xlt1.count; pt++) { in ice_init_sw_xlt1_db()
1829 ptg = hw->blk[blk].xlt1.t[pt]; in ice_init_sw_xlt1_db()
1831 ice_ptg_alloc_val(hw, blk, ptg); in ice_init_sw_xlt1_db()
1832 ice_ptg_add_mv_ptype(hw, blk, pt, ptg); in ice_init_sw_xlt1_db()
1842 static void ice_init_sw_xlt2_db(struct ice_hw *hw, enum ice_block blk) in ice_init_sw_xlt2_db() argument
1846 for (vsi = 0; vsi < hw->blk[blk].xlt2.count; vsi++) { in ice_init_sw_xlt2_db()
1849 vsig = hw->blk[blk].xlt2.t[vsi]; in ice_init_sw_xlt2_db()
1851 ice_vsig_alloc_val(hw, blk, vsig); in ice_init_sw_xlt2_db()
1852 ice_vsig_add_mv_vsi(hw, blk, vsi, vsig); in ice_init_sw_xlt2_db()
1856 hw->blk[blk].xlt2.vsis[vsi].changed = 0; in ice_init_sw_xlt2_db()
1922 sizeof(*hw->blk[block_id].xlt1.t); in ice_fill_tbl()
1923 dst = hw->blk[block_id].xlt1.t; in ice_fill_tbl()
1924 dst_len = hw->blk[block_id].xlt1.count * in ice_fill_tbl()
1925 sizeof(*hw->blk[block_id].xlt1.t); in ice_fill_tbl()
1935 sizeof(*hw->blk[block_id].xlt2.t); in ice_fill_tbl()
1936 dst = (u8 *)hw->blk[block_id].xlt2.t; in ice_fill_tbl()
1937 dst_len = hw->blk[block_id].xlt2.count * in ice_fill_tbl()
1938 sizeof(*hw->blk[block_id].xlt2.t); in ice_fill_tbl()
1948 sizeof(*hw->blk[block_id].prof.t); in ice_fill_tbl()
1949 dst = (u8 *)hw->blk[block_id].prof.t; in ice_fill_tbl()
1950 dst_len = hw->blk[block_id].prof.count * in ice_fill_tbl()
1951 sizeof(*hw->blk[block_id].prof.t); in ice_fill_tbl()
1961 sizeof(*hw->blk[block_id].prof_redir.t); in ice_fill_tbl()
1962 dst = hw->blk[block_id].prof_redir.t; in ice_fill_tbl()
1963 dst_len = hw->blk[block_id].prof_redir.count * in ice_fill_tbl()
1964 sizeof(*hw->blk[block_id].prof_redir.t); in ice_fill_tbl()
1974 hw->blk[block_id].es.fvw) * in ice_fill_tbl()
1975 sizeof(*hw->blk[block_id].es.t); in ice_fill_tbl()
1976 dst = (u8 *)hw->blk[block_id].es.t; in ice_fill_tbl()
1977 dst_len = (u32)(hw->blk[block_id].es.count * in ice_fill_tbl()
1978 hw->blk[block_id].es.fvw) * in ice_fill_tbl()
1979 sizeof(*hw->blk[block_id].es.t); in ice_fill_tbl()
2020 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].xlt1.sid); in ice_fill_blk_tbls()
2021 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].xlt2.sid); in ice_fill_blk_tbls()
2022 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].prof.sid); in ice_fill_blk_tbls()
2023 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].prof_redir.sid); in ice_fill_blk_tbls()
2024 ice_fill_tbl(hw, blk_id, hw->blk[blk_id].es.sid); in ice_fill_blk_tbls()
2037 struct ice_es *es = &hw->blk[blk_idx].es; in ice_free_prof_map()
2084 static void ice_free_vsig_tbl(struct ice_hw *hw, enum ice_block blk) in ice_free_vsig_tbl() argument
2088 if (!hw->blk[blk].xlt2.vsig_tbl) in ice_free_vsig_tbl()
2092 if (hw->blk[blk].xlt2.vsig_tbl[i].in_use) in ice_free_vsig_tbl()
2093 ice_vsig_free(hw, blk, i); in ice_free_vsig_tbl()
2106 if (hw->blk[i].is_list_init) { in ice_free_hw_tbls()
2107 struct ice_es *es = &hw->blk[i].es; in ice_free_hw_tbls()
2115 hw->blk[i].is_list_init = false; in ice_free_hw_tbls()
2118 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt1.ptypes); in ice_free_hw_tbls()
2119 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt1.ptg_tbl); in ice_free_hw_tbls()
2120 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt1.t); in ice_free_hw_tbls()
2121 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt2.t); in ice_free_hw_tbls()
2122 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt2.vsig_tbl); in ice_free_hw_tbls()
2123 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].xlt2.vsis); in ice_free_hw_tbls()
2124 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].prof.t); in ice_free_hw_tbls()
2125 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].prof_redir.t); in ice_free_hw_tbls()
2126 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.t); in ice_free_hw_tbls()
2127 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.ref_count); in ice_free_hw_tbls()
2128 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.symm); in ice_free_hw_tbls()
2129 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.written); in ice_free_hw_tbls()
2130 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].es.mask_ena); in ice_free_hw_tbls()
2131 devm_kfree(ice_hw_to_dev(hw), hw->blk[i].prof_id.id); in ice_free_hw_tbls()
2140 memset(hw->blk, 0, sizeof(hw->blk)); in ice_free_hw_tbls()
2163 struct ice_prof_redir *prof_redir = &hw->blk[i].prof_redir; in ice_clear_hw_tbls()
2164 struct ice_prof_id *prof_id = &hw->blk[i].prof_id; in ice_clear_hw_tbls()
2165 struct ice_prof_tcam *prof = &hw->blk[i].prof; in ice_clear_hw_tbls()
2166 struct ice_xlt1 *xlt1 = &hw->blk[i].xlt1; in ice_clear_hw_tbls()
2167 struct ice_xlt2 *xlt2 = &hw->blk[i].xlt2; in ice_clear_hw_tbls()
2168 struct ice_es *es = &hw->blk[i].es; in ice_clear_hw_tbls()
2170 if (hw->blk[i].is_list_init) { in ice_clear_hw_tbls()
2213 struct ice_prof_redir *prof_redir = &hw->blk[i].prof_redir; in ice_init_hw_tbls()
2214 struct ice_prof_id *prof_id = &hw->blk[i].prof_id; in ice_init_hw_tbls()
2215 struct ice_prof_tcam *prof = &hw->blk[i].prof; in ice_init_hw_tbls()
2216 struct ice_xlt1 *xlt1 = &hw->blk[i].xlt1; in ice_init_hw_tbls()
2217 struct ice_xlt2 *xlt2 = &hw->blk[i].xlt2; in ice_init_hw_tbls()
2218 struct ice_es *es = &hw->blk[i].es; in ice_init_hw_tbls()
2221 if (hw->blk[i].is_list_init) in ice_init_hw_tbls()
2227 hw->blk[i].is_list_init = true; in ice_init_hw_tbls()
2229 hw->blk[i].overwrite = blk_sizes[i].overwrite; in ice_init_hw_tbls()
2353 ice_prof_gen_key(struct ice_hw *hw, enum ice_block blk, u8 ptg, u16 vsig, in ice_prof_gen_key() argument
2364 switch (hw->blk[blk].prof.cdid_bits) { in ice_prof_gen_key()
2409 ice_tcam_write_entry(struct ice_hw *hw, enum ice_block blk, u16 idx, in ice_tcam_write_entry() argument
2418 status = ice_prof_gen_key(hw, blk, ptg, vsig, cdid, flags, vl_msk, in ice_tcam_write_entry()
2419 dc_msk, nm_msk, hw->blk[blk].prof.t[idx].key); in ice_tcam_write_entry()
2421 hw->blk[blk].prof.t[idx].addr = cpu_to_le16(idx); in ice_tcam_write_entry()
2422 hw->blk[blk].prof.t[idx].prof_id = prof_id; in ice_tcam_write_entry()
2436 ice_vsig_get_ref(struct ice_hw *hw, enum ice_block blk, u16 vsig, u16 *refs) in ice_vsig_get_ref() argument
2443 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_get_ref()
2446 ptr = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_get_ref()
2463 ice_has_prof_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl) in ice_has_prof_vsig() argument
2468 list_for_each_entry(ent, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_has_prof_vsig()
2486 ice_prof_bld_es(struct ice_hw *hw, enum ice_block blk, in ice_prof_bld_es() argument
2489 u16 vec_size = hw->blk[blk].es.fvw * sizeof(struct ice_fv_word); in ice_prof_bld_es()
2494 u16 off = tmp->prof_id * hw->blk[blk].es.fvw; in ice_prof_bld_es()
2498 id = ice_sect_id(blk, ICE_VEC_TBL); in ice_prof_bld_es()
2510 memcpy(p->es, &hw->blk[blk].es.t[off], vec_size); in ice_prof_bld_es()
2524 ice_prof_bld_tcam(struct ice_hw *hw, enum ice_block blk, in ice_prof_bld_tcam() argument
2534 id = ice_sect_id(blk, ICE_PROF_TCAM); in ice_prof_bld_tcam()
2546 &hw->blk[blk].prof.t[tmp->tcam_idx].key, in ice_prof_bld_tcam()
2547 sizeof(hw->blk[blk].prof.t->key)); in ice_prof_bld_tcam()
2560 ice_prof_bld_xlt1(enum ice_block blk, struct ice_buf_build *bld, in ice_prof_bld_xlt1() argument
2570 id = ice_sect_id(blk, ICE_XLT1); in ice_prof_bld_xlt1()
2592 ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld, in ice_prof_bld_xlt2() argument
2605 id = ice_sect_id(blk, ICE_XLT2); in ice_prof_bld_xlt2()
2631 ice_upd_prof_hw(struct ice_hw *hw, enum ice_block blk, in ice_upd_prof_hw() argument
2681 status = ice_prof_bld_es(hw, blk, b, chgs); in ice_upd_prof_hw()
2687 status = ice_prof_bld_tcam(hw, blk, b, chgs); in ice_upd_prof_hw()
2693 status = ice_prof_bld_xlt1(blk, b, chgs); in ice_upd_prof_hw()
2699 status = ice_prof_bld_xlt2(blk, b, chgs); in ice_upd_prof_hw()
2803 for (i = 0; i < hw->blk[ICE_BLK_FD].es.fvw; i++) { in ice_update_fd_swap()
2859 si = hw->blk[ICE_BLK_FD].es.fvw - 1; in ice_update_fd_swap()
2896 for (j = 0; j < hw->blk[ICE_BLK_FD].es.fvw / 4; j++) { in ice_update_fd_swap()
2995 fvw_num = hw->blk[ICE_BLK_FD].es.fvw / ICE_FDIR_REG_SET_SIZE; in ice_disable_fd_swap()
3046 ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[], in ice_add_prof() argument
3059 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof()
3062 status = ice_find_prof_id_with_mask(hw, blk, es, masks, symm, &prof_id); in ice_add_prof()
3065 status = ice_alloc_prof_id(hw, blk, &prof_id); in ice_add_prof()
3068 if (blk == ICE_BLK_FD && fd_swap) { in ice_add_prof()
3079 } else if (blk == ICE_BLK_FD) { in ice_add_prof()
3082 status = ice_update_prof_masking(hw, blk, prof_id, masks); in ice_add_prof()
3087 ice_write_es(hw, blk, prof_id, es, symm); in ice_add_prof()
3090 ice_prof_inc_ref(hw, blk, prof_id); in ice_add_prof()
3125 if (ice_ptg_find_ptype(hw, blk, ptype, &ptg)) in ice_add_prof()
3158 list_add(&prof->list, &hw->blk[blk].es.prof_map); in ice_add_prof()
3162 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof()
3176 ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id) in ice_search_prof_id() argument
3181 list_for_each_entry(map, &hw->blk[blk].es.prof_map, list) in ice_search_prof_id()
3197 ice_vsig_prof_id_count(struct ice_hw *hw, enum ice_block blk, u16 vsig) in ice_vsig_prof_id_count() argument
3202 list_for_each_entry(p, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_vsig_prof_id_count()
3215 static int ice_rel_tcam_idx(struct ice_hw *hw, enum ice_block blk, u16 idx) in ice_rel_tcam_idx() argument
3224 status = ice_tcam_write_entry(hw, blk, idx, 0, 0, 0, 0, 0, vl_msk, in ice_rel_tcam_idx()
3230 status = ice_free_tcam_ent(hw, blk, idx); in ice_rel_tcam_idx()
3242 ice_rem_prof_id(struct ice_hw *hw, enum ice_block blk, in ice_rem_prof_id() argument
3251 status = ice_rel_tcam_idx(hw, blk, in ice_rem_prof_id()
3268 ice_rem_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, in ice_rem_vsig() argument
3277 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_rem_vsig()
3281 status = ice_rem_prof_id(hw, blk, d); in ice_rem_vsig()
3290 vsi_cur = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_rem_vsig()
3307 p->vsi = vsi_cur - hw->blk[blk].xlt2.vsis; in ice_rem_vsig()
3314 return ice_vsig_free(hw, blk, vsig); in ice_rem_vsig()
3326 ice_rem_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, in ice_rem_prof_id_vsig() argument
3333 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_rem_prof_id_vsig()
3338 if (ice_vsig_prof_id_count(hw, blk, vsig) == 1) in ice_rem_prof_id_vsig()
3340 return ice_rem_vsig(hw, blk, vsig, chg); in ice_rem_prof_id_vsig()
3342 status = ice_rem_prof_id(hw, blk, p); in ice_rem_prof_id_vsig()
3359 static int ice_rem_flow_all(struct ice_hw *hw, enum ice_block blk, u64 id) in ice_rem_flow_all() argument
3369 if (hw->blk[blk].xlt2.vsig_tbl[i].in_use) { in ice_rem_flow_all()
3370 if (ice_has_prof_vsig(hw, blk, i, id)) { in ice_rem_flow_all()
3371 status = ice_rem_prof_id_vsig(hw, blk, i, id, in ice_rem_flow_all()
3378 status = ice_upd_prof_hw(hw, blk, &chg); in ice_rem_flow_all()
3399 int ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id) in ice_rem_prof() argument
3404 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_rem_prof()
3406 pmap = ice_search_prof_id(hw, blk, id); in ice_rem_prof()
3413 status = ice_rem_flow_all(hw, blk, pmap->profile_cookie); in ice_rem_prof()
3418 ice_prof_dec_ref(hw, blk, pmap->prof_id); in ice_rem_prof()
3424 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_rem_prof()
3436 ice_get_prof(struct ice_hw *hw, enum ice_block blk, u64 hdl, in ice_get_prof() argument
3444 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_get_prof()
3446 map = ice_search_prof_id(hw, blk, hdl); in ice_get_prof()
3453 if (!hw->blk[blk].es.written[map->prof_id]) { in ice_get_prof()
3470 hw->blk[blk].es.written[map->prof_id] = true; in ice_get_prof()
3476 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_get_prof()
3491 ice_get_profs_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, in ice_get_profs_vsig() argument
3497 list_for_each_entry(ent1, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_get_profs_vsig()
3529 ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk, in ice_add_prof_to_lst() argument
3537 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_to_lst()
3538 map = ice_search_prof_id(hw, blk, hdl); in ice_add_prof_to_lst()
3563 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_to_lst()
3576 ice_move_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig, in ice_move_vsi() argument
3587 status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); in ice_move_vsi()
3589 status = ice_vsig_add_mv_vsi(hw, blk, vsi, vsig); in ice_move_vsi()
3636 ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable, in ice_prof_tcam_ena_dis() argument
3649 status = ice_rel_tcam_idx(hw, blk, tcam->tcam_idx); in ice_prof_tcam_ena_dis()
3666 status = ice_alloc_tcam_ent(hw, blk, tcam->attr.mask == 0, in ice_prof_tcam_ena_dis()
3676 status = ice_tcam_write_entry(hw, blk, tcam->tcam_idx, tcam->prof_id, in ice_prof_tcam_ena_dis()
3709 ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig, in ice_adj_prof_priorities() argument
3729 list_for_each_entry(t, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_adj_prof_priorities()
3743 status = ice_prof_tcam_ena_dis(hw, blk, false, in ice_adj_prof_priorities()
3754 status = ice_prof_tcam_ena_dis(hw, blk, true, in ice_adj_prof_priorities()
3780 ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl, in ice_add_prof_id_vsig() argument
3794 if (ice_has_prof_vsig(hw, blk, vsig, hdl)) in ice_add_prof_id_vsig()
3802 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
3804 map = ice_search_prof_id(hw, blk, hdl); in ice_add_prof_id_vsig()
3830 status = ice_alloc_tcam_ent(hw, blk, map->attr[i].mask == 0, in ice_add_prof_id_vsig()
3851 status = ice_tcam_write_entry(hw, blk, t->tcam[i].tcam_idx, in ice_add_prof_id_vsig()
3868 &hw->blk[blk].xlt2.vsig_tbl[vsig_idx].prop_lst); in ice_add_prof_id_vsig()
3871 &hw->blk[blk].xlt2.vsig_tbl[vsig_idx].prop_lst); in ice_add_prof_id_vsig()
3873 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
3877 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
3892 ice_create_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl, in ice_create_prof_id_vsig() argument
3903 new_vsig = ice_vsig_alloc(hw, blk); in ice_create_prof_id_vsig()
3909 status = ice_move_vsi(hw, blk, vsi, new_vsig, chg); in ice_create_prof_id_vsig()
3913 status = ice_add_prof_id_vsig(hw, blk, new_vsig, hdl, false, chg); in ice_create_prof_id_vsig()
3942 ice_create_vsig_from_lst(struct ice_hw *hw, enum ice_block blk, u16 vsi, in ice_create_vsig_from_lst() argument
3950 vsig = ice_vsig_alloc(hw, blk); in ice_create_vsig_from_lst()
3954 status = ice_move_vsi(hw, blk, vsi, vsig, chg); in ice_create_vsig_from_lst()
3960 status = ice_add_prof_id_vsig(hw, blk, vsig, t->profile_cookie, in ice_create_vsig_from_lst()
3979 ice_find_prof_vsig(struct ice_hw *hw, enum ice_block blk, u64 hdl, u16 *vsig) in ice_find_prof_vsig() argument
3994 status = ice_find_dup_props_vsig(hw, blk, &lst, vsig); in ice_find_prof_vsig()
4014 ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl) in ice_add_prof_id_flow() argument
4027 status = ice_get_prof(hw, blk, hdl, &chg); in ice_add_prof_id_flow()
4032 status = ice_vsig_find_vsi(hw, blk, vsi, &vsig); in ice_add_prof_id_flow()
4045 if (ice_has_prof_vsig(hw, blk, vsig, hdl)) { in ice_add_prof_id_flow()
4051 status = ice_vsig_get_ref(hw, blk, vsig, &ref); in ice_add_prof_id_flow()
4059 status = ice_get_profs_vsig(hw, blk, vsig, &union_lst); in ice_add_prof_id_flow()
4063 status = ice_add_prof_to_lst(hw, blk, &union_lst, hdl); in ice_add_prof_id_flow()
4068 status = ice_find_dup_props_vsig(hw, blk, &union_lst, &vsig); in ice_add_prof_id_flow()
4071 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_add_prof_id_flow()
4079 status = ice_rem_vsig(hw, blk, or_vsig, &chg); in ice_add_prof_id_flow()
4089 status = ice_add_prof_id_vsig(hw, blk, vsig, hdl, false, in ice_add_prof_id_flow()
4095 status = ice_adj_prof_priorities(hw, blk, vsig, &chg); in ice_add_prof_id_flow()
4100 status = ice_create_vsig_from_lst(hw, blk, vsi, in ice_add_prof_id_flow()
4107 status = ice_adj_prof_priorities(hw, blk, vsig, &chg); in ice_add_prof_id_flow()
4114 if (ice_find_prof_vsig(hw, blk, hdl, &vsig)) { in ice_add_prof_id_flow()
4117 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_add_prof_id_flow()
4123 status = ice_create_prof_id_vsig(hw, blk, vsi, hdl, in ice_add_prof_id_flow()
4132 status = ice_upd_prof_hw(hw, blk, &chg); in ice_add_prof_id_flow()
4162 ice_flow_assoc_fdir_prof(struct ice_hw *hw, enum ice_block blk, in ice_flow_assoc_fdir_prof() argument
4168 if (blk != ICE_BLK_FD) in ice_flow_assoc_fdir_prof()
4172 status = ice_add_prof_id_flow(hw, blk, vsi_num, hdl); in ice_flow_assoc_fdir_prof()
4180 status = ice_add_prof_id_flow(hw, blk, vsi_num, hdl); in ice_flow_assoc_fdir_prof()
4191 ice_rem_prof_id_flow(hw, blk, vsi_num, hdl); in ice_flow_assoc_fdir_prof()
4229 ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl) in ice_rem_prof_id_flow() argument
4241 status = ice_vsig_find_vsi(hw, blk, vsi, &vsig); in ice_rem_prof_id_flow()
4248 last_profile = ice_vsig_prof_id_count(hw, blk, vsig) == 1; in ice_rem_prof_id_flow()
4249 status = ice_vsig_get_ref(hw, blk, vsig, &ref); in ice_rem_prof_id_flow()
4265 status = ice_rem_vsig(hw, blk, vsig, &chg); in ice_rem_prof_id_flow()
4269 status = ice_rem_prof_id_vsig(hw, blk, vsig, in ice_rem_prof_id_flow()
4275 status = ice_adj_prof_priorities(hw, blk, vsig, in ice_rem_prof_id_flow()
4283 status = ice_get_profs_vsig(hw, blk, vsig, ©); in ice_rem_prof_id_flow()
4293 status = ice_move_vsi(hw, blk, vsi, in ice_rem_prof_id_flow()
4298 } else if (!ice_find_dup_props_vsig(hw, blk, ©, in ice_rem_prof_id_flow()
4307 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_rem_prof_id_flow()
4315 status = ice_create_vsig_from_lst(hw, blk, vsi, in ice_rem_prof_id_flow()
4322 status = ice_adj_prof_priorities(hw, blk, vsig, in ice_rem_prof_id_flow()
4334 status = ice_upd_prof_hw(hw, blk, &chg); in ice_rem_prof_id_flow()