diff --git a/dpdk/dpdk_vrouter.c b/dpdk/dpdk_vrouter.c index 5caa4fb32..e9a385c72 100644 --- a/dpdk/dpdk_vrouter.c +++ b/dpdk/dpdk_vrouter.c @@ -866,6 +866,7 @@ Usage(void) " (ex: --"SOCKET_MEM_OPT" 256,256)\n" "\n" " --"VLAN_TCI_OPT" TCI VLAN tag control information to use\n" + " It may be a value between 0 and 4095\n" " --"VLAN_NAME_OPT" NAME VLAN forwarding interface name\n" "\n" " --"BRIDGE_ENTRIES_OPT" NUM Bridge table limit\n" @@ -923,10 +924,12 @@ parse_long_opts(int opt_flow_index, char *optarg) * vr_dpdk_lcore_vroute(), dpdk_vlan_forwarding_if_add(). */ case VLAN_TCI_OPT_INDEX: - vr_dpdk.vlan_tag = (uint16_t)strtol(optarg, NULL, 0); + vr_dpdk.vlan_tag = (uint16_t)strtoul(optarg, NULL, 0); if (errno != 0) { vr_dpdk.vlan_tag = VLAN_ID_INVALID; } + if (vr_dpdk.vlan_tag > 4095) + Usage(); break; case VTEST_VLAN_OPT_INDEX: diff --git a/dpdk/vr_dpdk_host.c b/dpdk/vr_dpdk_host.c index 95ae6e4b6..4b3fc373c 100644 --- a/dpdk/vr_dpdk_host.c +++ b/dpdk/vr_dpdk_host.c @@ -1337,6 +1337,8 @@ vr_dpdk_packet_get(struct rte_mbuf *m, struct vr_interface *vif) pkt->vp_ttl = 64; pkt->vp_type = VP_TYPE_NULL; + pkt->vp_queue = 0; + pkt->vp_priority = 0; return pkt; } diff --git a/dpdk/vr_dpdk_interface.c b/dpdk/vr_dpdk_interface.c index 1b9ff52f2..d1e040b08 100644 --- a/dpdk/vr_dpdk_interface.c +++ b/dpdk/vr_dpdk_interface.c @@ -1253,9 +1253,10 @@ dpdk_if_tx(struct vr_interface *vif, struct vr_packet *pkt) * non fabric interfaces too (Emulates physical interface for some vlan test cases). * */ - if ((unlikely(vr_dpdk.vlan_tag != VLAN_ID_INVALID && vif_is_fabric(vif)) - || vr_dpdk.vtest_vlan)) { - m->vlan_tci = vr_dpdk.vlan_tag; + if (unlikely(vr_dpdk.vlan_tag != VLAN_ID_INVALID && vif_is_fabric(vif)) || + vr_dpdk.vtest_vlan) { + /* set 3 PCP bits and 12 VLAN ID bits */ + m->vlan_tci = (pkt->vp_priority << 13 | vr_dpdk.vlan_tag); if (unlikely((vif->vif_flags & VIF_FLAG_VLAN_OFFLOAD) == 0)) { /* Software VLAN TCI insert. */ if (unlikely(pkt_push(pkt, sizeof(struct vlan_hdr)) == NULL)) {