Lines Matching +full:chg +full:- +full:status
1 // SPDX-License-Identifier: GPL-2.0
77 * ice_sect_id - returns section ID
90 * ice_hw_ptype_ena - check if the PTYPE is enabled or not
97 test_bit(ptype, hw->hw_ptype); in ice_hw_ptype_ena()
112 * ice_gen_key_word - generate 16-bits of a key/mask word
120 * This function generates 16-bits from a 8-bit value, an 8-bit don't care mask
121 * and an 8-bit never match mask. The 16-bits of output are divided into 8 bits
133 * ------------------------------
145 return -EIO; in ice_gen_key_word()
150 /* encode the 8 bits into 8-bit key and 8-bit key invert */ in ice_gen_key_word()
184 * ice_bits_max_set - determine if the number of bits set is within a maximum
221 * ice_set_key - generate a variable sized key with multiples of 16-bits
224 * @val: array of 8-bit values that makes up the value portion of the key
225 * @upd: array of 8-bit masks that determine what key portion to update
226 * @dc: array of 8-bit masks that make up the don't care mask
227 * @nm: array of 8-bit masks that make up the never match mask
234 * upd == NULL --> upd mask is all 1's (update all bits)
235 * dc == NULL --> dc mask is all 0's (no don't care bits)
236 * nm == NULL --> nm mask is all 0's (no never match bits)
247 return -EIO; in ice_set_key()
251 return -EIO; in ice_set_key()
259 return -EIO; in ice_set_key()
265 return -EIO; in ice_set_key()
296 * ice_get_open_tunnel_port - retrieve an open tunnel port
308 mutex_lock(&hw->tnl_lock); in ice_get_open_tunnel_port()
310 for (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++) in ice_get_open_tunnel_port()
311 if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].port && in ice_get_open_tunnel_port()
312 (type == TNL_LAST || type == hw->tnl.tbl[i].type)) { in ice_get_open_tunnel_port()
313 *port = hw->tnl.tbl[i].port; in ice_get_open_tunnel_port()
318 mutex_unlock(&hw->tnl_lock); in ice_get_open_tunnel_port()
332 int status = -ENOSPC; in ice_upd_dvm_boost_entry() local
338 return -ENOMEM; in ice_upd_dvm_boost_entry()
348 sect_rx->count = cpu_to_le16(1); in ice_upd_dvm_boost_entry()
354 sect_tx->count = cpu_to_le16(1); in ice_upd_dvm_boost_entry()
357 memcpy(sect_rx->tcam, entry->boost_entry, sizeof(*sect_rx->tcam)); in ice_upd_dvm_boost_entry()
359 /* re-write the don't care and never match bits accordingly */ in ice_upd_dvm_boost_entry()
360 if (entry->enable) { in ice_upd_dvm_boost_entry()
372 ice_set_key((u8 *)§_rx->tcam[0].key, sizeof(sect_rx->tcam[0].key), in ice_upd_dvm_boost_entry()
376 memcpy(sect_tx->tcam, sect_rx->tcam, sizeof(*sect_tx->tcam)); in ice_upd_dvm_boost_entry()
378 status = ice_update_pkg_no_lock(hw, ice_pkg_buf(bld), 1); in ice_upd_dvm_boost_entry()
383 return status; in ice_upd_dvm_boost_entry()
396 for (i = 0; i < hw->dvm_upd.count; i++) { in ice_set_dvm_boost_entries()
397 int status; in ice_set_dvm_boost_entries() local
399 status = ice_upd_dvm_boost_entry(hw, &hw->dvm_upd.tbl[i]); in ice_set_dvm_boost_entries()
400 if (status) in ice_set_dvm_boost_entries()
401 return status; in ice_set_dvm_boost_entries()
408 * ice_tunnel_idx_to_entry - convert linear index to the sparse one
422 for (i = 0; i < hw->tnl.count && i < ICE_TUNNEL_MAX_ENTRIES; i++) in ice_tunnel_idx_to_entry()
423 if (hw->tnl.tbl[i].valid && in ice_tunnel_idx_to_entry()
424 hw->tnl.tbl[i].type == type && in ice_tunnel_idx_to_entry()
425 idx-- == 0) in ice_tunnel_idx_to_entry()
449 int status = -ENOSPC; in ice_create_tunnel() local
451 mutex_lock(&hw->tnl_lock); in ice_create_tunnel()
455 status = -ENOMEM; in ice_create_tunnel()
467 sect_rx->count = cpu_to_le16(1); in ice_create_tunnel()
473 sect_tx->count = cpu_to_le16(1); in ice_create_tunnel()
476 memcpy(sect_rx->tcam, hw->tnl.tbl[index].boost_entry, in ice_create_tunnel()
477 sizeof(*sect_rx->tcam)); in ice_create_tunnel()
479 /* over-write the never-match dest port key bits with the encoded port in ice_create_tunnel()
482 ice_set_key((u8 *)§_rx->tcam[0].key, sizeof(sect_rx->tcam[0].key), in ice_create_tunnel()
485 sizeof(sect_rx->tcam[0].key.key.hv_dst_port_key)); in ice_create_tunnel()
488 memcpy(sect_tx->tcam, sect_rx->tcam, sizeof(*sect_tx->tcam)); in ice_create_tunnel()
490 status = ice_update_pkg(hw, ice_pkg_buf(bld), 1); in ice_create_tunnel()
491 if (!status) in ice_create_tunnel()
492 hw->tnl.tbl[index].port = port; in ice_create_tunnel()
498 mutex_unlock(&hw->tnl_lock); in ice_create_tunnel()
500 return status; in ice_create_tunnel()
520 int status = -ENOSPC; in ice_destroy_tunnel() local
522 mutex_lock(&hw->tnl_lock); in ice_destroy_tunnel()
524 if (WARN_ON(!hw->tnl.tbl[index].valid || in ice_destroy_tunnel()
525 hw->tnl.tbl[index].type != type || in ice_destroy_tunnel()
526 hw->tnl.tbl[index].port != port)) { in ice_destroy_tunnel()
527 status = -EIO; in ice_destroy_tunnel()
533 status = -ENOMEM; in ice_destroy_tunnel()
545 sect_rx->count = cpu_to_le16(1); in ice_destroy_tunnel()
551 sect_tx->count = cpu_to_le16(1); in ice_destroy_tunnel()
556 memcpy(sect_rx->tcam, hw->tnl.tbl[index].boost_entry, in ice_destroy_tunnel()
557 sizeof(*sect_rx->tcam)); in ice_destroy_tunnel()
558 memcpy(sect_tx->tcam, hw->tnl.tbl[index].boost_entry, in ice_destroy_tunnel()
559 sizeof(*sect_tx->tcam)); in ice_destroy_tunnel()
561 status = ice_update_pkg(hw, ice_pkg_buf(bld), 1); in ice_destroy_tunnel()
562 if (!status) in ice_destroy_tunnel()
563 hw->tnl.tbl[index].port = 0; in ice_destroy_tunnel()
569 mutex_unlock(&hw->tnl_lock); in ice_destroy_tunnel()
571 return status; in ice_destroy_tunnel()
578 struct ice_vsi *vsi = np->vsi; in ice_udp_tunnel_set_port()
579 struct ice_pf *pf = vsi->back; in ice_udp_tunnel_set_port()
581 int status; in ice_udp_tunnel_set_port() local
584 tnl_type = ti->type == UDP_TUNNEL_TYPE_VXLAN ? TNL_VXLAN : TNL_GENEVE; in ice_udp_tunnel_set_port()
585 index = ice_tunnel_idx_to_entry(&pf->hw, tnl_type, idx); in ice_udp_tunnel_set_port()
587 status = ice_create_tunnel(&pf->hw, index, tnl_type, ntohs(ti->port)); in ice_udp_tunnel_set_port()
588 if (status) { in ice_udp_tunnel_set_port()
589 netdev_err(netdev, "Error adding UDP tunnel - %d\n", in ice_udp_tunnel_set_port()
590 status); in ice_udp_tunnel_set_port()
591 return -EIO; in ice_udp_tunnel_set_port()
602 struct ice_vsi *vsi = np->vsi; in ice_udp_tunnel_unset_port()
603 struct ice_pf *pf = vsi->back; in ice_udp_tunnel_unset_port()
605 int status; in ice_udp_tunnel_unset_port() local
607 tnl_type = ti->type == UDP_TUNNEL_TYPE_VXLAN ? TNL_VXLAN : TNL_GENEVE; in ice_udp_tunnel_unset_port()
609 status = ice_destroy_tunnel(&pf->hw, ti->hw_priv, tnl_type, in ice_udp_tunnel_unset_port()
610 ntohs(ti->port)); in ice_udp_tunnel_unset_port()
611 if (status) { in ice_udp_tunnel_unset_port()
612 netdev_err(netdev, "Error removing UDP tunnel - %d\n", in ice_udp_tunnel_unset_port()
613 status); in ice_udp_tunnel_unset_port()
614 return -EIO; in ice_udp_tunnel_unset_port()
621 * ice_find_prot_off - find prot ID and offset pair, based on prof and FV index
635 if (prof >= hw->blk[blk].es.count) in ice_find_prot_off()
636 return -EINVAL; in ice_find_prot_off()
638 if (fv_idx >= hw->blk[blk].es.fvw) in ice_find_prot_off()
639 return -EINVAL; in ice_find_prot_off()
641 fv_ext = hw->blk[blk].es.t + (prof * hw->blk[blk].es.fvw); in ice_find_prot_off()
652 * ice_ptg_find_ptype - Search for packet type group using packet type (ptype)
666 return -EINVAL; in ice_ptg_find_ptype()
668 *ptg = hw->blk[blk].xlt1.ptypes[ptype].ptg; in ice_ptg_find_ptype()
673 * ice_ptg_alloc_val - Allocates a new packet type group ID by value
683 hw->blk[blk].xlt1.ptg_tbl[ptg].in_use = true; in ice_ptg_alloc_val()
687 * ice_ptg_remove_ptype - Removes ptype from a particular packet type group
702 if (ptype > ICE_XLT1_CNT - 1) in ice_ptg_remove_ptype()
703 return -EINVAL; in ice_ptg_remove_ptype()
705 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].in_use) in ice_ptg_remove_ptype()
706 return -ENOENT; in ice_ptg_remove_ptype()
709 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype) in ice_ptg_remove_ptype()
710 return -EIO; 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()
717 *ch = p->next_ptype; in ice_ptg_remove_ptype()
721 ch = &p->next_ptype; in ice_ptg_remove_ptype()
722 p = p->next_ptype; 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()
732 * ice_ptg_add_mv_ptype - Adds/moves ptype to a particular packet type group
747 int status; in ice_ptg_add_mv_ptype() local
749 if (ptype > ICE_XLT1_CNT - 1) in ice_ptg_add_mv_ptype()
750 return -EINVAL; in ice_ptg_add_mv_ptype()
752 if (!hw->blk[blk].xlt1.ptg_tbl[ptg].in_use && ptg != ICE_DEFAULT_PTG) in ice_ptg_add_mv_ptype()
753 return -ENOENT; in ice_ptg_add_mv_ptype()
755 status = ice_ptg_find_ptype(hw, blk, ptype, &original_ptg); in ice_ptg_add_mv_ptype()
756 if (status) in ice_ptg_add_mv_ptype()
757 return status; 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()
789 u8 prof_cdid_bits; /* # CDID one-hot bits used in key */
800 * XLT1 - Number of entries in XLT1 table
801 * XLT2 - Number of entries in XLT2 table
802 * TCAM - Number of entries Profile ID TCAM table
803 * CDID - Control Domain ID of the hardware block
804 * PRED - Number of entries in the Profile Redirection Table
805 * FV - Number of entries in the Field Vector
806 * FVW - Width (in WORDs) of the Field Vector
807 * OVR - Overwrite existing table entries
808 * REV - Reverse FV
836 * ice_match_prop_lst - determine if properties of two lists match
864 while (count--) { in ice_match_prop_lst()
865 if (tmp2->profile_cookie != tmp1->profile_cookie) in ice_match_prop_lst()
878 * ice_vsig_find_vsi - find a VSIG that contains a specified VSI
891 return -EINVAL; in ice_vsig_find_vsi()
897 *vsig = hw->blk[blk].xlt2.vsis[vsi].vsig; in ice_vsig_find_vsi()
903 * ice_vsig_alloc_val - allocate a new VSIG by value
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()
919 return ICE_VSIG_VALUE(idx, hw->pf_id); in ice_vsig_alloc_val()
923 * ice_vsig_alloc - Finds a free entry and allocates a new VSIG
935 if (!hw->blk[blk].xlt2.vsig_tbl[i].in_use) in ice_vsig_alloc()
942 * ice_find_dup_props_vsig - find VSI group with a specified set of properties
960 struct ice_xlt2 *xlt2 = &hw->blk[blk].xlt2; in ice_find_dup_props_vsig()
963 for (i = 0; i < xlt2->count; i++) in ice_find_dup_props_vsig()
964 if (xlt2->vsig_tbl[i].in_use && in ice_find_dup_props_vsig()
965 ice_match_prop_lst(chs, &xlt2->vsig_tbl[i].prop_lst)) { in ice_find_dup_props_vsig()
966 *vsig = ICE_VSIG_VALUE(i, hw->pf_id); in ice_find_dup_props_vsig()
970 return -ENOENT; in ice_find_dup_props_vsig()
974 * ice_vsig_free - free VSI group
990 return -EINVAL; in ice_vsig_free()
992 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_free()
993 return -ENOENT; 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()
1004 struct ice_vsig_vsi *tmp = vsi_cur->next_vsi; in ice_vsig_free()
1006 vsi_cur->vsig = ICE_DEFAULT_VSIG; in ice_vsig_free()
1007 vsi_cur->changed = 1; in ice_vsig_free()
1008 vsi_cur->next_vsi = NULL; 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()
1020 list_del(&del->list); in ice_vsig_free()
1025 * re-initialize the list head in ice_vsig_free()
1027 INIT_LIST_HEAD(&hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst); in ice_vsig_free()
1033 * ice_vsig_remove_vsi - remove VSI from VSIG
1051 return -EINVAL; in ice_vsig_remove_vsi()
1053 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_remove_vsi()
1054 return -ENOENT; in ice_vsig_remove_vsi()
1060 vsi_head = &hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_remove_vsi()
1062 return -EIO; in ice_vsig_remove_vsi()
1064 vsi_tgt = &hw->blk[blk].xlt2.vsis[vsi]; in ice_vsig_remove_vsi()
1070 (*vsi_head) = vsi_cur->next_vsi; in ice_vsig_remove_vsi()
1073 vsi_head = &vsi_cur->next_vsi; in ice_vsig_remove_vsi()
1074 vsi_cur = vsi_cur->next_vsi; in ice_vsig_remove_vsi()
1079 return -ENOENT; in ice_vsig_remove_vsi()
1081 vsi_cur->vsig = ICE_DEFAULT_VSIG; in ice_vsig_remove_vsi()
1082 vsi_cur->changed = 1; in ice_vsig_remove_vsi()
1083 vsi_cur->next_vsi = NULL; in ice_vsig_remove_vsi()
1089 * ice_vsig_add_mv_vsi - add or move a VSI to a VSI group
1105 int status; in ice_vsig_add_mv_vsi() local
1110 return -EINVAL; in ice_vsig_add_mv_vsi()
1115 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use && in ice_vsig_add_mv_vsi()
1117 return -ENOENT; in ice_vsig_add_mv_vsi()
1119 status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); in ice_vsig_add_mv_vsi()
1120 if (status) in ice_vsig_add_mv_vsi()
1121 return status; in ice_vsig_add_mv_vsi()
1129 status = ice_vsig_remove_vsi(hw, blk, vsi, orig_vsig); in ice_vsig_add_mv_vsi()
1130 if (status) in ice_vsig_add_mv_vsi()
1131 return status; 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()
1152 * ice_prof_has_mask_idx - determine if profile index masking is identical
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()
1196 * ice_prof_has_mask - determine if profile masking is identical
1207 /* es->mask_ena[prof] will have the mask */ in ice_prof_has_mask()
1208 for (i = 0; i < hw->blk[blk].es.fvw; i++) in ice_prof_has_mask()
1216 * ice_find_prof_id_with_mask - find profile ID for a given field vector
1229 struct ice_es *es = &hw->blk[blk].es; in ice_find_prof_id_with_mask()
1232 /* For FD, we don't want to re-use a existed profile with the same in ice_find_prof_id_with_mask()
1236 return -ENOENT; in ice_find_prof_id_with_mask()
1238 for (i = 0; i < (u8)es->count; i++) { in ice_find_prof_id_with_mask()
1239 u16 off = i * es->fvw; in ice_find_prof_id_with_mask()
1241 if (blk == ICE_BLK_RSS && es->symm[i] != symm) in ice_find_prof_id_with_mask()
1244 if (memcmp(&es->t[off], fv, es->fvw * sizeof(*fv))) in ice_find_prof_id_with_mask()
1255 return -ENOENT; in ice_find_prof_id_with_mask()
1259 * ice_prof_id_rsrc_type - get profile ID resource type for a block type
1279 * ice_tcam_ent_rsrc_type - get TCAM entry resource type for a block type
1299 * ice_alloc_tcam_ent - allocate hardware TCAM entry
1315 return -EINVAL; in ice_alloc_tcam_ent()
1321 * ice_free_tcam_ent - free hardware TCAM entry
1334 return -EINVAL; in ice_free_tcam_ent()
1340 * ice_alloc_prof_id - allocate profile ID
1352 int status; in ice_alloc_prof_id() local
1355 return -EINVAL; in ice_alloc_prof_id()
1357 status = ice_alloc_hw_res(hw, res_type, 1, false, &get_prof); in ice_alloc_prof_id()
1358 if (!status) in ice_alloc_prof_id()
1361 return status; in ice_alloc_prof_id()
1365 * ice_free_prof_id - free profile ID
1378 return -EINVAL; in ice_free_prof_id()
1384 * ice_prof_inc_ref - increment reference count for profile
1391 if (prof_id > hw->blk[blk].es.count) in ice_prof_inc_ref()
1392 return -EINVAL; in ice_prof_inc_ref()
1394 hw->blk[blk].es.ref_count[prof_id]++; in ice_prof_inc_ref()
1400 * ice_write_prof_mask_reg - write profile mask register
1405 * @mask: the 16-bit mask
1437 * ice_write_prof_mask_enable_res - write profile mask enable register
1468 * ice_init_prof_masks - initial prof masks
1477 mutex_init(&hw->blk[blk].masks.lock); in ice_init_prof_masks()
1479 per_pf = ICE_PROF_MASK_COUNT / hw->dev_caps.num_funcs; 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()
1492 * ice_init_all_prof_masks - initialize all prof masks
1502 * ice_alloc_prof_mask - allocate profile mask
1506 * @mask: the 16-bit mask
1515 int status = -ENOSPC; in ice_alloc_prof_mask() local
1519 return -EINVAL; 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()
1561 hw->blk[blk].masks.masks[i].ref++; in ice_alloc_prof_mask()
1563 status = 0; in ice_alloc_prof_mask()
1566 mutex_unlock(&hw->blk[blk].masks.lock); in ice_alloc_prof_mask()
1568 return status; in ice_alloc_prof_mask()
1572 * ice_free_prof_mask - free profile mask
1581 return -EINVAL; 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()
1585 return -ENOENT; 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()
1608 mutex_unlock(&hw->blk[blk].masks.lock); in ice_free_prof_mask()
1614 * ice_free_prof_masks - free all profile masks for a profile
1626 return -EINVAL; in ice_free_prof_masks()
1628 mask_bm = hw->blk[blk].es.mask_ena[prof_id]; in ice_free_prof_masks()
1637 * ice_shutdown_prof_masks - releases lock for masking
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()
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()
1663 * ice_shutdown_all_prof_masks - releases all locks for masking
1675 * ice_update_prof_masking - set registers according to masking
1694 for (i = 0; i < hw->blk[blk].es.fvw; i++) in ice_update_prof_masking()
1711 return -EIO; in ice_update_prof_masking()
1718 hw->blk[blk].es.mask_ena[prof_id] = ena_mask; in ice_update_prof_masking()
1724 * ice_write_es - write an extraction sequence and symmetric setting to hardware
1728 * @fv: pointer to the extraction sequence to write - NULL to clear extraction
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()
1748 hw->blk[blk].es.symm[prof_id] = symm; in ice_write_es()
1752 * ice_prof_dec_ref - decrement reference count for profile
1760 if (prof_id > hw->blk[blk].es.count) in ice_prof_dec_ref()
1761 return -EINVAL; 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()
1818 * ice_init_sw_xlt1_db - init software XLT1 database from HW tables
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()
1838 * ice_init_sw_xlt2_db - init software XLT2 database from HW tables
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()
1856 hw->blk[blk].xlt2.vsis[vsi].changed = 0; in ice_init_sw_xlt2_db()
1862 * ice_init_sw_db - init software database from HW tables
1876 * ice_fill_tbl - Reads content of a single table type into database
1903 if (!hw->seg) { in ice_fill_tbl()
1904 ice_debug(hw, ICE_DBG_PKG, "hw->seg is NULL, tables are not filled\n"); in ice_fill_tbl()
1910 sect = ice_pkg_enum_section(hw->seg, &state, sid); in ice_fill_tbl()
1920 src = xlt1->value; in ice_fill_tbl()
1921 sect_len = le16_to_cpu(xlt1->count) * in ice_fill_tbl()
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()
1933 src = (__force u8 *)xlt2->value; in ice_fill_tbl()
1934 sect_len = le16_to_cpu(xlt2->count) * 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()
1946 src = (u8 *)pid->entry; in ice_fill_tbl()
1947 sect_len = le16_to_cpu(pid->count) * 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()
1959 src = pr->redir_value; in ice_fill_tbl()
1960 sect_len = le16_to_cpu(pr->count) * 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()
1972 src = (u8 *)es->fv; in ice_fill_tbl()
1973 sect_len = (u32)(le16_to_cpu(es->count) * 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()
1997 sect_len = dst_len - offset; in ice_fill_tbl()
2006 * ice_fill_blk_tbls - Read package context for tables
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()
2031 * ice_free_prof_map - free profile map
2037 struct ice_es *es = &hw->blk[blk_idx].es; in ice_free_prof_map()
2040 mutex_lock(&es->prof_map_lock); in ice_free_prof_map()
2041 list_for_each_entry_safe(del, tmp, &es->prof_map, list) { in ice_free_prof_map()
2042 list_del(&del->list); in ice_free_prof_map()
2045 INIT_LIST_HEAD(&es->prof_map); in ice_free_prof_map()
2046 mutex_unlock(&es->prof_map_lock); in ice_free_prof_map()
2050 * ice_free_flow_profs - free flow profile entries
2058 mutex_lock(&hw->fl_profs_locks[blk_idx]); in ice_free_flow_profs()
2059 list_for_each_entry_safe(p, tmp, &hw->fl_profs[blk_idx], l_entry) { in ice_free_flow_profs()
2062 list_for_each_entry_safe(e, t, &p->entries, l_entry) in ice_free_flow_profs()
2066 list_del(&p->l_entry); in ice_free_flow_profs()
2068 mutex_destroy(&p->entries_lock); in ice_free_flow_profs()
2071 mutex_unlock(&hw->fl_profs_locks[blk_idx]); in ice_free_flow_profs()
2074 * re-initialize the flow profile list heads in ice_free_flow_profs()
2076 INIT_LIST_HEAD(&hw->fl_profs[blk_idx]); in ice_free_flow_profs()
2080 * ice_free_vsig_tbl - free complete VSIG table entries
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()
2097 * ice_free_hw_tbls - free hardware table memory
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()
2110 mutex_destroy(&es->prof_map_lock); in ice_free_hw_tbls()
2113 mutex_destroy(&hw->fl_profs_locks[i]); 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()
2134 list_for_each_entry_safe(r, rt, &hw->rss_list_head, l_entry) { in ice_free_hw_tbls()
2135 list_del(&r->l_entry); in ice_free_hw_tbls()
2138 mutex_destroy(&hw->rss_locks); in ice_free_hw_tbls()
2140 memset(hw->blk, 0, sizeof(hw->blk)); in ice_free_hw_tbls()
2144 * ice_init_flow_profs - init flow profile locks and list heads
2150 mutex_init(&hw->fl_profs_locks[blk_idx]); in ice_init_flow_profs()
2151 INIT_LIST_HEAD(&hw->fl_profs[blk_idx]); in ice_init_flow_profs()
2155 * ice_clear_hw_tbls - clear HW tables and flow profiles
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()
2177 memset(xlt1->ptypes, 0, xlt1->count * sizeof(*xlt1->ptypes)); in ice_clear_hw_tbls()
2178 memset(xlt1->ptg_tbl, 0, in ice_clear_hw_tbls()
2179 ICE_MAX_PTGS * sizeof(*xlt1->ptg_tbl)); in ice_clear_hw_tbls()
2180 memset(xlt1->t, 0, xlt1->count * sizeof(*xlt1->t)); in ice_clear_hw_tbls()
2182 memset(xlt2->vsis, 0, xlt2->count * sizeof(*xlt2->vsis)); in ice_clear_hw_tbls()
2183 memset(xlt2->vsig_tbl, 0, in ice_clear_hw_tbls()
2184 xlt2->count * sizeof(*xlt2->vsig_tbl)); in ice_clear_hw_tbls()
2185 memset(xlt2->t, 0, xlt2->count * sizeof(*xlt2->t)); in ice_clear_hw_tbls()
2187 memset(prof->t, 0, prof->count * sizeof(*prof->t)); in ice_clear_hw_tbls()
2188 memset(prof_redir->t, 0, in ice_clear_hw_tbls()
2189 prof_redir->count * sizeof(*prof_redir->t)); in ice_clear_hw_tbls()
2191 memset(es->t, 0, es->count * sizeof(*es->t) * es->fvw); in ice_clear_hw_tbls()
2192 memset(es->ref_count, 0, es->count * sizeof(*es->ref_count)); in ice_clear_hw_tbls()
2193 memset(es->symm, 0, es->count * sizeof(*es->symm)); in ice_clear_hw_tbls()
2194 memset(es->written, 0, es->count * sizeof(*es->written)); in ice_clear_hw_tbls()
2195 memset(es->mask_ena, 0, es->count * sizeof(*es->mask_ena)); in ice_clear_hw_tbls()
2197 memset(prof_id->id, 0, prof_id->count * sizeof(*prof_id->id)); in ice_clear_hw_tbls()
2202 * ice_init_hw_tbls - init hardware table memory
2209 mutex_init(&hw->rss_locks); in ice_init_hw_tbls()
2210 INIT_LIST_HEAD(&hw->rss_list_head); in ice_init_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()
2225 mutex_init(&es->prof_map_lock); in ice_init_hw_tbls()
2226 INIT_LIST_HEAD(&es->prof_map); 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()
2230 es->reverse = blk_sizes[i].reverse; in ice_init_hw_tbls()
2232 xlt1->sid = ice_blk_sids[i][ICE_SID_XLT1_OFF]; in ice_init_hw_tbls()
2233 xlt1->count = blk_sizes[i].xlt1; in ice_init_hw_tbls()
2235 xlt1->ptypes = devm_kcalloc(ice_hw_to_dev(hw), xlt1->count, in ice_init_hw_tbls()
2236 sizeof(*xlt1->ptypes), GFP_KERNEL); in ice_init_hw_tbls()
2238 if (!xlt1->ptypes) in ice_init_hw_tbls()
2241 xlt1->ptg_tbl = devm_kcalloc(ice_hw_to_dev(hw), ICE_MAX_PTGS, in ice_init_hw_tbls()
2242 sizeof(*xlt1->ptg_tbl), in ice_init_hw_tbls()
2245 if (!xlt1->ptg_tbl) in ice_init_hw_tbls()
2248 xlt1->t = devm_kcalloc(ice_hw_to_dev(hw), xlt1->count, in ice_init_hw_tbls()
2249 sizeof(*xlt1->t), GFP_KERNEL); in ice_init_hw_tbls()
2250 if (!xlt1->t) in ice_init_hw_tbls()
2253 xlt2->sid = ice_blk_sids[i][ICE_SID_XLT2_OFF]; in ice_init_hw_tbls()
2254 xlt2->count = blk_sizes[i].xlt2; in ice_init_hw_tbls()
2256 xlt2->vsis = devm_kcalloc(ice_hw_to_dev(hw), xlt2->count, in ice_init_hw_tbls()
2257 sizeof(*xlt2->vsis), GFP_KERNEL); in ice_init_hw_tbls()
2259 if (!xlt2->vsis) in ice_init_hw_tbls()
2262 xlt2->vsig_tbl = devm_kcalloc(ice_hw_to_dev(hw), xlt2->count, in ice_init_hw_tbls()
2263 sizeof(*xlt2->vsig_tbl), in ice_init_hw_tbls()
2265 if (!xlt2->vsig_tbl) in ice_init_hw_tbls()
2268 for (j = 0; j < xlt2->count; j++) in ice_init_hw_tbls()
2269 INIT_LIST_HEAD(&xlt2->vsig_tbl[j].prop_lst); in ice_init_hw_tbls()
2271 xlt2->t = devm_kcalloc(ice_hw_to_dev(hw), xlt2->count, in ice_init_hw_tbls()
2272 sizeof(*xlt2->t), GFP_KERNEL); in ice_init_hw_tbls()
2273 if (!xlt2->t) in ice_init_hw_tbls()
2276 prof->sid = ice_blk_sids[i][ICE_SID_PR_OFF]; in ice_init_hw_tbls()
2277 prof->count = blk_sizes[i].prof_tcam; in ice_init_hw_tbls()
2278 prof->max_prof_id = blk_sizes[i].prof_id; in ice_init_hw_tbls()
2279 prof->cdid_bits = blk_sizes[i].prof_cdid_bits; in ice_init_hw_tbls()
2280 prof->t = devm_kcalloc(ice_hw_to_dev(hw), prof->count, in ice_init_hw_tbls()
2281 sizeof(*prof->t), GFP_KERNEL); in ice_init_hw_tbls()
2283 if (!prof->t) in ice_init_hw_tbls()
2286 prof_redir->sid = ice_blk_sids[i][ICE_SID_PR_REDIR_OFF]; in ice_init_hw_tbls()
2287 prof_redir->count = blk_sizes[i].prof_redir; in ice_init_hw_tbls()
2288 prof_redir->t = devm_kcalloc(ice_hw_to_dev(hw), in ice_init_hw_tbls()
2289 prof_redir->count, in ice_init_hw_tbls()
2290 sizeof(*prof_redir->t), in ice_init_hw_tbls()
2293 if (!prof_redir->t) in ice_init_hw_tbls()
2296 es->sid = ice_blk_sids[i][ICE_SID_ES_OFF]; in ice_init_hw_tbls()
2297 es->count = blk_sizes[i].es; in ice_init_hw_tbls()
2298 es->fvw = blk_sizes[i].fvw; in ice_init_hw_tbls()
2299 es->t = devm_kcalloc(ice_hw_to_dev(hw), in ice_init_hw_tbls()
2300 (u32)(es->count * es->fvw), in ice_init_hw_tbls()
2301 sizeof(*es->t), GFP_KERNEL); in ice_init_hw_tbls()
2302 if (!es->t) in ice_init_hw_tbls()
2305 es->ref_count = devm_kcalloc(ice_hw_to_dev(hw), es->count, in ice_init_hw_tbls()
2306 sizeof(*es->ref_count), in ice_init_hw_tbls()
2308 if (!es->ref_count) in ice_init_hw_tbls()
2311 es->symm = devm_kcalloc(ice_hw_to_dev(hw), es->count, in ice_init_hw_tbls()
2312 sizeof(*es->symm), GFP_KERNEL); in ice_init_hw_tbls()
2313 if (!es->symm) in ice_init_hw_tbls()
2316 es->written = devm_kcalloc(ice_hw_to_dev(hw), es->count, in ice_init_hw_tbls()
2317 sizeof(*es->written), GFP_KERNEL); in ice_init_hw_tbls()
2318 if (!es->written) in ice_init_hw_tbls()
2321 es->mask_ena = devm_kcalloc(ice_hw_to_dev(hw), es->count, in ice_init_hw_tbls()
2322 sizeof(*es->mask_ena), GFP_KERNEL); in ice_init_hw_tbls()
2323 if (!es->mask_ena) in ice_init_hw_tbls()
2326 prof_id->count = blk_sizes[i].prof_id; in ice_init_hw_tbls()
2327 prof_id->id = devm_kcalloc(ice_hw_to_dev(hw), prof_id->count, in ice_init_hw_tbls()
2328 sizeof(*prof_id->id), GFP_KERNEL); in ice_init_hw_tbls()
2329 if (!prof_id->id) in ice_init_hw_tbls()
2336 return -ENOMEM; in ice_init_hw_tbls()
2340 * ice_prof_gen_key - generate profile ID key
2364 switch (hw->blk[blk].prof.cdid_bits) { in ice_prof_gen_key()
2395 * ice_tcam_write_entry - write TCAM entry
2416 int status; in ice_tcam_write_entry() local
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()
2420 if (!status) { 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()
2425 return status; in ice_tcam_write_entry()
2429 * ice_vsig_get_ref - returns number of VSIs belong to a VSIG
2443 if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) in ice_vsig_get_ref()
2444 return -ENOENT; in ice_vsig_get_ref()
2446 ptr = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_vsig_get_ref()
2449 ptr = ptr->next_vsi; in ice_vsig_get_ref()
2456 * ice_has_prof_vsig - check to see if VSIG has a specific profile
2468 list_for_each_entry(ent, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_has_prof_vsig()
2470 if (ent->profile_cookie == hdl) in ice_has_prof_vsig()
2479 * ice_prof_bld_es - build profile ID extraction sequence changes
2489 u16 vec_size = hw->blk[blk].es.fvw * sizeof(struct ice_fv_word); in ice_prof_bld_es()
2493 if (tmp->type == ICE_PTG_ES_ADD && tmp->add_prof) { in ice_prof_bld_es()
2494 u16 off = tmp->prof_id * hw->blk[blk].es.fvw; in ice_prof_bld_es()
2501 vec_size - in ice_prof_bld_es()
2502 sizeof(p->es[0])); in ice_prof_bld_es()
2505 return -ENOSPC; in ice_prof_bld_es()
2507 p->count = cpu_to_le16(1); in ice_prof_bld_es()
2508 p->offset = cpu_to_le16(tmp->prof_id); in ice_prof_bld_es()
2510 memcpy(p->es, &hw->blk[blk].es.t[off], vec_size); in ice_prof_bld_es()
2517 * ice_prof_bld_tcam - build profile ID TCAM changes
2530 if (tmp->type == ICE_TCAM_ADD && tmp->add_tcam_idx) { in ice_prof_bld_tcam()
2539 return -ENOSPC; in ice_prof_bld_tcam()
2541 p->count = cpu_to_le16(1); in ice_prof_bld_tcam()
2542 p->entry[0].addr = cpu_to_le16(tmp->tcam_idx); in ice_prof_bld_tcam()
2543 p->entry[0].prof_id = tmp->prof_id; in ice_prof_bld_tcam()
2545 memcpy(p->entry[0].key, 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()
2554 * ice_prof_bld_xlt1 - build XLT1 changes
2566 if (tmp->type == ICE_PTG_ES_ADD && tmp->add_ptg) { in ice_prof_bld_xlt1()
2575 return -ENOSPC; in ice_prof_bld_xlt1()
2577 p->count = cpu_to_le16(1); in ice_prof_bld_xlt1()
2578 p->offset = cpu_to_le16(tmp->ptype); in ice_prof_bld_xlt1()
2579 p->value[0] = tmp->ptg; in ice_prof_bld_xlt1()
2586 * ice_prof_bld_xlt2 - build XLT2 changes
2601 switch (tmp->type) { in ice_prof_bld_xlt2()
2610 return -ENOSPC; in ice_prof_bld_xlt2()
2612 p->count = cpu_to_le16(1); in ice_prof_bld_xlt2()
2613 p->offset = cpu_to_le16(tmp->vsi); in ice_prof_bld_xlt2()
2614 p->value[0] = cpu_to_le16(tmp->vsig); in ice_prof_bld_xlt2()
2625 * ice_upd_prof_hw - update hardware using the change list
2641 int status; in ice_upd_prof_hw() local
2646 switch (tmp->type) { in ice_upd_prof_hw()
2648 if (tmp->add_ptg) in ice_upd_prof_hw()
2650 if (tmp->add_prof) in ice_upd_prof_hw()
2673 return -ENOMEM; in ice_upd_prof_hw()
2675 status = ice_pkg_buf_reserve_section(b, sects); in ice_upd_prof_hw()
2676 if (status) in ice_upd_prof_hw()
2681 status = ice_prof_bld_es(hw, blk, b, chgs); in ice_upd_prof_hw()
2682 if (status) in ice_upd_prof_hw()
2687 status = ice_prof_bld_tcam(hw, blk, b, chgs); in ice_upd_prof_hw()
2688 if (status) in ice_upd_prof_hw()
2693 status = ice_prof_bld_xlt1(blk, b, chgs); in ice_upd_prof_hw()
2694 if (status) in ice_upd_prof_hw()
2699 status = ice_prof_bld_xlt2(blk, b, chgs); in ice_upd_prof_hw()
2700 if (status) in ice_upd_prof_hw()
2705 * non-zero and matches the number of sections detected for package in ice_upd_prof_hw()
2710 status = -EINVAL; in ice_upd_prof_hw()
2715 status = ice_update_pkg(hw, ice_pkg_buf(b), 1); in ice_upd_prof_hw()
2716 if (status == -EIO) in ice_upd_prof_hw()
2721 return status; in ice_upd_prof_hw()
2725 * ice_update_fd_mask - set Flow Director Field Vector mask for a profile
2777 * ice_update_fd_swap - set register appropriately for a FD FV extraction
2787 #define ICE_FD_FV_NOT_FOUND (-2) in ice_update_fd_swap()
2803 for (i = 0; i < hw->blk[ICE_BLK_FD].es.fvw; i++) { in ice_update_fd_swap()
2809 first_free = i - 1; in ice_update_fd_swap()
2837 return -ENOSPC; in ice_update_fd_swap()
2841 es[first_free - k].prot_id = in ice_update_fd_swap()
2843 es[first_free - k].off = in ice_update_fd_swap()
2847 return -EIO; in ice_update_fd_swap()
2849 /* keep track of non-relevant fields */ in ice_update_fd_swap()
2850 mask_sel |= BIT(first_free - k); in ice_update_fd_swap()
2854 first_free -= ice_fd_pairs[index].count; in ice_update_fd_swap()
2859 si = hw->blk[ICE_BLK_FD].es.fvw - 1; in ice_update_fd_swap()
2868 si -= indexes_used; in ice_update_fd_swap()
2879 idx = j + ((j % 2) ? -1 : 1); in ice_update_fd_swap()
2883 used[si - k] = (pair_start[idx] - k) | in ice_update_fd_swap()
2890 si -= indexes_used; in ice_update_fd_swap()
2896 for (j = 0; j < hw->blk[ICE_BLK_FD].es.fvw / 4; j++) { in ice_update_fd_swap()
2939 * ice_get_ptype_attrib_info - get PTYPE attribute information
2951 * ice_add_prof_attrib - add any PTG with attributes to profile
2969 prof->ptg[prof->ptg_cnt] = ptg; in ice_add_prof_attrib()
2971 &prof->attr[prof->ptg_cnt]); in ice_add_prof_attrib()
2973 if (++prof->ptg_cnt >= ICE_MAX_PTG_PER_PROFILE) in ice_add_prof_attrib()
2974 return -ENOSPC; in ice_add_prof_attrib()
2978 return -ENOENT; in ice_add_prof_attrib()
2984 * ice_add_prof - add profile
3010 int status; in ice_add_prof() local
3014 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof()
3017 status = ice_find_prof_id_with_mask(hw, blk, es, masks, symm, &prof_id); in ice_add_prof()
3018 if (status) { in ice_add_prof()
3020 status = ice_alloc_prof_id(hw, blk, &prof_id); in ice_add_prof()
3021 if (status) in ice_add_prof()
3031 status = ice_update_fd_swap(hw, prof_id, es); in ice_add_prof()
3032 if (status) in ice_add_prof()
3035 status = ice_update_prof_masking(hw, blk, prof_id, masks); in ice_add_prof()
3036 if (status) in ice_add_prof()
3048 status = -ENOMEM; in ice_add_prof()
3052 prof->profile_cookie = id; in ice_add_prof()
3053 prof->prof_id = prof_id; in ice_add_prof()
3054 prof->ptg_cnt = 0; in ice_add_prof()
3055 prof->context = 0; in ice_add_prof()
3058 while (bytes && prof->ptg_cnt < ICE_MAX_PTG_PER_PROFILE) { in ice_add_prof()
3062 bytes--; in ice_add_prof()
3075 /* The package should place all ptypes in a non-zero in ice_add_prof()
3089 status = ice_add_prof_attrib(prof, ptg, ptype, in ice_add_prof()
3091 if (status == -ENOSPC) in ice_add_prof()
3093 if (status) { in ice_add_prof()
3097 prof->ptg[prof->ptg_cnt] = ptg; in ice_add_prof()
3098 prof->attr[prof->ptg_cnt].flags = 0; in ice_add_prof()
3099 prof->attr[prof->ptg_cnt].mask = 0; in ice_add_prof()
3101 if (++prof->ptg_cnt >= in ice_add_prof()
3107 bytes--; in ice_add_prof()
3111 list_add(&prof->list, &hw->blk[blk].es.prof_map); in ice_add_prof()
3112 status = 0; in ice_add_prof()
3115 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof()
3116 return status; in ice_add_prof()
3120 * ice_search_prof_id - Search for a profile tracking ID
3134 list_for_each_entry(map, &hw->blk[blk].es.prof_map, list) in ice_search_prof_id()
3135 if (map->profile_cookie == id) { in ice_search_prof_id()
3144 * ice_vsig_prof_id_count - count profiles in a VSIG
3155 list_for_each_entry(p, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_vsig_prof_id_count()
3163 * ice_rel_tcam_idx - release a TCAM index
3174 int status; in ice_rel_tcam_idx() local
3177 status = ice_tcam_write_entry(hw, blk, idx, 0, 0, 0, 0, 0, vl_msk, in ice_rel_tcam_idx()
3179 if (status) in ice_rel_tcam_idx()
3180 return status; in ice_rel_tcam_idx()
3183 status = ice_free_tcam_ent(hw, blk, idx); in ice_rel_tcam_idx()
3185 return status; in ice_rel_tcam_idx()
3189 * ice_rem_prof_id - remove one profile from a VSIG
3198 int status; in ice_rem_prof_id() local
3201 for (i = 0; i < prof->tcam_count; i++) in ice_rem_prof_id()
3202 if (prof->tcam[i].in_use) { in ice_rem_prof_id()
3203 prof->tcam[i].in_use = false; in ice_rem_prof_id()
3204 status = ice_rel_tcam_idx(hw, blk, in ice_rem_prof_id()
3205 prof->tcam[i].tcam_idx); in ice_rem_prof_id()
3206 if (status) in ice_rem_prof_id()
3207 return -EIO; in ice_rem_prof_id()
3214 * ice_rem_vsig - remove VSIG
3218 * @chg: the change list
3222 struct list_head *chg) in ice_rem_vsig() argument
3230 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_rem_vsig()
3232 int status; in ice_rem_vsig() local
3234 status = ice_rem_prof_id(hw, blk, d); in ice_rem_vsig()
3235 if (status) in ice_rem_vsig()
3236 return status; in ice_rem_vsig()
3238 list_del(&d->list); in ice_rem_vsig()
3243 vsi_cur = hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; in ice_rem_vsig()
3249 struct ice_vsig_vsi *tmp = vsi_cur->next_vsi; in ice_rem_vsig()
3255 return -ENOMEM; in ice_rem_vsig()
3257 p->type = ICE_VSIG_REM; in ice_rem_vsig()
3258 p->orig_vsig = vsig; in ice_rem_vsig()
3259 p->vsig = ICE_DEFAULT_VSIG; in ice_rem_vsig()
3260 p->vsi = vsi_cur - hw->blk[blk].xlt2.vsis; in ice_rem_vsig()
3262 list_add(&p->list_entry, chg); in ice_rem_vsig()
3271 * ice_rem_prof_id_vsig - remove a specific profile from a VSIG
3276 * @chg: list to receive a record of changes
3280 struct list_head *chg) in ice_rem_prof_id_vsig() argument
3286 &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_rem_prof_id_vsig()
3288 if (p->profile_cookie == hdl) { in ice_rem_prof_id_vsig()
3289 int status; in ice_rem_prof_id_vsig() local
3293 return ice_rem_vsig(hw, blk, vsig, chg); in ice_rem_prof_id_vsig()
3295 status = ice_rem_prof_id(hw, blk, p); in ice_rem_prof_id_vsig()
3296 if (!status) { in ice_rem_prof_id_vsig()
3297 list_del(&p->list); in ice_rem_prof_id_vsig()
3300 return status; in ice_rem_prof_id_vsig()
3303 return -ENOENT; in ice_rem_prof_id_vsig()
3307 * ice_rem_flow_all - remove all flows with a particular profile
3315 struct list_head chg; in ice_rem_flow_all() local
3316 int status; in ice_rem_flow_all() local
3319 INIT_LIST_HEAD(&chg); in ice_rem_flow_all()
3322 if (hw->blk[blk].xlt2.vsig_tbl[i].in_use) { in ice_rem_flow_all()
3324 status = ice_rem_prof_id_vsig(hw, blk, i, id, in ice_rem_flow_all()
3325 &chg); in ice_rem_flow_all()
3326 if (status) in ice_rem_flow_all()
3331 status = ice_upd_prof_hw(hw, blk, &chg); in ice_rem_flow_all()
3334 list_for_each_entry_safe(del, tmp, &chg, list_entry) { in ice_rem_flow_all()
3335 list_del(&del->list_entry); in ice_rem_flow_all()
3339 return status; in ice_rem_flow_all()
3343 * ice_rem_prof - remove profile
3355 int status; in ice_rem_prof() local
3357 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_rem_prof()
3361 status = -ENOENT; in ice_rem_prof()
3366 status = ice_rem_flow_all(hw, blk, pmap->profile_cookie); in ice_rem_prof()
3367 if (status) in ice_rem_prof()
3371 ice_prof_dec_ref(hw, blk, pmap->prof_id); in ice_rem_prof()
3373 list_del(&pmap->list); in ice_rem_prof()
3377 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_rem_prof()
3378 return status; in ice_rem_prof()
3382 * ice_get_prof - get profile
3386 * @chg: change list
3390 struct list_head *chg) in ice_get_prof() argument
3394 int status = 0; in ice_get_prof() local
3397 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_get_prof()
3401 status = -ENOENT; in ice_get_prof()
3405 for (i = 0; i < map->ptg_cnt; i++) in ice_get_prof()
3406 if (!hw->blk[blk].es.written[map->prof_id]) { in ice_get_prof()
3411 status = -ENOMEM; in ice_get_prof()
3415 p->type = ICE_PTG_ES_ADD; in ice_get_prof()
3416 p->ptype = 0; in ice_get_prof()
3417 p->ptg = map->ptg[i]; in ice_get_prof()
3418 p->add_ptg = 0; in ice_get_prof()
3420 p->add_prof = 1; in ice_get_prof()
3421 p->prof_id = map->prof_id; in ice_get_prof()
3423 hw->blk[blk].es.written[map->prof_id] = true; in ice_get_prof()
3425 list_add(&p->list_entry, chg); in ice_get_prof()
3429 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_get_prof()
3431 return status; in ice_get_prof()
3435 * ice_get_profs_vsig - get a copy of the list of profiles from a VSIG
3450 list_for_each_entry(ent1, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_get_profs_vsig()
3460 list_add_tail(&p->list, lst); in ice_get_profs_vsig()
3467 list_del(&ent1->list); in ice_get_profs_vsig()
3471 return -ENOMEM; in ice_get_profs_vsig()
3475 * ice_add_prof_to_lst - add profile entry to a list
3487 int status = 0; in ice_add_prof_to_lst() local
3490 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_to_lst()
3493 status = -ENOENT; in ice_add_prof_to_lst()
3499 status = -ENOMEM; in ice_add_prof_to_lst()
3503 p->profile_cookie = map->profile_cookie; in ice_add_prof_to_lst()
3504 p->prof_id = map->prof_id; in ice_add_prof_to_lst()
3505 p->tcam_count = map->ptg_cnt; in ice_add_prof_to_lst()
3507 for (i = 0; i < map->ptg_cnt; i++) { in ice_add_prof_to_lst()
3508 p->tcam[i].prof_id = map->prof_id; in ice_add_prof_to_lst()
3509 p->tcam[i].tcam_idx = ICE_INVALID_TCAM; in ice_add_prof_to_lst()
3510 p->tcam[i].ptg = map->ptg[i]; in ice_add_prof_to_lst()
3513 list_add(&p->list, lst); in ice_add_prof_to_lst()
3516 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_to_lst()
3517 return status; in ice_add_prof_to_lst()
3521 * ice_move_vsi - move VSI to another VSIG
3526 * @chg: the change list
3530 struct list_head *chg) in ice_move_vsi() argument
3534 int status; in ice_move_vsi() local
3538 return -ENOMEM; in ice_move_vsi()
3540 status = ice_vsig_find_vsi(hw, blk, vsi, &orig_vsig); in ice_move_vsi()
3541 if (!status) in ice_move_vsi()
3542 status = ice_vsig_add_mv_vsi(hw, blk, vsi, vsig); in ice_move_vsi()
3544 if (status) { in ice_move_vsi()
3546 return status; in ice_move_vsi()
3549 p->type = ICE_VSI_MOVE; in ice_move_vsi()
3550 p->vsi = vsi; in ice_move_vsi()
3551 p->orig_vsig = orig_vsig; in ice_move_vsi()
3552 p->vsig = vsig; in ice_move_vsi()
3554 list_add(&p->list_entry, chg); in ice_move_vsi()
3560 * ice_rem_chg_tcam_ent - remove a specific TCAM entry from change list
3563 * @chg: the list of change structures to search
3566 ice_rem_chg_tcam_ent(struct ice_hw *hw, u16 idx, struct list_head *chg) in ice_rem_chg_tcam_ent() argument
3570 list_for_each_entry_safe(tmp, pos, chg, list_entry) in ice_rem_chg_tcam_ent()
3571 if (tmp->type == ICE_TCAM_ADD && tmp->tcam_idx == idx) { in ice_rem_chg_tcam_ent()
3572 list_del(&tmp->list_entry); in ice_rem_chg_tcam_ent()
3578 * ice_prof_tcam_ena_dis - add enable or disable TCAM change
3584 * @chg: the change list
3591 struct list_head *chg) in ice_prof_tcam_ena_dis() argument
3594 int status; in ice_prof_tcam_ena_dis() local
3602 status = ice_rel_tcam_idx(hw, blk, tcam->tcam_idx); in ice_prof_tcam_ena_dis()
3608 ice_rem_chg_tcam_ent(hw, tcam->tcam_idx, chg); in ice_prof_tcam_ena_dis()
3609 tcam->tcam_idx = 0; in ice_prof_tcam_ena_dis()
3610 tcam->in_use = 0; in ice_prof_tcam_ena_dis()
3611 return status; in ice_prof_tcam_ena_dis()
3614 /* for re-enabling, reallocate a TCAM */ in ice_prof_tcam_ena_dis()
3619 status = ice_alloc_tcam_ent(hw, blk, tcam->attr.mask == 0, in ice_prof_tcam_ena_dis()
3620 &tcam->tcam_idx); in ice_prof_tcam_ena_dis()
3621 if (status) in ice_prof_tcam_ena_dis()
3622 return status; in ice_prof_tcam_ena_dis()
3627 return -ENOMEM; in ice_prof_tcam_ena_dis()
3629 status = ice_tcam_write_entry(hw, blk, tcam->tcam_idx, tcam->prof_id, in ice_prof_tcam_ena_dis()
3630 tcam->ptg, vsig, 0, tcam->attr.flags, in ice_prof_tcam_ena_dis()
3632 if (status) in ice_prof_tcam_ena_dis()
3635 tcam->in_use = 1; in ice_prof_tcam_ena_dis()
3637 p->type = ICE_TCAM_ADD; in ice_prof_tcam_ena_dis()
3638 p->add_tcam_idx = true; in ice_prof_tcam_ena_dis()
3639 p->prof_id = tcam->prof_id; in ice_prof_tcam_ena_dis()
3640 p->ptg = tcam->ptg; in ice_prof_tcam_ena_dis()
3641 p->vsig = 0; in ice_prof_tcam_ena_dis()
3642 p->tcam_idx = tcam->tcam_idx; in ice_prof_tcam_ena_dis()
3645 list_add(&p->list_entry, chg); in ice_prof_tcam_ena_dis()
3651 return status; in ice_prof_tcam_ena_dis()
3655 * ice_adj_prof_priorities - adjust profile based on priorities
3659 * @chg: the change list
3663 struct list_head *chg) in ice_adj_prof_priorities() argument
3667 int status; in ice_adj_prof_priorities() local
3682 list_for_each_entry(t, &hw->blk[blk].xlt2.vsig_tbl[idx].prop_lst, in ice_adj_prof_priorities()
3686 for (i = 0; i < t->tcam_count; i++) { in ice_adj_prof_priorities()
3690 if (test_bit(t->tcam[i].ptg, ptgs_used) && in ice_adj_prof_priorities()
3691 t->tcam[i].in_use) { in ice_adj_prof_priorities()
3696 status = ice_prof_tcam_ena_dis(hw, blk, false, in ice_adj_prof_priorities()
3698 &t->tcam[i], in ice_adj_prof_priorities()
3699 chg); in ice_adj_prof_priorities()
3700 if (status) in ice_adj_prof_priorities()
3701 return status; in ice_adj_prof_priorities()
3702 } else if (!test_bit(t->tcam[i].ptg, ptgs_used) && in ice_adj_prof_priorities()
3703 !t->tcam[i].in_use) { in ice_adj_prof_priorities()
3707 status = ice_prof_tcam_ena_dis(hw, blk, true, in ice_adj_prof_priorities()
3709 &t->tcam[i], in ice_adj_prof_priorities()
3710 chg); in ice_adj_prof_priorities()
3711 if (status) in ice_adj_prof_priorities()
3712 return status; in ice_adj_prof_priorities()
3716 __set_bit(t->tcam[i].ptg, ptgs_used); in ice_adj_prof_priorities()
3724 * ice_add_prof_id_vsig - add profile to VSIG
3730 * @chg: the change list
3734 bool rev, struct list_head *chg) in ice_add_prof_id_vsig() argument
3744 int status = 0; in ice_add_prof_id_vsig() local
3748 return -EEXIST; in ice_add_prof_id_vsig()
3753 return -ENOMEM; in ice_add_prof_id_vsig()
3755 mutex_lock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
3759 status = -ENOENT; in ice_add_prof_id_vsig()
3763 t->profile_cookie = map->profile_cookie; in ice_add_prof_id_vsig()
3764 t->prof_id = map->prof_id; in ice_add_prof_id_vsig()
3765 t->tcam_count = map->ptg_cnt; in ice_add_prof_id_vsig()
3768 for (i = 0; i < map->ptg_cnt; i++) { in ice_add_prof_id_vsig()
3774 status = -ENOMEM; in ice_add_prof_id_vsig()
3783 status = ice_alloc_tcam_ent(hw, blk, map->attr[i].mask == 0, in ice_add_prof_id_vsig()
3785 if (status) { in ice_add_prof_id_vsig()
3790 t->tcam[i].ptg = map->ptg[i]; in ice_add_prof_id_vsig()
3791 t->tcam[i].prof_id = map->prof_id; in ice_add_prof_id_vsig()
3792 t->tcam[i].tcam_idx = tcam_idx; in ice_add_prof_id_vsig()
3793 t->tcam[i].attr = map->attr[i]; in ice_add_prof_id_vsig()
3794 t->tcam[i].in_use = true; in ice_add_prof_id_vsig()
3796 p->type = ICE_TCAM_ADD; in ice_add_prof_id_vsig()
3797 p->add_tcam_idx = true; in ice_add_prof_id_vsig()
3798 p->prof_id = t->tcam[i].prof_id; in ice_add_prof_id_vsig()
3799 p->ptg = t->tcam[i].ptg; in ice_add_prof_id_vsig()
3800 p->vsig = vsig; in ice_add_prof_id_vsig()
3801 p->tcam_idx = t->tcam[i].tcam_idx; in ice_add_prof_id_vsig()
3804 status = ice_tcam_write_entry(hw, blk, t->tcam[i].tcam_idx, in ice_add_prof_id_vsig()
3805 t->tcam[i].prof_id, in ice_add_prof_id_vsig()
3806 t->tcam[i].ptg, vsig, 0, 0, in ice_add_prof_id_vsig()
3808 if (status) { in ice_add_prof_id_vsig()
3814 list_add(&p->list_entry, chg); in ice_add_prof_id_vsig()
3820 list_add_tail(&t->list, in ice_add_prof_id_vsig()
3821 &hw->blk[blk].xlt2.vsig_tbl[vsig_idx].prop_lst); in ice_add_prof_id_vsig()
3823 list_add(&t->list, in ice_add_prof_id_vsig()
3824 &hw->blk[blk].xlt2.vsig_tbl[vsig_idx].prop_lst); in ice_add_prof_id_vsig()
3826 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
3827 return status; in ice_add_prof_id_vsig()
3830 mutex_unlock(&hw->blk[blk].es.prof_map_lock); in ice_add_prof_id_vsig()
3833 return status; in ice_add_prof_id_vsig()
3837 * ice_create_prof_id_vsig - add a new VSIG with a single profile
3842 * @chg: the change list
3846 struct list_head *chg) in ice_create_prof_id_vsig() argument
3850 int status; in ice_create_prof_id_vsig() local
3854 return -ENOMEM; in ice_create_prof_id_vsig()
3858 status = -EIO; in ice_create_prof_id_vsig()
3862 status = ice_move_vsi(hw, blk, vsi, new_vsig, chg); in ice_create_prof_id_vsig()
3863 if (status) in ice_create_prof_id_vsig()
3866 status = ice_add_prof_id_vsig(hw, blk, new_vsig, hdl, false, chg); in ice_create_prof_id_vsig()
3867 if (status) in ice_create_prof_id_vsig()
3870 p->type = ICE_VSIG_ADD; in ice_create_prof_id_vsig()
3871 p->vsi = vsi; in ice_create_prof_id_vsig()
3872 p->orig_vsig = ICE_DEFAULT_VSIG; in ice_create_prof_id_vsig()
3873 p->vsig = new_vsig; in ice_create_prof_id_vsig()
3875 list_add(&p->list_entry, chg); in ice_create_prof_id_vsig()
3882 return status; in ice_create_prof_id_vsig()
3886 * ice_create_vsig_from_lst - create a new VSIG with a list of profiles
3892 * @chg: the change list
3897 struct list_head *chg) in ice_create_vsig_from_lst() argument
3900 int status; in ice_create_vsig_from_lst() local
3905 return -EIO; in ice_create_vsig_from_lst()
3907 status = ice_move_vsi(hw, blk, vsi, vsig, chg); in ice_create_vsig_from_lst()
3908 if (status) in ice_create_vsig_from_lst()
3909 return status; in ice_create_vsig_from_lst()
3913 status = ice_add_prof_id_vsig(hw, blk, vsig, t->profile_cookie, in ice_create_vsig_from_lst()
3914 true, chg); in ice_create_vsig_from_lst()
3915 if (status) in ice_create_vsig_from_lst()
3916 return status; in ice_create_vsig_from_lst()
3925 * ice_find_prof_vsig - find a VSIG with a specific profile handle
3936 int status; in ice_find_prof_vsig() local
3944 t->profile_cookie = hdl; in ice_find_prof_vsig()
3945 list_add(&t->list, &lst); in ice_find_prof_vsig()
3947 status = ice_find_dup_props_vsig(hw, blk, &lst, vsig); in ice_find_prof_vsig()
3949 list_del(&t->list); in ice_find_prof_vsig()
3952 return !status; in ice_find_prof_vsig()
3956 * ice_add_prof_id_flow - add profile flow
3972 struct list_head chg; in ice_add_prof_id_flow() local
3973 int status; in ice_add_prof_id_flow() local
3977 INIT_LIST_HEAD(&chg); in ice_add_prof_id_flow()
3980 status = ice_get_prof(hw, blk, hdl, &chg); in ice_add_prof_id_flow()
3981 if (status) in ice_add_prof_id_flow()
3982 return status; in ice_add_prof_id_flow()
3985 status = ice_vsig_find_vsi(hw, blk, vsi, &vsig); in ice_add_prof_id_flow()
3986 if (!status && vsig) { in ice_add_prof_id_flow()
3999 status = -EEXIST; in ice_add_prof_id_flow()
4004 status = ice_vsig_get_ref(hw, blk, vsig, &ref); in ice_add_prof_id_flow()
4005 if (status) in ice_add_prof_id_flow()
4012 status = ice_get_profs_vsig(hw, blk, vsig, &union_lst); in ice_add_prof_id_flow()
4013 if (status) in ice_add_prof_id_flow()
4016 status = ice_add_prof_to_lst(hw, blk, &union_lst, hdl); in ice_add_prof_id_flow()
4017 if (status) in ice_add_prof_id_flow()
4021 status = ice_find_dup_props_vsig(hw, blk, &union_lst, &vsig); in ice_add_prof_id_flow()
4022 if (!status) { in ice_add_prof_id_flow()
4024 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_add_prof_id_flow()
4025 if (status) in ice_add_prof_id_flow()
4032 status = ice_rem_vsig(hw, blk, or_vsig, &chg); in ice_add_prof_id_flow()
4033 if (status) in ice_add_prof_id_flow()
4042 status = ice_add_prof_id_vsig(hw, blk, vsig, hdl, false, in ice_add_prof_id_flow()
4043 &chg); in ice_add_prof_id_flow()
4044 if (status) in ice_add_prof_id_flow()
4048 status = ice_adj_prof_priorities(hw, blk, vsig, &chg); in ice_add_prof_id_flow()
4049 if (status) in ice_add_prof_id_flow()
4053 status = ice_create_vsig_from_lst(hw, blk, vsi, in ice_add_prof_id_flow()
4055 &chg); in ice_add_prof_id_flow()
4056 if (status) in ice_add_prof_id_flow()
4060 status = ice_adj_prof_priorities(hw, blk, vsig, &chg); in ice_add_prof_id_flow()
4061 if (status) in ice_add_prof_id_flow()
4070 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_add_prof_id_flow()
4071 if (status) in ice_add_prof_id_flow()
4076 status = ice_create_prof_id_vsig(hw, blk, vsi, hdl, in ice_add_prof_id_flow()
4077 &chg); in ice_add_prof_id_flow()
4078 if (status) in ice_add_prof_id_flow()
4084 if (!status) in ice_add_prof_id_flow()
4085 status = ice_upd_prof_hw(hw, blk, &chg); in ice_add_prof_id_flow()
4088 list_for_each_entry_safe(del, tmp, &chg, list_entry) { in ice_add_prof_id_flow()
4089 list_del(&del->list_entry); in ice_add_prof_id_flow()
4094 list_del(&del1->list); in ice_add_prof_id_flow()
4098 return status; in ice_add_prof_id_flow()
4102 * ice_rem_prof_from_list - remove a profile from list
4113 if (ent->profile_cookie == hdl) { in ice_rem_prof_from_list()
4114 list_del(&ent->list); in ice_rem_prof_from_list()
4119 return -ENOENT; in ice_rem_prof_from_list()
4123 * ice_rem_prof_id_flow - remove flow
4138 struct list_head chg, copy; in ice_rem_prof_id_flow() local
4139 int status; in ice_rem_prof_id_flow() local
4143 INIT_LIST_HEAD(&chg); in ice_rem_prof_id_flow()
4146 status = ice_vsig_find_vsi(hw, blk, vsi, &vsig); in ice_rem_prof_id_flow()
4147 if (!status && vsig) { in ice_rem_prof_id_flow()
4154 status = ice_vsig_get_ref(hw, blk, vsig, &ref); in ice_rem_prof_id_flow()
4155 if (status) in ice_rem_prof_id_flow()
4170 status = ice_rem_vsig(hw, blk, vsig, &chg); in ice_rem_prof_id_flow()
4171 if (status) in ice_rem_prof_id_flow()
4174 status = ice_rem_prof_id_vsig(hw, blk, vsig, in ice_rem_prof_id_flow()
4175 hdl, &chg); in ice_rem_prof_id_flow()
4176 if (status) in ice_rem_prof_id_flow()
4180 status = ice_adj_prof_priorities(hw, blk, vsig, in ice_rem_prof_id_flow()
4181 &chg); in ice_rem_prof_id_flow()
4182 if (status) in ice_rem_prof_id_flow()
4188 status = ice_get_profs_vsig(hw, blk, vsig, ©); in ice_rem_prof_id_flow()
4189 if (status) in ice_rem_prof_id_flow()
4193 status = ice_rem_prof_from_list(hw, ©, hdl); in ice_rem_prof_id_flow()
4194 if (status) in ice_rem_prof_id_flow()
4198 status = ice_move_vsi(hw, blk, vsi, in ice_rem_prof_id_flow()
4199 ICE_DEFAULT_VSIG, &chg); in ice_rem_prof_id_flow()
4200 if (status) in ice_rem_prof_id_flow()
4212 status = ice_move_vsi(hw, blk, vsi, vsig, &chg); in ice_rem_prof_id_flow()
4213 if (status) in ice_rem_prof_id_flow()
4220 status = ice_create_vsig_from_lst(hw, blk, vsi, in ice_rem_prof_id_flow()
4222 &chg); in ice_rem_prof_id_flow()
4223 if (status) in ice_rem_prof_id_flow()
4227 status = ice_adj_prof_priorities(hw, blk, vsig, in ice_rem_prof_id_flow()
4228 &chg); in ice_rem_prof_id_flow()
4229 if (status) in ice_rem_prof_id_flow()
4234 status = -ENOENT; in ice_rem_prof_id_flow()
4238 if (!status) in ice_rem_prof_id_flow()
4239 status = ice_upd_prof_hw(hw, blk, &chg); in ice_rem_prof_id_flow()
4242 list_for_each_entry_safe(del, tmp, &chg, list_entry) { in ice_rem_prof_id_flow()
4243 list_del(&del->list_entry); in ice_rem_prof_id_flow()
4248 list_del(&del1->list); in ice_rem_prof_id_flow()
4252 return status; in ice_rem_prof_id_flow()