aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/tcm_qla2xxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/tcm_qla2xxx.c')
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c77
1 files changed, 76 insertions, 1 deletions
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 2358c16c4c8e..3d74f2f39ae1 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -237,7 +237,7 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg)
237 struct tcm_qla2xxx_tpg, se_tpg); 237 struct tcm_qla2xxx_tpg, se_tpg);
238 struct tcm_qla2xxx_lport *lport = tpg->lport; 238 struct tcm_qla2xxx_lport *lport = tpg->lport;
239 239
240 return &lport->lport_name[0]; 240 return lport->lport_naa_name;
241} 241}
242 242
243static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) 243static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg)
@@ -1457,6 +1457,78 @@ static int tcm_qla2xxx_check_initiator_node_acl(
1457 return 0; 1457 return 0;
1458} 1458}
1459 1459
1460static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,
1461 uint16_t loop_id, bool conf_compl_supported)
1462{
1463 struct qla_tgt *tgt = sess->tgt;
1464 struct qla_hw_data *ha = tgt->ha;
1465 struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr;
1466 struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
1467 struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
1468 struct tcm_qla2xxx_nacl, se_node_acl);
1469 u32 key;
1470
1471
1472 if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24)
1473 pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n",
1474 sess,
1475 sess->port_name[0], sess->port_name[1],
1476 sess->port_name[2], sess->port_name[3],
1477 sess->port_name[4], sess->port_name[5],
1478 sess->port_name[6], sess->port_name[7],
1479 sess->loop_id, loop_id,
1480 sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa,
1481 s_id.b.domain, s_id.b.area, s_id.b.al_pa);
1482
1483 if (sess->loop_id != loop_id) {
1484 /*
1485 * Because we can shuffle loop IDs around and we
1486 * update different sessions non-atomically, we might
1487 * have overwritten this session's old loop ID
1488 * already, and we might end up overwriting some other
1489 * session that will be updated later. So we have to
1490 * be extra careful and we can't warn about those things...
1491 */
1492 if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl)
1493 lport->lport_loopid_map[sess->loop_id].se_nacl = NULL;
1494
1495 lport->lport_loopid_map[loop_id].se_nacl = se_nacl;
1496
1497 sess->loop_id = loop_id;
1498 }
1499
1500 if (sess->s_id.b24 != s_id.b24) {
1501 key = (((u32) sess->s_id.b.domain << 16) |
1502 ((u32) sess->s_id.b.area << 8) |
1503 ((u32) sess->s_id.b.al_pa));
1504
1505 if (btree_lookup32(&lport->lport_fcport_map, key))
1506 WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl,
1507 "Found wrong se_nacl when updating s_id %x:%x:%x\n",
1508 sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);
1509 else
1510 WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n",
1511 sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);
1512
1513 key = (((u32) s_id.b.domain << 16) |
1514 ((u32) s_id.b.area << 8) |
1515 ((u32) s_id.b.al_pa));
1516
1517 if (btree_lookup32(&lport->lport_fcport_map, key)) {
1518 WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n",
1519 s_id.b.domain, s_id.b.area, s_id.b.al_pa);
1520 btree_update32(&lport->lport_fcport_map, key, se_nacl);
1521 } else {
1522 btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC);
1523 }
1524
1525 sess->s_id = s_id;
1526 nacl->nport_id = key;
1527 }
1528
1529 sess->conf_compl_supported = conf_compl_supported;
1530}
1531
1460/* 1532/*
1461 * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. 1533 * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path.
1462 */ 1534 */
@@ -1467,6 +1539,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = {
1467 .free_cmd = tcm_qla2xxx_free_cmd, 1539 .free_cmd = tcm_qla2xxx_free_cmd,
1468 .free_mcmd = tcm_qla2xxx_free_mcmd, 1540 .free_mcmd = tcm_qla2xxx_free_mcmd,
1469 .free_session = tcm_qla2xxx_free_session, 1541 .free_session = tcm_qla2xxx_free_session,
1542 .update_sess = tcm_qla2xxx_update_sess,
1470 .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, 1543 .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,
1471 .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, 1544 .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id,
1472 .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, 1545 .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id,
@@ -1534,6 +1607,7 @@ static struct se_wwn *tcm_qla2xxx_make_lport(
1534 lport->lport_wwpn = wwpn; 1607 lport->lport_wwpn = wwpn;
1535 tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, 1608 tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN,
1536 wwpn); 1609 wwpn);
1610 sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn);
1537 1611
1538 ret = tcm_qla2xxx_init_lport(lport); 1612 ret = tcm_qla2xxx_init_lport(lport);
1539 if (ret != 0) 1613 if (ret != 0)
@@ -1601,6 +1675,7 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport(
1601 lport->lport_npiv_wwnn = npiv_wwnn; 1675 lport->lport_npiv_wwnn = npiv_wwnn;
1602 tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], 1676 tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0],
1603 TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); 1677 TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn);
1678 sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn);
1604 1679
1605/* FIXME: tcm_qla2xxx_npiv_make_lport */ 1680/* FIXME: tcm_qla2xxx_npiv_make_lport */
1606 ret = -ENOSYS; 1681 ret = -ENOSYS;