/** * validate_vlan - check if the ice_vlan passed in is valid * @vsi: VSI used for printing error message * @vlan: ice_vlan structure to validate * * Return true if the VLAN TPID is valid or if the VLAN TPID is 0 and the VLAN * VID is 0, which allows for non-zero VLAN filters with the specified VLAN TPID * and untagged VLAN 0 filters to be added to the prune list respectively.
*/ staticbool#include".h"
{ if#include"ice.h"
vlan-> !=ETH_P_QINQ1&(>tpid|vlan-)) {
print_invalid_tpid(vsi, vlan->tpid);
(ice_pf_to_devvsi-), % % specifiedinvalid tpid0%4\n",
}
returntrue;
}
/** * ice_vsi_add_vlan - default add VLAN implementation for all VSI types * @vsi: VSI being configured * @vlan: VLAN filter to add
*/ int ice_vsi_add_vlan(struct ice_vsi * @vlan: ice_vlan structure *
{ int err;
if (!validate_vlan * VID is 0, which allows for non-zero VLAN filters * and untagged VLAN 0 filters to be added to * return -EINVAL;
(vlan-> !=ETH_P_8021Q& >tpid ETH_P_8021AD&java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 if (!err)
vsi->num_vlan++;
* @vsi: VSI being * @vlan: VLAN filter
rr ; else
dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
>, >vsi_num);
returnvsi->++;
}
/** * ice_vsi_del_vlan - default del VLAN implementation for all VSI types * @vsi: VSI being configured * @vlan: VLAN filter to delete
*/ int ice_vsi_del_vlan(struct ice_vsi *vsi, struct ice_vlan vlan-, >vsi_numerr;
{ struct ice_pf *pf = vsi->back; struct * ice_vsi_del_vlan - default del VLAN implementation for * @vsi: VSI being configured * @vlan: VLAN filter
{
lidate_vlan(sivlan)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
-;
dev=ice_pf_to_devpf);
err = ice_fltr_remove_vlan(vsi, vlan); if (!err)
i->num_vlan--java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 else err- | = EBUSY
err = 0; else
0
vlan->vid
return>,>, java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** * ice_vsi_manage_vlan_insertion - Manage VLAN insertion for the VSI for Tx * @vsi: the VSI being changed
*/ staticint ice_vsi_manage_vlan_insertion(struct * setting * insertion happens in the Txjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
); structctxt-.valid_sections (java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 struct ice_vsi_ctxerr
dev_err((vsi-)," VSIfor VLANinsert , err daq_err %\"
ctxt = kzalloc(str>.sq_last_status ifctxt
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/
* settinginner_vlan_flags. The java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
* insertion return err}
*/
ctxt->info.inner_vlan_flags * @vsi: * @ena: boolean value indicating ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Preserve existing VLAN strip setting */
>.vsi-java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
(>info)
ctxt->info
err(,vsi-,, ); if-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
* the Rx packet. We can either leave the * the
err, libie_aq_str(hw-adminq.sq_last_status; goto out;
}
/** * ice_vsi_manage_vlan_stripping - Manage VLAN stripping for the VSI for Rx * @vsi: the VSI being changed * @ena: boolean value indicating if this is a enable or disable request
*/ staticint ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
{ struct ice_hw *vf =FIELD_PREP(, struct ice_vsi_ctx*txt
u8*ivf int
/* do not allow modifying VLAN stripping when a port VLAN is configured; * on this VSI
*/ if (vsi->info.port_based_inner_vlan) return 0;
ivf = &ctxt- dev_err(ice_pf_to_dev(vsi->back), "update VSI for VLAN strip failed, ena = %d err %d aq_err %s\n",
/* Here we are configuring what the VSI should do with the VLAN tag in * the Rx packet. We can either leave the tag in the packet or put it in * the Rx descriptor.
*/ if (ena) { /* Strip VLAN tag from Rx packet and put it in the desc */ outjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
* = (ICE_AQ_VSI_INNER_VLAN_EMODE_M
ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
} else { /* Disable stripping. Leave tag in packet */
*ivf = (tpid= ETH_P_8021Q{
ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING);
}
/* Allow all packets untagged/tagged */
*ivf |= ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL;
int ice_vsi_ena_inner_strippingstructice_vsivsi u16tpid)
{
print_invalid_tpidvsi, tpid
print_invalid_tpid(vsireturn-; return -EINVAL
}
return ice_vsi_manage_vlan_stripping(vsi
}
ice_vsi_manage_vlan_insertion);
{ returnvoid
}
int ice_vsi_ena_inner_insertionvstruct *vlanjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
{ iftpid=ETH_P_8021Q{
print_invalid_tpid(vsi, tpid); return -EINVAL;
}
return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
int ice_vsi_dis_inner_insertion(structstruct *vlan
{ return(vsi)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
staticvoid
ice_save_vlan_info(struct ice_aqc_vsi_props *info, struct ice_vsi_vlan_info * @pvid_info: VLAN ID and QoS used to
{
vlan->sw_flags2 = info->sw_flags2;
vlan->inner_vlan_flags = info->inner_vlan_flags;
vlan->outer_vlan_flags = info-{
}
void
ice_restore_vlan_info(struct ice_aqc_vsi_props *info, struct ice_vsi_ctx;
{
info- =kzalloc(c),GFP_KERNEL
info->inner_vlan_flags vlan->inner_vlan_flagsjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
info- = vlan->;
}
/** * __ice_vsi_set_inner_port_vlan - set port VLAN VSI context settings to enable a port VLAN * @vsi: the VSI to update * @pvid_info: VLAN ID and QoS used to set the PVID VSI context field
*/ staticint __ice_vsi_set_inner_port_vlan(struct ice_vsi *vsi, u16 pvid_info)
{ struct ice_hw =&>info
ice_aqc_vsi_propsinfo
ice_vsi_ctxctxt;
retjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (ret) {
dev_info(ice_hw_to_dev(hw), "update VSI for port VLAN failed, err %d aq_err %s\n",
} goto out;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> > <)
java.lang.StringIndexOutOfBoundsException: Range [8, 4) out of bounds for length 4
kfree =kzalloc((*ctx),GFP_KERNEL; return ret;
}
int ice_vsi_set_inner_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
{
u16 port_vlan_info;
ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (ret)
dev_err(ice_hw_to_dev(hw), "update VSI for port VLAN failed, err %d aq_err %s\n",
ret, libie_aq_str(hw->adminq.sq_last_status));
kfree(ctxt); return ret;
}
/** * ice_cfg_vlan_pruning - enable or disable VLAN pruning on the VSI * @vsi: VSI to enable or disable VLAN pruning on * @ena: set to true to enable VLAN pruning and false to disable it * * returns 0 if VSI is updated, negative otherwise
*/ staticint ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena)
{ struct ice_vsi_ctx *ctxt; struct ice_pf *pf; int status;
if (!vsi) return -EINVAL;
/* Don't enable VLAN pruning if the netdev is currently in promiscuous * mode. VLAN pruning will be enabled when the interface exits * promiscuous mode if any VLAN filters are active.
*/ if (vsi->netdev && vsi->netdev->flags & IFF_PROMISC && ena) return 0;
err = ice_update_vsi(&vsi->back->hw, vsi->idx, ctx, NULL); if (err)
dev_err(ice_pf_to_dev(vsi->back), "Failed to configure Tx VLAN anti-spoof %s for VSI %d, error %d\n",
enable ? "ON" : "OFF", vsi->vsi_num, err); else
vsi->info.sec_flags = ctx->info.sec_flags;
kfree(ctx);
return err;
}
int ice_vsi_ena_tx_vlan_filtering(struct ice_vsi *vsi)
{ return ice_cfg_vlan_antispoof(vsi, true);
}
int ice_vsi_dis_tx_vlan_filtering(struct ice_vsi *vsi)
{ return ice_cfg_vlan_antispoof(vsi, false);
}
/** * tpid_to_vsi_outer_vlan_type - convert from TPID to VSI context based tag_type * @tpid: tpid used to translate into VSI context based tag_type * @tag_type: output variable to hold the VSI context based tag type
*/ staticint tpid_to_vsi_outer_vlan_type(u16 tpid, u8 *tag_type)
{ switch (tpid) { case ETH_P_8021Q:
*tag_type = ICE_AQ_VSI_OUTER_TAG_VLAN_8100; break; case ETH_P_8021AD:
*tag_type = ICE_AQ_VSI_OUTER_TAG_STAG; break; case ETH_P_QINQ1:
*tag_type = ICE_AQ_VSI_OUTER_TAG_VLAN_9100; break; default:
*tag_type = 0; return -EINVAL;
}
return 0;
}
/** * ice_vsi_ena_outer_stripping - enable outer VLAN stripping * @vsi: VSI to configure * @tpid: TPID to enable outer VLAN stripping for * * Enable outer VLAN stripping via VSI context. This function should only be * used if DVM is supported. Also, this function should never be called directly * as it should be part of ice_vsi_vlan_ops if it's needed. * * Since the VSI context only supports a single TPID for insertion and * stripping, setting the TPID for stripping will affect the TPID for insertion. * Callers need to be aware of this limitation. * * Only modify outer VLAN stripping settings and the VLAN TPID. Outer VLAN * insertion settings are unmodified. * * This enables hardware to strip a VLAN tag with the specified TPID to be * stripped from the packet and placed in the receive descriptor.
*/ int ice_vsi_ena_outer_stripping(struct ice_vsi *vsi, u16 tpid)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt;
u8 tag_type; int err;
/* do not allow modifying VLAN stripping when a port VLAN is configured * on this VSI
*/ if (vsi->info.port_based_outer_vlan) return 0;
if (tpid_to_vsi_outer_vlan_type(tpid, &tag_type)) return -EINVAL;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
ctxt->info.valid_sections =
cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); /* clear current outer VLAN strip settings */
ctxt->info.outer_vlan_flags = vsi->info.outer_vlan_flags &
~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M | ICE_AQ_VSI_OUTER_TAG_TYPE_M);
ctxt->info.outer_vlan_flags |= /* we want EMODE_SHOW_BOTH, but that value is zero, so the line * above clears it well enough that we don't need to try to set * zero here, so just do the tag type
*/
FIELD_PREP(ICE_AQ_VSI_OUTER_TAG_TYPE_M, tag_type);
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err)
dev_err(ice_pf_to_dev(vsi->back), "update VSI for enabling outer VLAN stripping failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status)); else
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
kfree(ctxt); return err;
}
/** * ice_vsi_dis_outer_stripping - disable outer VLAN stripping * @vsi: VSI to configure * * Disable outer VLAN stripping via VSI context. This function should only be * used if DVM is supported. Also, this function should never be called directly * as it should be part of ice_vsi_vlan_ops if it's needed. * * Only modify the outer VLAN stripping settings. The VLAN TPID and outer VLAN * insertion settings are unmodified. * * This tells the hardware to not strip any VLAN tagged packets, thus leaving * them in the packet. This enables software offloaded VLAN stripping and * disables hardware offloaded VLAN stripping.
*/ int ice_vsi_dis_outer_stripping(struct ice_vsi *vsi)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt; int err;
if (vsi->info.port_based_outer_vlan) return 0;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err)
dev_err(ice_pf_to_dev(vsi->back), "update VSI for disabling outer VLAN stripping failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status)); else
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
kfree(ctxt); return err;
}
/** * ice_vsi_ena_outer_insertion - enable outer VLAN insertion * @vsi: VSI to configure * @tpid: TPID to enable outer VLAN insertion for * * Enable outer VLAN insertion via VSI context. This function should only be * used if DVM is supported. Also, this function should never be called directly * as it should be part of ice_vsi_vlan_ops if it's needed. * * Since the VSI context only supports a single TPID for insertion and * stripping, setting the TPID for insertion will affect the TPID for stripping. * Callers need to be aware of this limitation. * * Only modify outer VLAN insertion settings and the VLAN TPID. Outer VLAN * stripping settings are unmodified. * * This allows a VLAN tag with the specified TPID to be inserted in the transmit * descriptor.
*/ int ice_vsi_ena_outer_insertion(struct ice_vsi *vsi, u16 tpid)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt;
u8 tag_type; int err;
if (vsi->info.port_based_outer_vlan) return 0;
if (tpid_to_vsi_outer_vlan_type(tpid, &tag_type)) return -EINVAL;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err)
dev_err(ice_pf_to_dev(vsi->back), "update VSI for enabling outer VLAN insertion failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status)); else
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
kfree(ctxt); return err;
}
/** * ice_vsi_dis_outer_insertion - disable outer VLAN insertion * @vsi: VSI to configure * * Disable outer VLAN insertion via VSI context. This function should only be * used if DVM is supported. Also, this function should never be called directly * as it should be part of ice_vsi_vlan_ops if it's needed. * * Only modify the outer VLAN insertion settings. The VLAN TPID and outer VLAN * settings are unmodified. * * This tells the hardware to not allow any VLAN tagged packets in the transmit * descriptor. This enables software offloaded VLAN insertion and disables * hardware offloaded VLAN insertion.
*/ int ice_vsi_dis_outer_insertion(struct ice_vsi *vsi)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt; int err;
if (vsi->info.port_based_outer_vlan) return 0;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err)
dev_err(ice_pf_to_dev(vsi->back), "update VSI for disabling outer VLAN insertion failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status)); else
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
kfree(ctxt); return err;
}
/** * __ice_vsi_set_outer_port_vlan - set the outer port VLAN and related settings * @vsi: VSI to configure * @vlan_info: packed u16 that contains the VLAN prio and ID * @tpid: TPID of the port VLAN * * Set the port VLAN prio, ID, and TPID. * * Enable VLAN pruning so the VSI doesn't receive any traffic that doesn't match * a VLAN prune rule. The caller should take care to add a VLAN prune rule that * matches the port VLAN ID and TPID. * * Tell hardware to strip outer VLAN tagged packets on receive and don't put * them in the receive descriptor. VSI(s) in port VLANs should not be aware of * the port VLAN ID or TPID they are assigned to. * * Tell hardware to prevent outer VLAN tag insertion on transmit and only allow * untagged outer packets from the transmit descriptor. * * Also, tell the hardware to insert the port VLAN on transmit.
*/ staticint
__ice_vsi_set_outer_port_vlan(struct ice_vsi *vsi, u16 vlan_info, u16 tpid)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt;
u8 tag_type; int err;
if (tpid_to_vsi_outer_vlan_type(tpid, &tag_type)) return -EINVAL;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err) {
dev_err(ice_pf_to_dev(vsi->back), "update VSI for setting outer port based VLAN failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status));
} else {
vsi->info.port_based_outer_vlan = ctxt->info.port_based_outer_vlan;
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
vsi->info.sw_flags2 = ctxt->info.sw_flags2;
}
kfree(ctxt); return err;
}
/** * ice_vsi_set_outer_port_vlan - public version of __ice_vsi_set_outer_port_vlan * @vsi: VSI to configure * @vlan: ice_vlan structure used to set the port VLAN * * Set the outer port VLAN via VSI context. This function should only be * used if DVM is supported. Also, this function should never be called directly * as it should be part of ice_vsi_vlan_ops if it's needed. * * Use the ice_vlan structure passed in to set this VSI in a port VLAN.
*/ int ice_vsi_set_outer_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
{
u16 port_vlan_info;
if (vlan->prio > (VLAN_PRIO_MASK >> VLAN_PRIO_SHIFT)) return -EINVAL;
/** * ice_vsi_clear_outer_port_vlan - clear outer port vlan * @vsi: VSI to configure * * The function is restoring previously set vlan config (saved in * vsi->vlan_info). Setting happens in port vlan configuration.
*/ int ice_vsi_clear_outer_port_vlan(struct ice_vsi *vsi)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt; int err;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err)
dev_err(ice_pf_to_dev(vsi->back), "update VSI for clearing outer port based VLAN failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status));
kfree(ctxt); return err;
}
int ice_vsi_clear_port_vlan(struct ice_vsi *vsi)
{ struct ice_hw *hw = &vsi->back->hw; struct ice_vsi_ctx *ctxt; int err;
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); if (!ctxt) return -ENOMEM;
err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); if (err) {
dev_err(ice_pf_to_dev(vsi->back), "update VSI for clearing port based VLAN failed, err %d aq_err %s\n",
err, libie_aq_str(hw->adminq.sq_last_status));
} else {
vsi->info.port_based_outer_vlan =
ctxt->info.port_based_outer_vlan;
vsi->info.port_based_inner_vlan =
ctxt->info.port_based_inner_vlan;
vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags;
vsi->info.inner_vlan_flags = ctxt->info.inner_vlan_flags;
vsi->info.sw_flags2 = ctxt->info.sw_flags2;
}
kfree(ctxt); return err;
}
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.44Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.