@@ -8,10 +8,11 @@ use serde::{Deserialize, Serialize};
88use spdk_rs:: {
99 ffihelper:: copy_str_with_null,
1010 libspdk:: {
11- bdev_nvme_get_opts , bdev_nvme_set_opts , spdk_bdev_get_opts , spdk_bdev_nvme_opts ,
11+ spdk_bdev_get_opts , spdk_bdev_nvme_get_opts , spdk_bdev_nvme_opts , spdk_bdev_nvme_set_opts ,
1212 spdk_bdev_opts, spdk_bdev_set_opts, spdk_iobuf_get_opts, spdk_iobuf_opts,
1313 spdk_iobuf_set_opts, spdk_nvmf_target_opts, spdk_nvmf_transport_opts,
14- spdk_sock_impl_get_opts, spdk_sock_impl_opts, spdk_sock_impl_set_opts,
14+ spdk_sock_impl_get_opts, spdk_sock_impl_opts, spdk_sock_impl_set_opts, NVMF_DEFAULT_KAS ,
15+ NVMF_DEFAULT_MIN_KATO ,
1516 } ,
1617 struct_size_init,
1718} ;
@@ -314,7 +315,9 @@ impl From<NvmfTransportOpts> for spdk_nvmf_transport_opts {
314315 num_shared_buffers: o. num_shared_buf,
315316 buf_cache_size: o. buf_cache_size,
316317 dif_insert_or_strip: o. dif_insert_or_strip,
317- reserved29: Default :: default ( ) ,
318+ // todo: add disable_command_passthru in NvmfTransportOpts when needed.
319+ disable_command_passthru: false ,
320+ reserved30: Default :: default ( ) ,
318321 abort_timeout_sec: o. abort_timeout_sec,
319322 association_timeout: 120000 ,
320323 transport_specific: std:: ptr:: null( ) ,
@@ -323,6 +326,9 @@ impl From<NvmfTransportOpts> for spdk_nvmf_transport_opts {
323326 reserved61: Default :: default ( ) ,
324327 ack_timeout: o. ack_timeout,
325328 data_wr_pool_size: o. data_wr_pool_size,
329+ // todo: add min_kato and kas in NvmfTransportOpts when needed.
330+ min_kato: NVMF_DEFAULT_MIN_KATO ,
331+ kas: NVMF_DEFAULT_KAS as u16 ,
326332 } ,
327333 opts_size
328334 )
@@ -381,14 +387,19 @@ pub struct NvmeBdevOpts {
381387impl GetOpts for NvmeBdevOpts {
382388 fn get ( & self ) -> Self {
383389 let opts: spdk_bdev_nvme_opts = unsafe { zeroed ( ) } ;
384- unsafe { bdev_nvme_get_opts ( & opts as * const _ as * mut spdk_bdev_nvme_opts ) } ;
390+ unsafe {
391+ spdk_bdev_nvme_get_opts (
392+ & opts as * const _ as * mut spdk_bdev_nvme_opts ,
393+ size_of :: < spdk_bdev_nvme_opts > ( ) as u64 ,
394+ )
395+ } ;
385396 opts. into ( )
386397 }
387398
388399 fn set ( & self ) -> bool {
389400 let opts = Box :: new ( self . into ( ) ) ;
390401 debug ! ( "{:?}" , & opts) ;
391- if unsafe { bdev_nvme_set_opts ( Box :: into_raw ( opts) ) } != 0 {
402+ if unsafe { spdk_bdev_nvme_set_opts ( Box :: into_raw ( opts) ) } != 0 {
392403 warn ! ( "Failed to apply NVMe Bdev options" ) ;
393404 return false ;
394405 }
@@ -466,6 +477,7 @@ impl From<spdk_bdev_nvme_opts> for NvmeBdevOpts {
466477impl From < & NvmeBdevOpts > for spdk_bdev_nvme_opts {
467478 fn from ( o : & NvmeBdevOpts ) -> Self {
468479 Self {
480+ opts_size : std:: mem:: size_of :: < spdk_bdev_nvme_opts > ( ) as u64 ,
469481 action_on_timeout : o. action_on_timeout ,
470482 timeout_us : o. timeout_us ,
471483 timeout_admin_us : o. timeout_admin_us ,
@@ -479,6 +491,7 @@ impl From<&NvmeBdevOpts> for spdk_bdev_nvme_opts {
479491 nvme_ioq_poll_period_us : o. nvme_ioq_poll_period_us ,
480492 io_queue_requests : o. io_queue_requests ,
481493 delay_cmd_submit : o. delay_cmd_submit ,
494+ reserved73 : Default :: default ( ) ,
482495 bdev_retry_count : o. bdev_retry_count ,
483496 transport_ack_timeout : o. transport_ack_timeout ,
484497 ctrlr_loss_timeout_sec : o. ctrlr_loss_timeout_sec ,
@@ -490,11 +503,16 @@ impl From<&NvmeBdevOpts> for spdk_bdev_nvme_opts {
490503 nvme_error_stat : false ,
491504 rdma_srq_size : 0 ,
492505 io_path_stat : false ,
506+ reserved99 : Default :: default ( ) ,
493507 allow_accel_sequence : false ,
494508 rdma_max_cq_size : 0 ,
495509 rdma_cm_event_timeout_ms : 0 ,
510+ reserved110 : Default :: default ( ) ,
496511 dhchap_digests : 0 ,
497512 dhchap_dhgroups : 0 ,
513+ rdma_umr_per_io : false ,
514+ reserved121 : Default :: default ( ) ,
515+ tcp_connect_timeout_ms : 0 ,
498516 }
499517 }
500518}
@@ -708,6 +726,8 @@ pub struct IoBufOpts {
708726 pub small_bufsize : u32 ,
709727 /// Size of a single large buffer.
710728 pub large_bufsize : u32 ,
729+ /// Enable per-NUMA node buffer pools.
730+ pub enable_numa : bool ,
711731}
712732
713733impl GetOpts for IoBufOpts {
@@ -718,6 +738,7 @@ impl GetOpts for IoBufOpts {
718738 large_pool_count: 0 ,
719739 small_bufsize: 0 ,
720740 large_bufsize: 0 ,
741+ enable_numa: 0 ,
721742 } ,
722743 opts_size
723744 ) ;
@@ -742,6 +763,7 @@ impl Default for IoBufOpts {
742763 large_pool_count : try_from_env ( "IOBUF_LARGE_POOL_COUNT" , 2048 ) ,
743764 small_bufsize : try_from_env ( "IOBUF_SMALL_BUFSIZE" , 8 * 1024 ) ,
744765 large_bufsize : try_from_env ( "IOBUF_LARGE_BUFSIZE" , 132 * 1024 ) ,
766+ enable_numa : try_from_env ( "IOBUF_ENABLE_NUMA" , false ) ,
745767 }
746768 }
747769}
@@ -753,6 +775,7 @@ impl From<spdk_iobuf_opts> for IoBufOpts {
753775 large_pool_count : o. large_pool_count ,
754776 small_bufsize : o. small_bufsize ,
755777 large_bufsize : o. large_bufsize ,
778+ enable_numa : o. enable_numa != 0 ,
756779 }
757780 }
758781}
@@ -765,6 +788,7 @@ impl From<&IoBufOpts> for spdk_iobuf_opts {
765788 large_pool_count: o. large_pool_count,
766789 small_bufsize: o. small_bufsize,
767790 large_bufsize: o. large_bufsize,
791+ enable_numa: o. enable_numa as u8 ,
768792 } ,
769793 opts_size
770794 )
0 commit comments