nvme: Fix keyed/unkeyd SGL nvme cmd dump
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Change-Id: I0a08518b5c30455a17158aa440715515d0c066fc Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12133 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
00d46b80b2
commit
007fb1d3cb
@ -191,11 +191,11 @@ nvme_get_sgl(char *buf, size_t size, struct spdk_nvme_cmd *cmd)
|
||||
nvme_get_string(sgl_subtype, sgl->generic.subtype), sgl->address);
|
||||
assert(c >= 0 && (size_t)c < size);
|
||||
|
||||
if (sgl->generic.type == SPDK_NVME_SGL_TYPE_KEYED_DATA_BLOCK) {
|
||||
if (sgl->generic.type == SPDK_NVME_SGL_TYPE_DATA_BLOCK) {
|
||||
nvme_get_sgl_unkeyed(buf + c, size - c, cmd);
|
||||
}
|
||||
|
||||
if (sgl->generic.type == SPDK_NVME_SGL_TYPE_DATA_BLOCK) {
|
||||
if (sgl->generic.type == SPDK_NVME_SGL_TYPE_KEYED_DATA_BLOCK) {
|
||||
nvme_get_sgl_keyed(buf + c, size - c, cmd);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -741,21 +742,21 @@ test_nvme_get_sgl_print_info(void)
|
||||
cmd.dptr.sgl1.generic.type = SPDK_NVME_SGL_TYPE_DATA_BLOCK;
|
||||
cmd.dptr.sgl1.generic.subtype = 0;
|
||||
cmd.dptr.sgl1.address = 0xdeadbeef;
|
||||
cmd.dptr.sgl1.keyed.length = 0x1000;
|
||||
cmd.dptr.sgl1.keyed.key = 0xababccdd;
|
||||
cmd.dptr.sgl1.unkeyed.length = 0x1000;
|
||||
|
||||
nvme_get_sgl(buf, NVME_CMD_DPTR_STR_SIZE, &cmd);
|
||||
CU_ASSERT(!strncmp(buf, "SGL DATA BLOCK ADDRESS 0xdeadbeef len:0x1000 key:0xababccdd",
|
||||
CU_ASSERT(!strncmp(buf, "SGL DATA BLOCK ADDRESS 0xdeadbeef len:0x1000",
|
||||
NVME_CMD_DPTR_STR_SIZE));
|
||||
|
||||
memset(&cmd.dptr.sgl1, 0, sizeof(cmd.dptr.sgl1));
|
||||
cmd.dptr.sgl1.generic.type = SPDK_NVME_SGL_TYPE_KEYED_DATA_BLOCK;
|
||||
cmd.dptr.sgl1.generic.subtype = 0;
|
||||
cmd.dptr.sgl1.address = 0xdeadbeef;
|
||||
cmd.dptr.sgl1.unkeyed.length = 0x1000;
|
||||
cmd.dptr.sgl1.keyed.length = 0x1000;
|
||||
cmd.dptr.sgl1.keyed.key = 0xababccdd;
|
||||
|
||||
nvme_get_sgl(buf, NVME_CMD_DPTR_STR_SIZE, &cmd);
|
||||
CU_ASSERT(!strncmp(buf, "SGL RESERVED ADDRESS 0xdeadbeef len:0x1000",
|
||||
CU_ASSERT(!strncmp(buf, "SGL RESERVED ADDRESS 0xdeadbeef len:0x1000 key:0xababccdd",
|
||||
NVME_CMD_DPTR_STR_SIZE));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user