diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2010-12-13 19:17:42 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:37:16 -0500 |
commit | b704495c6707013806d1b66507a967896e2b4a7c (patch) | |
tree | 4ef277e362f33d1803bbacf0e24053e9a6506bb5 /drivers/scsi/bfa/bfa_svc.c | |
parent | f1d584d70f31f54e0a559049906f42db89e2746d (diff) |
[SCSI] bfa: direct attach mode fix.
- Direct attach is not working due to the check of PID in fcxp_send request.
- Added logic to set the lps->lp_pid with the PID assigned for n2n mode.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa/bfa_svc.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_svc.c | 99 |
1 files changed, 98 insertions, 1 deletions
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index 2666472d1429..b7df5534da85 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c | |||
@@ -131,6 +131,7 @@ static void bfa_lps_reqq_resume(void *lps_arg); | |||
131 | static void bfa_lps_free(struct bfa_lps_s *lps); | 131 | static void bfa_lps_free(struct bfa_lps_s *lps); |
132 | static void bfa_lps_send_login(struct bfa_lps_s *lps); | 132 | static void bfa_lps_send_login(struct bfa_lps_s *lps); |
133 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); | 133 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); |
134 | static void bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps); | ||
134 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); | 135 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); |
135 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); | 136 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); |
136 | static void bfa_lps_cvl_event(struct bfa_lps_s *lps); | 137 | static void bfa_lps_cvl_event(struct bfa_lps_s *lps); |
@@ -143,6 +144,8 @@ static void bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event); | |||
143 | static void bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event | 144 | static void bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event |
144 | event); | 145 | event); |
145 | static void bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event); | 146 | static void bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event); |
147 | static void bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, | ||
148 | enum bfa_lps_event event); | ||
146 | static void bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event); | 149 | static void bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event); |
147 | static void bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event | 150 | static void bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event |
148 | event); | 151 | event); |
@@ -1254,6 +1257,12 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1254 | else | 1257 | else |
1255 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | 1258 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, |
1256 | BFA_PL_EID_LOGIN, 0, "FLOGI Accept"); | 1259 | BFA_PL_EID_LOGIN, 0, "FLOGI Accept"); |
1260 | /* If N2N, send the assigned PID to FW */ | ||
1261 | bfa_trc(lps->bfa, lps->fport); | ||
1262 | bfa_trc(lps->bfa, lps->lp_pid); | ||
1263 | |||
1264 | if (!lps->fport && lps->lp_pid) | ||
1265 | bfa_sm_send_event(lps, BFA_LPS_SM_SET_N2N_PID); | ||
1257 | } else { | 1266 | } else { |
1258 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1267 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
1259 | if (lps->fdisc) | 1268 | if (lps->fdisc) |
@@ -1272,6 +1281,11 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1272 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1281 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
1273 | break; | 1282 | break; |
1274 | 1283 | ||
1284 | case BFA_LPS_SM_SET_N2N_PID: | ||
1285 | bfa_trc(lps->bfa, lps->fport); | ||
1286 | bfa_trc(lps->bfa, lps->lp_pid); | ||
1287 | break; | ||
1288 | |||
1275 | default: | 1289 | default: |
1276 | bfa_sm_fault(lps->bfa, event); | 1290 | bfa_sm_fault(lps->bfa, event); |
1277 | } | 1291 | } |
@@ -1340,6 +1354,14 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1340 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); | 1354 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); |
1341 | break; | 1355 | break; |
1342 | 1356 | ||
1357 | case BFA_LPS_SM_SET_N2N_PID: | ||
1358 | if (bfa_reqq_full(lps->bfa, lps->reqq)) { | ||
1359 | bfa_sm_set_state(lps, bfa_lps_sm_online_n2n_pid_wait); | ||
1360 | bfa_reqq_wait(lps->bfa, lps->reqq, &lps->wqe); | ||
1361 | } else | ||
1362 | bfa_lps_send_set_n2n_pid(lps); | ||
1363 | break; | ||
1364 | |||
1343 | case BFA_LPS_SM_OFFLINE: | 1365 | case BFA_LPS_SM_OFFLINE: |
1344 | case BFA_LPS_SM_DELETE: | 1366 | case BFA_LPS_SM_DELETE: |
1345 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1367 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
@@ -1350,6 +1372,48 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1350 | } | 1372 | } |
1351 | } | 1373 | } |
1352 | 1374 | ||
1375 | /** | ||
1376 | * login complete | ||
1377 | */ | ||
1378 | static void | ||
1379 | bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event) | ||
1380 | { | ||
1381 | bfa_trc(lps->bfa, lps->lp_tag); | ||
1382 | bfa_trc(lps->bfa, event); | ||
1383 | |||
1384 | switch (event) { | ||
1385 | case BFA_LPS_SM_RESUME: | ||
1386 | bfa_sm_set_state(lps, bfa_lps_sm_online); | ||
1387 | bfa_lps_send_set_n2n_pid(lps); | ||
1388 | break; | ||
1389 | |||
1390 | case BFA_LPS_SM_LOGOUT: | ||
1391 | bfa_sm_set_state(lps, bfa_lps_sm_logowait); | ||
1392 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
1393 | BFA_PL_EID_LOGO, 0, "Logout"); | ||
1394 | break; | ||
1395 | |||
1396 | case BFA_LPS_SM_RX_CVL: | ||
1397 | bfa_sm_set_state(lps, bfa_lps_sm_init); | ||
1398 | bfa_reqq_wcancel(&lps->wqe); | ||
1399 | |||
1400 | /* Let the vport module know about this event */ | ||
1401 | bfa_lps_cvl_event(lps); | ||
1402 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
1403 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); | ||
1404 | break; | ||
1405 | |||
1406 | case BFA_LPS_SM_OFFLINE: | ||
1407 | case BFA_LPS_SM_DELETE: | ||
1408 | bfa_sm_set_state(lps, bfa_lps_sm_init); | ||
1409 | bfa_reqq_wcancel(&lps->wqe); | ||
1410 | break; | ||
1411 | |||
1412 | default: | ||
1413 | bfa_sm_fault(lps->bfa, event); | ||
1414 | } | ||
1415 | } | ||
1416 | |||
1353 | /* | 1417 | /* |
1354 | * logout in progress - awaiting firmware response | 1418 | * logout in progress - awaiting firmware response |
1355 | */ | 1419 | */ |
@@ -1498,8 +1562,9 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp) | |||
1498 | switch (rsp->status) { | 1562 | switch (rsp->status) { |
1499 | case BFA_STATUS_OK: | 1563 | case BFA_STATUS_OK: |
1500 | lps->fport = rsp->f_port; | 1564 | lps->fport = rsp->f_port; |
1565 | if (lps->fport) | ||
1566 | lps->lp_pid = rsp->lp_pid; | ||
1501 | lps->npiv_en = rsp->npiv_en; | 1567 | lps->npiv_en = rsp->npiv_en; |
1502 | lps->lp_pid = rsp->lp_pid; | ||
1503 | lps->pr_bbcred = be16_to_cpu(rsp->bb_credit); | 1568 | lps->pr_bbcred = be16_to_cpu(rsp->bb_credit); |
1504 | lps->pr_pwwn = rsp->port_name; | 1569 | lps->pr_pwwn = rsp->port_name; |
1505 | lps->pr_nwwn = rsp->node_name; | 1570 | lps->pr_nwwn = rsp->node_name; |
@@ -1626,6 +1691,25 @@ bfa_lps_send_logout(struct bfa_lps_s *lps) | |||
1626 | bfa_reqq_produce(lps->bfa, lps->reqq); | 1691 | bfa_reqq_produce(lps->bfa, lps->reqq); |
1627 | } | 1692 | } |
1628 | 1693 | ||
1694 | /** | ||
1695 | * send n2n pid set request to firmware | ||
1696 | */ | ||
1697 | static void | ||
1698 | bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps) | ||
1699 | { | ||
1700 | struct bfi_lps_n2n_pid_req_s *m; | ||
1701 | |||
1702 | m = bfa_reqq_next(lps->bfa, lps->reqq); | ||
1703 | bfa_assert(m); | ||
1704 | |||
1705 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, | ||
1706 | bfa_lpuid(lps->bfa)); | ||
1707 | |||
1708 | m->lp_tag = lps->lp_tag; | ||
1709 | m->lp_pid = lps->lp_pid; | ||
1710 | bfa_reqq_produce(lps->bfa, lps->reqq); | ||
1711 | } | ||
1712 | |||
1629 | /* | 1713 | /* |
1630 | * Indirect login completion handler for non-fcs | 1714 | * Indirect login completion handler for non-fcs |
1631 | */ | 1715 | */ |
@@ -1846,6 +1930,19 @@ bfa_lps_get_base_pid(struct bfa_s *bfa) | |||
1846 | return BFA_LPS_FROM_TAG(mod, 0)->lp_pid; | 1930 | return BFA_LPS_FROM_TAG(mod, 0)->lp_pid; |
1847 | } | 1931 | } |
1848 | 1932 | ||
1933 | /** | ||
1934 | * Set PID in case of n2n (which is assigned during PLOGI) | ||
1935 | */ | ||
1936 | void | ||
1937 | bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, uint32_t n2n_pid) | ||
1938 | { | ||
1939 | bfa_trc(lps->bfa, lps->lp_tag); | ||
1940 | bfa_trc(lps->bfa, n2n_pid); | ||
1941 | |||
1942 | lps->lp_pid = n2n_pid; | ||
1943 | bfa_sm_send_event(lps, BFA_LPS_SM_SET_N2N_PID); | ||
1944 | } | ||
1945 | |||
1849 | /* | 1946 | /* |
1850 | * LPS firmware message class handler. | 1947 | * LPS firmware message class handler. |
1851 | */ | 1948 | */ |