diff options
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/ipcp/broadcast.cmake | 6 | ||||
| -rw-r--r-- | cmake/ipcp/eth.cmake | 6 | ||||
| -rw-r--r-- | cmake/ipcp/ipcp.cmake | 2 | ||||
| -rw-r--r-- | cmake/ipcp/local.cmake | 17 | ||||
| -rw-r--r-- | cmake/ipcp/udp.cmake | 6 | ||||
| -rw-r--r-- | cmake/ipcp/unicast.cmake | 6 | ||||
| -rw-r--r-- | cmake/irmd.cmake | 1 | ||||
| -rw-r--r-- | cmake/lib/ssm.cmake | 156 |
8 files changed, 145 insertions, 55 deletions
diff --git a/cmake/ipcp/broadcast.cmake b/cmake/ipcp/broadcast.cmake index 20610a25..4f43d001 100644 --- a/cmake/ipcp/broadcast.cmake +++ b/cmake/ipcp/broadcast.cmake @@ -19,4 +19,10 @@ add_executable(${IPCP_BROADCAST_TARGET} target_include_directories(${IPCP_BROADCAST_TARGET} PRIVATE ${IPCP_INCLUDE_DIRS}) target_link_libraries(${IPCP_BROADCAST_TARGET} PUBLIC ouroboros-dev) + +include(utils/AddCompileFlags) +if (CMAKE_BUILD_TYPE MATCHES "Debug*") + add_compile_flags(${IPCP_BROADCAST_TARGET} -DCONFIG_OUROBOROS_DEBUG) +endif () + install(TARGETS ${IPCP_BROADCAST_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) diff --git a/cmake/ipcp/eth.cmake b/cmake/ipcp/eth.cmake index c14a1d6e..0960c8a5 100644 --- a/cmake/ipcp/eth.cmake +++ b/cmake/ipcp/eth.cmake @@ -38,5 +38,11 @@ if (HAVE_ETH) target_link_libraries(${target} PUBLIC ouroboros-dev) endforeach() + include(utils/AddCompileFlags) + if (CMAKE_BUILD_TYPE MATCHES "Debug*") + add_compile_flags(${IPCP_ETH_LLC_TARGET} -DCONFIG_OUROBOROS_DEBUG) + add_compile_flags(${IPCP_ETH_DIX_TARGET} -DCONFIG_OUROBOROS_DEBUG) + endif () + install(TARGETS ${IPCP_ETH_LLC_TARGET} ${IPCP_ETH_DIX_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) endif () diff --git a/cmake/ipcp/ipcp.cmake b/cmake/ipcp/ipcp.cmake index f821f481..006e76b0 100644 --- a/cmake/ipcp/ipcp.cmake +++ b/cmake/ipcp/ipcp.cmake @@ -23,7 +23,7 @@ set(BUILD_CONTAINER FALSE CACHE BOOL "Disable thread priority setting for container compatibility") if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(IPCP_LINUX_TIMERSLACK_NS 1000 CACHE STRING + set(IPCP_LINUX_TIMERSLACK_NS 100 CACHE STRING "Slack value for high resolution timers on Linux systems.") endif () diff --git a/cmake/ipcp/local.cmake b/cmake/ipcp/local.cmake index 9e320aad..7b604ba1 100644 --- a/cmake/ipcp/local.cmake +++ b/cmake/ipcp/local.cmake @@ -5,7 +5,24 @@ set(IPCP_LOCAL_TARGET ipcpd-local CACHE INTERNAL "") set(IPCP_LOCAL_MPL 100 CACHE STRING "Default maximum packet lifetime for the Local IPCP, in ms") +set(IPCP_LOCAL_POLLING FALSE CACHE BOOL + "Enable active polling in the Local IPCP for low-latency mode") + add_executable(${IPCP_LOCAL_TARGET} "${LOCAL_SOURCE_DIR}/main.c" ${IPCP_SOURCES}) target_include_directories(${IPCP_LOCAL_TARGET} PRIVATE ${IPCP_INCLUDE_DIRS}) target_link_libraries(${IPCP_LOCAL_TARGET} PUBLIC ouroboros-dev) + +include(utils/AddCompileFlags) +if (CMAKE_BUILD_TYPE MATCHES "Debug*") + add_compile_flags(${IPCP_LOCAL_TARGET} -DCONFIG_OUROBOROS_DEBUG) +endif () + +if (IPCP_LOCAL_POLLING) + add_compile_flags(${IPCP_LOCAL_TARGET} -DCONFIG_IPCP_LOCAL_POLLING) +endif () + +if (IPCP_LOCAL_POLLING) + add_compile_flags(${IPCP_LOCAL_TARGET} -DCONFIG_IPCP_LOCAL_POLLING) +endif () + install(TARGETS ${IPCP_LOCAL_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) diff --git a/cmake/ipcp/udp.cmake b/cmake/ipcp/udp.cmake index 7195dfa1..360330c5 100644 --- a/cmake/ipcp/udp.cmake +++ b/cmake/ipcp/udp.cmake @@ -48,4 +48,10 @@ foreach(target ${IPCP_UDP4_TARGET} ${IPCP_UDP6_TARGET}) target_link_libraries(${target} PUBLIC ouroboros-dev) endforeach() +include(utils/AddCompileFlags) +if (CMAKE_BUILD_TYPE MATCHES "Debug*") + add_compile_flags(${IPCP_UDP4_TARGET} -DCONFIG_OUROBOROS_DEBUG) + add_compile_flags(${IPCP_UDP6_TARGET} -DCONFIG_OUROBOROS_DEBUG) +endif () + install(TARGETS ${IPCP_UDP4_TARGET} ${IPCP_UDP6_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) diff --git a/cmake/ipcp/unicast.cmake b/cmake/ipcp/unicast.cmake index 2a2f7a3f..de237500 100644 --- a/cmake/ipcp/unicast.cmake +++ b/cmake/ipcp/unicast.cmake @@ -47,4 +47,10 @@ add_executable(${IPCP_UNICAST_TARGET} target_include_directories(${IPCP_UNICAST_TARGET} PRIVATE ${IPCP_INCLUDE_DIRS}) target_include_directories(${IPCP_UNICAST_TARGET} PRIVATE "${UNICAST_SOURCE_DIR}") target_link_libraries(${IPCP_UNICAST_TARGET} PUBLIC ouroboros-dev) + +include(utils/AddCompileFlags) +if (CMAKE_BUILD_TYPE MATCHES "Debug*") + add_compile_flags(${IPCP_UNICAST_TARGET} -DCONFIG_OUROBOROS_DEBUG) +endif () + install(TARGETS ${IPCP_UNICAST_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) diff --git a/cmake/irmd.cmake b/cmake/irmd.cmake index f02f37d6..1d6341d3 100644 --- a/cmake/irmd.cmake +++ b/cmake/irmd.cmake @@ -94,6 +94,7 @@ set(IRMD_SOURCES "${IRMD_SOURCE_DIR}/oap/cli.c" "${IRMD_SOURCE_DIR}/reg/flow.c" "${IRMD_SOURCE_DIR}/reg/ipcp.c" + "${IRMD_SOURCE_DIR}/reg/pool.c" "${IRMD_SOURCE_DIR}/reg/proc.c" "${IRMD_SOURCE_DIR}/reg/prog.c" "${IRMD_SOURCE_DIR}/reg/name.c" diff --git a/cmake/lib/ssm.cmake b/cmake/lib/ssm.cmake index 71790a4a..8a2971e6 100644 --- a/cmake/lib/ssm.cmake +++ b/cmake/lib/ssm.cmake @@ -3,87 +3,135 @@ # secure shared memory pool allocator # Shared memory pool naming configuration -set(SSM_PREFIX "o7s.ssm" CACHE STRING +set(SSM_PREFIX "ouroboros" CACHE STRING "Prefix for secure shared memory pools") -set(SSM_GSMP_SUFFIX ".gsmp" CACHE STRING - "Suffix for Group Shared Memory Pool") -set(SSM_PPP_SUFFIX ".ppp" CACHE STRING - "Suffix for Process Private Pool") +# Pool naming +set(SSM_GSPP_NAME "/${SSM_PREFIX}.gspp" CACHE INTERNAL + "Name for the Global Shared Packet Pool") +set(SSM_PUP_NAME_FMT "/${SSM_PREFIX}.pup.%d" CACHE INTERNAL + "Format string for Per-User Pool names (uid as argument)") + +# Legacy naming (for compatibility) set(SSM_POOL_NAME "/${SHM_PREFIX}.pool" CACHE INTERNAL - "Name for the main POSIX shared memory pool") + "Name for the main POSIX shared memory pool") set(SSM_POOL_BLOCKS 16384 CACHE STRING "Number of blocks in SSM packet pool, must be a power of 2") set(SSM_PK_BUFF_HEADSPACE 256 CACHE STRING - "Bytes of headspace to reserve for future headers") + "Bytes of headspace to reserve for future headers") set(SSM_PK_BUFF_TAILSPACE 32 CACHE STRING - "Bytes of tailspace to reserve for future tails") + "Bytes of tailspace to reserve for future tails") set(SSM_RBUFF_SIZE 1024 CACHE STRING "Number of blocks in rbuff buffer, must be a power of 2") set(SSM_RBUFF_PREFIX "/${SHM_PREFIX}.rbuff." CACHE INTERNAL - "Prefix for rbuff POSIX shared memory filenames") + "Prefix for rbuff POSIX shared memory filenames") set(SSM_FLOW_SET_PREFIX "/${SHM_PREFIX}.set." CACHE INTERNAL - "Prefix for the POSIX shared memory flow set") - -# Pool blocks per size class -# This determines how many blocks of each size are preallocated in the pool -# Higher values reduce allocation failures but increase memory usage -set(SSM_POOL_256_BLOCKS 1024 CACHE STRING - "Number of 256B blocks in pool") -set(SSM_POOL_512_BLOCKS 768 CACHE STRING - "Number of 512B blocks in pool") -set(SSM_POOL_1K_BLOCKS 512 CACHE STRING - "Number of 1KB blocks in pool") -set(SSM_POOL_2K_BLOCKS 384 CACHE STRING - "Number of 2KB blocks in pool") -set(SSM_POOL_4K_BLOCKS 256 CACHE STRING - "Number of 4KB blocks in pool") -set(SSM_POOL_16K_BLOCKS 128 CACHE STRING - "Number of 16KB blocks in pool") -set(SSM_POOL_64K_BLOCKS 64 CACHE STRING - "Number of 64KB blocks in pool") -set(SSM_POOL_256K_BLOCKS 32 CACHE STRING - "Number of 256KB blocks in pool") -set(SSM_POOL_1M_BLOCKS 16 CACHE STRING - "Number of 1MB blocks in pool") + "Prefix for the POSIX shared memory flow set") # Number of shards per size class for reducing contention set(SSM_POOL_SHARDS 4 CACHE STRING "Number of allocator shards per size class") +# Global Shared Packet Pool (GSPP) - for privileged processes +# Shared by all processes in 'ouroboros' group (~60 MB total) +set(SSM_GSPP_256_BLOCKS 1024 CACHE STRING + "GSPP: Number of 256B blocks") +set(SSM_GSPP_512_BLOCKS 768 CACHE STRING + "GSPP: Number of 512B blocks") +set(SSM_GSPP_1K_BLOCKS 512 CACHE STRING + "GSPP: Number of 1KB blocks") +set(SSM_GSPP_2K_BLOCKS 384 CACHE STRING + "GSPP: Number of 2KB blocks") +set(SSM_GSPP_4K_BLOCKS 256 CACHE STRING + "GSPP: Number of 4KB blocks") +set(SSM_GSPP_16K_BLOCKS 128 CACHE STRING + "GSPP: Number of 16KB blocks") +set(SSM_GSPP_64K_BLOCKS 64 CACHE STRING + "GSPP: Number of 64KB blocks") +set(SSM_GSPP_256K_BLOCKS 32 CACHE STRING + "GSPP: Number of 256KB blocks") +set(SSM_GSPP_1M_BLOCKS 16 CACHE STRING + "GSPP: Number of 1MB blocks") + +# Per-User Pool (PUP) - for unprivileged applications +# Each unprivileged app gets its own smaller pool (~7.5 MB total) +set(SSM_PUP_256_BLOCKS 128 CACHE STRING + "PUP: Number of 256B blocks") +set(SSM_PUP_512_BLOCKS 96 CACHE STRING + "PUP: Number of 512B blocks") +set(SSM_PUP_1K_BLOCKS 64 CACHE STRING + "PUP: Number of 1KB blocks") +set(SSM_PUP_2K_BLOCKS 48 CACHE STRING + "PUP: Number of 2KB blocks") +set(SSM_PUP_4K_BLOCKS 32 CACHE STRING + "PUP: Number of 4KB blocks") +set(SSM_PUP_16K_BLOCKS 16 CACHE STRING + "PUP: Number of 16KB blocks") +set(SSM_PUP_64K_BLOCKS 8 CACHE STRING + "PUP: Number of 64KB blocks") +set(SSM_PUP_256K_BLOCKS 2 CACHE STRING + "PUP: Number of 256KB blocks") +set(SSM_PUP_1M_BLOCKS 0 CACHE STRING + "PUP: Number of 1MB blocks") + # SSM packet buffer overhead - computed at compile time via sizeof() # Defined in config.h.in as sizeof(_ssm_memory_block) + sizeof(_ssm_pk_buff) -# This makes it portable across platforms with different pid_t sizes and padding +# This makes it portable across platforms with different pid_t sizes + +# GSPP total size calculation +math(EXPR SSM_GSPP_TOTAL_SIZE + "(1 << 8) * ${SSM_GSPP_256_BLOCKS} + \ + (1 << 9) * ${SSM_GSPP_512_BLOCKS} + \ + (1 << 10) * ${SSM_GSPP_1K_BLOCKS} + \ + (1 << 11) * ${SSM_GSPP_2K_BLOCKS} + \ + (1 << 12) * ${SSM_GSPP_4K_BLOCKS} + \ + (1 << 14) * ${SSM_GSPP_16K_BLOCKS} + \ + (1 << 16) * ${SSM_GSPP_64K_BLOCKS} + \ + (1 << 18) * ${SSM_GSPP_256K_BLOCKS} + \ + (1 << 20) * ${SSM_GSPP_1M_BLOCKS}") + +set(SSM_GSPP_TOTAL_SIZE ${SSM_GSPP_TOTAL_SIZE} CACHE INTERNAL + "GSPP total size in bytes") + +# PUP total size calculation +math(EXPR SSM_PUP_TOTAL_SIZE + "(1 << 8) * ${SSM_PUP_256_BLOCKS} + \ + (1 << 9) * ${SSM_PUP_512_BLOCKS} + \ + (1 << 10) * ${SSM_PUP_1K_BLOCKS} + \ + (1 << 11) * ${SSM_PUP_2K_BLOCKS} + \ + (1 << 12) * ${SSM_PUP_4K_BLOCKS} + \ + (1 << 14) * ${SSM_PUP_16K_BLOCKS} + \ + (1 << 16) * ${SSM_PUP_64K_BLOCKS} + \ + (1 << 18) * ${SSM_PUP_256K_BLOCKS} + \ + (1 << 20) * ${SSM_PUP_1M_BLOCKS}") -# Total shared memory pool size calculation -math(EXPR SSM_POOL_TOTAL_SIZE - "(1 << 8) * ${SSM_POOL_256_BLOCKS} + \ - (1 << 9) * ${SSM_POOL_512_BLOCKS} + \ - (1 << 10) * ${SSM_POOL_1K_BLOCKS} + \ - (1 << 11) * ${SSM_POOL_2K_BLOCKS} + \ - (1 << 12) * ${SSM_POOL_4K_BLOCKS} + \ - (1 << 14) * ${SSM_POOL_16K_BLOCKS} + \ - (1 << 16) * ${SSM_POOL_64K_BLOCKS} + \ - (1 << 18) * ${SSM_POOL_256K_BLOCKS} + \ - (1 << 20) * ${SSM_POOL_1M_BLOCKS}") +set(SSM_PUP_TOTAL_SIZE ${SSM_PUP_TOTAL_SIZE} CACHE INTERNAL + "PUP total size in bytes") -set(SSM_POOL_TOTAL_SIZE ${SSM_POOL_TOTAL_SIZE} CACHE INTERNAL +# Legacy total size (same as GSPP) +set(SSM_POOL_TOTAL_SIZE ${SSM_GSPP_TOTAL_SIZE} CACHE INTERNAL "Total shared memory pool size in bytes") include(utils/HumanReadable) -format_bytes_human_readable(${SSM_POOL_TOTAL_SIZE} SSM_POOL_SIZE_DISPLAY) +format_bytes_human_readable(${SSM_GSPP_TOTAL_SIZE} SSM_GSPP_SIZE_DISPLAY) +format_bytes_human_readable(${SSM_PUP_TOTAL_SIZE} SSM_PUP_SIZE_DISPLAY) # Display configuration summary message(STATUS "Secure Shared Memory Pool Configuration:") message(STATUS " Pool prefix: ${SSM_PREFIX}") message(STATUS " Size classes: " - "256B, 512B, 1KiB, 2KiB, 4KiB, 16KiB, 64KiB, 256KiB, 1MiB") + "256B, 512B, 1KiB, 2KiB, 4KiB, 16KiB, 64KiB, 256KiB, 1MiB") message(STATUS " Max allocation: 1 MB") -message(STATUS " Total pool size: ${SSM_POOL_SIZE_DISPLAY} " - "(${SSM_POOL_TOTAL_SIZE} bytes)") message(STATUS " Shards per class: ${SSM_POOL_SHARDS}") -message(STATUS " Blocks per class: ${SSM_POOL_256_BLOCKS}, " - "${SSM_POOL_512_BLOCKS}, ${SSM_POOL_1K_BLOCKS}, " - "${SSM_POOL_2K_BLOCKS}, ${SSM_POOL_4K_BLOCKS}, " - "${SSM_POOL_16K_BLOCKS}, ${SSM_POOL_64K_BLOCKS}, " - "${SSM_POOL_256K_BLOCKS}, ${SSM_POOL_1M_BLOCKS}") +message(STATUS " GSPP (privileged): ${SSM_GSPP_SIZE_DISPLAY} " + "(${SSM_GSPP_TOTAL_SIZE} bytes)") +message(STATUS " Blocks: ${SSM_GSPP_256_BLOCKS}, ${SSM_GSPP_512_BLOCKS}, " + "${SSM_GSPP_1K_BLOCKS}, ${SSM_GSPP_2K_BLOCKS}, ${SSM_GSPP_4K_BLOCKS}, " + "${SSM_GSPP_16K_BLOCKS}, ${SSM_GSPP_64K_BLOCKS}, ${SSM_GSPP_256K_BLOCKS}, " + "${SSM_GSPP_1M_BLOCKS}") +message(STATUS " PUP (unprivileged): ${SSM_PUP_SIZE_DISPLAY} " + "(${SSM_PUP_TOTAL_SIZE} bytes)") +message(STATUS " Blocks: ${SSM_PUP_256_BLOCKS}, ${SSM_PUP_512_BLOCKS}, " + "${SSM_PUP_1K_BLOCKS}, ${SSM_PUP_2K_BLOCKS}, ${SSM_PUP_4K_BLOCKS}, " + "${SSM_PUP_16K_BLOCKS}, ${SSM_PUP_64K_BLOCKS}, ${SSM_PUP_256K_BLOCKS}, " + "${SSM_PUP_1M_BLOCKS}") |
