src/dpdk/drivers/net/i40e/i40e_ethdev.c
int
i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on)
{
	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
	struct i40e_vsi_context ctxt;
	uint8_t vlan_flags;
	int ret = I40E_SUCCESS;

	/* Check if it has been already on or off */
	if (vsi->info.valid_sections &
		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID)) {
		if (on) {
			if ((vsi->info.port_vlan_flags &
				I40E_AQ_VSI_PVLAN_EMOD_MASK) == 0)
				return 0; /* already on */
		} else {
			if ((vsi->info.port_vlan_flags &
				I40E_AQ_VSI_PVLAN_EMOD_MASK) ==
				I40E_AQ_VSI_PVLAN_EMOD_MASK)
				return 0; /* already off */
		}
	}

	if (on)
		vlan_flags = I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH;
	else
		vlan_flags = I40E_AQ_VSI_PVLAN_EMOD_NOTHING;
	vsi->info.valid_sections =
		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID);
	vsi->info.port_vlan_flags &= ~(I40E_AQ_VSI_PVLAN_EMOD_MASK);
	vsi->info.port_vlan_flags |= vlan_flags;
	ctxt.seid = vsi->seid;
	rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
	if (ret)
		PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan stripping",
			    on ? "enable" : "disable");

	return ret;
}
/* Configure vlan stripping on or off */
Configure vlan stripping on or off
Configure vlan stripping on or off
int
i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on)
{
	struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
	struct i40e_vsi_context ctxt;
	uint8_t vlan_flags;
	int ret = I40E_SUCCESS;
	if (vsi->info.valid_sections &
		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID)) {
		if (on) {
			if ((vsi->info.port_vlan_flags &
				I40E_AQ_VSI_PVLAN_EMOD_MASK) == 0)
				return 0; 
		} else {
			if ((vsi->info.port_vlan_flags &
				I40E_AQ_VSI_PVLAN_EMOD_MASK) ==
				I40E_AQ_VSI_PVLAN_EMOD_MASK)
				return 0; 
		}
	}
	if (on)
		vlan_flags = I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH;
	else
		vlan_flags = I40E_AQ_VSI_PVLAN_EMOD_NOTHING;
	vsi->info.valid_sections =
		rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID);
	vsi->info.port_vlan_flags &= ~(I40E_AQ_VSI_PVLAN_EMOD_MASK);
	vsi->info.port_vlan_flags |= vlan_flags;
	ctxt.seid = vsi->seid;
	rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
	ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL);
	if (ret)
		PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan stripping",
			    on ? "enable" : "disable");
	return ret;
}
int i40e_vsi_config_vlan_stripping ( struct i40e_vsi * vsi , bool on ) { struct i40e_hw * hw = I40E_VSI_TO_HW ( vsi ) ; struct i40e_vsi_context ctxt ; uint8_t vlan_flags ; int ret = I40E_SUCCESS ; if ( vsi -> info . valid_sections & rte_cpu_to_le_16 ( I40E_AQ_VSI_PROP_VLAN_VALID ) ) { if ( on ) { if ( ( vsi -> info . port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK ) == 0 ) return 0 ; } else { if ( ( vsi -> info . port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK ) == I40E_AQ_VSI_PVLAN_EMOD_MASK ) return 0 ; } } if ( on ) vlan_flags = I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH ; else vlan_flags = I40E_AQ_VSI_PVLAN_EMOD_NOTHING ; vsi -> info . valid_sections = rte_cpu_to_le_16 ( I40E_AQ_VSI_PROP_VLAN_VALID ) ; vsi -> info . port_vlan_flags &= ~ ( I40E_AQ_VSI_PVLAN_EMOD_MASK ) ; vsi -> info . port_vlan_flags |= vlan_flags ; ctxt . seid = vsi -> seid ; rte_memcpy ( & ctxt . info , & vsi -> info , sizeof ( vsi -> info ) ) ; ret = i40e_aq_update_vsi_params ( hw , & ctxt , NULL ) ; if ( ret ) PMD_DRV_LOG ( INFO , " " , on ? " " : " " ) ; return ret ; }
Configure vlan stripping on or off
Configure vlan stripping on or off
/* Check if it has been already on or off */ /* already on */ /* already off */