From patchwork Mon Jun 16 23:11:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 32006 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9814A206A0 for ; Mon, 16 Jun 2014 23:12:26 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id i13sf17715692veh.7 for ; Mon, 16 Jun 2014 16:12:26 -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: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=nDNmHOZyqBfpPbsuNtmn0Ap04p+0ifvdER8strfVD+g=; b=LjtHR1e2i2NxZj6fRe1Dt04XKmgRfPf9qSqK0KKUGccdQ7h0MW+ONlIXgED4LLHuBC 1zpXytYAFXXBBURm46ca1IKA0qjfXG3jk5mz6qz+bl2Fz8l3Re4JIfb0Y3D+Uabt6wiG 1r8x1cELUApZGypVSiu/QlpS66i8SZ3xcqrWC4ypZqzsQB2fVTFNzhlVUl+Ri7A/8cKt Kt870wGU2xsz/6qyE2GwSIuw27KPWBsBdlc0SiHyRPAnOWCRXpDrZ4+RMHim2BULI1Af V3dcEFy/lsQ1rKWB8iEQzGVQlzAAqgC7zJdgj6P2FSl4o/nYJTFTyTsopV1TVVNVVNbD Cmpg== X-Gm-Message-State: ALoCoQm0zzsB/rxwedkY7p4pgfI74wdSo19A4BIeRACONOrokAniG3FtSG3aa1dBQbkAPytqYih4 X-Received: by 10.58.29.67 with SMTP id i3mr2083419veh.3.1402960346182; Mon, 16 Jun 2014 16:12:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.36 with SMTP id k33ls668927qgk.40.gmail; Mon, 16 Jun 2014 16:12:26 -0700 (PDT) X-Received: by 10.52.246.42 with SMTP id xt10mr15318689vdc.5.1402960346042; Mon, 16 Jun 2014 16:12:26 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id o5si4671196vez.30.2014.06.16.16.12.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 16:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so5554201vcb.7 for ; Mon, 16 Jun 2014 16:12:26 -0700 (PDT) X-Received: by 10.58.132.41 with SMTP id or9mr18341877veb.5.1402960345917; Mon, 16 Jun 2014 16:12:25 -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.221.54.6 with SMTP id vs6csp169604vcb; Mon, 16 Jun 2014 16:12:25 -0700 (PDT) X-Received: by 10.58.243.1 with SMTP id wu1mr5979238vec.27.1402960345574; Mon, 16 Jun 2014 16:12:25 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id w4si4666168vct.72.2014.06.16.16.12.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 16:12:25 -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-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wwg30-0007TE-NN; Mon, 16 Jun 2014 23:10:42 +0000 Received: from mail-yh0-f46.google.com ([209.85.213.46]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wwg2v-0007T9-G1 for lng-odp@lists.linaro.org; Mon, 16 Jun 2014 23:10:37 +0000 Received: by mail-yh0-f46.google.com with SMTP id c41so4905419yho.19 for ; Mon, 16 Jun 2014 16:12:14 -0700 (PDT) X-Received: by 10.236.19.78 with SMTP id m54mr17162978yhm.134.1402960333929; Mon, 16 Jun 2014 16:12:13 -0700 (PDT) Received: from manoharan-Vostro-2520.caveonetworks.com (64.2.3.195.ptr.us.xo.net. [64.2.3.195]) by mx.google.com with ESMTPSA id e4sm23005164yhe.42.2014.06.16.16.12.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 16:12:13 -0700 (PDT) From: bala.manoharan@linaro.org To: lng-odp@lists.linaro.org Date: Mon, 16 Jun 2014 16:11:50 -0700 Message-Id: <1402960310-11288-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Topics: patch Subject: [lng-odp] [PATCH]ODP Buffer Management support for Scatter-gather list 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.220.176 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 From: Bala Manoharan This patch contains the initial draft of Buffer Management with support for scatter-gather list Regards, Bala Signed-off-by: Bala Manoharan --- include/odp_buffer.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/include/odp_buffer.h b/include/odp_buffer.h index d79e76d..c313168 100644 --- a/include/odp_buffer.h +++ b/include/odp_buffer.h @@ -92,6 +92,79 @@ int odp_buffer_is_valid(odp_buffer_t buf); */ void odp_buffer_print(odp_buffer_t buf); +/** +*Number of segments in this scatter-gather List +* +*@param buf Buffer Handle +* +*@return Total number of segments in this scatter-gather List. +* +**/ +int odp_buffer_segment_count(odp_buffer_t buf) + +/** +*Address of the segment in the buffer list. +* +*@param buf Buffer Handle +*@param n Index number for the segment in the SG list +*@param size Returns the size of the current addressable segment + +*@return Segment start address +**/ + +void* odp_buffer_segment_addr(odp_buffer_t buf, int n, size_t* size); + +/* +*Creates ODP Buffer from a memory region +* +*@param addr Address of the memory region +*@param size Size of the memory region +* +*@return Buffer Handle to the newly create odp buffer +*/ +odp_buffer_t odp_buffer_from_memory_region(void* addr, int size ); + +/** +* Merge Buffer list into a singe buffer +*@param buf Array of ODP Buffer Handles +*@param num Number of Buffers in the buf Array + +*@return Buffer Handle to the newly created odp buffer +**/ +odp_buffer_t odp_buffer_merge(odp_buffer_t[] buf, int num); + +/** +* Split a single Buffer into a list of odp buffers +* +*@param buf Buffer Handle +* +*@param size Maximum size of the individual buffers +* +*@return Array of newly created Buffer Handle +**/ +odp_buffer_t[] odp_buffer_split(odp_buffer_t buf, int size); + +/** +* Append a buffer at the end of a scatter-gather list of buffer +* +*@param buf Buffer Handle to the scatter-gather list of buffer +* +*@param tail Buffer Handle to the buffer which is appended +* +*@return 1 if success 0 otherwise +**/ +int odp_buffer_append(odp_buffer_t buf, odp_buffer_t tail ); + +/** +* Add a buffer at the head of a existing Scatter-gather Buffer +* +*@param buf Buffer Handle to the scatter-gather list of buffer +* +*@param head Buffer Handle to the buffer which is added at the head +* +*@return 1 if success 0 otherwise +**/ +int odp_buffer_insert_at_head(odp_buffer_t buf, odp_buffer_t head); #ifdef __cplusplus }