From patchwork Wed Oct 1 14:32:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 38240 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 177C5202E7 for ; Wed, 1 Oct 2014 14:33:46 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id m15sf708963wgh.11 for ; Wed, 01 Oct 2014 07:33:45 -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=QUVSimtbnYqw6756qK2eXzP5wVaqw613nqtoqYfA0rDMIMMV5aUBqW+vNPxDWtTkna bom5fvvscfduUFZjt5FatGmm8fX7MZDJFIBGidrvmuaI9Vc09H/SHoG4p03xa8721AZW 6ersQVt0tgqmRniwMch1lNjzfIRaUek/pip+CkBreNYQ+enTnsrnAzIudrA89EX3/AjY DhOgC1TfGFRACL7ph/009jxJ+I1731sFA8L5vUNwvfQrxXIc825zrQ4BqndERIObfuKh Sd1uv48q9skhcnUcy4tgTf79A0uVE72bEyUfL+5mD1LYBcZ4XyPgmgIelIMjyTlyIQ6x qjwg== X-Gm-Message-State: ALoCoQm9l5qX4u8CAIs6C3nE6CQFEyP+nqGYlbDu0Bdb6BfNHd8BrGKEkVjhQpZwNoZjArIPq8Vu X-Received: by 10.180.221.236 with SMTP id qh12mr2234942wic.4.1412174025317; Wed, 01 Oct 2014 07:33:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.66 with SMTP id o2ls175105laj.8.gmail; Wed, 01 Oct 2014 07:33:45 -0700 (PDT) X-Received: by 10.152.23.199 with SMTP id o7mr56199275laf.26.1412174025186; Wed, 01 Oct 2014 07:33:45 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com [209.85.215.49]) by mx.google.com with ESMTPS id k3si2056966lbd.26.2014.10.01.07.33.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 07:33:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id q1so468771lam.22 for ; Wed, 01 Oct 2014 07:33:45 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr52674851lbb.73.1412174024950; Wed, 01 Oct 2014 07:33: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 of9csp542183lbb; Wed, 1 Oct 2014 07:33:44 -0700 (PDT) X-Received: by 10.229.73.70 with SMTP id p6mr70859081qcj.13.1412174023543; Wed, 01 Oct 2014 07:33: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 m16si1923445qax.60.2014.10.01.07.33.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 01 Oct 2014 07:33:43 -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 1XZKyM-0004zA-1D; Wed, 01 Oct 2014 14:33:42 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XZKy8-0004yb-0c for lng-odp@lists.linaro.org; Wed, 01 Oct 2014 14:33:28 +0000 Received: by mail-lb0-f180.google.com with SMTP id f15so434097lbj.39 for ; Wed, 01 Oct 2014 07:33:22 -0700 (PDT) X-Received: by 10.152.7.145 with SMTP id j17mr55255322laa.77.1412174001910; Wed, 01 Oct 2014 07:33:21 -0700 (PDT) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id tl8sm460985lbb.47.2014.10.01.07.33.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Oct 2014 07:33:21 -0700 (PDT) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Wed, 1 Oct 2014 17:32:56 +0300 Message-Id: <1412173976-5238-3-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412173976-5238-1-git-send-email-ciprian.barbu@linaro.org> References: <1412173976-5238-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 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.215.49 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)