diff --git a/src/nfs/nfs_proxy.cpp b/src/nfs/nfs_proxy.cpp index 386e39b7..0ab94ad6 100644 --- a/src/nfs/nfs_proxy.cpp +++ b/src/nfs/nfs_proxy.cpp @@ -72,12 +72,14 @@ static const char* help_text = " --port use port for NFS services (default is 2049)\n" " specify \"auto\" to auto-select and print port\n" " --portmap 0 do not listen on port 111 (portmap/rpcbind, requires root)\n" +#ifdef WITH_RDMACM " --nfs_rdma enable NFS-RDMA at RDMA-CM port (you can try 20049)\n" " if RDMA is enabled and --port is set to 0, TCP will be disabled\n" " --nfs_rdma_credit 16 maximum operation credit for RDMA clients (max iodepth)\n" " --nfs_rdma_send 1024 maximum RDMA send operation count (should be larger than iodepth)\n" " --nfs_rdma_alloc 1M RDMA memory allocation rounding\n" " --nfs_rdma_gc 64M maximum unused RDMA buffers\n" +#endif "\n" "vitastor-nfs --fs upgrade\n" " Upgrade FS metadata. Can be run online, but server(s) should be restarted\n" @@ -205,12 +207,15 @@ void nfs_proxy_t::run(json11::Json cfg) default_pool = cfg["pool"].as_string(); portmap_enabled = !json_is_false(cfg["portmap"]); nfs_port = cfg["port"].uint64_value() & 0xffff; +#ifdef WITH_RDMACM nfs_rdma_port = cfg["nfs_rdma"].uint64_value() & 0xffff; +#endif // Allow RDMA-only mode if port is explicitly set to 0 // Allow port auto-selection in server mode if explicitly set to --port auto nfs_port_auto = cfg["port"] == "auto"; if (!nfs_port) nfs_port = nfs_port_auto ? 0 : (!cfg["port"].is_null() && nfs_rdma_port ? -1 : 2049); +#ifdef WITH_RDMACM nfs_rdma_credit = cfg["nfs_rdma_credit"].uint64_value(); if (!nfs_rdma_credit) nfs_rdma_credit = 16; @@ -223,6 +228,7 @@ void nfs_proxy_t::run(json11::Json cfg) nfs_rdma_gc = cfg["nfs_rdma_gc"].uint64_value(); if (!nfs_rdma_gc) nfs_rdma_gc = 64*1048576; +#endif export_root = cfg["nfspath"].string_value(); if (!export_root.size()) export_root = "/"; @@ -391,10 +397,12 @@ void nfs_proxy_t::run_server(json11::Json cfg) } }); } +#ifdef WITH_RDMACM if (nfs_rdma_port) { rdma_context = create_rdma(bind_address, nfs_rdma_port, nfs_rdma_credit, nfs_rdma_max_send, nfs_rdma_alloc, nfs_rdma_gc); } +#endif if (mountpoint != "") { mount_fs();