Skip to content

Commit

Permalink
net/iavf: fix VLAN offload strip flag
Browse files Browse the repository at this point in the history
[ upstream commit e25c7ed114b296ddaa583427824acc30bcf9c85d ]

For i40e kernel driver which only supports vlan(v1) VIRTCHNL OP,
it will set strip on when setting filter on but dpdk side will not
change strip flag. To be consistent with dpdk side, disable strip
again.

Fixes: cb25d43 ("net/avf: enable MAC VLAN and promisc ops")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
Qiao-Intel authored and bluca committed Oct 18, 2023
1 parent 297e744 commit 19077f1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/net/iavf/iavf_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
int err;

if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
Expand All @@ -1021,6 +1022,23 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
err = iavf_add_del_vlan(adapter, vlan_id, on);
if (err)
return -EIO;

/* For i40e kernel driver which only supports vlan(v1) VIRTCHNL OP,
* it will set strip on when setting filter on but dpdk side will not
* change strip flag. To be consistent with dpdk side, disable strip
* again.
*
* For i40e kernel driver which supports vlan v2, dpdk will invoke vlan v2
* related function, so it won't go through here.
*/
if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
adapter->hw.mac.type == IAVF_MAC_X722_VF) {
if (on && !(dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)) {
err = iavf_disable_vlan_strip(adapter);
if (err)
return -EIO;
}
}
return 0;
}

Expand Down

0 comments on commit 19077f1

Please sign in to comment.