diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-11 00:20:51 +0200 |
---|---|---|
committer | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-29 23:36:49 +0200 |
commit | f7148d3d3a0a9dedf24cb4d7a5a72b63c17e6add (patch) | |
tree | 4fd8ba153545f8810f78b2fcb42ec0ce9e0b1014 /VNFs/DPPD-PROX/prox_port_cfg.c | |
parent | 1614130d60abfaa89a41ba8eed5f9bbf41d9a4f4 (diff) |
Added initial VLAN support with vdev devices
For kernel supported devices, add for vlan tag support
This can be configured through port parameter:
vlan tag=<vlan tag>
If this parameter is set, a vlan tagged interface is created
on top of the tap device
This is only supported for vdev tap devices
When sending (untagged) packet to the tap device (through socket)
the tap should react in sending tagged packet
Note that receiving in L3 mode (w/o tap support) a tagged packet
is not yet supported.
Change-Id: I363fa2f8d2341ac41ef23620222ece1d944bf336
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/prox_port_cfg.c')
-rw-r--r-- | VNFs/DPPD-PROX/prox_port_cfg.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/VNFs/DPPD-PROX/prox_port_cfg.c b/VNFs/DPPD-PROX/prox_port_cfg.c index 9798c590..2abf4d58 100644 --- a/VNFs/DPPD-PROX/prox_port_cfg.c +++ b/VNFs/DPPD-PROX/prox_port_cfg.c @@ -213,7 +213,17 @@ void init_rte_dev(int use_dummy_devices) prox_port_cfg[vdev_port_id].active = 1; prox_port_cfg[vdev_port_id].dpdk_mapping = port_id; prox_port_cfg[vdev_port_id].n_txq = 1; - strncpy(prox_port_cfg[vdev_port_id].name, port_cfg->vdev, MAX_NAME_SIZE); + + if (prox_port_cfg[port_id].vlan_tag) { + char command[1024]; + snprintf(prox_port_cfg[vdev_port_id].name, MAX_NAME_SIZE, "%s_%d", port_cfg->vdev, prox_port_cfg[port_id].vlan_tag); + sprintf(command, "ip link add link %s name %s type vlan id %d", port_cfg->vdev, prox_port_cfg[vdev_port_id].name, prox_port_cfg[port_id].vlan_tag); + system(command); + plog_info("Running %s\n", command); + plog_info("Using vlan tag %d - added device %s\n", prox_port_cfg[port_id].vlan_tag, prox_port_cfg[vdev_port_id].name); + } else + strncpy(prox_port_cfg[vdev_port_id].name, port_cfg->vdev, MAX_NAME_SIZE); + prox_port_cfg[port_id].dpdk_mapping = vdev_port_id; prox_port_cfg[vdev_port_id].ip = rte_be_to_cpu_32(prox_port_cfg[port_id].ip); prox_port_cfg[port_id].ip = 0; // So only vdev has an IP associated |