Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ARM requires non-accelerated CRC. #264

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ cmake-*/**
# Visual Studio
CMakeSettings.json
.vs/**
.cache
5 changes: 3 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "4.9.3"
version = "4.9.4"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down Expand Up @@ -59,7 +59,8 @@ def requirements(self):
self.requires("sisl/[>=10.3]")

self.requires("farmhash/cci.20190513@")
self.requires("isa-l/2.30.0")
if self.settings.arch in ['x86', 'x86_64']:
self.requires("isa-l/2.30.0")
self.requires("spdk/21.07.y")

def build(self):
Expand Down
43 changes: 24 additions & 19 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@ cmake_minimum_required(VERSION 3.13)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)

find_package(Threads)
find_library(LIB_AIO aio REQUIRED)
find_package(isa-l REQUIRED)
find_package(iomgr REQUIRED)
find_package(farmhash REQUIRED)
find_package(GTest REQUIRED)

set (COMMON_DEPS
iomgr::iomgr
farmhash::farmhash
isa-l::isa-l
sisl::sisl
)

set(COMMON_TEST_DEPS
${COMMON_DEPS}
${spdk_LIBRARY_LIST}
${dpdk_LIBRARY_LIST}
GTest::gmock
)
find_library(LIB_AIO aio QUIET REQUIRED)
find_package(isa-l QUIET)
find_package(iomgr QUIET REQUIRED)
find_package(farmhash QUIET REQUIRED)
find_package(GTest QUIET REQUIRED)

list(APPEND COMMON_DEPS
iomgr::iomgr
farmhash::farmhash
sisl::sisl
)
if (${isa-l_FOUND})
list(APPEND COMMON_DEPS isa-l::isa-l)
else ()
add_flags("-DNO_ISAL")
endif()

list(APPEND COMMON_TEST_DEPS
${COMMON_DEPS}
${spdk_LIBRARY_LIST}
${dpdk_LIBRARY_LIST}
GTest::gmock
)

include_directories (BEFORE lib/)
include_directories (BEFORE include/)
Expand Down Expand Up @@ -49,6 +53,7 @@ set(HOMESTORE_OBJECTS
$<TARGET_OBJECTS:hs_datasvc>
$<TARGET_OBJECTS:hs_replication>
lib/homestore.cpp
lib/crc.cpp
#$<TARGET_OBJECTS:hs_cp>
#$<TARGET_OBJECTS:indx_mgr>
)
Expand Down
3 changes: 1 addition & 2 deletions src/include/homestore/btree/detail/btree_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include <sisl/utility/obj_life_counter.hpp>
#include "btree_internal.hpp"
#include <homestore/btree/btree_kv.hpp>
// #include <iomgr/iomgr_flip.hpp>
#include <isa-l/crc.h>
#include <homestore/crc.h>

namespace homestore {
ENUM(locktype_t, uint8_t, NONE, READ, WRITE)
Expand Down
16 changes: 16 additions & 0 deletions src/include/homestore/crc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

// Only x86 and x86_64 supported by Intel Storage Acceleration library
#ifndef NO_ISAL
#include <isa-l/crc.h>

#else

extern "C" {
// crc16_t10dif reference function, slow crc16 from the definition.
uint16_t crc16_t10dif(uint16_t seed, const unsigned char* buf, uint64_t len);

// crc32_ieee reference function, slow crc32 from the definition.
uint32_t crc32_ieee(uint32_t seed, const unsigned char* buf, uint64_t len);
}
#endif
43 changes: 43 additions & 0 deletions src/lib/crc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Only x86 and x86_64 supported by Intel Storage Acceleration library
#ifdef NO_ISAL

#include <cstdint>
#include <cstddef>
extern "C" {
#define MAX_ITER 8

// crc16_t10dif reference function, slow crc16 from the definition.
uint16_t crc16_t10dif(uint16_t seed, const unsigned char* buf, uint64_t len) {
size_t rem = seed;
unsigned int i, j;

uint16_t poly = 0x8bb7; // t10dif standard

for (i = 0; i < len; i++) {
rem = rem ^ (buf[i] << 8);
for (j = 0; j < MAX_ITER; j++) {
rem = rem << 1;
rem = (rem & 0x10000) ? rem ^ poly : rem;
}
}
return rem;
}

// crc32_ieee reference function, slow crc32 from the definition.
uint32_t crc32_ieee(uint32_t seed, const unsigned char* buf, uint64_t len) {
uint64_t rem = ~seed;
unsigned int i, j;

uint32_t poly = 0x04C11DB7; // IEEE standard

for (i = 0; i < len; i++) {
rem = rem ^ ((uint64_t)buf[i] << 24);
for (j = 0; j < MAX_ITER; j++) {
rem = rem << 1;
rem = (rem & 0x100000000ULL) ? rem ^ poly : rem;
}
}
return ~rem;
}
}
#endif
2 changes: 1 addition & 1 deletion src/lib/device/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <map>
#include <vector>

#include <isa-l/crc.h>
#include <homestore/crc.h>
#include <iomgr/iomgr.hpp>
#include <sisl/fds/sparse_vector.hpp>
#include <homestore/homestore_decl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/device/device_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <vector>

#include <iomgr/iomgr.hpp>
#include <isa-l/crc.h>
#include <homestore/crc.h>
#include <sisl/logging/logging.h>

#include <boost/uuid/random_generator.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/lib/device/physical_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <iomgr/iomgr.hpp>
#include <iomgr/iomgr_flip.hpp>
#include <sisl/fds/utils.hpp>
#include <isa-l/crc.h>

#include <homestore/homestore_decl.hpp>
#include "device/chunk.h"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/device/physical_dev.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <boost/icl/split_interval_set.hpp>
#include <nlohmann/json.hpp>
#include <isa-l/crc.h>
#include <homestore/crc.h>
#include <sisl/metrics/metrics.hpp>
#include <sisl/logging/logging.h>
#include <homestore/homestore_decl.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/lib/logstore/log_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <iterator>

#include <sisl/fds/vector_pool.hpp>
#include <isa-l/crc.h>
#include <iomgr/iomgr_flip.hpp>

#include <homestore/logstore_service.hpp>
Expand Down
2 changes: 0 additions & 2 deletions src/lib/logstore/log_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*********************************************************************************/
#include <cstring>

#include <isa-l/crc.h>

#include <homestore/logstore/log_store.hpp>
#include "common/homestore_assert.hpp"
#include "log_dev.hpp"
Expand Down
2 changes: 0 additions & 2 deletions src/lib/logstore/log_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
* specific language governing permissions and limitations under the License.
*
*********************************************************************************/
#include <isa-l/crc.h>

#include "device/chunk.h"
#include "common/homestore_assert.hpp"
#include "common/homestore_config.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/lib/meta/meta_blk_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <sisl/fds/compress.hpp>
#include <sisl/fds/utils.hpp>
#include <isa-l/crc.h>
#include <iomgr/iomgr_flip.hpp>

#include <homestore/meta_service.hpp>
Expand Down