From patchwork Tue Jan 24 07:09:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Brooks X-Patchwork-Id: 92284 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1583874qgi; Mon, 23 Jan 2017 23:11:03 -0800 (PST) X-Received: by 10.200.35.6 with SMTP id a6mr26752410qta.210.1485241863098; Mon, 23 Jan 2017 23:11:03 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d9si12535970qte.183.2017.01.23.23.11.02; Mon, 23 Jan 2017 23:11:03 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 72E7362D75; Tue, 24 Jan 2017 07:11:02 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 E4C6361073; Tue, 24 Jan 2017 07:09: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 2282562C2E; Tue, 24 Jan 2017 07:09:26 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by lists.linaro.org (Postfix) with ESMTPS id DB68C60F38 for ; Tue, 24 Jan 2017 07:09:13 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id e4so47952468pfg.1 for ; Mon, 23 Jan 2017 23:09:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AmBQEmMjxNAtNpaQAollbxHktQaSJY8SlkSQquQAkbY=; b=gD8TdsFILekLca1oOvvOCwxZvtNH92bCQ6OFkoNdkT0ZKTPYKC70kECw2Ia8lBTmdY y+ne/IXQ9EJObVlgUHU+YMONB8MEsmXRRQAPNPBTr9Zw3izEExfMIJp5rXBrYIjbpncB lWAfpQ36R858yTV/rS6hS1hN7aphWuNVhJJitKO6Kp7lrVasMjULLIDPECcBuq+pOt7h ZgC+vR9b0KufVGhoo5O4idbOEc9+xFfVIrB3xAVZ0/iX/1MvQskpdWKNfdUK52uCMJgU sG/Y0FJIOBfQm0CoJH2jgXzeZePTnVH68pfx+44d+gasV1IPIwJjqbjX0aVzfFSFuWOn sV3Q== X-Gm-Message-State: AIkVDXLyOnGW0RmuDHRgdUYfXDJxaxCx+2qeF490vgnqy+017B2w4AU5ALA+DOG/IK/Wqp8dSfo= X-Received: by 10.84.174.197 with SMTP id r63mr32890131plb.14.1485241751251; Mon, 23 Jan 2017 23:09:11 -0800 (PST) Received: from vm-arch-01.localdomain (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id n70sm41751123pfg.34.2017.01.23.23.09.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 23:09:10 -0800 (PST) From: Brian Brooks To: lng-odp@lists.linaro.org Date: Tue, 24 Jan 2017 01:09:06 -0600 Message-Id: <20170124070906.35798-1-brian.brooks@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [PATCH] Universal API header files 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" Not all of the C code for the ODP API specification is found in the .h header files. Some of it is found in the ODP implementation's repo. There is no real reason for this, and it allows a particular ODP implementation to define whatever C code for the types of the API that is specified. This also means that the implementation defines the ABI. Which means it completely kills portability. Universal API header files yields 1 set of .h header files that contains _all_ of the C code for the entire specification. Applications only need these header files for compilation. The same for implementations. These header files can be cared for and gardened independently. There is debate on whether variable types should be opaque pointers or other scalar types, and the API function declarations too. In addition to providing a universal set of API header files found in /include/odp/ and /include/odp/api/spec/ this patch removes 2600 lines of code and 76 files. Signed-off-by: Brian Brooks --- doc/implementers-guide/implementers-guide.adoc | 6 - example/time/time_global_test.c | 1 + example/traffic_mgmt/odp_traffic_mgmt.c | 1 + helper/test/odpthreads.c | 1 + helper/test/table.c | 2 + helper/threads.c | 2 + include/odp/api/spec/atomic.h | 501 +++++++++++++++++---- include/odp/api/spec/buffer.h | 5 +- include/odp/api/spec/byteorder.h | 138 +++++- include/odp/api/spec/classification.h | 10 +- include/odp/api/spec/cpu.h | 21 +- include/odp/api/spec/crypto.h | 10 +- include/odp/api/spec/debug.h | 21 + include/odp/api/spec/event.h | 14 +- include/odp/api/spec/hash.h | 2 - include/odp/api/spec/init.h | 5 - include/odp/api/spec/packet.h | 19 +- include/odp/api/spec/packet_flags.h | 3 - include/odp/api/spec/packet_io.h | 20 +- include/odp/api/spec/packet_io_stats.h | 84 ---- include/odp/api/spec/pool.h | 2 - include/odp/api/spec/queue.h | 15 +- include/odp/api/spec/schedule.h | 11 +- include/odp/api/spec/schedule_types.h | 44 +- include/odp/api/spec/shared_memory.h | 6 +- include/odp/api/spec/std_clib.h | 17 +- include/odp/api/spec/std_types.h | 1 + include/odp/api/spec/sync.h | 15 +- include/odp/api/spec/thrmask.h | 2 - include/odp/api/spec/time.h | 1 + include/odp/api/spec/traffic_mngr.h | 18 +- include/odp_api.h | 321 +++++++++++-- platform/linux-generic/Makefile.am | 82 +--- platform/linux-generic/_fdserver.c | 4 +- platform/linux-generic/_ishm.c | 7 +- platform/linux-generic/_ishmphy.c | 5 +- platform/linux-generic/arch/arm/odp/api/cpu_arch.h | 6 - platform/linux-generic/arch/arm/odp_cpu_arch.c | 3 - .../linux-generic/arch/default/odp/api/cpu_arch.h | 6 - platform/linux-generic/arch/default/odp_cpu_arch.c | 5 +- .../linux-generic/arch/default/odp_sysinfo_parse.c | 2 + .../linux-generic/arch/mips64/odp/api/cpu_arch.h | 6 - platform/linux-generic/arch/mips64/odp_cpu_arch.c | 4 +- .../linux-generic/arch/mips64/odp_sysinfo_parse.c | 2 + .../linux-generic/arch/powerpc/odp/api/cpu_arch.h | 6 - platform/linux-generic/arch/powerpc/odp_cpu_arch.c | 5 +- .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 + platform/linux-generic/arch/x86/odp/api/cpu_arch.h | 11 - platform/linux-generic/arch/x86/odp_cpu_arch.c | 3 +- .../linux-generic/arch/x86/odp_sysinfo_parse.c | 2 + platform/linux-generic/include/odp/api/align.h | 58 --- platform/linux-generic/include/odp/api/atomic.h | 42 -- platform/linux-generic/include/odp/api/barrier.h | 31 -- platform/linux-generic/include/odp/api/buffer.h | 39 -- platform/linux-generic/include/odp/api/byteorder.h | 43 -- .../linux-generic/include/odp/api/classification.h | 41 -- platform/linux-generic/include/odp/api/compiler.h | 34 -- platform/linux-generic/include/odp/api/cpu.h | 28 -- platform/linux-generic/include/odp/api/cpumask.h | 28 -- platform/linux-generic/include/odp/api/crypto.h | 41 -- platform/linux-generic/include/odp/api/debug.h | 48 -- platform/linux-generic/include/odp/api/errno.h | 27 -- platform/linux-generic/include/odp/api/event.h | 36 -- platform/linux-generic/include/odp/api/hash.h | 34 -- platform/linux-generic/include/odp/api/hints.h | 34 -- platform/linux-generic/include/odp/api/init.h | 36 -- platform/linux-generic/include/odp/api/packet.h | 41 -- .../linux-generic/include/odp/api/packet_flags.h | 34 -- platform/linux-generic/include/odp/api/packet_io.h | 41 -- .../include/odp/api/packet_io_stats.h | 26 -- .../include/odp/api/plat/atomic_inlines.h | 385 ---------------- .../include/odp/api/plat/atomic_types.h | 88 ---- .../include/odp/api/plat/barrier_types.h | 38 -- .../include/odp/api/plat/buffer_types.h | 45 -- .../include/odp/api/plat/byteorder_inlines.h | 140 ------ .../include/odp/api/plat/byteorder_types.h | 87 ---- .../include/odp/api/plat/classification_types.h | 57 --- .../include/odp/api/plat/cpumask_types.h | 54 --- .../include/odp/api/plat/crypto_types.h | 50 -- .../include/odp/api/plat/event_types.h | 57 --- .../include/odp/api/plat/init_types.h | 35 -- .../include/odp/api/plat/packet_io_types.h | 64 --- .../include/odp/api/plat/packet_types.h | 72 --- .../include/odp/api/plat/pool_types.h | 52 --- .../include/odp/api/plat/queue_types.h | 57 --- .../include/odp/api/plat/rwlock_recursive_types.h | 38 -- .../include/odp/api/plat/rwlock_types.h | 37 -- .../include/odp/api/plat/schedule_types.h | 62 --- .../include/odp/api/plat/shared_memory_types.h | 50 -- .../odp/api/plat/spinlock_recursive_types.h | 36 -- .../include/odp/api/plat/spinlock_types.h | 34 -- .../include/odp/api/plat/static_inline.h.in | 43 -- .../include/odp/api/plat/std_clib_inlines.h | 36 -- .../include/odp/api/plat/strong_types.h | 36 -- .../include/odp/api/plat/sync_inlines.h | 47 -- .../include/odp/api/plat/thread_types.h | 34 -- .../include/odp/api/plat/thrmask_types.h | 48 -- .../include/odp/api/plat/ticketlock_types.h | 35 -- .../include/odp/api/plat/time_types.h | 43 -- .../include/odp/api/plat/timer_types.h | 51 --- .../include/odp/api/plat/traffic_mngr_types.h | 185 -------- .../include/odp/api/plat/version_types.h | 30 -- platform/linux-generic/include/odp/api/pool.h | 37 -- platform/linux-generic/include/odp/api/queue.h | 40 -- platform/linux-generic/include/odp/api/random.h | 34 -- platform/linux-generic/include/odp/api/rwlock.h | 28 -- .../include/odp/api/rwlock_recursive.h | 28 -- platform/linux-generic/include/odp/api/schedule.h | 36 -- .../linux-generic/include/odp/api/schedule_types.h | 28 -- .../linux-generic/include/odp/api/shared_memory.h | 36 -- platform/linux-generic/include/odp/api/spinlock.h | 28 -- .../include/odp/api/spinlock_recursive.h | 28 -- platform/linux-generic/include/odp/api/std_clib.h | 28 -- platform/linux-generic/include/odp/api/std_types.h | 42 -- platform/linux-generic/include/odp/api/sync.h | 39 -- .../linux-generic/include/odp/api/system_info.h | 29 -- platform/linux-generic/include/odp/api/thread.h | 28 -- platform/linux-generic/include/odp/api/thrmask.h | 36 -- .../linux-generic/include/odp/api/ticketlock.h | 28 -- platform/linux-generic/include/odp/api/time.h | 31 -- platform/linux-generic/include/odp/api/timer.h | 40 -- .../linux-generic/include/odp/api/traffic_mngr.h | 35 -- platform/linux-generic/include/odp/api/version.h | 27 -- .../linux-generic/include/odp_align_internal.h | 1 - .../linux-generic/include/odp_atomic_internal.h | 4 - .../linux-generic/include/odp_buffer_internal.h | 9 - .../include/odp_classification_datamodel.h | 2 - .../include/odp_classification_inlines.h | 1 - .../include/odp_classification_internal.h | 3 - .../linux-generic/include/odp_debug_internal.h | 2 +- platform/linux-generic/include/odp_internal.h | 3 - platform/linux-generic/include/odp_packet_dpdk.h | 4 - .../linux-generic/include/odp_packet_internal.h | 5 - .../linux-generic/include/odp_packet_io_internal.h | 3 - .../include/odp_packet_io_ipc_internal.h | 3 - .../include/odp_packet_io_ring_internal.h | 3 - platform/linux-generic/include/odp_packet_netmap.h | 5 - platform/linux-generic/include/odp_packet_socket.h | 7 - platform/linux-generic/include/odp_packet_tap.h | 2 - platform/linux-generic/include/odp_pool_internal.h | 3 - .../linux-generic/include/odp_queue_internal.h | 5 - platform/linux-generic/include/odp_ring_internal.h | 2 - platform/linux-generic/include/odp_schedule_if.h | 3 - platform/linux-generic/include/odp_shm_internal.h | 2 - ...ketlock_inlines.h => odp_ticketlock_internal.h} | 25 +- .../linux-generic/include/odp_timer_internal.h | 3 - .../include/odp_traffic_mngr_internal.h | 2 - .../linux-generic/include/odp_version_internal.h | 26 ++ platform/linux-generic/m4/configure.m4 | 3 +- platform/linux-generic/odp_atomic.c | 5 +- platform/linux-generic/odp_barrier.c | 5 +- platform/linux-generic/odp_buffer.c | 3 +- platform/linux-generic/odp_byteorder.c | 10 - platform/linux-generic/odp_classification.c | 9 +- platform/linux-generic/odp_cpu.c | 3 +- platform/linux-generic/odp_cpumask.c | 4 +- platform/linux-generic/odp_cpumask_task.c | 3 +- platform/linux-generic/odp_crypto.c | 11 +- platform/linux-generic/odp_errno.c | 3 +- platform/linux-generic/odp_event.c | 8 +- platform/linux-generic/odp_hash.c | 3 +- platform/linux-generic/odp_impl.c | 3 +- platform/linux-generic/odp_init.c | 5 +- platform/linux-generic/odp_name_table.c | 2 + platform/linux-generic/odp_packet.c | 5 +- platform/linux-generic/odp_packet_flags.c | 3 +- platform/linux-generic/odp_packet_io.c | 9 +- platform/linux-generic/odp_pool.c | 7 +- platform/linux-generic/odp_queue.c | 13 +- platform/linux-generic/odp_rwlock.c | 5 +- platform/linux-generic/odp_rwlock_recursive.c | 4 +- platform/linux-generic/odp_schedule.c | 12 +- platform/linux-generic/odp_schedule_if.c | 2 + platform/linux-generic/odp_schedule_sp.c | 6 +- platform/linux-generic/odp_shared_memory.c | 5 +- platform/linux-generic/odp_sorted_list.c | 2 + platform/linux-generic/odp_spinlock.c | 4 +- platform/linux-generic/odp_spinlock_recursive.c | 3 +- platform/linux-generic/odp_std_clib.c | 10 - platform/linux-generic/odp_sync.c | 10 - platform/linux-generic/odp_system_info.c | 5 +- platform/linux-generic/odp_thread.c | 8 +- platform/linux-generic/odp_thrmask.c | 3 +- platform/linux-generic/odp_ticketlock.c | 4 +- platform/linux-generic/odp_time.c | 4 +- platform/linux-generic/odp_timer.c | 17 +- platform/linux-generic/odp_timer_wheel.c | 2 + platform/linux-generic/odp_traffic_mngr.c | 3 +- platform/linux-generic/odp_version.c | 4 +- platform/linux-generic/odp_weak.c | 4 +- platform/linux-generic/pktio/dpdk.c | 2 - platform/linux-generic/pktio/io_ops.c | 2 + platform/linux-generic/pktio/ipc.c | 4 +- platform/linux-generic/pktio/loop.c | 1 - platform/linux-generic/pktio/pktio_common.c | 2 + platform/linux-generic/pktio/socket.c | 1 - platform/linux-generic/pktio/socket_mmap.c | 3 +- test/common_plat/validation/api/system/system.c | 1 - 198 files changed, 1139 insertions(+), 4273 deletions(-) delete mode 100644 platform/linux-generic/include/odp/api/align.h delete mode 100644 platform/linux-generic/include/odp/api/atomic.h delete mode 100644 platform/linux-generic/include/odp/api/barrier.h delete mode 100644 platform/linux-generic/include/odp/api/buffer.h delete mode 100644 platform/linux-generic/include/odp/api/byteorder.h delete mode 100644 platform/linux-generic/include/odp/api/classification.h delete mode 100644 platform/linux-generic/include/odp/api/compiler.h delete mode 100644 platform/linux-generic/include/odp/api/cpu.h delete mode 100644 platform/linux-generic/include/odp/api/cpumask.h delete mode 100644 platform/linux-generic/include/odp/api/crypto.h delete mode 100644 platform/linux-generic/include/odp/api/debug.h delete mode 100644 platform/linux-generic/include/odp/api/errno.h delete mode 100644 platform/linux-generic/include/odp/api/event.h delete mode 100644 platform/linux-generic/include/odp/api/hash.h delete mode 100644 platform/linux-generic/include/odp/api/hints.h delete mode 100644 platform/linux-generic/include/odp/api/init.h delete mode 100644 platform/linux-generic/include/odp/api/packet.h delete mode 100644 platform/linux-generic/include/odp/api/packet_flags.h delete mode 100644 platform/linux-generic/include/odp/api/packet_io.h delete mode 100644 platform/linux-generic/include/odp/api/packet_io_stats.h delete mode 100644 platform/linux-generic/include/odp/api/plat/atomic_inlines.h delete mode 100644 platform/linux-generic/include/odp/api/plat/atomic_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/barrier_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/buffer_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/byteorder_inlines.h delete mode 100644 platform/linux-generic/include/odp/api/plat/byteorder_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/classification_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/cpumask_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/crypto_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/event_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/init_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/packet_io_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/packet_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/pool_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/queue_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/rwlock_recursive_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/rwlock_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/schedule_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/shared_memory_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/spinlock_recursive_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/spinlock_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/static_inline.h.in delete mode 100644 platform/linux-generic/include/odp/api/plat/std_clib_inlines.h delete mode 100644 platform/linux-generic/include/odp/api/plat/strong_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/sync_inlines.h delete mode 100644 platform/linux-generic/include/odp/api/plat/thread_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/thrmask_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/ticketlock_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/time_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/timer_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h delete mode 100644 platform/linux-generic/include/odp/api/plat/version_types.h delete mode 100644 platform/linux-generic/include/odp/api/pool.h delete mode 100644 platform/linux-generic/include/odp/api/queue.h delete mode 100644 platform/linux-generic/include/odp/api/random.h delete mode 100644 platform/linux-generic/include/odp/api/rwlock.h delete mode 100644 platform/linux-generic/include/odp/api/rwlock_recursive.h delete mode 100644 platform/linux-generic/include/odp/api/schedule.h delete mode 100644 platform/linux-generic/include/odp/api/schedule_types.h delete mode 100644 platform/linux-generic/include/odp/api/shared_memory.h delete mode 100644 platform/linux-generic/include/odp/api/spinlock.h delete mode 100644 platform/linux-generic/include/odp/api/spinlock_recursive.h delete mode 100644 platform/linux-generic/include/odp/api/std_clib.h delete mode 100644 platform/linux-generic/include/odp/api/std_types.h delete mode 100644 platform/linux-generic/include/odp/api/sync.h delete mode 100644 platform/linux-generic/include/odp/api/system_info.h delete mode 100644 platform/linux-generic/include/odp/api/thread.h delete mode 100644 platform/linux-generic/include/odp/api/thrmask.h delete mode 100644 platform/linux-generic/include/odp/api/ticketlock.h delete mode 100644 platform/linux-generic/include/odp/api/time.h delete mode 100644 platform/linux-generic/include/odp/api/timer.h delete mode 100644 platform/linux-generic/include/odp/api/traffic_mngr.h delete mode 100644 platform/linux-generic/include/odp/api/version.h rename platform/linux-generic/include/{odp/api/plat/ticketlock_inlines.h => odp_ticketlock_internal.h} (90%) create mode 100644 platform/linux-generic/include/odp_version_internal.h delete mode 100644 platform/linux-generic/odp_byteorder.c delete mode 100644 platform/linux-generic/odp_std_clib.c delete mode 100644 platform/linux-generic/odp_sync.c -- 2.11.0 diff --git a/doc/implementers-guide/implementers-guide.adoc b/doc/implementers-guide/implementers-guide.adoc index 0e2edc0c..b6ecf3cc 100644 --- a/doc/implementers-guide/implementers-guide.adoc +++ b/doc/implementers-guide/implementers-guide.adoc @@ -639,12 +639,6 @@ that an application that tries to pass a variable of type `odp_packet_t` to an API that expects an argument of type `odp_queue_t`, for example, will result in a compilation error rather than some difficult to debug runtime failure. -The *odp-linux* reference implementation defines all ODP abstract types strongly -using a set of utility macros contained in -`platform/linux-generic/include/odp/api/plat/strong_types.h`. These macros -can be used or modified as desired by other implementations to achieve strong -typing of their typedefs. - === Typedef approaches ODP abstract types serve two distinct purposes that each implementation must consider. First, they shield applications from implementation internals, thus diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index dd339499..b6be4f17 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -5,6 +5,7 @@ */ #include +#include #include #include diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c index c83b6152..e56832c5 100644 --- a/example/traffic_mgmt/odp_traffic_mgmt.c +++ b/example/traffic_mgmt/odp_traffic_mgmt.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index 4bb3c3b6..2009d3e3 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -12,6 +12,7 @@ #include #include +#include #include #include diff --git a/helper/test/table.c b/helper/test/table.c index 3b74b225..09b71cbe 100644 --- a/helper/test/table.c +++ b/helper/test/table.c @@ -9,6 +9,8 @@ #include <../odph_lineartable.h> #include +#include + /** * Address Resolution Protocol (ARP) * Description: Once a route has been identified for an IP packet (so the diff --git a/helper/threads.c b/helper/threads.c index fe5d2bde..1bfc735f 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -9,6 +9,8 @@ #endif #include #include +#include +#include #include #include #include diff --git a/include/odp/api/spec/atomic.h b/include/odp/api/spec/atomic.h index 408829df..d201d5bb 100644 --- a/include/odp/api/spec/atomic.h +++ b/include/odp/api/spec/atomic.h @@ -74,7 +74,10 @@ extern "C" { * @param atom Pointer to atomic variable * @param val Value to initialize the variable with */ -void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val) +{ + __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); +} /** * Load value of atomic uint32 variable @@ -83,7 +86,10 @@ void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val); * * @return Value of the variable */ -uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom); +static inline uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom) +{ + return __atomic_load_n(&atom->v, __ATOMIC_RELAXED); +} /** * Store value to atomic uint32 variable @@ -91,7 +97,10 @@ uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom); * @param atom Pointer to atomic variable * @param val Value to store in the variable */ -void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val) +{ + __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); +} /** * Fetch and add to atomic uint32 variable @@ -101,7 +110,11 @@ void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val); * * @return Value of the variable before the addition */ -uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *atom, + uint32_t val) +{ + return __atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); +} /** * Add to atomic uint32 variable @@ -109,7 +122,10 @@ uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *atom, uint32_t val); * @param atom Pointer to atomic variable * @param val Value to be added to the variable */ -void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val) +{ + (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); +} /** * Fetch and subtract from atomic uint32 variable @@ -119,7 +135,11 @@ void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val); * * @return Value of the variable before the subtraction */ -uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, + uint32_t val) +{ + return __atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); +} /** * Subtract from atomic uint32 variable @@ -127,7 +147,10 @@ uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, uint32_t val); * @param atom Pointer to atomic variable * @param val Value to be subtracted from the variable */ -void odp_atomic_sub_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_sub_u32(odp_atomic_u32_t *atom, uint32_t val) +{ + (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); +} /** * Fetch and increment atomic uint32 variable @@ -136,14 +159,20 @@ void odp_atomic_sub_u32(odp_atomic_u32_t *atom, uint32_t val); * * @return Value of the variable before the increment */ -uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom); +static inline uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom) +{ + return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); +} /** * Increment atomic uint32 variable * * @param atom Pointer to atomic variable */ -void odp_atomic_inc_u32(odp_atomic_u32_t *atom); +static inline void odp_atomic_inc_u32(odp_atomic_u32_t *atom) +{ + (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); +} /** * Fetch and decrement atomic uint32 variable @@ -152,36 +181,20 @@ void odp_atomic_inc_u32(odp_atomic_u32_t *atom); * * @return Value of the variable before the subtraction */ -uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *atom); +static inline uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *atom) +{ + return __atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); +} /** * Decrement atomic uint32 variable * * @param atom Pointer to atomic variable */ -void odp_atomic_dec_u32(odp_atomic_u32_t *atom); - -/** - * Update maximum value of atomic uint32 variable - * - * Compares value of atomic variable to the new maximum value. If the new value - * is greater than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_max New maximum value to be written into the atomic variable - */ -void odp_atomic_max_u32(odp_atomic_u32_t *atom, uint32_t new_max); - -/** - * Update minimum value of atomic uint32 variable - * - * Compares value of atomic variable to the new minimum value. If the new value - * is less than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_min New minimum value to be written into the atomic variable - */ -void odp_atomic_min_u32(odp_atomic_u32_t *atom, uint32_t new_min); +static inline void odp_atomic_dec_u32(odp_atomic_u32_t *atom) +{ + (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); +} /** * Compare and swap atomic uint32 variable @@ -199,8 +212,14 @@ void odp_atomic_min_u32(odp_atomic_u32_t *atom, uint32_t new_min); * @return 0 on failure, !0 on success * */ -int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); +static inline int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val, + uint32_t new_val) +{ + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_RELAXED, + __ATOMIC_RELAXED); +} /** * Exchange value of atomic uint32 variable @@ -213,13 +232,95 @@ int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val, * * @return Value of the variable before the operation */ -uint32_t odp_atomic_xchg_u32(odp_atomic_u32_t *atom, uint32_t new_val); +static inline uint32_t odp_atomic_xchg_u32(odp_atomic_u32_t *atom, + uint32_t new_val) +{ + return __atomic_exchange_n(&atom->v, new_val, __ATOMIC_RELAXED); +} + +/** + * Update maximum value of atomic uint32 variable + * + * Compares value of atomic variable to the new maximum value. If the new value + * is greater than the current value, writes the new value into the variable. + * + * @param atom Pointer to atomic variable + * @param new_max New maximum value to be written into the atomic variable + */ +static inline void odp_atomic_max_u32(odp_atomic_u32_t *atom, uint32_t new_max) +{ + uint32_t old_val; + + old_val = odp_atomic_load_u32(atom); + + while (new_max > old_val) { + if (odp_atomic_cas_u32(atom, &old_val, new_max)) + break; + } +} + +/** + * Update minimum value of atomic uint32 variable + * + * Compares value of atomic variable to the new minimum value. If the new value + * is less than the current value, writes the new value into the variable. + * + * @param atom Pointer to atomic variable + * @param new_min New minimum value to be written into the atomic variable + */ +static inline void odp_atomic_min_u32(odp_atomic_u32_t *atom, uint32_t new_min) +{ + uint32_t old_val; + + old_val = odp_atomic_load_u32(atom); + + while (new_min < old_val) { + if (odp_atomic_cas_u32(atom, &old_val, new_min)) + break; + } +} /* * 64-bit operations in RELAXED memory ordering * -------------------------------------------- */ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + +/** + * @internal + * CAS operation expression for the ATOMIC_OP macro + */ +#define ATOMIC_CAS_OP(ret_ptr, old_val, new_val) \ +({ \ + if (atom->v == (old_val)) { \ + atom->v = (new_val); \ + *(ret_ptr) = 1; \ + } else { \ + *(ret_ptr) = 0; \ + } \ +}) + +/** + * @internal + * Helper macro for lock-based atomic operations on 64-bit integers + * @param[in,out] atom Pointer to the 64-bit atomic variable + * @param expr Expression used update the variable. + * @return The old value of the variable. + */ +#define ATOMIC_OP(atom, expr) \ +({ \ + uint64_t _old_val; \ + /* Loop while lock is already taken, stop when lock becomes clear */ \ + while (__atomic_test_and_set(&(atom)->lock, __ATOMIC_ACQUIRE)) \ + (void)0; \ + _old_val = (atom)->v; \ + (expr); /* Perform whatever update is desired */ \ + __atomic_clear(&(atom)->lock, __ATOMIC_RELEASE); \ + _old_val; /* Return old value */ \ +}) +#endif + /** * Initialize atomic uint64 variable * @@ -230,7 +331,13 @@ uint32_t odp_atomic_xchg_u32(odp_atomic_u32_t *atom, uint32_t new_val); * @param atom Pointer to atomic variable * @param val Value to initialize the variable with */ -void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t val) +{ + atom->v = val; +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + __atomic_clear(&atom->lock, __ATOMIC_RELAXED); +#endif +} /** * Load value of atomic uint64 variable @@ -239,7 +346,14 @@ void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t val); * * @return Value of the variable */ -uint64_t odp_atomic_load_u64(odp_atomic_u64_t *atom); +static inline uint64_t odp_atomic_load_u64(odp_atomic_u64_t *atom) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, (void)0); +#else + return __atomic_load_n(&atom->v, __ATOMIC_RELAXED); +#endif +} /** * Store value to atomic uint64 variable @@ -247,7 +361,14 @@ uint64_t odp_atomic_load_u64(odp_atomic_u64_t *atom); * @param atom Pointer to atomic variable * @param val Value to store in the variable */ -void odp_atomic_store_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_store_u64(odp_atomic_u64_t *atom, uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v = val); +#else + __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); +#endif +} /** * Fetch and add to atomic uint64 variable @@ -257,7 +378,15 @@ void odp_atomic_store_u64(odp_atomic_u64_t *atom, uint64_t val); * * @return Value of the variable before the addition */ -uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *atom, + uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, atom->v += val); +#else + return __atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); +#endif +} /** * Add to atomic uint64 variable @@ -265,7 +394,14 @@ uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *atom, uint64_t val); * @param atom Pointer to atomic variable * @param val Value to be added to the variable */ -void odp_atomic_add_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_add_u64(odp_atomic_u64_t *atom, uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v += val); +#else + (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); +#endif +} /** * Fetch and subtract from atomic uint64 variable @@ -275,7 +411,15 @@ void odp_atomic_add_u64(odp_atomic_u64_t *atom, uint64_t val); * * @return Value of the variable before the subtraction */ -uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *atom, + uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, atom->v -= val); +#else + return __atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); +#endif +} /** * Subtract from atomic uint64 variable @@ -283,7 +427,14 @@ uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *atom, uint64_t val); * @param atom Pointer to atomic variable * @param val Value to be subtracted from the variable */ -void odp_atomic_sub_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_sub_u64(odp_atomic_u64_t *atom, uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v -= val); +#else + (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); +#endif +} /** * Fetch and increment atomic uint64 variable @@ -292,14 +443,28 @@ void odp_atomic_sub_u64(odp_atomic_u64_t *atom, uint64_t val); * * @return Value of the variable before the increment */ -uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *atom); +static inline uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *atom) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, atom->v++); +#else + return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); +#endif +} /** * Increment atomic uint64 variable * * @param atom Pointer to atomic variable */ -void odp_atomic_inc_u64(odp_atomic_u64_t *atom); +static inline void odp_atomic_inc_u64(odp_atomic_u64_t *atom) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v++); +#else + (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); +#endif +} /** * Fetch and decrement atomic uint64 variable @@ -308,36 +473,28 @@ void odp_atomic_inc_u64(odp_atomic_u64_t *atom); * * @return Value of the variable before the decrement */ -uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *atom); +static inline uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *atom) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, atom->v--); +#else + return __atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); +#endif +} /** * Decrement atomic uint64 variable * * @param atom Pointer to atomic variable */ -void odp_atomic_dec_u64(odp_atomic_u64_t *atom); - -/** - * Update maximum value of atomic uint64 variable - * - * Compares value of atomic variable to the new maximum value. If the new value - * is greater than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_max New maximum value to be written into the atomic variable - */ -void odp_atomic_max_u64(odp_atomic_u64_t *atom, uint64_t new_max); - -/** - * Update minimum value of atomic uint64 variable - * - * Compares value of atomic variable to the new minimum value. If the new value - * is less than the current value, writes the new value into the variable. - * - * @param atom Pointer to atomic variable - * @param new_min New minimum value to be written into the atomic variable - */ -void odp_atomic_min_u64(odp_atomic_u64_t *atom, uint64_t new_min); +static inline void odp_atomic_dec_u64(odp_atomic_u64_t *atom) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v--); +#else + (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); +#endif +} /** * Compare and swap atomic uint64 variable @@ -354,8 +511,20 @@ void odp_atomic_min_u64(odp_atomic_u64_t *atom, uint64_t new_min); * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); +static inline int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val, + uint64_t new_val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + int ret; + *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); + return ret; +#else + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_RELAXED, + __ATOMIC_RELAXED); +#endif +} /** * Exchange value of atomic uint64 variable @@ -368,7 +537,57 @@ int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val, * * @return Value of the variable before the operation */ -uint64_t odp_atomic_xchg_u64(odp_atomic_u64_t *atom, uint64_t new_val); +static inline uint64_t odp_atomic_xchg_u64(odp_atomic_u64_t *atom, + uint64_t new_val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, atom->v = new_val); +#else + return __atomic_exchange_n(&atom->v, new_val, __ATOMIC_RELAXED); +#endif +} + +/** + * Update maximum value of atomic uint64 variable + * + * Compares value of atomic variable to the new maximum value. If the new value + * is greater than the current value, writes the new value into the variable. + * + * @param atom Pointer to atomic variable + * @param new_max New maximum value to be written into the atomic variable + */ +static inline void odp_atomic_max_u64(odp_atomic_u64_t *atom, uint64_t new_max) +{ + uint64_t old_val; + + old_val = odp_atomic_load_u64(atom); + + while (new_max > old_val) { + if (odp_atomic_cas_u64(atom, &old_val, new_max)) + break; + } +} + +/** + * Update minimum value of atomic uint64 variable + * + * Compares value of atomic variable to the new minimum value. If the new value + * is less than the current value, writes the new value into the variable. + * + * @param atom Pointer to atomic variable + * @param new_min New minimum value to be written into the atomic variable + */ +static inline void odp_atomic_min_u64(odp_atomic_u64_t *atom, uint64_t new_min) +{ + uint64_t old_val; + + old_val = odp_atomic_load_u64(atom); + + while (new_min < old_val) { + if (odp_atomic_cas_u64(atom, &old_val, new_min)) + break; + } +} /* * 32-bit operations in non-RELAXED memory ordering @@ -385,7 +604,10 @@ uint64_t odp_atomic_xchg_u64(odp_atomic_u64_t *atom, uint64_t new_val); * * @return Value of the variable */ -uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom); +static inline uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom) +{ + return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE); +} /** * Store value to atomic uint32 variable using RELEASE memory ordering @@ -396,7 +618,11 @@ uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom); * @param atom Pointer to atomic variable * @param val Value to store in the variable */ -void odp_atomic_store_rel_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_store_rel_u32(odp_atomic_u32_t *atom, + uint32_t val) +{ + __atomic_store_n(&atom->v, val, __ATOMIC_RELEASE); +} /** * Add to atomic uint32 variable using RELEASE memory ordering @@ -407,7 +633,10 @@ void odp_atomic_store_rel_u32(odp_atomic_u32_t *atom, uint32_t val); * @param atom Pointer to atomic variable * @param val Value to be added to the variable */ -void odp_atomic_add_rel_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_add_rel_u32(odp_atomic_u32_t *atom, uint32_t val) +{ + (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); +} /** * Subtract from atomic uint32 variable using RELEASE memory ordering @@ -418,7 +647,10 @@ void odp_atomic_add_rel_u32(odp_atomic_u32_t *atom, uint32_t val); * @param atom Pointer to atomic variable * @param val Value to be subtracted from the variable */ -void odp_atomic_sub_rel_u32(odp_atomic_u32_t *atom, uint32_t val); +static inline void odp_atomic_sub_rel_u32(odp_atomic_u32_t *atom, uint32_t val) +{ + (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); +} /** * Compare and swap atomic uint32 variable using ACQUIRE memory ordering @@ -433,8 +665,14 @@ void odp_atomic_sub_rel_u32(odp_atomic_u32_t *atom, uint32_t val); * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); +static inline int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, + uint32_t *old_val, uint32_t new_val) +{ + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_ACQUIRE, + __ATOMIC_RELAXED); +} /** * Compare and swap atomic uint32 variable using RELEASE memory ordering @@ -449,8 +687,14 @@ int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, uint32_t *old_val, * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_rel_u32(odp_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); +static inline int odp_atomic_cas_rel_u32(odp_atomic_u32_t *atom, + uint32_t *old_val, uint32_t new_val) +{ + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_RELEASE, + __ATOMIC_RELAXED); +} /** * Compare and swap atomic uint32 variable using ACQUIRE-and-RELEASE memory @@ -466,8 +710,15 @@ int odp_atomic_cas_rel_u32(odp_atomic_u32_t *atom, uint32_t *old_val, * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_acq_rel_u32(odp_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val); +static inline int odp_atomic_cas_acq_rel_u32(odp_atomic_u32_t *atom, + uint32_t *old_val, + uint32_t new_val) +{ + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED); +} /* * 64-bit operations in non-RELAXED memory ordering @@ -484,7 +735,14 @@ int odp_atomic_cas_acq_rel_u32(odp_atomic_u32_t *atom, uint32_t *old_val, * * @return Value of the variable */ -uint64_t odp_atomic_load_acq_u64(odp_atomic_u64_t *atom); +static inline uint64_t odp_atomic_load_acq_u64(odp_atomic_u64_t *atom) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + return ATOMIC_OP(atom, (void)0); +#else + return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE); +#endif +} /** * Store value to atomic uint64 variable using RELEASE memory ordering @@ -495,7 +753,15 @@ uint64_t odp_atomic_load_acq_u64(odp_atomic_u64_t *atom); * @param atom Pointer to atomic variable * @param val Value to store in the variable */ -void odp_atomic_store_rel_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_store_rel_u64(odp_atomic_u64_t *atom, + uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v = val); +#else + __atomic_store_n(&atom->v, val, __ATOMIC_RELEASE); +#endif +} /** * Add to atomic uint64 variable using RELEASE memory ordering @@ -506,7 +772,14 @@ void odp_atomic_store_rel_u64(odp_atomic_u64_t *atom, uint64_t val); * @param atom Pointer to atomic variable * @param val Value to be added to the variable */ -void odp_atomic_add_rel_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_add_rel_u64(odp_atomic_u64_t *atom, uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v += val); +#else + (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); +#endif +} /** * Subtract from atomic uint64 variable using RELEASE memory ordering @@ -517,7 +790,14 @@ void odp_atomic_add_rel_u64(odp_atomic_u64_t *atom, uint64_t val); * @param atom Pointer to atomic variable * @param val Value to be subtracted from the variable */ -void odp_atomic_sub_rel_u64(odp_atomic_u64_t *atom, uint64_t val); +static inline void odp_atomic_sub_rel_u64(odp_atomic_u64_t *atom, uint64_t val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + (void)ATOMIC_OP(atom, atom->v -= val); +#else + (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); +#endif +} /** * Compare and swap atomic uint64 variable using ACQUIRE memory ordering @@ -532,8 +812,20 @@ void odp_atomic_sub_rel_u64(odp_atomic_u64_t *atom, uint64_t val); * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_acq_u64(odp_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); +static inline int odp_atomic_cas_acq_u64(odp_atomic_u64_t *atom, + uint64_t *old_val, uint64_t new_val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + int ret; + *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); + return ret; +#else + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_ACQUIRE, + __ATOMIC_RELAXED); +#endif +} /** * Compare and swap atomic uint64 variable using RELEASE memory ordering @@ -548,8 +840,20 @@ int odp_atomic_cas_acq_u64(odp_atomic_u64_t *atom, uint64_t *old_val, * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_rel_u64(odp_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); +static inline int odp_atomic_cas_rel_u64(odp_atomic_u64_t *atom, + uint64_t *old_val, uint64_t new_val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + int ret; + *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); + return ret; +#else + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_RELEASE, + __ATOMIC_RELAXED); +#endif +} /** * Compare and swap atomic uint64 variable using ACQUIRE-and-RELEASE memory @@ -565,8 +869,21 @@ int odp_atomic_cas_rel_u64(odp_atomic_u64_t *atom, uint64_t *old_val, * * @return 0 on failure, !0 on success */ -int odp_atomic_cas_acq_rel_u64(odp_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val); +static inline int odp_atomic_cas_acq_rel_u64(odp_atomic_u64_t *atom, + uint64_t *old_val, + uint64_t new_val) +{ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + int ret; + *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); + return ret; +#else + return __atomic_compare_exchange_n(&atom->v, old_val, new_val, + 0 /* strong */, + __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED); +#endif +} /** * Atomic operations diff --git a/include/odp/api/spec/buffer.h b/include/odp/api/spec/buffer.h index 94829b32..8430eae7 100644 --- a/include/odp/api/spec/buffer.h +++ b/include/odp/api/spec/buffer.h @@ -159,7 +159,10 @@ void odp_buffer_print(odp_buffer_t buf); * to enable applications to generate a printable value that represents * an odp_buffer_t handle. */ -uint64_t odp_buffer_to_u64(odp_buffer_t hdl); +static inline uint64_t odp_buffer_to_u64(odp_buffer_t hdl) +{ + return _odp_pri(hdl); +} /** * @} diff --git a/include/odp/api/spec/byteorder.h b/include/odp/api/spec/byteorder.h index 2899adbe..36e26da0 100644 --- a/include/odp/api/spec/byteorder.h +++ b/include/odp/api/spec/byteorder.h @@ -24,6 +24,18 @@ extern "C" { * @{ */ +#ifndef __BYTE_ORDER__ +#error __BYTE_ORDER not defined! +#endif + +#ifndef __ORDER_BIG_ENDIAN__ +#error __BIG_ENDIAN not defined! +#endif + +#ifndef __ORDER_LITTLE_ENDIAN__ +#error __LITTLE_ENDIAN not defined! +#endif + /** * @def ODP_BIG_ENDIAN * Big endian byte order @@ -44,6 +56,22 @@ extern "C" { * Selected bitfield order */ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #define ODP_LITTLE_ENDIAN 1 + #define ODP_BIG_ENDIAN 0 + #define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN + #define ODP_LITTLE_ENDIAN_BITFIELD 1 + #define ODP_BIG_ENDIAN_BITFIELD 0 + #define ODP_BITFIELD_ORDER ODP_LITTLE_ENDIAN_BITFIELD +#else + #define ODP_LITTLE_ENDIAN 0 + #define ODP_BIG_ENDIAN 1 + #define ODP_BYTE_ORDER ODP_BIG_ENDIAN + #define ODP_LITTLE_ENDIAN_BITFIELD 0 + #define ODP_BIG_ENDIAN_BITFIELD 1 + #define ODP_BITFIELD_ORDER ODP_BIG_ENDIAN_BITFIELD +#endif + /** * @typedef odp_u16le_t * unsigned 16bit little endian @@ -79,21 +107,42 @@ extern "C" { * @param be16 big endian 16bit * @return cpu native uint16_t */ -uint16_t odp_be_to_cpu_16(odp_u16be_t be16); +static inline uint16_t odp_be_to_cpu_16(odp_u16be_t be16) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return __odp_builtin_bswap16((__odp_force uint16_t)be16); +#else + return (__odp_force uint16_t)be16; +#endif +} /** * Convert 32bit big endian to cpu native uint32_t * @param be32 big endian 32bit * @return cpu native uint32_t */ -uint32_t odp_be_to_cpu_32(odp_u32be_t be32); +static inline uint32_t odp_be_to_cpu_32(odp_u32be_t be32) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return __builtin_bswap32((__odp_force uint32_t)be32); +#else + return (__odp_force uint32_t)be32; +#endif +} /** * Convert 64bit big endian to cpu native uint64_t * @param be64 big endian 64bit * @return cpu native uint64_t */ -uint64_t odp_be_to_cpu_64(odp_u64be_t be64); +static inline uint64_t odp_be_to_cpu_64(odp_u64be_t be64) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return __builtin_bswap64((__odp_force uint64_t)be64); +#else + return (__odp_force uint64_t)be64; +#endif +} /* @@ -105,22 +154,42 @@ uint64_t odp_be_to_cpu_64(odp_u64be_t be64); * @param cpu16 uint16_t in cpu native format * @return big endian 16bit */ -odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16); +static inline odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force odp_u16be_t)__odp_builtin_bswap16(cpu16); +#else + return (__odp_force odp_u16be_t)cpu16; +#endif +} /** * Convert cpu native uint32_t to 32bit big endian * @param cpu32 uint32_t in cpu native format * @return big endian 32bit */ -odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32); +static inline odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force odp_u32be_t)__builtin_bswap32(cpu32); +#else + return (__odp_force odp_u32be_t)cpu32; +#endif +} /** * Convert cpu native uint64_t to 64bit big endian * @param cpu64 uint64_t in cpu native format * @return big endian 64bit */ -odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64); - +static inline odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force odp_u64be_t)__builtin_bswap64(cpu64); +#else + return (__odp_force odp_u64be_t)cpu64; +#endif +} /* * Little Endian -> CPU byte order: @@ -131,22 +200,42 @@ odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64); * @param le16 little endian 16bit * @return cpu native uint16_t */ -uint16_t odp_le_to_cpu_16(odp_u16le_t le16); +static inline uint16_t odp_le_to_cpu_16(odp_u16le_t le16) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force uint16_t)le16; +#else + return __odp_builtin_bswap16((__odp_force uint16_t)le16); +#endif +} /** * Convert 32bit little endian to cpu native uint32_t * @param le32 little endian 32bit * @return cpu native uint32_t */ -uint32_t odp_le_to_cpu_32(odp_u32le_t le32); +static inline uint32_t odp_le_to_cpu_32(odp_u32le_t le32) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force uint32_t)le32; +#else + return __builtin_bswap32((__odp_force uint32_t)le32); +#endif +} /** * Convert 64bit little endian to cpu native uint64_t * @param le64 little endian 64bit * @return cpu native uint64_t */ -uint64_t odp_le_to_cpu_64(odp_u64le_t le64); - +static inline uint64_t odp_le_to_cpu_64(odp_u64le_t le64) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force uint64_t)le64; +#else + return __builtin_bswap64((__odp_force uint64_t)le64); +#endif +} /* * CPU byte order -> Little Endian: @@ -157,21 +246,42 @@ uint64_t odp_le_to_cpu_64(odp_u64le_t le64); * @param cpu16 uint16_t in cpu native format * @return little endian 16bit */ -odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16); +static inline odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force odp_u16le_t)cpu16; +#else + return (__odp_force odp_u16le_t)__odp_builtin_bswap16(cpu16); +#endif +} /** * Convert cpu native uint32_t to 32bit little endian * @param cpu32 uint32_t in cpu native format * @return little endian 32bit */ -odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32); +static inline odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force odp_u32le_t)cpu32; +#else + return (__odp_force odp_u32le_t)__builtin_bswap32(cpu32); +#endif +} /** * Convert cpu native uint64_t to 64bit little endian * @param cpu64 uint64_t in cpu native format * @return little endian 64bit */ -odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64); +static inline odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64) +{ +#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN + return (__odp_force odp_u64le_t)cpu64; +#else + return (__odp_force odp_u64le_t)__builtin_bswap64(cpu64); +#endif +} /** * @} diff --git a/include/odp/api/spec/classification.h b/include/odp/api/spec/classification.h index 0e1addd6..344737ec 100644 --- a/include/odp/api/spec/classification.h +++ b/include/odp/api/spec/classification.h @@ -478,7 +478,10 @@ odp_pool_t odp_cls_cos_pool(odp_cos_t cos_id); * to enable applications to generate a printable value that represents * an odp_cos_t handle. */ -uint64_t odp_cos_to_u64(odp_cos_t hdl); +static inline uint64_t odp_cos_to_u64(odp_cos_t hdl) +{ + return _odp_pri(hdl); +} /** * Get printable value for an odp_pmr_t @@ -491,7 +494,10 @@ uint64_t odp_cos_to_u64(odp_cos_t hdl); * to enable applications to generate a printable value that represents * an odp_pmr_t handle. */ -uint64_t odp_pmr_to_u64(odp_pmr_t hdl); +static inline uint64_t odp_pmr_to_u64(odp_pmr_t hdl) +{ + return _odp_pri(hdl); +} /** * @} diff --git a/include/odp/api/spec/cpu.h b/include/odp/api/spec/cpu.h index 0f47e479..8d672d07 100644 --- a/include/odp/api/spec/cpu.h +++ b/include/odp/api/spec/cpu.h @@ -19,8 +19,6 @@ extern "C" { #endif -#include - /** @defgroup odp_cpu ODP CPU * @{ */ @@ -167,7 +165,24 @@ uint64_t odp_cpu_cycles_resolution(void); * pause within the loop may save energy and improve system performance as * CPU polling frequency is reduced. */ -void odp_cpu_pause(void); +static inline void odp_cpu_pause(void) +{ +#if defined(__x86_64__) +#ifdef __SSE2__ + __asm volatile("pause"); +#else + __asm volatile("rep; nop"); +#endif +#elif defined(__mips64__) + __asm volatile("nop"); + __asm volatile("nop"); + __asm volatile("nop"); + __asm volatile("nop"); + __asm volatile("nop"); +#else + /* .. */ +#endif +} /** * @} diff --git a/include/odp/api/spec/crypto.h b/include/odp/api/spec/crypto.h index 9855bf98..9b702e35 100644 --- a/include/odp/api/spec/crypto.h +++ b/include/odp/api/spec/crypto.h @@ -640,7 +640,10 @@ void odp_crypto_compl_result(odp_crypto_compl_t completion_event, * to enable applications to generate a printable value that represents * an odp_crypto_session_t handle. */ -uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl); +static inline uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) +{ + return (uint64_t)hdl; +} /** * Get printable value for an odp_crypto_compl_t @@ -653,7 +656,10 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl); * to enable applications to generate a printable value that represents * an odp_crypto_compl_t handle. */ -uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl); +static inline uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl) +{ + return _odp_pri(hdl); +} /** * Initialize crypto session parameters diff --git a/include/odp/api/spec/debug.h b/include/odp/api/spec/debug.h index b3b170f3..da49ef1e 100644 --- a/include/odp/api/spec/debug.h +++ b/include/odp/api/spec/debug.h @@ -27,6 +27,27 @@ extern "C" { * * @param msg Compile time error message to be displayed if cond is false */ +#if defined(__GNUC__) && !defined(__clang__) + +#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) + +/** + * @internal _Static_assert was only added in GCC 4.6. Provide a weak replacement + * for previous versions. + */ +#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \ + [sizeof(struct { unsigned int error_if_negative:(e) ? 1 : -1; })]) + +#endif + +#endif + +/** + * @internal Compile time assertion macro. Fails compilation and outputs 'msg' + * if condition 'cond' is false. Macro definition is empty when compiler is not + * supported or the compiler does not support static assertion. + */ +#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) #ifdef __cplusplus } diff --git a/include/odp/api/spec/event.h b/include/odp/api/spec/event.h index fdfa52d1..26b21669 100644 --- a/include/odp/api/spec/event.h +++ b/include/odp/api/spec/event.h @@ -37,10 +37,13 @@ extern "C" { /** * @typedef odp_event_type_t - * ODP event types: - * ODP_EVENT_BUFFER, ODP_EVENT_PACKET, ODP_EVENT_TIMEOUT, - * ODP_EVENT_CRYPTO_COMPL */ +typedef enum odp_event_type_t { + ODP_EVENT_BUFFER = 1, + ODP_EVENT_PACKET = 2, + ODP_EVENT_TIMEOUT = 3, + ODP_EVENT_CRYPTO_COMPL = 4, +} odp_event_type_t; /** * Get event type @@ -62,7 +65,10 @@ odp_event_type_t odp_event_type(odp_event_t event); * to enable applications to generate a printable value that represents * an odp_event_t handle. */ -uint64_t odp_event_to_u64(odp_event_t hdl); +static inline uint64_t odp_event_to_u64(odp_event_t hdl) +{ + return _odp_pri(hdl); +} /** * Free event diff --git a/include/odp/api/spec/hash.h b/include/odp/api/spec/hash.h index 66b740e2..07e7d36a 100644 --- a/include/odp/api/spec/hash.h +++ b/include/odp/api/spec/hash.h @@ -18,8 +18,6 @@ extern "C" { #endif -#include - /** @defgroup odp_hash ODP HASH FUNCTIONS * ODP Hash functions * @{ diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h index 154cdf8f..54936401 100644 --- a/include/odp/api/spec/init.h +++ b/include/odp/api/spec/init.h @@ -27,11 +27,6 @@ extern "C" { #endif -#include -#include -#include -#include - /** @defgroup odp_initialization ODP INITIALIZATION * Initialisation operations. * @{ diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 4a86ebad..000d74ce 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -19,8 +19,6 @@ extern "C" { #endif -#include - /** @defgroup odp_packet ODP PACKET * Operations on a packet. * @{ @@ -55,6 +53,13 @@ extern "C" { * @typedef odp_packet_color_t * Color of packet for shaper/drop processing */ +typedef enum { + ODP_PACKET_GREEN = 0, + ODP_PACKET_YELLOW = 1, + ODP_PACKET_RED = 2, + ODP_PACKET_ALL_COLORS = 3, +} odp_packet_color_t; +#define ODP_NUM_PACKET_COLORS 3 /** * @def ODP_PACKET_GREEN @@ -1384,7 +1389,10 @@ int odp_packet_is_valid(odp_packet_t pkt); * to enable applications to generate a printable value that represents * an odp_packet_t handle. */ -uint64_t odp_packet_to_u64(odp_packet_t hdl); +static inline uint64_t odp_packet_to_u64(odp_packet_t hdl) +{ + return _odp_pri(hdl); +} /** * Get printable value for an odp_packet_seg_t @@ -1397,7 +1405,10 @@ uint64_t odp_packet_to_u64(odp_packet_t hdl); * to enable applications to generate a printable value that represents * an odp_packet_seg_t handle. */ -uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl); +static inline uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl) +{ + return _odp_pri(hdl); +} /** * @} diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h index 377b75ba..c58d8b8c 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -19,9 +19,6 @@ extern "C" { #endif -#include -#include - /** @addtogroup odp_packet * Boolean operations on a packet. * @{ diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 85cd6d18..00eafaa4 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -19,10 +19,6 @@ extern "C" { #endif -#include -#include -#include - /** @defgroup odp_packet_io ODP PACKET IO * Operations on a packet Input/Output interface. * @@ -48,11 +44,19 @@ extern "C" { * @typedef odp_pktin_queue_t * Direct packet input queue handle */ +typedef struct odp_pktin_queue_t { + odp_pktio_t pktio; /**< pktio handle */ + int index; /**< pktio queue index */ +} odp_pktin_queue_t; /** * @typedef odp_pktout_queue_t * Direct packet output queue handle */ +typedef struct odp_pktout_queue_t { + odp_pktio_t pktio; /**< pktio handle */ + int index; /**< pktio queue index */ +} odp_pktout_queue_t; /** * @def ODP_PKTIO_INVALID @@ -64,16 +68,19 @@ extern "C" { * Minimum size of output buffer for odp_pktio_mac_addr() * Actual MAC address sizes may be different. */ +#define ODP_PKTIO_MACADDR_MAXSIZE 16 /** * @def ODP_PKTIN_NO_WAIT * Do not wait on packet input */ +#define ODP_PKTIN_NO_WAIT 0 /** * @def ODP_PKTIN_WAIT * Wait infinitely on packet input */ +#define ODP_PKTIN_WAIT UINT64_MAX /** * Packet input mode @@ -957,7 +964,10 @@ int odp_pktio_index(odp_pktio_t pktio); * to enable applications to generate a printable value that represents * an odp_pktio_t handle. */ -uint64_t odp_pktio_to_u64(odp_pktio_t pktio); +static inline uint64_t odp_pktio_to_u64(odp_pktio_t hdl) +{ + return _odp_pri(hdl); +} /** * Initialize pktio params diff --git a/include/odp/api/spec/packet_io_stats.h b/include/odp/api/spec/packet_io_stats.h index 299ecd0e..1f12693d 100644 --- a/include/odp/api/spec/packet_io_stats.h +++ b/include/odp/api/spec/packet_io_stats.h @@ -23,90 +23,6 @@ extern "C" { */ /** - * Packet IO statistics - * - * Packet IO statistics counters follow RFCs for Management Information Base - * (MIB)for use with network management protocols in the Internet community: - * https://tools.ietf.org/html/rfc3635 - * https://tools.ietf.org/html/rfc2863 - * https://tools.ietf.org/html/rfc2819 - */ -typedef struct odp_pktio_stats_t { - /** - * The number of octets in valid MAC frames received on this interface, - * including the MAC header and FCS. See ifHCInOctets counter - * description in RFC 3635 for details. - */ - uint64_t in_octets; - - /** - * The number of packets, delivered by this sub-layer to a higher - * (sub-)layer, which were not addressed to a multicast or broadcast - * address at this sub-layer. See ifHCInUcastPkts in RFC 2863, RFC 3635. - */ - uint64_t in_ucast_pkts; - - /** - * The number of inbound packets which were chosen to be discarded - * even though no errors had been detected to prevent their being - * deliverable to a higher-layer protocol. One possible reason for - * discarding such a packet could be to free up buffer space. - * See ifInDiscards in RFC 2863. - */ - uint64_t in_discards; - - /** - * The sum for this interface of AlignmentErrors, FCSErrors, FrameTooLongs, - * InternalMacReceiveErrors. See ifInErrors in RFC 3635. - */ - uint64_t in_errors; - - /** - * For packet-oriented interfaces, the number of packets received via - * the interface which were discarded because of an unknown or - * unsupported protocol. For character-oriented or fixed-length - * interfaces that support protocol multiplexing the number of - * transmission units received via the interface which were discarded - * because of an unknown or unsupported protocol. For any interface - * that does not support protocol multiplexing, this counter will always - * be 0. See ifInUnknownProtos in RFC 2863, RFC 3635. - */ - uint64_t in_unknown_protos; - - /** - * The number of octets transmitted in valid MAC frames on this - * interface, including the MAC header and FCS. This does include - * the number of octets in valid MAC Control frames transmitted on - * this interface. See ifHCOutOctets in RFC 3635. - */ - uint64_t out_octets; - - /** - * The total number of packets that higher-level protocols requested - * be transmitted, and which were not addressed to a multicast or - * broadcast address at this sub-layer, including those that were - * discarded or not sent. does not include MAC Control frames. - * See ifHCOutUcastPkts RFC 2863, 3635. - */ - uint64_t out_ucast_pkts; - - /** - * The number of outbound packets which were chosen to be discarded - * even though no errors had been detected to prevent their being - * transmitted. One possible reason for discarding such a packet could - * be to free up buffer space. See OutDiscards in RFC 2863. - */ - uint64_t out_discards; - - /** - * The sum for this interface of SQETestErrors, LateCollisions, - * ExcessiveCollisions, InternalMacTransmitErrors and - * CarrierSenseErrors. See ifOutErrors in RFC 3635. - */ - uint64_t out_errors; -} odp_pktio_stats_t; - -/** * Get statistics for pktio handle * * @param pktio Packet IO handle diff --git a/include/odp/api/spec/pool.h b/include/odp/api/spec/pool.h index c0de195a..9d9e0227 100644 --- a/include/odp/api/spec/pool.h +++ b/include/odp/api/spec/pool.h @@ -19,8 +19,6 @@ extern "C" { #endif -#include - /** @defgroup odp_pool ODP POOL * Operations on a pool. * @{ diff --git a/include/odp/api/spec/queue.h b/include/odp/api/spec/queue.h index 7972feac..b5045392 100644 --- a/include/odp/api/spec/queue.h +++ b/include/odp/api/spec/queue.h @@ -19,9 +19,6 @@ extern "C" { #endif -#include -#include - /** @defgroup odp_queue ODP QUEUE * Macros and operation on a queue. * @{ @@ -66,6 +63,13 @@ typedef enum odp_queue_type_t { } odp_queue_type_t; /** + * @def ODP_QUEUE_TYPE_TM + * Traffic manager queue + * @note Internal to the implementation -- not part of queue type API + */ +#define ODP_QUEUE_TYPE_TM 4 + +/** * Queue operation mode */ typedef enum odp_queue_op_mode_t { @@ -372,7 +376,10 @@ int odp_queue_lock_count(odp_queue_t queue); * to enable applications to generate a printable value that represents * an odp_queue_t handle. */ -uint64_t odp_queue_to_u64(odp_queue_t hdl); +static inline uint64_t odp_queue_to_u64(odp_queue_t hdl) +{ + return _odp_pri(hdl); +} /** * Initialize queue params diff --git a/include/odp/api/spec/schedule.h b/include/odp/api/spec/schedule.h index 8244746d..ae58d738 100644 --- a/include/odp/api/spec/schedule.h +++ b/include/odp/api/spec/schedule.h @@ -19,12 +19,6 @@ extern "C" { #endif -#include -#include -#include -#include -#include - /** @defgroup odp_scheduler ODP SCHEDULER * Operations on the scheduler. * @{ @@ -34,11 +28,13 @@ extern "C" { * @def ODP_SCHED_WAIT * Wait infinitely */ +#define ODP_SCHED_WAIT UINT64_MAX /** * @def ODP_SCHED_NO_WAIT * Do not wait */ +#define ODP_SCHED_NO_WAIT 0 /** * @def ODP_SCHED_GROUP_NAME_LEN @@ -54,16 +50,19 @@ extern "C" { * @def ODP_SCHED_GROUP_ALL * Predefined scheduler group of all threads */ +#define ODP_SCHED_GROUP_ALL 0 /** * @def ODP_SCHED_GROUP_WORKER * Predefined scheduler group of all worker threads */ +#define ODP_SCHED_GROUP_WORKER 1 /** * @def ODP_SCHED_GROUP_CONTROL * Predefined scheduler group of all control threads */ +#define ODP_SCHED_GROUP_CONTROL 2 /** * Schedule wait time diff --git a/include/odp/api/spec/schedule_types.h b/include/odp/api/spec/schedule_types.h index 8a4e42c6..5081b0e7 100644 --- a/include/odp/api/spec/schedule_types.h +++ b/include/odp/api/spec/schedule_types.h @@ -31,16 +31,19 @@ extern "C" { * @def ODP_SCHED_PRIO_HIGHEST * Highest scheduling priority */ +#define ODP_SCHED_PRIO_HIGHEST 0 /** * @def ODP_SCHED_PRIO_NORMAL * Normal scheduling priority */ +#define ODP_SCHED_PRIO_NORMAL 4 /** * @def ODP_SCHED_PRIO_LOWEST * Lowest scheduling priority */ +#define ODP_SCHED_PRIO_LOWEST 7 /** * @def ODP_SCHED_PRIO_DEFAULT @@ -48,6 +51,7 @@ extern "C" { * level - throughput, load balancing and synchronization features are more * important than priority scheduling. */ +#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL /** * @typedef odp_schedule_sync_t @@ -64,6 +68,7 @@ extern "C" { * for concurrent processing. Application is responsible for queue context * synchronization and event ordering (SW synchronization). */ +#define ODP_SCHED_SYNC_PARALLEL 0 /** * @def ODP_SCHED_SYNC_ATOMIC @@ -80,6 +85,7 @@ extern "C" { * context. User may allow the scheduler to release the context earlier than * that by calling odp_schedule_release_atomic(). */ +#define ODP_SCHED_SYNC_ATOMIC 1 /** * @def ODP_SCHED_SYNC_ORDERED @@ -106,6 +112,7 @@ extern "C" { * reordering and are skipped at this time (but can be ordered again within * another context). */ +#define ODP_SCHED_SYNC_ORDERED 2 /** * @typedef odp_schedule_group_t @@ -113,43 +120,6 @@ extern "C" { */ /** - * @def ODP_SCHED_GROUP_ALL - * Group of all threads. All active worker and control threads belong to this - * group. The group is automatically updated when new threads enter or old - * threads exit ODP. - */ - -/** - * @def ODP_SCHED_GROUP_WORKER - * Group of all worker threads. All active worker threads belong to this - * group. The group is automatically updated when new worker threads enter or - * old threads exit ODP. - */ - -/** Scheduler parameters */ -typedef struct odp_schedule_param_t { - /** Priority level - * - * Default value is ODP_SCHED_PRIO_DEFAULT. */ - odp_schedule_prio_t prio; - - /** Synchronization method - * - * Default value is ODP_SCHED_SYNC_PARALLEL. */ - odp_schedule_sync_t sync; - - /** Thread group - * - * Default value is ODP_SCHED_GROUP_ALL. */ - odp_schedule_group_t group; - - /** Ordered lock count for this queue - * - * Default value is 0. */ - unsigned lock_count; -} odp_schedule_param_t; - -/** * @} */ diff --git a/include/odp/api/spec/shared_memory.h b/include/odp/api/spec/shared_memory.h index 1a9c1299..e67ca77f 100644 --- a/include/odp/api/spec/shared_memory.h +++ b/include/odp/api/spec/shared_memory.h @@ -14,7 +14,6 @@ #ifndef ODP_API_SHARED_MEMORY_H_ #define ODP_API_SHARED_MEMORY_H_ #include -#include #ifdef __cplusplus extern "C" { @@ -215,7 +214,10 @@ void odp_shm_print_all(void); * to enable applications to generate a printable value that represents * an odp_shm_t handle. */ -uint64_t odp_shm_to_u64(odp_shm_t hdl); +static inline uint64_t odp_shm_to_u64(odp_shm_t hdl) +{ + return _odp_pri(hdl); +} /** * @} diff --git a/include/odp/api/spec/std_clib.h b/include/odp/api/spec/std_clib.h index 33e9db53..e7758cbd 100644 --- a/include/odp/api/spec/std_clib.h +++ b/include/odp/api/spec/std_clib.h @@ -14,6 +14,8 @@ #define ODP_API_STD_CLIB_H_ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -38,7 +40,10 @@ extern "C" { * * @return 'dst' address */ -void *odp_memcpy(void *dst, const void *src, size_t num); +static inline void *odp_memcpy(void *dst, const void *src, size_t num) +{ + return memcpy(dst, src, num); +} /** * Memset @@ -52,7 +57,10 @@ void *odp_memcpy(void *dst, const void *src, size_t num); * * @return 'ptr' address */ -void *odp_memset(void *ptr, int value, size_t num); +static inline void *odp_memset(void *ptr, int value, size_t num) +{ + return memset(ptr, value, num); +} /** * Memcmp @@ -70,7 +78,10 @@ void *odp_memset(void *ptr, int value, size_t num); * @retval >0 when the contents of memory blocks do not match, and * block 'ptr1' is greater than block 'ptr2' */ -int odp_memcmp(const void *ptr1, const void *ptr2, size_t num); +static inline int odp_memcmp(const void *ptr1, const void *ptr2, size_t num) +{ + return memcmp(ptr1, ptr2, num); +} /** * @} diff --git a/include/odp/api/spec/std_types.h b/include/odp/api/spec/std_types.h index ec6a6df6..eef294a2 100644 --- a/include/odp/api/spec/std_types.h +++ b/include/odp/api/spec/std_types.h @@ -30,6 +30,7 @@ extern "C" { * regardless which compiler is used as this facilities interoperability * between e.g. different compilers. */ +typedef int odp_bool_t; /** * @} diff --git a/include/odp/api/spec/sync.h b/include/odp/api/spec/sync.h index 6f87db55..2d1d472d 100644 --- a/include/odp/api/spec/sync.h +++ b/include/odp/api/spec/sync.h @@ -50,7 +50,10 @@ extern "C" { * * @see odp_mb_acquire() */ -void odp_mb_release(void); +static inline void odp_mb_release(void) +{ + __atomic_thread_fence(__ATOMIC_RELEASE); +} /** * Memory barrier for acquire operations @@ -66,7 +69,10 @@ void odp_mb_release(void); * * @see odp_mb_release() */ -void odp_mb_acquire(void); +static inline void odp_mb_acquire(void) +{ + __atomic_thread_fence(__ATOMIC_ACQUIRE); +} /** * Full memory barrier @@ -77,7 +83,10 @@ void odp_mb_acquire(void); * * This call is not needed when using ODP defined synchronization mechanisms. */ -void odp_mb_full(void); +static inline void odp_mb_full(void) +{ + __atomic_thread_fence(__ATOMIC_SEQ_CST); +} /** * @} diff --git a/include/odp/api/spec/thrmask.h b/include/odp/api/spec/thrmask.h index 3986769a..9608119f 100644 --- a/include/odp/api/spec/thrmask.h +++ b/include/odp/api/spec/thrmask.h @@ -18,8 +18,6 @@ extern "C" { #endif -#include - /** @addtogroup odp_thread * Thread mask operations. * @{ diff --git a/include/odp/api/spec/time.h b/include/odp/api/spec/time.h index fcc94c98..97e93c68 100644 --- a/include/odp/api/spec/time.h +++ b/include/odp/api/spec/time.h @@ -40,6 +40,7 @@ extern "C" { * @def ODP_TIME_NULL * Zero time stamp */ +#define ODP_TIME_NULL ((odp_time_t){0, 0}) /** * Current local time diff --git a/include/odp/api/spec/traffic_mngr.h b/include/odp/api/spec/traffic_mngr.h index 71198bbd..6e2b903a 100644 --- a/include/odp/api/spec/traffic_mngr.h +++ b/include/odp/api/spec/traffic_mngr.h @@ -12,9 +12,6 @@ extern "C" { #endif -#include -#include - /** * @file * @@ -47,12 +44,14 @@ extern "C" { * The maximum number of TM systems that may be created. On some platforms * this might be much more limited to as little as one hardware TM system. */ +#define ODP_TM_MAX_NUM_SYSTEMS 64 /** * @def ODP_TM_MAX_PRIORITIES * The largest range of priorities that any TM system can support. All strict * priority values MUST in the range 0..ODP_TM_MAX_PRIORITIES-1. */ +#define ODP_TM_MAX_PRIORITIES 16 /** * @def ODP_TM_MAX_LEVELS @@ -61,61 +60,72 @@ extern "C" { * Smaller tm_node levels are associated with tm_nodes closer to the TM system * egress. */ +#define ODP_TM_MAX_LEVELS 8 /** * @def ODP_TM_MIN_SCHED_WEIGHT * The smallest SCHED weight is 1 (i.e. 0 is not a legal WFQ/WRR value). */ +#define ODP_TM_MIN_SCHED_WEIGHT 1 /** * @def ODP_TM_MAX_SCHED_WEIGHT * The largest weight any TM system can support (at least from a configuration * standpoint). A given TM system could have a smaller value. */ +#define ODP_TM_MAX_SCHED_WEIGHT 255 /** * @def ODP_TM_MAX_TM_QUEUES * The largest number of tm_queues that can handled by any one TM system. */ +#define ODP_TM_MAX_TM_QUEUES (16 * 1024 * 1024) /** * @def ODP_TM_MAX_NUM_OUTPUTS * The largest number of outputs that can be configured for any one TM system. */ +#define ODP_TM_MAX_NUM_OUTPUTS 256 /** * @def ODP_TM_MAX_NUM_TM_NODES * The largest number of tm_nodes that can be in existence for any one TM * system. */ +#define ODP_TM_MAX_NUM_TM_NODES (1024 * 1024) /** * @def ODP_TM_MAX_TM_NODE_FANIN * The largest number of fan-in "inputs" that can be simultaneously connected * to a single tm_node. */ +#define ODP_TM_MAX_TM_NODE_FANIN (1024 * 1024) /** * @def ODP_TM_MIN_SHAPER_BW * The largest amount of bandwidth that any shaper's peak or commit rate can * be set to. It is in units of 1000 bytes/second. */ +#define ODP_TM_MIN_SHAPER_BW 1 /** * @def ODP_TM_MAX_SHAPER_BW * The largest amount of bandwidth that any shaper's peak or commit rate can * be set to. It is in units of 1000 bytes/second. */ +#define ODP_TM_MAX_SHAPER_BW 12500000 /** * @def ODP_NUM_SHAPER_COLORS * The number of enumeration values defined in the odp_tm_shaper_color_t type. */ +#define ODP_NUM_SHAPER_COLORS 3 /** * @def ODP_TM_INVALID_PRIORITY * Used to indicate an invalid priority value. */ +#define ODP_TM_INVALID_PRIORITY 255 /** * @typedef odp_tm_percent_t @@ -126,6 +136,7 @@ extern "C" { * in any event will never be larger than 500% (i.e. it MUST be capped at * 50000). */ +typedef uint16_t odp_tm_percent_t; /** * @typedef odp_tm_t @@ -188,6 +199,7 @@ extern "C" { * Constant that is used to refer to the egress/root node of the TM subsystem's * tree/hierarchy of nodes. */ +#define ODP_TM_ROOT ((odp_tm_handle_t)-1) /** Per Level Capabilities * diff --git a/include/odp_api.h b/include/odp_api.h index ec7fcd2e..31355e69 100644 --- a/include/odp_api.h +++ b/include/odp_api.h @@ -18,45 +18,288 @@ extern "C" { #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#define _GNU_SOURCE +#include +#include +#include + +#define ODP_HANDLE_T(obj) struct obj##_T* obj; + +/** Get value of an ODP handle */ +#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle)) + +/** Get printable value of an ODP handle */ +#define _odp_pri(handle) ((uint64_t)_odp_typeval(handle)) + +/** Convert a scalar to a typed handle */ +#define _odp_cast_scalar(type, val) ((type)(uintptr_t)(val)) + +/* + * Types, handles, #defines are defined here to avoid circular dependencies + * in the API header files that include the function declarations. + */ + +#define ODP_THREAD_COUNT_MAX 128 + +#if defined __OCTEON__ +#define _ODP_CACHE_LINE_SIZE 128 +#else +#define _ODP_CACHE_LINE_SIZE 64 +#endif + +#ifdef __GNUC__ + +#define ODP_ALIGNED(x) __attribute__((__aligned__(x))) + +#define ODP_PACKED __attribute__((__packed__)) + +#define ODP_OFFSETOF(type, member) __builtin_offsetof(type, member) + +#define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member) + +#else +#error Please add support for your compiler in odp_api.h +#endif + +#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE + +#define ODP_PAGE_SIZE 4096 + +#define ODP_ALIGNED_CACHE ODP_ALIGNED(ODP_CACHE_LINE_SIZE) + +#define ODP_ALIGNED_PAGE ODP_ALIGNED(ODP_PAGE_SIZE) + +typedef struct { + uint64_t v; /**< Actual storage for the atomic variable */ +#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 + /* Some architectures do not support lock-free operations on 64-bit + * data types. We use a spin lock to ensure atomicity. */ + char lock; /**< Spin lock (if needed) used to ensure atomic access */ +#endif +} odp_atomic_u64_t __attribute__((aligned(sizeof(uint64_t)))); + +typedef struct { + uint32_t v; /**< Actual storage for the atomic variable */ +} odp_atomic_u32_t __attribute__((aligned(sizeof(uint32_t)))); + +struct odp_barrier_s { + uint32_t count; /**< Thread count */ + odp_atomic_u32_t bar; /**< Barrier counter */ +}; +typedef struct odp_barrier_s odp_barrier_t; + +typedef ODP_HANDLE_T(odp_buffer_t); + +#ifdef __CHECKER__ +#define __odp_bitwise __attribute__((bitwise)) +#define __odp_force __attribute__((force)) +#else +#define __odp_bitwise +#define __odp_force +#endif + +typedef uint16_t __odp_bitwise odp_u16le_t; +typedef uint16_t __odp_bitwise odp_u16be_t; + +typedef uint32_t __odp_bitwise odp_u32le_t; +typedef uint32_t __odp_bitwise odp_u32be_t; + +typedef uint64_t __odp_bitwise odp_u64le_t; +typedef uint64_t __odp_bitwise odp_u64be_t; + +typedef uint16_t __odp_bitwise odp_u16sum_t; +typedef uint32_t __odp_bitwise odp_u32sum_t; + +typedef ODP_HANDLE_T(odp_cos_t); +typedef uint16_t odp_cos_flow_set_t; + +#define ODP_CPUMASK_SIZE 1024 +#define ODP_CPUMASK_STR_SIZE ((ODP_CPUMASK_SIZE + 3) / 4 + 3) +typedef struct odp_cpumask_t { + uint8_t _u8[ODP_CPUMASK_SIZE / 8]; +} odp_cpumask_t __attribute__((aligned(8))); + +typedef ODP_HANDLE_T(odp_crypto_compl_t); +typedef uint64_t odp_crypto_session_t; +typedef ODP_HANDLE_T(odp_event_t); +typedef ODP_HANDLE_T(odp_flowsig_t); +typedef uint64_t odp_instance_t; +typedef ODP_HANDLE_T(odp_packet_t); + +typedef struct odp_pktio_stats_t { + uint64_t in_octets; + uint64_t in_ucast_pkts; + uint64_t in_discards; + uint64_t in_errors; + uint64_t in_unknown_protos; + uint64_t out_octets; + uint64_t out_ucast_pkts; + uint64_t out_discards; + uint64_t out_errors; +} odp_pktio_stats_t; + +typedef uint8_t odp_packet_seg_t; +typedef ODP_HANDLE_T(odp_pktio_t); +typedef struct odp_platform_init_t { + int ipc_ns; /**< Name space for ipc shared objects. */ +} odp_platform_init_t; +typedef ODP_HANDLE_T(odp_pmr_t); +typedef ODP_HANDLE_T(odp_pool_t); +typedef ODP_HANDLE_T(odp_queue_t); +typedef ODP_HANDLE_T(odp_queue_group_t); + +struct odp_rwlock_s { + odp_atomic_u32_t cnt; /**< lock count + 0 lock not taken + -1 write lock taken + >0 read lock(s) taken */ +}; +typedef struct odp_rwlock_s odp_rwlock_t; + +struct odp_rwlock_recursive_s { + odp_rwlock_t lock; /**< the lock */ + int wr_owner; /**< write owner thread */ + uint32_t wr_cnt; /**< write recursion count */ + uint8_t rd_cnt[ODP_THREAD_COUNT_MAX]; /**< read recursion count */ +}; +typedef struct odp_rwlock_recursive_s odp_rwlock_recursive_t; + +typedef int odp_schedule_prio_t; +typedef int odp_schedule_sync_t; +typedef int odp_schedule_group_t; + +/** Scheduler parameters */ +typedef struct odp_schedule_param_t { + /** Priority level + * + * Default value is ODP_SCHED_PRIO_DEFAULT. */ + odp_schedule_prio_t prio; + + /** Synchronization method + * + * Default value is ODP_SCHED_SYNC_PARALLEL. */ + odp_schedule_sync_t sync; + + /** Thread group + * + * Default value is ODP_SCHED_GROUP_ALL. */ + odp_schedule_group_t group; + + /** Ordered lock count for this queue + * + * Default value is 0. */ + unsigned lock_count; +} odp_schedule_param_t; + +typedef ODP_HANDLE_T(odp_shm_t); + +struct odp_spinlock_s { + char lock; /**< lock flag, should match odp_atomic_flag_t */ +}; +typedef struct odp_spinlock_s odp_spinlock_t; + +struct odp_spinlock_recursive_s { + odp_spinlock_t lock; /**< the lock */ + int owner; /**< thread owning the lock */ + uint32_t cnt; /**< recursion count */ +}; +typedef struct odp_spinlock_recursive_s odp_spinlock_recursive_t; + +#define ODP_THRMASK_STR_SIZE ODP_CPUMASK_STR_SIZE +typedef struct odp_thrmask_t { + odp_cpumask_t m; +} odp_thrmask_t; + +struct odp_ticketlock_s { + odp_atomic_u32_t next_ticket; /**< Next ticket */ + odp_atomic_u32_t cur_ticket; /**< Current ticket */ +}; +typedef struct odp_ticketlock_s odp_ticketlock_t; + +typedef ODP_HANDLE_T(odp_timeout_t); +typedef ODP_HANDLE_T(odp_timer_t); +struct odp_timer_pool_s; +typedef struct odp_timer_pool_s *odp_timer_pool_t; +typedef struct odp_time_t { + int64_t tv_sec; /**< @internal Seconds */ + int64_t tv_nsec; /**< @internal Nanoseconds */ +} odp_time_t; +typedef uint64_t odp_tm_handle_t; +typedef odp_tm_handle_t odp_tm_t; +typedef odp_tm_handle_t odp_tm_queue_t; +typedef odp_tm_handle_t odp_tm_node_t; +typedef odp_tm_handle_t odp_tm_shaper_t; +typedef odp_tm_handle_t odp_tm_sched_t; +typedef odp_tm_handle_t odp_tm_threshold_t; +typedef odp_tm_handle_t odp_tm_wred_t; + +#define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0xffffffff) +#define ODP_COS_INVALID _odp_cast_scalar(odp_cos_t, ~0) +#define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL) +#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff) +#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0xffffffff) +#define ODP_PACKET_OFFSET_INVALID (0x0fffffff) +#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1) +#define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0) +#define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0) +#define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff) +#define ODP_QUEUE_INVALID _odp_cast_scalar(odp_queue_t, 0) +#define ODP_SCHED_GROUP_INVALID -1 +#define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0) +#define ODP_SHM_NULL ODP_SHM_INVALID +#define ODP_TIMEOUT_INVALID _odp_cast_scalar(odp_timeout_t, 0xffffffff) +#define ODP_TIMER_INVALID _odp_cast_scalar(odp_timer_t, 0xffffffff) +#define ODP_TIMER_POOL_INVALID NULL +#define ODP_TM_INVALID 0 + +#define ODP_COS_NAME_LEN 32 +#define ODP_POOL_NAME_LEN 32 +#define ODP_QUEUE_NAME_LEN 32 +#define ODP_SCHED_GROUP_NAME_LEN 32 +#define ODP_SHM_NAME_LEN 32 +#define ODP_TIMER_POOL_NAME_LEN 32 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __cplusplus } diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 0bc98427..0b4fe652 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -20,85 +20,8 @@ odpinclude_HEADERS = \ odpapiincludedir= $(includedir)/odp/api odpapiinclude_HEADERS = \ - $(srcdir)/include/odp/api/align.h \ - $(srcdir)/include/odp/api/atomic.h \ - $(srcdir)/include/odp/api/barrier.h \ - $(srcdir)/include/odp/api/buffer.h \ - $(srcdir)/include/odp/api/byteorder.h \ - $(srcdir)/include/odp/api/classification.h \ - $(srcdir)/include/odp/api/compiler.h \ - $(srcdir)/include/odp/api/cpu.h \ - $(srcdir)/include/odp/api/cpumask.h \ - $(srcdir)/include/odp/api/crypto.h \ - $(srcdir)/include/odp/api/debug.h \ - $(srcdir)/include/odp/api/errno.h \ - $(srcdir)/include/odp/api/event.h \ - $(srcdir)/include/odp/api/hash.h \ - $(srcdir)/include/odp/api/hints.h \ - $(srcdir)/include/odp/api/init.h \ - $(srcdir)/include/odp/api/packet_flags.h \ - $(srcdir)/include/odp/api/packet.h \ - $(srcdir)/include/odp/api/packet_io.h \ - $(srcdir)/include/odp/api/packet_io_stats.h \ - $(srcdir)/include/odp/api/pool.h \ - $(srcdir)/include/odp/api/queue.h \ - $(srcdir)/include/odp/api/random.h \ - $(srcdir)/include/odp/api/rwlock.h \ - $(srcdir)/include/odp/api/rwlock_recursive.h \ - $(srcdir)/include/odp/api/schedule.h \ - $(srcdir)/include/odp/api/schedule_types.h \ - $(srcdir)/include/odp/api/shared_memory.h \ - $(srcdir)/include/odp/api/spinlock.h \ - $(srcdir)/include/odp/api/spinlock_recursive.h \ - $(srcdir)/include/odp/api/std_clib.h \ - $(srcdir)/include/odp/api/std_types.h \ - $(srcdir)/include/odp/api/sync.h \ - $(srcdir)/include/odp/api/system_info.h \ - $(srcdir)/include/odp/api/thread.h \ - $(srcdir)/include/odp/api/thrmask.h \ - $(srcdir)/include/odp/api/ticketlock.h \ - $(srcdir)/include/odp/api/time.h \ - $(srcdir)/include/odp/api/timer.h \ - $(srcdir)/include/odp/api/traffic_mngr.h \ - $(srcdir)/include/odp/api/version.h \ $(srcdir)/arch/@ARCH_DIR@/odp/api/cpu_arch.h -odpapiplatincludedir= $(includedir)/odp/api/plat -odpapiplatinclude_HEADERS = \ - $(builddir)/include/odp/api/plat/static_inline.h \ - $(srcdir)/include/odp/api/plat/atomic_inlines.h \ - $(srcdir)/include/odp/api/plat/atomic_types.h \ - $(srcdir)/include/odp/api/plat/barrier_types.h \ - $(srcdir)/include/odp/api/plat/buffer_types.h \ - $(srcdir)/include/odp/api/plat/byteorder_inlines.h \ - $(srcdir)/include/odp/api/plat/byteorder_types.h \ - $(srcdir)/include/odp/api/plat/classification_types.h \ - $(srcdir)/include/odp/api/plat/cpumask_types.h \ - $(srcdir)/include/odp/api/plat/crypto_types.h \ - $(srcdir)/include/odp/api/plat/event_types.h \ - $(srcdir)/include/odp/api/plat/init_types.h \ - $(srcdir)/include/odp/api/plat/packet_types.h \ - $(srcdir)/include/odp/api/plat/packet_io_types.h \ - $(srcdir)/include/odp/api/plat/pool_types.h \ - $(srcdir)/include/odp/api/plat/queue_types.h \ - $(srcdir)/include/odp/api/plat/rwlock_types.h \ - $(srcdir)/include/odp/api/plat/rwlock_recursive_types.h \ - $(srcdir)/include/odp/api/plat/schedule_types.h \ - $(srcdir)/include/odp/api/plat/shared_memory_types.h \ - $(srcdir)/include/odp/api/plat/spinlock_types.h \ - $(srcdir)/include/odp/api/plat/spinlock_recursive_types.h \ - $(srcdir)/include/odp/api/plat/std_clib_inlines.h \ - $(srcdir)/include/odp/api/plat/strong_types.h \ - $(srcdir)/include/odp/api/plat/sync_inlines.h \ - $(srcdir)/include/odp/api/plat/thread_types.h \ - $(srcdir)/include/odp/api/plat/thrmask_types.h \ - $(srcdir)/include/odp/api/plat/ticketlock_inlines.h \ - $(srcdir)/include/odp/api/plat/ticketlock_types.h \ - $(srcdir)/include/odp/api/plat/time_types.h \ - $(srcdir)/include/odp/api/plat/timer_types.h \ - $(srcdir)/include/odp/api/plat/traffic_mngr_types.h \ - $(srcdir)/include/odp/api/plat/version_types.h - odpdrvincludedir = $(includedir)/odp/drv odpdrvinclude_HEADERS = \ $(srcdir)/include/odp/drv/compiler.h @@ -137,9 +60,11 @@ noinst_HEADERS = \ ${srcdir}/include/odp_schedule_if.h \ ${srcdir}/include/odp_sorted_list_internal.h \ ${srcdir}/include/odp_shm_internal.h \ + ${srcdir}/include/odp_ticketlock_internal.h \ ${srcdir}/include/odp_timer_internal.h \ ${srcdir}/include/odp_timer_wheel_internal.h \ ${srcdir}/include/odp_traffic_mngr_internal.h \ + ${srcdir}/include/odp_version_internal.h \ ${srcdir}/include/protocols/eth.h \ ${srcdir}/include/protocols/ip.h \ ${srcdir}/include/protocols/ipsec.h \ @@ -154,7 +79,6 @@ __LIB__libodp_linux_la_SOURCES = \ odp_atomic.c \ odp_barrier.c \ odp_buffer.c \ - odp_byteorder.c \ odp_classification.c \ odp_cpu.c \ odp_cpumask.c \ @@ -193,8 +117,6 @@ __LIB__libodp_linux_la_SOURCES = \ odp_sorted_list.c \ odp_spinlock.c \ odp_spinlock_recursive.c \ - odp_std_clib.c \ - odp_sync.c \ odp_system_info.c \ odp_thread.c \ odp_thrmask.c \ diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c index 9aed7a9f..47a5b389 100644 --- a/platform/linux-generic/_fdserver.c +++ b/platform/linux-generic/_fdserver.c @@ -36,8 +36,10 @@ * process and get converted both when registered or looked up. */ +#define _GNU_SOURCE +#include + #include -#include #include #include #include <_fdserver_internal.h> diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index f8898346..e10ab146 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -45,13 +45,12 @@ * memory: * _odp_ishm_reserve(), _odp_ishm_free*() and _odp_ishm_lookup*()... */ + +#include + #include #include #include -#include -#include -#include -#include #include #include #include diff --git a/platform/linux-generic/_ishmphy.c b/platform/linux-generic/_ishmphy.c index 2b2d1007..bbead5e1 100644 --- a/platform/linux-generic/_ishmphy.c +++ b/platform/linux-generic/_ishmphy.c @@ -8,12 +8,11 @@ * This file handles the lower end of the ishm memory allocator: * It performs the physical mappings. */ +#include + #include #include #include -#include -#include -#include #include #include #include <_ishm_internal.h> diff --git a/platform/linux-generic/arch/arm/odp/api/cpu_arch.h b/platform/linux-generic/arch/arm/odp/api/cpu_arch.h index 22b1da2d..048e19b3 100644 --- a/platform/linux-generic/arch/arm/odp/api/cpu_arch.h +++ b/platform/linux-generic/arch/arm/odp/api/cpu_arch.h @@ -11,12 +11,6 @@ extern "C" { #endif -#define _ODP_CACHE_LINE_SIZE 64 - -static inline void odp_cpu_pause(void) -{ -} - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c b/platform/linux-generic/arch/arm/odp_cpu_arch.c index 2ac223e0..a678e62a 100644 --- a/platform/linux-generic/arch/arm/odp_cpu_arch.c +++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c @@ -9,9 +9,6 @@ #include #include -#include -#include -#include #include #define GIGA 1000000000 diff --git a/platform/linux-generic/arch/default/odp/api/cpu_arch.h b/platform/linux-generic/arch/default/odp/api/cpu_arch.h index 22b1da2d..048e19b3 100644 --- a/platform/linux-generic/arch/default/odp/api/cpu_arch.h +++ b/platform/linux-generic/arch/default/odp/api/cpu_arch.h @@ -11,12 +11,6 @@ extern "C" { #endif -#define _ODP_CACHE_LINE_SIZE 64 - -static inline void odp_cpu_pause(void) -{ -} - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/arch/default/odp_cpu_arch.c b/platform/linux-generic/arch/default/odp_cpu_arch.c index 2ac223e0..88903ae8 100644 --- a/platform/linux-generic/arch/default/odp_cpu_arch.c +++ b/platform/linux-generic/arch/default/odp_cpu_arch.c @@ -4,14 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include -#include -#include -#include #include #define GIGA 1000000000 diff --git a/platform/linux-generic/arch/default/odp_sysinfo_parse.c b/platform/linux-generic/arch/default/odp_sysinfo_parse.c index 53e2aaea..393d8893 100644 --- a/platform/linux-generic/arch/default/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/default/odp_sysinfo_parse.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include diff --git a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h index 3582b129..3bfa0dcd 100644 --- a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h +++ b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h @@ -11,12 +11,6 @@ extern "C" { #endif -#if defined __OCTEON__ -#define _ODP_CACHE_LINE_SIZE 128 -#else -#error Please add support for your arch in cpu_arch.h -#endif - static inline void odp_cpu_pause(void) { __asm__ __volatile__ ("nop"); diff --git a/platform/linux-generic/arch/mips64/odp_cpu_arch.c b/platform/linux-generic/arch/mips64/odp_cpu_arch.c index 646acf9c..efbffd94 100644 --- a/platform/linux-generic/arch/mips64/odp_cpu_arch.c +++ b/platform/linux-generic/arch/mips64/odp_cpu_arch.c @@ -4,9 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include -#include +#include uint64_t odp_cpu_cycles(void) { diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c index 407264b7..e0e0125d 100644 --- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include diff --git a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h index 22b1da2d..048e19b3 100644 --- a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h +++ b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h @@ -11,12 +11,6 @@ extern "C" { #endif -#define _ODP_CACHE_LINE_SIZE 64 - -static inline void odp_cpu_pause(void) -{ -} - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c index 2ac223e0..88903ae8 100644 --- a/platform/linux-generic/arch/powerpc/odp_cpu_arch.c +++ b/platform/linux-generic/arch/powerpc/odp_cpu_arch.c @@ -4,14 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include -#include -#include -#include #include #define GIGA 1000000000 diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c index 3b88d55b..b62653fe 100644 --- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include diff --git a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h index 44e6b30e..048e19b3 100644 --- a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h +++ b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h @@ -11,17 +11,6 @@ extern "C" { #endif -#define _ODP_CACHE_LINE_SIZE 64 - -static inline void odp_cpu_pause(void) -{ -#ifdef __SSE2__ - __asm__ __volatile__ ("pause"); -#else - __asm__ __volatile__ ("rep; nop"); -#endif -} - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/arch/x86/odp_cpu_arch.c b/platform/linux-generic/arch/x86/odp_cpu_arch.c index c8cf27b6..e69fea36 100644 --- a/platform/linux-generic/arch/x86/odp_cpu_arch.c +++ b/platform/linux-generic/arch/x86/odp_cpu_arch.c @@ -3,7 +3,8 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include + +#include uint64_t odp_cpu_cycles(void) { diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c index 96127ec6..186b7c11 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include diff --git a/platform/linux-generic/include/odp/api/align.h b/platform/linux-generic/include/odp/api/align.h deleted file mode 100644 index c238b80a..00000000 --- a/platform/linux-generic/include/odp/api/align.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP alignments - */ - -#ifndef ODP_PLAT_ALIGN_H_ -#define ODP_PLAT_ALIGN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odp_compiler_optim - * @{ - */ - -#ifdef __GNUC__ - -#define ODP_ALIGNED(x) __attribute__((__aligned__(x))) - -#define ODP_PACKED __attribute__((__packed__)) - -#define ODP_OFFSETOF(type, member) __builtin_offsetof(type, member) - -#define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member) - -#else -#error Non-gcc compatible compiler -#endif - -#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE - -#define ODP_PAGE_SIZE 4096 - -#define ODP_ALIGNED_CACHE ODP_ALIGNED(ODP_CACHE_LINE_SIZE) - -#define ODP_ALIGNED_PAGE ODP_ALIGNED(ODP_PAGE_SIZE) - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/atomic.h b/platform/linux-generic/include/odp/api/atomic.h deleted file mode 100644 index 7886cb4e..00000000 --- a/platform/linux-generic/include/odp/api/atomic.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP atomic operations - */ - -#ifndef ODP_PLAT_ATOMIC_H_ -#define ODP_PLAT_ATOMIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @ingroup odp_atomic - * @{ - */ - -#include -#if ODP_ABI_COMPAT == 0 -#include -#endif - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/barrier.h b/platform/linux-generic/include/odp/api/barrier.h deleted file mode 100644 index ab1b7756..00000000 --- a/platform/linux-generic/include/odp/api/barrier.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP execution barriers - */ - -#ifndef ODP_PLAT_BARRIER_H_ -#define ODP_PLAT_BARRIER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/buffer.h b/platform/linux-generic/include/odp/api/buffer.h deleted file mode 100644 index 81dbf128..00000000 --- a/platform/linux-generic/include/odp/api/buffer.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP buffer descriptor - */ - -#ifndef ODP_PLAT_BUFFER_H_ -#define ODP_PLAT_BUFFER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -/** @ingroup odp_buffer - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/byteorder.h b/platform/linux-generic/include/odp/api/byteorder.h deleted file mode 100644 index ec3d0eef..00000000 --- a/platform/linux-generic/include/odp/api/byteorder.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP byteorder - */ - -#ifndef ODP_PLAT_BYTEORDER_H_ -#define ODP_PLAT_BYTEORDER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/** @ingroup odp_compiler_optim - * @{ - */ - -#include -#if ODP_ABI_COMPAT == 0 -#include -#endif - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/classification.h b/platform/linux-generic/include/odp/api/classification.h deleted file mode 100644 index 0bec38be..00000000 --- a/platform/linux-generic/include/odp/api/classification.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP classification descriptor - */ - -#ifndef ODP_PLAT_CLASSIFY_H_ -#define ODP_PLAT_CLASSIFY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include - -/** @ingroup odp_classification - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/compiler.h b/platform/linux-generic/include/odp/api/compiler.h deleted file mode 100644 index 5249d5d6..00000000 --- a/platform/linux-generic/include/odp/api/compiler.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Compiler related - */ - -#ifndef ODP_PLAT_COMPILER_H_ -#define ODP_PLAT_COMPILER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_compiler_optim - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/cpu.h b/platform/linux-generic/include/odp/api/cpu.h deleted file mode 100644 index d49c782b..00000000 --- a/platform/linux-generic/include/odp/api/cpu.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP CPU - */ - -#ifndef ODP_PLAT_CPU_H_ -#define ODP_PLAT_CPU_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/cpumask.h b/platform/linux-generic/include/odp/api/cpumask.h deleted file mode 100644 index 325ea52e..00000000 --- a/platform/linux-generic/include/odp/api/cpumask.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP CPU masks and enumeration - */ - -#ifndef ODP_PLAT_CPUMASK_H_ -#define ODP_PLAT_CPUMASK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/crypto.h b/platform/linux-generic/include/odp/api/crypto.h deleted file mode 100644 index 4f65932a..00000000 --- a/platform/linux-generic/include/odp/api/crypto.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP crypto - */ - -#ifndef ODP_PLAT_CRYPTO_H_ -#define ODP_PLAT_CRYPTO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include - -/** @ingroup odp_crypto - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/debug.h b/platform/linux-generic/include/odp/api/debug.h deleted file mode 100644 index 7db14339..00000000 --- a/platform/linux-generic/include/odp/api/debug.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP debug - */ - -#ifndef ODP_PLAT_DEBUG_H_ -#define ODP_PLAT_DEBUG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if defined(__GNUC__) && !defined(__clang__) - -#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) - -/** - * @internal _Static_assert was only added in GCC 4.6. Provide a weak replacement - * for previous versions. - */ -#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \ - [sizeof(struct { unsigned int error_if_negative:(e) ? 1 : -1; })]) - -#endif - -#endif - -/** - * @internal Compile time assertion macro. Fails compilation and outputs 'msg' - * if condition 'cond' is false. Macro definition is empty when compiler is not - * supported or the compiler does not support static assertion. - */ -#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/errno.h b/platform/linux-generic/include/odp/api/errno.h deleted file mode 100644 index f70d84df..00000000 --- a/platform/linux-generic/include/odp/api/errno.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP errno API - */ - -#ifndef ODP_PLAT_ERRNO_H_ -#define ODP_PLAT_ERRNO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/event.h b/platform/linux-generic/include/odp/api/event.h deleted file mode 100644 index 55931b62..00000000 --- a/platform/linux-generic/include/odp/api/event.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP event - */ - -#ifndef ODP_PLAT_EVENT_H_ -#define ODP_PLAT_EVENT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odp_event - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/hash.h b/platform/linux-generic/include/odp/api/hash.h deleted file mode 100644 index 332029ed..00000000 --- a/platform/linux-generic/include/odp/api/hash.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP Hash function - */ - -#ifndef ODP_PLAT_HASH_H_ -#define ODP_PLAT_HASH_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_hash - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/hints.h b/platform/linux-generic/include/odp/api/hints.h deleted file mode 100644 index 3ba1ba95..00000000 --- a/platform/linux-generic/include/odp/api/hints.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP compiler hints - */ - -#ifndef ODP_PLAT_HINTS_H_ -#define ODP_PLAT_HINTS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_compiler_optim - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/init.h b/platform/linux-generic/include/odp/api/init.h deleted file mode 100644 index 1d9f59a6..00000000 --- a/platform/linux-generic/include/odp/api/init.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP initialization. - */ - -#ifndef ODP_PLAT_INIT_H_ -#define ODP_PLAT_INIT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odp_initialization - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/packet.h b/platform/linux-generic/include/odp/api/packet.h deleted file mode 100644 index ebbeaf1b..00000000 --- a/platform/linux-generic/include/odp/api/packet.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP packet descriptor - */ - -#ifndef ODP_PLAT_PACKET_H_ -#define ODP_PLAT_PACKET_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include - -/** @ingroup odp_packet - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/packet_flags.h b/platform/linux-generic/include/odp/api/packet_flags.h deleted file mode 100644 index 467f5b1d..00000000 --- a/platform/linux-generic/include/odp/api/packet_flags.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP packet flags - */ - -#ifndef ODP_PLAT_PACKET_FLAGS_H_ -#define ODP_PLAT_PACKET_FLAGS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_packet - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/packet_io.h b/platform/linux-generic/include/odp/api/packet_io.h deleted file mode 100644 index 76c7dfed..00000000 --- a/platform/linux-generic/include/odp/api/packet_io.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP Packet IO - */ - -#ifndef ODP_PLAT_PACKET_IO_H_ -#define ODP_PLAT_PACKET_IO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include - -/** @ingroup odp_packet_io - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/packet_io_stats.h b/platform/linux-generic/include/odp/api/packet_io_stats.h deleted file mode 100644 index a9cd9535..00000000 --- a/platform/linux-generic/include/odp/api/packet_io_stats.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP packet IO stats - */ - -#ifndef ODP_PLAT_PACKET_IO_STATS_H_ -#define ODP_PLAT_PACKET_IO_STATS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/atomic_inlines.h b/platform/linux-generic/include/odp/api/plat/atomic_inlines.h deleted file mode 100644 index 4471f2ec..00000000 --- a/platform/linux-generic/include/odp/api/plat/atomic_inlines.h +++ /dev/null @@ -1,385 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP Atomic inline functions - */ - -#ifndef _ODP_PLAT_ATOMIC_INLINES_H_ -#define _ODP_PLAT_ATOMIC_INLINES_H_ - -_STATIC void odp_atomic_init_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); -} - -_STATIC uint32_t odp_atomic_load_u32(odp_atomic_u32_t *atom) -{ - return __atomic_load_n(&atom->v, __ATOMIC_RELAXED); -} - -_STATIC void odp_atomic_store_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); -} - -_STATIC uint32_t odp_atomic_fetch_add_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - return __atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -} - -_STATIC void odp_atomic_add_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -} - -_STATIC uint32_t odp_atomic_fetch_sub_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - return __atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -} - -_STATIC void odp_atomic_sub_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -} - -_STATIC uint32_t odp_atomic_fetch_inc_u32(odp_atomic_u32_t *atom) -{ - return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -} - -_STATIC void odp_atomic_inc_u32(odp_atomic_u32_t *atom) -{ - (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -} - -_STATIC uint32_t odp_atomic_fetch_dec_u32(odp_atomic_u32_t *atom) -{ - return __atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -} - -_STATIC void odp_atomic_dec_u32(odp_atomic_u32_t *atom) -{ - (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -} - -_STATIC int odp_atomic_cas_u32(odp_atomic_u32_t *atom, uint32_t *old_val, - uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED); -} - -_STATIC uint32_t odp_atomic_xchg_u32(odp_atomic_u32_t *atom, uint32_t new_val) -{ - return __atomic_exchange_n(&atom->v, new_val, __ATOMIC_RELAXED); -} - -_STATIC void odp_atomic_max_u32(odp_atomic_u32_t *atom, uint32_t new_max) -{ - uint32_t old_val; - - old_val = odp_atomic_load_u32(atom); - - while (new_max > old_val) { - if (odp_atomic_cas_u32(atom, &old_val, new_max)) - break; - } -} - -_STATIC void odp_atomic_min_u32(odp_atomic_u32_t *atom, uint32_t new_min) -{ - uint32_t old_val; - - old_val = odp_atomic_load_u32(atom); - - while (new_min < old_val) { - if (odp_atomic_cas_u32(atom, &old_val, new_min)) - break; - } -} - -_STATIC void odp_atomic_init_u64(odp_atomic_u64_t *atom, uint64_t val) -{ - atom->v = val; -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - __atomic_clear(&atom->lock, __ATOMIC_RELAXED); -#endif -} - -_STATIC uint64_t odp_atomic_load_u64(odp_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, (void)0); -#else - return __atomic_load_n(&atom->v, __ATOMIC_RELAXED); -#endif -} - -_STATIC void odp_atomic_store_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v = val); -#else - __atomic_store_n(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -_STATIC uint64_t odp_atomic_fetch_add_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v += val); -#else - return __atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -_STATIC void odp_atomic_add_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v += val); -#else - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -_STATIC uint64_t odp_atomic_fetch_sub_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v -= val); -#else - return __atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -_STATIC void odp_atomic_sub_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v -= val); -#else - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELAXED); -#endif -} - -_STATIC uint64_t odp_atomic_fetch_inc_u64(odp_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v++); -#else - return __atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -_STATIC void odp_atomic_inc_u64(odp_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v++); -#else - (void)__atomic_fetch_add(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -_STATIC uint64_t odp_atomic_fetch_dec_u64(odp_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v--); -#else - return __atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -_STATIC void odp_atomic_dec_u64(odp_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v--); -#else - (void)__atomic_fetch_sub(&atom->v, 1, __ATOMIC_RELAXED); -#endif -} - -_STATIC int odp_atomic_cas_u64(odp_atomic_u64_t *atom, uint64_t *old_val, - uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELAXED, - __ATOMIC_RELAXED); -#endif -} - -_STATIC uint64_t odp_atomic_xchg_u64(odp_atomic_u64_t *atom, uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, atom->v = new_val); -#else - return __atomic_exchange_n(&atom->v, new_val, __ATOMIC_RELAXED); -#endif -} - -_STATIC void odp_atomic_max_u64(odp_atomic_u64_t *atom, uint64_t new_max) -{ - uint64_t old_val; - - old_val = odp_atomic_load_u64(atom); - - while (new_max > old_val) { - if (odp_atomic_cas_u64(atom, &old_val, new_max)) - break; - } -} - -_STATIC void odp_atomic_min_u64(odp_atomic_u64_t *atom, uint64_t new_min) -{ - uint64_t old_val; - - old_val = odp_atomic_load_u64(atom); - - while (new_min < old_val) { - if (odp_atomic_cas_u64(atom, &old_val, new_min)) - break; - } -} - -_STATIC uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom) -{ - return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE); -} - -_STATIC void odp_atomic_store_rel_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - __atomic_store_n(&atom->v, val, __ATOMIC_RELEASE); -} - -_STATIC void odp_atomic_add_rel_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); -} - -_STATIC void odp_atomic_sub_rel_u32(odp_atomic_u32_t *atom, uint32_t val) -{ - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); -} - -_STATIC int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom, - uint32_t *old_val, uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQUIRE, - __ATOMIC_RELAXED); -} - -_STATIC int odp_atomic_cas_rel_u32(odp_atomic_u32_t *atom, - uint32_t *old_val, uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELEASE, - __ATOMIC_RELAXED); -} - -_STATIC int odp_atomic_cas_acq_rel_u32(odp_atomic_u32_t *atom, - uint32_t *old_val, - uint32_t new_val) -{ - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQ_REL, - __ATOMIC_RELAXED); -} - -_STATIC uint64_t odp_atomic_load_acq_u64(odp_atomic_u64_t *atom) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - return ATOMIC_OP(atom, (void)0); -#else - return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE); -#endif -} - -_STATIC void odp_atomic_store_rel_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v = val); -#else - __atomic_store_n(&atom->v, val, __ATOMIC_RELEASE); -#endif -} - -_STATIC void odp_atomic_add_rel_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v += val); -#else - (void)__atomic_fetch_add(&atom->v, val, __ATOMIC_RELEASE); -#endif -} - -_STATIC void odp_atomic_sub_rel_u64(odp_atomic_u64_t *atom, uint64_t val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - (void)ATOMIC_OP(atom, atom->v -= val); -#else - (void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE); -#endif -} - -_STATIC int odp_atomic_cas_acq_u64(odp_atomic_u64_t *atom, - uint64_t *old_val, uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQUIRE, - __ATOMIC_RELAXED); -#endif -} - -_STATIC int odp_atomic_cas_rel_u64(odp_atomic_u64_t *atom, - uint64_t *old_val, uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_RELEASE, - __ATOMIC_RELAXED); -#endif -} - -_STATIC int odp_atomic_cas_acq_rel_u64(odp_atomic_u64_t *atom, - uint64_t *old_val, - uint64_t new_val) -{ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - int ret; - *old_val = ATOMIC_OP(atom, ATOMIC_CAS_OP(&ret, *old_val, new_val)); - return ret; -#else - return __atomic_compare_exchange_n(&atom->v, old_val, new_val, - 0 /* strong */, - __ATOMIC_ACQ_REL, - __ATOMIC_RELAXED); -#endif -} - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/atomic_types.h b/platform/linux-generic/include/odp/api/plat/atomic_types.h deleted file mode 100644 index a674ac99..00000000 --- a/platform/linux-generic/include/odp/api/plat/atomic_types.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP atomic operations - */ - -#ifndef ODP_ATOMIC_TYPES_H_ -#define ODP_ATOMIC_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** - * @internal - * Atomic 64-bit unsigned integer - */ -struct odp_atomic_u64_s { - uint64_t v; /**< Actual storage for the atomic variable */ -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - /* Some architectures do not support lock-free operations on 64-bit - * data types. We use a spin lock to ensure atomicity. */ - char lock; /**< Spin lock (if needed) used to ensure atomic access */ -#endif -} ODP_ALIGNED(sizeof(uint64_t)); /* Enforce alignement! */ - -/** - * @internal - * Atomic 32-bit unsigned integer - */ -struct odp_atomic_u32_s { - uint32_t v; /**< Actual storage for the atomic variable */ -} ODP_ALIGNED(sizeof(uint32_t)); /* Enforce alignement! */ - -#if __GCC_ATOMIC_LLONG_LOCK_FREE < 2 - -/** - * @internal - * CAS operation expression for the ATOMIC_OP macro - */ -#define ATOMIC_CAS_OP(ret_ptr, old_val, new_val) \ -({ \ - if (atom->v == (old_val)) { \ - atom->v = (new_val); \ - *(ret_ptr) = 1; \ - } else { \ - *(ret_ptr) = 0; \ - } \ -}) - -/** - * @internal - * Helper macro for lock-based atomic operations on 64-bit integers - * @param[in,out] atom Pointer to the 64-bit atomic variable - * @param expr Expression used update the variable. - * @return The old value of the variable. - */ -#define ATOMIC_OP(atom, expr) \ -({ \ - uint64_t _old_val; \ - /* Loop while lock is already taken, stop when lock becomes clear */ \ - while (__atomic_test_and_set(&(atom)->lock, __ATOMIC_ACQUIRE)) \ - (void)0; \ - _old_val = (atom)->v; \ - (expr); /* Perform whatever update is desired */ \ - __atomic_clear(&(atom)->lock, __ATOMIC_RELEASE); \ - _old_val; /* Return old value */ \ -}) -#endif - -typedef struct odp_atomic_u64_s odp_atomic_u64_t; - -typedef struct odp_atomic_u32_s odp_atomic_u32_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/barrier_types.h b/platform/linux-generic/include/odp/api/plat/barrier_types.h deleted file mode 100644 index 00b383cc..00000000 --- a/platform/linux-generic/include/odp/api/plat/barrier_types.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP barrier - */ - -#ifndef ODP_BARRIER_TYPES_H_ -#define ODP_BARRIER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** - * @internal - * ODP thread synchronization barrier - */ -struct odp_barrier_s { - uint32_t count; /**< Thread count */ - odp_atomic_u32_t bar; /**< Barrier counter */ -}; - -typedef struct odp_barrier_s odp_barrier_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/buffer_types.h b/platform/linux-generic/include/odp/api/plat/buffer_types.h deleted file mode 100644 index 344121b6..00000000 --- a/platform/linux-generic/include/odp/api/plat/buffer_types.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP buffer descriptor - */ - -#ifndef ODP_BUFFER_TYPES_H_ -#define ODP_BUFFER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** ODP buffer */ -typedef ODP_HANDLE_T(odp_buffer_t); - -/** Invalid buffer */ -#define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0xffffffff) - -/** ODP buffer segment */ -typedef ODP_HANDLE_T(odp_buffer_seg_t); - -/** Invalid segment */ -#define ODP_SEGMENT_INVALID ((odp_buffer_seg_t)ODP_BUFFER_INVALID) - -/** Get printable format of odp_buffer_t */ -static inline uint64_t odp_buffer_to_u64(odp_buffer_t hdl) -{ - return _odp_pri(hdl); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h b/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h deleted file mode 100644 index c91a3b18..00000000 --- a/platform/linux-generic/include/odp/api/plat/byteorder_inlines.h +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP byteorder - */ - -#ifndef ODP_PLAT_BYTEORDER_INLINES_H_ -#define ODP_PLAT_BYTEORDER_INLINES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_compiler_optim - * @{ - */ - -_STATIC uint16_t odp_be_to_cpu_16(odp_u16be_t be16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return __odp_builtin_bswap16((__odp_force uint16_t)be16); -#else - return (__odp_force uint16_t)be16; -#endif -} - -_STATIC uint32_t odp_be_to_cpu_32(odp_u32be_t be32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return __builtin_bswap32((__odp_force uint32_t)be32); -#else - return (__odp_force uint32_t)be32; -#endif -} - -_STATIC uint64_t odp_be_to_cpu_64(odp_u64be_t be64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return __builtin_bswap64((__odp_force uint64_t)be64); -#else - return (__odp_force uint64_t)be64; -#endif -} - -_STATIC odp_u16be_t odp_cpu_to_be_16(uint16_t cpu16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force odp_u16be_t)__odp_builtin_bswap16(cpu16); -#else - return (__odp_force odp_u16be_t)cpu16; -#endif -} - -_STATIC odp_u32be_t odp_cpu_to_be_32(uint32_t cpu32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force odp_u32be_t)__builtin_bswap32(cpu32); -#else - return (__odp_force odp_u32be_t)cpu32; -#endif -} - -_STATIC odp_u64be_t odp_cpu_to_be_64(uint64_t cpu64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force odp_u64be_t)__builtin_bswap64(cpu64); -#else - return (__odp_force odp_u64be_t)cpu64; -#endif -} - -_STATIC uint16_t odp_le_to_cpu_16(odp_u16le_t le16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint16_t)le16; -#else - return __odp_builtin_bswap16((__odp_force uint16_t)le16); -#endif -} - -_STATIC uint32_t odp_le_to_cpu_32(odp_u32le_t le32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint32_t)le32; -#else - return __builtin_bswap32((__odp_force uint32_t)le32); -#endif -} - -_STATIC uint64_t odp_le_to_cpu_64(odp_u64le_t le64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force uint64_t)le64; -#else - return __builtin_bswap64((__odp_force uint64_t)le64); -#endif -} - -_STATIC odp_u16le_t odp_cpu_to_le_16(uint16_t cpu16) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force odp_u16le_t)cpu16; -#else - return (__odp_force odp_u16le_t)__odp_builtin_bswap16(cpu16); -#endif -} - -_STATIC odp_u32le_t odp_cpu_to_le_32(uint32_t cpu32) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force odp_u32le_t)cpu32; -#else - return (__odp_force odp_u32le_t)__builtin_bswap32(cpu32); -#endif -} - -_STATIC odp_u64le_t odp_cpu_to_le_64(uint64_t cpu64) -{ -#if ODP_BYTE_ORDER == ODP_LITTLE_ENDIAN - return (__odp_force odp_u64le_t)cpu64; -#else - return (__odp_force odp_u64le_t)__builtin_bswap64(cpu64); -#endif -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_types.h b/platform/linux-generic/include/odp/api/plat/byteorder_types.h deleted file mode 100644 index 09235b53..00000000 --- a/platform/linux-generic/include/odp/api/plat/byteorder_types.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP byteorder - */ - -#ifndef ODP_BYTEORDER_TYPES_H_ -#define ODP_BYTEORDER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __BYTE_ORDER__ -#error __BYTE_ORDER not defined! -#endif - -#ifndef __ORDER_BIG_ENDIAN__ -#error __BIG_ENDIAN not defined! -#endif - -#ifndef __ORDER_LITTLE_ENDIAN__ -#error __LITTLE_ENDIAN not defined! -#endif - - -/* for use with type checkers such as sparse */ -#ifdef __CHECKER__ -/** @internal bitwise attribute */ -#define __odp_bitwise __attribute__((bitwise)) -/** @internal force attribute */ -#define __odp_force __attribute__((force)) -#else -/** @internal bitwise attribute */ -#define __odp_bitwise -/** @internal force attribute */ -#define __odp_force -#endif - - -/** @addtogroup odp_compiler_optim - * @{ - */ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - #define ODP_LITTLE_ENDIAN 1 - #define ODP_BIG_ENDIAN 0 - #define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN - #define ODP_LITTLE_ENDIAN_BITFIELD 1 - #define ODP_BIG_ENDIAN_BITFIELD 0 - #define ODP_BITFIELD_ORDER ODP_LITTLE_ENDIAN_BITFIELD -#else - #define ODP_LITTLE_ENDIAN 0 - #define ODP_BIG_ENDIAN 1 - #define ODP_BYTE_ORDER ODP_BIG_ENDIAN - #define ODP_LITTLE_ENDIAN_BITFIELD 0 - #define ODP_BIG_ENDIAN_BITFIELD 1 - #define ODP_BITFIELD_ORDER ODP_BIG_ENDIAN_BITFIELD -#endif - -typedef uint16_t __odp_bitwise odp_u16le_t; -typedef uint16_t __odp_bitwise odp_u16be_t; - -typedef uint32_t __odp_bitwise odp_u32le_t; -typedef uint32_t __odp_bitwise odp_u32be_t; - -typedef uint64_t __odp_bitwise odp_u64le_t; -typedef uint64_t __odp_bitwise odp_u64be_t; - -typedef uint16_t __odp_bitwise odp_u16sum_t; -typedef uint32_t __odp_bitwise odp_u32sum_t; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/classification_types.h b/platform/linux-generic/include/odp/api/plat/classification_types.h deleted file mode 100644 index 2093f54a..00000000 --- a/platform/linux-generic/include/odp/api/plat/classification_types.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP classification descriptor - */ - -#ifndef ODP_CLASSIFY_TYPES_H_ -#define ODP_CLASSIFY_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @addtogroup odp_classification - * @{ - */ - -typedef ODP_HANDLE_T(odp_cos_t); -typedef ODP_HANDLE_T(odp_flowsig_t); - -#define ODP_COS_INVALID _odp_cast_scalar(odp_cos_t, ~0) -#define ODP_COS_NAME_LEN 32 - -typedef uint16_t odp_cos_flow_set_t; - -typedef ODP_HANDLE_T(odp_pmr_t); -#define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0) - -/** Get printable format of odp_cos_t */ -static inline uint64_t odp_cos_to_u64(odp_cos_t hdl) -{ - return _odp_pri(hdl); -} - -/** Get printable format of odp_pmr_t */ -static inline uint64_t odp_pmr_to_u64(odp_pmr_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/cpumask_types.h b/platform/linux-generic/include/odp/api/plat/cpumask_types.h deleted file mode 100644 index c2727a46..00000000 --- a/platform/linux-generic/include/odp/api/plat/cpumask_types.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP CPU masks and enumeration - */ - -#ifndef ODP_CPUMASK_TYPES_H_ -#define ODP_CPUMASK_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_cpumask - * @{ - */ - -#include -#include - -#define ODP_CPUMASK_SIZE 1024 - -#define ODP_CPUMASK_STR_SIZE ((ODP_CPUMASK_SIZE + 3) / 4 + 3) - -/** - * CPU mask - * - * Don't access directly, use access functions. - */ -typedef struct odp_cpumask_t { - /** @private CPU mask storage - * - * This is private to the implementation. - * Don't access directly, use access functions. - */ - uint8_t _u8[ODP_CPUMASK_SIZE / 8]; -} odp_cpumask_t ODP_ALIGNED(8); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/crypto_types.h b/platform/linux-generic/include/odp/api/plat/crypto_types.h deleted file mode 100644 index 0cbbce8b..00000000 --- a/platform/linux-generic/include/odp/api/plat/crypto_types.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP crypto - */ - -#ifndef ODP_CRYPTO_TYPES_H_ -#define ODP_CRYPTO_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_crypto - * @{ - */ - -#define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL) - -typedef uint64_t odp_crypto_session_t; -typedef ODP_HANDLE_T(odp_crypto_compl_t); - -/** Get printable format of odp_crypto_session_t */ -static inline uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) -{ - return (uint64_t)hdl; -} - -/** Get printable format of odp_crypto_compl_t_t */ -static inline uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/event_types.h b/platform/linux-generic/include/odp/api/plat/event_types.h deleted file mode 100644 index 9ca0fb80..00000000 --- a/platform/linux-generic/include/odp/api/plat/event_types.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP event - */ - -#ifndef ODP_EVENT_TYPES_H_ -#define ODP_EVENT_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @defgroup odp_event ODP EVENT - * Operations on an event. - * @{ - */ - -typedef ODP_HANDLE_T(odp_event_t); - -#define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff) - -/** - * Event types - */ -typedef enum odp_event_type_t { - ODP_EVENT_BUFFER = 1, - ODP_EVENT_PACKET = 2, - ODP_EVENT_TIMEOUT = 3, - ODP_EVENT_CRYPTO_COMPL = 4, -} odp_event_type_t; - -/** Get printable format of odp_event_t */ -static inline uint64_t odp_event_to_u64(odp_event_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/init_types.h b/platform/linux-generic/include/odp/api/plat/init_types.h deleted file mode 100644 index 888b04a7..00000000 --- a/platform/linux-generic/include/odp/api/plat/init_types.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP initialization. - */ - -#ifndef ODP_INIT_TYPES_H_ -#define ODP_INIT_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef uint64_t odp_instance_t; - -/** - * @internal platform specific data - */ -typedef struct odp_platform_init_t { - int ipc_ns; /**< Name space for ipc shared objects. */ -} odp_platform_init_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/packet_io_types.h b/platform/linux-generic/include/odp/api/plat/packet_io_types.h deleted file mode 100644 index 5a45321f..00000000 --- a/platform/linux-generic/include/odp/api/plat/packet_io_types.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP Packet IO - */ - -#ifndef ODP_PACKET_IO_TYPES_H_ -#define ODP_PACKET_IO_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odp_packet_io - * Operations on a packet. - * @{ - */ - -typedef ODP_HANDLE_T(odp_pktio_t); - -/** @internal */ -typedef struct odp_pktin_queue_t { - odp_pktio_t pktio; /**< @internal pktio handle */ - int index; /**< @internal pktio queue index */ -} odp_pktin_queue_t; - -/** @internal */ -typedef struct odp_pktout_queue_t { - odp_pktio_t pktio; /**< @internal pktio handle */ - int index; /**< @internal pktio queue index */ -} odp_pktout_queue_t; - -#define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0) - -#define ODP_PKTIO_MACADDR_MAXSIZE 16 - -#define ODP_PKTIN_NO_WAIT 0 -#define ODP_PKTIN_WAIT UINT64_MAX - -/** Get printable format of odp_pktio_t */ -static inline uint64_t odp_pktio_to_u64(odp_pktio_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h deleted file mode 100644 index 864494d4..00000000 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP packet descriptor - */ - -#ifndef ODP_PACKET_TYPES_H_ -#define ODP_PACKET_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odp_packet ODP PACKET - * Operations on a packet. - * @{ - */ - -typedef ODP_HANDLE_T(odp_packet_t); - -#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0xffffffff) - -#define ODP_PACKET_OFFSET_INVALID (0x0fffffff) - -/* A packet segment handle stores a small index. Strong type handles are - * pointers, which would be wasteful in this case. */ -typedef uint8_t odp_packet_seg_t; - -#define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1) - -/** odp_packet_color_t assigns names to the various pkt "colors" */ -typedef enum { - ODP_PACKET_GREEN = 0, - ODP_PACKET_YELLOW = 1, - ODP_PACKET_RED = 2, - ODP_PACKET_ALL_COLORS = 3, -} odp_packet_color_t; - -/** Sets the maximum number of pkt "colors" */ -#define ODP_NUM_PACKET_COLORS 3 - -/** Get printable format of odp_packet_t */ -static inline uint64_t odp_packet_to_u64(odp_packet_t hdl) -{ - return _odp_pri(hdl); -} - -/** Get printable format of odp_packet_seg_t */ -static inline uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/pool_types.h b/platform/linux-generic/include/odp/api/plat/pool_types.h deleted file mode 100644 index 6baff092..00000000 --- a/platform/linux-generic/include/odp/api/plat/pool_types.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP pool - */ - -#ifndef ODP_POOL_TYPES_H_ -#define ODP_POOL_TYPES_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_buffer - * Operations on a pool. - * @{ - */ - -typedef ODP_HANDLE_T(odp_pool_t); - -#define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff) - -#define ODP_POOL_NAME_LEN 32 - -/** - * Pool type - */ -typedef enum odp_pool_type_t { - ODP_POOL_BUFFER = ODP_EVENT_BUFFER, - ODP_POOL_PACKET = ODP_EVENT_PACKET, - ODP_POOL_TIMEOUT = ODP_EVENT_TIMEOUT, -} odp_pool_type_t; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/queue_types.h b/platform/linux-generic/include/odp/api/plat/queue_types.h deleted file mode 100644 index 1569f5d6..00000000 --- a/platform/linux-generic/include/odp/api/plat/queue_types.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP queue - */ - -#ifndef ODP_QUEUE_TYPES_H_ -#define ODP_QUEUE_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odp_queue ODP QUEUE - * Macros and operation on a queue. - * @{ - */ - -typedef ODP_HANDLE_T(odp_queue_t); - -typedef ODP_HANDLE_T(odp_queue_group_t); - -#define ODP_QUEUE_INVALID _odp_cast_scalar(odp_queue_t, 0) - -#define ODP_QUEUE_NAME_LEN 32 - -/** - * @def ODP_QUEUE_TYPE_TM - * Traffic manager queue - * @note Internal to the implementation -- not part of queue type API - */ -#define ODP_QUEUE_TYPE_TM 4 - -/** Get printable format of odp_queue_t */ -static inline uint64_t odp_queue_to_u64(odp_queue_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/rwlock_recursive_types.h b/platform/linux-generic/include/odp/api/plat/rwlock_recursive_types.h deleted file mode 100644 index 36f9204a..00000000 --- a/platform/linux-generic/include/odp/api/plat/rwlock_recursive_types.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP recursive read/write lock - */ - -#ifndef ODP_RWLOCK_RECURSIVE_TYPES_H_ -#define ODP_RWLOCK_RECURSIVE_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/** @internal */ -struct odp_rwlock_recursive_s { - odp_rwlock_t lock; /**< the lock */ - int wr_owner; /**< write owner thread */ - uint32_t wr_cnt; /**< write recursion count */ - uint8_t rd_cnt[ODP_THREAD_COUNT_MAX]; /**< read recursion count */ -}; - -typedef struct odp_rwlock_recursive_s odp_rwlock_recursive_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/rwlock_types.h b/platform/linux-generic/include/odp/api/plat/rwlock_types.h deleted file mode 100644 index f7dc0449..00000000 --- a/platform/linux-generic/include/odp/api/plat/rwlock_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP rwlock - */ - -#ifndef ODP_RWLOCK_TYPES_H_ -#define ODP_RWLOCK_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @internal */ -struct odp_rwlock_s { - odp_atomic_u32_t cnt; /**< lock count - 0 lock not taken - -1 write lock taken - >0 read lock(s) taken */ -}; - -typedef struct odp_rwlock_s odp_rwlock_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/schedule_types.h b/platform/linux-generic/include/odp/api/plat/schedule_types.h deleted file mode 100644 index 535fd6d0..00000000 --- a/platform/linux-generic/include/odp/api/plat/schedule_types.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP schedule - */ - -#ifndef ODP_SCHEDULE_TYPES_H_ -#define ODP_SCHEDULE_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_scheduler - * @{ - */ - -#define ODP_SCHED_WAIT UINT64_MAX -#define ODP_SCHED_NO_WAIT 0 - -typedef int odp_schedule_prio_t; - -#define ODP_SCHED_PRIO_HIGHEST 0 - -#define ODP_SCHED_PRIO_NORMAL 4 - -#define ODP_SCHED_PRIO_LOWEST 7 - -#define ODP_SCHED_PRIO_DEFAULT ODP_SCHED_PRIO_NORMAL - -typedef int odp_schedule_sync_t; - -#define ODP_SCHED_SYNC_PARALLEL 0 -#define ODP_SCHED_SYNC_ATOMIC 1 -#define ODP_SCHED_SYNC_ORDERED 2 - -typedef int odp_schedule_group_t; - -/* These must be kept in sync with thread_globals_t in odp_thread.c */ -#define ODP_SCHED_GROUP_INVALID -1 -#define ODP_SCHED_GROUP_ALL 0 -#define ODP_SCHED_GROUP_WORKER 1 -#define ODP_SCHED_GROUP_CONTROL 2 - -#define ODP_SCHED_GROUP_NAME_LEN 32 - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/shared_memory_types.h b/platform/linux-generic/include/odp/api/plat/shared_memory_types.h deleted file mode 100644 index afa0bf9c..00000000 --- a/platform/linux-generic/include/odp/api/plat/shared_memory_types.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP shared memory - */ - -#ifndef ODP_SHARED_MEMORY_TYPES_H_ -#define ODP_SHARED_MEMORY_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odp_shared_memory ODP SHARED MEMORY - * Operations on shared memory. - * @{ - */ - -typedef ODP_HANDLE_T(odp_shm_t); - -#define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0) -#define ODP_SHM_NULL ODP_SHM_INVALID - -#define ODP_SHM_NAME_LEN 32 - -/** Get printable format of odp_shm_t */ -static inline uint64_t odp_shm_to_u64(odp_shm_t hdl) -{ - return _odp_pri(hdl); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/spinlock_recursive_types.h b/platform/linux-generic/include/odp/api/plat/spinlock_recursive_types.h deleted file mode 100644 index c5a1adff..00000000 --- a/platform/linux-generic/include/odp/api/plat/spinlock_recursive_types.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP recursive spinlock - */ - -#ifndef ODP_SPINLOCK_RECURSIVE_TYPES_H_ -#define ODP_SPINLOCK_RECURSIVE_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @internal */ -struct odp_spinlock_recursive_s { - odp_spinlock_t lock; /**< the lock */ - int owner; /**< thread owning the lock */ - uint32_t cnt; /**< recursion count */ -}; - -typedef struct odp_spinlock_recursive_s odp_spinlock_recursive_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/spinlock_types.h b/platform/linux-generic/include/odp/api/plat/spinlock_types.h deleted file mode 100644 index f38ece6a..00000000 --- a/platform/linux-generic/include/odp/api/plat/spinlock_types.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP spinlock - */ - -#ifndef ODP_SPINLOCK_TYPES_H_ -#define ODP_SPINLOCK_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @internal */ -struct odp_spinlock_s { - char lock; /**< lock flag, should match odp_atomic_flag_t */ -}; - -typedef struct odp_spinlock_s odp_spinlock_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/static_inline.h.in b/platform/linux-generic/include/odp/api/plat/static_inline.h.in deleted file mode 100644 index 4562a225..00000000 --- a/platform/linux-generic/include/odp/api/plat/static_inline.h.in +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Macro for static inline functions - */ - -#ifndef ODP_PLAT_STATIC_INLINE_H_ -#define ODP_PLAT_STATIC_INLINE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @internal - * @def ODP_ABI_COMPAT - * Control ABI compatibility - */ - -/** - * @internal - * @def _STATIC - * Control conditional static inline expansions for ABI compatibility - */ -#if @ODP_ABI_COMPAT@ -#define ODP_ABI_COMPAT 1 -#define _STATIC -#else -#define ODP_ABI_COMPAT 0 -#define _STATIC static inline -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/std_clib_inlines.h b/platform/linux-generic/include/odp/api/plat/std_clib_inlines.h deleted file mode 100644 index 2e833e41..00000000 --- a/platform/linux-generic/include/odp/api/plat/std_clib_inlines.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_PLAT_STD_CLIB_INLINE_H_ -#define ODP_PLAT_STD_CLIB_INLINE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -_STATIC void *odp_memcpy(void *dst, const void *src, size_t num) -{ - return memcpy(dst, src, num); -} - -_STATIC void *odp_memset(void *ptr, int value, size_t num) -{ - return memset(ptr, value, num); -} - -_STATIC int odp_memcmp(const void *ptr1, const void *ptr2, size_t num) -{ - return memcmp(ptr1, ptr2, num); -} - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/strong_types.h b/platform/linux-generic/include/odp/api/plat/strong_types.h deleted file mode 100644 index a53d7635..00000000 --- a/platform/linux-generic/include/odp/api/plat/strong_types.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP Strong Types. Common macros for implementing strong typing - * for ODP abstract data types - */ - -#ifndef STRONG_TYPES_H_ -#define STRONG_TYPES_H_ - -/** Use strong typing for ODP types */ -#ifdef __cplusplus -#define ODP_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type -#else -#define odp_handle_t struct { uint8_t unused_dummy_var; } * -/** C/C++ helper macro for strong typing */ -#define ODP_HANDLE_T(type) odp_handle_t type -#endif - -/** Internal macro to get value of an ODP handle */ -#define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle)) - -/** Internal macro to get printable value of an ODP handle */ -#define _odp_pri(handle) ((uint64_t)_odp_typeval(handle)) - -/** Internal macro to convert a scalar to a typed handle */ -#define _odp_cast_scalar(type, val) ((type)(uintptr_t)(val)) - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/sync_inlines.h b/platform/linux-generic/include/odp/api/plat/sync_inlines.h deleted file mode 100644 index 245c7502..00000000 --- a/platform/linux-generic/include/odp/api/plat/sync_inlines.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP synchronisation inlines - */ - -#ifndef ODP_PLAT_SYNC_INLINE_H_ -#define ODP_PLAT_SYNC_INLINE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_barrier - * @{ - */ - -_STATIC void odp_mb_release(void) -{ - __atomic_thread_fence(__ATOMIC_RELEASE); -} - -_STATIC void odp_mb_acquire(void) -{ - __atomic_thread_fence(__ATOMIC_ACQUIRE); -} - -_STATIC void odp_mb_full(void) -{ - __atomic_thread_fence(__ATOMIC_SEQ_CST); -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/thread_types.h b/platform/linux-generic/include/odp/api/plat/thread_types.h deleted file mode 100644 index 33af4598..00000000 --- a/platform/linux-generic/include/odp/api/plat/thread_types.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP thread - */ - -#ifndef ODP_THREAD_TYPES_H_ -#define ODP_THREAD_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_thread - * @{ - */ - -#define ODP_THREAD_COUNT_MAX 128 - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/thrmask_types.h b/platform/linux-generic/include/odp/api/plat/thrmask_types.h deleted file mode 100644 index 5d93890c..00000000 --- a/platform/linux-generic/include/odp/api/plat/thrmask_types.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP thread masks - */ - -#ifndef ODP_THRMASK_TYPES_H_ -#define ODP_THRMASK_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_thread - * @{ - */ - -#include - -/** - * Minimum size of output buffer for odp_thrmask_to_str() - */ -#define ODP_THRMASK_STR_SIZE ODP_CPUMASK_STR_SIZE - -/** - * Thread mask - * - * Don't access directly, use access functions. - */ -typedef struct odp_thrmask_t { - odp_cpumask_t m; /**< @private Mask*/ -} odp_thrmask_t; - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_types.h b/platform/linux-generic/include/odp/api/plat/ticketlock_types.h deleted file mode 100644 index 81d479d6..00000000 --- a/platform/linux-generic/include/odp/api/plat/ticketlock_types.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP ticketlock - */ - -#ifndef ODP_TICKETLOCK_TYPES_H_ -#define ODP_TICKETLOCK_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @internal */ -struct odp_ticketlock_s { - odp_atomic_u32_t next_ticket; /**< Next ticket */ - odp_atomic_u32_t cur_ticket; /**< Current ticket */ -}; - -typedef struct odp_ticketlock_s odp_ticketlock_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/time_types.h b/platform/linux-generic/include/odp/api/plat/time_types.h deleted file mode 100644 index 4847f3b1..00000000 --- a/platform/linux-generic/include/odp/api/plat/time_types.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP time service - */ - -#ifndef ODP_TIME_TYPES_H_ -#define ODP_TIME_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @addtogroup odp_time - * @{ - **/ - -/** - * @internal Time structure used to isolate odp-linux implementation from - * the linux timespec structure, which is dependent on POSIX extension level. - */ -typedef struct odp_time_t { - int64_t tv_sec; /**< @internal Seconds */ - int64_t tv_nsec; /**< @internal Nanoseconds */ -} odp_time_t; - -#define ODP_TIME_NULL ((odp_time_t){0, 0}) - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/timer_types.h b/platform/linux-generic/include/odp/api/plat/timer_types.h deleted file mode 100644 index 8821bed6..00000000 --- a/platform/linux-generic/include/odp/api/plat/timer_types.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -/** - * @file - * - * ODP timer service - */ - -#ifndef ODP_TIMER_TYPES_H_ -#define ODP_TIMER_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @addtogroup odp_timer - * @{ - **/ - -struct odp_timer_pool_s; /**< Forward declaration */ - -typedef struct odp_timer_pool_s *odp_timer_pool_t; - -#define ODP_TIMER_POOL_INVALID NULL - -#define ODP_TIMER_POOL_NAME_LEN 32 - -typedef ODP_HANDLE_T(odp_timer_t); - -#define ODP_TIMER_INVALID _odp_cast_scalar(odp_timer_t, 0xffffffff) - -typedef ODP_HANDLE_T(odp_timeout_t); - -#define ODP_TIMEOUT_INVALID _odp_cast_scalar(odp_timeout_t, 0xffffffff) - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h b/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h deleted file mode 100644 index b766afec..00000000 --- a/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h +++ /dev/null @@ -1,185 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP traffic mngr - */ - -#ifndef ODP_TRAFFIC_MNGR_TYPES_H_ -#define ODP_TRAFFIC_MNGR_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/** @addtogroup odp_traffic_mngr - * Macros and operations on a TM system. - * @{ - */ - -/** The ODP_TM_MAX_NUM_SYSTEMS constant specifies the maximum number of TM - * systems that may be created. On some platforms this might be much more - * limited to as little as one hardware TM system. - */ -#define ODP_TM_MAX_NUM_SYSTEMS 64 - -/** The ODP_TM_MAX_PRIORITIES constant specifies the largest range of - * priorities that any TM system can support. All strict priority values MUST - * in the range 0..ODP_TM_MAX_PRIORITIES-1. - */ -#define ODP_TM_MAX_PRIORITIES 16 - -/** The ODP_TM MAX_LEVELS constant specifies the largest range of - * tm_node levels that any TM system can support. Hence all tm_node level - * values MUST be in the range 0..ODP_TM_MAX_LEVELS-1. Smaller tm_node - * levels are associated with tm_nodes closer to the TM system egress. - */ -#define ODP_TM_MAX_LEVELS 8 - -/** - * The smallest SCHED weight is 1 (i.e. 0 is not a legal WFQ/WRR value). - */ -#define ODP_TM_MIN_SCHED_WEIGHT 1 - -/** The ODP_TM_MAX_SCHED_WEIGHT constant is the largest weight any TM system - * can support (at least from a configuration standpoint). A given TM system - * could have a smaller value. - */ -#define ODP_TM_MAX_SCHED_WEIGHT 255 - -/** The ODP_TM_MAX_TM_QUEUES constant is the largest number of tm_queues - * that can handled by any one TM system. - */ -#define ODP_TM_MAX_TM_QUEUES (16 * 1024 * 1024) - -/** The ODP_TM_MAX_NUM_OUTPUTS constant is the largest number of outputs that - * can be configured for any one TM system. - */ -#define ODP_TM_MAX_NUM_OUTPUTS 256 - -/** The ODP_TM_MAX_NUM_TM_NODES constant is the largest number of tm_nodes that - * can be in existence for any one TM system. - */ -#define ODP_TM_MAX_NUM_TM_NODES (1024 * 1024) - -/** The ODP_TM_MAX_TM_NODE_FANIN constant is the largest number of fan-in - * "inputs" that can be simultaneously connected to a single tm_node. - * *TBD* Does this need to be as large as ODP_TM_MAX_TM_QUEUES? *TBD* - */ -#define ODP_TM_MAX_TM_NODE_FANIN (1024 * 1024) - -/** The ODP_TM_MIN_SHAPER_BW constant is the smallest amount of bandwidth that - * can a shaper's peak or commit rate can be set to. It is in units of - * 1000 bytes/second so that it and the ODP_TM_MAX_SHAPER_BW can both fit in - * 32 bits. - */ -#define ODP_TM_MIN_SHAPER_BW 1 - -/** The ODP_TM_MAX_SHAPER_BW constant is the largest amound of bandwidth that - * any shaper's peak or commit rate can be set to. It is in units of - * 1000 bytes/second so that it and the ODP_TM_MIN_SHAPER_BW can both fit in - * 32 bits. - */ -#define ODP_TM_MAX_SHAPER_BW 12500000 - -/** The ODP_NUM_SHAPER_COLORS constant just counts the number of enumeration - * values defined in the odp_tm_shaper_color_t type. - */ -#define ODP_NUM_SHAPER_COLORS 3 - -/** The INVALID_PRIORITY constant is used when one needs to indicate an - * invalid priority value. - */ -#define ODP_TM_INVALID_PRIORITY 255 - -/** The odp_tm_percent_t type is used when specifying fields that are - * percentages. It is a fixed point integer whose units are 1/100 of a - * percent. Hence 100% is represented as the integer value 10000. Note - * that because it is often used as a ratio of the current queue value and - * maximum queue threshold, it can be > 100%, but in any event will never - * be larger than 500% (i.e. it MUST be capped at 50000). - */ -typedef uint16_t odp_tm_percent_t; - -/** The odp_tm_handle_t type is a generic type that can stand for any of the - * other ODP_TM handle types. - */ -typedef uint64_t odp_tm_handle_t; - -/** Each odp_tm_t value represents a specific TM system. Almost all - * functions in this API require a odp_tm_t value - either directly - * as a function parameter or indirectly by having another ODP TM handle value - * as a function parameter. - */ -typedef odp_tm_handle_t odp_tm_t; - -/** Each odp_tm_queue_t value is an opaque ODP handle representing a specific - * tm_queue within a specific TM system. - */ -typedef odp_tm_handle_t odp_tm_queue_t; - -/** Each odp_tm_node_t value is an opaque ODP handle representing a specific - * tm_node within a specific TM system. - */ -typedef odp_tm_handle_t odp_tm_node_t; - -/** Each odp_tm_shaper_t value is an opaque ODP handle representing a specific - * shaper profile usable across all TM systems described by this API. A given - * shaper profile can then be attached to any tm_queue or tm_node. - */ -typedef odp_tm_handle_t odp_tm_shaper_t; - -/** Each odp_tm_sched_t value is an opaque ODP handle representing a specific - * tm_node scheduler profile usable across all TM systems described by this - * API. A given tm_node scheduler profile can then be attached to any tm_node. - */ -typedef odp_tm_handle_t odp_tm_sched_t; - -/** Each odp_tm_threshold_t value is an opaque ODP handle representing a - * specific queue threshold profile usable across all TM systems described by - * this API. A given queue threshold profile can then be attached to any - * tm_queue or tm_node. - */ -typedef odp_tm_handle_t odp_tm_threshold_t; - -/** Each odp_tm_wred_t value is an opaque ODP handle representing a specific - * WRED profile usable across all TM systems described by this API. A given - * WRED profile can then be attached to any tm_queue or tm_node. - */ -typedef odp_tm_handle_t odp_tm_wred_t; - -/** The ODP_TM_INVALID constant can be used with any ODP TM handle type and - * indicates that this value does NOT represent a valid TM object. - */ -#define ODP_TM_INVALID 0 - -/** - * @def ODP_TM_ROOT - * Constant that is used to refer to the egress/root node of the TM subsystem's - * tree/hierarchy of nodes. - */ -#define ODP_TM_ROOT ((odp_tm_handle_t)-1) - -/** Get printable format of odp_queue_t */ -static inline uint64_t odp_tm_handle_to_u64(odp_tm_handle_t hdl) -{ - return hdl; -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/plat/version_types.h b/platform/linux-generic/include/odp/api/plat/version_types.h deleted file mode 100644 index e3327eb3..00000000 --- a/platform/linux-generic/include/odp/api/plat/version_types.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_VERSION_TYPESH_ -#define ODP_VERSION_TYPESH_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @internal Version string expand */ -#define ODP_VERSION_STR_EXPAND(x) #x - -/** @internal Version to string */ -#define ODP_VERSION_TO_STR(x) ODP_VERSION_STR_EXPAND(x) - -/** @internal API version string */ -#define ODP_VERSION_API_STR \ -ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) "." \ -ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) "." \ -ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/pool.h b/platform/linux-generic/include/odp/api/pool.h deleted file mode 100644 index d712b650..00000000 --- a/platform/linux-generic/include/odp/api/pool.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP pool - */ - -#ifndef ODP_PLAT_POOL_H_ -#define ODP_PLAT_POOL_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_buffer - * @{ - */ - -/** - * @} - */ - -#include -#include -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/queue.h b/platform/linux-generic/include/odp/api/queue.h deleted file mode 100644 index a5cf8734..00000000 --- a/platform/linux-generic/include/odp/api/queue.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP queue - */ - -#ifndef ODP_PLAT_QUEUE_H_ -#define ODP_PLAT_QUEUE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include - -/** @ingroup odp_queue - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/random.h b/platform/linux-generic/include/odp/api/random.h deleted file mode 100644 index c8529b3f..00000000 --- a/platform/linux-generic/include/odp/api/random.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP random number API - */ - -#ifndef ODP_PLAT_RANDOM_H_ -#define ODP_PLAT_RANDOM_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_random ODP RANDOM - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/rwlock.h b/platform/linux-generic/include/odp/api/rwlock.h deleted file mode 100644 index 4a86173f..00000000 --- a/platform/linux-generic/include/odp/api/rwlock.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP RW Locks - */ - -#ifndef ODP_PLAT_RWLOCK_H_ -#define ODP_PLAT_RWLOCK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif /* ODP_RWLOCK_H_ */ diff --git a/platform/linux-generic/include/odp/api/rwlock_recursive.h b/platform/linux-generic/include/odp/api/rwlock_recursive.h deleted file mode 100644 index 4a081532..00000000 --- a/platform/linux-generic/include/odp/api/rwlock_recursive.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP resursive read/write lock - */ - -#ifndef ODP_PLAT_RWLOCK_RECURSIVE_H_ -#define ODP_PLAT_RWLOCK_RECURSIVE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/schedule.h b/platform/linux-generic/include/odp/api/schedule.h deleted file mode 100644 index 00264851..00000000 --- a/platform/linux-generic/include/odp/api/schedule.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP schedule - */ - -#ifndef ODP_PLAT_SCHEDULE_H_ -#define ODP_PLAT_SCHEDULE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odp_scheduler - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/schedule_types.h b/platform/linux-generic/include/odp/api/schedule_types.h deleted file mode 100644 index 536007d6..00000000 --- a/platform/linux-generic/include/odp/api/schedule_types.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP schedule - */ - -#ifndef ODP_PLAT_SCHEDULE_TYPES_H_ -#define ODP_PLAT_SCHEDULE_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/shared_memory.h b/platform/linux-generic/include/odp/api/shared_memory.h deleted file mode 100644 index affc290e..00000000 --- a/platform/linux-generic/include/odp/api/shared_memory.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2013-2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP shared memory - */ - -#ifndef ODP_PLAT_SHARED_MEMORY_H_ -#define ODP_PLAT_SHARED_MEMORY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odp_shared_memory - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/spinlock.h b/platform/linux-generic/include/odp/api/spinlock.h deleted file mode 100644 index 830f4edd..00000000 --- a/platform/linux-generic/include/odp/api/spinlock.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP spinlock - */ - -#ifndef ODP_PLAT_SPINLOCK_H_ -#define ODP_PLAT_SPINLOCK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/spinlock_recursive.h b/platform/linux-generic/include/odp/api/spinlock_recursive.h deleted file mode 100644 index d97b0173..00000000 --- a/platform/linux-generic/include/odp/api/spinlock_recursive.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP resursive spinlock - */ - -#ifndef ODP_PLAT_SPINLOCK_RECURSIVE_H_ -#define ODP_PLAT_SPINLOCK_RECURSIVE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/std_clib.h b/platform/linux-generic/include/odp/api/std_clib.h deleted file mode 100644 index fea47254..00000000 --- a/platform/linux-generic/include/odp/api/std_clib.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_PLAT_STD_CLIB_H_ -#define ODP_PLAT_STD_CLIB_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#if ODP_ABI_COMPAT == 0 -#include -#endif - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/std_types.h b/platform/linux-generic/include/odp/api/std_types.h deleted file mode 100644 index b61f33f4..00000000 --- a/platform/linux-generic/include/odp/api/std_types.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * Standard C language types and definitions for ODP. - */ - -#ifndef ODP_PLAT_STD_TYPES_H_ -#define ODP_PLAT_STD_TYPES_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* uint64_t, uint32_t, etc */ -#include - -/* true and false for odp_bool_t */ -#include - -/** @addtogroup odp_system ODP SYSTEM - * @{ - */ - -typedef int odp_bool_t; - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/sync.h b/platform/linux-generic/include/odp/api/sync.h deleted file mode 100644 index e1afcc72..00000000 --- a/platform/linux-generic/include/odp/api/sync.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP synchronisation - */ - -#ifndef ODP_PLAT_SYNC_H_ -#define ODP_PLAT_SYNC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_barrier - * @{ - */ - -#include -#if ODP_ABI_COMPAT == 0 -#include -#endif - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/system_info.h b/platform/linux-generic/include/odp/api/system_info.h deleted file mode 100644 index 36ddc814..00000000 --- a/platform/linux-generic/include/odp/api/system_info.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP system information - */ - -#ifndef ODP_PLAT_SYSTEM_INFO_H_ -#define ODP_PLAT_SYSTEM_INFO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/thread.h b/platform/linux-generic/include/odp/api/thread.h deleted file mode 100644 index c54abc89..00000000 --- a/platform/linux-generic/include/odp/api/thread.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP thread API - */ - -#ifndef ODP_PLAT_THREAD_H_ -#define ODP_PLAT_THREAD_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/thrmask.h b/platform/linux-generic/include/odp/api/thrmask.h deleted file mode 100644 index b1c20777..00000000 --- a/platform/linux-generic/include/odp/api/thrmask.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP thread masks - */ - -#ifndef ODP_PLAT_THRMASK_H_ -#define ODP_PLAT_THRMASK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/** @ingroup odp_thread - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/ticketlock.h b/platform/linux-generic/include/odp/api/ticketlock.h deleted file mode 100644 index 85be4bc5..00000000 --- a/platform/linux-generic/include/odp/api/ticketlock.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP ticketlock - */ - -#ifndef ODP_PLAT_TICKETLOCK_H_ -#define ODP_PLAT_TICKETLOCK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/time.h b/platform/linux-generic/include/odp/api/time.h deleted file mode 100644 index 8d1c33e6..00000000 --- a/platform/linux-generic/include/odp/api/time.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP time - */ - -#ifndef ODP_PLAT_TIME_H_ -#define ODP_PLAT_TIME_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - - -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/timer.h b/platform/linux-generic/include/odp/api/timer.h deleted file mode 100644 index 1450727f..00000000 --- a/platform/linux-generic/include/odp/api/timer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP timer service - */ - -#ifndef ODP_PLAT_TIMER_H_ -#define ODP_PLAT_TIMER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include - -/** @ingroup odp_timer - * @{ - */ - -/** - * @} - */ - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/traffic_mngr.h b/platform/linux-generic/include/odp/api/traffic_mngr.h deleted file mode 100644 index 3e6f5fbb..00000000 --- a/platform/linux-generic/include/odp/api/traffic_mngr.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2015, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP Traffic manager - */ - -#ifndef ODP_PLAT_TRAFFIC_MNGR_H_ -#define ODP_PLAT_TRAFFIC_MNGR_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** @ingroup odp_traffic_mngr - * @{ - */ - -/** - * @} - */ - -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp/api/version.h b/platform/linux-generic/include/odp/api/version.h deleted file mode 100644 index fc4ea586..00000000 --- a/platform/linux-generic/include/odp/api/version.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) 2013, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/** - * @file - * - * ODP version - */ - -#ifndef ODP_PLAT_VERSION_H_ -#define ODP_PLAT_VERSION_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/platform/linux-generic/include/odp_align_internal.h b/platform/linux-generic/include/odp_align_internal.h index 61ff200c..4fae910f 100644 --- a/platform/linux-generic/include/odp_align_internal.h +++ b/platform/linux-generic/include/odp_align_internal.h @@ -17,7 +17,6 @@ extern "C" { #endif -#include #include /* Macros to calculate ODP_ROUNDUP_POWER2_U32() in five rounds of shift diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index dca2175c..ff1d9b4b 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -16,10 +16,6 @@ #ifndef ODP_ATOMIC_INTERNAL_H_ #define ODP_ATOMIC_INTERNAL_H_ -#include -#include -#include -#include #include #ifdef __cplusplus diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index 076abe96..9bb55621 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -18,17 +18,8 @@ extern "C" { #endif -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include #include #include #include diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h index f6393ee7..d108c184 100644 --- a/platform/linux-generic/include/odp_classification_datamodel.h +++ b/platform/linux-generic/include/odp_classification_datamodel.h @@ -19,8 +19,6 @@ extern "C" { #endif -#include -#include #include #include #include diff --git a/platform/linux-generic/include/odp_classification_inlines.h b/platform/linux-generic/include/odp_classification_inlines.h index b839197a..01a2ad3b 100644 --- a/platform/linux-generic/include/odp_classification_inlines.h +++ b/platform/linux-generic/include/odp_classification_inlines.h @@ -18,7 +18,6 @@ extern "C" { #endif -#include #include #include #include diff --git a/platform/linux-generic/include/odp_classification_internal.h b/platform/linux-generic/include/odp_classification_internal.h index 78eaac90..e06efcb9 100644 --- a/platform/linux-generic/include/odp_classification_internal.h +++ b/platform/linux-generic/include/odp_classification_internal.h @@ -19,10 +19,7 @@ extern "C" { #endif -#include -#include #include -#include #include #include diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 02ae87a9..6d443881 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -18,8 +18,8 @@ #include #include -#include #include + #ifdef __cplusplus extern "C" { #endif diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index b313b1fe..e10fe7bf 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -17,9 +17,6 @@ extern "C" { #endif -#include -#include -#include #include #include diff --git a/platform/linux-generic/include/odp_packet_dpdk.h b/platform/linux-generic/include/odp_packet_dpdk.h index 4d7e0fc4..961a28f0 100644 --- a/platform/linux-generic/include/odp_packet_dpdk.h +++ b/platform/linux-generic/include/odp_packet_dpdk.h @@ -7,10 +7,6 @@ #ifndef ODP_PACKET_DPDK_H #define ODP_PACKET_DPDK_H -#include -#include -#include - #include #ifdef ODP_PKTIO_DPDK diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index e6e9d744..0f334fe7 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -17,14 +17,9 @@ extern "C" { #endif -#include -#include #include #include #include -#include -#include -#include #include /** Minimum segment length expected by packet_parse_common() */ diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 89bb6f3a..a086c043 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -18,15 +18,12 @@ extern "C" { #endif -#include -#include #include #include #include #include #include -#include #include #define PKTIO_MAX_QUEUES 64 diff --git a/platform/linux-generic/include/odp_packet_io_ipc_internal.h b/platform/linux-generic/include/odp_packet_io_ipc_internal.h index 7cd29488..60390f54 100644 --- a/platform/linux-generic/include/odp_packet_io_ipc_internal.h +++ b/platform/linux-generic/include/odp_packet_io_ipc_internal.h @@ -4,12 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include #include -#include #include #include -#include #include #include diff --git a/platform/linux-generic/include/odp_packet_io_ring_internal.h b/platform/linux-generic/include/odp_packet_io_ring_internal.h index d044f931..374e164a 100644 --- a/platform/linux-generic/include/odp_packet_io_ring_internal.h +++ b/platform/linux-generic/include/odp_packet_io_ring_internal.h @@ -96,9 +96,6 @@ extern "C" { #endif -#include -#include -#include #include #include #include diff --git a/platform/linux-generic/include/odp_packet_netmap.h b/platform/linux-generic/include/odp_packet_netmap.h index a6f68d56..f14faf2c 100644 --- a/platform/linux-generic/include/odp_packet_netmap.h +++ b/platform/linux-generic/include/odp_packet_netmap.h @@ -7,11 +7,6 @@ #ifndef ODP_PACKET_NETMAP_H #define ODP_PACKET_NETMAP_H -#include -#include -#include -#include -#include #include #include diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index dbfc9f1f..081fd431 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -14,13 +14,6 @@ #include #include -#include -#include -#include -#include -#include -#include - #include /* diff --git a/platform/linux-generic/include/odp_packet_tap.h b/platform/linux-generic/include/odp_packet_tap.h index a90bfbce..5350cf24 100644 --- a/platform/linux-generic/include/odp_packet_tap.h +++ b/platform/linux-generic/include/odp_packet_tap.h @@ -7,8 +7,6 @@ #ifndef ODP_PACKET_TAP_H_ #define ODP_PACKET_TAP_H_ -#include - typedef struct { int fd; /**< file descriptor for tap interface*/ int skfd; /**< socket descriptor */ diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h index b0805ac3..068c9933 100644 --- a/platform/linux-generic/include/odp_pool_internal.h +++ b/platform/linux-generic/include/odp_pool_internal.h @@ -18,9 +18,6 @@ extern "C" { #endif -#include -#include - #include #include #include diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 560f826e..98c3eaa3 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -18,15 +18,10 @@ extern "C" { #endif -#include #include #include #include #include -#include -#include -#include -#include #include #define QUEUE_MULTI_MAX CONFIG_BURST_SIZE diff --git a/platform/linux-generic/include/odp_ring_internal.h b/platform/linux-generic/include/odp_ring_internal.h index 55fedeb3..986c335e 100644 --- a/platform/linux-generic/include/odp_ring_internal.h +++ b/platform/linux-generic/include/odp_ring_internal.h @@ -11,8 +11,6 @@ extern "C" { #endif -#include -#include #include /* Ring empty, not a valid data value. */ diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 6c2b0501..28ceb6d3 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -11,9 +11,6 @@ extern "C" { #endif -#include -#include - typedef void (*schedule_pktio_start_fn_t)(int pktio_index, int num_in_queue, int in_queue_idx[]); typedef int (*schedule_thr_add_fn_t)(odp_schedule_group_t group, int thr); diff --git a/platform/linux-generic/include/odp_shm_internal.h b/platform/linux-generic/include/odp_shm_internal.h index 8bd105d9..93b3bb52 100644 --- a/platform/linux-generic/include/odp_shm_internal.h +++ b/platform/linux-generic/include/odp_shm_internal.h @@ -11,8 +11,6 @@ extern "C" { #endif -#include - #define SHM_DEVNAME_MAXLEN (ODP_SHM_NAME_LEN + 16) #define SHM_DEVNAME_FORMAT "/odp-%d-%s" /* /dev/shm/odp-- */ diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h b/platform/linux-generic/include/odp_ticketlock_internal.h similarity index 90% rename from platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h rename to platform/linux-generic/include/odp_ticketlock_internal.h index 87432a71..37fa0f9d 100644 --- a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h +++ b/platform/linux-generic/include/odp_ticketlock_internal.h @@ -1,22 +1,15 @@ -/* Copyright (c) 2016, Linaro Limited +/* Copyright (c) 2013, Linaro Limited * All rights reserved. * - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-3-Clause */ -/** - * @file - * - * Ticketlock inline functions - */ +#ifndef ODP_TICKETLOCK_INTERNAL_H_ +#define ODP_TICKETLOCK_INTERNAL_H_ -#ifndef _ODP_PLAT_TICKETLOCK_INLINES_H_ -#define _ODP_PLAT_TICKETLOCK_INLINES_H_ - -#include -#include -#include -#include +#ifdef __cplusplus +extern "C" { +#endif /** @internal * Acquire ticket lock. @@ -110,4 +103,8 @@ static inline int _odp_ticketlock_is_locked(odp_ticketlock_t *ticketlock) odp_atomic_load_u32(&ticketlock->next_ticket); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h index 91b12c54..642e55fd 100644 --- a/platform/linux-generic/include/odp_timer_internal.h +++ b/platform/linux-generic/include/odp_timer_internal.h @@ -14,11 +14,8 @@ #ifndef ODP_TIMER_INTERNAL_H_ #define ODP_TIMER_INTERNAL_H_ -#include -#include #include #include -#include /** * Internal Timeout header diff --git a/platform/linux-generic/include/odp_traffic_mngr_internal.h b/platform/linux-generic/include/odp_traffic_mngr_internal.h index 9f821fe4..6bc53d77 100644 --- a/platform/linux-generic/include/odp_traffic_mngr_internal.h +++ b/platform/linux-generic/include/odp_traffic_mngr_internal.h @@ -20,8 +20,6 @@ extern "C" { #endif #include -#include -#include #include #include #include diff --git a/platform/linux-generic/include/odp_version_internal.h b/platform/linux-generic/include/odp_version_internal.h new file mode 100644 index 00000000..3aa54998 --- /dev/null +++ b/platform/linux-generic/include/odp_version_internal.h @@ -0,0 +1,26 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef ODP_VERSION_INTERNAL_H_ +#define ODP_VERSION_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ODP_VERSION_STR_EXPAND(x) #x +#define ODP_VERSION_TO_STR(x) ODP_VERSION_STR_EXPAND(x) + +#define ODP_VERSION_API_STR \ + ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) "." \ + ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) "." \ + ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index d3e5528c..1b1b883d 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -36,5 +36,4 @@ m4_include([platform/linux-generic/m4/odp_dpdk.m4]) m4_include([platform/linux-generic/m4/odp_ipc.m4]) m4_include([platform/linux-generic/m4/odp_schedule.m4]) -AC_CONFIG_FILES([platform/linux-generic/Makefile - platform/linux-generic/include/odp/api/plat/static_inline.h]) +AC_CONFIG_FILES([platform/linux-generic/Makefile]) diff --git a/platform/linux-generic/odp_atomic.c b/platform/linux-generic/odp_atomic.c index 0e40cda5..cfae4ad3 100644 --- a/platform/linux-generic/odp_atomic.c +++ b/platform/linux-generic/odp_atomic.c @@ -4,10 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#if ODP_ABI_COMPAT == 1 -#include -#endif +#include int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op) { diff --git a/platform/linux-generic/odp_barrier.c b/platform/linux-generic/odp_barrier.c index a2c62676..f680f594 100644 --- a/platform/linux-generic/odp_barrier.c +++ b/platform/linux-generic/odp_barrier.c @@ -4,10 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include -#include -#include +#include void odp_barrier_init(odp_barrier_t *barrier, int count) { diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index b7910397..a2ff9748 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -4,7 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + #include #include #include diff --git a/platform/linux-generic/odp_byteorder.c b/platform/linux-generic/odp_byteorder.c deleted file mode 100644 index a344c53f..00000000 --- a/platform/linux-generic/odp_byteorder.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#if ODP_ABI_COMPAT == 1 -#include -#endif diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 50a7e547..f6c27c58 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -4,25 +4,20 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include -#include -#include +#include + #include #include #include -#include #include #include #include #include -#include #include #include #include #include #include -#include #define LOCK(a) odp_spinlock_lock(a) #define UNLOCK(a) odp_spinlock_unlock(a) diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-generic/odp_cpu.c index 282defd4..b7d1fb00 100644 --- a/platform/linux-generic/odp_cpu.c +++ b/platform/linux-generic/odp_cpu.c @@ -4,8 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1) { diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index 64559a6d..7d9dc68e 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -4,13 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include -#include -#include #include #include diff --git a/platform/linux-generic/odp_cpumask_task.c b/platform/linux-generic/odp_cpumask_task.c index 10885ce6..b8ed3914 100644 --- a/platform/linux-generic/odp_cpumask_task.c +++ b/platform/linux-generic/odp_cpumask_task.c @@ -4,12 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include -#include #include int odp_cpumask_default_worker(odp_cpumask_t *mask, int num) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 4f17fd66..ff7ca1d5 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -4,19 +4,12 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include -#include #include -#include -#include -#include -#include -#include -#include #include #include -#include -#include #include #include diff --git a/platform/linux-generic/odp_errno.c b/platform/linux-generic/odp_errno.c index 408a4b95..11384bc8 100644 --- a/platform/linux-generic/odp_errno.c +++ b/platform/linux-generic/odp_errno.c @@ -4,7 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + #include #include #include diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index cc3fb0ad..85436d26 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -4,12 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include -#include -#include -#include -#include +#include + #include #include #include diff --git a/platform/linux-generic/odp_hash.c b/platform/linux-generic/odp_hash.c index 55876c33..4da4fb22 100644 --- a/platform/linux-generic/odp_hash.c +++ b/platform/linux-generic/odp_hash.c @@ -37,8 +37,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include #include diff --git a/platform/linux-generic/odp_impl.c b/platform/linux-generic/odp_impl.c index 3fc2d6ab..1f7023da 100644 --- a/platform/linux-generic/odp_impl.c +++ b/platform/linux-generic/odp_impl.c @@ -18,7 +18,8 @@ extern "C" { #endif -#include +#include +#include #define ODP_VERSION_IMPL 0 #define ODP_VERSION_IMPL_STR \ diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 06c61435..6a80282e 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -3,9 +3,10 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include + +#include + #include -#include #include #include #include diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c index b116904d..b7de6221 100644 --- a/platform/linux-generic/odp_name_table.c +++ b/platform/linux-generic/odp_name_table.c @@ -6,6 +6,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 34d720c7..b4376791 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -4,11 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + #include #include -#include -#include #include #include diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 798fa115..9d83f9d4 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -4,7 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + #include #define retflag(pkt, x, layer) do { \ diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 98460a56..27f575ea 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -3,17 +3,15 @@ * * SPDX-License-Identifier: BSD-3-Clause */ + +#include + #include -#include #include #include -#include #include #include -#include -#include -#include #include #include #include @@ -21,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index cf7c2c41..0330062a 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -4,10 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include -#include -#include +#include #include #include @@ -16,12 +13,12 @@ #include #include #include +#include #include #include #include -#include #define LOCK(a) _odp_ticketlock_lock(a) #define UNLOCK(a) _odp_ticketlock_unlock(a) #define LOCK_INIT(a) odp_ticketlock_init(a) diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index aafe5671..51010747 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -4,29 +4,22 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + #include -#include -#include -#include #include #include #include #include -#include -#include #include #include #include #include #include -#include -#include -#include +#include #define NUM_INTERNAL_QUEUES 64 -#include #define LOCK(a) _odp_ticketlock_lock(a) #define UNLOCK(a) _odp_ticketlock_unlock(a) #define LOCK_INIT(a) odp_ticketlock_init(a) diff --git a/platform/linux-generic/odp_rwlock.c b/platform/linux-generic/odp_rwlock.c index 13c17a2c..05c14a8a 100644 --- a/platform/linux-generic/odp_rwlock.c +++ b/platform/linux-generic/odp_rwlock.c @@ -4,10 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include -#include -#include -#include void odp_rwlock_init(odp_rwlock_t *rwlock) { diff --git a/platform/linux-generic/odp_rwlock_recursive.c b/platform/linux-generic/odp_rwlock_recursive.c index 6b022814..2a9f2b6a 100644 --- a/platform/linux-generic/odp_rwlock_recursive.c +++ b/platform/linux-generic/odp_rwlock_recursive.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include + #include #define NO_OWNER (-1) diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index e14d145b..eaeb9dec 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -4,22 +4,14 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include -#include #include -#include -#include #include #include -#include -#include -#include -#include -#include -#include #include #include -#include #include #include diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index daf6c98c..c8634265 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include extern const schedule_fn_t schedule_sp_fn; diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index ad01bfe7..388c2116 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -4,11 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include -#include -#include -#include -#include #include #include #include diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index ba32deec..b6e9139a 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -4,10 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include -#include -#include -#include #include <_ishm_internal.h> #include diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c index 8a1dc3ac..e4b04c4e 100644 --- a/platform/linux-generic/odp_sorted_list.c +++ b/platform/linux-generic/odp_sorted_list.c @@ -6,6 +6,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include diff --git a/platform/linux-generic/odp_spinlock.c b/platform/linux-generic/odp_spinlock.c index cb0f0533..d2edf14e 100644 --- a/platform/linux-generic/odp_spinlock.c +++ b/platform/linux-generic/odp_spinlock.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include + #include void odp_spinlock_init(odp_spinlock_t *spinlock) diff --git a/platform/linux-generic/odp_spinlock_recursive.c b/platform/linux-generic/odp_spinlock_recursive.c index 5ed481c4..9531158d 100644 --- a/platform/linux-generic/odp_spinlock_recursive.c +++ b/platform/linux-generic/odp_spinlock_recursive.c @@ -4,8 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include #define NO_OWNER (-1) diff --git a/platform/linux-generic/odp_std_clib.c b/platform/linux-generic/odp_std_clib.c deleted file mode 100644 index 24df249d..00000000 --- a/platform/linux-generic/odp_std_clib.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#if ODP_ABI_COMPAT == 1 -#include -#endif diff --git a/platform/linux-generic/odp_sync.c b/platform/linux-generic/odp_sync.c deleted file mode 100644 index b7eb503c..00000000 --- a/platform/linux-generic/odp_sync.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Copyright (c) 2016, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#if ODP_ABI_COMPAT == 1 -#include -#endif diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 18c61dbe..15a22c8b 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -11,13 +11,12 @@ * All rights reserved. */ +#include + #include -#include #include #include -#include -#include #include #include #include diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index 33a8a7f3..65cacdc2 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -4,18 +4,14 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include -#include -#include #include -#include #include #include -#include -#include -#include #include #include diff --git a/platform/linux-generic/odp_thrmask.c b/platform/linux-generic/odp_thrmask.c index c176a5c6..ab458b4b 100644 --- a/platform/linux-generic/odp_thrmask.c +++ b/platform/linux-generic/odp_thrmask.c @@ -4,8 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include void odp_thrmask_from_str(odp_thrmask_t *mask, const char *str) { diff --git a/platform/linux-generic/odp_ticketlock.c b/platform/linux-generic/odp_ticketlock.c index f18d78f5..574ee4e1 100644 --- a/platform/linux-generic/odp_ticketlock.c +++ b/platform/linux-generic/odp_ticketlock.c @@ -4,7 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + +#include void odp_ticketlock_init(odp_ticketlock_t *ticketlock) { diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index 81e05224..2178c7eb 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -4,11 +4,11 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include -#include -#include #include static odp_time_t start_time; diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index cf610bfa..b0d1d8ef 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -19,6 +19,8 @@ #define TB_SET_PAD(x) (void)(x) #endif +#include + #include #include @@ -31,27 +33,12 @@ #include #include -#include #include -#include #include -#include #include -#include -#include #include -#include #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include #define TMO_UNUSED ((uint64_t)0xFFFFFFFFFFFFFFFF) diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index f2c802a8..22eaf911 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -6,6 +6,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 9dc3a864..4d0c232f 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -6,6 +6,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #define _GNU_SOURCE #include #include @@ -18,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/platform/linux-generic/odp_version.c b/platform/linux-generic/odp_version.c index 7b704d05..ff29cfdd 100644 --- a/platform/linux-generic/odp_version.c +++ b/platform/linux-generic/odp_version.c @@ -4,7 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include + +#include const char *odp_version_api_str(void) { diff --git a/platform/linux-generic/odp_weak.c b/platform/linux-generic/odp_weak.c index 0fbf6645..a2cff550 100644 --- a/platform/linux-generic/odp_weak.c +++ b/platform/linux-generic/odp_weak.c @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include -#include #include -#include #include diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 0eb025ae..bef8e03e 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -12,8 +12,6 @@ #include #include -#include - #include #include #include diff --git a/platform/linux-generic/pktio/io_ops.c b/platform/linux-generic/pktio/io_ops.c index fbf30ca7..e129e193 100644 --- a/platform/linux-generic/pktio/io_ops.c +++ b/platform/linux-generic/pktio/io_ops.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include /* Ops for all implementation of pktio. diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index 377f20e6..91bc2a5b 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -3,10 +3,12 @@ * * SPDX-License-Identifier: BSD-3-Clause */ + +#include + #include #include #include -#include #include #include <_ishm_internal.h> diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 70962839..2c31a4ef 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c index 611bb451..4108d77c 100644 --- a/platform/linux-generic/pktio/pktio_common.c +++ b/platform/linux-generic/pktio/pktio_common.c @@ -5,6 +5,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include #include diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 7d239686..e9210d74 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 666aae6a..2c6b4ee0 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -5,6 +5,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include + #include #include @@ -30,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/test/common_plat/validation/api/system/system.c b/test/common_plat/validation/api/system/system.c index 57ff34eb..37b8759f 100644 --- a/test/common_plat/validation/api/system/system.c +++ b/test/common_plat/validation/api/system/system.c @@ -6,7 +6,6 @@ #include #include -#include #include "odp_cunit_common.h" #include "test_debug.h" #include "system.h"