@@ -96,30 +96,6 @@ static void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd
96
96
static void lpfc_vmid_assign_cs_ctl (struct lpfc_vport * vport ,
97
97
struct lpfc_vmid * vmid );
98
98
99
- static inline unsigned
100
- lpfc_cmd_blksize (struct scsi_cmnd * sc )
101
- {
102
- return sc -> device -> sector_size ;
103
- }
104
-
105
- #define LPFC_CHECK_PROTECT_GUARD 1
106
- #define LPFC_CHECK_PROTECT_REF 2
107
- static inline unsigned
108
- lpfc_cmd_protect (struct scsi_cmnd * sc , int flag )
109
- {
110
- return 1 ;
111
- }
112
-
113
- static inline unsigned
114
- lpfc_cmd_guard_csum (struct scsi_cmnd * sc )
115
- {
116
- if (lpfc_prot_group_type (NULL , sc ) == LPFC_PG_TYPE_NO_DIF )
117
- return 0 ;
118
- if (scsi_host_get_guard (sc -> device -> host ) == SHOST_DIX_GUARD_IP )
119
- return 1 ;
120
- return 0 ;
121
- }
122
-
123
99
/**
124
100
* lpfc_sli4_set_rsp_sgl_last - Set the last bit in the response sge.
125
101
* @phba: Pointer to HBA object.
@@ -1046,13 +1022,13 @@ lpfc_bg_err_inject(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1046
1022
return 0 ;
1047
1023
1048
1024
sgpe = scsi_prot_sglist (sc );
1049
- lba = t10_pi_ref_tag ( scsi_cmd_to_rq ( sc ) );
1025
+ lba = scsi_prot_ref_tag ( sc );
1050
1026
if (lba == LPFC_INVALID_REFTAG )
1051
1027
return 0 ;
1052
1028
1053
1029
/* First check if we need to match the LBA */
1054
1030
if (phba -> lpfc_injerr_lba != LPFC_INJERR_LBA_OFF ) {
1055
- blksize = lpfc_cmd_blksize (sc );
1031
+ blksize = scsi_prot_interval (sc );
1056
1032
numblks = (scsi_bufflen (sc ) + blksize - 1 ) / blksize ;
1057
1033
1058
1034
/* Make sure we have the right LBA if one is specified */
@@ -1441,7 +1417,7 @@ lpfc_sc_to_bg_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1441
1417
{
1442
1418
uint8_t ret = 0 ;
1443
1419
1444
- if (lpfc_cmd_guard_csum ( sc ) ) {
1420
+ if (sc -> prot_flags & SCSI_PROT_IP_CHECKSUM ) {
1445
1421
switch (scsi_get_prot_op (sc )) {
1446
1422
case SCSI_PROT_READ_INSERT :
1447
1423
case SCSI_PROT_WRITE_STRIP :
@@ -1521,7 +1497,7 @@ lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1521
1497
{
1522
1498
uint8_t ret = 0 ;
1523
1499
1524
- if (lpfc_cmd_guard_csum ( sc ) ) {
1500
+ if (sc -> prot_flags & SCSI_PROT_IP_CHECKSUM ) {
1525
1501
switch (scsi_get_prot_op (sc )) {
1526
1502
case SCSI_PROT_READ_INSERT :
1527
1503
case SCSI_PROT_WRITE_STRIP :
@@ -1629,7 +1605,7 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1629
1605
goto out ;
1630
1606
1631
1607
/* extract some info from the scsi command for pde*/
1632
- reftag = t10_pi_ref_tag ( scsi_cmd_to_rq ( sc ) );
1608
+ reftag = scsi_prot_ref_tag ( sc );
1633
1609
if (reftag == LPFC_INVALID_REFTAG )
1634
1610
goto out ;
1635
1611
@@ -1668,12 +1644,12 @@ lpfc_bg_setup_bpl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1668
1644
* protection data is automatically generated, not checked.
1669
1645
*/
1670
1646
if (datadir == DMA_FROM_DEVICE ) {
1671
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_GUARD ) )
1647
+ if (sc -> prot_flags & SCSI_PROT_GUARD_CHECK )
1672
1648
bf_set (pde6_ce , pde6 , checking );
1673
1649
else
1674
1650
bf_set (pde6_ce , pde6 , 0 );
1675
1651
1676
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_REF ) )
1652
+ if (sc -> prot_flags & SCSI_PROT_REF_CHECK )
1677
1653
bf_set (pde6_re , pde6 , checking );
1678
1654
else
1679
1655
bf_set (pde6_re , pde6 , 0 );
@@ -1791,8 +1767,8 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1791
1767
goto out ;
1792
1768
1793
1769
/* extract some info from the scsi command */
1794
- blksize = lpfc_cmd_blksize (sc );
1795
- reftag = t10_pi_ref_tag ( scsi_cmd_to_rq ( sc ) );
1770
+ blksize = scsi_prot_interval (sc );
1771
+ reftag = scsi_prot_ref_tag ( sc );
1796
1772
if (reftag == LPFC_INVALID_REFTAG )
1797
1773
goto out ;
1798
1774
@@ -1832,12 +1808,12 @@ lpfc_bg_setup_bpl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
1832
1808
bf_set (pde6_optx , pde6 , txop );
1833
1809
bf_set (pde6_oprx , pde6 , rxop );
1834
1810
1835
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_GUARD ) )
1811
+ if (sc -> prot_flags & SCSI_PROT_GUARD_CHECK )
1836
1812
bf_set (pde6_ce , pde6 , checking );
1837
1813
else
1838
1814
bf_set (pde6_ce , pde6 , 0 );
1839
1815
1840
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_REF ) )
1816
+ if (sc -> prot_flags & SCSI_PROT_REF_CHECK )
1841
1817
bf_set (pde6_re , pde6 , checking );
1842
1818
else
1843
1819
bf_set (pde6_re , pde6 , 0 );
@@ -2023,7 +1999,7 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2023
1999
goto out ;
2024
2000
2025
2001
/* extract some info from the scsi command for pde*/
2026
- reftag = t10_pi_ref_tag ( scsi_cmd_to_rq ( sc ) );
2002
+ reftag = scsi_prot_ref_tag ( sc );
2027
2003
if (reftag == LPFC_INVALID_REFTAG )
2028
2004
goto out ;
2029
2005
@@ -2051,12 +2027,12 @@ lpfc_bg_setup_sgl(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2051
2027
* protection data is automatically generated, not checked.
2052
2028
*/
2053
2029
if (sc -> sc_data_direction == DMA_FROM_DEVICE ) {
2054
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_GUARD ) )
2030
+ if (sc -> prot_flags & SCSI_PROT_GUARD_CHECK )
2055
2031
bf_set (lpfc_sli4_sge_dif_ce , diseed , checking );
2056
2032
else
2057
2033
bf_set (lpfc_sli4_sge_dif_ce , diseed , 0 );
2058
2034
2059
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_REF ) )
2035
+ if (sc -> prot_flags & SCSI_PROT_REF_CHECK )
2060
2036
bf_set (lpfc_sli4_sge_dif_re , diseed , checking );
2061
2037
else
2062
2038
bf_set (lpfc_sli4_sge_dif_re , diseed , 0 );
@@ -2223,8 +2199,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2223
2199
goto out ;
2224
2200
2225
2201
/* extract some info from the scsi command */
2226
- blksize = lpfc_cmd_blksize (sc );
2227
- reftag = t10_pi_ref_tag ( scsi_cmd_to_rq ( sc ) );
2202
+ blksize = scsi_prot_interval (sc );
2203
+ reftag = scsi_prot_ref_tag ( sc );
2228
2204
if (reftag == LPFC_INVALID_REFTAG )
2229
2205
goto out ;
2230
2206
@@ -2281,9 +2257,8 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2281
2257
diseed -> ref_tag = cpu_to_le32 (reftag );
2282
2258
diseed -> ref_tag_tran = diseed -> ref_tag ;
2283
2259
2284
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_GUARD ) ) {
2260
+ if (sc -> prot_flags & SCSI_PROT_GUARD_CHECK ) {
2285
2261
bf_set (lpfc_sli4_sge_dif_ce , diseed , checking );
2286
-
2287
2262
} else {
2288
2263
bf_set (lpfc_sli4_sge_dif_ce , diseed , 0 );
2289
2264
/*
@@ -2300,7 +2275,7 @@ lpfc_bg_setup_sgl_prot(struct lpfc_hba *phba, struct scsi_cmnd *sc,
2300
2275
}
2301
2276
2302
2277
2303
- if (lpfc_cmd_protect ( sc , LPFC_CHECK_PROTECT_REF ) )
2278
+ if (sc -> prot_flags & SCSI_PROT_REF_CHECK )
2304
2279
bf_set (lpfc_sli4_sge_dif_re , diseed , checking );
2305
2280
else
2306
2281
bf_set (lpfc_sli4_sge_dif_re , diseed , 0 );
@@ -2557,7 +2532,7 @@ lpfc_bg_scsi_adjust_dl(struct lpfc_hba *phba,
2557
2532
* DIF (trailer) attached to it. Must ajust FCP data length
2558
2533
* to account for the protection data.
2559
2534
*/
2560
- fcpdl += (fcpdl / lpfc_cmd_blksize (sc )) * 8 ;
2535
+ fcpdl += (fcpdl / scsi_prot_interval (sc )) * 8 ;
2561
2536
2562
2537
return fcpdl ;
2563
2538
}
@@ -2811,14 +2786,14 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
2811
2786
* data length is a multiple of the blksize.
2812
2787
*/
2813
2788
sgde = scsi_sglist (cmd );
2814
- blksize = lpfc_cmd_blksize (cmd );
2789
+ blksize = scsi_prot_interval (cmd );
2815
2790
data_src = (uint8_t * )sg_virt (sgde );
2816
2791
data_len = sgde -> length ;
2817
2792
if ((data_len & (blksize - 1 )) == 0 )
2818
2793
chk_guard = 1 ;
2819
2794
2820
2795
src = (struct scsi_dif_tuple * )sg_virt (sgpe );
2821
- start_ref_tag = t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) );
2796
+ start_ref_tag = scsi_prot_ref_tag ( cmd );
2822
2797
if (start_ref_tag == LPFC_INVALID_REFTAG )
2823
2798
goto out ;
2824
2799
start_app_tag = src -> app_tag ;
@@ -2839,7 +2814,8 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
2839
2814
/* First Guard Tag checking */
2840
2815
if (chk_guard ) {
2841
2816
guard_tag = src -> guard_tag ;
2842
- if (lpfc_cmd_guard_csum (cmd ))
2817
+ if (cmd -> prot_flags
2818
+ & SCSI_PROT_IP_CHECKSUM )
2843
2819
sum = lpfc_bg_csum (data_src ,
2844
2820
blksize );
2845
2821
else
@@ -2910,7 +2886,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
2910
2886
phba -> bg_guard_err_cnt ++ ;
2911
2887
lpfc_printf_log (phba , KERN_WARNING , LOG_FCP | LOG_BG ,
2912
2888
"9069 BLKGRD: reftag %x grd_tag err %x != %x\n" ,
2913
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
2889
+ scsi_prot_ref_tag ( cmd ),
2914
2890
sum , guard_tag );
2915
2891
2916
2892
} else if (err_type == BGS_REFTAG_ERR_MASK ) {
@@ -2920,7 +2896,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
2920
2896
phba -> bg_reftag_err_cnt ++ ;
2921
2897
lpfc_printf_log (phba , KERN_WARNING , LOG_FCP | LOG_BG ,
2922
2898
"9066 BLKGRD: reftag %x ref_tag err %x != %x\n" ,
2923
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
2899
+ scsi_prot_ref_tag ( cmd ),
2924
2900
ref_tag , start_ref_tag );
2925
2901
2926
2902
} else if (err_type == BGS_APPTAG_ERR_MASK ) {
@@ -2930,7 +2906,7 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
2930
2906
phba -> bg_apptag_err_cnt ++ ;
2931
2907
lpfc_printf_log (phba , KERN_WARNING , LOG_FCP | LOG_BG ,
2932
2908
"9041 BLKGRD: reftag %x app_tag err %x != %x\n" ,
2933
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
2909
+ scsi_prot_ref_tag ( cmd ),
2934
2910
app_tag , start_app_tag );
2935
2911
}
2936
2912
}
@@ -2992,7 +2968,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
2992
2968
" 0x%x lba 0x%llx blk cnt 0x%x "
2993
2969
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
2994
2970
(unsigned long long )scsi_get_lba (cmd ),
2995
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
2971
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
2996
2972
}
2997
2973
2998
2974
if (lpfc_bgs_get_reftag_err (bgstat )) {
@@ -3007,7 +2983,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3007
2983
" 0x%x lba 0x%llx blk cnt 0x%x "
3008
2984
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3009
2985
(unsigned long long )scsi_get_lba (cmd ),
3010
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
2986
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3011
2987
}
3012
2988
3013
2989
if (lpfc_bgs_get_apptag_err (bgstat )) {
@@ -3022,7 +2998,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3022
2998
" 0x%x lba 0x%llx blk cnt 0x%x "
3023
2999
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3024
3000
(unsigned long long )scsi_get_lba (cmd ),
3025
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3001
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3026
3002
}
3027
3003
3028
3004
if (lpfc_bgs_get_hi_water_mark_present (bgstat )) {
@@ -3066,9 +3042,9 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3066
3042
" 0x%x lba 0x%llx blk cnt 0x%x "
3067
3043
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3068
3044
(unsigned long long )scsi_get_lba (cmd ),
3069
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3045
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3070
3046
3071
- /* Calcuate what type of error it was */
3047
+ /* Calculate what type of error it was */
3072
3048
lpfc_calc_bg_err (phba , lpfc_cmd );
3073
3049
}
3074
3050
return ret ;
@@ -3103,8 +3079,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3103
3079
"9072 BLKGRD: Invalid BG Profile in cmd "
3104
3080
"0x%x reftag 0x%x blk cnt 0x%x "
3105
3081
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3106
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
3107
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3082
+ scsi_prot_ref_tag ( cmd ),
3083
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3108
3084
ret = (-1 );
3109
3085
goto out ;
3110
3086
}
@@ -3115,8 +3091,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3115
3091
"9073 BLKGRD: Invalid BG PDIF Block in cmd "
3116
3092
"0x%x reftag 0x%x blk cnt 0x%x "
3117
3093
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3118
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
3119
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3094
+ scsi_prot_ref_tag ( cmd ),
3095
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3120
3096
ret = (-1 );
3121
3097
goto out ;
3122
3098
}
@@ -3131,8 +3107,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3131
3107
"9055 BLKGRD: Guard Tag error in cmd "
3132
3108
"0x%x reftag 0x%x blk cnt 0x%x "
3133
3109
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3134
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
3135
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3110
+ scsi_prot_ref_tag ( cmd ),
3111
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3136
3112
}
3137
3113
3138
3114
if (lpfc_bgs_get_reftag_err (bgstat )) {
@@ -3146,8 +3122,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3146
3122
"9056 BLKGRD: Ref Tag error in cmd "
3147
3123
"0x%x reftag 0x%x blk cnt 0x%x "
3148
3124
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3149
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
3150
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3125
+ scsi_prot_ref_tag ( cmd ),
3126
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3151
3127
}
3152
3128
3153
3129
if (lpfc_bgs_get_apptag_err (bgstat )) {
@@ -3161,8 +3137,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3161
3137
"9061 BLKGRD: App Tag error in cmd "
3162
3138
"0x%x reftag 0x%x blk cnt 0x%x "
3163
3139
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3164
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
3165
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3140
+ scsi_prot_ref_tag ( cmd ),
3141
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3166
3142
}
3167
3143
3168
3144
if (lpfc_bgs_get_hi_water_mark_present (bgstat )) {
@@ -3205,10 +3181,10 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
3205
3181
"9057 BLKGRD: Unknown error in cmd "
3206
3182
"0x%x reftag 0x%x blk cnt 0x%x "
3207
3183
"bgstat=x%x bghm=x%x\n" , cmd -> cmnd [0 ],
3208
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmd ) ),
3209
- blk_rq_sectors ( scsi_cmd_to_rq ( cmd ) ), bgstat , bghm );
3184
+ scsi_prot_ref_tag ( cmd ),
3185
+ scsi_logical_block_count ( cmd ), bgstat , bghm );
3210
3186
3211
- /* Calcuate what type of error it was */
3187
+ /* Calculate what type of error it was */
3212
3188
lpfc_calc_bg_err (phba , lpfc_cmd );
3213
3189
}
3214
3190
out :
@@ -5715,8 +5691,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
5715
5691
"reftag x%x cnt %u pt %x\n" ,
5716
5692
dif_op_str [scsi_get_prot_op (cmnd )],
5717
5693
cmnd -> cmnd [0 ],
5718
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmnd ) ),
5719
- blk_rq_sectors ( scsi_cmd_to_rq ( cmnd ) ),
5694
+ scsi_prot_ref_tag ( cmnd ),
5695
+ scsi_logical_block_count ( cmnd ),
5720
5696
(cmnd -> cmnd [1 ]>>5 ));
5721
5697
}
5722
5698
err = lpfc_bg_scsi_prep_dma_buf (phba , lpfc_cmd );
@@ -5727,8 +5703,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
5727
5703
"9038 BLKGRD: rcvd PROT_NORMAL cmd: "
5728
5704
"x%x reftag x%x cnt %u pt %x\n" ,
5729
5705
cmnd -> cmnd [0 ],
5730
- t10_pi_ref_tag ( scsi_cmd_to_rq ( cmnd ) ),
5731
- blk_rq_sectors ( scsi_cmd_to_rq ( cmnd ) ),
5706
+ scsi_prot_ref_tag ( cmnd ),
5707
+ scsi_logical_block_count ( cmnd ),
5732
5708
(cmnd -> cmnd [1 ]>>5 ));
5733
5709
}
5734
5710
err = lpfc_scsi_prep_dma_buf (phba , lpfc_cmd );
0 commit comments