Skip to content

Commit

Permalink
DPDK: support for priority in VLAN header.
Browse files Browse the repository at this point in the history
If QoS policy is set and vRouter operates in VLAN,
set priority bits in the TCI field of a VLAN header
for packets egressing fabric interface.

Closes-bug #1604353
Change-Id: I400e835948d1a048496ab4be52ab2f251e96d49b
  • Loading branch information
semihalf-zmuda-wojciech committed Jul 20, 2016
1 parent 1846cfe commit 630a2d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion dpdk/dpdk_vrouter.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions dpdk/vr_dpdk_host.c
Expand Up @@ -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;
}
Expand Down
7 changes: 4 additions & 3 deletions dpdk/vr_dpdk_interface.c
Expand Up @@ -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)) {
Expand Down

0 comments on commit 630a2d6

Please sign in to comment.