aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2010-12-13 19:23:27 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:37:17 -0500
commit15821f05b78dbeb2f897d1d22576449103a4d8d5 (patch)
treed71a92b42ceba66e2cd33d5494b05f378cae0476
parentb704495c6707013806d1b66507a967896e2b4a7c (diff)
[SCSI] bfa: io tag handling and minor bug fix.
Fix iotag handling: 1) Update and check io tag for retry case. 2) Clearing upper 3 bits in io tag when an IO completes. The 3 upper bits in io tags are used for counting FCP exchange retry. Un-cleared bits will cause firmware to access invalid memory when the same io tag is used for an IO to a target that doesn't support FCP exchange retry. 3) Only check the effective bits when validating an iotag. Other minor fixes: 1) Added trace to get FC header type with assert of unhandled packet received. Ignore the type FC_TYPE_FC_FSS (FC_XS). 2) Fixed the adapter info display check - to check for fcmode flag even. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c8
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.h22
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c8
-rw-r--r--drivers/scsi/bfa/bfad_im.c2
4 files changed, 24 insertions, 16 deletions
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 314c93122980..5e697f236ef3 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -1540,8 +1540,8 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1540 break; 1540 break;
1541 1541
1542 case BFA_IOIM_SM_SQRETRY: 1542 case BFA_IOIM_SM_SQRETRY:
1543 if (bfa_ioim_get_iotag(ioim) != BFA_TRUE) { 1543 if (bfa_ioim_maxretry_reached(ioim)) {
1544 /* max retry completed free IO */ 1544 /* max retry reached, free IO */
1545 bfa_sm_set_state(ioim, bfa_ioim_sm_hcb_free); 1545 bfa_sm_set_state(ioim, bfa_ioim_sm_hcb_free);
1546 bfa_ioim_move_to_comp_q(ioim); 1546 bfa_ioim_move_to_comp_q(ioim);
1547 bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, 1547 bfa_cb_queue(ioim->bfa, &ioim->hcb_qe,
@@ -1569,6 +1569,7 @@ bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1569 switch (event) { 1569 switch (event) {
1570 case BFA_IOIM_SM_FREE: 1570 case BFA_IOIM_SM_FREE:
1571 /* abts and rrq done. Now retry the IO with new tag */ 1571 /* abts and rrq done. Now retry the IO with new tag */
1572 bfa_ioim_update_iotag(ioim);
1572 if (!bfa_ioim_send_ioreq(ioim)) { 1573 if (!bfa_ioim_send_ioreq(ioim)) {
1573 bfa_sm_set_state(ioim, bfa_ioim_sm_qfull); 1574 bfa_sm_set_state(ioim, bfa_ioim_sm_qfull);
1574 break; 1575 break;
@@ -2526,7 +2527,7 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2526 iotag = be16_to_cpu(rsp->io_tag); 2527 iotag = be16_to_cpu(rsp->io_tag);
2527 2528
2528 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); 2529 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag);
2529 bfa_assert(ioim->iotag == iotag); 2530 bfa_assert(BFA_IOIM_TAG_2_ID(ioim->iotag) == iotag);
2530 2531
2531 bfa_trc_fp(ioim->bfa, ioim->iotag); 2532 bfa_trc_fp(ioim->bfa, ioim->iotag);
2532 bfa_ioim_cb_profile_comp(fcpim, ioim); 2533 bfa_ioim_cb_profile_comp(fcpim, ioim);
@@ -2629,6 +2630,7 @@ bfa_ioim_free(struct bfa_ioim_s *ioim)
2629 bfa_stats(ioim->itnim, io_comps); 2630 bfa_stats(ioim->itnim, io_comps);
2630 fcpim->ios_active--; 2631 fcpim->ios_active--;
2631 2632
2633 ioim->iotag &= BFA_IOIM_IOTAG_MASK;
2632 list_del(&ioim->qe); 2634 list_del(&ioim->qe);
2633 list_add_tail(&ioim->qe, &fcpim->ioim_free_q); 2635 list_add_tail(&ioim->qe, &fcpim->ioim_free_q);
2634} 2636}
diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h
index f9334587e02a..1e38dade8423 100644
--- a/drivers/scsi/bfa/bfa_fcpim.h
+++ b/drivers/scsi/bfa/bfa_fcpim.h
@@ -41,7 +41,7 @@
41 (__itnim->ioprofile.iocomps[__index]++) 41 (__itnim->ioprofile.iocomps[__index]++)
42 42
43#define BFA_IOIM_RETRY_TAG_OFFSET 11 43#define BFA_IOIM_RETRY_TAG_OFFSET 11
44#define BFA_IOIM_RETRY_TAG_MASK 0x07ff /* 2K IOs */ 44#define BFA_IOIM_IOTAG_MASK 0x07ff /* 2K IOs */
45#define BFA_IOIM_RETRY_MAX 7 45#define BFA_IOIM_RETRY_MAX 7
46 46
47/* Buckets are are 512 bytes to 2MB */ 47/* Buckets are are 512 bytes to 2MB */
@@ -189,8 +189,9 @@ struct bfa_itnim_s {
189 189
190#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) 190#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
191#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) 191#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod)
192#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK)
192#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ 193#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
193 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_RETRY_TAG_MASK)]) 194 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)])
194#define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ 195#define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \
195 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) 196 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
196 197
@@ -198,20 +199,21 @@ struct bfa_itnim_s {
198 (_bfa->modules.fcpim_mod.io_profile_start_time) 199 (_bfa->modules.fcpim_mod.io_profile_start_time)
199#define bfa_fcpim_get_io_profile(_bfa) \ 200#define bfa_fcpim_get_io_profile(_bfa) \
200 (_bfa->modules.fcpim_mod.io_profile) 201 (_bfa->modules.fcpim_mod.io_profile)
202#define bfa_ioim_update_iotag(__ioim) do { \
203 uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \
204 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \
205 (__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \
206} while (0)
201 207
202static inline bfa_boolean_t 208static inline bfa_boolean_t
203bfa_ioim_get_iotag(struct bfa_ioim_s *ioim) 209bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
204{ 210{
205 u16 k = ioim->iotag; 211 uint16_t k = ioim->iotag >> BFA_IOIM_RETRY_TAG_OFFSET;
206 212 if (k < BFA_IOIM_RETRY_MAX)
207 k >>= BFA_IOIM_RETRY_TAG_OFFSET; k++;
208
209 if (k > BFA_IOIM_RETRY_MAX)
210 return BFA_FALSE; 213 return BFA_FALSE;
211 ioim->iotag &= BFA_IOIM_RETRY_TAG_MASK;
212 ioim->iotag |= k<<BFA_IOIM_RETRY_TAG_OFFSET;
213 return BFA_TRUE; 214 return BFA_TRUE;
214} 215}
216
215/* 217/*
216 * function prototypes 218 * function prototypes
217 */ 219 */
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 4f2e4e095d67..eb804980cde9 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -604,6 +604,7 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport,
604 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); 604 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
605 605
606 bfa_stats(lport, uf_recvs); 606 bfa_stats(lport, uf_recvs);
607 bfa_trc(lport->fcs, fchs->type);
607 608
608 if (!bfa_fcs_lport_is_online(lport)) { 609 if (!bfa_fcs_lport_is_online(lport)) {
609 bfa_stats(lport, uf_recv_drops); 610 bfa_stats(lport, uf_recv_drops);
@@ -663,8 +664,11 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport,
663 * Only handles ELS frames for now. 664 * Only handles ELS frames for now.
664 */ 665 */
665 if (fchs->type != FC_TYPE_ELS) { 666 if (fchs->type != FC_TYPE_ELS) {
666 bfa_trc(lport->fcs, fchs->type); 667 bfa_trc(lport->fcs, fchs->s_id);
667 bfa_assert(0); 668 bfa_trc(lport->fcs, fchs->d_id);
669 /* ignore type FC_TYPE_FC_FSS */
670 if (fchs->type != FC_TYPE_FC_FSS)
671 bfa_sm_fault(lport->fcs, fchs->type);
668 return; 672 return;
669 } 673 }
670 674
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 7b0f9725bbc9..53cea3d33351 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -182,7 +182,7 @@ bfad_im_info(struct Scsi_Host *shost)
182 bfa_get_adapter_model(bfa, model); 182 bfa_get_adapter_model(bfa, model);
183 183
184 memset(bfa_buf, 0, sizeof(bfa_buf)); 184 memset(bfa_buf, 0, sizeof(bfa_buf));
185 if (ioc->ctdev) 185 if (ioc->ctdev && !ioc->fcmode)
186 snprintf(bfa_buf, sizeof(bfa_buf), 186 snprintf(bfa_buf, sizeof(bfa_buf),
187 "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s", 187 "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s",
188 model, bfad->pci_name, BFAD_DRIVER_VERSION); 188 model, bfad->pci_name, BFAD_DRIVER_VERSION);