diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2020-04-20 23:25:22 +0200 |
---|---|---|
committer | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-29 23:28:44 +0200 |
commit | fa869940dd9bb459ac599fe80c26c9d3e720fd31 (patch) | |
tree | 67aefe7f36fad283ab690d5d0feae1a547a59487 | |
parent | 6f898f1c73d630bf6e5e75ba1b30d261c8301d2a (diff) |
Add support for vdev tap devices
This commit adds support for the creation of tap devices.
To create a tap device, and associate it with a DPDK port,
add within the port section:
vdev=<tap_name>
local ipv4=<ip_assigned_to_port>
<tap_name> will appear as a kernel network device, with an IP <ip_assigned_to_port>
ARP packets received from the network on the DPDK interface will be forwarded to the kernel.
1st packet which needs to be generated to a new IP will cause an IP packet
to be sent to the kernel (using socket sendto) forcing the kernel to send an ARP_REQUEST.
In this commit, there is no notification from the kernel about ARP table changes.
This is subject to further commits.
Two config files, gen_tap.cfg and swap_tap.cfg have been created. They work one against each other.
*** Note however that they do not work if running within the same host
(with the port being connected back to back) ***
This is due to the fact that the kernel would bypass the ports and use local interface...
Change-Id: Iadeec0d99e3c693472ea44bdb9163a3bf97df2fa
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
-rw-r--r-- | VNFs/DPPD-PROX/defaults.c | 3 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/defaults.h | 3 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/gen_tap.cfg | 64 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/handle_master.c | 76 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/handle_master.h | 8 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/packet_utils.c | 4 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/prox_args.c | 8 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/prox_port_cfg.c | 67 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/prox_port_cfg.h | 6 | ||||
-rw-r--r-- | VNFs/DPPD-PROX/swap_tap.cfg | 50 |
10 files changed, 277 insertions, 12 deletions
diff --git a/VNFs/DPPD-PROX/defaults.c b/VNFs/DPPD-PROX/defaults.c index b839453d..bb359cfb 100644 --- a/VNFs/DPPD-PROX/defaults.c +++ b/VNFs/DPPD-PROX/defaults.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -194,6 +194,7 @@ void set_port_defaults(void) prox_port_cfg[i].rx_ring[0] = '\0'; prox_port_cfg[i].tx_ring[0] = '\0'; prox_port_cfg[i].mtu = PROX_MTU; + prox_port_cfg[i].dpdk_mapping = NO_VDEV_PORT; // CRC_STRIP becoming the default behavior in DPDK 18.08, and // DEV_RX_OFFLOAD_CRC_STRIP define has been deleted diff --git a/VNFs/DPPD-PROX/defaults.h b/VNFs/DPPD-PROX/defaults.h index 8ce59530..18dae530 100644 --- a/VNFs/DPPD-PROX/defaults.h +++ b/VNFs/DPPD-PROX/defaults.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -62,5 +62,6 @@ void set_port_defaults(void); #define TX_MBUF_SIZE (PROX_RTE_ETHER_MAX_LEN + (unsigned)sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM + 2 * PROX_VLAN_TAG_SIZE) #define PROX_MTU PROX_RTE_ETHER_MAX_LEN - PROX_RTE_ETHER_HDR_LEN - PROX_RTE_ETHER_CRC_LEN +#define NO_VDEV_PORT 0xFF #endif /* _DEFAULTS_H_ */ diff --git a/VNFs/DPPD-PROX/gen_tap.cfg b/VNFs/DPPD-PROX/gen_tap.cfg new file mode 100644 index 00000000..fd74672e --- /dev/null +++ b/VNFs/DPPD-PROX/gen_tap.cfg @@ -0,0 +1,64 @@ +;; +;; Copyright (c) 2020 Intel Corporation +;; +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. +;; + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output + +[port 0] +name=p0 +vdev=gen_tap +local ipv4=$ip1 + +[defaults] +mempool size=16K + +[global] +start time=5 +name=Basic Gen + +[variables] +$hex_ip1=0a 0a 0a 01 +$hex_ip2=0a 0a 0a 02 +$ip1=10.10.10.1 +$ip2=10.10.10.2 + +[core 0s0] +mode=master + +[core 1s0] +name=p0 +task=0 +mode=gen +sub mode=l3 +tx port=p0 +bps=1250000000 +pkt inline=00 00 01 00 00 01 00 00 02 00 00 02 08 00 45 00 00 1c 00 01 00 00 40 11 f7 7d ${hex_ip1} ${hex_ip2} 13 88 13 88 00 08 55 7b +pkt size=60 +lat pos=42 +packet id pos=46 +min bulk size=8 + +[core 2s0] +name=nop +task=0 +mode=lat +sub mode=l3 +rx port=p0 +drop=no +lat pos=42 +packet id pos=46 +local ipv4=${ip1} diff --git a/VNFs/DPPD-PROX/handle_master.c b/VNFs/DPPD-PROX/handle_master.c index 9a864352..de0c0d51 100644 --- a/VNFs/DPPD-PROX/handle_master.c +++ b/VNFs/DPPD-PROX/handle_master.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ // limitations under the License. */ +#include <fcntl.h> + #include <rte_hash.h> #include <rte_hash_crc.h> #include "prox_cfg.h" @@ -35,10 +37,12 @@ #include "lconf.h" #include "input.h" #include "tx_pkt.h" +#include "defines.h" #define PROX_MAX_ARP_REQUESTS 32 // Maximum number of tasks requesting the same MAC address +#define SET_NON_BLOCKING(X) fcntl(X, F_SETFL, fcntl(X, F_GETFL) | O_NONBLOCK); -const char *actions_string[] = {"UPDATE_FROM_CTRL", "SEND_ARP_REQUEST_FROM_CTRL", "SEND_ARP_REPLY_FROM_CTRL", "HANDLE_ARP_TO_CTRL", "REQ_MAC_TO_CTRL"}; +const char *actions_string[] = {"UPDATE_FROM_CTRL", "SEND_ARP_REQUEST_FROM_CTRL", "SEND_ARP_REPLY_FROM_CTRL", "HANDLE_ARP_TO_CTRL", "REQ_MAC_TO_CTRL", "PKT_FROM_TAP"}; static struct my_arp_t arp_reply = { .htype = 0x100, @@ -83,6 +87,8 @@ struct task_master { struct rte_hash *external_ip_hash; struct rte_hash *internal_ip_hash; struct port_table internal_port_table[PROX_MAX_PORTS]; + struct vdev all_vdev[PROX_MAX_PORTS]; + int max_vdev_id; }; struct ip_port { @@ -111,11 +117,36 @@ static inline uint32_t get_ip(struct rte_mbuf *mbuf) return (mbuf->udata64 >> 32) & 0xFFFFFFFF; } +void master_init_vdev(struct task_base *tbase, uint8_t port_id, uint8_t core_id, uint8_t task_id) +{ + struct task_master *task = (struct task_master *)tbase; + uint8_t vdev_port = prox_port_cfg[port_id].dpdk_mapping; + int rc; + if (vdev_port != NO_VDEV_PORT) { + task->all_vdev[task->max_vdev_id].port_id = vdev_port; + task->all_vdev[task->max_vdev_id].ring = task->ctrl_tx_rings[core_id * MAX_TASKS_PER_CORE + task_id]; + + struct sockaddr_in dst, src; + src.sin_family = AF_INET; + src.sin_addr.s_addr = prox_port_cfg[vdev_port].ip; + src.sin_port = 5000; + + int fd = socket(AF_INET, SOCK_DGRAM, 0); + PROX_PANIC(fd < 0, "Failed to open socket(AF_INET, SOCK_DGRAM, 0)\n"); + prox_port_cfg[vdev_port].fd = fd; + rc = bind(fd,(struct sockaddr *)&src, sizeof(struct sockaddr_in)); + PROX_PANIC(rc, "Failed to bind("IPv4_BYTES_FMT":%d): errno = %d\n", IPv4_BYTES(((uint8_t*)&src.sin_addr.s_addr)), src.sin_port, errno); + plog_info("DPDK port %d bound("IPv4_BYTES_FMT":%d) to fd %d\n", port_id, IPv4_BYTES(((uint8_t*)&src.sin_addr.s_addr)), src.sin_port, fd); + SET_NON_BLOCKING(fd); + task->max_vdev_id++; + } +} + void register_ip_to_ctrl_plane(struct task_base *tbase, uint32_t ip, uint8_t port_id, uint8_t core_id, uint8_t task_id) { struct task_master *task = (struct task_master *)tbase; struct ip_port key; - plogx_dbg("\tregistering IP %d.%d.%d.%d with port %d core %d and task %d\n", IP4(ip), port_id, core_id, task_id); + plogx_info("\tregistering IP %d.%d.%d.%d with port %d core %d and task %d\n", IP4(ip), port_id, core_id, task_id); if (port_id >= PROX_MAX_PORTS) { plog_err("Unable to register ip %d.%d.%d.%d, port %d\n", IP4(ip), port_id); @@ -273,13 +304,22 @@ static inline void handle_unknown_ip(struct task_base *tbase, struct rte_mbuf *m static inline void handle_message(struct task_base *tbase, struct rte_mbuf *mbuf, int ring_id) { + struct task_master *task = (struct task_master *)tbase; struct ether_hdr_arp *hdr_arp = rte_pktmbuf_mtod(mbuf, struct ether_hdr_arp *); int command = get_command(mbuf); + uint8_t port = get_port(mbuf); uint32_t ip; + uint8_t vdev_port = prox_port_cfg[port].dpdk_mapping; plogx_dbg("\tMaster received %s (%x) from mbuf %p\n", actions_string[command], command, mbuf); switch(command) { case ARP_TO_CTRL: + if (vdev_port != NO_VDEV_PORT) { + // If a virtual (net_tap) device is attached, send the (ARP) packet to this device + // The kernel will receive and handle it. + int n = rte_eth_tx_burst(prox_port_cfg[port].dpdk_mapping, 0, &mbuf, 1); + return; + } if (hdr_arp->ether_hdr.ether_type != ETYPE_ARP) { tx_drop(mbuf); plog_err("\tUnexpected message received: ARP_TO_CTRL with ether_type %x\n", hdr_arp->ether_hdr.ether_type); @@ -300,6 +340,26 @@ static inline void handle_message(struct task_base *tbase, struct rte_mbuf *mbuf } break; case REQ_MAC_TO_CTRL: + if (vdev_port != NO_VDEV_PORT) { + // We send a packet to the kernel with the proper destnation IP address and our src IP address + // This means that if a generator sends packets from many sources all ARP will still + // be sent from the same IP src. This might be a limitation. + // This prevent to have to open as many sockets as there are sources MAC addresses + // We also always use the same UDP ports - as the packet will finally not leave the system anyhow + // Content of udp might be garbage - we do not care. + + prox_rte_ether_hdr *hdr = rte_pktmbuf_mtod(mbuf, prox_rte_ether_hdr *); + prox_rte_ipv4_hdr *ip_hdr = (prox_rte_ipv4_hdr *)(hdr + 1); + prox_rte_udp_hdr *udp = (prox_rte_udp_hdr *)(ip_hdr + 1); + + struct sockaddr_in dst; + dst.sin_family = AF_INET; + dst.sin_addr.s_addr = ip_hdr->dst_addr; + dst.sin_port = 5000; + int n = sendto(prox_port_cfg[vdev_port].fd, (char*)(udp + 1), 18, 0, (struct sockaddr *)&dst, sizeof(struct sockaddr_in)); + plog_dbg("Sent %d bytes to "IPv4_BYTES_FMT" using fd %d\n", n, IPv4_BYTES(((uint8_t*)&ip_hdr->dst_addr)), prox_port_cfg[vdev_port].fd); + break; + } handle_unknown_ip(tbase, mbuf); break; default: @@ -343,7 +403,7 @@ void init_ctrl_plane(struct task_base *tbase) static int handle_ctrl_plane_f(struct task_base *tbase, __attribute__((unused)) struct rte_mbuf **mbuf, uint16_t n_pkts) { - int ring_id = 0, j, ret = 0; + int ring_id = 0, j, ret = 0, n = 0; struct rte_mbuf *mbufs[MAX_RING_BURST]; struct task_master *task = (struct task_master *)tbase; @@ -356,6 +416,14 @@ static int handle_ctrl_plane_f(struct task_base *tbase, __attribute__((unused)) for (j = 0; j < ret; j++) { handle_message(tbase, mbufs[j], ring_id); } + for (int vdev_id = 0; vdev_id < task->max_vdev_id; vdev_id++) { + struct vdev *vdev = &task->all_vdev[vdev_id]; + n = rte_eth_rx_burst(vdev->port_id, 0, mbufs, MAX_PKT_BURST); + for (j = 0; j < n; j++) { + tx_ring(tbase, vdev->ring, PKT_FROM_TAP, mbufs[j]); + } + ret +=n; + } return ret; } diff --git a/VNFs/DPPD-PROX/handle_master.h b/VNFs/DPPD-PROX/handle_master.h index bc32182d..7772dd32 100644 --- a/VNFs/DPPD-PROX/handle_master.h +++ b/VNFs/DPPD-PROX/handle_master.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ enum arp_actions { ARP_REPLY_FROM_CTRL, ARP_TO_CTRL, REQ_MAC_TO_CTRL, + PKT_FROM_TAP, MAX_ACTIONS }; @@ -40,4 +41,9 @@ static inline void tx_drop(struct rte_mbuf *mbuf) rte_pktmbuf_free(mbuf); } +struct vdev { + int port_id; + struct rte_ring *ring; +}; void register_ip_to_ctrl_plane(struct task_base *task, uint32_t ip, uint8_t port_id, uint8_t core_id, uint8_t task_id); +void master_init_vdev(struct task_base *task, uint8_t port_id, uint8_t core_id, uint8_t task_id); diff --git a/VNFs/DPPD-PROX/packet_utils.c b/VNFs/DPPD-PROX/packet_utils.c index 96d9074a..b0bc6da9 100644 --- a/VNFs/DPPD-PROX/packet_utils.c +++ b/VNFs/DPPD-PROX/packet_utils.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -253,6 +253,7 @@ void task_start_l3(struct task_base *tbase, struct task_args *targ) tbase->local_ipv4 = rte_be_to_cpu_32(targ->local_ipv4); register_ip_to_ctrl_plane(tbase->l3.tmaster, tbase->local_ipv4, tbase->l3.reachable_port_id, targ->lconf->id, targ->id); } + master_init_vdev(tbase->l3.tmaster, tbase->l3.reachable_port_id, targ->lconf->id, targ->id); name[3]++; struct rte_mempool *ret = rte_mempool_create(name, NB_ARP_MBUF, ARP_MBUF_SIZE, NB_CACHE_ARP_MBUF, sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, 0, @@ -333,6 +334,7 @@ void handle_ctrl_plane_pkts(struct task_base *tbase, struct rte_mbuf **mbufs, ui break; case ARP_REPLY_FROM_CTRL: case ARP_REQ_FROM_CTRL: + case PKT_FROM_TAP: out[0] = 0; // tx_ctrlplane_pkt does not drop packets tbase->aux->tx_ctrlplane_pkt(tbase, &mbufs[j], 1, out); diff --git a/VNFs/DPPD-PROX/prox_args.c b/VNFs/DPPD-PROX/prox_args.c index 5d33957c..f4b84890 100644 --- a/VNFs/DPPD-PROX/prox_args.c +++ b/VNFs/DPPD-PROX/prox_args.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -553,6 +553,12 @@ static int get_port_cfg(unsigned sindex, char *str, void *data) } cfg->lsc_val = val; } + else if (STR_EQ(str, "local ipv4")) { + return parse_ip(&cfg->ip, pkey); + } + else if (STR_EQ(str, "vdev")) { + prox_strncpy(cfg->vdev, pkey, MAX_NAME_SIZE); + } #if RTE_VERSION >= RTE_VERSION_NUM(18,8,0,1) else if (STR_EQ(str, "disable tx offload")) { uint32_t val; diff --git a/VNFs/DPPD-PROX/prox_port_cfg.c b/VNFs/DPPD-PROX/prox_port_cfg.c index 74514062..9798c590 100644 --- a/VNFs/DPPD-PROX/prox_port_cfg.c +++ b/VNFs/DPPD-PROX/prox_port_cfg.c @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,6 +31,9 @@ #endif #endif +#include <sys/ioctl.h> +#include <net/if.h> + #include "prox_port_cfg.h" #include "prox_globals.h" #include "log.h" @@ -161,14 +164,70 @@ void prox_pktmbuf_reinit(void *arg, void *start, __attribute__((unused)) void *e }\ +static void set_ip_address (char *devname, uint32_t *ip) +{ + struct ifreq ifreq; + struct sockaddr_in in_addr; + int fd, rc; + + memset(&ifreq, 0, sizeof(struct ifreq)); + memset(&in_addr, 0, sizeof(struct sockaddr_in)); + + in_addr.sin_family = AF_INET; + in_addr.sin_addr = *(struct in_addr *)ip; + fd = socket(in_addr.sin_family, SOCK_DGRAM, 0); + + strncpy(ifreq.ifr_name, devname, IFNAMSIZ); + ifreq.ifr_addr = *(struct sockaddr *)&in_addr; + rc = ioctl(fd, SIOCSIFADDR, &ifreq); + PROX_PANIC(rc < 0, "Failed to set IP address %d on device %s: error = %d\n", *ip, devname, errno); + close(fd); +} + /* initialize rte devices and check the number of available ports */ void init_rte_dev(int use_dummy_devices) { uint8_t nb_ports, port_id_max; - int port_id_last; + int port_id_last, rc = 0; struct rte_eth_dev_info dev_info; const struct rte_pci_device *pci_dev; + for (uint8_t port_id = 0; port_id < PROX_MAX_PORTS; ++port_id) { + if (!prox_port_cfg[port_id].active) { + continue; + } + struct prox_port_cfg* port_cfg = &prox_port_cfg[port_id]; + if (port_cfg->vdev[0]) { +#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,1)) + char name[MAX_NAME_SIZE], tap[MAX_NAME_SIZE]; + snprintf(tap, MAX_NAME_SIZE, "net_tap%d", port_id); + snprintf(name, MAX_NAME_SIZE, "iface=%s", port_cfg->vdev); + rc = rte_vdev_init(tap, name); +#else + rc = eth_dev_null_create(tap, name, PROX_RTE_ETHER_MIN_LEN, 0); +#endif + PROX_PANIC(rc != 0, "Unable to create device %s %s\n", "net tap", port_cfg->vdev); + int vdev_port_id = rte_eth_dev_count() - 1; + PROX_PANIC(vdev_port_id >= PROX_MAX_PORTS, "Too many port defined %d >= %d\n", vdev_port_id, PROX_MAX_PORTS); + plog_info("\tCreating device %s, port %d\n", port_cfg->vdev, vdev_port_id); + 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); + 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 + prox_port_cfg[vdev_port_id].type = prox_port_cfg[port_id].type; + if (prox_port_cfg[vdev_port_id].type == PROX_PORT_MAC_HW) { + // If DPDK port MAC set to HW, then make sure the vdev has the same MAC as DPDK port + prox_port_cfg[vdev_port_id].type = PROX_PORT_MAC_SET; + rte_eth_macaddr_get(port_id, &prox_port_cfg[vdev_port_id].eth_addr); + plog_info("\tDPDK port %d MAC address pre-configured to MAC from port %d: "MAC_BYTES_FMT"\n", + vdev_port_id, port_id, MAC_BYTES(prox_port_cfg[vdev_port_id].eth_addr.addr_bytes)); + } else + memcpy(&prox_port_cfg[vdev_port_id].eth_addr, &prox_port_cfg[port_id].eth_addr, sizeof(prox_port_cfg[port_id].eth_addr)); + } + } nb_ports = prox_rte_eth_dev_count_avail(); /* get available ports configuration */ PROX_PANIC(use_dummy_devices && nb_ports, "Can't use dummy devices while there are also real ports\n"); @@ -681,6 +740,9 @@ static void init_port(struct prox_port_cfg *port_cfg) PROX_PANIC(ret < 0, "\n\t\t\trte_eth_dev_start() failed on port %u: error %d\n", port_id, ret); plog_info(" done: "); + if (prox_port_cfg[port_id].ip) { + set_ip_address(prox_port_cfg[port_id].name, &prox_port_cfg[port_id].ip); + } /* Getting link status can be done without waiting if Link State Interrupt is enabled since in that case, if the link is recognized as being down, an interrupt will notify that @@ -782,6 +844,7 @@ void init_port_addr(void) prox_rte_eth_random_addr(port_cfg->eth_addr.addr_bytes); break; case PROX_PORT_MAC_SET: + plog_info("Setting MAC to "MAC_BYTES_FMT"\n", MAC_BYTES(port_cfg->eth_addr.addr_bytes)); if ((rc = rte_eth_dev_default_mac_addr_set(port_id, &port_cfg->eth_addr)) != 0) plog_warn("port %u: failed to set mac address. Error = %d\n", port_id, rc); break; diff --git a/VNFs/DPPD-PROX/prox_port_cfg.h b/VNFs/DPPD-PROX/prox_port_cfg.h index 9a252c16..d6090a35 100644 --- a/VNFs/DPPD-PROX/prox_port_cfg.h +++ b/VNFs/DPPD-PROX/prox_port_cfg.h @@ -1,5 +1,5 @@ /* -// Copyright (c) 2010-2017 Intel Corporation +// Copyright (c) 2010-2020 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -56,6 +56,7 @@ struct prox_port_cfg { enum addr_type type; prox_rte_ether_addr eth_addr; /* port MAC address */ char name[MAX_NAME_SIZE]; + char vdev[MAX_NAME_SIZE]; char short_name[MAX_NAME_SIZE]; char driver_name[MAX_NAME_SIZE]; char rx_ring[MAX_NAME_SIZE]; @@ -79,6 +80,9 @@ struct prox_port_cfg { uint16_t max_tx_desc; uint32_t nb_mc_addr; prox_rte_ether_addr mc_addr[NB_MCAST_ADDR]; + int dpdk_mapping; + uint32_t ip; + int fd; }; extern rte_atomic32_t lsc; diff --git a/VNFs/DPPD-PROX/swap_tap.cfg b/VNFs/DPPD-PROX/swap_tap.cfg new file mode 100644 index 00000000..5777f9d9 --- /dev/null +++ b/VNFs/DPPD-PROX/swap_tap.cfg @@ -0,0 +1,50 @@ +;; +;; Copyright (c) 2020 Intel Corporation +;; +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. +;; + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output + +[port 0] +name=p0 +vdev=swap_tap +local ipv4=$ip2 + +[defaults] +mempool size=16K + +[global] +start time=5 +name=Basic Gen + +[variables] +$hex_ip1=0a 0a 0a 01 +$hex_ip2=0a 0a 0a 02 +$ip1=10.10.10.1 +$ip2=10.10.10.2 + +[core 0s0] +mode=master + +[core 1s0] +name=swap +task=0 +mode=swap +sub mode=l3 +rx port=p0 +tx port=p0 +drop=no +local ipv4=${ip2} |