From patchwork Wed Oct 1 15:53:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 38249 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C5172202E7 for ; Wed, 1 Oct 2014 15:54:45 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e51sf22017eek.11 for ; Wed, 01 Oct 2014 08:54:44 -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:in-reply-to :references: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=kDgfSsF4OUTdfBkVBC6G8A4uIW9+ecYNxssJMJV82HY=; b=JoKzaTd/Zkxu+oXsxnpBeCY9UNCQfyqqCdw0/bKz+4Ag9JStxTqQ8z3yhRLlRz9ieH jVWwoZH4XVBNzkIcCjGEdWqVRHfX233G+Uv7NJfl8cGxjTcaT2VBB9Tjib/+W2T6KGek c7/sEP3dGK2okhLKfvn3YbBptauzCED7/q3/o0OuDie/3s43WfKjpgT/BDSdvN6VwvKZ kaZmN5Y+29602+9PvTW7YKBxlj1lW7QTOADRBaUxq96/qg/b7NnrYrrxLaNjxQR4Bm5B fwDlySkiBaQ4kuyBCp5lBA8AyChwSWmk9cxcAMUQLq8dLxni5iQMnhfvovgq1vUc5n8e CmGg== X-Gm-Message-State: ALoCoQntVgl8muxXCYYc/IHmxGNiqKYKfPcajHe9h/EbJjXzYN44Zl9Dy1QZdTANAtVJ89uWznLV X-Received: by 10.112.189.69 with SMTP id gg5mr575555lbc.14.1412178884847; Wed, 01 Oct 2014 08:54:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.135 with SMTP id k7ls165138lah.78.gmail; Wed, 01 Oct 2014 08:54:44 -0700 (PDT) X-Received: by 10.152.19.167 with SMTP id g7mr6893639lae.31.1412178884645; Wed, 01 Oct 2014 08:54:44 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx.google.com with ESMTPS id h10si2285053lam.113.2014.10.01.08.54.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 08:54:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id z11so621373lbi.13 for ; Wed, 01 Oct 2014 08:54:44 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr55709259lac.44.1412178884534; Wed, 01 Oct 2014 08:54:44 -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.112.130.169 with SMTP id of9csp559228lbb; Wed, 1 Oct 2014 08:54:43 -0700 (PDT) X-Received: by 10.229.235.200 with SMTP id kh8mr24395737qcb.30.1412178883008; Wed, 01 Oct 2014 08:54:43 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id o34si2320472qga.77.2014.10.01.08.54.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 01 Oct 2014 08:54:42 -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-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XZMEj-0007Us-E1; Wed, 01 Oct 2014 15:54:41 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XZMEV-0007SZ-N2 for lng-odp@lists.linaro.org; Wed, 01 Oct 2014 15:54:27 +0000 Received: by mail-lb0-f172.google.com with SMTP id b6so604234lbj.31 for ; Wed, 01 Oct 2014 08:54:21 -0700 (PDT) X-Received: by 10.152.28.38 with SMTP id y6mr20564026lag.90.1412178861743; Wed, 01 Oct 2014 08:54:21 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id n7sm538338lae.47.2014.10.01.08.54.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 08:54:21 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 1 Oct 2014 18:53:51 +0300 Message-Id: <1412178831-7575-3-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412178831-7575-1-git-send-email-ciprian.barbu@linaro.org> References: <1412178831-7575-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 2/2] Removed unnecessary pktio type include files 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: ciprian.barbu@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.217.182 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 Signed-off-by: Ciprian Barbu --- platform/linux-generic/Makefile.am | 4 +- platform/linux-generic/include/api/odp_packet_io.h | 2 - .../linux-generic/include/api/odp_pktio_netmap.h | 39 --------------- .../linux-generic/include/api/odp_pktio_socket.h | 34 ------------- .../linux-generic/include/api/odp_pktio_types.h | 55 ---------------------- .../linux-generic/include/odp_packet_io_internal.h | 11 ++++- platform/linux-generic/include/odp_packet_socket.h | 1 + platform/linux-generic/odp_packet_io.c | 21 +++------ platform/linux-generic/odp_packet_socket.c | 1 + 9 files changed, 19 insertions(+), 149 deletions(-) delete mode 100644 platform/linux-generic/include/api/odp_pktio_netmap.h delete mode 100644 platform/linux-generic/include/api/odp_pktio_socket.h delete mode 100644 platform/linux-generic/include/api/odp_pktio_types.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 5b3c879..d076d50 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -35,9 +35,7 @@ include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp_ticketlock.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_time.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_timer.h \ - $(top_srcdir)/platform/linux-generic/include/api/odp_version.h \ - $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_types.h \ - $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_socket.h + $(top_srcdir)/platform/linux-generic/include/api/odp_version.h subdirheadersdir = $(includedir)/helper subdirheaders_HEADERS = \ diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h index 9f9e754..29fd105 100644 --- a/platform/linux-generic/include/api/odp_packet_io.h +++ b/platform/linux-generic/include/api/odp_packet_io.h @@ -23,8 +23,6 @@ extern "C" { #include #include -#include - /** ODP packet IO handle */ typedef uint32_t odp_pktio_t; diff --git a/platform/linux-generic/include/api/odp_pktio_netmap.h b/platform/linux-generic/include/api/odp_pktio_netmap.h deleted file mode 100644 index 294a13d..0000000 --- a/platform/linux-generic/include/api/odp_pktio_netmap.h +++ /dev/null @@ -1,39 +0,0 @@ - -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP packet input/output netmap - */ - -#ifndef ODP_PKTIO_NETMAP_H -#define ODP_PKTIO_NETMAP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define ODP_NETMAP_MODE_HW 0 /**< Netmap mode in hardware */ -#define ODP_NETMAP_MODE_SW 1 /**< Netmap mode in software */ - -/** - * Netmap parameters - */ -typedef struct { - odp_pktio_type_t type; /**< Packet IO type */ - int netmap_mode; /**< Netmap Mode */ - uint16_t ringid; /**< Ring identifiers */ -} netmap_params_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/api/odp_pktio_socket.h b/platform/linux-generic/include/api/odp_pktio_socket.h deleted file mode 100644 index 6444cba..0000000 --- a/platform/linux-generic/include/api/odp_pktio_socket.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP packet input/output socket - */ - -#ifndef ODP_PKTIO_SOCKET_H -#define ODP_PKTIO_SOCKET_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** - * Socket Parameters - */ -typedef struct { - odp_pktio_type_t type; /**< Packet IO type */ - int fanout; /**< Fantout */ -} socket_params_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/api/odp_pktio_types.h b/platform/linux-generic/include/api/odp_pktio_types.h deleted file mode 100644 index 54ce459..0000000 --- a/platform/linux-generic/include/api/odp_pktio_types.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP packet input/output types - */ - -#ifndef ODP_PKTIO_TYPES_H -#define ODP_PKTIO_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* We should ensure that future enum values will never overlap, otherwise - * applications that want netmap suport might get in trouble if the odp lib - * was not built with netmap support and there are more types define below - */ - -/** - * Packet IO types - */ -typedef enum { - ODP_PKTIO_TYPE_SOCKET_BASIC = 0x1, - ODP_PKTIO_TYPE_SOCKET_MMSG, - ODP_PKTIO_TYPE_SOCKET_MMAP, - ODP_PKTIO_TYPE_NETMAP, -} odp_pktio_type_t; - -#include -#ifdef ODP_HAVE_NETMAP -#include -#endif - -/** - * Packet IO parameters - */ -typedef union odp_pktio_params_t { - odp_pktio_type_t type; /**< Packet IO type */ - socket_params_t sock_params; /**< Socket parameter */ -#ifdef ODP_HAVE_NETMAP - netmap_params_t nm_params; -#endif -} odp_pktio_params_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 7ba72df..23633ed 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -21,12 +21,21 @@ extern "C" { #include #include +/** + * Packet IO types + */ +typedef enum { + ODP_PKTIO_TYPE_SOCKET_BASIC = 0x1, + ODP_PKTIO_TYPE_SOCKET_MMSG, + ODP_PKTIO_TYPE_SOCKET_MMAP, +} odp_pktio_type_t; + struct pktio_entry { odp_spinlock_t lock; /**< entry spinlock */ int taken; /**< is entry taken(1) or free(0) */ odp_queue_t inq_default; /**< default input queue, if set */ odp_queue_t outq_default; /**< default out queue */ - odp_pktio_params_t params; /**< pktio parameters */ + odp_pktio_type_t type; /**< pktio type */ pkt_sock_t pkt_sock; /**< using socket API for IO */ pkt_sock_mmap_t pkt_sock_mmap; /**< using socket mmap API for IO */ }; diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index f38f5b0..9c1bd78 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -81,6 +81,7 @@ typedef struct { unsigned mmap_len; unsigned char if_mac[ETH_ALEN]; struct sockaddr_ll ll; + int fanout; } pkt_sock_mmap_t; /** diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 719e1d0..0c30f0f 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -19,8 +19,6 @@ #include #include -#include - #include typedef struct { @@ -113,7 +111,6 @@ static void init_pktio_entry(pktio_entry_t *entry) { set_taken(entry); entry->s.inq_default = ODP_QUEUE_INVALID; - memset(&entry->s.params, 0, sizeof(entry->s.params)); memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock)); memset(&entry->s.pkt_sock_mmap, 0, sizeof(entry->s.pkt_sock_mmap)); } @@ -170,9 +167,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) ODP_DBG("ODP_PKTIO_USE_FANOUT: %d\n", fanout); 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; + pktio_entry->s.type = ODP_PKTIO_TYPE_SOCKET_MMAP; res = setup_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, dev, pool, fanout); if (res != -1) { @@ -183,9 +178,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) } 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; + pktio_entry->s.type = ODP_PKTIO_TYPE_SOCKET_MMSG; res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool); if (res != -1) { ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_MMSG\n"); @@ -195,9 +188,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) } if (getenv("ODP_PKTIO_DISABLE_SOCKET_BASIC") == NULL) { - pktio_entry->s.params.sock_params.type = - ODP_PKTIO_TYPE_SOCKET_BASIC; - pktio_entry->s.params.sock_params.fanout = fanout; + pktio_entry->s.type = ODP_PKTIO_TYPE_SOCKET_BASIC; res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool); if (res != -1) { ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_BASIC\n"); @@ -227,7 +218,7 @@ int odp_pktio_close(odp_pktio_t id) lock_entry(entry); if (!is_free(entry)) { - switch (entry->s.params.type) { + switch (entry->s.type) { case ODP_PKTIO_TYPE_SOCKET_BASIC: case ODP_PKTIO_TYPE_SOCKET_MMSG: res = close_pkt_sock(&entry->s.pkt_sock); @@ -268,7 +259,7 @@ int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) return -1; lock_entry(pktio_entry); - switch (pktio_entry->s.params.type) { + switch (pktio_entry->s.type) { case ODP_PKTIO_TYPE_SOCKET_BASIC: pkts = recv_pkt_sock_basic(&pktio_entry->s.pkt_sock, pkt_table, len); @@ -305,7 +296,7 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) return -1; lock_entry(pktio_entry); - switch (pktio_entry->s.params.type) { + switch (pktio_entry->s.type) { case ODP_PKTIO_TYPE_SOCKET_BASIC: pkts = send_pkt_sock_basic(&pktio_entry->s.pkt_sock, pkt_table, len); diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c index 279a0cb..844f117 100644 --- a/platform/linux-generic/odp_packet_socket.c +++ b/platform/linux-generic/odp_packet_socket.c @@ -857,6 +857,7 @@ int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev, return -1; } + pkt_sock->fanout = fanout; if (fanout) { ret = set_pkt_sock_fanout_mmap(pkt_sock, if_idx); if (ret != 0)