From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB6A2A00C4; Thu, 4 Aug 2022 18:59:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B07CB42C0F; Thu, 4 Aug 2022 18:58:59 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 32C0142BF1 for ; Thu, 4 Aug 2022 18:58:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659632334; x=1691168334; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6WklVaKDbqddeo1Nn5SNNCuoIBb7qyEX3VtGVbcO7hs=; b=VKQaKEFWIbYIDzMkREwTbtgqfXkxYnk3HmOkblOBjoCxtVSaJFwy5AA4 Xsm3suNQS+rfRWzVMoTrsL3kXf+QMF3KewDGRmLxO8UsOXq3MscMFvucE 5imStyrDKDazexhqmscYZuqwhueTldFumEALFKjOhn8I0yLz/HNdnDpQt AJHipLzd+CjS//0yG99ivfO0+g+9CgIwN/ZfIIY8IuViG0ir0XUhTDZ5O AsQe0G2hrBTzcI7yhdU36Z06aS1h9EyRsPR46gD6N3cHlwS00T8Dm7xTe TCR8+2//ytz1y7d6c2cBxh4o2Yph9PuPKwZ0aSmVpbWlBnh07svo7yPrB Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10429"; a="290000100" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290000100" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2022 09:58:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="636163121" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.157]) by orsmga001.jf.intel.com with ESMTP; 04 Aug 2022 09:58:49 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: jasvinder.singh@intel.com, yogesh.jangra@intel.com Subject: [PATCH 05/21] net/softnic: remove tap support Date: Thu, 4 Aug 2022 16:58:23 +0000 Message-Id: <20220804165839.1074817-6-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220804165839.1074817-1-cristian.dumitrescu@intel.com> References: <20220804165839.1074817-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Yogesh Jangra --- 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 - */ -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 * [filter match | mismatch offset mask key port ] @@ -874,7 +847,6 @@ cmd_pipeline(struct pmd_internals *softnic, * bsz * link rxq * | swq - * | tap mempool mtu * | source mempool file bpp * [action ] * [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 * link txq * | swq - * | tap * | sink [file 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 -#ifdef RTE_EXEC_ENV_LINUX -#include -#include -#endif -#include - -#include -#include -#include -#include -#include - -#include - -#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