diff mbox series

[v2,4/5] scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI

Message ID 20210806040023.5355-5-martin.petersen@oracle.com (mailing list archive)
State Changes Requested
Headers show
Series [v2,1/5] scsi: core: Add helper to return number of logical blocks in a request | expand

Commit Message

Martin K. Petersen Aug. 6, 2021, 4 a.m. UTC
Use the SCSI midlayer interfaces to query protection interval, reference
tag, and per-command DIX flags.

Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

Comments

kernel test robot Aug. 7, 2021, 3:43 a.m. UTC | #1
Hi "Martin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[also build test WARNING on mkp-scsi/for-next next-20210806]
[cannot apply to v5.14-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Martin-K-Petersen/scsi-core-Add-helper-to-return-number-of-logical-blocks-in-a-request/20210806-130031
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: arm64-randconfig-s032-20210806 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 10.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-348-gf0e6938b-dirty
        # https://github.com/0day-ci/linux/commit/953afbb2ac9054f86b27ff634dbaf8311e27b6aa
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Martin-K-Petersen/scsi-core-Add-helper-to-return-number-of-logical-blocks-in-a-request/20210806-130031
        git checkout 953afbb2ac9054f86b27ff634dbaf8311e27b6aa
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/mpt3sas/mpt3sas_scsih.c:5075:39: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] EEDPBlockSize @@     got unsigned int @@
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:5075:39: sparse:     expected restricted __le16 [usertype] EEDPBlockSize
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:5075:39: sparse:     got unsigned int
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:10843:25: sparse: sparse: cast to restricted __le32
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:10843:25: sparse: sparse: cast to restricted __le32
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:10843:25: sparse: sparse: cast to restricted __le32
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:10843:25: sparse: sparse: cast to restricted __le32
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:10843:25: sparse: sparse: cast to restricted __le32
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:10843:25: sparse: sparse: cast to restricted __le32

vim +5075 drivers/scsi/mpt3sas/mpt3sas_scsih.c

  5036	
  5037	/**
  5038	 * _scsih_setup_eedp - setup MPI request for EEDP transfer
  5039	 * @ioc: per adapter object
  5040	 * @scmd: pointer to scsi command object
  5041	 * @mpi_request: pointer to the SCSI_IO request message frame
  5042	 *
  5043	 * Supporting protection 1 and 3.
  5044	 */
  5045	static void
  5046	_scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
  5047		Mpi25SCSIIORequest_t *mpi_request)
  5048	{
  5049		u16 eedp_flags;
  5050		unsigned char prot_op = scsi_get_prot_op(scmd);
  5051		unsigned char prot_type = scsi_get_prot_type(scmd);
  5052		Mpi25SCSIIORequest_t *mpi_request_3v =
  5053		   (Mpi25SCSIIORequest_t *)mpi_request;
  5054	
  5055		if (prot_type == SCSI_PROT_DIF_TYPE0 || prot_op == SCSI_PROT_NORMAL)
  5056			return;
  5057	
  5058		if (prot_op ==  SCSI_PROT_READ_STRIP)
  5059			eedp_flags = MPI2_SCSIIO_EEDPFLAGS_CHECK_REMOVE_OP;
  5060		else if (prot_op ==  SCSI_PROT_WRITE_INSERT)
  5061			eedp_flags = MPI2_SCSIIO_EEDPFLAGS_INSERT_OP;
  5062		else
  5063			return;
  5064	
  5065		if (scmd->prot_op & SCSI_PROT_GUARD_CHECK)
  5066			eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
  5067	
  5068		if (scmd->prot_op & SCSI_PROT_REF_CHECK) {
  5069			eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
  5070				MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
  5071			mpi_request->CDB.EEDP32.PrimaryReferenceTag =
  5072				cpu_to_be32(scsi_prot_ref_tag(scmd));
  5073		}
  5074	
> 5075		mpi_request_3v->EEDPBlockSize = scsi_prot_interval(scmd);
  5076	
  5077		if (ioc->is_gen35_ioc)
  5078			eedp_flags |= MPI25_SCSIIO_EEDPFLAGS_APPTAG_DISABLE_MODE;
  5079		mpi_request->EEDPFlags = cpu_to_le16(eedp_flags);
  5080	}
  5081	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 866d118f7931..a66cea57fa96 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -5062,33 +5062,17 @@  _scsih_setup_eedp(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
 	else
 		return;
 
-	switch (prot_type) {
-	case SCSI_PROT_DIF_TYPE1:
-	case SCSI_PROT_DIF_TYPE2:
+	if (scmd->prot_op & SCSI_PROT_GUARD_CHECK)
+		eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
 
-		/*
-		* enable ref/guard checking
-		* auto increment ref tag
-		*/
+	if (scmd->prot_op & SCSI_PROT_REF_CHECK) {
 		eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG |
-		    MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG |
-		    MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
+			MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG;
 		mpi_request->CDB.EEDP32.PrimaryReferenceTag =
-		    cpu_to_be32(t10_pi_ref_tag(scmd->request));
-		break;
-
-	case SCSI_PROT_DIF_TYPE3:
-
-		/*
-		* enable guard checking
-		*/
-		eedp_flags |= MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD;
-
-		break;
+			cpu_to_be32(scsi_prot_ref_tag(scmd));
 	}
 
-	mpi_request_3v->EEDPBlockSize =
-	    cpu_to_le16(scmd->device->sector_size);
+	mpi_request_3v->EEDPBlockSize = scsi_prot_interval(scmd);
 
 	if (ioc->is_gen35_ioc)
 		eedp_flags |= MPI25_SCSIIO_EEDPFLAGS_APPTAG_DISABLE_MODE;