Remove the TUN/TAP device support. The TUN/TAP devices are still supported as virtual Ethernet devices through the TAP Poll Mode Driver.
Signed-off-by: Cristian Dumitrescu <cristian.dumitre...@intel.com> Signed-off-by: Yogesh Jangra <yogesh.jan...@intel.com> --- drivers/net/softnic/meson.build | 1 - drivers/net/softnic/rte_eth_softnic.c | 3 - drivers/net/softnic/rte_eth_softnic_cli.c | 76 ----------- .../net/softnic/rte_eth_softnic_internals.h | 36 ------ .../net/softnic/rte_eth_softnic_pipeline.c | 44 ------- drivers/net/softnic/rte_eth_softnic_tap.c | 118 ------------------ 6 files changed, 278 deletions(-) delete mode 100644 drivers/net/softnic/rte_eth_softnic_tap.c diff --git a/drivers/net/softnic/meson.build b/drivers/net/softnic/meson.build index b3d235841d..91f1f3220f 100644 --- a/drivers/net/softnic/meson.build +++ b/drivers/net/softnic/meson.build @@ -16,7 +16,6 @@ sources = files( 'rte_eth_softnic_mempool.c', 'rte_eth_softnic_pipeline.c', 'rte_eth_softnic_swq.c', - 'rte_eth_softnic_tap.c', 'rte_eth_softnic_thread.c', ) deps += ['pipeline', 'port', 'table'] diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 1ea5989223..eb97ae7185 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -162,7 +162,6 @@ pmd_dev_stop(struct rte_eth_dev *dev) softnic_pipeline_free(p); softnic_table_action_profile_free(p); softnic_port_in_action_profile_free(p); - softnic_tap_free(p); softnic_link_free(p); softnic_softnic_swq_free_keep_rxq_txq(p); softnic_mempool_free(p); @@ -183,7 +182,6 @@ pmd_free(struct pmd_internals *p) softnic_pipeline_free(p); softnic_table_action_profile_free(p); softnic_port_in_action_profile_free(p); - softnic_tap_free(p); softnic_link_free(p); softnic_swq_free(p); softnic_mempool_free(p); @@ -263,7 +261,6 @@ pmd_init(struct pmd_params *params) softnic_mempool_init(p); softnic_swq_init(p); softnic_link_init(p); - softnic_tap_init(p); softnic_port_in_action_profile_init(p); softnic_table_action_profile_init(p); softnic_pipeline_init(p); diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index bca0b176d6..501ef08c4c 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -186,33 +186,6 @@ cmd_swq(struct pmd_internals *softnic, } } -/** - * tap <tap_name> - */ -static void -cmd_tap(struct pmd_internals *softnic, - char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size) -{ - char *name; - struct softnic_tap *tap; - - if (n_tokens != 2) { - snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); - return; - } - - name = tokens[1]; - - tap = softnic_tap_create(softnic, name); - if (tap == NULL) { - snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); - return; - } -} - /** * port in action profile <profile_name> * [filter match | mismatch offset <key_offset> mask <key_mask> key <key_value> port <port_id>] @@ -874,7 +847,6 @@ cmd_pipeline(struct pmd_internals *softnic, * bsz <burst_size> * link <link_name> rxq <queue_id> * | swq <swq_name> - * | tap <tap_name> mempool <mempool_name> mtu <mtu> * | source mempool <mempool_name> file <file_name> bpp <n_bytes_per_pkt> * [action <port_in_action_profile_name>] * [disabled] @@ -957,38 +929,6 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); t0 += 2; - } else if (strcmp(tokens[t0], "tap") == 0) { - if (n_tokens < t0 + 6) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "pipeline port in tap"); - return; - } - - p.type = PORT_IN_TAP; - - strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); - - if (strcmp(tokens[t0 + 2], "mempool") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, - "mempool"); - return; - } - - p.tap.mempool_name = tokens[t0 + 3]; - - if (strcmp(tokens[t0 + 4], "mtu") != 0) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, - "mtu"); - return; - } - - if (softnic_parser_read_uint32(&p.tap.mtu, - tokens[t0 + 5]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "mtu"); - return; - } - - t0 += 6; } else if (strcmp(tokens[t0], "source") == 0) { if (n_tokens < t0 + 6) { snprintf(out, out_size, MSG_ARG_MISMATCH, @@ -1074,7 +1014,6 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, * bsz <burst_size> * link <link_name> txq <txq_id> * | swq <swq_name> - * | tap <tap_name> * | sink [file <file_name> pkts <max_n_pkts>] */ static void @@ -1147,16 +1086,6 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, p.type = PORT_OUT_SWQ; - strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); - } else if (strcmp(tokens[6], "tap") == 0) { - if (n_tokens != 8) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "pipeline port out tap"); - return; - } - - p.type = PORT_OUT_TAP; - strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); } else if (strcmp(tokens[6], "sink") == 0) { if ((n_tokens != 7) && (n_tokens != 11)) { @@ -4600,11 +4529,6 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg) return; } - if (strcmp(tokens[0], "tap") == 0) { - cmd_tap(softnic, tokens, n_tokens, out, out_size); - return; - } - if (strcmp(tokens[0], "port") == 0) { cmd_port_in_action_profile(softnic, tokens, n_tokens, out, out_size); return; diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index ddcde99b98..df74c1fbdc 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -89,17 +89,6 @@ struct softnic_link { TAILQ_HEAD(softnic_link_list, softnic_link); -/** - * TAP - */ -struct softnic_tap { - TAILQ_ENTRY(softnic_tap) node; - char name[NAME_SIZE]; - int fd; -}; - -TAILQ_HEAD(softnic_tap_list, softnic_tap); - /** * Input port action */ @@ -163,7 +152,6 @@ struct pipeline_params { enum softnic_port_in_type { PORT_IN_RXQ, PORT_IN_SWQ, - PORT_IN_TAP, PORT_IN_SOURCE, }; @@ -176,11 +164,6 @@ struct softnic_port_in_params { uint16_t queue_id; } rxq; - struct { - const char *mempool_name; - uint32_t mtu; - } tap; - struct { const char *mempool_name; const char *file_name; @@ -196,7 +179,6 @@ struct softnic_port_in_params { enum softnic_port_out_type { PORT_OUT_TXQ, PORT_OUT_SWQ, - PORT_OUT_TAP, PORT_OUT_SINK, }; @@ -385,7 +367,6 @@ struct pmd_internals { struct softnic_mempool_list mempool_list; struct softnic_swq_list swq_list; struct softnic_link_list link_list; - struct softnic_tap_list tap_list; struct softnic_port_in_action_profile_list port_in_action_profile_list; struct softnic_table_action_profile_list table_action_profile_list; struct pipeline_list pipeline_list; @@ -466,23 +447,6 @@ softnic_link_create(struct pmd_internals *p, const char *name, struct softnic_link_params *params); -/** - * TAP - */ -int -softnic_tap_init(struct pmd_internals *p); - -void -softnic_tap_free(struct pmd_internals *p); - -struct softnic_tap * -softnic_tap_find(struct pmd_internals *p, - const char *name); - -struct softnic_tap * -softnic_tap_create(struct pmd_internals *p, - const char *name); - /** * Input port action */ diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 51a1ea73c0..7a2828b785 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -293,25 +293,6 @@ softnic_pipeline_port_in_create(struct pmd_internals *softnic, break; } - case PORT_IN_TAP: - { - struct softnic_tap *tap; - struct softnic_mempool *mempool; - - tap = softnic_tap_find(softnic, params->dev_name); - mempool = softnic_mempool_find(softnic, params->tap.mempool_name); - if (tap == NULL || mempool == NULL) - return -1; - - pp.fd.fd = tap->fd; - pp.fd.mempool = mempool->m; - pp.fd.mtu = params->tap.mtu; - - p.ops = &rte_port_fd_reader_ops; - p.arg_create = &pp.fd; - break; - } - case PORT_IN_SOURCE: { struct softnic_mempool *mempool; @@ -499,31 +480,6 @@ softnic_pipeline_port_out_create(struct pmd_internals *softnic, break; } - case PORT_OUT_TAP: - { - struct softnic_tap *tap; - - tap = softnic_tap_find(softnic, params->dev_name); - if (tap == NULL) - return -1; - - pp.fd.fd = tap->fd; - pp.fd.tx_burst_sz = params->burst_size; - - pp_nodrop.fd.fd = tap->fd; - pp_nodrop.fd.tx_burst_sz = params->burst_size; - pp_nodrop.fd.n_retries = params->n_retries; - - if (params->retry == 0) { - p.ops = &rte_port_fd_writer_ops; - p.arg_create = &pp.fd; - } else { - p.ops = &rte_port_fd_writer_nodrop_ops; - p.arg_create = &pp_nodrop.fd; - } - break; - } - case PORT_OUT_SINK: { pp.sink.file_name = params->sink.file_name; diff --git a/drivers/net/softnic/rte_eth_softnic_tap.c b/drivers/net/softnic/rte_eth_softnic_tap.c deleted file mode 100644 index 36fe9f0287..0000000000 --- a/drivers/net/softnic/rte_eth_softnic_tap.c +++ /dev/null @@ -1,118 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2018 Intel Corporation - */ - -#include <netinet/in.h> -#ifdef RTE_EXEC_ENV_LINUX -#include <linux/if.h> -#include <linux/if_tun.h> -#endif -#include <sys/ioctl.h> - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <rte_string_fns.h> - -#include "rte_eth_softnic_internals.h" - -#define TAP_DEV "/dev/net/tun" - -int -softnic_tap_init(struct pmd_internals *p) -{ - TAILQ_INIT(&p->tap_list); - - return 0; -} - -void -softnic_tap_free(struct pmd_internals *p) -{ - for ( ; ; ) { - struct softnic_tap *tap; - - tap = TAILQ_FIRST(&p->tap_list); - if (tap == NULL) - break; - - TAILQ_REMOVE(&p->tap_list, tap, node); - free(tap); - } -} - -struct softnic_tap * -softnic_tap_find(struct pmd_internals *p, - const char *name) -{ - struct softnic_tap *tap; - - if (name == NULL) - return NULL; - - TAILQ_FOREACH(tap, &p->tap_list, node) - if (strcmp(tap->name, name) == 0) - return tap; - - return NULL; -} - -#ifndef RTE_EXEC_ENV_LINUX - -struct softnic_tap * -softnic_tap_create(struct pmd_internals *p __rte_unused, - const char *name __rte_unused) -{ - return NULL; -} - -#else - -struct softnic_tap * -softnic_tap_create(struct pmd_internals *p, - const char *name) -{ - struct softnic_tap *tap; - struct ifreq ifr; - int fd, status; - - /* Check input params */ - if (name == NULL || - softnic_tap_find(p, name)) - return NULL; - - /* Resource create */ - fd = open(TAP_DEV, O_RDWR | O_NONBLOCK); - if (fd < 0) - return NULL; - - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; /* No packet information */ - strlcpy(ifr.ifr_name, name, IFNAMSIZ); - - status = ioctl(fd, TUNSETIFF, (void *)&ifr); - if (status < 0) { - close(fd); - return NULL; - } - - /* Node allocation */ - tap = calloc(1, sizeof(struct softnic_tap)); - if (tap == NULL) { - close(fd); - return NULL; - } - /* Node fill in */ - strlcpy(tap->name, name, sizeof(tap->name)); - tap->fd = fd; - - /* Node add to list */ - TAILQ_INSERT_TAIL(&p->tap_list, tap, node); - - return tap; -} - -#endif -- 2.34.1