Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/ice_flex_pipe.c
/* SPDX-License-Identifier: BSD-3-Clause */ | /* SPDX-License-Identifier: BSD-3-Clause */ | ||||
/* Copyright (c) 2020, Intel Corporation | /* Copyright (c) 2021, Intel Corporation | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions are met: | * modification, are permitted provided that the following conditions are met: | ||||
* | * | ||||
* 1. Redistributions of source code must retain the above copyright notice, | * 1. Redistributions of source code must retain the above copyright notice, | ||||
* this list of conditions and the following disclaimer. | * this list of conditions and the following disclaimer. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 1,041 Lines • ▼ Show 20 Lines | if (status) { | ||||
break; | break; | ||||
} | } | ||||
if (last) | if (last) | ||||
break; | break; | ||||
} | } | ||||
if (!status) { | |||||
status = ice_set_vlan_mode(hw); | |||||
if (status) | |||||
ice_debug(hw, ICE_DBG_PKG, "Failed to set VLAN mode: err %d\n", | |||||
status); | |||||
} | |||||
ice_release_global_cfg_lock(hw); | ice_release_global_cfg_lock(hw); | ||||
return status; | return status; | ||||
} | } | ||||
/** | /** | ||||
* ice_aq_get_pkg_info_list | * ice_aq_get_pkg_info_list | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @pkg_hdr: pointer to the driver's package hdr | * @pkg_hdr: pointer to the driver's package hdr | ||||
* | * | ||||
* Saves off the package details into the HW structure. | * Saves off the package details into the HW structure. | ||||
*/ | */ | ||||
static enum ice_status | static enum ice_status | ||||
ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) | ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) | ||||
{ | { | ||||
struct ice_global_metadata_seg *meta_seg; | |||||
struct ice_generic_seg_hdr *seg_hdr; | struct ice_generic_seg_hdr *seg_hdr; | ||||
ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); | ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); | ||||
if (!pkg_hdr) | if (!pkg_hdr) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
meta_seg = (struct ice_global_metadata_seg *) | seg_hdr = (struct ice_generic_seg_hdr *) | ||||
ice_find_seg_in_pkg(hw, SEGMENT_TYPE_METADATA, pkg_hdr); | ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); | ||||
if (meta_seg) { | if (seg_hdr) { | ||||
hw->pkg_ver = meta_seg->pkg_ver; | struct ice_meta_sect *meta; | ||||
ice_memcpy(hw->pkg_name, meta_seg->pkg_name, | struct ice_pkg_enum state; | ||||
sizeof(hw->pkg_name), ICE_NONDMA_TO_NONDMA); | |||||
ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n", | ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); | ||||
meta_seg->pkg_ver.major, meta_seg->pkg_ver.minor, | |||||
meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, | /* Get package information from the Metadata Section */ | ||||
meta_seg->pkg_name); | meta = (struct ice_meta_sect *) | ||||
} else { | ice_pkg_enum_section((struct ice_seg *)seg_hdr, &state, | ||||
ice_debug(hw, ICE_DBG_INIT, "Did not find metadata segment in driver package\n"); | ICE_SID_METADATA); | ||||
if (!meta) { | |||||
ice_debug(hw, ICE_DBG_INIT, "Did not find ice metadata section in package\n"); | |||||
return ICE_ERR_CFG; | return ICE_ERR_CFG; | ||||
} | } | ||||
seg_hdr = ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); | hw->pkg_ver = meta->ver; | ||||
if (seg_hdr) { | ice_memcpy(hw->pkg_name, meta->name, sizeof(meta->name), | ||||
hw->ice_pkg_ver = seg_hdr->seg_format_ver; | ICE_NONDMA_TO_NONDMA); | ||||
ice_memcpy(hw->ice_pkg_name, seg_hdr->seg_id, | |||||
sizeof(hw->ice_pkg_name), ICE_NONDMA_TO_NONDMA); | |||||
ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n", | |||||
meta->ver.major, meta->ver.minor, meta->ver.update, | |||||
meta->ver.draft, meta->name); | |||||
hw->ice_seg_fmt_ver = seg_hdr->seg_format_ver; | |||||
ice_memcpy(hw->ice_seg_id, seg_hdr->seg_id, | |||||
sizeof(hw->ice_seg_id), ICE_NONDMA_TO_NONDMA); | |||||
ice_debug(hw, ICE_DBG_PKG, "Ice Seg: %d.%d.%d.%d, %s\n", | ice_debug(hw, ICE_DBG_PKG, "Ice Seg: %d.%d.%d.%d, %s\n", | ||||
seg_hdr->seg_format_ver.major, | seg_hdr->seg_format_ver.major, | ||||
seg_hdr->seg_format_ver.minor, | seg_hdr->seg_format_ver.minor, | ||||
seg_hdr->seg_format_ver.update, | seg_hdr->seg_format_ver.update, | ||||
seg_hdr->seg_format_ver.draft, | seg_hdr->seg_format_ver.draft, | ||||
seg_hdr->seg_id); | seg_hdr->seg_id); | ||||
} else { | } else { | ||||
ice_debug(hw, ICE_DBG_INIT, "Did not find ice segment in driver package\n"); | ice_debug(hw, ICE_DBG_INIT, "Did not find ice segment in driver package\n"); | ||||
▲ Show 20 Lines • Show All 738 Lines • ▼ Show 20 Lines | ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count) | ||||
if (section_count > 0) | if (section_count > 0) | ||||
return ICE_ERR_CFG; | return ICE_ERR_CFG; | ||||
if (bld->reserved_section_table_entries + count > ICE_MAX_S_COUNT) | if (bld->reserved_section_table_entries + count > ICE_MAX_S_COUNT) | ||||
return ICE_ERR_CFG; | return ICE_ERR_CFG; | ||||
bld->reserved_section_table_entries += count; | bld->reserved_section_table_entries += count; | ||||
data_end = LE16_TO_CPU(buf->data_end) + | data_end = LE16_TO_CPU(buf->data_end) + | ||||
(count * sizeof(buf->section_entry[0])); | FLEX_ARRAY_SIZE(buf, section_entry, count); | ||||
buf->data_end = CPU_TO_LE16(data_end); | buf->data_end = CPU_TO_LE16(data_end); | ||||
return ICE_SUCCESS; | return ICE_SUCCESS; | ||||
} | } | ||||
/** | /** | ||||
* ice_pkg_buf_alloc_section | * ice_pkg_buf_alloc_section | ||||
* @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) | * @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | ice_pkg_buf_unreserve_section(struct ice_buf_build *bld, u16 count) | ||||
if (section_count > 0) | if (section_count > 0) | ||||
return ICE_ERR_CFG; | return ICE_ERR_CFG; | ||||
if (count > bld->reserved_section_table_entries) | if (count > bld->reserved_section_table_entries) | ||||
return ICE_ERR_CFG; | return ICE_ERR_CFG; | ||||
bld->reserved_section_table_entries -= count; | bld->reserved_section_table_entries -= count; | ||||
data_end = LE16_TO_CPU(buf->data_end) - | data_end = LE16_TO_CPU(buf->data_end) - | ||||
(count * sizeof(buf->section_entry[0])); | FLEX_ARRAY_SIZE(buf, section_entry, count); | ||||
buf->data_end = CPU_TO_LE16(data_end); | buf->data_end = CPU_TO_LE16(data_end); | ||||
return ICE_SUCCESS; | return ICE_SUCCESS; | ||||
} | } | ||||
/** | /** | ||||
* ice_pkg_buf_get_free_space | * ice_pkg_buf_get_free_space | ||||
* @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) | * @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) | ||||
▲ Show 20 Lines • Show All 3,591 Lines • Show Last 20 Lines |