Skip to content

Commit

Permalink
Feat: Support SNIA KV API
Browse files Browse the repository at this point in the history
Desc: Implementation of SNIA KV API according to SNIA spec
1. Wrap API code to support both Samsung KV API and SNIA KV API
2. Make sample code and kvbench support SNIA KV API
3. Update Quick Start Guide, README and upload SNIA KV API spec
4. Update LICENSE
5. Fix multiple bugs
  • Loading branch information
yuanyinggao committed Aug 28, 2019
1 parent f032082 commit c908297
Show file tree
Hide file tree
Showing 52 changed files with 5,915 additions and 1,299 deletions.
Binary file removed KVSSD_QUICK_START_GUIDE_0.8.0.pdf
Binary file not shown.
Binary file added KVSSD_QUICK_START_GUIDE_0.9.0.pdf
Binary file not shown.
36 changes: 8 additions & 28 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
BSD LICENSE
KVSSD

Copyright (c) 2018 Samsung Electronics Co., Ltd.
All rights reserved.
This Software is originally developed by OpenMPDK.
THIS SOFTWARE USE FOLLOWING OPEN SOURCE COMPONENTS
1. kv_bench dynamically links to the kv_core.
2. kv_core interacts with kernel_driver with Linux system calls and is dynamically linked to kv_bench.
3. kv_driver is a stand-alone component and used by other components only
through Linux system calls.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Samsung Electronics Co., Ltd. nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Please see application/kvbench/LICENSE, PDK/core/LICENSE and PDK/driver/PCIe/kernel_driver/LICENSE.
12 changes: 12 additions & 0 deletions PDK/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project (libkvapi C CXX)
option(WITH_EMU "Enable Emulator support" OFF)
option(WITH_KDD "Enable Kernel Driver support" OFF)
option(WITH_SPDK "Enable SPDK Driver support" OFF)
option(SAMSUNG_API "Support SAMSUNG API not SNIA API" OFF)

set(CMAKE_C_FLAGS "-MMD -MP -Wall -DLINUX -D_FILE_OFFSET_BITS=64 -fPIC -march=native")
set(CMAKE_CXX_FLAGS "-O2 -g -std=c++11 -MMD -MP -Wall -DLINUX -D_FILE_OFFSET_BITS=64 -fPIC -march=native")
Expand All @@ -17,6 +18,10 @@ if(WITH_LOG)
add_definitions(-DKVKDD_DEBUG)
endif()

if(SAMSUNG_API)
add_definitions(-DSAMSUNG_API)
endif()

if(WITH_KDD)

set(kvkdd_CFLAGS "-MMD -MP -Wall -DLINUX -D_FILE_OFFSET_BITS=64 -fPIC -march=native")
Expand All @@ -40,6 +45,8 @@ SET(SOURCES_API
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/driver_adapter/kvkdd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/cfrontend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/kvsdevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/private_cfrontend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/device_abstract_layer/emulator/src/kv_config.cpp
)
#
# library build rules (shared)
Expand Down Expand Up @@ -133,10 +140,12 @@ SET(SOURCES_API
#${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/driver_adapter/kvkdd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/cfrontend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/kvsdevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/private_cfrontend.cpp
)
message("${SOURCES_API}")
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/api/include)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/api/include/private)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/device_abstract_layer/include/private)
set(KVAPI_CXXFLAGS "-O2 -std=c++11 -MMD -MP -Wall -D_FILE_OFFSET_BITS=64 -fPIC -fpermissive -march=native")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${KVAPI_CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KVAPI_CXXFLAGS}")
Expand All @@ -159,6 +168,7 @@ elseif(WITH_SPDK)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/api/include)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/api/include/udd)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/api/include/private)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/device_abstract_layer/include/private)

set(KVKUDD_LIBS -L${CMAKE_CURRENT_SOURCE_DIR}/lib -Wl,--no-as-needed -lkvnvmedd -ldl -luuid)
SET(SOURCES_API
Expand All @@ -167,6 +177,8 @@ elseif(WITH_SPDK)
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/driver_adapter/kvudd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/cfrontend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/kvsdevice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/api/src/private_cfrontend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/device_abstract_layer/emulator/src/kv_config.cpp
)
set(KVAPI_LIBS ${KVAPI_LIBS} ${KVKUDD_LIBS} -lrt)
add_definitions(-DWITH_SPDK)
Expand Down
30 changes: 30 additions & 0 deletions PDK/core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BSD LICENSE

Copyright (c) 2018 Samsung Electronics Co., Ltd.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Samsung Electronics Co., Ltd. nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 changes: 18 additions & 2 deletions PDK/core/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ How to build:
- gcc version should be newer than v5.0
1. mkdir build
2. cd build
3. Three types of driver is available : kernel driver (KDD); emulator (EMU); user space driver (SPDK)
3. Two types of API are available: Samsung KV API and SNIA KV Storage API
Three types of driver are available : kernel driver (KDD); emulator (EMU); user space driver (SPDK)
User can compile one of them with following options:

SNIA KV Storage API:
Kernel Device Driver
=======
cmake -DWITH_KDD=ON ../
Expand All @@ -23,6 +25,19 @@ How to build:
User Space Driver
=======
cmake -DWITH_SPDK=ON ../

Samsung KV API:
Kernel Device Driver
=======
cmake -DWITH_KDD=ON -DSAMSUNG_API=ON ../

Emulator
=======
cmake -DWITH_EMU=ON -DSAMSUNG_API=ON ../

User Space Driver
=======
cmake -DWITH_SPDK=ON -DSAMSUNG_API=ON ../
* Replace <main_source_dir>/lib/libkvnvmedd.a if there is newer version of spdk driver available or if user wants to rebuild the driver
* The pre-build library is on gcc version 5.4.0
* https://github.com/OpenMPDK/uNVMe v18.11
Expand Down Expand Up @@ -53,4 +68,5 @@ How to test
- ./sample_code_async -d 0000:06:00.0 -n 100 -q 64 -o 1 -k 16 -v 4096
- /KVSSD/PDK/core/tools/setup.sh reset


PS: When test SNIA KV Storage API, make sure configuration file env_init.conf is in the upper directory of working directory
SNIA KV Storage API configuration file env_init.conf and emulator configuration file kvssd_emul.conf are described in KVSSD_QUICK_START_GUIDE
22 changes: 22 additions & 0 deletions PDK/core/env_init.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Environment configuration file of SNIA API
[aio]
# the maximum queue depth
queue_depth=64
# a bitmask for CPUs to be used for I/O
iocoremask=0

# emulator configuration
[emu]
# path to the emulator config file if using kvssd emulator
cfg_file=../kvssd_emul.conf

# spdk configuration
[udd]
# core ids used for submission queue when using spdk driver
core_mask_str=0
# core ids used for completion queue when using spdk driver
cq_thread_mask=0
# shared memory size in MB
memory_size=1024
# 1: sync I/O; 0: async I/O
syncio=0
Loading

0 comments on commit c908297

Please sign in to comment.