Add Disable IO flag to wdc_dump_dui_data function
PATCH 1/1 Add Disable IO flag to wdc_dump_dui_data function
Signed-off-by Jeff Lien <jeff.lien at wdc.com>
--- plugins/wdc/wdc-nvme.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
plugins/wdc/wdc-nvme.c +14 -3
@@ -126,6 +126,7 @@/* Capture Device Unit Info */ #define WDC_NVME_CAP_DUI_HEADER_SIZE 0x400#define WDC_NVME_CAP_DUI_OPCODE 0xFA +#define WDC_NVME_CAP_DUI_DISABLE_IO 0x01#define WDC_NVME_DUI_MAX_SECTION 0x3A#define WDC_NVME_DUI_MAX_DATA_AREA 0x05
@@ -1061,7 +1062,7 @@ static __u32 wdc_dump_length_e6(int fd, __u32 opcode, __u32 cdw10, __u32 cdw12,return ret; } -static __u32 wdc_dump_dui_data (int fd,__u32 dataLen,__u32 offset,__u8 *dump_data) +static __u32 wdc_dump_dui_data (int fd,__u32 dataLen,__u32 offset,__u8 *dump_data,bool last_xfer) {int ret;struct nvme_admin_cmd admin_cmd;
@@ -1073,6 +1074,11 @@ static __u32 wdc_dump_dui_data(int fd, __u32 dataLen, __u32 offset, __u8 *dump_d admin_cmd.data_len = dataLen; admin_cmd.cdw10 = ((dataLen >>2 ) -1 ); admin_cmd.cdw12 = offset; +if (last_xfer) + admin_cmd.cdw14 =0 ; +else + admin_cmd.cdw14 =WDC_NVME_CAP_DUI_DISABLE_IO ; + ret =nvme_submit_passthru (fd,NVME_IOCTL_ADMIN_CMD , &admin_cmd);if (ret !=0 ) {
@@ -1258,6 +1264,7 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area)__s32 log_size =0 ;__s32 total_size =0 ;int i; +bool last_xfer = false; log_hdr = (struct wdc_dui_log_hdr *)malloc (dui_log_hdr_size);if (log_hdr ==NULL ) {
@@ -1267,7 +1274,7 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area)memset (log_hdr,0 , dui_log_hdr_size);/* get the dui telemetry and log headers */ - ret =wdc_dump_dui_data (fd,WDC_NVME_CAP_DUI_HEADER_SIZE ,0x00 , (__u8 *)log_hdr); + ret =wdc_dump_dui_data (fd,WDC_NVME_CAP_DUI_HEADER_SIZE ,0x00 , (__u8 *)log_hdr, last_xfer);if (ret !=0 ) {fprintf (stderr,"%s: ERROR : WDC : Get DUI headers failed\n" , __func__);fprintf (stderr,"%s: ERROR : WDC : NVMe Status:%s(%x)\n" , __func__,nvme_status_to_string (ret), ret);
@@ -1312,8 +1319,12 @@ static int wdc_do_cap_dui(int fd, char *file, __u32 xfer_size, int data_area)for (; log_size >0 ; log_size -= xfer_size) { xfer_size =min (xfer_size, log_size); +if (log_size <= xfer_size) + last_xfer = true; + buffer_addr = (__u64 )(uintptr_t )dump_data + (__u64 )curr_data_offset; - ret =wdc_dump_dui_data (fd, xfer_size, curr_data_offset, (__u8 *)buffer_addr); + + ret =wdc_dump_dui_data (fd, xfer_size, curr_data_offset, (__u8 *)buffer_addr, last_xfer);if (ret !=0 ) {fprintf (stderr,"%s: ERROR : WDC : Get chunk %d, size = 0x%x, offset = 0x%x, addr = 0x%lx\n" , __func__, i, total_size, curr_data_offset, (long unsigned int )buffer_addr);
Signature · 1 line
1.8.3.1
Keith Busch
AppliedPATCH 1/1 Add Disable IO flag to wdc_dump_dui_data function
Quoted 1 line · Jeffrey Lien
Signed-off-by Jeff Lien <jeff.lien at wdc.com>
Applied, thanks.