From patchwork Wed May 21 13:31:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 30548 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 849C020671 for ; Wed, 21 May 2014 13:32:08 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x3sf5949834qcv.11 for ; Wed, 21 May 2014 06:32:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=18Jn0L+BXdJSUlyxhpToOTINhJLSbJLCZtIRvDgkJtM=; b=CvklrKXr8c9P6eXt0xk5YDROlt/vw6hcGnyJEtPVJ735F/xddTxwcyu/bK7LWgxZhR crdRtkvyZ/GJMzdnBZTgkATy6ZDQ/MyaYIcF36P8GcyxD0hYbfgtu+v/i+vho04cstc3 P+qaTFHX0SSQj2PoI1hIz7Mo81j/BnQjYLVkH3w9LRpcn7U8VAMK+UORKmThqlJtvLHI q2luRf9DMrY6zj+WOAvainRxGUrwANq0Qw+v1lPEryLczCf91vwC2oRkgGCTN84dYdpl 1Fq2n/R8O5dzqLIgkQgWhnXuZIGLglPhICIJ+c2+cspOCvcnAtvS/U2Tlinun0KDPvaA JScw== X-Gm-Message-State: ALoCoQmt4olWYgDlxkBEgGcsgJ8VBmsP7Hv46Mk5vlz/C50NQS0LsxJyIoaAIwEUo3zZjwl4YUkG X-Received: by 10.58.245.132 with SMTP id xo4mr21699678vec.11.1400679128244; Wed, 21 May 2014 06:32:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.165 with SMTP id d34ls719513qgd.25.gmail; Wed, 21 May 2014 06:32:08 -0700 (PDT) X-Received: by 10.52.14.130 with SMTP id p2mr8353660vdc.39.1400679128020; Wed, 21 May 2014 06:32:08 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id t7si600587vef.53.2014.05.21.06.32.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 May 2014 06:32:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.178 as permitted sender) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id sa20so2518812veb.9 for ; Wed, 21 May 2014 06:32:07 -0700 (PDT) X-Received: by 10.58.245.2 with SMTP id xk2mr26278854vec.9.1400679127915; Wed, 21 May 2014 06:32:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp113674vcb; Wed, 21 May 2014 06:32:07 -0700 (PDT) X-Received: by 10.229.79.2 with SMTP id n2mr69840394qck.11.1400679126996; Wed, 21 May 2014 06:32:06 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id m3si1399934qaz.65.2014.05.21.06.32.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 21 May 2014 06:32:06 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wn6bn-0006qk-Mv; Wed, 21 May 2014 13:31:03 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wn6bg-0006qf-VM for lng-odp@lists.linaro.org; Wed, 21 May 2014 13:30:57 +0000 Received: by mail-lb0-f175.google.com with SMTP id l4so1575689lbv.34 for ; Wed, 21 May 2014 06:31:53 -0700 (PDT) X-Received: by 10.112.210.165 with SMTP id mv5mr1759380lbc.68.1400679112946; Wed, 21 May 2014 06:31:52 -0700 (PDT) Received: from maxim-lap.localhost.onion ([92.39.133.154]) by mx.google.com with ESMTPSA id g3sm4124786lam.18.2014.05.21.06.31.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 May 2014 06:31:51 -0700 (PDT) From: root To: lng-odp@lists.linaro.org Date: Wed, 21 May 2014 17:31:47 +0400 Message-Id: <1400679107-12067-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: patch Subject: [lng-odp] [PATCHv3] hide packet i/o selection to the api X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Maxim Uvarov Ddp application should be independent of underlaying i/o type. Propose is to use order of available i/o types and try to register them. Also use getenv() for hint which i/o type to select. Signed-off-by: Maxim Uvarov --- v2: implement getenv() to allow linux-generic turn off types of packets I/O. This is needed mainly for testing all code paths. v3: fix linux-keystone2 and netmap. Fix needed const for netmap packet I/O. Todo in separate patch: rather than disabling particular I/O types explicitly select one. Maxim. include/odp_packet_io.h | 3 +- platform/linux-generic/include/odp_packet_netmap.h | 4 +- platform/linux-generic/source/odp_packet_io.c | 154 ++++++++++----------- platform/linux-generic/source/odp_packet_netmap.c | 10 +- platform/linux-keystone2/source/odp_packet_io.c | 14 +- test/generator/odp_generator.c | 11 +- test/l2fwd/l2fwd.c | 6 +- test/packet/odp_example_pktio.c | 31 +---- test/packet_netmap/odp_example_pktio_netmap.c | 15 +- 9 files changed, 94 insertions(+), 154 deletions(-) diff --git a/include/odp_packet_io.h b/include/odp_packet_io.h index cfefac0..96d6039 100644 --- a/include/odp_packet_io.h +++ b/include/odp_packet_io.h @@ -40,8 +40,7 @@ typedef uint32_t odp_pktio_t; * * @return ODP packet IO handle or ODP_PKTIO_INVALID on error */ -odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, - odp_pktio_params_t *params); +odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool); /** * Close an ODP packet IO instance diff --git a/platform/linux-generic/include/odp_packet_netmap.h b/platform/linux-generic/include/odp_packet_netmap.h index 57d9f2c..9663162 100644 --- a/platform/linux-generic/include/odp_packet_netmap.h +++ b/platform/linux-generic/include/odp_packet_netmap.h @@ -45,8 +45,8 @@ typedef struct { /** * Configure an interface to work in netmap mode */ -int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, char *netdev, - odp_buffer_pool_t pool, netmap_params_t *nm_params); +int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, + odp_buffer_pool_t pool); /** * Switch interface from netmap mode to normal mode diff --git a/platform/linux-generic/source/odp_packet_io.c b/platform/linux-generic/source/odp_packet_io.c index 33ade10..bba876f 100644 --- a/platform/linux-generic/source/odp_packet_io.c +++ b/platform/linux-generic/source/odp_packet_io.c @@ -13,21 +13,19 @@ #include #include #include -#ifdef ODP_HAVE_NETMAP -#include -#endif #include #include #include #include #include - #include #ifdef ODP_HAVE_NETMAP +#include #include #endif #include +#include typedef struct { pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES]; @@ -112,32 +110,13 @@ static void unlock_entry(pktio_entry_t *entry) odp_spinlock_unlock(&entry->s.lock); } -static void init_pktio_entry(pktio_entry_t *entry, odp_pktio_params_t *params) +static void init_pktio_entry(pktio_entry_t *entry) { set_taken(entry); entry->s.inq_default = ODP_QUEUE_INVALID; - switch (params->type) { - case ODP_PKTIO_TYPE_SOCKET_BASIC: - case ODP_PKTIO_TYPE_SOCKET_MMSG: - case ODP_PKTIO_TYPE_SOCKET_MMAP: - memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock)); - memset(&entry->s.pkt_sock_mmap, 0, - sizeof(entry->s.pkt_sock_mmap)); - break; -#ifdef ODP_HAVE_NETMAP - case ODP_PKTIO_TYPE_NETMAP: - memset(&entry->s.pkt_nm, 0, sizeof(entry->s.pkt_nm)); - break; -#endif - default: - ODP_ERR("Packet I/O type not supported. Please recompile\n"); - break; - } - /* Save pktio parameters, type is the most useful */ - memcpy(&entry->s.params, params, sizeof(*params)); } -static odp_pktio_t alloc_lock_pktio_entry(odp_pktio_params_t *params) +static odp_pktio_t alloc_lock_pktio_entry(void) { odp_pktio_t id; pktio_entry_t *entry; @@ -148,7 +127,7 @@ static odp_pktio_t alloc_lock_pktio_entry(odp_pktio_params_t *params) if (is_free(entry)) { lock_entry(entry); if (is_free(entry)) { - init_pktio_entry(entry, params); + init_pktio_entry(entry); id = i + 1; return id; /* return with entry locked! */ } @@ -171,35 +150,14 @@ static int free_pktio_entry(odp_pktio_t id) return 0; } -odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, - odp_pktio_params_t *params) +odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) { odp_pktio_t id; pktio_entry_t *pktio_entry; int res; + int fanout = 0; - if (params == NULL) { - ODP_ERR("Invalid pktio params\n"); - return ODP_PKTIO_INVALID; - } - - switch (params->type) { - case ODP_PKTIO_TYPE_SOCKET_BASIC: - case ODP_PKTIO_TYPE_SOCKET_MMSG: - case ODP_PKTIO_TYPE_SOCKET_MMAP: - ODP_DBG("Allocating socket pktio\n"); - break; -#ifdef ODP_HAVE_NETMAP - case ODP_PKTIO_TYPE_NETMAP: - ODP_DBG("Allocating netmap pktio\n"); - break; -#endif - default: - ODP_ERR("Invalid pktio type: %02x\n", params->type); - return ODP_PKTIO_INVALID; - } - - id = alloc_lock_pktio_entry(params); + id = alloc_lock_pktio_entry(); if (id == ODP_PKTIO_INVALID) { ODP_ERR("No resources available.\n"); return ODP_PKTIO_INVALID; @@ -208,44 +166,76 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, pktio_entry = get_entry(id); - switch (params->type) { - case ODP_PKTIO_TYPE_SOCKET_BASIC: - case ODP_PKTIO_TYPE_SOCKET_MMSG: - res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool); - if (res == -1) { - close_pkt_sock(&pktio_entry->s.pkt_sock); - free_pktio_entry(id); - id = ODP_PKTIO_INVALID; - } - break; - case ODP_PKTIO_TYPE_SOCKET_MMAP: - res = setup_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, dev, - pool, params->sock_params.fanout); - if (res == -1) { - close_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap); - free_pktio_entry(id); - id = ODP_PKTIO_INVALID; - } - break; -#ifdef ODP_HAVE_NETMAP - case ODP_PKTIO_TYPE_NETMAP: + if (getenv("ODP_PKTIO_USE_FANOUT")) + fanout = 1; + ODP_DBG("ODP_PKTIO_USE_FANOUT: %d\n", fanout); - res = setup_pkt_netmap(&pktio_entry->s.pkt_nm, dev, - pool, ¶ms->nm_params); - if (res == -1) { + memset(&pktio_entry->s.pkt_sock, 0, sizeof(pktio_entry->s.pkt_sock)); + memset(&pktio_entry->s.pkt_sock_mmap, 0, sizeof(pktio_entry->s.pkt_sock_mmap)); +#ifdef ODP_HAVE_NETMAP + memset(&pktio_entry->s.pkt_nm, 0, sizeof(pktio_entry->s.pkt_nm)); + + if (getenv("ODP_PKTIO_DISABLE_NETMAP") == NULL) { + pktio_entry->s.params.nm_params.type = ODP_PKTIO_TYPE_NETMAP; + if (getenv("ODP_NETMAP_MODE_HW")) + pktio_entry->s.params.nm_params.netmap_mode = ODP_NETMAP_MODE_HW; + else + pktio_entry->s.params.nm_params.netmap_mode = ODP_NETMAP_MODE_SW; + pktio_entry->s.params.nm_params.ringid = 0; + res = setup_pkt_netmap(&pktio_entry->s.pkt_nm, dev, pool); + if (res != -1) { + pktio_entry->s.params.type = pktio_entry->s.params.nm_params.type; + ODP_DBG("IO type: ODP_PKTIO_TYPE_NETMAP\n"); + goto done; + } else close_pkt_netmap(&pktio_entry->s.pkt_nm); - free_pktio_entry(id); - id = ODP_PKTIO_INVALID; - } - break; + } #endif - default: + + if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMAP") == NULL) { + pktio_entry->s.params.sock_params.type = ODP_PKTIO_TYPE_SOCKET_MMAP; + pktio_entry->s.params.sock_params.fanout = fanout; + res = setup_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, dev, + pool, fanout); + if (res != -1) { + pktio_entry->s.params.type = pktio_entry->s.params.sock_params.type; + ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_MMAP\n"); + goto done; + } else + close_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap); + } + + if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMSG") == NULL) { + pktio_entry->s.params.sock_params.type = ODP_PKTIO_TYPE_SOCKET_MMSG; + pktio_entry->s.params.sock_params.fanout = fanout; + res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool); + if (res != -1) { + pktio_entry->s.params.type = pktio_entry->s.params.sock_params.type; + ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_MMSG\n"); + goto done; + } else + close_pkt_sock(&pktio_entry->s.pkt_sock); + } + + if (getenv("ODP_PKTIO_DISABLE_SOCKET_BASIC") == NULL) { free_pktio_entry(id); - id = ODP_PKTIO_INVALID; - ODP_ERR("This type of I/O is not supported. Please recompile.\n"); - break; + pktio_entry->s.params.sock_params.type = ODP_PKTIO_TYPE_SOCKET_BASIC; + pktio_entry->s.params.sock_params.fanout = fanout; + res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool); + if (res != -1) { + pktio_entry->s.params.type = pktio_entry->s.params.sock_params.type; + ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_BASIC\n"); + goto done; + } else + close_pkt_sock(&pktio_entry->s.pkt_sock); } + free_pktio_entry(id); + unlock_entry(pktio_entry); + ODP_ERR("Unable to init any I/O type.\n"); + return ODP_PKTIO_INVALID; + +done: unlock_entry(pktio_entry); return id; } diff --git a/platform/linux-generic/source/odp_packet_netmap.c b/platform/linux-generic/source/odp_packet_netmap.c index e2215ab..027a338 100644 --- a/platform/linux-generic/source/odp_packet_netmap.c +++ b/platform/linux-generic/source/odp_packet_netmap.c @@ -105,7 +105,7 @@ done: } int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, - odp_buffer_pool_t pool, netmap_params_t *nm_params) + odp_buffer_pool_t pool) { char qname[ODP_QUEUE_NAME_LEN]; char ifname[32]; @@ -132,12 +132,10 @@ int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, pkt_nm->buf_size = odp_packet_buf_size(pkt); /* max frame len taking into account the l2-offset */ pkt_nm->max_frame_len = pkt_nm->buf_size - pkt_nm->frame_offset; - /* save netmap_mode for later use */ - pkt_nm->netmap_mode = nm_params->netmap_mode; odp_packet_free(pkt); - if (nm_params->netmap_mode == ODP_NETMAP_MODE_SW) + if (pkt_nm->netmap_mode == ODP_NETMAP_MODE_SW) ringid = NETMAP_SW_RING; else ringid = nm_params->ringid; @@ -153,7 +151,7 @@ int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, ODP_DBG("thread %d mode %s mmap addr %p\n", odp_thread_id(), - nm_params->netmap_mode == ODP_NETMAP_MODE_SW ? "SW" : "HW", + pkt_nm->netmap_mode == ODP_NETMAP_MODE_SW ? "SW" : "HW", pkt_nm->nm_desc->mem); if (nm_params->netmap_mode == ODP_NETMAP_MODE_SW) { @@ -178,7 +176,7 @@ int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, } /* Set TX checksumming if hardware rings */ - if (nm_params->netmap_mode == ODP_NETMAP_MODE_HW) { + if (pkt_nm->netmap_mode == ODP_NETMAP_MODE_HW) { ret = nm_do_ioctl(pkt_nm, SIOCGIFFLAGS, 0); if (ret) return ret; diff --git a/platform/linux-keystone2/source/odp_packet_io.c b/platform/linux-keystone2/source/odp_packet_io.c index 1ded021..0f7e80a 100644 --- a/platform/linux-keystone2/source/odp_packet_io.c +++ b/platform/linux-keystone2/source/odp_packet_io.c @@ -121,12 +121,12 @@ static void unlock_entry(pktio_entry_t *entry) odp_spinlock_unlock(&entry->s.lock); } -static odp_pktio_t alloc_lock_pktio_entry(odp_pktio_params_t *params) +static odp_pktio_t alloc_lock_pktio_entry(void) { odp_pktio_t id; pktio_entry_t *entry; int i; - (void)params; + for (i = 0; i < ODP_CONFIG_PKTIO_ENTRIES; ++i) { entry = &pktio_tbl->entries[i]; if (is_free(entry)) { @@ -157,8 +157,7 @@ static int free_pktio_entry(odp_pktio_t id) return 0; } -odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, - odp_pktio_params_t *params) +odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) { odp_pktio_t id; pktio_entry_t *pktio_entry; @@ -166,14 +165,9 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool, queue_entry_t *queue_entry; odp_queue_t qid = ODP_QUEUE_INVALID; - if (params == NULL) { - ODP_ERR("Invalid pktio params\n"); - return ODP_PKTIO_INVALID; - } - ODP_DBG("Allocating HW pktio\n"); - id = alloc_lock_pktio_entry(params); + id = alloc_lock_pktio_entry(); if (id == ODP_PKTIO_INVALID) { ODP_ERR("No resources available.\n"); return ODP_PKTIO_INVALID; diff --git a/test/generator/odp_generator.c b/test/generator/odp_generator.c index ca84e4c..c386418 100644 --- a/test/generator/odp_generator.c +++ b/test/generator/odp_generator.c @@ -294,17 +294,13 @@ static void *gen_send_thread(void *arg) odp_pktio_t pktio; thread_args_t *thr_args; odp_queue_t outq_def; - odp_pktio_params_t params; - socket_params_t *sock_params = ¶ms.sock_params; - odp_buffer_t buf; thr = odp_thread_id(); thr_args = arg; /* Open a packet IO instance for this thread */ - sock_params->type = 1; - pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool, ¶ms); + pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool); if (pktio == ODP_PKTIO_INVALID) { ODP_ERR(" [%02i] Error: pktio create failed\n", thr); return NULL; @@ -459,10 +455,8 @@ static void *gen_recv_thread(void *arg) odp_pktio_t pktio; thread_args_t *thr_args; odp_queue_t inq_def; - odp_pktio_params_t params; char inq_name[ODP_QUEUE_NAME_LEN]; odp_queue_param_t qparam; - socket_params_t *sock_params = ¶ms.sock_params; odp_packet_t pkt; odp_buffer_t buf; @@ -471,8 +465,7 @@ static void *gen_recv_thread(void *arg) thr_args = arg; /* Open a packet IO instance for this thread */ - sock_params->type = 1; - pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool, ¶ms); + pktio = odp_pktio_open(thr_args->pktio_dev, thr_args->pool); if (pktio == ODP_PKTIO_INVALID) { ODP_ERR(" [%02i] Error: pktio create failed\n", thr); return NULL; diff --git a/test/l2fwd/l2fwd.c b/test/l2fwd/l2fwd.c index fb1b949..67332cc 100644 --- a/test/l2fwd/l2fwd.c +++ b/test/l2fwd/l2fwd.c @@ -91,15 +91,11 @@ static void usage(char *progname); static odp_pktio_t burst_mode_init_params(void *arg, int pool) { thread_args_t *args; - odp_pktio_params_t params; - socket_params_t *sock_params = ¶ms.sock_params; odp_pktio_t pktio; args = arg; /* Open a packet IO instance for this thread */ - sock_params->type = args->type; - sock_params->fanout = args->fanout; - pktio = odp_pktio_open(args->srcif, pool, ¶ms); + pktio = odp_pktio_open(args->srcif, pool); if (pktio == ODP_PKTIO_INVALID) ODP_ERR(" Error: pktio create failed"); diff --git a/test/packet/odp_example_pktio.c b/test/packet/odp_example_pktio.c index 3acb1fb..0d23bd6 100644 --- a/test/packet/odp_example_pktio.c +++ b/test/packet/odp_example_pktio.c @@ -98,8 +98,6 @@ static void *pktio_queue_thread(void *arg) int ret; unsigned long pkt_cnt = 0; unsigned long err_cnt = 0; - odp_pktio_params_t params; - socket_params_t *sock_params = ¶ms.sock_params; thr = odp_thread_id(); thr_args = arg; @@ -115,9 +113,7 @@ static void *pktio_queue_thread(void *arg) } /* Open a packet IO instance for this thread */ - sock_params->type = thr_args->type; - sock_params->fanout = thr_args->fanout; - pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool, ¶ms); + pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool); if (pktio == ODP_PKTIO_INVALID) { ODP_ERR(" [%02i] Error: pktio create failed\n", thr); return NULL; @@ -211,8 +207,6 @@ static void *pktio_ifburst_thread(void *arg) unsigned long pkt_cnt = 0; unsigned long err_cnt = 0; unsigned long tmp = 0; - odp_pktio_params_t params; - socket_params_t *sock_params = ¶ms.sock_params; thr = odp_thread_id(); thr_args = arg; @@ -228,9 +222,7 @@ static void *pktio_ifburst_thread(void *arg) } /* Open a packet IO instance for this thread */ - sock_params->type = thr_args->type; - sock_params->fanout = thr_args->fanout; - pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool, ¶ms); + pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool); if (pktio == ODP_PKTIO_INVALID) { ODP_ERR(" [%02i] Error: pktio create failed.\n", thr); return NULL; @@ -543,14 +535,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->mode = APPL_MODE_PKT_QUEUE; break; - case 't': - appl_args->type = atoi(optarg); - break; - - case 'f': - appl_args->fanout = atoi(optarg); - break; - case 'h': usage(argv[0]); exit(EXIT_SUCCESS); @@ -620,16 +604,15 @@ static void usage(char *progname) " -i, --interface Eth interfaces (comma-separated, no spaces)\n" " -m, --mode 0: Burst send&receive packets (no queues)\n" " 1: Send&receive packets through ODP queues.\n" - " -t, --type 1: ODP_PKTIO_TYPE_SOCKET_BASIC\n" - " 2: ODP_PKTIO_TYPE_SOCKET_MMSG\n" - " 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n" - " 4: ODP_PKTIO_TYPE_NETMAP\n" - " Default: 3: ODP_PKTIO_TYPE_SOCKET_MMAP\n" - " -f, --fanout 0: off 1: on (Default 1: on)\n" "\n" "Optional OPTIONS\n" " -c, --count Core count.\n" " -h, --help Display help and exit.\n" + " environment variables: ODP_PKTIO_DISABLE_NETMAP" + " ODP_PKTIO_DISABLE_SOCKET_MMAP\n" + " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" + " ODP_PKTIO_DISABLE_SOCKET_BASIC\n" + " can be used to advance packet I/O selection for linux-generic\n" "\n", NO_PATH(progname), NO_PATH(progname) ); } diff --git a/test/packet_netmap/odp_example_pktio_netmap.c b/test/packet_netmap/odp_example_pktio_netmap.c index f50f764..acabd0b 100644 --- a/test/packet_netmap/odp_example_pktio_netmap.c +++ b/test/packet_netmap/odp_example_pktio_netmap.c @@ -248,8 +248,6 @@ int main(int argc, char *argv[]) odp_buffer_pool_print(pool); for (i = 0; i < 2 * args->appl.if_count; ++i) { - odp_pktio_params_t params; - netmap_params_t *nm_params = ¶ms.nm_params; char inq_name[ODP_QUEUE_NAME_LEN]; odp_queue_t inq_def; odp_queue_param_t qparam; @@ -260,18 +258,8 @@ int main(int argc, char *argv[]) * the software ring associated with the physical interface */ - args->pktios[i].pktio_dev = args->appl.ifs[i / 2].if_name; - memset(nm_params, 0, sizeof(*nm_params)); - nm_params->type = ODP_PKTIO_TYPE_NETMAP; - if (i % 2) { - nm_params->netmap_mode = ODP_NETMAP_MODE_SW; - nm_params->ringid = 0; - } else { - nm_params->netmap_mode = ODP_NETMAP_MODE_HW; - nm_params->ringid = 0; - } pktio = odp_pktio_open(args->pktios[i].pktio_dev, - pool, ¶ms); + pool); /* Open a packet IO instance for this thread */ if (pktio == ODP_PKTIO_INVALID) { ODP_ERR(" [%02i] Err: pktio create\n", i); @@ -280,7 +268,6 @@ int main(int argc, char *argv[]) args->pktios[i].pktio = pktio; args->pktios[i].pool = pool; - args->pktios[i].netmap_mode = nm_params->netmap_mode; /* Save pktio_info in the lookup table */ args->pktio_lt[pktio] = &args->pktios[i]; /*