Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ice/ice_switch.c
Context not available. | |||||
* In case of Ether type filter it is treated as header without VLAN tag | * In case of Ether type filter it is treated as header without VLAN tag | ||||
* and byte 12 and 13 is used to program a given Ether type instead | * and byte 12 and 13 is used to program a given Ether type instead | ||||
*/ | */ | ||||
#define DUMMY_ETH_HDR_LEN 16 | |||||
static const u8 dummy_eth_header[DUMMY_ETH_HDR_LEN] = { 0x2, 0, 0, 0, 0, 0, | static const u8 dummy_eth_header[DUMMY_ETH_HDR_LEN] = { 0x2, 0, 0, 0, 0, 0, | ||||
0x2, 0, 0, 0, 0, 0, | 0x2, 0, 0, 0, 0, 0, | ||||
0x81, 0, 0, 0}; | 0x81, 0, 0, 0}; | ||||
#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \ | |||||
(sizeof(struct ice_aqc_sw_rules_elem) - \ | |||||
sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \ | |||||
sizeof(struct ice_sw_rule_lkup_rx_tx) + DUMMY_ETH_HDR_LEN - 1) | |||||
#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \ | |||||
(sizeof(struct ice_aqc_sw_rules_elem) - \ | |||||
sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \ | |||||
sizeof(struct ice_sw_rule_lkup_rx_tx) - 1) | |||||
#define ICE_SW_RULE_LG_ACT_SIZE(n) \ | |||||
(sizeof(struct ice_aqc_sw_rules_elem) - \ | |||||
sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \ | |||||
sizeof(struct ice_sw_rule_lg_act) - \ | |||||
sizeof(((struct ice_sw_rule_lg_act *)0)->act) + \ | |||||
((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act))) | |||||
#define ICE_SW_RULE_VSI_LIST_SIZE(n) \ | |||||
(sizeof(struct ice_aqc_sw_rules_elem) - \ | |||||
sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \ | |||||
sizeof(struct ice_sw_rule_vsi_list) - \ | |||||
sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi) + \ | |||||
((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi))) | |||||
/** | /** | ||||
* ice_init_def_sw_recp - initialize the recipe book keeping tables | * ice_init_def_sw_recp - initialize the recipe book keeping tables | ||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
Context not available. | |||||
* @num_elems: pointer to number of elements | * @num_elems: pointer to number of elements | ||||
* @cd: pointer to command details structure or NULL | * @cd: pointer to command details structure or NULL | ||||
* | * | ||||
* Get switch configuration (0x0200) to be placed in 'buff'. | * Get switch configuration (0x0200) to be placed in buf. | ||||
* This admin command returns information such as initial VSI/port number | * This admin command returns information such as initial VSI/port number | ||||
* and switch ID it belongs to. | * and switch ID it belongs to. | ||||
* | * | ||||
Context not available. | |||||
* parsing the response buffer. | * parsing the response buffer. | ||||
*/ | */ | ||||
static enum ice_status | static enum ice_status | ||||
ice_aq_get_sw_cfg(struct ice_hw *hw, struct ice_aqc_get_sw_cfg_resp *buf, | ice_aq_get_sw_cfg(struct ice_hw *hw, struct ice_aqc_get_sw_cfg_resp_elem *buf, | ||||
u16 buf_size, u16 *req_desc, u16 *num_elems, | u16 buf_size, u16 *req_desc, u16 *num_elems, | ||||
struct ice_sq_cd *cd) | struct ice_sq_cd *cd) | ||||
{ | { | ||||
struct ice_aqc_get_sw_cfg *cmd; | struct ice_aqc_get_sw_cfg *cmd; | ||||
enum ice_status status; | |||||
struct ice_aq_desc desc; | struct ice_aq_desc desc; | ||||
enum ice_status status; | |||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_sw_cfg); | ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_sw_cfg); | ||||
cmd = &desc.params.get_sw_conf; | cmd = &desc.params.get_sw_conf; | ||||
Context not available. | |||||
enum ice_status status; | enum ice_status status; | ||||
u16 buf_len; | u16 buf_len; | ||||
buf_len = sizeof(*sw_buf); | buf_len = ice_struct_size(sw_buf, elem, 1); | ||||
sw_buf = (struct ice_aqc_alloc_free_res_elem *) | sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len); | ||||
ice_malloc(hw, buf_len); | |||||
if (!sw_buf) | if (!sw_buf) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
Context not available. | |||||
enum ice_status status, ret_status; | enum ice_status status, ret_status; | ||||
u16 buf_len; | u16 buf_len; | ||||
buf_len = sizeof(*sw_buf); | buf_len = ice_struct_size(sw_buf, elem, 1); | ||||
sw_buf = (struct ice_aqc_alloc_free_res_elem *) | sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len); | ||||
ice_malloc(hw, buf_len); | |||||
if (!sw_buf) | if (!sw_buf) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
Context not available. | |||||
status = ice_aq_alloc_free_res(hw, 1, counter_buf, buf_len, | status = ice_aq_alloc_free_res(hw, 1, counter_buf, buf_len, | ||||
ice_aqc_opc_free_res, NULL); | ice_aqc_opc_free_res, NULL); | ||||
if (status) { | if (status) { | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "VEB counter resource could not be freed\n"); | ||||
"VEB counter resource could not be freed\n"); | |||||
ret_status = status; | ret_status = status; | ||||
} | } | ||||
Context not available. | |||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
break; | break; | ||||
default: | default: | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "Error due to unsupported rule_type %u\n", rule_type); | ||||
"Error due to unsupported rule_type %u\n", rule_type); | |||||
return ICE_ERR_OUT_OF_RANGE; | return ICE_ERR_OUT_OF_RANGE; | ||||
} | } | ||||
Context not available. | |||||
* than ICE_MAX_VSI, if not return with error. | * than ICE_MAX_VSI, if not return with error. | ||||
*/ | */ | ||||
if (id >= ICE_MAX_VSI) { | if (id >= ICE_MAX_VSI) { | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "Error VSI index (%u) out-of-range\n", | ||||
"Error VSI index (%u) out-of-range\n", | |||||
id); | id); | ||||
ice_free(hw, mr_list); | ice_free(hw, mr_list); | ||||
return ICE_ERR_OUT_OF_RANGE; | return ICE_ERR_OUT_OF_RANGE; | ||||
Context not available. | |||||
enum ice_status status; | enum ice_status status; | ||||
u16 buf_len; | u16 buf_len; | ||||
buf_len = sizeof(*sw_buf); | buf_len = ice_struct_size(sw_buf, elem, 1); | ||||
sw_buf = (struct ice_aqc_alloc_free_res_elem *) | sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len); | ||||
ice_malloc(hw, buf_len); | |||||
if (!sw_buf) | if (!sw_buf) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
sw_buf->num_elems = CPU_TO_LE16(1); | sw_buf->num_elems = CPU_TO_LE16(1); | ||||
Context not available. | |||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
* @bcast_thresh: represents the upper threshold for broadcast storm control | * @bcast_thresh: represents the upper threshold for broadcast storm control | ||||
* @mcast_thresh: represents the upper threshold for multicast storm control | * @mcast_thresh: represents the upper threshold for multicast storm control | ||||
* @ctl_bitmask: storm control control knobs | * @ctl_bitmask: storm control knobs | ||||
* | * | ||||
* Sets the storm control configuration (0x0280) | * Sets the storm control configuration (0x0280) | ||||
*/ | */ | ||||
Context not available. | |||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
* @bcast_thresh: represents the upper threshold for broadcast storm control | * @bcast_thresh: represents the upper threshold for broadcast storm control | ||||
* @mcast_thresh: represents the upper threshold for multicast storm control | * @mcast_thresh: represents the upper threshold for multicast storm control | ||||
* @ctl_bitmask: storm control control knobs | * @ctl_bitmask: storm control knobs | ||||
* | * | ||||
* Gets the storm control configuration (0x0281) | * Gets the storm control configuration (0x0281) | ||||
*/ | */ | ||||
Context not available. | |||||
u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd) | u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd) | ||||
{ | { | ||||
struct ice_aq_desc desc; | struct ice_aq_desc desc; | ||||
enum ice_status status; | |||||
ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); | ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); | ||||
Context not available. | |||||
desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD); | desc.flags |= CPU_TO_LE16(ICE_AQ_FLAG_RD); | ||||
desc.params.sw_rules.num_rules_fltr_entry_index = | desc.params.sw_rules.num_rules_fltr_entry_index = | ||||
CPU_TO_LE16(num_rules); | CPU_TO_LE16(num_rules); | ||||
return ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd); | status = ice_aq_send_cmd(hw, &desc, rule_list, rule_list_sz, cd); | ||||
if (opc != ice_aqc_opc_add_sw_rules && | |||||
hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) | |||||
status = ICE_ERR_DOES_NOT_EXIST; | |||||
return status; | |||||
} | } | ||||
/* ice_init_port_info - Initialize port_info with switch configuration data | /* ice_init_port_info - Initialize port_info with switch configuration data | ||||
Context not available. | |||||
pi->dflt_rx_vsi_num = ICE_DFLT_VSI_INVAL; | pi->dflt_rx_vsi_num = ICE_DFLT_VSI_INVAL; | ||||
break; | break; | ||||
default: | default: | ||||
ice_debug(pi->hw, ICE_DBG_SW, | ice_debug(pi->hw, ICE_DBG_SW, "incorrect VSI/port type received\n"); | ||||
"incorrect VSI/port type received\n"); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
Context not available. | |||||
*/ | */ | ||||
enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw) | enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw) | ||||
{ | { | ||||
struct ice_aqc_get_sw_cfg_resp *rbuf; | struct ice_aqc_get_sw_cfg_resp_elem *rbuf; | ||||
enum ice_status status; | enum ice_status status; | ||||
u8 num_total_ports; | u8 num_total_ports; | ||||
u16 req_desc = 0; | u16 req_desc = 0; | ||||
Context not available. | |||||
num_total_ports = 1; | num_total_ports = 1; | ||||
rbuf = (struct ice_aqc_get_sw_cfg_resp *) | rbuf = (struct ice_aqc_get_sw_cfg_resp_elem *) | ||||
ice_malloc(hw, ICE_SW_CFG_MAX_BUF_LEN); | ice_malloc(hw, ICE_SW_CFG_MAX_BUF_LEN); | ||||
if (!rbuf) | if (!rbuf) | ||||
Context not available. | |||||
* writing a non-zero value in req_desc | * writing a non-zero value in req_desc | ||||
*/ | */ | ||||
do { | do { | ||||
struct ice_aqc_get_sw_cfg_resp_elem *ele; | |||||
status = ice_aq_get_sw_cfg(hw, rbuf, ICE_SW_CFG_MAX_BUF_LEN, | status = ice_aq_get_sw_cfg(hw, rbuf, ICE_SW_CFG_MAX_BUF_LEN, | ||||
&req_desc, &num_elems, NULL); | &req_desc, &num_elems, NULL); | ||||
if (status) | if (status) | ||||
break; | break; | ||||
for (i = 0; i < num_elems; i++) { | for (i = 0, ele = rbuf; i < num_elems; i++, ele++) { | ||||
struct ice_aqc_get_sw_cfg_resp_elem *ele; | |||||
u16 pf_vf_num, swid, vsi_port_num; | u16 pf_vf_num, swid, vsi_port_num; | ||||
bool is_vf = false; | bool is_vf = false; | ||||
u8 res_type; | u8 res_type; | ||||
ele = rbuf[i].elements; | |||||
vsi_port_num = LE16_TO_CPU(ele->vsi_port_num) & | vsi_port_num = LE16_TO_CPU(ele->vsi_port_num) & | ||||
ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M; | ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M; | ||||
Context not available. | |||||
case ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT: | case ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT: | ||||
case ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT: | case ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT: | ||||
if (j == num_total_ports) { | if (j == num_total_ports) { | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "more ports than expected\n"); | ||||
"more ports than expected\n"); | |||||
status = ICE_ERR_CFG; | status = ICE_ERR_CFG; | ||||
goto out; | goto out; | ||||
} | } | ||||
Context not available. | |||||
} while (req_desc && !status); | } while (req_desc && !status); | ||||
out: | out: | ||||
ice_free(hw, (void *)rbuf); | ice_free(hw, rbuf); | ||||
return status; | return status; | ||||
} | } | ||||
Context not available. | |||||
m_ent->fltr_info.fwd_id.hw_vsi_id; | m_ent->fltr_info.fwd_id.hw_vsi_id; | ||||
act = ICE_LG_ACT_VSI_FORWARDING | ICE_LG_ACT_VALID_BIT; | act = ICE_LG_ACT_VSI_FORWARDING | ICE_LG_ACT_VALID_BIT; | ||||
act |= (id << ICE_LG_ACT_VSI_LIST_ID_S) & | act |= (id << ICE_LG_ACT_VSI_LIST_ID_S) & ICE_LG_ACT_VSI_LIST_ID_M; | ||||
ICE_LG_ACT_VSI_LIST_ID_M; | |||||
if (m_ent->vsi_count > 1) | if (m_ent->vsi_count > 1) | ||||
act |= ICE_LG_ACT_VSI_LIST; | act |= ICE_LG_ACT_VSI_LIST; | ||||
lg_act->pdata.lg_act.act[0] = CPU_TO_LE32(act); | lg_act->pdata.lg_act.act[0] = CPU_TO_LE32(act); | ||||
Context not available. | |||||
*/ | */ | ||||
lg_act_size = (u16)ICE_SW_RULE_LG_ACT_SIZE(num_acts); | lg_act_size = (u16)ICE_SW_RULE_LG_ACT_SIZE(num_acts); | ||||
rules_size = lg_act_size + ICE_SW_RULE_RX_TX_ETH_HDR_SIZE; | rules_size = lg_act_size + ICE_SW_RULE_RX_TX_ETH_HDR_SIZE; | ||||
lg_act = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, | lg_act = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, rules_size); | ||||
rules_size); | |||||
if (!lg_act) | if (!lg_act) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
rx_tx = (struct ice_aqc_sw_rules_elem *) | rx_tx = (struct ice_aqc_sw_rules_elem *)((u8 *)lg_act + lg_act_size); | ||||
((u8 *)lg_act + lg_act_size); | |||||
/* Fill in the first switch rule i.e. large action */ | /* Fill in the first switch rule i.e. large action */ | ||||
lg_act->type = CPU_TO_LE16(ICE_AQC_SW_RULES_T_LG_ACT); | lg_act->type = CPU_TO_LE16(ICE_AQC_SW_RULES_T_LG_ACT); | ||||
Context not available. | |||||
ice_remove_vsi_list_rule(struct ice_hw *hw, u16 vsi_list_id, | ice_remove_vsi_list_rule(struct ice_hw *hw, u16 vsi_list_id, | ||||
enum ice_sw_lkup_type lkup_type) | enum ice_sw_lkup_type lkup_type) | ||||
{ | { | ||||
struct ice_aqc_sw_rules_elem *s_rule; | |||||
enum ice_status status; | |||||
u16 s_rule_size; | |||||
s_rule_size = (u16)ICE_SW_RULE_VSI_LIST_SIZE(0); | |||||
s_rule = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, s_rule_size); | |||||
if (!s_rule) | |||||
return ICE_ERR_NO_MEMORY; | |||||
s_rule->type = CPU_TO_LE16(ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR); | |||||
s_rule->pdata.vsi_list.index = CPU_TO_LE16(vsi_list_id); | |||||
/* Free the vsi_list resource that we allocated. It is assumed that the | /* Free the vsi_list resource that we allocated. It is assumed that the | ||||
* list is empty at this point. | * list is empty at this point. | ||||
*/ | */ | ||||
status = ice_aq_alloc_free_vsi_list(hw, &vsi_list_id, lkup_type, | return ice_aq_alloc_free_vsi_list(hw, &vsi_list_id, lkup_type, | ||||
ice_aqc_opc_free_res); | ice_aqc_opc_free_res); | ||||
ice_free(hw, s_rule); | |||||
return status; | |||||
} | } | ||||
/** | /** | ||||
Context not available. | |||||
tmp_fltr_info.vsi_handle = rem_vsi_handle; | tmp_fltr_info.vsi_handle = rem_vsi_handle; | ||||
status = ice_update_pkt_fwd_rule(hw, &tmp_fltr_info); | status = ice_update_pkt_fwd_rule(hw, &tmp_fltr_info); | ||||
if (status) { | if (status) { | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n", | ||||
"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n", | |||||
tmp_fltr_info.fwd_id.hw_vsi_id, status); | tmp_fltr_info.fwd_id.hw_vsi_id, status); | ||||
return status; | return status; | ||||
} | } | ||||
Context not available. | |||||
/* Remove the VSI list since it is no longer used */ | /* Remove the VSI list since it is no longer used */ | ||||
status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type); | status = ice_remove_vsi_list_rule(hw, vsi_list_id, lkup_type); | ||||
if (status) { | if (status) { | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "Failed to remove VSI list %d, error %d\n", | ||||
"Failed to remove VSI list %d, error %d\n", | |||||
vsi_list_id, status); | vsi_list_id, status); | ||||
return status; | return status; | ||||
} | } | ||||
Context not available. | |||||
* ice_aq_get_res_alloc - get allocated resources | * ice_aq_get_res_alloc - get allocated resources | ||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
* @num_entries: pointer to u16 to store the number of resource entries returned | * @num_entries: pointer to u16 to store the number of resource entries returned | ||||
* @buf: pointer to user-supplied buffer | * @buf: pointer to buffer | ||||
* @buf_size: size of buff | * @buf_size: size of buf | ||||
* @cd: pointer to command details structure or NULL | * @cd: pointer to command details structure or NULL | ||||
* | * | ||||
* The user-supplied buffer must be large enough to store the resource | * The caller-supplied buffer must be large enough to store the resource | ||||
* information for all resource types. Each resource type is an | * information for all resource types. Each resource type is an | ||||
* ice_aqc_get_res_resp_data_elem structure. | * ice_aqc_get_res_resp_elem structure. | ||||
*/ | */ | ||||
enum ice_status | enum ice_status | ||||
ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, void *buf, | ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, | ||||
u16 buf_size, struct ice_sq_cd *cd) | struct ice_aqc_get_res_resp_elem *buf, u16 buf_size, | ||||
struct ice_sq_cd *cd) | |||||
{ | { | ||||
struct ice_aqc_get_res_alloc *resp; | struct ice_aqc_get_res_alloc *resp; | ||||
enum ice_status status; | enum ice_status status; | ||||
Context not available. | |||||
* ice_aq_get_res_descs - get allocated resource descriptors | * ice_aq_get_res_descs - get allocated resource descriptors | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @num_entries: number of resource entries in buffer | * @num_entries: number of resource entries in buffer | ||||
* @buf: Indirect buffer to hold data parameters and response | * @buf: structure to hold response data buffer | ||||
* @buf_size: size of buffer for indirect commands | * @buf_size: size of buffer | ||||
* @res_type: resource type | * @res_type: resource type | ||||
* @res_shared: is resource shared | * @res_shared: is resource shared | ||||
* @desc_id: input - first desc ID to start; output - next desc ID | * @desc_id: input - first desc ID to start; output - next desc ID | ||||
Context not available. | |||||
*/ | */ | ||||
enum ice_status | enum ice_status | ||||
ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries, | ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries, | ||||
struct ice_aqc_get_allocd_res_desc_resp *buf, | struct ice_aqc_res_elem *buf, u16 buf_size, u16 res_type, | ||||
u16 buf_size, u16 res_type, bool res_shared, u16 *desc_id, | bool res_shared, u16 *desc_id, struct ice_sq_cd *cd) | ||||
struct ice_sq_cd *cd) | |||||
{ | { | ||||
struct ice_aqc_get_allocd_res_desc *cmd; | struct ice_aqc_get_allocd_res_desc *cmd; | ||||
struct ice_aq_desc desc; | struct ice_aq_desc desc; | ||||
Context not available. | |||||
* | * | ||||
* Function add MAC rule for logical port from HW struct | * Function add MAC rule for logical port from HW struct | ||||
*/ | */ | ||||
enum ice_status | enum ice_status ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list) | ||||
ice_add_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list) | |||||
{ | { | ||||
if (!m_list || !hw) | if (!m_list || !hw) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
Context not available. | |||||
*/ | */ | ||||
if (v_list_itr->vsi_count > 1 && | if (v_list_itr->vsi_count > 1 && | ||||
v_list_itr->vsi_list_info->ref_cnt > 1) { | v_list_itr->vsi_list_info->ref_cnt > 1) { | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "Invalid configuration: Optimization to reuse VSI list with more than one VSI is not being done yet\n"); | ||||
"Invalid configuration: Optimization to reuse VSI list with more than one VSI is not being done yet\n"); | |||||
status = ICE_ERR_CFG; | status = ICE_ERR_CFG; | ||||
goto exit; | goto exit; | ||||
} | } | ||||
Context not available. | |||||
* | * | ||||
* Function add VLAN rule for logical port from HW struct | * Function add VLAN rule for logical port from HW struct | ||||
*/ | */ | ||||
enum ice_status | enum ice_status ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) | ||||
ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) | |||||
{ | { | ||||
if (!v_list || !hw) | if (!v_list || !hw) | ||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
Context not available. | |||||
return ICE_SUCCESS; | return ICE_SUCCESS; | ||||
} | } | ||||
enum ice_status | |||||
/** | /** | ||||
* ice_add_eth_mac - Add a ethertype based filter rule | * ice_add_eth_mac - Add a ethertype based filter rule | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
Context not available. | |||||
* | * | ||||
* Function add ethertype rule for logical port from HW struct | * Function add ethertype rule for logical port from HW struct | ||||
*/ | */ | ||||
enum ice_status | |||||
ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list) | ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list) | ||||
{ | { | ||||
if (!em_list || !hw) | if (!em_list || !hw) | ||||
Context not available. | |||||
hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); | hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); | ||||
s_rule_size = set ? ICE_SW_RULE_RX_TX_ETH_HDR_SIZE : | s_rule_size = set ? ICE_SW_RULE_RX_TX_ETH_HDR_SIZE : | ||||
ICE_SW_RULE_RX_TX_NO_HDR_SIZE; | ICE_SW_RULE_RX_TX_NO_HDR_SIZE; | ||||
s_rule = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, s_rule_size); | s_rule = (struct ice_aqc_sw_rules_elem *)ice_malloc(hw, s_rule_size); | ||||
if (!s_rule) | if (!s_rule) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
Context not available. | |||||
* @m_list: list of MAC addresses and forwarding information | * @m_list: list of MAC addresses and forwarding information | ||||
* | * | ||||
*/ | */ | ||||
enum ice_status | enum ice_status ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list) | ||||
ice_remove_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list) | |||||
{ | { | ||||
struct ice_sw_recipe *recp_list; | struct ice_sw_recipe *recp_list; | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* ice_get_vsi_promisc - get promiscuous mode of given VSI | * _ice_get_vsi_promisc - get promiscuous mode of given VSI | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @vsi_handle: VSI handle to retrieve info from | * @vsi_handle: VSI handle to retrieve info from | ||||
* @promisc_mask: pointer to mask to be filled in | * @promisc_mask: pointer to mask to be filled in | ||||
* @vid: VLAN ID of promisc VLAN VSI | * @vid: VLAN ID of promisc VLAN VSI | ||||
* @sw: pointer to switch info struct for which function add rule | |||||
*/ | */ | ||||
enum ice_status | static enum ice_status | ||||
ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, | _ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, | ||||
u16 *vid) | u16 *vid, struct ice_switch_info *sw) | ||||
{ | { | ||||
struct ice_switch_info *sw = hw->switch_info; | |||||
struct ice_fltr_mgmt_list_entry *itr; | struct ice_fltr_mgmt_list_entry *itr; | ||||
struct LIST_HEAD_TYPE *rule_head; | struct LIST_HEAD_TYPE *rule_head; | ||||
struct ice_lock *rule_lock; /* Lock to protect filter rule list */ | struct ice_lock *rule_lock; /* Lock to protect filter rule list */ | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI | * ice_get_vsi_promisc - get promiscuous mode of given VSI | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @vsi_handle: VSI handle to retrieve info from | * @vsi_handle: VSI handle to retrieve info from | ||||
* @promisc_mask: pointer to mask to be filled in | * @promisc_mask: pointer to mask to be filled in | ||||
* @vid: VLAN ID of promisc VLAN VSI | * @vid: VLAN ID of promisc VLAN VSI | ||||
*/ | */ | ||||
enum ice_status | enum ice_status | ||||
ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, | ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, | ||||
u16 *vid) | u16 *vid) | ||||
{ | |||||
return _ice_get_vsi_promisc(hw, vsi_handle, promisc_mask, | |||||
vid, hw->switch_info); | |||||
} | |||||
/** | |||||
* ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI | |||||
* @hw: pointer to the hardware structure | |||||
* @vsi_handle: VSI handle to retrieve info from | |||||
* @promisc_mask: pointer to mask to be filled in | |||||
* @vid: VLAN ID of promisc VLAN VSI | |||||
* @sw: pointer to switch info struct for which function add rule | |||||
*/ | |||||
static enum ice_status | |||||
_ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, | |||||
u16 *vid, struct ice_switch_info *sw) | |||||
{ | { | ||||
struct ice_switch_info *sw = hw->switch_info; | |||||
struct ice_fltr_mgmt_list_entry *itr; | struct ice_fltr_mgmt_list_entry *itr; | ||||
struct LIST_HEAD_TYPE *rule_head; | struct LIST_HEAD_TYPE *rule_head; | ||||
struct ice_lock *rule_lock; /* Lock to protect filter rule list */ | struct ice_lock *rule_lock; /* Lock to protect filter rule list */ | ||||
Context not available. | |||||
return ICE_SUCCESS; | return ICE_SUCCESS; | ||||
} | } | ||||
/** | |||||
* ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI | |||||
* @hw: pointer to the hardware structure | |||||
* @vsi_handle: VSI handle to retrieve info from | |||||
* @promisc_mask: pointer to mask to be filled in | |||||
* @vid: VLAN ID of promisc VLAN VSI | |||||
*/ | |||||
enum ice_status | |||||
ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask, | |||||
u16 *vid) | |||||
{ | |||||
return _ice_get_vsi_vlan_promisc(hw, vsi_handle, promisc_mask, | |||||
vid, hw->switch_info); | |||||
} | |||||
/** | /** | ||||
* ice_remove_promisc - Remove promisc based filter rules | * ice_remove_promisc - Remove promisc based filter rules | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI | * _ice_clear_vsi_promisc - clear specified promiscuous mode(s) | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @vsi_handle: VSI handle to clear mode | * @vsi_handle: VSI handle to clear mode | ||||
* @promisc_mask: mask of promiscuous config bits to clear | * @promisc_mask: mask of promiscuous config bits to clear | ||||
* @vid: VLAN ID to clear VLAN promiscuous | * @vid: VLAN ID to clear VLAN promiscuous | ||||
* @sw: pointer to switch info struct for which function add rule | |||||
*/ | */ | ||||
enum ice_status | static enum ice_status | ||||
ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | _ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | ||||
u16 vid) | u16 vid, struct ice_switch_info *sw) | ||||
{ | { | ||||
struct ice_switch_info *sw = hw->switch_info; | |||||
struct ice_fltr_list_entry *fm_entry, *tmp; | struct ice_fltr_list_entry *fm_entry, *tmp; | ||||
struct LIST_HEAD_TYPE remove_list_head; | struct LIST_HEAD_TYPE remove_list_head; | ||||
struct ice_fltr_mgmt_list_entry *itr; | struct ice_fltr_mgmt_list_entry *itr; | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* ice_set_vsi_promisc - set given VSI to given promiscuous mode(s) | * ice_clear_vsi_promisc - clear specified promiscuous mode(s) for given VSI | ||||
* @hw: pointer to the hardware structure | |||||
* @vsi_handle: VSI handle to clear mode | |||||
* @promisc_mask: mask of promiscuous config bits to clear | |||||
* @vid: VLAN ID to clear VLAN promiscuous | |||||
*/ | |||||
enum ice_status | |||||
ice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, | |||||
u8 promisc_mask, u16 vid) | |||||
{ | |||||
return _ice_clear_vsi_promisc(hw, vsi_handle, promisc_mask, | |||||
vid, hw->switch_info); | |||||
} | |||||
/** | |||||
* _ice_set_vsi_promisc - set given VSI to given promiscuous mode(s) | |||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @vsi_handle: VSI handle to configure | * @vsi_handle: VSI handle to configure | ||||
* @promisc_mask: mask of promiscuous config bits | * @promisc_mask: mask of promiscuous config bits | ||||
* @vid: VLAN ID to set VLAN promiscuous | * @vid: VLAN ID to set VLAN promiscuous | ||||
* @lport: logical port number to configure promisc mode | |||||
* @sw: pointer to switch info struct for which function add rule | |||||
*/ | */ | ||||
enum ice_status | static enum ice_status | ||||
ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, u16 vid) | _ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | ||||
u16 vid, u8 lport, struct ice_switch_info *sw) | |||||
{ | { | ||||
enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR }; | enum { UCAST_FLTR = 1, MCAST_FLTR, BCAST_FLTR }; | ||||
struct ice_fltr_list_entry f_list_entry; | struct ice_fltr_list_entry f_list_entry; | ||||
Context not available. | |||||
new_fltr.src = hw_vsi_id; | new_fltr.src = hw_vsi_id; | ||||
} else { | } else { | ||||
new_fltr.flag |= ICE_FLTR_RX; | new_fltr.flag |= ICE_FLTR_RX; | ||||
new_fltr.src = hw->port_info->lport; | new_fltr.src = lport; | ||||
} | } | ||||
new_fltr.fltr_act = ICE_FWD_TO_VSI; | new_fltr.fltr_act = ICE_FWD_TO_VSI; | ||||
new_fltr.vsi_handle = vsi_handle; | new_fltr.vsi_handle = vsi_handle; | ||||
new_fltr.fwd_id.hw_vsi_id = hw_vsi_id; | new_fltr.fwd_id.hw_vsi_id = hw_vsi_id; | ||||
f_list_entry.fltr_info = new_fltr; | f_list_entry.fltr_info = new_fltr; | ||||
recp_list = &hw->switch_info->recp_list[recipe_id]; | recp_list = &sw->recp_list[recipe_id]; | ||||
status = ice_add_rule_internal(hw, recp_list, | status = ice_add_rule_internal(hw, recp_list, lport, | ||||
hw->port_info->lport, | |||||
&f_list_entry); | &f_list_entry); | ||||
if (status != ICE_SUCCESS) | if (status != ICE_SUCCESS) | ||||
goto set_promisc_exit; | goto set_promisc_exit; | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* ice_set_vlan_vsi_promisc | * ice_set_vsi_promisc - set given VSI to given promiscuous mode(s) | ||||
* @hw: pointer to the hardware structure | |||||
* @vsi_handle: VSI handle to configure | |||||
* @promisc_mask: mask of promiscuous config bits | |||||
* @vid: VLAN ID to set VLAN promiscuous | |||||
*/ | |||||
enum ice_status | |||||
ice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | |||||
u16 vid) | |||||
{ | |||||
return _ice_set_vsi_promisc(hw, vsi_handle, promisc_mask, vid, | |||||
hw->port_info->lport, | |||||
hw->switch_info); | |||||
} | |||||
/** | |||||
* _ice_set_vlan_vsi_promisc | |||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @vsi_handle: VSI handle to configure | * @vsi_handle: VSI handle to configure | ||||
* @promisc_mask: mask of promiscuous config bits | * @promisc_mask: mask of promiscuous config bits | ||||
* @rm_vlan_promisc: Clear VLANs VSI promisc mode | * @rm_vlan_promisc: Clear VLANs VSI promisc mode | ||||
* @lport: logical port number to configure promisc mode | |||||
* @sw: pointer to switch info struct for which function add rule | |||||
* | * | ||||
* Configure VSI with all associated VLANs to given promiscuous mode(s) | * Configure VSI with all associated VLANs to given promiscuous mode(s) | ||||
*/ | */ | ||||
enum ice_status | static enum ice_status | ||||
ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | _ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | ||||
bool rm_vlan_promisc) | bool rm_vlan_promisc, u8 lport, | ||||
struct ice_switch_info *sw) | |||||
{ | { | ||||
struct ice_switch_info *sw = hw->switch_info; | |||||
struct ice_fltr_list_entry *list_itr, *tmp; | struct ice_fltr_list_entry *list_itr, *tmp; | ||||
struct LIST_HEAD_TYPE vsi_list_head; | struct LIST_HEAD_TYPE vsi_list_head; | ||||
struct LIST_HEAD_TYPE *vlan_head; | struct LIST_HEAD_TYPE *vlan_head; | ||||
Context not available. | |||||
list_entry) { | list_entry) { | ||||
vlan_id = list_itr->fltr_info.l_data.vlan.vlan_id; | vlan_id = list_itr->fltr_info.l_data.vlan.vlan_id; | ||||
if (rm_vlan_promisc) | if (rm_vlan_promisc) | ||||
status = ice_clear_vsi_promisc(hw, vsi_handle, | status = _ice_clear_vsi_promisc(hw, vsi_handle, | ||||
promisc_mask, vlan_id); | promisc_mask, | ||||
vlan_id, sw); | |||||
else | else | ||||
status = ice_set_vsi_promisc(hw, vsi_handle, | status = _ice_set_vsi_promisc(hw, vsi_handle, | ||||
promisc_mask, vlan_id); | promisc_mask, vlan_id, | ||||
lport, sw); | |||||
if (status) | if (status) | ||||
break; | break; | ||||
} | } | ||||
Context not available. | |||||
return status; | return status; | ||||
} | } | ||||
/** | |||||
* ice_set_vlan_vsi_promisc | |||||
* @hw: pointer to the hardware structure | |||||
* @vsi_handle: VSI handle to configure | |||||
* @promisc_mask: mask of promiscuous config bits | |||||
* @rm_vlan_promisc: Clear VLANs VSI promisc mode | |||||
* | |||||
* Configure VSI with all associated VLANs to given promiscuous mode(s) | |||||
*/ | |||||
enum ice_status | |||||
ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, | |||||
bool rm_vlan_promisc) | |||||
{ | |||||
return _ice_set_vlan_vsi_promisc(hw, vsi_handle, promisc_mask, | |||||
rm_vlan_promisc, hw->port_info->lport, | |||||
hw->switch_info); | |||||
} | |||||
/** | /** | ||||
* ice_remove_vsi_lkup_fltr - Remove lookup type filters for a VSI | * ice_remove_vsi_lkup_fltr - Remove lookup type filters for a VSI | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
Context not available. | |||||
ice_remove_eth_mac(hw, &remove_list_head); | ice_remove_eth_mac(hw, &remove_list_head); | ||||
break; | break; | ||||
case ICE_SW_LKUP_DFLT: | case ICE_SW_LKUP_DFLT: | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "Remove filters for this lookup type hasn't been implemented yet\n"); | ||||
"Remove filters for this lookup type hasn't been implemented yet\n"); | |||||
break; | break; | ||||
case ICE_SW_LKUP_LAST: | case ICE_SW_LKUP_LAST: | ||||
ice_debug(hw, ICE_DBG_SW, "Unsupported lookup type\n"); | ice_debug(hw, ICE_DBG_SW, "Unsupported lookup type\n"); | ||||
Context not available. | |||||
u16 buf_len; | u16 buf_len; | ||||
/* Allocate resource */ | /* Allocate resource */ | ||||
buf_len = sizeof(*buf); | buf_len = ice_struct_size(buf, elem, 1); | ||||
buf = (struct ice_aqc_alloc_free_res_elem *) | buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len); | ||||
ice_malloc(hw, buf_len); | |||||
if (!buf) | if (!buf) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
Context not available. | |||||
u16 buf_len; | u16 buf_len; | ||||
/* Free resource */ | /* Free resource */ | ||||
buf_len = sizeof(*buf); | buf_len = ice_struct_size(buf, elem, 1); | ||||
buf = (struct ice_aqc_alloc_free_res_elem *) | buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len); | ||||
ice_malloc(hw, buf_len); | |||||
if (!buf) | if (!buf) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
Context not available. | |||||
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, | status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, | ||||
ice_aqc_opc_free_res, NULL); | ice_aqc_opc_free_res, NULL); | ||||
if (status) | if (status) | ||||
ice_debug(hw, ICE_DBG_SW, | ice_debug(hw, ICE_DBG_SW, "counter resource could not be freed\n"); | ||||
"counter resource could not be freed\n"); | |||||
ice_free(hw, buf); | ice_free(hw, buf); | ||||
return status; | return status; | ||||
Context not available. | |||||
return ICE_ERR_PARAM; | return ICE_ERR_PARAM; | ||||
/* Allocate resource for large action */ | /* Allocate resource for large action */ | ||||
buf_len = sizeof(*sw_buf); | buf_len = ice_struct_size(sw_buf, elem, 1); | ||||
sw_buf = (struct ice_aqc_alloc_free_res_elem *) | sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc(hw, buf_len); | ||||
ice_malloc(hw, buf_len); | |||||
if (!sw_buf) | if (!sw_buf) | ||||
return ICE_ERR_NO_MEMORY; | return ICE_ERR_NO_MEMORY; | ||||
Context not available. | |||||
LIST_FOR_EACH_ENTRY(itr, &l_head, ice_fltr_mgmt_list_entry, | LIST_FOR_EACH_ENTRY(itr, &l_head, ice_fltr_mgmt_list_entry, | ||||
list_entry) { | list_entry) { | ||||
struct ice_fltr_list_entry f_entry; | struct ice_fltr_list_entry f_entry; | ||||
u16 vsi_handle; | |||||
f_entry.fltr_info = itr->fltr_info; | f_entry.fltr_info = itr->fltr_info; | ||||
if (itr->vsi_count < 2 && recp_id != ICE_SW_LKUP_VLAN) { | if (itr->vsi_count < 2 && recp_id != ICE_SW_LKUP_VLAN) { | ||||
Context not available. | |||||
} | } | ||||
/* Add a filter per VSI separately */ | /* Add a filter per VSI separately */ | ||||
while (1) { | ice_for_each_set_bit(vsi_handle, itr->vsi_list_info->vsi_map, | ||||
u16 vsi_handle; | ICE_MAX_VSI) { | ||||
vsi_handle = | |||||
ice_find_first_bit(itr->vsi_list_info->vsi_map, | |||||
ICE_MAX_VSI); | |||||
if (!ice_is_vsi_valid(hw, vsi_handle)) | if (!ice_is_vsi_valid(hw, vsi_handle)) | ||||
break; | break; | ||||
Context not available. | |||||
/** | /** | ||||
* ice_replay_vsi_fltr - Replay filters for requested VSI | * ice_replay_vsi_fltr - Replay filters for requested VSI | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @pi: pointer to port information structure | |||||
* @sw: pointer to switch info struct for which function replays filters | |||||
* @vsi_handle: driver VSI handle | * @vsi_handle: driver VSI handle | ||||
* @recp_id: Recipe ID for which rules need to be replayed | * @recp_id: Recipe ID for which rules need to be replayed | ||||
* @list_head: list for which filters need to be replayed | * @list_head: list for which filters need to be replayed | ||||
Context not available. | |||||
* It is required to pass valid VSI handle. | * It is required to pass valid VSI handle. | ||||
*/ | */ | ||||
static enum ice_status | static enum ice_status | ||||
ice_replay_vsi_fltr(struct ice_hw *hw, u16 vsi_handle, u8 recp_id, | ice_replay_vsi_fltr(struct ice_hw *hw, struct ice_port_info *pi, | ||||
struct ice_switch_info *sw, u16 vsi_handle, u8 recp_id, | |||||
struct LIST_HEAD_TYPE *list_head) | struct LIST_HEAD_TYPE *list_head) | ||||
{ | { | ||||
struct ice_fltr_mgmt_list_entry *itr; | struct ice_fltr_mgmt_list_entry *itr; | ||||
Context not available. | |||||
if (LIST_EMPTY(list_head)) | if (LIST_EMPTY(list_head)) | ||||
return status; | return status; | ||||
recp_list = &hw->switch_info->recp_list[recp_id]; | recp_list = &sw->recp_list[recp_id]; | ||||
hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); | hw_vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); | ||||
LIST_FOR_EACH_ENTRY(itr, list_head, ice_fltr_mgmt_list_entry, | LIST_FOR_EACH_ENTRY(itr, list_head, ice_fltr_mgmt_list_entry, | ||||
Context not available. | |||||
if (f_entry.fltr_info.src_id == ICE_SRC_ID_VSI) | if (f_entry.fltr_info.src_id == ICE_SRC_ID_VSI) | ||||
f_entry.fltr_info.src = hw_vsi_id; | f_entry.fltr_info.src = hw_vsi_id; | ||||
status = ice_add_rule_internal(hw, recp_list, | status = ice_add_rule_internal(hw, recp_list, | ||||
hw->port_info->lport, | pi->lport, | ||||
&f_entry); | &f_entry); | ||||
if (status != ICE_SUCCESS) | if (status != ICE_SUCCESS) | ||||
goto end; | goto end; | ||||
Context not available. | |||||
status = ice_add_vlan_internal(hw, recp_list, &f_entry); | status = ice_add_vlan_internal(hw, recp_list, &f_entry); | ||||
else | else | ||||
status = ice_add_rule_internal(hw, recp_list, | status = ice_add_rule_internal(hw, recp_list, | ||||
hw->port_info->lport, | pi->lport, | ||||
&f_entry); | &f_entry); | ||||
if (status != ICE_SUCCESS) | if (status != ICE_SUCCESS) | ||||
goto end; | goto end; | ||||
Context not available. | |||||
/** | /** | ||||
* ice_replay_vsi_all_fltr - replay all filters stored in bookkeeping lists | * ice_replay_vsi_all_fltr - replay all filters stored in bookkeeping lists | ||||
* @hw: pointer to the hardware structure | * @hw: pointer to the hardware structure | ||||
* @pi: pointer to port information structure | |||||
* @vsi_handle: driver VSI handle | * @vsi_handle: driver VSI handle | ||||
* | * | ||||
* Replays filters for requested VSI via vsi_handle. | * Replays filters for requested VSI via vsi_handle. | ||||
*/ | */ | ||||
enum ice_status ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle) | enum ice_status | ||||
ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi, | |||||
u16 vsi_handle) | |||||
{ | { | ||||
struct ice_switch_info *sw = hw->switch_info; | struct ice_switch_info *sw = hw->switch_info; | ||||
enum ice_status status = ICE_SUCCESS; | enum ice_status status = ICE_SUCCESS; | ||||
Context not available. | |||||
head = &sw->recp_list[i].filt_replay_rules; | head = &sw->recp_list[i].filt_replay_rules; | ||||
if (!sw->recp_list[i].adv_rule) | if (!sw->recp_list[i].adv_rule) | ||||
status = ice_replay_vsi_fltr(hw, vsi_handle, i, head); | status = ice_replay_vsi_fltr(hw, pi, sw, vsi_handle, i, | ||||
head); | |||||
if (status != ICE_SUCCESS) | if (status != ICE_SUCCESS) | ||||
return status; | return status; | ||||
} | } | ||||
Context not available. | |||||
} | } | ||||
/** | /** | ||||
* ice_rm_all_sw_replay_rule_info - deletes filter replay rules | * ice_rm_all_sw_replay_rule - helper function to delete filter replay rules | ||||
* @hw: pointer to the HW struct | * @hw: pointer to the HW struct | ||||
* @sw: pointer to switch info struct for which function removes filters | |||||
* | * | ||||
* Deletes the filter replay rules. | * Deletes the filter replay rules for given switch | ||||
*/ | */ | ||||
void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw) | void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw) | ||||
{ | { | ||||
struct ice_switch_info *sw = hw->switch_info; | |||||
u8 i; | u8 i; | ||||
if (!sw) | if (!sw) | ||||
Context not available. | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | |||||
* ice_rm_all_sw_replay_rule_info - deletes filter replay rules | |||||
* @hw: pointer to the HW struct | |||||
* | |||||
* Deletes the filter replay rules. | |||||
*/ | |||||
void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw) | |||||
{ | |||||
ice_rm_sw_replay_rule_info(hw, hw->switch_info); | |||||
} | |||||
Context not available. |