Skip to content

Commit

Permalink
- Set the VLAN filter for VFs if vrouter is provisioned on a VLAN.
Browse files Browse the repository at this point in the history
Change-Id: I33e5f26b50c0532c3a802acba8025f3a268be4fb
Closes-bug: 1573255
  • Loading branch information
srajag committed May 19, 2016
1 parent 4e0ca7b commit fbf7525
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -163,9 +163,9 @@ dpdk_find_pci_addr_by_port(struct rte_pci_addr *addr, uint8_t port_id)
}

static inline void
dpdk_set_hw_vlan_strip(uint32_t port_id, struct vr_interface *vif)
dpdk_set_hw_vlan_filter_strip(uint32_t port_id, struct vr_interface *vif)
{
uint32_t i;
uint32_t i, ret;
uint8_t *port_id_ptr;
int port_num = 0;
struct vr_dpdk_ethdev *ethdev = &vr_dpdk.ethdevs[port_id];
Expand All @@ -174,6 +174,26 @@ dpdk_set_hw_vlan_strip(uint32_t port_id, struct vr_interface *vif)
&ethdev->ethdev_port_id:ethdev->ethdev_slaves;

do {
if (vr_dpdk.vlan_tag != VLAN_ID_INVALID) {
ret = rte_eth_dev_set_vlan_offload(*port_id_ptr, ETH_VLAN_FILTER_OFFLOAD);
if (ret) {
RTE_LOG(INFO, VROUTER, "Error %d enabling vlan offload on port %d\n",
ret, *port_id_ptr);
} else {
RTE_LOG(INFO, VROUTER, "Enabled vlan offload on port %d\n",
*port_id_ptr);
}

ret = rte_eth_dev_vlan_filter(*port_id_ptr, vr_dpdk.vlan_tag, 1);
if (ret) {
RTE_LOG(INFO, VROUTER, "Error %d enabling vlan %d on port %d\n",
ret, vr_dpdk.vlan_tag, *port_id_ptr);
} else {
RTE_LOG(INFO, VROUTER, "Enabled vlan %d on port %d\n",
vr_dpdk.vlan_tag, *port_id_ptr);
}
}

for (i=0; i< rte_eth_devices[*port_id_ptr].data->nb_rx_queues; i++)
{
if (vif->vif_flags & VIF_FLAG_VLAN_OFFLOAD) {
Expand Down Expand Up @@ -441,7 +461,7 @@ dpdk_fabric_if_add(struct vr_interface *vif)
#endif

/* Set hardware VLAN stripping */
dpdk_set_hw_vlan_strip(port_id, vif);
dpdk_set_hw_vlan_filter_strip(port_id, vif);

/* schedule RX/TX queues */
return vr_dpdk_lcore_if_schedule(vif, vr_dpdk_lcore_least_used_get(),
Expand Down

0 comments on commit fbf7525

Please sign in to comment.