From patchwork Sat Dec 6 03:59:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 41988 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 179B626667 for ; Sat, 6 Dec 2014 04:01:13 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf182601wiv.5 for ; Fri, 05 Dec 2014 20:01:12 -0800 (PST) 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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=7LqLDl6dbrx5WhuKcYEyWLRZsWs6P7PmbspWunZklAk=; b=nFntd6fKgw1DyshSn+3EdhXIdcVec1DIgI9PLGfhI27BwX+xY5z4P8Bsb0gdAmxRYv z/mbcLU1xcJjqjVh7Ujs0NYsnqI/u4+cDSEHm181EFPFMcINk7JAZJPo3vzV1BJivbG3 KipZ28212ITUDPA1mbR/hHl3f6sO21nnD6wSp2K1MwiSsYRxi06fzAg5cpwRz9Hp6DE5 Kbj8HbqUh+3AAOdpMasXo1fXeeBjD+0egZMXoM0rElFhgzSxeok6QAnOTXSA8UNW9ybP 8hXEVRy6uAv2aQNBddXzsDYkMIKb0/38zRbWPhL/BlRz7SVpA4PPfCcY37Axa966svm/ vsbw== X-Gm-Message-State: ALoCoQloN5yZuYp68J0LLjKthZLxVVCch7GtU0y/wYiRwuJgp1D/Z/qQk3LaP8TXyKgQyjJfy21I X-Received: by 10.194.178.163 with SMTP id cz3mr4128427wjc.1.1417838472410; Fri, 05 Dec 2014 20:01:12 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.163 with SMTP id ej3ls430088lad.94.gmail; Fri, 05 Dec 2014 20:01:12 -0800 (PST) X-Received: by 10.152.5.198 with SMTP id u6mr6088448lau.42.1417838472181; Fri, 05 Dec 2014 20:01:12 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id x8si30605085lax.57.2014.12.05.20.01.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Dec 2014 20:01:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so1688518lab.13 for ; Fri, 05 Dec 2014 20:01:12 -0800 (PST) X-Received: by 10.152.43.12 with SMTP id s12mr5738759lal.67.1417838471947; Fri, 05 Dec 2014 20:01:11 -0800 (PST) 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.184.201 with SMTP id ew9csp328082lbc; Fri, 5 Dec 2014 20:01:11 -0800 (PST) X-Received: by 10.224.14.133 with SMTP id g5mr32029319qaa.81.1417838470483; Fri, 05 Dec 2014 20:01:10 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id a8si36991264qcs.23.2014.12.05.20.01.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Dec 2014 20:01:10 -0800 (PST) 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 1Xx6YN-0000GK-Ri; Sat, 06 Dec 2014 04:01:07 +0000 Received: from mail-yk0-f178.google.com ([209.85.160.178]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xx6YF-0000Eo-WF for lng-odp@lists.linaro.org; Sat, 06 Dec 2014 04:01:00 +0000 Received: by mail-yk0-f178.google.com with SMTP id 20so896862yks.9 for ; Fri, 05 Dec 2014 20:00:54 -0800 (PST) X-Received: by 10.236.62.228 with SMTP id y64mr22053010yhc.106.1417838454791; Fri, 05 Dec 2014 20:00:54 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id o38sm19111734yhp.34.2014.12.05.20.00.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Dec 2014 20:00:54 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Sat, 6 Dec 2014 09:29:41 +0530 Message-Id: <1417838383-3215-2-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417838383-3215-1-git-send-email-bala.manoharan@linaro.org> References: <1417838383-3215-1-git-send-email-bala.manoharan@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v5 2/3] linux-generic:pktio:move static inline functions to header 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: bala.manoharan@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.54 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 Moves static inline access functions in pktio module to header file. This changes is required as these functions are accessed by classification module Signed-off-by: Balasubramanian Manoharan Reviewed-by: Bill Fischofer --- .../linux-generic/include/odp_packet_io_internal.h | 17 ++++++++++ platform/linux-generic/odp_packet_io.c | 38 ++++++++-------------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 7819dc7..d129f22 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -22,6 +22,8 @@ extern "C" { #include #include +#include +#include #include /** @@ -50,6 +52,21 @@ typedef union { uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(struct pktio_entry))]; } pktio_entry_t; +typedef struct { + pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES]; +} pktio_table_t; + +extern void *pktio_entry_ptr[]; + + +static inline pktio_entry_t *get_pktio_entry(odp_pktio_t id) +{ + if (odp_unlikely(id == ODP_PKTIO_INVALID || + id > ODP_CONFIG_PKTIO_ENTRIES)) + return NULL; + + return pktio_entry_ptr[id - 1]; +} #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 7e3eca2..19b9eea 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -22,21 +22,10 @@ #include #include -typedef struct { - pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES]; -} pktio_table_t; - static pktio_table_t *pktio_tbl; - -static pktio_entry_t *get_entry(odp_pktio_t id) -{ - if (odp_unlikely(id == ODP_PKTIO_INVALID || - id > ODP_CONFIG_PKTIO_ENTRIES)) - return NULL; - - return &pktio_tbl->entries[id - 1]; -} +/* pktio pointer entries ( for inlines) */ +void *pktio_entry_ptr[ODP_CONFIG_PKTIO_ENTRIES]; int odp_pktio_init_global(void) { @@ -58,10 +47,11 @@ int odp_pktio_init_global(void) memset(pktio_tbl, 0, sizeof(pktio_table_t)); for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) { - pktio_entry = get_entry(id); + pktio_entry = &pktio_tbl->entries[id - 1]; odp_spinlock_init(&pktio_entry->s.lock); + pktio_entry_ptr[id - 1] = pktio_entry; /* Create a default output queue for each pktio resource */ snprintf(name, sizeof(name), "%i-pktio_outq_default", (int)id); name[ODP_QUEUE_NAME_LEN-1] = '\0'; @@ -140,7 +130,7 @@ static odp_pktio_t alloc_lock_pktio_entry(void) static int free_pktio_entry(odp_pktio_t id) { - pktio_entry_t *entry = get_entry(id); + pktio_entry_t *entry = get_pktio_entry(id); if (entry == NULL) return -1; @@ -164,7 +154,7 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) } /* if successful, alloc_pktio_entry() returns with the entry locked */ - pktio_entry = get_entry(id); + pktio_entry = get_pktio_entry(id); if (!pktio_entry) return ODP_PKTIO_INVALID; @@ -216,7 +206,7 @@ int odp_pktio_close(odp_pktio_t id) pktio_entry_t *entry; int res = -1; - entry = get_entry(id); + entry = get_pktio_entry(id); if (entry == NULL) return -1; @@ -255,7 +245,7 @@ odp_pktio_t odp_pktio_get_input(odp_packet_t pkt) int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) { - pktio_entry_t *pktio_entry = get_entry(id); + pktio_entry_t *pktio_entry = get_pktio_entry(id); int pkts; int i; @@ -293,7 +283,7 @@ int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) { - pktio_entry_t *pktio_entry = get_entry(id); + pktio_entry_t *pktio_entry = get_pktio_entry(id); int pkts; if (pktio_entry == NULL) @@ -323,7 +313,7 @@ int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len) int odp_pktio_inq_setdef(odp_pktio_t id, odp_queue_t queue) { - pktio_entry_t *pktio_entry = get_entry(id); + pktio_entry_t *pktio_entry = get_pktio_entry(id); queue_entry_t *qentry; if (pktio_entry == NULL || queue == ODP_QUEUE_INVALID) @@ -355,7 +345,7 @@ int odp_pktio_inq_remdef(odp_pktio_t id) odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id) { - pktio_entry_t *pktio_entry = get_entry(id); + pktio_entry_t *pktio_entry = get_pktio_entry(id); if (pktio_entry == NULL) return ODP_QUEUE_INVALID; @@ -365,7 +355,7 @@ odp_queue_t odp_pktio_inq_getdef(odp_pktio_t id) odp_queue_t odp_pktio_outq_getdef(odp_pktio_t id) { - pktio_entry_t *pktio_entry = get_entry(id); + pktio_entry_t *pktio_entry = get_pktio_entry(id); if (pktio_entry == NULL) return ODP_QUEUE_INVALID; @@ -495,7 +485,7 @@ int odp_pktio_set_mtu(odp_pktio_t id, int mtu) return -1; } - entry = get_entry(id); + entry = get_pktio_entry(id); if (entry == NULL) { ODP_DBG("pktio entry %d does not exist\n", id); return -1; @@ -525,7 +515,7 @@ int odp_pktio_mtu(odp_pktio_t id) struct ifreq ifr; int ret; - entry = get_entry(id); + entry = get_pktio_entry(id); if (entry == NULL) { ODP_DBG("pktio entry %d does not exist\n", id); return -1;