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_svc.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_svc.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_svc.c | 188 |
1 files changed, 142 insertions, 46 deletions
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index fe99ce20ec28..cfc0b09465ec 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c | |||
@@ -125,6 +125,7 @@ static void bfa_lps_stop(struct bfa_s *bfa); | |||
125 | static void bfa_lps_iocdisable(struct bfa_s *bfa); | 125 | static void bfa_lps_iocdisable(struct bfa_s *bfa); |
126 | static void bfa_lps_login_rsp(struct bfa_s *bfa, | 126 | static void bfa_lps_login_rsp(struct bfa_s *bfa, |
127 | struct bfi_lps_login_rsp_s *rsp); | 127 | struct bfi_lps_login_rsp_s *rsp); |
128 | static void bfa_lps_no_res(struct bfa_lps_s *first_lps, u8 count); | ||
128 | static void bfa_lps_logout_rsp(struct bfa_s *bfa, | 129 | static void bfa_lps_logout_rsp(struct bfa_s *bfa, |
129 | struct bfi_lps_logout_rsp_s *rsp); | 130 | struct bfi_lps_logout_rsp_s *rsp); |
130 | static void bfa_lps_reqq_resume(void *lps_arg); | 131 | static void bfa_lps_reqq_resume(void *lps_arg); |
@@ -475,6 +476,7 @@ claim_fcxps_mem(struct bfa_fcxp_mod_s *mod, struct bfa_meminfo_s *mi) | |||
475 | 476 | ||
476 | INIT_LIST_HEAD(&mod->fcxp_free_q); | 477 | INIT_LIST_HEAD(&mod->fcxp_free_q); |
477 | INIT_LIST_HEAD(&mod->fcxp_active_q); | 478 | INIT_LIST_HEAD(&mod->fcxp_active_q); |
479 | INIT_LIST_HEAD(&mod->fcxp_unused_q); | ||
478 | 480 | ||
479 | mod->fcxp_list = fcxp; | 481 | mod->fcxp_list = fcxp; |
480 | 482 | ||
@@ -561,6 +563,9 @@ bfa_fcxp_iocdisable(struct bfa_s *bfa) | |||
561 | struct bfa_fcxp_s *fcxp; | 563 | struct bfa_fcxp_s *fcxp; |
562 | struct list_head *qe, *qen; | 564 | struct list_head *qe, *qen; |
563 | 565 | ||
566 | /* Enqueue unused fcxp resources to free_q */ | ||
567 | list_splice_tail_init(&mod->fcxp_unused_q, &mod->fcxp_free_q); | ||
568 | |||
564 | list_for_each_safe(qe, qen, &mod->fcxp_active_q) { | 569 | list_for_each_safe(qe, qen, &mod->fcxp_active_q) { |
565 | fcxp = (struct bfa_fcxp_s *) qe; | 570 | fcxp = (struct bfa_fcxp_s *) qe; |
566 | if (fcxp->caller == NULL) { | 571 | if (fcxp->caller == NULL) { |
@@ -829,7 +834,7 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) | |||
829 | struct bfa_rport_s *rport = reqi->bfa_rport; | 834 | struct bfa_rport_s *rport = reqi->bfa_rport; |
830 | 835 | ||
831 | bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ, | 836 | bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ, |
832 | bfa_lpuid(bfa)); | 837 | bfa_fn_lpu(bfa)); |
833 | 838 | ||
834 | send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); | 839 | send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); |
835 | if (rport) { | 840 | if (rport) { |
@@ -843,7 +848,7 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) | |||
843 | } | 848 | } |
844 | 849 | ||
845 | send_req->vf_id = cpu_to_be16(reqi->vf_id); | 850 | send_req->vf_id = cpu_to_be16(reqi->vf_id); |
846 | send_req->lp_tag = reqi->lp_tag; | 851 | send_req->lp_fwtag = bfa_lps_get_fwtag(bfa, reqi->lp_tag); |
847 | send_req->class = reqi->class; | 852 | send_req->class = reqi->class; |
848 | send_req->rsp_timeout = rspi->rsp_timeout; | 853 | send_req->rsp_timeout = rspi->rsp_timeout; |
849 | send_req->cts = reqi->cts; | 854 | send_req->cts = reqi->cts; |
@@ -891,7 +896,7 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) | |||
891 | 896 | ||
892 | hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); | 897 | hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); |
893 | 898 | ||
894 | bfa_reqq_produce(bfa, BFA_REQQ_FCXP); | 899 | bfa_reqq_produce(bfa, BFA_REQQ_FCXP, send_req->mh); |
895 | 900 | ||
896 | bfa_trc(bfa, bfa_reqq_pi(bfa, BFA_REQQ_FCXP)); | 901 | bfa_trc(bfa, bfa_reqq_pi(bfa, BFA_REQQ_FCXP)); |
897 | bfa_trc(bfa, bfa_reqq_ci(bfa, BFA_REQQ_FCXP)); | 902 | bfa_trc(bfa, bfa_reqq_ci(bfa, BFA_REQQ_FCXP)); |
@@ -1160,6 +1165,18 @@ bfa_fcxp_get_maxrsp(struct bfa_s *bfa) | |||
1160 | return mod->rsp_pld_sz; | 1165 | return mod->rsp_pld_sz; |
1161 | } | 1166 | } |
1162 | 1167 | ||
1168 | void | ||
1169 | bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw) | ||
1170 | { | ||
1171 | struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); | ||
1172 | struct list_head *qe; | ||
1173 | int i; | ||
1174 | |||
1175 | for (i = 0; i < (mod->num_fcxps - num_fcxp_fw); i++) { | ||
1176 | bfa_q_deq_tail(&mod->fcxp_free_q, &qe); | ||
1177 | list_add_tail(qe, &mod->fcxp_unused_q); | ||
1178 | } | ||
1179 | } | ||
1163 | 1180 | ||
1164 | /* | 1181 | /* |
1165 | * BFA LPS state machine functions | 1182 | * BFA LPS state machine functions |
@@ -1171,7 +1188,7 @@ bfa_fcxp_get_maxrsp(struct bfa_s *bfa) | |||
1171 | static void | 1188 | static void |
1172 | bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1189 | bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1173 | { | 1190 | { |
1174 | bfa_trc(lps->bfa, lps->lp_tag); | 1191 | bfa_trc(lps->bfa, lps->bfa_tag); |
1175 | bfa_trc(lps->bfa, event); | 1192 | bfa_trc(lps->bfa, event); |
1176 | 1193 | ||
1177 | switch (event) { | 1194 | switch (event) { |
@@ -1223,7 +1240,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1223 | static void | 1240 | static void |
1224 | bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1241 | bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1225 | { | 1242 | { |
1226 | bfa_trc(lps->bfa, lps->lp_tag); | 1243 | bfa_trc(lps->bfa, lps->bfa_tag); |
1227 | bfa_trc(lps->bfa, event); | 1244 | bfa_trc(lps->bfa, event); |
1228 | 1245 | ||
1229 | switch (event) { | 1246 | switch (event) { |
@@ -1277,7 +1294,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1277 | static void | 1294 | static void |
1278 | bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1295 | bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1279 | { | 1296 | { |
1280 | bfa_trc(lps->bfa, lps->lp_tag); | 1297 | bfa_trc(lps->bfa, lps->bfa_tag); |
1281 | bfa_trc(lps->bfa, event); | 1298 | bfa_trc(lps->bfa, event); |
1282 | 1299 | ||
1283 | switch (event) { | 1300 | switch (event) { |
@@ -1310,7 +1327,7 @@ bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1310 | static void | 1327 | static void |
1311 | bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1328 | bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1312 | { | 1329 | { |
1313 | bfa_trc(lps->bfa, lps->lp_tag); | 1330 | bfa_trc(lps->bfa, lps->bfa_tag); |
1314 | bfa_trc(lps->bfa, event); | 1331 | bfa_trc(lps->bfa, event); |
1315 | 1332 | ||
1316 | switch (event) { | 1333 | switch (event) { |
@@ -1359,7 +1376,7 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1359 | static void | 1376 | static void |
1360 | bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1377 | bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1361 | { | 1378 | { |
1362 | bfa_trc(lps->bfa, lps->lp_tag); | 1379 | bfa_trc(lps->bfa, lps->bfa_tag); |
1363 | bfa_trc(lps->bfa, event); | 1380 | bfa_trc(lps->bfa, event); |
1364 | 1381 | ||
1365 | switch (event) { | 1382 | switch (event) { |
@@ -1401,7 +1418,7 @@ bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1401 | static void | 1418 | static void |
1402 | bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1419 | bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1403 | { | 1420 | { |
1404 | bfa_trc(lps->bfa, lps->lp_tag); | 1421 | bfa_trc(lps->bfa, lps->bfa_tag); |
1405 | bfa_trc(lps->bfa, event); | 1422 | bfa_trc(lps->bfa, event); |
1406 | 1423 | ||
1407 | switch (event) { | 1424 | switch (event) { |
@@ -1426,7 +1443,7 @@ bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1426 | static void | 1443 | static void |
1427 | bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event) | 1444 | bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event) |
1428 | { | 1445 | { |
1429 | bfa_trc(lps->bfa, lps->lp_tag); | 1446 | bfa_trc(lps->bfa, lps->bfa_tag); |
1430 | bfa_trc(lps->bfa, event); | 1447 | bfa_trc(lps->bfa, event); |
1431 | 1448 | ||
1432 | switch (event) { | 1449 | switch (event) { |
@@ -1488,10 +1505,11 @@ bfa_lps_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
1488 | 1505 | ||
1489 | INIT_LIST_HEAD(&mod->lps_free_q); | 1506 | INIT_LIST_HEAD(&mod->lps_free_q); |
1490 | INIT_LIST_HEAD(&mod->lps_active_q); | 1507 | INIT_LIST_HEAD(&mod->lps_active_q); |
1508 | INIT_LIST_HEAD(&mod->lps_login_q); | ||
1491 | 1509 | ||
1492 | for (i = 0; i < mod->num_lps; i++, lps++) { | 1510 | for (i = 0; i < mod->num_lps; i++, lps++) { |
1493 | lps->bfa = bfa; | 1511 | lps->bfa = bfa; |
1494 | lps->lp_tag = (u8) i; | 1512 | lps->bfa_tag = (u8) i; |
1495 | lps->reqq = BFA_REQQ_LPS; | 1513 | lps->reqq = BFA_REQQ_LPS; |
1496 | bfa_reqq_winit(&lps->wqe, bfa_lps_reqq_resume, lps); | 1514 | bfa_reqq_winit(&lps->wqe, bfa_lps_reqq_resume, lps); |
1497 | list_add_tail(&lps->qe, &mod->lps_free_q); | 1515 | list_add_tail(&lps->qe, &mod->lps_free_q); |
@@ -1527,6 +1545,11 @@ bfa_lps_iocdisable(struct bfa_s *bfa) | |||
1527 | lps = (struct bfa_lps_s *) qe; | 1545 | lps = (struct bfa_lps_s *) qe; |
1528 | bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); | 1546 | bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); |
1529 | } | 1547 | } |
1548 | list_for_each_safe(qe, qen, &mod->lps_login_q) { | ||
1549 | lps = (struct bfa_lps_s *) qe; | ||
1550 | bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); | ||
1551 | } | ||
1552 | list_splice_tail_init(&mod->lps_login_q, &mod->lps_active_q); | ||
1530 | } | 1553 | } |
1531 | 1554 | ||
1532 | /* | 1555 | /* |
@@ -1538,12 +1561,13 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp) | |||
1538 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | 1561 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); |
1539 | struct bfa_lps_s *lps; | 1562 | struct bfa_lps_s *lps; |
1540 | 1563 | ||
1541 | WARN_ON(rsp->lp_tag >= mod->num_lps); | 1564 | WARN_ON(rsp->bfa_tag >= mod->num_lps); |
1542 | lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); | 1565 | lps = BFA_LPS_FROM_TAG(mod, rsp->bfa_tag); |
1543 | 1566 | ||
1544 | lps->status = rsp->status; | 1567 | lps->status = rsp->status; |
1545 | switch (rsp->status) { | 1568 | switch (rsp->status) { |
1546 | case BFA_STATUS_OK: | 1569 | case BFA_STATUS_OK: |
1570 | lps->fw_tag = rsp->fw_tag; | ||
1547 | lps->fport = rsp->f_port; | 1571 | lps->fport = rsp->f_port; |
1548 | if (lps->fport) | 1572 | if (lps->fport) |
1549 | lps->lp_pid = rsp->lp_pid; | 1573 | lps->lp_pid = rsp->lp_pid; |
@@ -1570,14 +1594,46 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp) | |||
1570 | 1594 | ||
1571 | break; | 1595 | break; |
1572 | 1596 | ||
1597 | case BFA_STATUS_VPORT_MAX: | ||
1598 | if (!rsp->ext_status) | ||
1599 | bfa_lps_no_res(lps, rsp->ext_status); | ||
1600 | break; | ||
1601 | |||
1573 | default: | 1602 | default: |
1574 | /* Nothing to do with other status */ | 1603 | /* Nothing to do with other status */ |
1575 | break; | 1604 | break; |
1576 | } | 1605 | } |
1577 | 1606 | ||
1607 | list_del(&lps->qe); | ||
1608 | list_add_tail(&lps->qe, &mod->lps_active_q); | ||
1578 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); | 1609 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); |
1579 | } | 1610 | } |
1580 | 1611 | ||
1612 | static void | ||
1613 | bfa_lps_no_res(struct bfa_lps_s *first_lps, u8 count) | ||
1614 | { | ||
1615 | struct bfa_s *bfa = first_lps->bfa; | ||
1616 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | ||
1617 | struct list_head *qe, *qe_next; | ||
1618 | struct bfa_lps_s *lps; | ||
1619 | |||
1620 | bfa_trc(bfa, count); | ||
1621 | |||
1622 | qe = bfa_q_next(first_lps); | ||
1623 | |||
1624 | while (count && qe) { | ||
1625 | qe_next = bfa_q_next(qe); | ||
1626 | lps = (struct bfa_lps_s *)qe; | ||
1627 | bfa_trc(bfa, lps->bfa_tag); | ||
1628 | lps->status = first_lps->status; | ||
1629 | list_del(&lps->qe); | ||
1630 | list_add_tail(&lps->qe, &mod->lps_active_q); | ||
1631 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); | ||
1632 | qe = qe_next; | ||
1633 | count--; | ||
1634 | } | ||
1635 | } | ||
1636 | |||
1581 | /* | 1637 | /* |
1582 | * Firmware logout response | 1638 | * Firmware logout response |
1583 | */ | 1639 | */ |
@@ -1587,8 +1643,8 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp) | |||
1587 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | 1643 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); |
1588 | struct bfa_lps_s *lps; | 1644 | struct bfa_lps_s *lps; |
1589 | 1645 | ||
1590 | WARN_ON(rsp->lp_tag >= mod->num_lps); | 1646 | WARN_ON(rsp->bfa_tag >= mod->num_lps); |
1591 | lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); | 1647 | lps = BFA_LPS_FROM_TAG(mod, rsp->bfa_tag); |
1592 | 1648 | ||
1593 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); | 1649 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); |
1594 | } | 1650 | } |
@@ -1602,7 +1658,7 @@ bfa_lps_rx_cvl_event(struct bfa_s *bfa, struct bfi_lps_cvl_event_s *cvl) | |||
1602 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | 1658 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); |
1603 | struct bfa_lps_s *lps; | 1659 | struct bfa_lps_s *lps; |
1604 | 1660 | ||
1605 | lps = BFA_LPS_FROM_TAG(mod, cvl->lp_tag); | 1661 | lps = BFA_LPS_FROM_TAG(mod, cvl->bfa_tag); |
1606 | 1662 | ||
1607 | bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL); | 1663 | bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL); |
1608 | } | 1664 | } |
@@ -1637,15 +1693,16 @@ bfa_lps_free(struct bfa_lps_s *lps) | |||
1637 | static void | 1693 | static void |
1638 | bfa_lps_send_login(struct bfa_lps_s *lps) | 1694 | bfa_lps_send_login(struct bfa_lps_s *lps) |
1639 | { | 1695 | { |
1696 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(lps->bfa); | ||
1640 | struct bfi_lps_login_req_s *m; | 1697 | struct bfi_lps_login_req_s *m; |
1641 | 1698 | ||
1642 | m = bfa_reqq_next(lps->bfa, lps->reqq); | 1699 | m = bfa_reqq_next(lps->bfa, lps->reqq); |
1643 | WARN_ON(!m); | 1700 | WARN_ON(!m); |
1644 | 1701 | ||
1645 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, | 1702 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, |
1646 | bfa_lpuid(lps->bfa)); | 1703 | bfa_fn_lpu(lps->bfa)); |
1647 | 1704 | ||
1648 | m->lp_tag = lps->lp_tag; | 1705 | m->bfa_tag = lps->bfa_tag; |
1649 | m->alpa = lps->alpa; | 1706 | m->alpa = lps->alpa; |
1650 | m->pdu_size = cpu_to_be16(lps->pdusz); | 1707 | m->pdu_size = cpu_to_be16(lps->pdusz); |
1651 | m->pwwn = lps->pwwn; | 1708 | m->pwwn = lps->pwwn; |
@@ -1654,7 +1711,9 @@ bfa_lps_send_login(struct bfa_lps_s *lps) | |||
1654 | m->auth_en = lps->auth_en; | 1711 | m->auth_en = lps->auth_en; |
1655 | m->bb_scn = lps->bb_scn; | 1712 | m->bb_scn = lps->bb_scn; |
1656 | 1713 | ||
1657 | bfa_reqq_produce(lps->bfa, lps->reqq); | 1714 | bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); |
1715 | list_del(&lps->qe); | ||
1716 | list_add_tail(&lps->qe, &mod->lps_login_q); | ||
1658 | } | 1717 | } |
1659 | 1718 | ||
1660 | /* | 1719 | /* |
@@ -1669,11 +1728,11 @@ bfa_lps_send_logout(struct bfa_lps_s *lps) | |||
1669 | WARN_ON(!m); | 1728 | WARN_ON(!m); |
1670 | 1729 | ||
1671 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, | 1730 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, |
1672 | bfa_lpuid(lps->bfa)); | 1731 | bfa_fn_lpu(lps->bfa)); |
1673 | 1732 | ||
1674 | m->lp_tag = lps->lp_tag; | 1733 | m->fw_tag = lps->fw_tag; |
1675 | m->port_name = lps->pwwn; | 1734 | m->port_name = lps->pwwn; |
1676 | bfa_reqq_produce(lps->bfa, lps->reqq); | 1735 | bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); |
1677 | } | 1736 | } |
1678 | 1737 | ||
1679 | /* | 1738 | /* |
@@ -1688,11 +1747,11 @@ bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps) | |||
1688 | WARN_ON(!m); | 1747 | WARN_ON(!m); |
1689 | 1748 | ||
1690 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, | 1749 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, |
1691 | bfa_lpuid(lps->bfa)); | 1750 | bfa_fn_lpu(lps->bfa)); |
1692 | 1751 | ||
1693 | m->lp_tag = lps->lp_tag; | 1752 | m->fw_tag = lps->fw_tag; |
1694 | m->lp_pid = lps->lp_pid; | 1753 | m->lp_pid = lps->lp_pid; |
1695 | bfa_reqq_produce(lps->bfa, lps->reqq); | 1754 | bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); |
1696 | } | 1755 | } |
1697 | 1756 | ||
1698 | /* | 1757 | /* |
@@ -1884,6 +1943,13 @@ bfa_lps_fdisclogo(struct bfa_lps_s *lps) | |||
1884 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); | 1943 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); |
1885 | } | 1944 | } |
1886 | 1945 | ||
1946 | u8 | ||
1947 | bfa_lps_get_fwtag(struct bfa_s *bfa, u8 lp_tag) | ||
1948 | { | ||
1949 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | ||
1950 | |||
1951 | return BFA_LPS_FROM_TAG(mod, lp_tag)->fw_tag; | ||
1952 | } | ||
1887 | 1953 | ||
1888 | /* | 1954 | /* |
1889 | * Return lport services tag given the pid | 1955 | * Return lport services tag given the pid |
@@ -1897,7 +1963,7 @@ bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid) | |||
1897 | 1963 | ||
1898 | for (i = 0, lps = mod->lps_arr; i < mod->num_lps; i++, lps++) { | 1964 | for (i = 0, lps = mod->lps_arr; i < mod->num_lps; i++, lps++) { |
1899 | if (lps->lp_pid == pid) | 1965 | if (lps->lp_pid == pid) |
1900 | return lps->lp_tag; | 1966 | return lps->bfa_tag; |
1901 | } | 1967 | } |
1902 | 1968 | ||
1903 | /* Return base port tag anyway */ | 1969 | /* Return base port tag anyway */ |
@@ -1922,7 +1988,7 @@ bfa_lps_get_base_pid(struct bfa_s *bfa) | |||
1922 | void | 1988 | void |
1923 | bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, uint32_t n2n_pid) | 1989 | bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, uint32_t n2n_pid) |
1924 | { | 1990 | { |
1925 | bfa_trc(lps->bfa, lps->lp_tag); | 1991 | bfa_trc(lps->bfa, lps->bfa_tag); |
1926 | bfa_trc(lps->bfa, n2n_pid); | 1992 | bfa_trc(lps->bfa, n2n_pid); |
1927 | 1993 | ||
1928 | lps->lp_pid = n2n_pid; | 1994 | lps->lp_pid = n2n_pid; |
@@ -2935,7 +3001,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport) | |||
2935 | } | 3001 | } |
2936 | 3002 | ||
2937 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ, | 3003 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ, |
2938 | bfa_lpuid(fcport->bfa)); | 3004 | bfa_fn_lpu(fcport->bfa)); |
2939 | m->nwwn = fcport->nwwn; | 3005 | m->nwwn = fcport->nwwn; |
2940 | m->pwwn = fcport->pwwn; | 3006 | m->pwwn = fcport->pwwn; |
2941 | m->port_cfg = fcport->cfg; | 3007 | m->port_cfg = fcport->cfg; |
@@ -2949,7 +3015,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport) | |||
2949 | /* | 3015 | /* |
2950 | * queue I/O message to firmware | 3016 | * queue I/O message to firmware |
2951 | */ | 3017 | */ |
2952 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | 3018 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh); |
2953 | return BFA_TRUE; | 3019 | return BFA_TRUE; |
2954 | } | 3020 | } |
2955 | 3021 | ||
@@ -2978,13 +3044,13 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport) | |||
2978 | } | 3044 | } |
2979 | 3045 | ||
2980 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ, | 3046 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ, |
2981 | bfa_lpuid(fcport->bfa)); | 3047 | bfa_fn_lpu(fcport->bfa)); |
2982 | m->msgtag = fcport->msgtag; | 3048 | m->msgtag = fcport->msgtag; |
2983 | 3049 | ||
2984 | /* | 3050 | /* |
2985 | * queue I/O message to firmware | 3051 | * queue I/O message to firmware |
2986 | */ | 3052 | */ |
2987 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | 3053 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh); |
2988 | 3054 | ||
2989 | return BFA_TRUE; | 3055 | return BFA_TRUE; |
2990 | } | 3056 | } |
@@ -3016,14 +3082,14 @@ bfa_fcport_send_txcredit(void *port_cbarg) | |||
3016 | } | 3082 | } |
3017 | 3083 | ||
3018 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ, | 3084 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ, |
3019 | bfa_lpuid(fcport->bfa)); | 3085 | bfa_fn_lpu(fcport->bfa)); |
3020 | m->tx_bbcredit = cpu_to_be16((u16)fcport->cfg.tx_bbcredit); | 3086 | m->tx_bbcredit = cpu_to_be16((u16)fcport->cfg.tx_bbcredit); |
3021 | m->bb_scn = fcport->cfg.bb_scn; | 3087 | m->bb_scn = fcport->cfg.bb_scn; |
3022 | 3088 | ||
3023 | /* | 3089 | /* |
3024 | * queue I/O message to firmware | 3090 | * queue I/O message to firmware |
3025 | */ | 3091 | */ |
3026 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | 3092 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh); |
3027 | } | 3093 | } |
3028 | 3094 | ||
3029 | static void | 3095 | static void |
@@ -3127,8 +3193,8 @@ bfa_fcport_send_stats_get(void *cbarg) | |||
3127 | 3193 | ||
3128 | memset(msg, 0, sizeof(struct bfi_fcport_req_s)); | 3194 | memset(msg, 0, sizeof(struct bfi_fcport_req_s)); |
3129 | bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ, | 3195 | bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ, |
3130 | bfa_lpuid(fcport->bfa)); | 3196 | bfa_fn_lpu(fcport->bfa)); |
3131 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | 3197 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh); |
3132 | } | 3198 | } |
3133 | 3199 | ||
3134 | static void | 3200 | static void |
@@ -3189,8 +3255,8 @@ bfa_fcport_send_stats_clear(void *cbarg) | |||
3189 | 3255 | ||
3190 | memset(msg, 0, sizeof(struct bfi_fcport_req_s)); | 3256 | memset(msg, 0, sizeof(struct bfi_fcport_req_s)); |
3191 | bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ, | 3257 | bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ, |
3192 | bfa_lpuid(fcport->bfa)); | 3258 | bfa_fn_lpu(fcport->bfa)); |
3193 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | 3259 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh); |
3194 | } | 3260 | } |
3195 | 3261 | ||
3196 | /* | 3262 | /* |
@@ -4370,6 +4436,7 @@ bfa_rport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
4370 | 4436 | ||
4371 | INIT_LIST_HEAD(&mod->rp_free_q); | 4437 | INIT_LIST_HEAD(&mod->rp_free_q); |
4372 | INIT_LIST_HEAD(&mod->rp_active_q); | 4438 | INIT_LIST_HEAD(&mod->rp_active_q); |
4439 | INIT_LIST_HEAD(&mod->rp_unused_q); | ||
4373 | 4440 | ||
4374 | rp = (struct bfa_rport_s *) bfa_meminfo_kva(meminfo); | 4441 | rp = (struct bfa_rport_s *) bfa_meminfo_kva(meminfo); |
4375 | mod->rps_list = rp; | 4442 | mod->rps_list = rp; |
@@ -4421,6 +4488,9 @@ bfa_rport_iocdisable(struct bfa_s *bfa) | |||
4421 | struct bfa_rport_s *rport; | 4488 | struct bfa_rport_s *rport; |
4422 | struct list_head *qe, *qen; | 4489 | struct list_head *qe, *qen; |
4423 | 4490 | ||
4491 | /* Enqueue unused rport resources to free_q */ | ||
4492 | list_splice_tail_init(&mod->rp_unused_q, &mod->rp_free_q); | ||
4493 | |||
4424 | list_for_each_safe(qe, qen, &mod->rp_active_q) { | 4494 | list_for_each_safe(qe, qen, &mod->rp_active_q) { |
4425 | rport = (struct bfa_rport_s *) qe; | 4495 | rport = (struct bfa_rport_s *) qe; |
4426 | bfa_sm_send_event(rport, BFA_RPORT_SM_HWFAIL); | 4496 | bfa_sm_send_event(rport, BFA_RPORT_SM_HWFAIL); |
@@ -4464,11 +4534,11 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp) | |||
4464 | } | 4534 | } |
4465 | 4535 | ||
4466 | bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ, | 4536 | bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ, |
4467 | bfa_lpuid(rp->bfa)); | 4537 | bfa_fn_lpu(rp->bfa)); |
4468 | m->bfa_handle = rp->rport_tag; | 4538 | m->bfa_handle = rp->rport_tag; |
4469 | m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz); | 4539 | m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz); |
4470 | m->pid = rp->rport_info.pid; | 4540 | m->pid = rp->rport_info.pid; |
4471 | m->lp_tag = rp->rport_info.lp_tag; | 4541 | m->lp_fwtag = bfa_lps_get_fwtag(rp->bfa, (u8)rp->rport_info.lp_tag); |
4472 | m->local_pid = rp->rport_info.local_pid; | 4542 | m->local_pid = rp->rport_info.local_pid; |
4473 | m->fc_class = rp->rport_info.fc_class; | 4543 | m->fc_class = rp->rport_info.fc_class; |
4474 | m->vf_en = rp->rport_info.vf_en; | 4544 | m->vf_en = rp->rport_info.vf_en; |
@@ -4478,7 +4548,7 @@ bfa_rport_send_fwcreate(struct bfa_rport_s *rp) | |||
4478 | /* | 4548 | /* |
4479 | * queue I/O message to firmware | 4549 | * queue I/O message to firmware |
4480 | */ | 4550 | */ |
4481 | bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); | 4551 | bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh); |
4482 | return BFA_TRUE; | 4552 | return BFA_TRUE; |
4483 | } | 4553 | } |
4484 | 4554 | ||
@@ -4497,13 +4567,13 @@ bfa_rport_send_fwdelete(struct bfa_rport_s *rp) | |||
4497 | } | 4567 | } |
4498 | 4568 | ||
4499 | bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_DELETE_REQ, | 4569 | bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_DELETE_REQ, |
4500 | bfa_lpuid(rp->bfa)); | 4570 | bfa_fn_lpu(rp->bfa)); |
4501 | m->fw_handle = rp->fw_handle; | 4571 | m->fw_handle = rp->fw_handle; |
4502 | 4572 | ||
4503 | /* | 4573 | /* |
4504 | * queue I/O message to firmware | 4574 | * queue I/O message to firmware |
4505 | */ | 4575 | */ |
4506 | bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); | 4576 | bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh); |
4507 | return BFA_TRUE; | 4577 | return BFA_TRUE; |
4508 | } | 4578 | } |
4509 | 4579 | ||
@@ -4522,14 +4592,14 @@ bfa_rport_send_fwspeed(struct bfa_rport_s *rp) | |||
4522 | } | 4592 | } |
4523 | 4593 | ||
4524 | bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_SET_SPEED_REQ, | 4594 | bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_SET_SPEED_REQ, |
4525 | bfa_lpuid(rp->bfa)); | 4595 | bfa_fn_lpu(rp->bfa)); |
4526 | m->fw_handle = rp->fw_handle; | 4596 | m->fw_handle = rp->fw_handle; |
4527 | m->speed = (u8)rp->rport_info.speed; | 4597 | m->speed = (u8)rp->rport_info.speed; |
4528 | 4598 | ||
4529 | /* | 4599 | /* |
4530 | * queue I/O message to firmware | 4600 | * queue I/O message to firmware |
4531 | */ | 4601 | */ |
4532 | bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT); | 4602 | bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh); |
4533 | return BFA_TRUE; | 4603 | return BFA_TRUE; |
4534 | } | 4604 | } |
4535 | 4605 | ||
@@ -4579,7 +4649,18 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
4579 | } | 4649 | } |
4580 | } | 4650 | } |
4581 | 4651 | ||
4652 | void | ||
4653 | bfa_rport_res_recfg(struct bfa_s *bfa, u16 num_rport_fw) | ||
4654 | { | ||
4655 | struct bfa_rport_mod_s *mod = BFA_RPORT_MOD(bfa); | ||
4656 | struct list_head *qe; | ||
4657 | int i; | ||
4582 | 4658 | ||
4659 | for (i = 0; i < (mod->num_rports - num_rport_fw); i++) { | ||
4660 | bfa_q_deq_tail(&mod->rp_free_q, &qe); | ||
4661 | list_add_tail(qe, &mod->rp_unused_q); | ||
4662 | } | ||
4663 | } | ||
4583 | 4664 | ||
4584 | /* | 4665 | /* |
4585 | * bfa_rport_api | 4666 | * bfa_rport_api |
@@ -4880,7 +4961,7 @@ claim_uf_post_msgs(struct bfa_uf_mod_s *ufm, struct bfa_meminfo_s *mi) | |||
4880 | buf_len = sizeof(struct bfa_uf_buf_s); | 4961 | buf_len = sizeof(struct bfa_uf_buf_s); |
4881 | uf_bp_msg->buf_len = cpu_to_be16(buf_len); | 4962 | uf_bp_msg->buf_len = cpu_to_be16(buf_len); |
4882 | bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST, | 4963 | bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST, |
4883 | bfa_lpuid(ufm->bfa)); | 4964 | bfa_fn_lpu(ufm->bfa)); |
4884 | bfa_alen_set(&uf_bp_msg->alen, buf_len, ufm_pbs_pa(ufm, i)); | 4965 | bfa_alen_set(&uf_bp_msg->alen, buf_len, ufm_pbs_pa(ufm, i)); |
4885 | } | 4966 | } |
4886 | 4967 | ||
@@ -4957,6 +5038,7 @@ bfa_uf_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
4957 | ufm->num_ufs = cfg->fwcfg.num_uf_bufs; | 5038 | ufm->num_ufs = cfg->fwcfg.num_uf_bufs; |
4958 | INIT_LIST_HEAD(&ufm->uf_free_q); | 5039 | INIT_LIST_HEAD(&ufm->uf_free_q); |
4959 | INIT_LIST_HEAD(&ufm->uf_posted_q); | 5040 | INIT_LIST_HEAD(&ufm->uf_posted_q); |
5041 | INIT_LIST_HEAD(&ufm->uf_unused_q); | ||
4960 | 5042 | ||
4961 | uf_mem_claim(ufm, meminfo); | 5043 | uf_mem_claim(ufm, meminfo); |
4962 | } | 5044 | } |
@@ -4992,7 +5074,7 @@ bfa_uf_post(struct bfa_uf_mod_s *ufm, struct bfa_uf_s *uf) | |||
4992 | 5074 | ||
4993 | memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag], | 5075 | memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag], |
4994 | sizeof(struct bfi_uf_buf_post_s)); | 5076 | sizeof(struct bfi_uf_buf_post_s)); |
4995 | bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP); | 5077 | bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP, uf_post_msg->mh); |
4996 | 5078 | ||
4997 | bfa_trc(ufm->bfa, uf->uf_tag); | 5079 | bfa_trc(ufm->bfa, uf->uf_tag); |
4998 | 5080 | ||
@@ -5061,6 +5143,9 @@ bfa_uf_iocdisable(struct bfa_s *bfa) | |||
5061 | struct bfa_uf_s *uf; | 5143 | struct bfa_uf_s *uf; |
5062 | struct list_head *qe, *qen; | 5144 | struct list_head *qe, *qen; |
5063 | 5145 | ||
5146 | /* Enqueue unused uf resources to free_q */ | ||
5147 | list_splice_tail_init(&ufm->uf_unused_q, &ufm->uf_free_q); | ||
5148 | |||
5064 | list_for_each_safe(qe, qen, &ufm->uf_posted_q) { | 5149 | list_for_each_safe(qe, qen, &ufm->uf_posted_q) { |
5065 | uf = (struct bfa_uf_s *) qe; | 5150 | uf = (struct bfa_uf_s *) qe; |
5066 | list_del(&uf->qe); | 5151 | list_del(&uf->qe); |
@@ -5125,4 +5210,15 @@ bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
5125 | } | 5210 | } |
5126 | } | 5211 | } |
5127 | 5212 | ||
5213 | void | ||
5214 | bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw) | ||
5215 | { | ||
5216 | struct bfa_uf_mod_s *mod = BFA_UF_MOD(bfa); | ||
5217 | struct list_head *qe; | ||
5218 | int i; | ||
5128 | 5219 | ||
5220 | for (i = 0; i < (mod->num_ufs - num_uf_fw); i++) { | ||
5221 | bfa_q_deq_tail(&mod->uf_free_q, &qe); | ||
5222 | list_add_tail(qe, &mod->uf_unused_q); | ||
5223 | } | ||
5224 | } | ||