diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2019-06-18 15:53:19 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2019-06-18 15:53:19 +0000 |
commit | 9546b77d7682770d4b8b334c2ac737adf5955b1b (patch) | |
tree | f6a4ad3120982c41ac71a0e8e23724a75399dad4 | |
parent | 3dfb85f55d1cfbff0ae4658395471b9dc3b0a0d4 (diff) | |
download | sg3_utils-9546b77d7682770d4b8b334c2ac737adf5955b1b.tar.gz |
testing tweaks assocaied with sg v4 driver testing
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@826 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | testing/sg_tst_async.cpp | 17 | ||||
-rw-r--r-- | testing/sgh_dd.cpp | 16 |
3 files changed, 24 insertions, 11 deletions
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and some description at the top of its ".c" file. All utilities in the main directory have their own "man" pages. There is also a sg3_utils man page. -Changelog for sg3_utils-1.45 [20190612] [svn: r825] +Changelog for sg3_utils-1.45 [20190618] [svn: r826] - sg_ses: bug: --page= being overridden when --control and --data= also given; fix - document explicit Element type codes and example diff --git a/testing/sg_tst_async.cpp b/testing/sg_tst_async.cpp index 150abea9..bfc14eb1 100644 --- a/testing/sg_tst_async.cpp +++ b/testing/sg_tst_async.cpp @@ -89,7 +89,7 @@ #include "sg_pt.h" #include "sg_cmds.h" -static const char * version_str = "1.35 20190612"; +static const char * version_str = "1.36 20190613"; static const char * util_name = "sg_tst_async"; /* This is a test program for checking the async usage of the Linux sg @@ -1153,7 +1153,8 @@ work_thread(int id, struct opts_t * op) } if (vb && ! once1000 && num_outstanding >= 1000) { int num_waiting; - int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : -1; + int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : + pi2buff.size(); once1000 = true; if (ioctl(sg_fd, SG_GET_NUM_WAITING, &num_waiting) < 0) { @@ -1167,7 +1168,8 @@ work_thread(int id, struct opts_t * op) } if (vb && ! once5000 && num_outstanding >= 5000) { int num_waiting; - int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : -1; + int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : + pi2buff.size(); once5000 = true; if (ioctl(sg_fd, SG_GET_NUM_WAITING, &num_waiting) < 0) { @@ -1180,7 +1182,8 @@ work_thread(int id, struct opts_t * op) } if (vb && ! once_7000 && num_outstanding >= 7000) { int num_waiting; - int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : -1; + int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : + pi2buff.size(); once_7000 = true; if (ioctl(sg_fd, SG_GET_NUM_WAITING, &num_waiting) < 0) { @@ -1193,7 +1196,8 @@ work_thread(int id, struct opts_t * op) } if (vb && ! once10_000 && num_outstanding >= 10000) { int num_waiting; - int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : -1; + int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : + pi2buff.size(); once10_000 = true; if (ioctl(sg_fd, SG_GET_NUM_WAITING, &num_waiting) < 0) { @@ -1206,7 +1210,8 @@ work_thread(int id, struct opts_t * op) } if (vb && ! once20_000 && num_outstanding >= 20000) { int num_waiting; - int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : -1; + int num_subm = (op->sg_vn_ge_40030) ? num_submitted(sg_fd) : + pi2buff.size(); once20_000 = true; if (ioctl(sg_fd, SG_GET_NUM_WAITING, &num_waiting) < 0) { diff --git a/testing/sgh_dd.cpp b/testing/sgh_dd.cpp index 2de7bbaa..f0669b1a 100644 --- a/testing/sgh_dd.cpp +++ b/testing/sgh_dd.cpp @@ -103,7 +103,7 @@ using namespace std; -static const char * version_str = "1.33 20190612"; +static const char * version_str = "1.34 20190613"; #ifdef __GNUC__ #ifndef __clang__ @@ -309,6 +309,7 @@ static pthread_mutex_t strerr_mut = PTHREAD_MUTEX_INITIALIZER; static bool have_sg_version = false; static int sg_version = 0; static bool sg_version_lt_4 = false; +static bool sg_version_ge_40030 = false; static bool shutting_down = false; static bool do_sync = false; static bool do_time = true; @@ -1047,7 +1048,8 @@ read_write_thread(void * v_tip) if (vb > 4) pr2serr_lk("thread=%d: Skipping share on both IFILE and OFILE\n", rep->id); - } else if ((FT_SG == clp->in_type) && (FT_SG == clp->out_type)) + } else if (sg_version_ge_40030 && (FT_SG == clp->in_type) && + (FT_SG == clp->out_type)) rep->has_share = sg_share_prepare(rep->outfd, rep->infd, rep->id, rep->debug > 9); if (vb > 9) @@ -2223,6 +2225,8 @@ sg_prepare_resbuf(int fd, int bs, int bpt, bool def_res, int elem_sz, } goto fini; } + if (! sg_version_ge_40030) + goto bypass; if (elem_sz >= 4096) { memset(seip, 0, sizeof(*seip)); seip->sei_rd_mask |= SG_SEIM_SGAT_ELEM_SZ; @@ -2245,7 +2249,8 @@ sg_prepare_resbuf(int fd, int bs, int bpt, bool def_res, int elem_sz, pr2serr_lk("sgh_dd: %s: SG_SET_GET_EXTENDED(SGAT_ELEM_SZ) " "wr error: %s\n", __func__, strerror(errno)); } - } else if (no_dur || masync) { + } + if (no_dur || masync) { memset(seip, 0, sizeof(*seip)); seip->sei_wr_mask |= SG_SEIM_CTL_FLAGS; if (no_dur) { @@ -2261,6 +2266,7 @@ sg_prepare_resbuf(int fd, int bs, int bpt, bool def_res, int elem_sz, pr2serr_lk("sgh_dd: %s: SG_SET_GET_EXTENDED(NO_DURATION) " "error: %s\n", __func__, strerror(errno)); } +bypass: if (! def_res) { num = bs * bpt; res = ioctl(fd, SG_SET_RESERVED_SIZE, &num); @@ -2280,7 +2286,7 @@ sg_prepare_resbuf(int fd, int bs, int bpt, bool def_res, int elem_sz, res = ioctl(fd, SG_SET_FORCE_PACK_ID, &t); if (res < 0) perror("sgh_dd: SG_SET_FORCE_PACK_ID error"); - if (unit_nano) { + if (unit_nano && sg_version_ge_40030) { memset(seip, 0, sizeof(*seip)); seip->sei_wr_mask |= SG_SEIM_CTL_FLAGS; seip->ctl_flags_wr_mask |= SG_CTL_FLAGM_TIME_IN_NS; @@ -2495,6 +2501,8 @@ main(int argc, char * argv[]) if (sg_version > 40000) { clp->in_flags.v4 = true; clp->out_flags.v4 = true; + if (sg_version >= 40030) + sg_version_ge_40030 = true; } for (k = 1; k < argc; k++) { |