Lines Matching +full:tcam +full:- +full:based

1 /* SPDX-License-Identifier: BSD-3-Clause */
68 cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
77 *error_offset = LE32_TO_CPU(resp->error_offset);
79 *error_info = LE32_TO_CPU(resp->error_info);
137 cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
146 *error_offset = LE32_TO_CPU(resp->error_offset);
148 *error_info = LE32_TO_CPU(resp->error_info);
171 pkg_hdr->pkg_format_ver.major, pkg_hdr->pkg_format_ver.minor,
172 pkg_hdr->pkg_format_ver.update,
173 pkg_hdr->pkg_format_ver.draft);
176 for (i = 0; i < LE32_TO_CPU(pkg_hdr->seg_count); i++) {
180 ((u8 *)pkg_hdr + LE32_TO_CPU(pkg_hdr->seg_offset[i]));
182 if (LE32_TO_CPU(seg->seg_type) == seg_type)
199 if (idx < LE32_TO_CPU(pkg_hdr->seg_count))
202 LE32_TO_CPU(pkg_hdr->seg_offset[idx]));
208 * ice_is_signing_seg_at_idx - determine if segment is a signing segment
219 retval = LE32_TO_CPU(seg->seg_type) == SEGMENT_TYPE_SIGNING;
244 if (seg && LE32_TO_CPU(seg->seg_id) == seg_id &&
245 LE32_TO_CPU(seg->sign_type) == sign_type)
269 status = ice_aq_update_pkg(hw, bh, LE16_TO_CPU(bh->data_end),
326 * ice_is_buffer_metadata - determine if package buffer is a metadata buffer
333 if (LE32_TO_CPU(buf->section_entry[0].type) & ICE_METADATA_BUF)
393 if (LE32_TO_CPU(bh->section_entry[0].type) & ICE_METADATA_BUF)
412 err = hw->adminq.sq_last_status;
446 * ice_get_pkg_segment_id - get correct package segment id, based on device
469 * ice_get_pkg_sign_type - get package segment sign type, based on device
496 * ice_get_signing_req - get correct package requirements, based on device
501 hw->pkg_seg_id = ice_get_pkg_segment_id(hw->mac_type);
502 hw->pkg_sign_type = ice_get_pkg_sign_type(hw->mac_type);
506 * ice_download_pkg_sig_seg - download a signature segment
515 state = ice_dwnld_cfg_bufs_no_lock(hw, seg->buf_tbl.buf_array, 0,
516 LE32_TO_CPU(seg->buf_tbl.buf_count),
523 * ice_download_pkg_config_seg - download a config segment
547 buf_count = LE32_TO_CPU(bufs->buf_count);
552 state = ice_dwnld_cfg_bufs_no_lock(hw, bufs->buf_array, start, count,
559 * ice_dwnld_sign_and_cfg_segs - download a signing segment and config segment
584 conf_idx = LE32_TO_CPU(seg->signed_seg_idx);
585 start = LE32_TO_CPU(seg->signed_buf_start);
586 count = LE32_TO_CPU(seg->signed_buf_count);
587 flags = LE32_TO_CPU(seg->flags);
612 * ice_match_signing_seg - determine if a matching signing segment exists
623 for (i = 0; i < LE32_TO_CPU(pkg_hdr->seg_count); i++) {
635 * ice_post_dwnld_pkg_actions - perform post download package actions
655 * ice_download_pkg_with_sig_seg - download package using signature segments
662 enum ice_aq_err aq_err = hw->adminq.sq_last_status;
667 ice_debug(hw, ICE_DBG_INIT, "Segment ID %d\n", hw->pkg_seg_id);
668 ice_debug(hw, ICE_DBG_INIT, "Signature type %d\n", hw->pkg_sign_type);
679 for (i = 0; i < LE32_TO_CPU(pkg_hdr->seg_count); i++) {
680 if (!ice_is_signing_seg_type_at_idx(pkg_hdr, i, hw->pkg_seg_id,
681 hw->pkg_sign_type))
721 if (LE32_TO_CPU(bh->section_entry[0].type) & ICE_METADATA_BUF)
728 return ice_map_aq_err_to_ddp_state(hw->adminq.sq_last_status);
754 ice_seg->hdr.seg_format_ver.major,
755 ice_seg->hdr.seg_format_ver.minor,
756 ice_seg->hdr.seg_format_ver.update,
757 ice_seg->hdr.seg_format_ver.draft);
760 LE32_TO_CPU(ice_seg->hdr.seg_type),
761 LE32_TO_CPU(ice_seg->hdr.seg_size), ice_seg->hdr.seg_id);
766 LE32_TO_CPU(ice_buf_tbl->buf_count));
768 state = ice_dwnld_cfg_bufs(hw, ice_buf_tbl->buf_array,
769 LE32_TO_CPU(ice_buf_tbl->buf_count));
788 if (ice_match_signing_seg(pkg_hdr, hw->pkg_seg_id, hw->pkg_sign_type))
816 hw->pkg_seg_id);
819 ice_find_seg_in_pkg(hw, hw->pkg_seg_id, pkg_hdr);
835 hw->pkg_ver = meta->ver;
836 ice_memcpy(hw->pkg_name, meta->name, sizeof(meta->name),
840 meta->ver.major, meta->ver.minor, meta->ver.update,
841 meta->ver.draft, meta->name);
843 hw->ice_seg_fmt_ver = seg_hdr->seg_format_ver;
844 ice_memcpy(hw->ice_seg_id, seg_hdr->seg_id,
845 sizeof(hw->ice_seg_id), ICE_NONDMA_TO_NONDMA);
848 seg_hdr->seg_format_ver.major,
849 seg_hdr->seg_format_ver.minor,
850 seg_hdr->seg_format_ver.update,
851 seg_hdr->seg_format_ver.draft,
852 seg_hdr->seg_id);
884 for (i = 0; i < LE32_TO_CPU(pkg_info->count); i++) {
889 if (pkg_info->pkg_info[i].is_active) {
891 hw->active_pkg_ver = pkg_info->pkg_info[i].ver;
892 hw->active_track_id =
893 LE32_TO_CPU(pkg_info->pkg_info[i].track_id);
894 ice_memcpy(hw->active_pkg_name,
895 pkg_info->pkg_info[i].name,
896 sizeof(pkg_info->pkg_info[i].name),
898 hw->active_pkg_in_nvm = pkg_info->pkg_info[i].is_in_nvm;
900 if (pkg_info->pkg_info[i].is_active_at_boot)
902 if (pkg_info->pkg_info[i].is_modified)
904 if (pkg_info->pkg_info[i].is_in_nvm)
908 i, pkg_info->pkg_info[i].ver.major,
909 pkg_info->pkg_info[i].ver.minor,
910 pkg_info->pkg_info[i].ver.update,
911 pkg_info->pkg_info[i].ver.draft,
912 pkg_info->pkg_info[i].name, flags);
947 if (index >= LE16_TO_CPU(labels->count))
950 return labels->label + index;
981 *value = LE16_TO_CPU(label->value);
982 return label->name;
987 * @ice_seg: pointer to the ice segment (non-NULL)
1023 * ice_verify_pkg - verify package
1038 if (pkg->pkg_format_ver.major != ICE_PKG_FMT_VER_MAJ ||
1039 pkg->pkg_format_ver.minor != ICE_PKG_FMT_VER_MNR ||
1040 pkg->pkg_format_ver.update != ICE_PKG_FMT_VER_UPD ||
1041 pkg->pkg_format_ver.draft != ICE_PKG_FMT_VER_DFT)
1045 seg_count = LE32_TO_CPU(pkg->seg_count);
1055 u32 off = LE32_TO_CPU(pkg->seg_offset[i]);
1065 if (len < off + LE32_TO_CPU(seg->seg_size))
1073 * ice_free_seg - free package segment pointer
1081 if (hw->pkg_copy) {
1082 ice_free(hw, hw->pkg_copy);
1083 hw->pkg_copy = NULL;
1084 hw->pkg_size = 0;
1086 hw->seg = NULL;
1090 * ice_chk_pkg_version - check package version for compatibility with driver
1100 if (pkg_ver->major > ICE_PKG_SUPP_VER_MAJ ||
1101 (pkg_ver->major == ICE_PKG_SUPP_VER_MAJ &&
1102 pkg_ver->minor > ICE_PKG_SUPP_VER_MNR))
1104 else if (pkg_ver->major < ICE_PKG_SUPP_VER_MAJ ||
1105 (pkg_ver->major == ICE_PKG_SUPP_VER_MAJ &&
1106 pkg_ver->minor < ICE_PKG_SUPP_VER_MNR))
1129 state = ice_chk_pkg_version(&hw->pkg_ver);
1136 *seg = (struct ice_seg *)ice_find_seg_in_pkg(hw, hw->pkg_seg_id,
1154 for (i = 0; i < LE32_TO_CPU(pkg->count); i++) {
1156 if (!pkg->pkg_info[i].is_in_nvm)
1158 if ((*seg)->hdr.seg_format_ver.major !=
1159 pkg->pkg_info[i].ver.major ||
1160 (*seg)->hdr.seg_format_ver.minor >
1161 pkg->pkg_info[i].ver.minor) {
1192 if (index >= LE16_TO_CPU(fv_section->count))
1200 *offset = LE16_TO_CPU(fv_section->base_offset) + index;
1201 return fv_section->fv + index;
1205 * ice_get_prof_index_max - get the max profile index for used profile
1223 if (!hw->seg)
1226 ice_seg = hw->seg;
1239 for (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++)
1240 if (fv->ew[j].prot_id != ICE_PROT_INVALID ||
1241 fv->ew[j].off != ICE_FV_OFFSET_INVAL)
1250 hw->switch_info->max_used_prof_index = max_prof_index;
1256 * ice_get_ddp_pkg_state - get DDP pkg state after download
1264 if (hw->pkg_ver.major == hw->active_pkg_ver.major &&
1265 hw->pkg_ver.minor == hw->active_pkg_ver.minor &&
1266 hw->pkg_ver.update == hw->active_pkg_ver.update &&
1267 hw->pkg_ver.draft == hw->active_pkg_ver.draft &&
1268 !memcmp(hw->pkg_name, hw->active_pkg_name, sizeof(hw->pkg_name))) {
1273 } else if (hw->active_pkg_ver.major != ICE_PKG_SUPP_VER_MAJ ||
1274 hw->active_pkg_ver.minor != ICE_PKG_SUPP_VER_MNR) {
1282 * ice_init_pkg_regs - initialize additional package registers
1291 /* setup Switch block input mask, which is 48-bits in two parts */
1297 * ice_init_pkg - initialize/download package
1356 ice_debug(hw, ICE_DBG_INIT, "package previously loaded - no work.\n");
1370 hw->seg = seg;
1387 * ice_copy_and_init_pkg - initialize/download a copy of the package
1426 hw->pkg_copy = buf_copy;
1427 hw->pkg_size = len;
1434 * ice_is_init_pkg_successful - check if DDP init was successful
1466 buf->data_end = CPU_TO_LE16(offsetof(struct ice_buf_hdr,
1492 * ice_get_sw_prof_type - determine switch profile type
1509 for (i = 0; i < hw->blk[ICE_BLK_SW].es.fvw; i++) {
1510 if (fv->ew[i].off != ICE_NAN_OFFSET)
1514 if (fv->ew[i].prot_id == (u8)ICE_PROT_UDP_OF &&
1515 fv->ew[i].off == ICE_VNI_OFFSET)
1519 if (fv->ew[i].prot_id == (u8)ICE_PROT_GRE_OF)
1527 * ice_get_sw_fv_bitmap - Get switch field vector bitmap based on profile type
1542 ice_seg = hw->seg;
1590 if (!lkups->n_val_words || !hw->seg)
1593 ice_seg = hw->seg;
1610 for (i = 0; i < lkups->n_val_words; i++) {
1613 for (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++)
1614 if (fv->ew[j].prot_id ==
1615 lkups->fv_words[i].prot_id &&
1616 fv->ew[j].off == lkups->fv_words[i].off)
1618 if (j >= hw->blk[ICE_BLK_SW].es.fvw)
1620 if (i + 1 == lkups->n_val_words) {
1625 fvl->fv_ptr = fv;
1626 fvl->profile_id = offset;
1627 LIST_ADD(&fvl->list_entry, fv_list);
1641 LIST_DEL(&fvl->list_entry);
1649 * ice_init_prof_result_bm - Initialize the profile result index bitmap
1660 if (!hw->seg)
1663 ice_seg = hw->seg;
1675 ice_zero_bitmap(hw->switch_info->prof_res_bm[off],
1683 if (fv->ew[i].prot_id == ICE_PROT_INVALID &&
1684 fv->ew[i].off == ICE_FV_OFFSET_INVAL)
1686 hw->switch_info->prof_res_bm[off]);
1725 buf = (struct ice_buf_hdr *)&bld->buf;
1728 section_count = LE16_TO_CPU(buf->section_count);
1732 if (bld->reserved_section_table_entries + count > ICE_MAX_S_COUNT)
1734 bld->reserved_section_table_entries += count;
1736 data_end = LE16_TO_CPU(buf->data_end) +
1738 buf->data_end = CPU_TO_LE16(data_end);
1765 buf = (struct ice_buf_hdr *)&bld->buf;
1768 data_end = LE16_TO_CPU(buf->data_end);
1777 sect_count = LE16_TO_CPU(buf->section_count);
1778 if (sect_count < bld->reserved_section_table_entries) {
1781 buf->section_entry[sect_count].offset = CPU_TO_LE16(data_end);
1782 buf->section_entry[sect_count].size = CPU_TO_LE16(size);
1783 buf->section_entry[sect_count].type = CPU_TO_LE32(type);
1786 buf->data_end = CPU_TO_LE16(data_end);
1788 buf->section_count = CPU_TO_LE16(sect_count + 1);
1857 buf = (struct ice_buf_hdr *)&bld->buf;
1860 section_count = LE16_TO_CPU(buf->section_count);
1864 if (count > bld->reserved_section_table_entries)
1866 bld->reserved_section_table_entries -= count;
1868 data_end = LE16_TO_CPU(buf->data_end) -
1870 buf->data_end = CPU_TO_LE16(data_end);
1889 buf = (struct ice_buf_hdr *)&bld->buf;
1890 return ICE_MAX_S_DATA_END - LE16_TO_CPU(buf->data_end);
1899 * least one active section - otherwise, the buffer is not legal and should
1910 buf = (struct ice_buf_hdr *)&bld->buf;
1911 return LE16_TO_CPU(buf->section_count);
1923 return &bld->buf;
1939 (ice_seg->device_table +
1940 LE32_TO_CPU(ice_seg->device_table_count));
1943 (nvms->vers + LE32_TO_CPU(nvms->table_count));
1958 hdr = (struct ice_buf_hdr *)buf->buf;
1960 section_count = LE16_TO_CPU(hdr->section_count);
1964 data_end = LE16_TO_CPU(hdr->data_end);
1977 * call is made with the ice_seg parameter non-NULL; on subsequent calls,
1987 state->buf_table = ice_find_buf_table(ice_seg);
1988 if (!state->buf_table)
1991 state->buf_idx = 0;
1992 return ice_pkg_val_buf(state->buf_table->buf_array);
1995 if (++state->buf_idx < LE32_TO_CPU(state->buf_table->buf_count))
1996 return ice_pkg_val_buf(state->buf_table->buf_array +
1997 state->buf_idx);
2013 if (!ice_seg && !state->buf)
2016 if (!ice_seg && state->buf)
2017 if (++state->sect_idx < LE16_TO_CPU(state->buf->section_count))
2020 state->buf = ice_pkg_enum_buf(ice_seg, state);
2021 if (!state->buf)
2025 state->sect_idx = 0;
2036 * ice segment. The first call is made with the ice_seg parameter non-NULL;
2048 state->type = sect_type;
2054 while (state->buf->section_entry[state->sect_idx].type !=
2055 CPU_TO_LE32(state->type))
2060 offset = LE16_TO_CPU(state->buf->section_entry[state->sect_idx].offset);
2064 size = LE16_TO_CPU(state->buf->section_entry[state->sect_idx].size);
2072 state->sect_type =
2073 LE32_TO_CPU(state->buf->section_entry[state->sect_idx].type);
2076 state->sect = ((u8 *)state->buf) +
2077 LE16_TO_CPU(state->buf->section_entry[state->sect_idx].offset);
2079 return state->sect;
2091 * the ice segment. The first call is made with the ice_seg parameter non-NULL;
2122 state->entry_idx = 0;
2123 state->handler = handler;
2125 state->entry_idx++;
2128 if (!state->handler)
2132 entry = state->handler(state->sect_type, state->sect, state->entry_idx,
2139 state->entry_idx = 0;
2140 entry = state->handler(state->sect_type, state->sect,
2141 state->entry_idx, offset);
2151 * @index: index of the boost TCAM entry to be returned
2152 * @offset: pointer to receive absolute offset, always 0 for boost TCAM sections
2155 * Handles enumeration of individual boost TCAM entries.
2175 if (index >= LE16_TO_CPU(boost->count))
2178 return boost->tcam + index;
2183 * @ice_seg: pointer to the ice segment (non-NULL)
2184 * @addr: Boost TCAM address of entry to search for
2187 * Finds a particular Boost TCAM entry and returns a pointer to that entry
2195 struct ice_boost_tcam_entry *tcam;
2204 tcam = (struct ice_boost_tcam_entry *)
2208 if (tcam && LE16_TO_CPU(tcam->addr) == addr) {
2209 *entry = tcam;
2214 } while (tcam);
2223 * @ice_seg: pointer to the segment of the package scan (non-NULL)
2237 ice_memset(&hw->tnl, 0, sizeof(hw->tnl), ICE_NONDMA_MEM);
2255 /* Cache the appropriate boost TCAM entry pointers for tunnels */
2256 for (i = 0; i < hw->tnl.count; i++) {
2257 ice_find_boost_entry(ice_seg, hw->tnl.tbl[i].boost_addr,
2258 &hw->tnl.tbl[i].boost_entry);
2259 if (hw->tnl.tbl[i].boost_entry)
2260 hw->tnl.tbl[i].valid = true;
2273 * 0 - Means the caller has acquired the global config lock
2275 * ICE_ERR_AQ_NO_WORK - Indicates another driver has already written the
2348 * ice_get_set_tx_topo - get or set tx topology
2354 * @set: 0-get, 1-set topology
2369 cmd->set_flags = ICE_AQC_TX_TOPO_FLAGS_ISSUED;
2372 cmd->set_flags |= ICE_AQC_TX_TOPO_FLAGS_SRC_RAM |
2378 cmd->get_flags = ICE_AQC_TX_TOPO_GET_RAM;
2395 * ice_cfg_tx_topo - Initialize new tx topology if available
2419 if (!hw->func_caps.common_cap.tx_sched_topo_comp_mode_en) {
2440 hw->num_tx_sched_layers == 9) {
2448 hw->num_tx_sched_layers == 5) {
2465 hw->num_tx_sched_layers == 5) {
2486 if (LE32_TO_CPU(seg->buf_table.buf_count) < ICE_MIN_S_COUNT) {
2488 seg->buf_table.buf_count);
2492 section = ice_pkg_val_buf(seg->buf_table.buf_array);
2494 if (!section || LE32_TO_CPU(section->section_entry[0].type) !=
2500 size = LE16_TO_CPU(section->section_entry[0].size);
2501 offset = LE16_TO_CPU(section->section_entry[0].offset);
2530 /* Reset is in progress, re-init the hw again */