bdev/nvme/rpc: Add params to enable TCP hdgst and ddgst
Function bdev_nvme_create accpets new parameter - ctrlr opts which is passed and filled by RPC handler. That will allow us to add config parameters for other ctrlr options with minimal changes. Change-Id: I96ac1b21e7a3816c652765cddade75423eb843ca Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6023 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: <dongx.yi@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
4c26a8e79f
commit
05aeb9db27
@ -2561,6 +2561,8 @@ hostaddr | Optional | string | NVMe-oF host address: ip addr
|
|||||||
hostsvcid | Optional | string | NVMe-oF host trsvcid: port number
|
hostsvcid | Optional | string | NVMe-oF host trsvcid: port number
|
||||||
prchk_reftag | Optional | bool | Enable checking of PI reference tag for I/O processing
|
prchk_reftag | Optional | bool | Enable checking of PI reference tag for I/O processing
|
||||||
prchk_guard | Optional | bool | Enable checking of PI guard for I/O processing
|
prchk_guard | Optional | bool | Enable checking of PI guard for I/O processing
|
||||||
|
hdgst | Optional | bool | Enable TCP header digest
|
||||||
|
ddgst | Optional | bool | Enable TCP data digest
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
@ -2019,7 +2019,8 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,
|
|||||||
const char *hostnqn,
|
const char *hostnqn,
|
||||||
uint32_t prchk_flags,
|
uint32_t prchk_flags,
|
||||||
spdk_bdev_create_nvme_fn cb_fn,
|
spdk_bdev_create_nvme_fn cb_fn,
|
||||||
void *cb_ctx)
|
void *cb_ctx,
|
||||||
|
struct spdk_nvme_ctrlr_opts *opts)
|
||||||
{
|
{
|
||||||
struct nvme_probe_skip_entry *entry, *tmp;
|
struct nvme_probe_skip_entry *entry, *tmp;
|
||||||
struct nvme_async_probe_ctx *ctx;
|
struct nvme_async_probe_ctx *ctx;
|
||||||
@ -2054,7 +2055,12 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spdk_nvme_ctrlr_get_default_ctrlr_opts(&ctx->opts, sizeof(ctx->opts));
|
if (opts) {
|
||||||
|
memcpy(&ctx->opts, opts, sizeof(*opts));
|
||||||
|
} else {
|
||||||
|
spdk_nvme_ctrlr_get_default_ctrlr_opts(&ctx->opts, sizeof(ctx->opts));
|
||||||
|
}
|
||||||
|
|
||||||
ctx->opts.transport_retry_count = g_opts.retry_count;
|
ctx->opts.transport_retry_count = g_opts.retry_count;
|
||||||
ctx->opts.keep_alive_timeout_ms = g_opts.keep_alive_timeout_ms;
|
ctx->opts.keep_alive_timeout_ms = g_opts.keep_alive_timeout_ms;
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ int bdev_nvme_create(struct spdk_nvme_transport_id *trid,
|
|||||||
const char *hostnqn,
|
const char *hostnqn,
|
||||||
uint32_t prchk_flags,
|
uint32_t prchk_flags,
|
||||||
spdk_bdev_create_nvme_fn cb_fn,
|
spdk_bdev_create_nvme_fn cb_fn,
|
||||||
void *cb_ctx);
|
void *cb_ctx,
|
||||||
|
struct spdk_nvme_ctrlr_opts *opts);
|
||||||
struct spdk_nvme_ctrlr *bdev_nvme_get_ctrlr(struct spdk_bdev *bdev);
|
struct spdk_nvme_ctrlr *bdev_nvme_get_ctrlr(struct spdk_bdev *bdev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,6 +176,7 @@ struct rpc_bdev_nvme_attach_controller {
|
|||||||
char *hostsvcid;
|
char *hostsvcid;
|
||||||
bool prchk_reftag;
|
bool prchk_reftag;
|
||||||
bool prchk_guard;
|
bool prchk_guard;
|
||||||
|
struct spdk_nvme_ctrlr_opts opts;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -207,7 +208,9 @@ static const struct spdk_json_object_decoder rpc_bdev_nvme_attach_controller_dec
|
|||||||
{"hostsvcid", offsetof(struct rpc_bdev_nvme_attach_controller, hostsvcid), spdk_json_decode_string, true},
|
{"hostsvcid", offsetof(struct rpc_bdev_nvme_attach_controller, hostsvcid), spdk_json_decode_string, true},
|
||||||
|
|
||||||
{"prchk_reftag", offsetof(struct rpc_bdev_nvme_attach_controller, prchk_reftag), spdk_json_decode_bool, true},
|
{"prchk_reftag", offsetof(struct rpc_bdev_nvme_attach_controller, prchk_reftag), spdk_json_decode_bool, true},
|
||||||
{"prchk_guard", offsetof(struct rpc_bdev_nvme_attach_controller, prchk_guard), spdk_json_decode_bool, true}
|
{"prchk_guard", offsetof(struct rpc_bdev_nvme_attach_controller, prchk_guard), spdk_json_decode_bool, true},
|
||||||
|
{"hdgst", offsetof(struct rpc_bdev_nvme_attach_controller, opts.header_digest), spdk_json_decode_bool, true},
|
||||||
|
{"ddgst", offsetof(struct rpc_bdev_nvme_attach_controller, opts.data_digest), spdk_json_decode_bool, true}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NVME_MAX_BDEVS_PER_RPC 128
|
#define NVME_MAX_BDEVS_PER_RPC 128
|
||||||
@ -263,6 +266,8 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spdk_nvme_ctrlr_get_default_ctrlr_opts(&ctx->req.opts, sizeof(ctx->req.opts));
|
||||||
|
|
||||||
if (spdk_json_decode_object(params, rpc_bdev_nvme_attach_controller_decoders,
|
if (spdk_json_decode_object(params, rpc_bdev_nvme_attach_controller_decoders,
|
||||||
SPDK_COUNTOF(rpc_bdev_nvme_attach_controller_decoders),
|
SPDK_COUNTOF(rpc_bdev_nvme_attach_controller_decoders),
|
||||||
&ctx->req)) {
|
&ctx->req)) {
|
||||||
@ -375,7 +380,7 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
|
|||||||
ctx->request = request;
|
ctx->request = request;
|
||||||
ctx->count = NVME_MAX_BDEVS_PER_RPC;
|
ctx->count = NVME_MAX_BDEVS_PER_RPC;
|
||||||
rc = bdev_nvme_create(&trid, &hostid, ctx->req.name, ctx->names, ctx->count, ctx->req.hostnqn,
|
rc = bdev_nvme_create(&trid, &hostid, ctx->req.name, ctx->names, ctx->count, ctx->req.hostnqn,
|
||||||
prchk_flags, rpc_bdev_nvme_attach_controller_done, ctx);
|
prchk_flags, rpc_bdev_nvme_attach_controller_done, ctx, &ctx->req.opts);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc));
|
spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -510,7 +510,9 @@ if __name__ == "__main__":
|
|||||||
hostaddr=args.hostaddr,
|
hostaddr=args.hostaddr,
|
||||||
hostsvcid=args.hostsvcid,
|
hostsvcid=args.hostsvcid,
|
||||||
prchk_reftag=args.prchk_reftag,
|
prchk_reftag=args.prchk_reftag,
|
||||||
prchk_guard=args.prchk_guard))
|
prchk_guard=args.prchk_guard,
|
||||||
|
hdgst=args.hdgst,
|
||||||
|
ddgst=args.ddgst))
|
||||||
|
|
||||||
p = subparsers.add_parser('bdev_nvme_attach_controller', aliases=['construct_nvme_bdev'],
|
p = subparsers.add_parser('bdev_nvme_attach_controller', aliases=['construct_nvme_bdev'],
|
||||||
help='Add bdevs with nvme backend')
|
help='Add bdevs with nvme backend')
|
||||||
@ -535,6 +537,10 @@ if __name__ == "__main__":
|
|||||||
help='Enable checking of PI reference tag for I/O processing.', action='store_true')
|
help='Enable checking of PI reference tag for I/O processing.', action='store_true')
|
||||||
p.add_argument('-g', '--prchk-guard',
|
p.add_argument('-g', '--prchk-guard',
|
||||||
help='Enable checking of PI guard for I/O processing.', action='store_true')
|
help='Enable checking of PI guard for I/O processing.', action='store_true')
|
||||||
|
p.add_argument('-e', '--hdgst',
|
||||||
|
help='Enable TCP header digest.', action='store_true')
|
||||||
|
p.add_argument('-d', '--ddgst',
|
||||||
|
help='Enable TCP data digest.', action='store_true')
|
||||||
p.set_defaults(func=bdev_nvme_attach_controller)
|
p.set_defaults(func=bdev_nvme_attach_controller)
|
||||||
|
|
||||||
def bdev_nvme_get_controllers(args):
|
def bdev_nvme_get_controllers(args):
|
||||||
|
@ -488,7 +488,8 @@ def bdev_nvme_set_hotplug(client, enable, period_us=None):
|
|||||||
@deprecated_alias('construct_nvme_bdev')
|
@deprecated_alias('construct_nvme_bdev')
|
||||||
def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvcid=None,
|
def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvcid=None,
|
||||||
priority=None, subnqn=None, hostnqn=None, hostaddr=None,
|
priority=None, subnqn=None, hostnqn=None, hostaddr=None,
|
||||||
hostsvcid=None, prchk_reftag=None, prchk_guard=None):
|
hostsvcid=None, prchk_reftag=None, prchk_guard=None,
|
||||||
|
hdgst=None, ddgst=None):
|
||||||
"""Construct block device for each NVMe namespace in the attached controller.
|
"""Construct block device for each NVMe namespace in the attached controller.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -504,6 +505,8 @@ def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvc
|
|||||||
hostsvcid: host transport service ID (port number for IP-based transports, NULL for PCIe or FC; optional)
|
hostsvcid: host transport service ID (port number for IP-based transports, NULL for PCIe or FC; optional)
|
||||||
prchk_reftag: Enable checking of PI reference tag for I/O processing (optional)
|
prchk_reftag: Enable checking of PI reference tag for I/O processing (optional)
|
||||||
prchk_guard: Enable checking of PI guard for I/O processing (optional)
|
prchk_guard: Enable checking of PI guard for I/O processing (optional)
|
||||||
|
hdgst: Enable TCP header digest (optional)
|
||||||
|
ddgst: Enable TCP data digest (optional)
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Names of created block devices.
|
Names of created block devices.
|
||||||
@ -539,6 +542,12 @@ def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvc
|
|||||||
if prchk_guard:
|
if prchk_guard:
|
||||||
params['prchk_guard'] = prchk_guard
|
params['prchk_guard'] = prchk_guard
|
||||||
|
|
||||||
|
if hdgst:
|
||||||
|
params['hdgst'] = hdgst
|
||||||
|
|
||||||
|
if ddgst:
|
||||||
|
params['ddgst'] = ddgst
|
||||||
|
|
||||||
return client.call('bdev_nvme_attach_controller', params)
|
return client.call('bdev_nvme_attach_controller', params)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user