From f7148d3d3a0a9dedf24cb4d7a5a72b63c17e6add Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Mon, 11 May 2020 00:20:51 +0200 Subject: 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= 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 --- VNFs/DPPD-PROX/prox_port_cfg.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'VNFs/DPPD-PROX/prox_port_cfg.c') 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 -- cgit 1.2.3-korg