From patchwork Mon May 16 09:50:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 67840 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1445063qge; Mon, 16 May 2016 02:52:43 -0700 (PDT) X-Received: by 10.140.227.199 with SMTP id x190mr29063932qhb.15.1463392362850; Mon, 16 May 2016 02:52:42 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 76si22192252qhu.2.2016.05.16.02.52.42; Mon, 16 May 2016 02:52:42 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 8D85761644; Mon, 16 May 2016 09:52:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 2679B61737; Mon, 16 May 2016 09:50:37 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 74D316172B; Mon, 16 May 2016 09:50:26 +0000 (UTC) Received: from demumfd001.nsn-inter.net (demumfd001.nsn-inter.net [93.183.12.32]) by lists.linaro.org (Postfix) with ESMTPS id 65A3061640 for ; Mon, 16 May 2016 09:50:23 +0000 (UTC) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd001.nsn-inter.net (8.15.2/8.15.2) with ESMTPS id u4G9oLo5023573 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 May 2016 09:50:22 GMT Received: from 10.144.19.15 ([10.144.104.109]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id u4G9oKq1017285 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 16 May 2016 11:50:21 +0200 From: Matias Elo To: lng-odp@lists.linaro.org Date: Mon, 16 May 2016 12:50:19 +0300 Message-Id: <1463392220-22856-5-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463392220-22856-1-git-send-email-matias.elo@nokia.com> References: <1463392220-22856-1-git-send-email-matias.elo@nokia.com> X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 2753 X-purgate-ID: 151667::1463392222-00001B3D-74440741/0/0 X-Topics: patch Subject: [lng-odp] [PATCH v2 4/5] linux-generic: buffer: ifdef ipc_addr_offset member from odp_buffer_hdr_t X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" Define ipc_addr_offset member of struct odp_buffer_hdr_t only if ipc pktio is enabled to reduce struct size. Signed-off-by: Matias Elo --- platform/linux-generic/include/odp_buffer_internal.h | 8 +++++--- platform/linux-generic/pktio/ipc.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 727abb4..47f41c6 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -132,9 +132,6 @@ struct odp_buffer_hdr_t { uint32_t uarea_size; /* size of user area */ uint32_t segcount; /* segment count */ uint32_t segsize; /* segment size */ - /* ipc mapped process can not walk over pointers, - * offset has to be used */ - uint64_t ipc_addr_offset[ODP_BUFFER_MAX_SEG]; void *addr[ODP_BUFFER_MAX_SEG]; /* block addrs */ uint64_t order; /* sequence for ordered queues */ queue_entry_t *origin_qe; /* ordered queue origin */ @@ -142,6 +139,11 @@ struct odp_buffer_hdr_t { queue_entry_t *target_qe; /* ordered queue target */ uint64_t sync[ODP_CONFIG_MAX_ORDERED_LOCKS_PER_QUEUE]; }; +#ifdef _ODP_PKTIO_IPC + /* ipc mapped process can not walk over pointers, + * offset has to be used */ + uint64_t ipc_addr_offset[ODP_BUFFER_MAX_SEG]; +#endif }; /** @internal Compile time assert that the diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index 12cc286..f1cd21c 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -436,8 +436,15 @@ static inline void *_ipc_buffer_map(odp_buffer_hdr_t *buf, { int seg_index = offset / buf->segsize; int seg_offset = offset % buf->segsize; +#ifdef _ODP_PKTIO_IPC void *addr = (char *)buf - buf->ipc_addr_offset[seg_index]; +#else + /** buf_hdr.ipc_addr_offset defined only when ipc is + * enabled. */ + void *addr = NULL; + (void)seg_index; +#endif if (seglen) { uint32_t buf_left = limit - offset; *seglen = seg_offset + buf_left <= buf->segsize ? @@ -631,8 +638,14 @@ static int ipc_pktio_send(pktio_entry_t *pktio_entry, * convert it to offset */ for (j = 0; j < ODP_BUFFER_MAX_SEG; j++) { +#ifdef _ODP_PKTIO_IPC pkt_hdr->buf_hdr.ipc_addr_offset[j] = (char *)pkt_hdr - (char *)pkt_hdr->buf_hdr.addr[j]; +#else + /** buf_hdr.ipc_addr_offset defined only when ipc is + * enabled. */ + (void)pkt_hdr; +#endif } }