Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mhvtl for openSUSE:Factory checked in at 2025-08-15 21:52:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mhvtl (Old) and /work/SRC/openSUSE:Factory/.mhvtl.new.1085 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mhvtl" Fri Aug 15 21:52:54 2025 rev:25 rq:1299853 version:1.72_release+13.928fc784016a Changes: -------- --- /work/SRC/openSUSE:Factory/mhvtl/mhvtl.changes 2025-06-05 20:37:39.929591683 +0200 +++ /work/SRC/openSUSE:Factory/.mhvtl.new.1085/mhvtl.changes 2025-08-15 21:54:38.538561546 +0200 @@ -1,0 +2,19 @@ +Wed Aug 13 20:07:38 UTC 2025 - ldun...@suse.com + +- Update to version 1.72_release+13.928fc784016a: + * vtltape: Add ability to define LBP RSCRC byte order + * mhvtl.ko: Update module version 0.18.36 will work with kernel 6.10+ + * kernel config: handle del_timer_sync() kABI rename + * Fix external declarations of crc32c() + * kernel config: put braces around debug stmnt + * kernel config: replace fgrep with grep -F + This removed these patches, as they are now upstream: + * 0001-kernel-config-replace-fgrep-with-grep-F.patch + * 0002-kernel-config-put-braces-around-debug-stmnt.patch + * 0003-Fix-external-declarations-of-crc32c.patch + * 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch + Also added and submitted upstream, to handle breakage in factory + with newer kernel: + * mhvtl-kernel-module-handle-rename-of-from_timer.patch + +------------------------------------------------------------------- Old: ---- 0001-kernel-config-replace-fgrep-with-grep-F.patch 0002-kernel-config-put-braces-around-debug-stmnt.patch 0003-Fix-external-declarations-of-crc32c.patch 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch mhvtl-1.72_release+6.a11b6777660b.tar.xz New: ---- mhvtl-1.72_release+13.928fc784016a.tar.xz mhvtl-kernel-module-handle-rename-of-from_timer.patch ----------(Old B)---------- Old: This removed these patches, as they are now upstream: * 0001-kernel-config-replace-fgrep-with-grep-F.patch * 0002-kernel-config-put-braces-around-debug-stmnt.patch Old: * 0001-kernel-config-replace-fgrep-with-grep-F.patch * 0002-kernel-config-put-braces-around-debug-stmnt.patch * 0003-Fix-external-declarations-of-crc32c.patch Old: * 0002-kernel-config-put-braces-around-debug-stmnt.patch * 0003-Fix-external-declarations-of-crc32c.patch * 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch Old: * 0003-Fix-external-declarations-of-crc32c.patch * 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch Also added and submitted upstream, to handle breakage in factory ----------(Old E)---------- ----------(New B)---------- New: with newer kernel: * mhvtl-kernel-module-handle-rename-of-from_timer.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mhvtl.spec ++++++ --- /var/tmp/diff_new_pack.tVDeO3/_old 2025-08-15 21:54:39.094584668 +0200 +++ /var/tmp/diff_new_pack.tVDeO3/_new 2025-08-15 21:54:39.098584833 +0200 @@ -26,7 +26,7 @@ Name: mhvtl URL: http://sites.google.com/site/linuxvtl2/ -Version: 1.72_release+6.a11b6777660b +Version: 1.72_release+13.928fc784016a Release: 0 Requires: mhvtl-kmp Requires: module-init-tools @@ -47,10 +47,7 @@ Group: System/Daemons Source: %{name}-%{version}.tar.xz Source2: %{name}.preamble -Patch1: 0001-kernel-config-replace-fgrep-with-grep-F.patch -Patch2: 0002-kernel-config-put-braces-around-debug-stmnt.patch -Patch3: 0003-Fix-external-declarations-of-crc32c.patch -Patch4: 0004-kernel-config-handle-del_timer_sync-kABI-rename.patch +Patch1: mhvtl-kernel-module-handle-rename-of-from_timer.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %{?systemd_ordering} ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.tVDeO3/_old 2025-08-15 21:54:39.138586497 +0200 +++ /var/tmp/diff_new_pack.tVDeO3/_new 2025-08-15 21:54:39.142586664 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/markh794/mhvtl.git</param> - <param name="changesrevision">a11b6777660b969318bd1b849203164fcbae3eca</param></service></servicedata> + <param name="changesrevision">928fc784016a8dd375a85dedcbee5356fe3a3ef2</param></service></servicedata> (No newline at EOF) ++++++ mhvtl-1.72_release+6.a11b6777660b.tar.xz -> mhvtl-1.72_release+13.928fc784016a.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/kernel/backport.h new/mhvtl-1.72_release+13.928fc784016a/kernel/backport.h --- old/mhvtl-1.72_release+6.a11b6777660b/kernel/backport.h 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/kernel/backport.h 2025-06-11 04:25:06.000000000 +0200 @@ -75,3 +75,7 @@ return len; } #endif + +#if !defined(USE_TIMER_DELETE_NOT_DEL_TIMER) +#define timer_delete_sync del_timer_sync +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/kernel/config.sh new/mhvtl-1.72_release+13.928fc784016a/kernel/config.sh --- old/mhvtl-1.72_release+6.a11b6777660b/kernel/config.sh 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/kernel/config.sh 2025-06-11 04:25:06.000000000 +0200 @@ -121,7 +121,7 @@ # check if scsi_host_template argument to scsi_host_alloc # is const # -if fgrep -q 'extern struct Scsi_Host *scsi_host_alloc(const' \ +if grep -F -q 'extern struct Scsi_Host *scsi_host_alloc(const' \ "${hdrs}/scsi/scsi_host.h"; then # the first argument to scsi_host_alloc needs to be a "const" echo "#ifndef DEFINE_CONST_STRUCT_SCSI_HOST_TEMPLATE" @@ -146,7 +146,7 @@ # Now check for the 2nd argument needs a "const" if [ -r "$bus_type_def_file" ] && - fgrep -q "$pat" "$bus_type_def_file"; then + grep -F -q "$pat" "$bus_type_def_file"; then # the second argument needs a "const" definition echo "#ifndef DEFINE_CONST_STRUCT_DEVICE_DRIVER" echo "#define DEFINE_CONST_STRUCT_DEVICE_DRIVER" @@ -159,7 +159,7 @@ # check if slave_configure has been renamed to sdev_configure # pat='int (* sdev_configure)(struct scsi_device *, struct queue_limits *lim);' -if fgrep -q "$pat" "${hdrs}/scsi/scsi_host.h"; then +if grep -F -q "$pat" "${hdrs}/scsi/scsi_host.h"; then echo "#ifndef DEFINE_QUEUE_LIMITS_SCSI_DEV_CONFIGURE" echo "#define DEFINE_QUEUE_LIMITS_SCSI_DEV_CONFIGURE" echo "#endif" @@ -167,4 +167,15 @@ echo "#undef DEFINE_QUEUE_LIMITS_SCSI_DEV_CONFIGURE" fi >> "${output}" +# +# check if del_timer_sync() has been renamed to timer_delete() +# +if grep -F -q 'int timer_delete_sync(' "${hdrs}/linux/timer.h"; then + echo "#ifndef USE_TIMER_DELETE_NOT_DEL_TIMER" + echo "#define USE_TIMER_DELETE_NOT_DEL_TIMER" + echo "#endif" +else + echo "#undef USE_TIMER_DELETE_NOT_DEL_TIMER" +fi >> "${output}" + printf '\n\n#endif /* _MHVTL_KERNEL_CONFIG_H */\n' >> "${output}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/kernel/mhvtl.c new/mhvtl-1.72_release+13.928fc784016a/kernel/mhvtl.c --- old/mhvtl-1.72_release+6.a11b6777660b/kernel/mhvtl.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/kernel/mhvtl.c 2025-06-11 04:25:06.000000000 +0200 @@ -104,9 +104,9 @@ #define VTL_VERSION "1.75" */ #ifndef MHVTL_VERSION -#define MHVTL_VERSION "0.18.35" +#define MHVTL_VERSION "0.18.36" #endif -static const char *mhvtl_version_date = "20250512-0"; +static const char *mhvtl_version_date = "20250611-0"; static const char mhvtl_driver_name[] = "mhvtl"; /* Additional Sense Code (ASC) used */ @@ -597,8 +597,9 @@ if (done == NULL) return 0; /* assume mid level reprocessing command */ - if (cmd) + if (cmd) { MHVTL_DBG_PRT_CDB(1, serial_number, cmd, SCpnt->cmd_len); + } if (SCpnt->device->id == mhvtl_driver_template.this_id) { pr_err("initiator's id used as target!\n"); @@ -1001,7 +1002,7 @@ spin_lock_irqsave(&lu->cmd_list_lock, iflags); list_for_each_entry_safe(sqcp, n, &lu->cmd_list, queued_sibling) { if (sqcp->state && (SCpnt == sqcp->a_cmnd)) { - del_timer_sync(&sqcp->cmnd_timer); + timer_delete_sync(&sqcp->cmnd_timer); sqcp->state = CMD_STATE_FREE; sqcp->a_cmnd = NULL; found = 1; @@ -1030,7 +1031,7 @@ list_for_each_entry_safe(sqcp, n, &lu->cmd_list, queued_sibling) { if (sqcp->state && sqcp->a_cmnd) { - del_timer_sync(&sqcp->cmnd_timer); + timer_delete_sync(&sqcp->cmnd_timer); sqcp->state = CMD_STATE_FREE; sqcp->a_cmnd = NULL; __mhvtl_remove_sqcp(sqcp); @@ -1598,9 +1599,10 @@ s[2], s[12], s[13]); - } else + } else { sqcp->a_cmnd->result = DID_OK << 16; - del_timer_sync(&sqcp->cmnd_timer); + } + timer_delete_sync(&sqcp->cmnd_timer); if (sqcp->done_funct) sqcp->done_funct(sqcp->a_cmnd); else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/usr/mhvtl_io.c new/mhvtl-1.72_release+13.928fc784016a/usr/mhvtl_io.c --- old/mhvtl-1.72_release+6.a11b6777660b/usr/mhvtl_io.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/usr/mhvtl_io.c 2025-06-11 04:25:06.000000000 +0200 @@ -41,11 +41,14 @@ extern int verbose; extern int debug; extern long my_id; +extern int lbp_rscrc_be; extern struct priv_lu_ssc lu_ssc; extern struct lu_phy_attr lunit; extern struct encryption app_encryption_state; uint32_t GenerateRSCRC(uint32_t crc, uint32_t size, const void *buf); +uint32_t BlockVerifyRSCRC(const uint8_t *blkbuf, uint32_t blklen, int32_t bigendian); +uint32_t BlockProtectRSCRC(uint8_t *blkbuf, uint32_t blklen, int32_t bigendian); static void mk_sense_short_block(uint32_t requested, uint32_t processed, uint8_t *sense_valid) @@ -135,8 +138,7 @@ goto complete; break; case LZO_E_INPUT_NOT_CONSUMED: - MHVTL_DBG(1, "The end of compressed block has been detected before all %d bytes", - blk_size); + MHVTL_DBG(1, "The end of compressed block has been detected before all %d bytes", blk_size); break; case LZO_E_INPUT_OVERRUN: MHVTL_ERR("The decompressor requested more bytes from the compressed block"); @@ -253,13 +255,6 @@ return rc; } -/* Reed-Solomon CRC */ -static uint32_t mhvtl_rscrc(unsigned char const *buf, size_t size) -{ -/* return ~GenerateRSCRC(0xffffffff, size, buf); */ - return GenerateRSCRC(0, size, buf); -} - /* CRC32C */ static uint32_t mhvtl_crc32c(unsigned char const *buf, size_t size) { @@ -272,7 +267,7 @@ */ int readBlock(uint8_t *buf, uint32_t request_sz, int sili, int lbp_method, uint8_t *sam_stat) { - uint32_t disk_blk_size, blk_size; + uint32_t disk_blk_size, blk_size, blk_number; uint32_t rc; uint32_t save_sense; uint32_t pre_crc; @@ -327,6 +322,7 @@ the read causes the tape block to advance. */ blk_size = c_pos->blk_size; + blk_number = c_pos->blk_number; disk_blk_size = c_pos->disk_blk_size; pre_crc = c_pos->uncomp_crc; blk_flags = c_pos->blk_flags; @@ -376,11 +372,11 @@ /* Update Logical Block Protection CRC */ switch (lbp_method) { case 1: - lbp_crc = mhvtl_rscrc(bounce_buffer, rc); - put_unaligned_be32(lbp_crc, &bounce_buffer[rc]); - MHVTL_DBG(2, "Logical Block Protection - Reed-Solomon CRC, rc: %d, request_sz: %d, lbp_size: %d, RS-CRC: 0x%08x", - rc, request_sz, lbp_sz, lbp_crc); - rc += 4; /* Account for LBP checksum */ + rc = BlockProtectRSCRC(bounce_buffer, rc, lbp_rscrc_be); + if (rc == 0) { + MHVTL_ERR("Failed to generate/append RSCRC: lbp_be: %d", lbp_rscrc_be); + } + MHVTL_DBG(2, "READ block %d LBP RSCRC : 0x%02x 0x%02x 0x%02x 0x%02x", blk_number, bounce_buffer[rc - 4], bounce_buffer[rc - 3], bounce_buffer[rc - 2], bounce_buffer[rc - 1]); break; case 2: MHVTL_DBG(2, "rc: %d, request_sz: %d bounce buffer before LBP: 0x%08x %08x", rc, request_sz, get_unaligned_be32(&bounce_buffer[rc - 4]), get_unaligned_be32(&bounce_buffer[rc])); @@ -389,6 +385,7 @@ memcpy(&bounce_buffer[rc], &lbp_crc, 4); MHVTL_DBG(2, "Logical Block Protection - CRC32C, rc: %d, request_sz: %d, lbp_size: %d, CRC32C: 0x%8x", rc, request_sz, lbp_sz, lbp_crc); MHVTL_DBG(2, "rc: %d, request_sz: %d bounce buffer after LBP: 0x%08x %08x", rc, request_sz, get_unaligned_be32(&bounce_buffer[rc - 4]), get_unaligned_be32(&bounce_buffer[rc])); + MHVTL_DBG(2, "READ block %d LBP RSCRC : 0x%02x 0x%02x 0x%02x 0x%02x", blk_number, bounce_buffer[rc], bounce_buffer[rc + 1], bounce_buffer[rc + 2], bounce_buffer[rc + 3]); rc += 4; /* Account for LBP checksum */ break; case 3: @@ -480,7 +477,7 @@ ** ** Return -1 on error or 0 on success (LBP CRC match) */ -static int32_t get_lbp_crc(int lbp_method, unsigned char const *buf, size_t src_sz, uint32_t crc32c) +static int32_t verify_lbp_crc(int lbp_method, unsigned char const *buf, size_t src_sz, uint32_t crc32c) { uint32_t lbp_crc = 0; @@ -488,20 +485,21 @@ case 0: /* No method defined - skip check */ break; case 1: - MHVTL_DBG(1, "Reed-Solomon CRC check"); - lbp_crc = mhvtl_rscrc(buf, src_sz); - if (lbp_crc != get_unaligned_be32(&buf[src_sz])) { - MHVTL_ERR("Reed-Solomon CRC mismatch - LBP: 0x%08x, calculated: 0x%08x", - get_unaligned_be32(&buf[src_sz]), lbp_crc); + MHVTL_DBG(2, "WRITE block %d LBP RSCRC : 0x%02x 0x%02x 0x%02x 0x%02x", c_pos->blk_number - 1, buf[src_sz], buf[src_sz + 1], buf[src_sz + 2], buf[src_sz + 3]); + if (!BlockVerifyRSCRC(buf, src_sz + 4, lbp_rscrc_be)) { + if (lbp_rscrc_be) { + MHVTL_ERR("RSCRC mismatch: lbp_be: %d - LBP provided: 0x%08x, calculated RSCRC: 0x%08x", lbp_rscrc_be, get_unaligned_be32(&buf[src_sz]), GenerateRSCRC(0, src_sz, buf)); + } else { + MHVTL_ERR("RSCRC mismatch: lbp_be: %d - LBP provided: 0x%08x, calculated RSCRC: 0x%08x", lbp_rscrc_be, get_unaligned_be32(&buf[src_sz]), __bswap_32(GenerateRSCRC(0, src_sz, buf))); + } return -1; /* CRC mismatch */ } break; case 2: - MHVTL_DBG(1, "CRC32C check"); + MHVTL_DBG(2, "WRITE block %d LBP CRC32C : 0x%02x 0x%02x 0x%02x 0x%02x", c_pos->blk_number - 1, buf[src_sz], buf[src_sz + 1], buf[src_sz + 2], buf[src_sz + 3]); lbp_crc = get_unaligned_be32(&crc32c); if (lbp_crc != get_unaligned_be32(&buf[src_sz])) { - MHVTL_ERR("CRC32C mismatch - LBP: 0x%08x, calculated: 0x%08x", - get_unaligned_be32(&buf[src_sz]), lbp_crc); + MHVTL_ERR("CRC32C mismatch - LBP: 0x%08x, calculated: 0x%08x", get_unaligned_be32(&buf[src_sz]), lbp_crc); return -1; /* CRC mismatch */ } break; @@ -537,6 +535,21 @@ } } +static void log_lbp_method(int lbp_method) +{ + switch(lbp_method) { + case 1: + MHVTL_DBG(2, "Drive supports RS-CRC Logical Block Protection, lbp_be: %d", lbp_rscrc_be); + break; + case 2: + MHVTL_DBG(2, "Drive supports RS-CRC and CRC32C Logical Block Protection"); + break; + default: + MHVTL_DBG(2, "Drive supports Logical Block Protection (LBP) but unsupported LBP method provided: %d", lbp_method); + break; + } +} + /* * Return number of bytes written to 'file' * @@ -558,8 +571,8 @@ rc = write_tape_block(src_buf, src_sz, 0, lu_priv->app_encr_info, 0, null_wr, crc, sam_stat); if (lu_priv->pm->drive_supports_LBP && lbp_method) { - MHVTL_DBG(1, "Drive supports Logical Block Protection and LBP method: %d", lbp_method); - if (get_lbp_crc(lbp_method, src_buf, src_sz, crc)) { + log_lbp_method(lbp_method); + if (verify_lbp_crc(lbp_method, src_buf, src_sz, crc) < 0) { MHVTL_ERR("LBP mis-compare on write : Returning E_LOGICAL_BLOCK_GUARD_FAILED"); sam_hardware_error(E_LOGICAL_BLOCK_GUARD_FAILED, sam_stat); log_crc_options(lbp_method, src_buf, src_sz, crc); @@ -627,8 +640,7 @@ return 0; } - MHVTL_DBG(2, "Compression: Orig %d, after comp: %ld", - src_sz, (unsigned long)dest_len); + MHVTL_DBG(2, "Compression: Orig %d, after comp: %ld", src_sz, (unsigned long)dest_len); rc = write_tape_block(dest_buf, src_len, dest_len, lu_priv->app_encr_info, LZO, null_wr, crc, sam_stat); @@ -638,9 +650,9 @@ lu_priv->bytesWritten_I += src_len; if (lu_priv->pm->drive_supports_LBP && lbp_method) { - MHVTL_DBG(1, "Drive supports Logical Block Protection and LBP method: %d", lbp_method); - if (get_lbp_crc(lbp_method, src_buf, src_sz, crc)) { - MHVTL_ERR("LBP mis-compare on write : Returning E_LOGICAL_BLOCK_GUARD_FAILED"); + log_lbp_method(lbp_method); + if (verify_lbp_crc(lbp_method, src_buf, src_sz, crc) < 0) { + MHVTL_ERR("LBP mis-compare on write : Returning E_LOGICAL_BLOCK_GUARD_FAILED - but wrote block anyway..."); sam_hardware_error(E_LOGICAL_BLOCK_GUARD_FAILED, sam_stat); log_crc_options(lbp_method, src_buf, src_sz, crc); return 0; @@ -713,8 +725,8 @@ lu_priv->bytesWritten_I += src_len; if (lu_priv->pm->drive_supports_LBP && lbp_method) { - MHVTL_DBG(1, "Drive supports Logical Block Protection and LBP method: %d", lbp_method); - if (get_lbp_crc(lbp_method, src_buf, src_sz, crc)) { + log_lbp_method(lbp_method); + if (verify_lbp_crc(lbp_method, src_buf, src_sz, crc) < 0) { MHVTL_ERR("LBP mis-compare on write : Returning E_LOGICAL_BLOCK_GUARD_FAILED"); sam_hardware_error(E_LOGICAL_BLOCK_GUARD_FAILED, sam_stat); log_crc_options(lbp_method, src_buf, src_sz, crc); @@ -743,7 +755,7 @@ if (lu_priv->pm->drive_supports_LBP) { if (lu_priv->LBP_W) { - MHVTL_DBG(1, "Write using LBP (CRC: %s)", + MHVTL_DBG(2, "Write using LBP (CRC: %s)", (lu_priv->LBP_method == 0) ? "Off" : (lu_priv->LBP_method == 1) ? "RS-CRC" : (lu_priv->LBP_method == 2) ? "CRC32C" : "Invalid"); @@ -776,7 +788,7 @@ src_len = writeBlock_nocomp(cmd, lbp_sz, TRUE, 0); } else if (*lu_priv->compressionFactor == MHVTL_NO_COMPRESSION) { /* No compression - use the no-compression function */ - return writeBlock_nocomp(cmd, lbp_sz, FALSE, lbp_method); + src_len = writeBlock_nocomp(cmd, lbp_sz, FALSE, lbp_method); } else { switch (lu_priv->compressionType) { case LZO: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/usr/reed-solomon.c new/mhvtl-1.72_release+13.928fc784016a/usr/reed-solomon.c --- old/mhvtl-1.72_release+6.a11b6777660b/usr/reed-solomon.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/usr/reed-solomon.c 2025-06-11 04:25:06.000000000 +0200 @@ -5,6 +5,7 @@ */ #include <inttypes.h> +#include <byteswap.h> /*---------------------------------------------------------------------------- ** ABSTRACT: function to compute interim LBP CRC @@ -76,19 +77,27 @@ ** ABSTRACT: function to compute and append LBP CRC to a data block ** INPUTS: blkbuf - starting address of the data block to protect ** blklen - length of block to protect (NOT including CRC) + ** bigendian - Check CRC in big/little endian ** OUTPUTS: uint32_t - length of protected block (to write) including LBP CRC */ -uint32_t BlockProtectRSCRC(uint8_t *blkbuf, uint32_t blklen) +uint32_t BlockProtectRSCRC(uint8_t *blkbuf, uint32_t blklen, int32_t bigendian) { uint32_t crc = GenerateRSCRC(0x00000000, blklen, blkbuf); if (blklen == 0) return 0; /* no such thing as a zero length block in SSC (write NOP) */ + if (bigendian) { /* append CRC in proper byte order (regardless of system endian-ness) */ - blkbuf[blklen+0] = (crc >> 24) & 0xFF; - blkbuf[blklen+1] = (crc >> 16) & 0xFF; - blkbuf[blklen+2] = (crc >> 8) & 0xFF; - blkbuf[blklen+3] = (crc >> 0) & 0xFF; + blkbuf[blklen+0] = (crc >> 24) & 0xFF; + blkbuf[blklen+1] = (crc >> 16) & 0xFF; + blkbuf[blklen+2] = (crc >> 8) & 0xFF; + blkbuf[blklen+3] = (crc >> 0) & 0xFF; + } else { + blkbuf[blklen+0] = (crc >> 0) & 0xFF; + blkbuf[blklen+1] = (crc >> 8) & 0xFF; + blkbuf[blklen+2] = (crc >> 16) & 0xFF; + blkbuf[blklen+3] = (crc >> 24) & 0xFF; + } return (blklen+4); /* size of block to be written includes CRC */ } @@ -96,28 +105,32 @@ ** ABSTRACT: function to verify block with LBP CRC ** INPUTS: blkbuf - starting address of the data block to protect ** blklen - length of block to verify (INCLUDING CRC) + ** bigendian - Check CRC in big/little endian ** OUTPUTS: uint32_t - length of block w/o CRC (0 if verify failed) */ -uint32_t BlockVerifyRSCRC(const uint8_t *blkbuf, uint32_t blklen) +uint32_t BlockVerifyRSCRC(const uint8_t *blkbuf, uint32_t blklen, int32_t bigendian) { if (blklen <= 4) - return 0; /* block is too small to be valid, cannot check CRC */ + return 0; /* block is too small to be valid, cannot check CRC */ blklen -= 4; /* user data portion does not include CRC */ -#if 1 /* method 1: calculate CRC on data only and compare against CRC from block */ - { - uint32_t crccmp = GenerateRSCRC(0x00000000, blklen, blkbuf); + uint32_t crccmp; uint32_t crcblk; + /* this matches the append method in the function above */ crcblk = (blkbuf[blklen+0] << 24) | - (blkbuf[blklen+1] << 16) | - (blkbuf[blklen+2] << 8) | - (blkbuf[blklen+3] << 0); + (blkbuf[blklen+1] << 16) | + (blkbuf[blklen+2] << 8) | + (blkbuf[blklen+3] << 0); + if (bigendian) { + crccmp = GenerateRSCRC(0x00000000, blklen, blkbuf); + } else { + crccmp = __bswap_32(GenerateRSCRC(0x00000000, blklen, blkbuf)); + } if (crccmp != crcblk) return 0; /* block CRC is incorrect */ return(blklen); - } -#endif + #if 2 /* method 2: calculate including CRC and check magic constant */ { if (GenerateRSCRC(0x00000000, blklen+4, blkbuf) != 0x00000000) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/usr/ssc.c new/mhvtl-1.72_release+13.928fc784016a/usr/ssc.c --- old/mhvtl-1.72_release+6.a11b6777660b/usr/ssc.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/usr/ssc.c 2025-06-11 04:25:06.000000000 +0200 @@ -2332,7 +2332,7 @@ } uint32_t GenerateRSCRC(uint32_t seed, int sz, const uint8_t *buf); -uint32_t crc32c(uint32_t seed, const uint8_t *buf, int sz); +uint32_t crc32c(uint32_t seed, const uint8_t *buf, size_t sz); uint8_t ssc_send_diagnostics(struct scsi_cmd *cmd) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/usr/tape_util.c new/mhvtl-1.72_release+13.928fc784016a/usr/tape_util.c --- old/mhvtl-1.72_release+6.a11b6777660b/usr/tape_util.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/usr/tape_util.c 2025-06-11 04:25:06.000000000 +0200 @@ -50,6 +50,7 @@ int verbose = 0; int debug = 0; long my_id = 0; +int lbp_rscrc_be = 1; /* Return RS-CRC in BigEndian format */ int lib_id; struct priv_lu_ssc lu_ssc; struct lu_phy_attr lunit; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/usr/validate_crc.c new/mhvtl-1.72_release+13.928fc784016a/usr/validate_crc.c --- old/mhvtl-1.72_release+6.a11b6777660b/usr/validate_crc.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/usr/validate_crc.c 2025-06-11 04:25:06.000000000 +0200 @@ -13,7 +13,7 @@ #include <assert.h> #include <inttypes.h> -uint32_t crc32c(uint32_t seed, const uint8_t *buf, int sz); +uint32_t crc32c(uint32_t seed, const uint8_t *buf, size_t sz); uint32_t GenerateRSCRC(uint32_t seed, int sz, const uint8_t *buf); int main(int argc, char *argv[]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mhvtl-1.72_release+6.a11b6777660b/usr/vtltape.c new/mhvtl-1.72_release+13.928fc784016a/usr/vtltape.c --- old/mhvtl-1.72_release+6.a11b6777660b/usr/vtltape.c 2025-05-29 03:09:36.000000000 +0200 +++ new/mhvtl-1.72_release+13.928fc784016a/usr/vtltape.c 2025-06-11 04:25:06.000000000 +0200 @@ -130,6 +130,9 @@ * and call usleep() before polling again. */ long backoff; + +int lbp_rscrc_be; /* Logical Block Protection: RS-CRC big-endian */ + static useconds_t cumul_pollInterval; int library_id = 0; @@ -2216,6 +2219,7 @@ lu->ptype = TYPE_TAPE; backoff = DEFLT_BACKOFF_VALUE; + lbp_rscrc_be = 1; /* Default RSCRC is big-endian */ lu->sense_p = &sense[0]; @@ -2299,6 +2303,9 @@ if (sscanf(b, " Library ID: %d", &library_id)) { MHVTL_DBG(2, "Library ID: %d", library_id); } + if (sscanf(b, " LBP RSCRC BE: %d", &lbp_rscrc_be)) { + MHVTL_DBG(2, "Logical Block Protection RSCRC: %d", lbp_rscrc_be); + } if (sscanf(b, " Backoff: %d", &i)) { if ((i > 1) && (i < 10000)) { MHVTL_DBG(1, "Backoff value: %d", i); ++++++ mhvtl-kernel-module-handle-rename-of-from_timer.patch ++++++ >From 27f03b01360050d3d95997fa70e845a949d5153c Mon Sep 17 00:00:00 2001 From: Lee Duncan <ldun...@suse.com> Date: Wed, 13 Aug 2025 11:03:40 -0700 Subject: [PATCH] kernel module: handle rename of from_timer() This is a 6.16 kernel change, from "from_timer()" to "timer_container_of()" in timer.h. --- kernel/config.sh | 11 +++++++++++ kernel/mhvtl.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/kernel/config.sh b/kernel/config.sh index 2c9da68d6eb6..a0a95cf25d45 100755 --- a/kernel/config.sh +++ b/kernel/config.sh @@ -178,4 +178,15 @@ else echo "#undef USE_TIMER_DELETE_NOT_DEL_TIMER" fi >> "${output}" +# +# has "from_timer()" been renamed to "timer_container_of()"? +# +if grep -F -q 'timer_container_of(' "${hdrs}/linux/timer.h"; then + echo "#ifndef FROM_TIMER_NOW_TIMER_CONTAINER_OF" + echo "#define FROM_TIMER_NOW_TIMER_CONTAINER_OF" + echo "#endif" +else + echo "#undef FROM_TIMER_NOW_TIMER_CONTAINER_OF" +fi >> "${output}" + printf '\n\n#endif /* _MHVTL_KERNEL_CONFIG_H */\n' >> "${output}" diff --git a/kernel/mhvtl.c b/kernel/mhvtl.c index 5c7efdc35036..eb94db9b4836 100644 --- a/kernel/mhvtl.c +++ b/kernel/mhvtl.c @@ -791,7 +791,12 @@ static void mhvtl_remove_sqcp(struct mhvtl_lu_info *lu, struct mhvtl_queued_cmd #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) static void mhvtl_timer_intr_handler(struct timer_list *t) { +#ifdef FROM_TIMER_NOW_TIMER_CONTAINER_OF + struct mhvtl_queued_cmd *sqcp = timer_container_of(sqcp, t, + cmnd_timer); +#else struct mhvtl_queued_cmd *sqcp = from_timer(sqcp, t, cmnd_timer); +#endif unsigned long long indx = sqcp->serial_number; #else static void mhvtl_timer_intr_handler(unsigned long indx) -- 2.50.1