diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2011-06-24 23:24:08 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-06-29 18:02:28 -0400 |
commit | 3fd459804ff8e002db2671900debd0fc6dc6c443 (patch) | |
tree | 34d71220521bedb451182ae98a32c16906881503 /drivers/scsi/bfa/bfa_fcpim.c | |
parent | 10a07379247078448c076690657a076076bf89aa (diff) |
[SCSI] bfa: Brocade-1860 Fabric Adapter vHBA support.
- Introduced partitioning of the BFA resources.
- Added h/w queue ID in CPE messages, firmware uses h/w queue ID
from messages to pick a matching RME queue.
- Added message header to bfa_reqq_produce(). h/w queue ID is set
in the message header and firmware modules use h/w queue ID from
message header instead of from cpqe event.
- Made changes to allow using all 256 queues of Brocade-1860 asic.
Previously only a single queue per queue group was used.
- Added function tag to BFI message header. Only used by FC BFI
messages. Used to translate host tag to firmware tag. bfa_lpuid()
is changed to bfa_fn_lpu() that encodes both PCI function and port
ID in BFI message header.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcpim.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcpim.c | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 76d9a00ffb6a..eb14fd6193a0 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c | |||
@@ -340,6 +340,9 @@ bfa_fcpim_iocdisable(struct bfa_fcp_mod_s *fcp) | |||
340 | struct bfa_itnim_s *itnim; | 340 | struct bfa_itnim_s *itnim; |
341 | struct list_head *qe, *qen; | 341 | struct list_head *qe, *qen; |
342 | 342 | ||
343 | /* Enqueue unused ioim resources to free_q */ | ||
344 | list_splice_tail_init(&fcpim->tskim_unused_q, &fcpim->tskim_free_q); | ||
345 | |||
343 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { | 346 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { |
344 | itnim = (struct bfa_itnim_s *) qe; | 347 | itnim = (struct bfa_itnim_s *) qe; |
345 | bfa_itnim_iocdisable(itnim); | 348 | bfa_itnim_iocdisable(itnim); |
@@ -1036,7 +1039,7 @@ bfa_itnim_send_fwcreate(struct bfa_itnim_s *itnim) | |||
1036 | } | 1039 | } |
1037 | 1040 | ||
1038 | bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_CREATE_REQ, | 1041 | bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_CREATE_REQ, |
1039 | bfa_lpuid(itnim->bfa)); | 1042 | bfa_fn_lpu(itnim->bfa)); |
1040 | m->fw_handle = itnim->rport->fw_handle; | 1043 | m->fw_handle = itnim->rport->fw_handle; |
1041 | m->class = FC_CLASS_3; | 1044 | m->class = FC_CLASS_3; |
1042 | m->seq_rec = itnim->seq_rec; | 1045 | m->seq_rec = itnim->seq_rec; |
@@ -1046,7 +1049,7 @@ bfa_itnim_send_fwcreate(struct bfa_itnim_s *itnim) | |||
1046 | /* | 1049 | /* |
1047 | * queue I/O message to firmware | 1050 | * queue I/O message to firmware |
1048 | */ | 1051 | */ |
1049 | bfa_reqq_produce(itnim->bfa, itnim->reqq); | 1052 | bfa_reqq_produce(itnim->bfa, itnim->reqq, m->mh); |
1050 | return BFA_TRUE; | 1053 | return BFA_TRUE; |
1051 | } | 1054 | } |
1052 | 1055 | ||
@@ -1065,14 +1068,14 @@ bfa_itnim_send_fwdelete(struct bfa_itnim_s *itnim) | |||
1065 | } | 1068 | } |
1066 | 1069 | ||
1067 | bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_DELETE_REQ, | 1070 | bfi_h2i_set(m->mh, BFI_MC_ITN, BFI_ITN_H2I_DELETE_REQ, |
1068 | bfa_lpuid(itnim->bfa)); | 1071 | bfa_fn_lpu(itnim->bfa)); |
1069 | m->fw_handle = itnim->rport->fw_handle; | 1072 | m->fw_handle = itnim->rport->fw_handle; |
1070 | bfa_stats(itnim, fw_delete); | 1073 | bfa_stats(itnim, fw_delete); |
1071 | 1074 | ||
1072 | /* | 1075 | /* |
1073 | * queue I/O message to firmware | 1076 | * queue I/O message to firmware |
1074 | */ | 1077 | */ |
1075 | bfa_reqq_produce(itnim->bfa, itnim->reqq); | 1078 | bfa_reqq_produce(itnim->bfa, itnim->reqq, m->mh); |
1076 | return BFA_TRUE; | 1079 | return BFA_TRUE; |
1077 | } | 1080 | } |
1078 | 1081 | ||
@@ -2171,12 +2174,12 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2171 | */ | 2174 | */ |
2172 | switch (m->cmnd.iodir) { | 2175 | switch (m->cmnd.iodir) { |
2173 | case FCP_IODIR_READ: | 2176 | case FCP_IODIR_READ: |
2174 | bfi_h2i_set(m->mh, BFI_MC_IOIM_READ, 0, bfa_lpuid(ioim->bfa)); | 2177 | bfi_h2i_set(m->mh, BFI_MC_IOIM_READ, 0, bfa_fn_lpu(ioim->bfa)); |
2175 | bfa_stats(itnim, input_reqs); | 2178 | bfa_stats(itnim, input_reqs); |
2176 | ioim->itnim->stats.rd_throughput += fcp_dl; | 2179 | ioim->itnim->stats.rd_throughput += fcp_dl; |
2177 | break; | 2180 | break; |
2178 | case FCP_IODIR_WRITE: | 2181 | case FCP_IODIR_WRITE: |
2179 | bfi_h2i_set(m->mh, BFI_MC_IOIM_WRITE, 0, bfa_lpuid(ioim->bfa)); | 2182 | bfi_h2i_set(m->mh, BFI_MC_IOIM_WRITE, 0, bfa_fn_lpu(ioim->bfa)); |
2180 | bfa_stats(itnim, output_reqs); | 2183 | bfa_stats(itnim, output_reqs); |
2181 | ioim->itnim->stats.wr_throughput += fcp_dl; | 2184 | ioim->itnim->stats.wr_throughput += fcp_dl; |
2182 | break; | 2185 | break; |
@@ -2184,16 +2187,16 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2184 | bfa_stats(itnim, input_reqs); | 2187 | bfa_stats(itnim, input_reqs); |
2185 | bfa_stats(itnim, output_reqs); | 2188 | bfa_stats(itnim, output_reqs); |
2186 | default: | 2189 | default: |
2187 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); | 2190 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_fn_lpu(ioim->bfa)); |
2188 | } | 2191 | } |
2189 | if (itnim->seq_rec || | 2192 | if (itnim->seq_rec || |
2190 | (scsi_bufflen(cmnd) & (sizeof(u32) - 1))) | 2193 | (scsi_bufflen(cmnd) & (sizeof(u32) - 1))) |
2191 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); | 2194 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_fn_lpu(ioim->bfa)); |
2192 | 2195 | ||
2193 | /* | 2196 | /* |
2194 | * queue I/O message to firmware | 2197 | * queue I/O message to firmware |
2195 | */ | 2198 | */ |
2196 | bfa_reqq_produce(ioim->bfa, ioim->reqq); | 2199 | bfa_reqq_produce(ioim->bfa, ioim->reqq, m->mh); |
2197 | return BFA_TRUE; | 2200 | return BFA_TRUE; |
2198 | } | 2201 | } |
2199 | 2202 | ||
@@ -2251,14 +2254,14 @@ bfa_ioim_send_abort(struct bfa_ioim_s *ioim) | |||
2251 | else | 2254 | else |
2252 | msgop = BFI_IOIM_H2I_IOCLEANUP_REQ; | 2255 | msgop = BFI_IOIM_H2I_IOCLEANUP_REQ; |
2253 | 2256 | ||
2254 | bfi_h2i_set(m->mh, BFI_MC_IOIM, msgop, bfa_lpuid(ioim->bfa)); | 2257 | bfi_h2i_set(m->mh, BFI_MC_IOIM, msgop, bfa_fn_lpu(ioim->bfa)); |
2255 | m->io_tag = cpu_to_be16(ioim->iotag); | 2258 | m->io_tag = cpu_to_be16(ioim->iotag); |
2256 | m->abort_tag = ++ioim->abort_tag; | 2259 | m->abort_tag = ++ioim->abort_tag; |
2257 | 2260 | ||
2258 | /* | 2261 | /* |
2259 | * queue I/O message to firmware | 2262 | * queue I/O message to firmware |
2260 | */ | 2263 | */ |
2261 | bfa_reqq_produce(ioim->bfa, ioim->reqq); | 2264 | bfa_reqq_produce(ioim->bfa, ioim->reqq, m->mh); |
2262 | return BFA_TRUE; | 2265 | return BFA_TRUE; |
2263 | } | 2266 | } |
2264 | 2267 | ||
@@ -2998,7 +3001,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim) | |||
2998 | * build i/o request message next | 3001 | * build i/o request message next |
2999 | */ | 3002 | */ |
3000 | bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_TM_REQ, | 3003 | bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_TM_REQ, |
3001 | bfa_lpuid(tskim->bfa)); | 3004 | bfa_fn_lpu(tskim->bfa)); |
3002 | 3005 | ||
3003 | m->tsk_tag = cpu_to_be16(tskim->tsk_tag); | 3006 | m->tsk_tag = cpu_to_be16(tskim->tsk_tag); |
3004 | m->itn_fhdl = tskim->itnim->rport->fw_handle; | 3007 | m->itn_fhdl = tskim->itnim->rport->fw_handle; |
@@ -3009,7 +3012,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim) | |||
3009 | /* | 3012 | /* |
3010 | * queue I/O message to firmware | 3013 | * queue I/O message to firmware |
3011 | */ | 3014 | */ |
3012 | bfa_reqq_produce(tskim->bfa, itnim->reqq); | 3015 | bfa_reqq_produce(tskim->bfa, itnim->reqq, m->mh); |
3013 | return BFA_TRUE; | 3016 | return BFA_TRUE; |
3014 | } | 3017 | } |
3015 | 3018 | ||
@@ -3033,14 +3036,14 @@ bfa_tskim_send_abort(struct bfa_tskim_s *tskim) | |||
3033 | * build i/o request message next | 3036 | * build i/o request message next |
3034 | */ | 3037 | */ |
3035 | bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ, | 3038 | bfi_h2i_set(m->mh, BFI_MC_TSKIM, BFI_TSKIM_H2I_ABORT_REQ, |
3036 | bfa_lpuid(tskim->bfa)); | 3039 | bfa_fn_lpu(tskim->bfa)); |
3037 | 3040 | ||
3038 | m->tsk_tag = cpu_to_be16(tskim->tsk_tag); | 3041 | m->tsk_tag = cpu_to_be16(tskim->tsk_tag); |
3039 | 3042 | ||
3040 | /* | 3043 | /* |
3041 | * queue I/O message to firmware | 3044 | * queue I/O message to firmware |
3042 | */ | 3045 | */ |
3043 | bfa_reqq_produce(tskim->bfa, itnim->reqq); | 3046 | bfa_reqq_produce(tskim->bfa, itnim->reqq, m->mh); |
3044 | return BFA_TRUE; | 3047 | return BFA_TRUE; |
3045 | } | 3048 | } |
3046 | 3049 | ||
@@ -3112,6 +3115,7 @@ bfa_tskim_attach(struct bfa_fcpim_s *fcpim, struct bfa_meminfo_s *minfo) | |||
3112 | u16 i; | 3115 | u16 i; |
3113 | 3116 | ||
3114 | INIT_LIST_HEAD(&fcpim->tskim_free_q); | 3117 | INIT_LIST_HEAD(&fcpim->tskim_free_q); |
3118 | INIT_LIST_HEAD(&fcpim->tskim_unused_q); | ||
3115 | 3119 | ||
3116 | tskim = (struct bfa_tskim_s *) bfa_meminfo_kva(minfo); | 3120 | tskim = (struct bfa_tskim_s *) bfa_meminfo_kva(minfo); |
3117 | fcpim->tskim_arr = tskim; | 3121 | fcpim->tskim_arr = tskim; |
@@ -3211,6 +3215,19 @@ bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, | |||
3211 | bfa_sm_send_event(tskim, BFA_TSKIM_SM_START); | 3215 | bfa_sm_send_event(tskim, BFA_TSKIM_SM_START); |
3212 | } | 3216 | } |
3213 | 3217 | ||
3218 | void | ||
3219 | bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw) | ||
3220 | { | ||
3221 | struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa); | ||
3222 | struct list_head *qe; | ||
3223 | int i; | ||
3224 | |||
3225 | for (i = 0; i < (fcpim->num_tskim_reqs - num_tskim_fw); i++) { | ||
3226 | bfa_q_deq_tail(&fcpim->tskim_free_q, &qe); | ||
3227 | list_add_tail(qe, &fcpim->tskim_unused_q); | ||
3228 | } | ||
3229 | } | ||
3230 | |||
3214 | /* BFA FCP module - parent module for fcpim */ | 3231 | /* BFA FCP module - parent module for fcpim */ |
3215 | 3232 | ||
3216 | BFA_MODULE(fcp); | 3233 | BFA_MODULE(fcp); |
@@ -3303,10 +3320,26 @@ bfa_fcp_iocdisable(struct bfa_s *bfa) | |||
3303 | { | 3320 | { |
3304 | struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa); | 3321 | struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa); |
3305 | 3322 | ||
3323 | /* Enqueue unused ioim resources to free_q */ | ||
3324 | list_splice_tail_init(&fcp->iotag_unused_q, &fcp->iotag_ioim_free_q); | ||
3325 | |||
3306 | bfa_fcpim_iocdisable(fcp); | 3326 | bfa_fcpim_iocdisable(fcp); |
3307 | } | 3327 | } |
3308 | 3328 | ||
3309 | void | 3329 | void |
3330 | bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw) | ||
3331 | { | ||
3332 | struct bfa_fcp_mod_s *mod = BFA_FCP_MOD(bfa); | ||
3333 | struct list_head *qe; | ||
3334 | int i; | ||
3335 | |||
3336 | for (i = 0; i < (mod->num_ioim_reqs - num_ioim_fw); i++) { | ||
3337 | bfa_q_deq_tail(&mod->iotag_ioim_free_q, &qe); | ||
3338 | list_add_tail(qe, &mod->iotag_unused_q); | ||
3339 | } | ||
3340 | } | ||
3341 | |||
3342 | void | ||
3310 | bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport, | 3343 | bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport, |
3311 | void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)) | 3344 | void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)) |
3312 | { | 3345 | { |
@@ -3347,6 +3380,7 @@ bfa_iotag_attach(struct bfa_fcp_mod_s *fcp, struct bfa_meminfo_s *minfo) | |||
3347 | 3380 | ||
3348 | INIT_LIST_HEAD(&fcp->iotag_ioim_free_q); | 3381 | INIT_LIST_HEAD(&fcp->iotag_ioim_free_q); |
3349 | INIT_LIST_HEAD(&fcp->iotag_tio_free_q); | 3382 | INIT_LIST_HEAD(&fcp->iotag_tio_free_q); |
3383 | INIT_LIST_HEAD(&fcp->iotag_unused_q); | ||
3350 | 3384 | ||
3351 | num_io_req = fcp->num_ioim_reqs + fcp->num_fwtio_reqs; | 3385 | num_io_req = fcp->num_ioim_reqs + fcp->num_fwtio_reqs; |
3352 | for (i = 0; i < num_io_req; i++, iotag++) { | 3386 | for (i = 0; i < num_io_req; i++, iotag++) { |