From patchwork Mon Dec 11 13:00:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 121398 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2760303qgn; Mon, 11 Dec 2017 05:02:12 -0800 (PST) X-Google-Smtp-Source: ACJfBosYyssmA4UdXr4fGszygdOto2JXmqUdF1y4pxkznmnyRgeMbaIjLPjXWSf95eD8EX2x22oq X-Received: by 10.37.203.198 with SMTP id b189mr207043ybg.72.1512997332579; Mon, 11 Dec 2017 05:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512997332; cv=none; d=google.com; s=arc-20160816; b=SYUyOUtEAOVJerHtW0kg1IN6jMm9a0cRAaB95Vhz7JabJhd0AK5su9F0bTXXTLp3Si +ePRDJeWwPNzz6bB0bPYEX0QEZnjd5Gzd33DisSiWl6yBVRe/xqA70mDHR0psKGlEihE w4A0Uj08oZ0nIuUpOJ6gjlTdw8YuHrYD/gMACYv6nomNE5i5iR2ucNTqLDxuC4n1+gXw N7w0eqsa1gNxl029Aio1OsFU7lzjrUFYGcd0OXBeFsLaUoE15quPB80ENgO47rXzibIu U4TvCIX40E6Yl9ofFfeKtxAThxmCd266oPF2O8cYYzAUYRrLOMX6xKGx5rDTwnwGykOW ME3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ePpOZmO4rmNh+CRIypJwEBR5YyA1L9Sx3LC80CDnOVw=; b=v4phTMMIj7gYFIqX12JmYIdCVxQPYBBBFgIc0DGVLrDb9oaXnvlrxM2w3jiLjosJcn ZbKXY6SjvBv2AJ8dafJohPSFxQ7cyQFc+Cn/pN5MUpKTBqID9D1U4C56tw/NcpCdN3fV 1AFprJ/no8Ih466YuWoNFFHXOI1U3Zg97iyRfKYEbKsuZ+oVblpOcvlZgOhbj1rGdF5J 3kAWku6cF6QfbqghQwyeY4bZvZRMqc7TdqQ9uAJJaHQ3mNb2i9duQj7pxVZm6D1RTSgo 1QPGBJbH3a18DJchAc9JRmgXFI8rIlHvR/m5TFMDS+fO7ThmFDHTfQgs4Wk9vyOd1DyJ 1Jyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o16si1325850qkl.21.2017.12.11.05.01.59; Mon, 11 Dec 2017 05:02:12 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id BE6776088A; Mon, 11 Dec 2017 13:01:59 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 F4098608DF; Mon, 11 Dec 2017 13:00:27 +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 0447960880; Mon, 11 Dec 2017 13:00:21 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 7B95860654 for ; Mon, 11 Dec 2017 13:00:14 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward104p.mail.yandex.net (Yandex) with ESMTP id D6EA6183848 for ; Mon, 11 Dec 2017 16:00:12 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 3qzuAlvSPc-0CBuvkCP; Mon, 11 Dec 2017 16:00:12 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lUqdMm89GC-0CIOWIDF; Mon, 11 Dec 2017 16:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 11 Dec 2017 16:00:09 +0300 Message-Id: <1512997210-20605-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512997210-20605-1-git-send-email-odpbot@yandex.ru> References: <1512997210-20605-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 333 Subject: [lng-odp] [PATCH API-NEXT v1 1/2] api: shm: name is optional 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" From: Petri Savolainen Align shared memory name parameter specification with other APIs. Name is optional and does not need to be unique, except when it's used for lookups. Signed-off-by: Petri Savolainen --- /** Email created from pull request 333 (psavol:next-shm-name) ** https://github.com/Linaro/odp/pull/333 ** Patch: https://github.com/Linaro/odp/pull/333.patch ** Base sha: 0980001e33b4190133d478a0aa2e718fd1e3c164 ** Merge commit sha: 543dc97f844948140c579c8f47f833a61ae7ec78 **/ include/odp/api/spec/shared_memory.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index 60a0cdde3..38c82a106 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -127,7 +127,14 @@ int odp_shm_capability(odp_shm_capability_t *capa); /** * Reserve a contiguous block of shared memory * - * @param name Name of the block (maximum ODP_SHM_NAME_LEN - 1 chars) + * Reserve a contiguous block of shared memory that fulfills size, alignment + * and shareability (ODP_SHM_* flags) requirements. In general, a name is + * optional and does not need to be unique. However, if the block will be + * searched with odp_shm_lookup() or odp_shm_import(), a unique name is needed + * for correct match. + * + * @param name Name of the block or NULL. Maximum string length is + * ODP_SHM_NAME_LEN. * @param size Block size in bytes * @param align Block alignment in bytes * @param flags Shared memory parameter flags (ODP_SHM_*). Default value is 0. From patchwork Mon Dec 11 13:00:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 121396 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2757488qgn; Mon, 11 Dec 2017 05:00:31 -0800 (PST) X-Google-Smtp-Source: ACJfBouwELdJtbtLHOBUFAXRf/SdVVt8sA1UGCW3chRjSPjc3IjaWuWdIx4JxR2Jvt/2oBtX9f9Z X-Received: by 10.200.33.185 with SMTP id 54mr408196qty.236.1512997231491; Mon, 11 Dec 2017 05:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512997231; cv=none; d=google.com; s=arc-20160816; b=zd87zrW8XvmHU4IzGopH9+4UKht2NNi1uArqQ+yPMhg5lL6bXZq5x79+kDbhLTPfzZ 6BhPbTveN8r1fB9003q0SmFHeEJd5Iob9ZhqvE/yDS2o6KgMly4clw/gQCUgmOqA7dcn AJD3GZ8Htf3Rm6Bm/A8ytZfBHBmCyhRJGvsJl4d7OsvGf9UPxa5r8996cz6BBpeN80Yl 9OPzFE34YAhCFTioQLttlCQkZqZ6YWO+n/ILo3q4YpvFvD9L+jkpXF1QLo42yg84vC3Y 6NlX7tTPvDDGvz0NTkxWkUlVJmy9FNUiwZA0yTEyvn6Xkaz5H04MTvw3KZsSKIXPLm/i jtdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=wy2O5E2pr7C6AwWDrT9jD1Nv5C4pBwQDnFEhphblVpg=; b=nF834i7BTfJwhuloTbwjx8VMVI4lnbSGsHTO4xdEcxTigy1C09NxR6Mf5/TCPqlHoD votuKwoscWmZft2zAu+IyWcNG6XgVpCPsDAbVe9vXueR5cF0EAfRPiWyFstxnWzxHScR ArT2x56Hy3Ne1zXoqyuDAsCLhqPtfTy4zq9BuPNzzvE2ufYdezyqiHZCCX4zCdV721DH dMPpKAxonnphUss/4qyJD8zHihPmPM/c9crb+TEzEO3WTci9YHXIUouTY15bqINTf6HQ WCAVNQz4W46QQtGtrfBORPcWwSFTP5Dmvh1CYml50eySOb9fqMqgbG8WBqmqEo2O4sOB S8Gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id h21si11232169qkh.216.2017.12.11.05.00.29; Mon, 11 Dec 2017 05:00:31 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E75BA608ED; Mon, 11 Dec 2017 13:00:28 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 51D6460825; Mon, 11 Dec 2017 13:00:24 +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 949F360888; Mon, 11 Dec 2017 13:00:16 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id E4B4760825 for ; Mon, 11 Dec 2017 13:00:14 +0000 (UTC) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 4BB1F781113 for ; Mon, 11 Dec 2017 16:00:13 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Z7nD5EKRvN-0D9SbG5h; Mon, 11 Dec 2017 16:00:13 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id lUqdMm89GC-0CIamXrZ; Mon, 11 Dec 2017 16:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 11 Dec 2017 16:00:10 +0300 Message-Id: <1512997210-20605-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512997210-20605-1-git-send-email-odpbot@yandex.ru> References: <1512997210-20605-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 333 Subject: [lng-odp] [PATCH API-NEXT v1 2/2] validation: shm: add name tests 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" From: Petri Savolainen Test shm blocks with NULL and maximum length names. Signed-off-by: Petri Savolainen --- /** Email created from pull request 333 (psavol:next-shm-name) ** https://github.com/Linaro/odp/pull/333 ** Patch: https://github.com/Linaro/odp/pull/333.patch ** Base sha: 0980001e33b4190133d478a0aa2e718fd1e3c164 ** Merge commit sha: 543dc97f844948140c579c8f47f833a61ae7ec78 **/ test/validation/api/shmem/shmem.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/test/validation/api/shmem/shmem.c b/test/validation/api/shmem/shmem.c index d1abc62bb..30eb08da0 100644 --- a/test/validation/api/shmem/shmem.c +++ b/test/validation/api/shmem/shmem.c @@ -136,24 +136,59 @@ void shmem_test_basic(void) odp_shm_t shm2; shared_test_data_t *shared_test_data; odp_cpumask_t unused; + int i; + char max_name[ODP_SHM_NAME_LEN]; + + for (i = 0; i < ODP_SHM_NAME_LEN; i++) + max_name[i] = 'A' + (i % 26); + + max_name[ODP_QUEUE_NAME_LEN - 1] = 0; + + /* NULL name */ + shm = odp_shm_reserve(NULL, + sizeof(shared_test_data_t), ALIGN_SIZE, 0); + CU_ASSERT(ODP_SHM_INVALID != shm); + shared_test_data = odp_shm_addr(shm); + CU_ASSERT_FATAL(NULL != shared_test_data); + shared_test_data->foo = 0; + CU_ASSERT(0 == odp_shm_free(shm)); + + /* Maximum length name */ + shm = odp_shm_reserve(max_name, + sizeof(shared_test_data_t), ALIGN_SIZE, 0); + CU_ASSERT(ODP_SHM_INVALID != shm); + shm2 = odp_shm_lookup(max_name); + CU_ASSERT(ODP_SHM_INVALID != shm2); + CU_ASSERT(odp_shm_addr(shm) == odp_shm_addr(shm2)); + shared_test_data = odp_shm_addr(shm); + CU_ASSERT_FATAL(NULL != shared_test_data); + shared_test_data->foo = 0; + CU_ASSERT(0 == odp_shm_free(shm)); + /* Non-unique name */ shm = odp_shm_reserve(MEM_NAME, sizeof(shared_test_data_t), ALIGN_SIZE, 0); CU_ASSERT(ODP_SHM_INVALID != shm); CU_ASSERT(odp_shm_to_u64(shm) != odp_shm_to_u64(ODP_SHM_INVALID)); - - /* also check that another reserve with same name is accepted: */ shm2 = odp_shm_reserve(MEM_NAME, sizeof(shared_test_data_t), ALIGN_SIZE, 0); CU_ASSERT(ODP_SHM_INVALID != shm2); CU_ASSERT(odp_shm_to_u64(shm2) != odp_shm_to_u64(ODP_SHM_INVALID)); + CU_ASSERT(odp_shm_addr(shm) != odp_shm_addr(shm2)); + shared_test_data = odp_shm_addr(shm); + CU_ASSERT_FATAL(NULL != shared_test_data); + shared_test_data->foo = 0; + shared_test_data = odp_shm_addr(shm2); + CU_ASSERT_FATAL(NULL != shared_test_data); + shared_test_data->foo = 0; CU_ASSERT(0 == odp_shm_free(shm)); CU_ASSERT(0 == odp_shm_free(shm2)); CU_ASSERT(ODP_SHM_INVALID == odp_shm_lookup(MEM_NAME)); + /* Share with multiple threads */ shm = odp_shm_reserve(MEM_NAME, sizeof(shared_test_data_t), ALIGN_SIZE, 0); CU_ASSERT(ODP_SHM_INVALID != shm);