From patchwork Wed Jan 14 22:48:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 43130 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 916AA240B9 for ; Wed, 14 Jan 2015 22:49:28 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf6241878lab.3 for ; Wed, 14 Jan 2015 14:49:27 -0800 (PST) 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:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=4ru+WfhBPjDWsmUzvSd3LtzS8/dXzh77boyzKRzzl7Y=; b=SHReouBZLMNsYskT8iK8AGcd8jUeQsiP9GOPJUnUD4hZDaDBdZBVFduHNppTwTRwpA mmxmayCG+mJVuOm/qtizdY/lEuoSdd7egypDhShuTZ6rk2p1IDxD16BoIwZCYaGdFDH4 k+xZeE2nkc85PU4iiFlThs5bNfgXsbusEfJ+PpamOQo4Q23Ne9VN0FR+U4sjG2MwU3IW fucC7k4jySKxs7+wuK/bHCjG/K5VOSsyMXEQv5eagysM6hVMuAgQBYmuaI7W1v6sRuka dZP28VcErUQenivKvmUWc/QaBXeszAs+GoeavX/kCN5onoRME4Ic5pbrf4VxYvFhX8pH S3Aw== X-Gm-Message-State: ALoCoQlOa1CmwI1EeqyYeMtOnqi3JBHMsTPgAqXUsR3A473/Zu1dSbd8axDvlGDzGVFLOnbyYbAw X-Received: by 10.112.154.232 with SMTP id vr8mr637235lbb.10.1421275767579; Wed, 14 Jan 2015 14:49:27 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.226 with SMTP id kt2ls177960lac.52.gmail; Wed, 14 Jan 2015 14:49:27 -0800 (PST) X-Received: by 10.152.5.67 with SMTP id q3mr6449329laq.73.1421275767416; Wed, 14 Jan 2015 14:49:27 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id l8si7294334lag.2.2015.01.14.14.49.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Jan 2015 14:49:27 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id ge10so994528lab.5 for ; Wed, 14 Jan 2015 14:49:27 -0800 (PST) X-Received: by 10.152.6.132 with SMTP id b4mr6568317laa.59.1421275767311; Wed, 14 Jan 2015 14:49:27 -0800 (PST) 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.112.9.200 with SMTP id c8csp1845578lbb; Wed, 14 Jan 2015 14:49:26 -0800 (PST) X-Received: by 10.229.79.69 with SMTP id o5mr8669825qck.13.1421275765452; Wed, 14 Jan 2015 14:49:25 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id q89si33077590qgd.39.2015.01.14.14.49.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 14 Jan 2015 14:49:25 -0800 (PST) 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-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBWkc-0000Cf-35; Wed, 14 Jan 2015 22:49:22 +0000 Received: from mail-la0-f44.google.com ([209.85.215.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YBWkW-0000An-Ac for lng-odp@lists.linaro.org; Wed, 14 Jan 2015 22:49:16 +0000 Received: by mail-la0-f44.google.com with SMTP id gd6so10813290lab.3 for ; Wed, 14 Jan 2015 14:49:10 -0800 (PST) X-Received: by 10.152.5.7 with SMTP id o7mr6590416lao.26.1421275750686; Wed, 14 Jan 2015 14:49:10 -0800 (PST) Received: from localhost (c-853670d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.54.133]) by mx.google.com with ESMTPSA id i5sm2166272lae.26.2015.01.14.14.49.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jan 2015 14:49:10 -0800 (PST) From: Anders Roxell To: lng-odp@lists.linaro.org Date: Wed, 14 Jan 2015 23:48:18 +0100 Message-Id: <1421275706-11176-2-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421275706-11176-1-git-send-email-anders.roxell@linaro.org> References: <1421275706-11176-1-git-send-email-anders.roxell@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 1/9] api: cpumask: rename API and use CPU_SET(3) for impl 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: anders.roxell@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.215.46 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: Robbie King Rename odp_coremask to odp_cpumask and implement with use of the cpu_set_t data structure (CPU_SET(3)). Signed-off-by: Robbie King Signed-off-by: Anders Roxell --- platform/linux-generic/Makefile.am | 4 +- platform/linux-generic/include/api/odp.h | 2 +- platform/linux-generic/include/api/odp_coremask.h | 188 ---------------------- platform/linux-generic/include/api/odp_cpumask.h | 137 ++++++++++++++++ platform/linux-generic/odp_coremask.c | 109 ------------- platform/linux-generic/odp_cpumask.c | 175 ++++++++++++++++++++ test/api_test/odp_common.c | 8 +- 7 files changed, 319 insertions(+), 304 deletions(-) delete mode 100644 platform/linux-generic/include/api/odp_coremask.h create mode 100644 platform/linux-generic/include/api/odp_cpumask.h delete mode 100644 platform/linux-generic/odp_coremask.c create mode 100644 platform/linux-generic/odp_cpumask.c diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 4535c57..a699ea6 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -16,7 +16,7 @@ include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp_classification.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_compiler.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_config.h \ - $(top_srcdir)/platform/linux-generic/include/api/odp_coremask.h \ + $(top_srcdir)/platform/linux-generic/include/api/odp_cpumask.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_crypto.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_debug.h \ $(top_srcdir)/platform/linux-generic/include/api/odp_hints.h \ @@ -78,7 +78,7 @@ __LIB__libodp_la_SOURCES = \ odp_buffer.c \ odp_buffer_pool.c \ odp_classification.c \ - odp_coremask.c \ + odp_cpumask.c \ odp_crypto.c \ odp_init.c \ odp_impl.c \ diff --git a/platform/linux-generic/include/api/odp.h b/platform/linux-generic/include/api/odp.h index b7b1ca9..1cc7ce0 100644 --- a/platform/linux-generic/include/api/odp.h +++ b/platform/linux-generic/include/api/odp.h @@ -27,7 +27,7 @@ extern "C" { #include #include #include -#include +#include #include #include #include diff --git a/platform/linux-generic/include/api/odp_coremask.h b/platform/linux-generic/include/api/odp_coremask.h deleted file mode 100644 index c9331fd..0000000 --- a/platform/linux-generic/include/api/odp_coremask.h +++ /dev/null @@ -1,188 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP core masks and enumeration - */ - -#ifndef ODP_COREMASK_H_ -#define ODP_COREMASK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - - -#include - -/** @addtogroup odp_scheduler - * Core mask operations. - * @{ - */ - -/** @internal */ -#define ODP_COREMASK_SIZE_U64 1 - -/** - * Core mask - * - * Don't access directly, use access functions. - */ -typedef struct odp_coremask_t { - uint64_t _u64[ODP_COREMASK_SIZE_U64]; /**< @private Mask*/ - -} odp_coremask_t; - - - -/** - * Add core mask bits from a string - * - * @param str Hexadecimal digits in a string. Core #0 is located - * at the least significant bit (0x1). - * @param mask Core mask to modify - * - * @note Supports currently only core indexes upto 63 - */ -void odp_coremask_from_str(const char *str, odp_coremask_t *mask); - -/** - * Write core mask as a string of hexadecimal digits - * - * The result will be prefixed with 0x and will be in hexadecimal - * - * @param str String for output - * @param len Size of string length (incl. ending zero) - * @param mask Core mask - * - * @note Supports currently only core indexes upto 63 - */ -void odp_coremask_to_str(char *str, int len, const odp_coremask_t *mask); - - -/** - * Add core mask bits from a u64 array - * - * In the array core #0 is located at the least significant bit - * of the first word (u64[0] = 0x1). - * - * Examples - * - core 0: u64[0] = 0x1 - * - core 1: u64[0] = 0x2 - * - ... - * - core 63: u64[0] = 0x8000 0000 0000 0000 - * - core 64: u64[0] = 0x0, u64[1] = 0x1 - * - core 65: u64[0] = 0x0, u64[1] = 0x2 - * - * @param u64 An array of u64 bit words - * @param num Number of u64 words in the array - * @param mask Core mask to modify - * - * @note Supports currently only core indexes upto 63 - */ -void odp_coremask_from_u64(const uint64_t *u64, int num, odp_coremask_t *mask); - -/** - * Clear entire mask - * @param mask Core mask to flush with zero value - */ -static inline void odp_coremask_zero(odp_coremask_t *mask) -{ - mask->_u64[0] = 0; -} - -/** - * Add core to mask - * @param core Core number - * @param mask add core number in core mask - */ -void odp_coremask_set(int core, odp_coremask_t *mask); - -/** - * Remove core from mask - * @param core Core number - * @param mask clear core number from core mask - */ -void odp_coremask_clr(int core, odp_coremask_t *mask); - -/** - * Test if core is a member of mask - * @param core Core number - * @param mask Core mask to check if core num set or not - * @return non-zero if set otherwise 0 - */ -int odp_coremask_isset(int core, const odp_coremask_t *mask); - -/** - * Count number of cores in mask - * @param mask Core mask - * @return coremask count - */ -int odp_coremask_count(const odp_coremask_t *mask); - - - -/** - * Logical AND over two source masks. - * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 - */ -static inline void odp_coremask_and(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] & src2->_u64[0]; -} - -/** - * Logical OR over two source masks. - * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 - */ -static inline void odp_coremask_or(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] | src2->_u64[0]; -} - -/** - * Logical XOR over two source masks. - * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 - */ -static inline void odp_coremask_xor(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] ^ src2->_u64[0]; -} - -/** - * Test if two masks contain the same cores - */ -static inline int odp_coremask_equal(odp_coremask_t *mask1, - odp_coremask_t *mask2) -{ - return (mask1->_u64[0] == mask2->_u64[0]); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/api/odp_cpumask.h b/platform/linux-generic/include/api/odp_cpumask.h new file mode 100644 index 0000000..e421d4d --- /dev/null +++ b/platform/linux-generic/include/api/odp_cpumask.h @@ -0,0 +1,137 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP CPU masks and enumeration + */ + +#ifndef ODP_CPUMASK_H_ +#define ODP_CPUMASK_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include + +/** @addtogroup odp_scheduler + * CPU mask operations. + * @{ + */ + +/** + * CPU mask + * + * Don't access directly, use access functions. + */ +typedef struct odp_cpumask_t { + cpu_set_t set; /**< @private Mask*/ +} odp_cpumask_t; + +/** + * Add CPU mask bits from a string + * + * @param str Hexadecimal digits in a string. CPU #0 is located + * at the least significant bit (0x1). + * @param mask CPU mask to modify + */ +void odp_cpumask_from_str(const char *str, odp_cpumask_t *mask); + +/** + * Write CPU mask as a string of hexadecimal digits + * + * @param str String for output + * @param len Size of string length (incl. ending zero) + * @param mask CPU mask + */ +void odp_cpumask_to_str(char *str, int len, const odp_cpumask_t *mask); + +/** + * Clear entire mask + * @param mask CPU mask to flush with zero value + */ +void odp_cpumask_zero(odp_cpumask_t *mask); + +/** + * Add cpu to mask + * @param cpu CPU number + * @param mask add cpu number in CPU mask + */ +void odp_cpumask_set(int cpu, odp_cpumask_t *mask); + +/** + * Remove cpu from mask + * @param cpu CPU number + * @param mask clear cpu number from CPU mask + */ +void odp_cpumask_clr(int cpu, odp_cpumask_t *mask); + +/** + * Test if cpu is a member of mask + * @param cpu CPU number + * @param mask CPU mask to check if cpu num set or not + * @return non-zero if set otherwise 0 + */ +int odp_cpumask_isset(int cpu, const odp_cpumask_t *mask); + +/** + * Count number of cpus in mask + * @param mask CPU mask + * @return cpumask count + */ +int odp_cpumask_count(const odp_cpumask_t *mask); + +/** + * Logical AND over two source masks. + * + * @param dest Destination mask, can be one of the source masks + * @param src1 Source mask 1 + * @param src2 Source mask 2 + */ +void odp_cpumask_and(odp_cpumask_t *dest, odp_cpumask_t *src1, + odp_cpumask_t *src2); + +/** + * Logical OR over two source masks. + * + * @param dest Destination mask, can be one of the source masks + * @param src1 Source mask 1 + * @param src2 Source mask 2 + */ +void odp_cpumask_or(odp_cpumask_t *dest, odp_cpumask_t *src1, + odp_cpumask_t *src2); + +/** + * Logical XOR over two source masks. + * + * @param dest Destination mask, can be one of the source masks + * @param src1 Source mask 1 + * @param src2 Source mask 2 + */ +void odp_cpumask_xor(odp_cpumask_t *dest, odp_cpumask_t *src1, + odp_cpumask_t *src2); + +/** + * Test if two masks contain the same cpus + */ +int odp_cpumask_equal(const odp_cpumask_t *mask1, + const odp_cpumask_t *mask2); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/odp_coremask.c b/platform/linux-generic/odp_coremask.c deleted file mode 100644 index 54cd333..0000000 --- a/platform/linux-generic/odp_coremask.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include - -#include -#include - -#define MAX_CORE_NUM 64 - - -void odp_coremask_from_str(const char *str, odp_coremask_t *mask) -{ - uint64_t mask_u64; - - if (strlen(str) > 18) { - /* more than 64 bits */ - return; - } - - mask_u64 = strtoull(str, NULL, 16); - - odp_coremask_from_u64(&mask_u64, 1, mask); -} - - -void odp_coremask_to_str(char *str, int len, const odp_coremask_t *mask) -{ - int ret; - - ret = snprintf(str, len, "0x%"PRIx64"", mask->_u64[0]); - - if (ret >= 0 && ret < len) { - /* force trailing zero */ - str[len-1] = '\0'; - } -} - - -void odp_coremask_from_u64(const uint64_t *u64, int num, odp_coremask_t *mask) -{ - int i; - - if (num > ODP_COREMASK_SIZE_U64) { - /* force max size */ - num = ODP_COREMASK_SIZE_U64; - } - - for (i = 0; i < num; i++) - mask->_u64[0] |= u64[i]; -} - -void odp_coremask_set(int core, odp_coremask_t *mask) -{ - /* should not be more than 63 - * core no. should be from 0..63= 64bit - */ - if (core >= MAX_CORE_NUM) { - ODP_ERR("invalid core count\n"); - return; - } - - mask->_u64[0] |= (1ULL << core); -} - -void odp_coremask_clr(int core, odp_coremask_t *mask) -{ - /* should not be more than 63 - * core no. should be from 0..63= 64bit - */ - if (core >= MAX_CORE_NUM) { - ODP_ERR("invalid core count\n"); - return; - } - - mask->_u64[0] &= ~(1ULL << core); -} - - -int odp_coremask_isset(int core, const odp_coremask_t *mask) -{ - /* should not be more than 63 - * core no. should be from 0..63= 64bit - */ - if (core >= MAX_CORE_NUM) { - ODP_ERR("invalid core count\n"); - return -1; - } - - return (mask->_u64[0] >> core) & 1; -} - -int odp_coremask_count(const odp_coremask_t *mask) -{ - uint64_t coremask = mask->_u64[0]; - int cnt = 0; - - while (coremask != 0) { - coremask >>= 1; - if (coremask & 1) - cnt++; - } - - return cnt; -} diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c new file mode 100644 index 0000000..1f9d73b --- /dev/null +++ b/platform/linux-generic/odp_cpumask.c @@ -0,0 +1,175 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include + +#include +#include + +#include +#include + +#define MAX_CORE_NUM 64 + + +void odp_cpumask_from_str(const char *str_in, odp_cpumask_t *mask) +{ + cpu_set_t cpuset; + const char *str = str_in; + const char *p; + int cpu = 0; + int len = strlen(str); + + CPU_ZERO(&cpuset); + odp_cpumask_zero(mask); + + /* Strip leading "0x"/"0X" if present and verify length */ + if ((len >= 2) && ((str[1] == 'x') || (str[1] == 'X'))) { + str += 2; + len -= 2; + } + if (!len) + return; + + /* Walk string from LSB setting cpu bits */ + for (p = str + len - 1; (len > 0) && (cpu < CPU_SETSIZE); p--, len--) { + char c = *p; + int value; + int idx; + + /* Convert hex nibble, abort when invalid value found */ + if ((c >= '0') && (c <= '9')) + value = c - '0'; + else if ((c >= 'A') && (c <= 'F')) + value = c - 'A' + 10; + else if ((c >= 'a') && (c <= 'f')) + value = c - 'a' + 10; + else + return; + + /* Walk converted nibble and set bits in mask */ + for (idx = 0; idx < 4; idx++, cpu++) + if (value & (1 << idx)) + CPU_SET(cpu, &cpuset); + } + + /* Copy the computed mask */ + memcpy(&mask->set, &cpuset, sizeof(cpuset)); +} + +static int _odp_cpumask_last(const odp_cpumask_t *mask) +{ + int cpu; + + for (cpu = CPU_SETSIZE - 1; cpu >= 0; cpu--) + if (odp_cpumask_isset(cpu, mask)) + return cpu; + return -1; +} + +void odp_cpumask_to_str(char *str, int len, const odp_cpumask_t *mask) +{ + char *p = str; + int cpu = _odp_cpumask_last(mask); + int nibbles; + int value; + + /* Quickly handle bad string length or empty mask */ + if (len <= 0) + return; + *str = 0; + if (cpu < 0) { + if (len >= 4) + strcpy(str, "0x0"); + return; + } + + /* Compute number nibbles in cpumask that have bits set */ + nibbles = (cpu / 4) + 1; + + /* Verify minimum space (account for "0x" and termination) */ + if (len < (3 + nibbles)) + return; + + /* Prefix */ + *p++ = '0'; + *p++ = 'x'; + + /* + * Now we can scan the cpus down to zero and + * build the string one nibble at a time + */ + value = 0; + do { + /* Set bit to go into the current nibble */ + if (CPU_ISSET(cpu, &mask->set)) + value |= 1 << (cpu % 4); + + /* If we are on a nibble boundary flush value to string */ + if (0 == (cpu % 4)) { + if (value < 0xA) + *p++ = '0' + value; + else + *p++ = 'A' + value - 0xA; + value = 0; + } + } while (cpu--); + + /* Terminate the string */ + *p++ = 0; +} + +void odp_cpumask_zero(odp_cpumask_t *mask) +{ + CPU_ZERO(&mask->set); +} + +void odp_cpumask_set(int cpu, odp_cpumask_t *mask) +{ + CPU_SET(cpu, &mask->set); +} + +void odp_cpumask_clr(int cpu, odp_cpumask_t *mask) +{ + CPU_CLR(cpu, &mask->set); +} + +int odp_cpumask_isset(int cpu, const odp_cpumask_t *mask) +{ + return CPU_ISSET(cpu, &mask->set); +} + +int odp_cpumask_count(const odp_cpumask_t *mask) +{ + return CPU_COUNT(&mask->set); +} + +void odp_cpumask_and(odp_cpumask_t *dest, odp_cpumask_t *src1, + odp_cpumask_t *src2) +{ + CPU_AND(&dest->set, &src1->set, &src2->set); +} + +void odp_cpumask_or(odp_cpumask_t *dest, odp_cpumask_t *src1, + odp_cpumask_t *src2) +{ + CPU_OR(&dest->set, &src1->set, &src2->set); +} + +void odp_cpumask_xor(odp_cpumask_t *dest, odp_cpumask_t *src1, + odp_cpumask_t *src2) +{ + CPU_XOR(&dest->set, &src1->set, &src2->set); +} + +int odp_cpumask_equal(const odp_cpumask_t *mask1, + const odp_cpumask_t *mask2) +{ + return CPU_EQUAL(&mask1->set, &mask2->set); +} diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index e585ef5..7449a52 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -29,15 +29,15 @@ __thread test_shared_data_t *test_shared_data; /**< pointer to shared data * */ void odp_print_system_info(void) { - odp_coremask_t coremask; + odp_cpumask_t cpumask; char str[32]; memset(str, 1, sizeof(str)); - odp_coremask_zero(&coremask); + odp_cpumask_zero(&cpumask); - odp_coremask_from_str("0x1", &coremask); - odp_coremask_to_str(str, sizeof(str), &coremask); + odp_cpumask_from_str("0x1", &cpumask); + odp_cpumask_to_str(str, sizeof(str), &cpumask); printf("\n"); printf("ODP system info\n");