struct rte_pci_device *pci_dev = I40E_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
uint32_t intr_vector = 0;
+ struct i40e_vsi *vsi;
hw->adapter_stopped = 0;
PMD_DRV_LOG(INFO, "fail to set vsi broadcast");
}
+ /* Enable the VLAN promiscuous mode. */
+ if (pf->vfs) {
+ for (i = 0; i < pf->vf_num; i++) {
+ vsi = pf->vfs[i].vsi;
+ i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid,
+ true, NULL);
+ }
+ }
+
/* Apply link configure */
if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
vsi->parent_vsi = uplink_vsi ? uplink_vsi : pf->main_vsi;
vsi->user_param = user_param;
vsi->vlan_anti_spoof_on = 0;
+ vsi->vlan_filter_on = 0;
/* Allocate queues */
switch (vsi->type) {
case I40E_VSI_MAIN :
i40e_store_vlan_filter(vsi, vlan_id, on);
- if (!vsi->vlan_anti_spoof_on || !vlan_id)
+ if ((!vsi->vlan_anti_spoof_on && !vsi->vlan_filter_on) || !vlan_id)
return;
vlan_data.vlan_tag = rte_cpu_to_le_16(vlan_id);
return 0; /* already on or off */
vsi->vlan_anti_spoof_on = on;
- ret = i40e_add_rm_all_vlan_filter(vsi, on);
- if (ret) {
- PMD_DRV_LOG(ERR, "Failed to remove VLAN filters.");
- return -ENOTSUP;
+ if (!vsi->vlan_filter_on) {
+ ret = i40e_add_rm_all_vlan_filter(vsi, on);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "Failed to add/remove VLAN filters.");
+ return -ENOTSUP;
+ }
}
vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_SECURITY_VALID);
PMD_INIT_LOG(ERR, "Failed to remove MAC filters.");
return ret;
}
- if (vsi->vlan_anti_spoof_on) {
+ if (vsi->vlan_anti_spoof_on || vsi->vlan_filter_on) {
ret = i40e_add_rm_all_vlan_filter(vsi, 0);
if (ret) {
PMD_INIT_LOG(ERR, "Failed to remove VLAN filters.");
ret = i40e_vsi_restore_mac_filter(vsi);
if (ret)
return ret;
- if (vsi->vlan_anti_spoof_on) {
+ if (vsi->vlan_anti_spoof_on || vsi->vlan_filter_on) {
ret = i40e_add_rm_all_vlan_filter(vsi, 1);
if (ret)
return ret;
struct rte_eth_dev *dev;
struct i40e_pf *pf;
struct i40e_hw *hw;
+ struct i40e_vsi *vsi;
uint16_t vf_idx;
int ret = I40E_SUCCESS;
return -ENODEV;
}
- for (vf_idx = 0; vf_idx < 64 && ret == I40E_SUCCESS; vf_idx++) {
+ for (vf_idx = 0; vf_idx < pf->vf_num && ret == I40E_SUCCESS; vf_idx++) {
if (vf_mask & ((uint64_t)(1ULL << vf_idx))) {
- if (on)
- ret = i40e_vsi_add_vlan(pf->vfs[vf_idx].vsi,
- vlan_id);
- else
- ret = i40e_vsi_delete_vlan(pf->vfs[vf_idx].vsi,
- vlan_id);
+ vsi = pf->vfs[vf_idx].vsi;
+ if (on) {
+ if (!vsi->vlan_filter_on) {
+ vsi->vlan_filter_on = true;
+ if (!vsi->vlan_anti_spoof_on)
+ i40e_add_rm_all_vlan_filter(
+ vsi, true);
+ }
+ i40e_aq_set_vsi_vlan_promisc(hw, vsi->seid,
+ false, NULL);
+ ret = i40e_vsi_add_vlan(vsi, vlan_id);
+ } else {
+ ret = i40e_vsi_delete_vlan(vsi, vlan_id);
+ }
}
}