From patchwork Fri Jan 8 20:29:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 59386 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp749103lbb; Fri, 8 Jan 2016 11:32:53 -0800 (PST) X-Received: by 10.55.204.135 with SMTP id n7mr94119323qkl.36.1452281573381; Fri, 08 Jan 2016 11:32:53 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 130si94836692qhw.52.2016.01.08.11.32.52; Fri, 08 Jan 2016 11:32:53 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1597161CB2; Fri, 8 Jan 2016 19:32:52 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=aZifjl3L; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 E17CC61765; Fri, 8 Jan 2016 19:31:39 +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 973406167C; Fri, 8 Jan 2016 19:31:35 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by lists.linaro.org (Postfix) with ESMTPS id 528F461665 for ; Fri, 8 Jan 2016 19:31:34 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id bc4so229214664lbc.2 for ; Fri, 08 Jan 2016 11:31:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IuX32mEQzTOc3xnpD7daoWke73ZPdzxEr7F4Vza5FkI=; b=aZifjl3LawEpWhTATZeyj3pvxKI0EKGP86qbM5dhSMibQ4sMwlRidSa0UEfyHXsJgS uOQqPjJwJPkj3m9djAGfFxprtmeV4o/hmMxxWHrbjE8mYk8rg4AEMoovqmmN/241Kg8e zUijiThSxujnskSZh2hvD5giODXwHqrwtBAGo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IuX32mEQzTOc3xnpD7daoWke73ZPdzxEr7F4Vza5FkI=; b=f0bgOUK+XCT6SEOhRkC0EE7qtMQZ0MvAW9r1B9dBbyvQV9vfbXqtsc6DS0GIRCJqGT q77Ya1ehL46It/EJ3Kq3xsdM15ohMS5JVJWq105OKlWg8T8BucahLIQhsjplmB4FSfgp ZIYaG/ytdf0mEw7ADcvKbjEbHz6te9GGLokHL4LZmPnVtI1NQsa9p98wpK5GTnlJNPA4 9Ce42FxiPmSwoxRLX2GfqBdvcnqrY3A8Qzlma6PeM5QC3vbfyukJ4C9auyJ0lnGk7c/U q5OQnLlQZwa2n8HBFcTuuTyaC9UGmblr5rXTb2Foa3Coz+OJIVOTvgb1EPDmUGnh8S0m bDqQ== X-Gm-Message-State: ALoCoQm/3Ewnk/FaqlQKk4eKj9mQwJMuOgaLMlxe5WSiATZB5nURBN1robSnRzK8GF1qPBaIDeL/lqdaYRLkh7mNyUeNuPRZSw== X-Received: by 10.112.135.39 with SMTP id pp7mr3599052lbb.43.1452281493288; Fri, 08 Jan 2016 11:31:33 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id l204sm2085534lfg.49.2016.01.08.11.31.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jan 2016 11:31:32 -0800 (PST) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org, bill.fischofer@linaro.org, petri.savolainen@linaro.org, edavis@broadcom.com Date: Fri, 8 Jan 2016 21:29:44 +0100 Message-Id: <1452285014-60320-2-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452285014-60320-1-git-send-email-christophe.milard@linaro.org> References: <1452285014-60320-1-git-send-email-christophe.milard@linaro.org> Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [API-NEXT RFC 01/31] api: dma: defining the dma region descriptor 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" A DMA region descriptor is an object defining a contiguous DMA region. DMA descriptors can be chained to describe scattered regions. (The DMA mapping function itself will be defined as a PCI function, as the DMA is a PCI device) Note that this file is not included in include/odp.h as it does not belong to the ODP-application interface. Signed-off-by: Christophe Milard --- include/odp/api/dma.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 include/odp/api/dma.h diff --git a/include/odp/api/dma.h b/include/odp/api/dma.h new file mode 100644 index 0000000..2cabcec --- /dev/null +++ b/include/odp/api/dma.h @@ -0,0 +1,102 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * DMA descriptor and related operations. + */ + +#ifndef ODP_API_DMA_H_ +#define ODP_API_DMA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @defgroup odp_dma DMA + * @{ + */ + +/** + * @typedef odp_dma_addr_t + * DMA address (iether physical or iova) + */ + +/** + * @typedef odp_dma_map_t + * DMA map region descriptor + * DMA map region descriptors are returned by ODP (on request) and describe + * how a DMA mapping should be done to access a given resource + * (sucha as a packet pool or a memory area). + * If needed (i.e. if the DMA region is scattered), the returned region can + * link to others (odp_dma_map_get_next() then returns valid region(s)), hence + * allowing a scattered region to be described. + * Regions descriptor are used to request DMA mapping for NIC devices. + * Region descriptors must be released using odp_dma_map_free(). + */ + +/** + * @def ODP_DMA_REG_INVALID + * Invalid DMA region + */ + +/* operations on DMA maps: */ + +/** + * Get the DMA region user address. + * + * @param an ODP DMA region descriptor + * + * @retval the virtual userland address for the region + */ +void *odp_dma_map_get_addr(odp_dma_map_t map); + +/** + * Get the DMA region DMA address. + * + * @param an ODP DMA region descriptor + * + * @retval the DMA address (i.e. physical or iova) for the region + */ +odp_dma_addr_t odp_dma_map_get_dma_addr(odp_dma_map_t map); + +/** + * Get the DMA region size. + * + * @param an ODP DMA region descriptor + * + * @retval size (in bytes) for the region + */ +int odp_dma_map_get_size(odp_dma_map_t map); + +/** + * Get the following region (if any). + * + * @param an ODP DMA region descriptor + * + * @retval a DMA region descriptor describing the next fragment + * (if any) of a scattered region. Returns ODP_DMA_REG_INVALID if none. + */ +odp_dma_map_t odp_dma_map_get_next(odp_dma_map_t map); + +/** + * Free a region descriptor. The region must be unmapped first. + * + * @param an unmapped ODP DMA region descriptor + * + */ +void odp_dma_map_free(odp_dma_map_t map); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ODP_API_DMA_H_ */