net/ice/base: add functions to get VSI promiscuous mode
1. ice_get_vsi_promisc - get promiscuous mode of give VSI. 2. ice_get_vsi_vlan_promisc - get VLAN promiscuous mode of given VSI. PMD may use these APIs to check the real HW status, but not rely on a software flag when something abnormal. Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Reviewed-by: Qiming Yang <qiming.yang@intel.com> Reviewed-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
This commit is contained in:
parent
f1ffdec6cf
commit
8fc7f70837
@ -2894,6 +2894,85 @@ static u8 ice_determine_promisc_mask(struct ice_fltr_info *fi)
|
||||
return promisc_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_get_vsi_promisc - get 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_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
|
||||
u16 *vid)
|
||||
{
|
||||
struct ice_switch_info *sw = hw->switch_info;
|
||||
struct ice_fltr_mgmt_list_entry *itr;
|
||||
struct LIST_HEAD_TYPE *rule_head;
|
||||
struct ice_lock *rule_lock; /* Lock to protect filter rule list */
|
||||
|
||||
if (!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
*vid = 0;
|
||||
*promisc_mask = 0;
|
||||
rule_head = &sw->recp_list[ICE_SW_LKUP_PROMISC].filt_rules;
|
||||
rule_lock = &sw->recp_list[ICE_SW_LKUP_PROMISC].filt_rule_lock;
|
||||
|
||||
ice_acquire_lock(rule_lock);
|
||||
LIST_FOR_EACH_ENTRY(itr, rule_head,
|
||||
ice_fltr_mgmt_list_entry, list_entry) {
|
||||
/* Continue if this filter doesn't apply to this VSI or the
|
||||
* VSI ID is not in the VSI map for this filter
|
||||
*/
|
||||
if (!ice_vsi_uses_fltr(itr, vsi_handle))
|
||||
continue;
|
||||
|
||||
*promisc_mask |= ice_determine_promisc_mask(&itr->fltr_info);
|
||||
}
|
||||
ice_release_lock(rule_lock);
|
||||
|
||||
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)
|
||||
{
|
||||
struct ice_switch_info *sw = hw->switch_info;
|
||||
struct ice_fltr_mgmt_list_entry *itr;
|
||||
struct LIST_HEAD_TYPE *rule_head;
|
||||
struct ice_lock *rule_lock; /* Lock to protect filter rule list */
|
||||
|
||||
if (!ice_is_vsi_valid(hw, vsi_handle))
|
||||
return ICE_ERR_PARAM;
|
||||
|
||||
*vid = 0;
|
||||
*promisc_mask = 0;
|
||||
rule_head = &sw->recp_list[ICE_SW_LKUP_PROMISC_VLAN].filt_rules;
|
||||
rule_lock = &sw->recp_list[ICE_SW_LKUP_PROMISC_VLAN].filt_rule_lock;
|
||||
|
||||
ice_acquire_lock(rule_lock);
|
||||
LIST_FOR_EACH_ENTRY(itr, rule_head, ice_fltr_mgmt_list_entry,
|
||||
list_entry) {
|
||||
/* Continue if this filter doesn't apply to this VSI or the
|
||||
* VSI ID is not in the VSI map for this filter
|
||||
*/
|
||||
if (!ice_vsi_uses_fltr(itr, vsi_handle))
|
||||
continue;
|
||||
|
||||
*promisc_mask |= ice_determine_promisc_mask(&itr->fltr_info);
|
||||
}
|
||||
ice_release_lock(rule_lock);
|
||||
|
||||
return ICE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_remove_promisc - Remove promisc based filter rules
|
||||
|
@ -394,6 +394,13 @@ enum ice_status
|
||||
ice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
|
||||
bool rm_vlan_promisc);
|
||||
|
||||
/* Get VSIs Promisc/defport settings */
|
||||
enum ice_status
|
||||
ice_get_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
|
||||
u16 *vid);
|
||||
enum ice_status
|
||||
ice_get_vsi_vlan_promisc(struct ice_hw *hw, u16 vsi_handle, u8 *promisc_mask,
|
||||
u16 *vid);
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user