From patchwork Mon Nov 17 11:03:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 40905 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5592C2450C for ; Mon, 17 Nov 2014 11:05:53 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id c13sf610499eek.2 for ; Mon, 17 Nov 2014 03:05:52 -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: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=ayVxMY9P8MqQXhBZ1oRVcNErNRq4Xt2G7XjDaMdMtN8=; b=D/8h9KhHaNJDu1d0l1I8hSx+wmBA9hO2h31LqeL+Zk7vWjWD54YdY6ZQPEMDxPrBmS 1yfKDn2kFxEXYSO9mUSPtJsJG/FXz8skj5Fi5w/pB/kaFf9fcptKY/pXsRzyG9nmikdb Ku+DFOME5II8b/pG5MndqJkunWdhPoR0wfL4FajwsUfxjOQhnZmfK/+QpxBGbeJ9Yffo vF68kIGyPeqOpMsZ/xiSyT1WdzHXK8z8qloREe+gbBpWkS1UgYnSyya3PWN83zq/IKHd TdJuON50oL4cTEJsQM43zjY6+Z0MfNivjrye1qRiMRvXzZgvS8lBXipaN3oJnjUte2jQ yyPQ== X-Gm-Message-State: ALoCoQm84xoYIlCeOIgClH5vdj7j7cqeaWd8hcQj38VwB2YfSIq0hRYKiptO1UPpLlRXxTsmAP46 X-Received: by 10.181.13.80 with SMTP id ew16mr4268542wid.4.1416222352366; Mon, 17 Nov 2014 03:05:52 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.232 with SMTP id m8ls441163laa.45.gmail; Mon, 17 Nov 2014 03:05:52 -0800 (PST) X-Received: by 10.112.16.168 with SMTP id h8mr13251954lbd.41.1416222352105; Mon, 17 Nov 2014 03:05:52 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id g2si51429624laf.43.2014.11.17.03.05.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 03:05:52 -0800 (PST) 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 f15so16995587lbj.41 for ; Mon, 17 Nov 2014 03:05:52 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr26394726lad.44.1416222351974; Mon, 17 Nov 2014 03:05:51 -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 ew9csp1135386lbc; Mon, 17 Nov 2014 03:05:51 -0800 (PST) X-Received: by 10.140.41.166 with SMTP id z35mr32930487qgz.82.1416222350633; Mon, 17 Nov 2014 03:05:50 -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 w4si5635771qaw.120.2014.11.17.03.05.49 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 17 Nov 2014 03:05:50 -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 1XqK7v-0007iH-KX; Mon, 17 Nov 2014 11:05:47 +0000 Received: from mail-yk0-f180.google.com ([209.85.160.180]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XqK7o-0007i0-99 for lng-odp@lists.linaro.org; Mon, 17 Nov 2014 11:05:40 +0000 Received: by mail-yk0-f180.google.com with SMTP id 9so3897203ykp.25 for ; Mon, 17 Nov 2014 03:05:35 -0800 (PST) X-Received: by 10.236.209.198 with SMTP id s46mr694163yho.181.1416222335031; Mon, 17 Nov 2014 03:05:35 -0800 (PST) Received: from bala-PowerEdge-T110-II.caveonetworks.com ([111.93.218.67]) by mx.google.com with ESMTPSA id e35sm14927257yhq.45.2014.11.17.03.05.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 03:05:34 -0800 (PST) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Mon, 17 Nov 2014 16:33:39 +0530 Message-Id: <1416222221-17496-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [ODP/PATCHv1 1/3] Move pktio static inline functions into header file 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.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 This patch moves static inlines functions in odp_packet_io.c file into header file This patch adds classifier object inside pktio struct Signed-off-by: Balasubramanian Manoharan --- .../linux-generic/include/odp_packet_io_internal.h | 17 +++++++++++ platform/linux-generic/odp_packet_io.c | 34 ++++++---------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 23633ed..cc43cac 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -20,6 +20,7 @@ extern "C" { #include #include +#include /** * Packet IO types @@ -38,6 +39,7 @@ struct pktio_entry { 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 */ + classifier_t cls; }; typedef union { @@ -45,6 +47,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; + +static pktio_table_t *pktio_tbl; + + +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_tbl->entries[id - 1]; +} #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index f35193f..bbfb9be 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -21,22 +21,6 @@ #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]; -} - int odp_pktio_init_global(void) { char name[ODP_QUEUE_NAME_LEN]; @@ -57,7 +41,7 @@ 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 = get_pktio_entry(id); odp_spinlock_init(&pktio_entry->s.lock); @@ -139,7 +123,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; @@ -163,7 +147,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); ODP_DBG("ODP_PKTIO_USE_FANOUT: %d\n", fanout); if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMAP") == NULL) { @@ -212,7 +196,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; @@ -251,7 +235,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; @@ -289,7 +273,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) @@ -319,7 +303,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 = queue_to_qentry(queue); if (pktio_entry == NULL || qentry == NULL) @@ -349,7 +333,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; @@ -359,7 +343,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;