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

feat: cryto build enable #74

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ fn configure_spdk() -> Result<LibraryConfig, Error> {
spdk_lib.mark_system("uuid");
spdk_lib.mark_system("rdmacm");
spdk_lib.mark_system("ibverbs");
spdk_lib.mark_system("mlx5");
spdk_lib.mark_system("keyutils");

spdk_lib.set_static_search(true);

Expand Down Expand Up @@ -294,7 +296,9 @@ fn main() {
.header("wrapper.h")
.formatter(bindgen::Formatter::Rustfmt)
.allowlist_function(".*.aio.*")
.allowlist_function("^accel.*")
.allowlist_function(".*.crypto_disk.*")
.allowlist_function(".*.crypto_opts.*")
.allowlist_function(".*.iscsi.*")
.allowlist_function(".*.lock_lba_range")
.allowlist_function(".*.lvol.*")
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/build_spdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ function cmd_configure() {
msg_info "Target platform: $TARGET_PLATFORM"
case $TARGET_PLATFORM in
"x86_64-unknown-linux-gnu")
CONFIGURE_ARGS+=("--target-arch=nehalem" "--without-crypto")
CONFIGURE_ARGS+=("--target-arch=nehalem" "--with-crypto")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add it to the aarch below as well? is this why ci is failing perhaps?

;;
"aarch64-unknown-linux-gnu")
CONFIGURE_ARGS+=(" --target-arch=armv8-a+crypto")
Expand Down
2 changes: 2 additions & 0 deletions nix/pkgs/libspdk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
, utillinux
, zlib
, rdma-core
, keyutils
}:
let
# Suffix for debug build name.
Expand Down Expand Up @@ -143,6 +144,7 @@ let
numactl
openssl
rdma-core
keyutils
zlib
] ++ extraBuildInputs;

Expand Down
12 changes: 11 additions & 1 deletion src/bdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
spdk_bdev_get_aliases, spdk_bdev_get_buf_align, spdk_bdev_get_by_name,
spdk_bdev_has_write_cache, spdk_bdev_io_type_supported, spdk_bdev_module,
spdk_bdev_module_release_bdev, spdk_bdev_register, spdk_bdev_unregister,
SPDK_BDEV_CLAIM_EXCL_WRITE, SPDK_BDEV_CLAIM_NONE,
vbdev_crypto_disk_get_base_bdev, SPDK_BDEV_CLAIM_EXCL_WRITE, SPDK_BDEV_CLAIM_NONE,
},
BdevIo, BdevModule, BdevOps, IoChannel, IoDevice, IoType, Thread, Uuid,
};
Expand Down Expand Up @@ -71,6 +71,16 @@ where
unsafe { (*self.as_inner_ref().module).name.as_str() }
}

/// Returns the bdev handle which is the base of `self` bdev here.
/// e.g self could be a crypto vbdev and base an aio bdev.
/// XXX: This must be called only by crypto vbdev today.
pub fn crypto_base_bdev(&self) -> Self {
let p = unsafe {
vbdev_crypto_disk_get_base_bdev(self.name().as_ptr() as *mut std::os::raw::c_char)
};
Self::from_inner_ptr(p)
}

/// TODO
/// ... lookup a bdev by its name
pub fn lookup_by_name(name: &str) -> Option<Self> {
Expand Down
2 changes: 2 additions & 0 deletions wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include <thread/thread_internal.h>
#include <bdev/bdev_internal.h>
#include <blob/blobstore.h>
#include <spdk/accel_module.h>
#include <accel/dpdk_cryptodev/accel_dpdk_cryptodev.h>

#include "helpers/logwrapper.h"
#include "helpers/nvme_helper.h"
Expand Down
Loading