Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] bfa: remove all SCSI IO callbacks

Remove SCSI IO callbacks, and as a result remove bfa_cb_ioim.h.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by

Maggie Zhang and committed by
James Bottomley
f314878a e3e7d3ee

+49 -204
-169
drivers/scsi/bfa/bfa_cb_ioim.h
··· 1 - /* 2 - * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. 3 - * All rights reserved 4 - * www.brocade.com 5 - * 6 - * Linux driver for Brocade Fibre Channel Host Bus Adapter. 7 - * 8 - * This program is free software; you can redistribute it and/or modify it 9 - * under the terms of the GNU General Public License (GPL) Version 2 as 10 - * published by the Free Software Foundation 11 - * 12 - * This program is distributed in the hope that it will be useful, but 13 - * WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 - * General Public License for more details. 16 - */ 17 - 18 - #ifndef __BFA_HCB_IOIM_H__ 19 - #define __BFA_HCB_IOIM_H__ 20 - 21 - #include "bfa_os_inc.h" 22 - /* 23 - * task attribute values in FCP-2 FCP_CMND IU 24 - */ 25 - #define SIMPLE_Q 0 26 - #define HEAD_OF_Q 1 27 - #define ORDERED_Q 2 28 - #define ACA_Q 4 29 - #define UNTAGGED 5 30 - 31 - static inline lun_t 32 - bfad_int_to_lun(u32 luno) 33 - { 34 - union { 35 - __be16 scsi_lun[4]; 36 - lun_t bfa_lun; 37 - } lun; 38 - 39 - lun.bfa_lun = 0; 40 - lun.scsi_lun[0] = cpu_to_be16(luno); 41 - 42 - return lun.bfa_lun; 43 - } 44 - 45 - /* 46 - * Get LUN for the I/O request 47 - */ 48 - #define bfa_cb_ioim_get_lun(__dio) \ 49 - bfad_int_to_lun(((struct scsi_cmnd *)__dio)->device->lun) 50 - 51 - /* 52 - * Get CDB for the I/O request 53 - */ 54 - static inline u8 * 55 - bfa_cb_ioim_get_cdb(struct bfad_ioim_s *dio) 56 - { 57 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 58 - 59 - return (u8 *) cmnd->cmnd; 60 - } 61 - 62 - /* 63 - * Get I/O direction (read/write) for the I/O request 64 - */ 65 - static inline enum fcp_iodir 66 - bfa_cb_ioim_get_iodir(struct bfad_ioim_s *dio) 67 - { 68 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 69 - enum dma_data_direction dmadir; 70 - 71 - dmadir = cmnd->sc_data_direction; 72 - if (dmadir == DMA_TO_DEVICE) 73 - return FCP_IODIR_WRITE; 74 - else if (dmadir == DMA_FROM_DEVICE) 75 - return FCP_IODIR_READ; 76 - else 77 - return FCP_IODIR_NONE; 78 - } 79 - 80 - /* 81 - * Get IO size in bytes for the I/O request 82 - */ 83 - static inline u32 84 - bfa_cb_ioim_get_size(struct bfad_ioim_s *dio) 85 - { 86 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 87 - 88 - return scsi_bufflen(cmnd); 89 - } 90 - 91 - /* 92 - * Get timeout for the I/O request 93 - */ 94 - static inline u8 95 - bfa_cb_ioim_get_timeout(struct bfad_ioim_s *dio) 96 - { 97 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 98 - /* 99 - * TBD: need a timeout for scsi passthru 100 - */ 101 - if (cmnd->device->host == NULL) 102 - return 4; 103 - 104 - return 0; 105 - } 106 - 107 - /* 108 - * Get Command Reference Number for the I/O request. 0 if none. 109 - */ 110 - static inline u8 111 - bfa_cb_ioim_get_crn(struct bfad_ioim_s *dio) 112 - { 113 - return 0; 114 - } 115 - 116 - /* 117 - * Get SAM-3 priority for the I/O request. 0 is default. 118 - */ 119 - static inline u8 120 - bfa_cb_ioim_get_priority(struct bfad_ioim_s *dio) 121 - { 122 - return 0; 123 - } 124 - 125 - /* 126 - * Get task attributes for the I/O request. Default is FCP_TASK_ATTR_SIMPLE(0). 127 - */ 128 - static inline u8 129 - bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio) 130 - { 131 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 132 - u8 task_attr = UNTAGGED; 133 - 134 - if (cmnd->device->tagged_supported) { 135 - switch (cmnd->tag) { 136 - case HEAD_OF_QUEUE_TAG: 137 - task_attr = HEAD_OF_Q; 138 - break; 139 - case ORDERED_QUEUE_TAG: 140 - task_attr = ORDERED_Q; 141 - break; 142 - default: 143 - task_attr = SIMPLE_Q; 144 - break; 145 - } 146 - } 147 - 148 - return task_attr; 149 - } 150 - 151 - /* 152 - * Get CDB length in bytes for the I/O request. Default is FCP_CMND_CDB_LEN(16). 153 - */ 154 - static inline u8 155 - bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio) 156 - { 157 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; 158 - 159 - return cmnd->cmd_len; 160 - } 161 - 162 - /* 163 - * Assign queue to be used for the I/O request. This value depends on whether 164 - * the driver wants to use the queues via any specific algorithm. Currently, 165 - * this is not supported. 166 - */ 167 - #define bfa_cb_ioim_get_reqq(__dio) BFA_FALSE 168 - 169 - #endif /* __BFA_HCB_IOIM_H__ */
+2 -2
drivers/scsi/bfa/bfa_defs.h
··· 446 446 * Boot lun information. 447 447 */ 448 448 struct bfa_boot_bootlun_s { 449 - wwn_t pwwn; /* port wwn of target */ 450 - lun_t lun; /* 64-bit lun */ 449 + wwn_t pwwn; /* port wwn of target */ 450 + struct scsi_lun lun; /* 64-bit lun */ 451 451 }; 452 452 #pragma pack() 453 453
+2 -3
drivers/scsi/bfa/bfa_fc.h
··· 21 21 #include "bfa_os_inc.h" 22 22 23 23 typedef u64 wwn_t; 24 - typedef u64 lun_t; 25 24 26 25 #define WWN_NULL (0) 27 26 #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */ ··· 1175 1176 #define FCP_CMND_LUN_LEN 8 1176 1177 1177 1178 struct fcp_cmnd_s { 1178 - lun_t lun; /* 64-bit LU number */ 1179 - u8 crn; /* command reference number */ 1179 + struct scsi_lun lun; /* 64-bit LU number */ 1180 + u8 crn; /* command reference number */ 1180 1181 #ifdef __BIGENDIAN 1181 1182 u8 resvd:1, 1182 1183 priority:4, /* FCP-3: SAM-3 priority */
+33 -20
drivers/scsi/bfa/bfa_fcpim.c
··· 16 16 */ 17 17 18 18 #include "bfa_modules.h" 19 - #include "bfa_cb_ioim.h" 19 + #include "bfa_os_inc.h" 20 20 21 21 BFA_TRC_FILE(HAL, FCPIM); 22 22 BFA_MODULE(fcpim); ··· 263 263 static void __bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete); 264 264 static void __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete); 265 265 static bfa_boolean_t bfa_tskim_match_scope(struct bfa_tskim_s *tskim, 266 - lun_t lun); 266 + struct scsi_lun lun); 267 267 static void bfa_tskim_gather_ios(struct bfa_tskim_s *tskim); 268 268 static void bfa_tskim_cleanp_comp(void *tskim_cbarg); 269 269 static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim); ··· 2315 2315 { 2316 2316 struct bfa_itnim_s *itnim = ioim->itnim; 2317 2317 struct bfi_ioim_req_s *m; 2318 - static struct fcp_cmnd_s cmnd_z0 = { 0 }; 2318 + static struct fcp_cmnd_s cmnd_z0 = {{{0}}}; 2319 2319 struct bfi_sge_s *sge, *sgpge; 2320 2320 u32 pgdlen = 0; 2321 2321 u32 fcp_dl; ··· 2324 2324 struct bfa_sgpg_s *sgpg; 2325 2325 struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; 2326 2326 u32 i, sge_id, pgcumsz; 2327 + enum dma_data_direction dmadir; 2327 2328 2328 2329 /* 2329 2330 * check for room in queue to send request now ··· 2342 2341 */ 2343 2342 m->io_tag = cpu_to_be16(ioim->iotag); 2344 2343 m->rport_hdl = ioim->itnim->rport->fw_handle; 2345 - m->io_timeout = bfa_cb_ioim_get_timeout(ioim->dio); 2344 + m->io_timeout = 0; 2346 2345 2347 2346 sge = &m->sges[0]; 2348 2347 sgpg = ioim->sgpg; ··· 2413 2412 * set up I/O command parameters 2414 2413 */ 2415 2414 m->cmnd = cmnd_z0; 2416 - m->cmnd.lun = bfa_cb_ioim_get_lun(ioim->dio); 2417 - m->cmnd.iodir = bfa_cb_ioim_get_iodir(ioim->dio); 2418 - m->cmnd.cdb = *(scsi_cdb_t *)bfa_cb_ioim_get_cdb(ioim->dio); 2419 - fcp_dl = bfa_cb_ioim_get_size(ioim->dio); 2415 + int_to_scsilun(cmnd->device->lun, &m->cmnd.lun); 2416 + dmadir = cmnd->sc_data_direction; 2417 + if (dmadir == DMA_TO_DEVICE) 2418 + m->cmnd.iodir = FCP_IODIR_WRITE; 2419 + else if (dmadir == DMA_FROM_DEVICE) 2420 + m->cmnd.iodir = FCP_IODIR_READ; 2421 + else 2422 + m->cmnd.iodir = FCP_IODIR_NONE; 2423 + 2424 + m->cmnd.cdb = *(scsi_cdb_t *) cmnd->cmnd; 2425 + fcp_dl = scsi_bufflen(cmnd); 2420 2426 m->cmnd.fcp_dl = cpu_to_be32(fcp_dl); 2421 2427 2422 2428 /* ··· 2447 2439 bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); 2448 2440 } 2449 2441 if (itnim->seq_rec || 2450 - (bfa_cb_ioim_get_size(ioim->dio) & (sizeof(u32) - 1))) 2442 + (scsi_bufflen(cmnd) & (sizeof(u32) - 1))) 2451 2443 bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); 2452 2444 2453 2445 /* ··· 2777 2769 void 2778 2770 bfa_ioim_profile_comp(struct bfa_ioim_s *ioim) 2779 2771 { 2780 - u32 fcp_dl = bfa_cb_ioim_get_size(ioim->dio); 2772 + struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; 2773 + u32 fcp_dl = scsi_bufflen(cmnd); 2781 2774 u32 index = bfa_ioim_get_index(fcp_dl); 2782 2775 u64 end_time = jiffies; 2783 2776 struct bfa_itnim_latency_s *io_lat = ··· 2904 2895 * Obtain the queue over which this request has to be issued 2905 2896 */ 2906 2897 ioim->reqq = bfa_fcpim_ioredirect_enabled(ioim->bfa) ? 2907 - bfa_cb_ioim_get_reqq(ioim->dio) : 2908 - bfa_itnim_get_reqq(ioim); 2898 + BFA_FALSE : bfa_itnim_get_reqq(ioim); 2909 2899 2910 2900 bfa_sm_send_event(ioim, BFA_IOIM_SM_START); 2911 2901 } ··· 3194 3186 } 3195 3187 3196 3188 static bfa_boolean_t 3197 - bfa_tskim_match_scope(struct bfa_tskim_s *tskim, lun_t lun) 3189 + bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun) 3198 3190 { 3199 3191 switch (tskim->tm_cmnd) { 3200 3192 case FCP_TM_TARGET_RESET: ··· 3204 3196 case FCP_TM_CLEAR_TASK_SET: 3205 3197 case FCP_TM_LUN_RESET: 3206 3198 case FCP_TM_CLEAR_ACA: 3207 - return (tskim->lun == lun); 3199 + return (!memcmp(&tskim->lun, &lun, sizeof(lun))); 3208 3200 3209 3201 default: 3210 3202 bfa_assert(0); ··· 3221 3213 { 3222 3214 struct bfa_itnim_s *itnim = tskim->itnim; 3223 3215 struct bfa_ioim_s *ioim; 3224 - struct list_head *qe, *qen; 3216 + struct list_head *qe, *qen; 3217 + struct scsi_cmnd *cmnd; 3218 + struct scsi_lun scsilun; 3225 3219 3226 3220 INIT_LIST_HEAD(&tskim->io_q); 3227 3221 ··· 3232 3222 */ 3233 3223 list_for_each_safe(qe, qen, &itnim->io_q) { 3234 3224 ioim = (struct bfa_ioim_s *) qe; 3235 - if (bfa_tskim_match_scope 3236 - (tskim, bfa_cb_ioim_get_lun(ioim->dio))) { 3225 + cmnd = (struct scsi_cmnd *) ioim->dio; 3226 + int_to_scsilun(cmnd->device->lun, &scsilun); 3227 + if (bfa_tskim_match_scope(tskim, scsilun)) { 3237 3228 list_del(&ioim->qe); 3238 3229 list_add_tail(&ioim->qe, &tskim->io_q); 3239 3230 } ··· 3245 3234 */ 3246 3235 list_for_each_safe(qe, qen, &itnim->pending_q) { 3247 3236 ioim = (struct bfa_ioim_s *) qe; 3248 - if (bfa_tskim_match_scope 3249 - (tskim, bfa_cb_ioim_get_lun(ioim->dio))) { 3237 + cmnd = (struct scsi_cmnd *) ioim->dio; 3238 + int_to_scsilun(cmnd->device->lun, &scsilun); 3239 + if (bfa_tskim_match_scope(tskim, scsilun)) { 3250 3240 list_del(&ioim->qe); 3251 3241 list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); 3252 3242 bfa_ioim_tov(ioim); ··· 3506 3494 * @return None. 3507 3495 */ 3508 3496 void 3509 - bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, lun_t lun, 3497 + bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, 3498 + struct scsi_lun lun, 3510 3499 enum fcp_tm_cmnd tm_cmnd, u8 tsecs) 3511 3500 { 3512 3501 tskim->itnim = itnim;
+4 -4
drivers/scsi/bfa/bfa_fcpim.h
··· 146 146 struct bfa_s *bfa; /* BFA module */ 147 147 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ 148 148 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ 149 - struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ 150 - bfa_boolean_t notify; /* notify itnim on TM comp */ 151 - lun_t lun; /* lun if applicable */ 149 + struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ 150 + bfa_boolean_t notify; /* notify itnim on TM comp */ 151 + struct scsi_lun lun; /* lun if applicable */ 152 152 enum fcp_tm_cmnd tm_cmnd; /* task management command */ 153 153 u16 tsk_tag; /* FWI IO tag */ 154 154 u8 tsecs; /* timeout in seconds */ ··· 389 389 struct bfad_tskim_s *dtsk); 390 390 void bfa_tskim_free(struct bfa_tskim_s *tskim); 391 391 void bfa_tskim_start(struct bfa_tskim_s *tskim, 392 - struct bfa_itnim_s *itnim, lun_t lun, 392 + struct bfa_itnim_s *itnim, struct scsi_lun lun, 393 393 enum fcp_tm_cmnd tm, u8 t_secs); 394 394 void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, 395 395 enum bfi_tskim_status tsk_status);
+6 -4
drivers/scsi/bfa/bfad_im.c
··· 21 21 22 22 #include "bfad_drv.h" 23 23 #include "bfad_im.h" 24 - #include "bfa_cb_ioim.h" 25 24 #include "bfa_fcs.h" 26 25 27 26 BFA_TRC_FILE(LDRV, IM); ··· 257 258 struct bfa_tskim_s *tskim; 258 259 struct bfa_itnim_s *bfa_itnim; 259 260 bfa_status_t rc = BFA_STATUS_OK; 261 + struct scsi_lun scsilun; 260 262 261 263 tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); 262 264 if (!tskim) { ··· 274 274 cmnd->host_scribble = NULL; 275 275 cmnd->SCp.Status = 0; 276 276 bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); 277 - bfa_tskim_start(tskim, bfa_itnim, (lun_t)0, 277 + memset(&scsilun, 0, sizeof(scsilun)); 278 + bfa_tskim_start(tskim, bfa_itnim, scsilun, 278 279 FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO); 279 280 out: 280 281 return rc; ··· 302 301 int rc = SUCCESS; 303 302 unsigned long flags; 304 303 enum bfi_tskim_status task_status; 304 + struct scsi_lun scsilun; 305 305 306 306 spin_lock_irqsave(&bfad->bfad_lock, flags); 307 307 itnim = itnim_data->itnim; ··· 329 327 cmnd->SCp.ptr = (char *)&wq; 330 328 cmnd->SCp.Status = 0; 331 329 bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); 332 - bfa_tskim_start(tskim, bfa_itnim, 333 - bfad_int_to_lun(cmnd->device->lun), 330 + int_to_scsilun(cmnd->device->lun, &scsilun); 331 + bfa_tskim_start(tskim, bfa_itnim, scsilun, 334 332 FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO); 335 333 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 336 334
+1 -1
drivers/scsi/bfa/bfi.h
··· 399 399 */ 400 400 struct bfi_pbc_blun_s { 401 401 wwn_t tgt_pwwn; 402 - lun_t tgt_lun; 402 + struct scsi_lun tgt_lun; 403 403 }; 404 404 405 405 /*
+1 -1
drivers/scsi/bfa/bfi_ms.h
··· 725 725 struct bfi_mhdr_s mh; /* Common msg header */ 726 726 __be16 tsk_tag; /* task management tag */ 727 727 u16 itn_fhdl; /* itn firmware handle */ 728 - lun_t lun; /* LU number */ 728 + struct scsi_lun lun; /* LU number */ 729 729 u8 tm_flags; /* see enum fcp_tm_cmnd */ 730 730 u8 t_secs; /* Timeout value in seconds */ 731 731 u8 rsvd[2];