From patchwork Tue Oct 18 11:56:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 77993 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp824498qge; Tue, 18 Oct 2016 04:06:09 -0700 (PDT) X-Received: by 10.55.119.197 with SMTP id s188mr1768464qkc.44.1476788769287; Tue, 18 Oct 2016 04:06:09 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e124si10890011qkf.202.2016.10.18.04.06.09; Tue, 18 Oct 2016 04:06:09 -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=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B7025607BE; Tue, 18 Oct 2016 11:06:08 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 C9477611FB; Tue, 18 Oct 2016 10:59:00 +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 C25B860EC4; Tue, 18 Oct 2016 10:58:50 +0000 (UTC) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id 0CF4860DCE for ; Tue, 18 Oct 2016 10:57:41 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id b75so341083999lfg.3 for ; Tue, 18 Oct 2016 03:57:40 -0700 (PDT) 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=1lfFDvMiFKsmfmkYp4Yq2xbrQU95y9xUtrNLu/P2pnA=; b=mkIFct54/jvPPI16FPENe1Pwfv6ZTTqQCcxhdHczaD2OHJMW1ZGOgSXlJhLnslcF1I 6juWy/aI0i/FwxhmTPiUWIJ22IaRETtBRwlQh8rdFseTjhRR66E3+cEJQYKu6rGbxCkh Fua9/MtoF7qRG7LJMguYwVwq2F63OLuOez3ob8msYbDZzMrUBpmCHnOGL0masXJpWJc2 k+OwuT8D7KnZx3ssn7BUHYZ2Zp/Egq0NxMV/35kLlK2R63zQ9D+qBglkCVrct46h/ixE yLcG04wdqeUXKcvHT5H2Xdx/LEd79ZATJf73d0V4kDgR7yUlvU8xWRl1kOvCbR18VlPr 5+rQ== X-Gm-Message-State: AA6/9Rn3yfRZjw5f1j+Et+pHuGlSY0Le/Mxtsu3TOFihN0fnLZf6YeR/tUbd8PfaG4L50NIfAbY= X-Received: by 10.25.198.9 with SMTP id w9mr20921845lff.164.1476788259816; Tue, 18 Oct 2016 03:57:39 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id 204sm3879424ljj.47.2016.10.18.03.57.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 03:57:39 -0700 (PDT) From: Christophe Milard To: mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Tue, 18 Oct 2016 13:56:42 +0200 Message-Id: <1476791808-29363-11-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476791808-29363-1-git-send-email-christophe.milard@linaro.org> References: <1476791808-29363-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 10/16] api: shmem: add flag and function to share memory between ODP instances 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The flag ODP_SHM_EXPORT is added: when passed at odp_shm_reserve() time the memory block becomes visible to other ODP instances. The function odp_shm_reserve_exported() is added: this function enables to reserve block of memories exported by other ODP instances (using the ODP_SHM_EXPORT flag). Signed-off-by: Christophe Milard --- include/odp/api/spec/shared_memory.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.7.4 diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index fe683d4..1b4d068 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -14,6 +14,7 @@ #ifndef ODP_API_SHARED_MEMORY_H_ #define ODP_API_SHARED_MEMORY_H_ #include +#include #ifdef __cplusplus extern "C" { @@ -49,6 +50,7 @@ extern "C" { #define ODP_SHM_PROC 0x2 /**< Share with external processes */ #define ODP_SHM_SINGLE_VA 0x4 /**< guarantee unique addr on all threads*/ #define ODP_SHM_LOCK 0x8 /**< prevent swapping this memory */ +#define ODP_SHM_EXPORT 0x10 /**< share with other ODP instances */ /** * Shared memory block info @@ -135,6 +137,23 @@ int odp_shm_free(odp_shm_t shm); */ odp_shm_t odp_shm_lookup(const char *name); +/** + * get and reserve a block of shared memory, exported by another ODP instance + * + * @param[in] remote_name Name of the block, in the remote ODP instance + * @param[in] odp_inst Remote ODP instance, as returned by odp_init_global() + * @param[in] local_name Name given to the block, in the local ODP instance + * @param[in] align Block alignment in bytes + * @param[in] flags Shared memory parameter flags (ODP_SHM_*). + * Default value is 0. + * + * @return A new handle to the block if it is found (must be freed when done). + * @retval ODP_SHM_INVALID on failure + */ +odp_shm_t odp_shm_reserve_exported(const char *remote_name, + odp_instance_t odp_inst, + const char *local_name, + uint64_t align, uint32_t flags); /** * Shared memory block address