2012-05-15 12:34:29 -06:00
|
|
|
/*******************************************************************************
|
|
|
|
* This file contains tcm implementation using v4 configfs fabric infrastructure
|
|
|
|
* for QLogic target mode HBAs
|
|
|
|
*
|
2013-09-05 16:29:12 -06:00
|
|
|
* (c) Copyright 2010-2013 Datera, Inc.
|
2012-05-15 12:34:29 -06:00
|
|
|
*
|
2013-09-05 16:29:12 -06:00
|
|
|
* Author: Nicholas A. Bellinger <nab@daterainc.com>
|
2012-05-15 12:34:29 -06:00
|
|
|
*
|
|
|
|
* tcm_qla2xxx_parse_wwn() and tcm_qla2xxx_format_wwn() contains code from
|
|
|
|
* the TCM_FC / Open-FCoE.org fabric module.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 Cisco Systems, Inc
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/utsname.h>
|
2015-05-28 12:35:41 -06:00
|
|
|
#include <linux/vmalloc.h>
|
2012-05-15 12:34:29 -06:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/kthread.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/configfs.h>
|
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <asm/unaligned.h>
|
|
|
|
#include <scsi/scsi.h>
|
|
|
|
#include <scsi/scsi_host.h>
|
|
|
|
#include <scsi/scsi_device.h>
|
|
|
|
#include <scsi/scsi_cmnd.h>
|
|
|
|
#include <target/target_core_base.h>
|
|
|
|
#include <target/target_core_fabric.h>
|
|
|
|
|
|
|
|
#include "qla_def.h"
|
|
|
|
#include "qla_target.h"
|
|
|
|
#include "tcm_qla2xxx.h"
|
|
|
|
|
2014-09-25 04:14:43 -06:00
|
|
|
static struct workqueue_struct *tcm_qla2xxx_free_wq;
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Parse WWN.
|
|
|
|
* If strict, we require lower-case hex and colon separators to be sure
|
|
|
|
* the name is the same as what would be generated by ft_format_wwn()
|
|
|
|
* so the name and wwn are mapped one-to-one.
|
|
|
|
*/
|
|
|
|
static ssize_t tcm_qla2xxx_parse_wwn(const char *name, u64 *wwn, int strict)
|
|
|
|
{
|
|
|
|
const char *cp;
|
|
|
|
char c;
|
|
|
|
u32 nibble;
|
|
|
|
u32 byte = 0;
|
|
|
|
u32 pos = 0;
|
|
|
|
u32 err;
|
|
|
|
|
|
|
|
*wwn = 0;
|
|
|
|
for (cp = name; cp < &name[TCM_QLA2XXX_NAMELEN - 1]; cp++) {
|
|
|
|
c = *cp;
|
|
|
|
if (c == '\n' && cp[1] == '\0')
|
|
|
|
continue;
|
|
|
|
if (strict && pos++ == 2 && byte++ < 7) {
|
|
|
|
pos = 0;
|
|
|
|
if (c == ':')
|
|
|
|
continue;
|
|
|
|
err = 1;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
if (c == '\0') {
|
|
|
|
err = 2;
|
|
|
|
if (strict && byte != 8)
|
|
|
|
goto fail;
|
|
|
|
return cp - name;
|
|
|
|
}
|
|
|
|
err = 3;
|
|
|
|
if (isdigit(c))
|
|
|
|
nibble = c - '0';
|
|
|
|
else if (isxdigit(c) && (islower(c) || !strict))
|
|
|
|
nibble = tolower(c) - 'a' + 10;
|
|
|
|
else
|
|
|
|
goto fail;
|
|
|
|
*wwn = (*wwn << 4) | nibble;
|
|
|
|
}
|
|
|
|
err = 4;
|
|
|
|
fail:
|
|
|
|
pr_debug("err %u len %zu pos %u byte %u\n",
|
|
|
|
err, cp - name, pos, byte);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t tcm_qla2xxx_format_wwn(char *buf, size_t len, u64 wwn)
|
|
|
|
{
|
|
|
|
u8 b[8];
|
|
|
|
|
|
|
|
put_unaligned_be64(wwn, b);
|
|
|
|
return snprintf(buf, len,
|
|
|
|
"%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
|
|
|
|
b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *tcm_qla2xxx_get_fabric_name(void)
|
|
|
|
{
|
|
|
|
return "qla2xxx";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* From drivers/scsi/scsi_transport_fc.c:fc_parse_wwn
|
|
|
|
*/
|
|
|
|
static int tcm_qla2xxx_npiv_extract_wwn(const char *ns, u64 *nm)
|
|
|
|
{
|
2012-06-11 19:31:31 -06:00
|
|
|
unsigned int i, j;
|
2012-05-15 12:34:29 -06:00
|
|
|
u8 wwn[8];
|
|
|
|
|
|
|
|
memset(wwn, 0, sizeof(wwn));
|
|
|
|
|
|
|
|
/* Validate and store the new name */
|
|
|
|
for (i = 0, j = 0; i < 16; i++) {
|
2012-06-11 19:31:31 -06:00
|
|
|
int value;
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
value = hex_to_bin(*ns++);
|
|
|
|
if (value >= 0)
|
|
|
|
j = (j << 4) | value;
|
|
|
|
else
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (i % 2) {
|
|
|
|
wwn[i/2] = j & 0xff;
|
|
|
|
j = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*nm = wwn_to_u64(wwn);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This parsing logic follows drivers/scsi/scsi_transport_fc.c:
|
|
|
|
* store_fc_host_vport_create()
|
|
|
|
*/
|
|
|
|
static int tcm_qla2xxx_npiv_parse_wwn(
|
|
|
|
const char *name,
|
|
|
|
size_t count,
|
|
|
|
u64 *wwpn,
|
|
|
|
u64 *wwnn)
|
|
|
|
{
|
|
|
|
unsigned int cnt = count;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
*wwpn = 0;
|
|
|
|
*wwnn = 0;
|
|
|
|
|
|
|
|
/* count may include a LF at end of string */
|
2014-01-14 21:40:38 -07:00
|
|
|
if (name[cnt-1] == '\n' || name[cnt-1] == 0)
|
2012-05-15 12:34:29 -06:00
|
|
|
cnt--;
|
|
|
|
|
|
|
|
/* validate we have enough characters for WWPN */
|
|
|
|
if ((cnt != (16+1+16)) || (name[16] != ':'))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
rc = tcm_qla2xxx_npiv_extract_wwn(&name[0], wwpn);
|
|
|
|
if (rc != 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
rc = tcm_qla2xxx_npiv_extract_wwn(&name[17], wwnn);
|
|
|
|
if (rc != 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *tcm_qla2xxx_npiv_get_fabric_name(void)
|
|
|
|
{
|
|
|
|
return "qla2xxx_npiv";
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
struct tcm_qla2xxx_lport *lport = tpg->lport;
|
|
|
|
|
tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC
My draft of SPC-4 says the following about the SCSI name string in
inquiry VPD page 83h:
The SCSI NAME STRING field starts with either:
a) the four UTF-8 characters 'eui.' concatenated with 16, 24, or
32 hexadecimal digits (i.e., the UTF-8 characters 0 through 9
and A through F) for an EUI-64 based identifier (see
7.8.6.5). The first hexadecimal digit shall be the most
significant four bits of the first byte (i.e., most significant
byte) of the EUI-64 based identifier;
b) the four UTF-8 characters 'naa.' concatenated with 16 or 32
hexadecimal digits for an NAA identifier (see 7.8.6.6). The
first hexadecimal digit shall be the most significant four bits
of the first byte (i.e., most significant byte) of the NAA
identifier; or
c) the four UTF-8 characters 'iqn.' concatenated with an iSCSI
Name for an iSCSI-name based identifier (see iSCSI).
However, the .tpg_get_wwn method for tcm_qla2xxx formats the WWN so
the SCSI name string looks like "52:4a:93:7d:24:5f:b2:12,t,0x0001".
This patch corrects the code so that VPD 83h gives a SPC-compliant
SCSI name string like "naa.524a937d245fb212,t,0x0001" while leavig
other uses alone (so configfs will still work with ':' separated WWNs).
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Chad Dupuis <chad.dupuis@qlogic.com>
Cc: Arun Easi <arun.easi@qlogic.com>
Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-10-11 14:41:31 -06:00
|
|
|
return lport->lport_naa_name;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
return tpg->lport_tpgt;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_check_demo_mode(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
2013-10-09 12:05:59 -06:00
|
|
|
return tpg->tpg_attrib.generate_node_acls;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_check_demo_mode_cache(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
2013-10-09 12:05:59 -06:00
|
|
|
return tpg->tpg_attrib.cache_dynamic_acls;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_check_demo_write_protect(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
2013-10-09 12:05:59 -06:00
|
|
|
return tpg->tpg_attrib.demo_mode_write_protect;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_check_prod_write_protect(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
2013-10-09 12:05:59 -06:00
|
|
|
return tpg->tpg_attrib.prod_mode_write_protect;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2013-07-19 16:06:38 -06:00
|
|
|
static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
2013-10-09 12:05:59 -06:00
|
|
|
return tpg->tpg_attrib.demo_mode_login_only;
|
2013-07-19 16:06:38 -06:00
|
|
|
}
|
|
|
|
|
2015-03-28 00:30:57 -06:00
|
|
|
static int tcm_qla2xxx_check_prot_fabric_only(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
|
|
|
return tpg->tpg_attrib.fabric_prot_type;
|
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static u32 tcm_qla2xxx_tpg_get_inst_index(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
|
|
|
return tpg->lport_tpgt;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_complete_mcmd(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct qla_tgt_mgmt_cmd *mcmd = container_of(work,
|
|
|
|
struct qla_tgt_mgmt_cmd, free_work);
|
|
|
|
|
|
|
|
transport_generic_free_cmd(&mcmd->se_cmd, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called from qla_target_template->free_mcmd(), and will call
|
|
|
|
* tcm_qla2xxx_release_cmd() via normal struct target_core_fabric_ops
|
|
|
|
* release callback. qla_hw_data->hardware_lock is expected to be held
|
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_free_mcmd(struct qla_tgt_mgmt_cmd *mcmd)
|
|
|
|
{
|
|
|
|
INIT_WORK(&mcmd->free_work, tcm_qla2xxx_complete_mcmd);
|
|
|
|
queue_work(tcm_qla2xxx_free_wq, &mcmd->free_work);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_complete_free(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work);
|
|
|
|
|
2014-09-25 04:14:58 -06:00
|
|
|
cmd->cmd_in_wq = 0;
|
|
|
|
|
2017-01-19 23:27:55 -07:00
|
|
|
WARN_ON(cmd->trc_flags & TRC_CMD_FREE);
|
2014-09-25 04:14:58 -06:00
|
|
|
|
2017-06-13 21:47:28 -06:00
|
|
|
cmd->qpair->tgt_counters.qla_core_ret_sta_ctio++;
|
2017-01-19 23:27:55 -07:00
|
|
|
cmd->trc_flags |= TRC_CMD_FREE;
|
2012-05-15 12:34:29 -06:00
|
|
|
transport_generic_free_cmd(&cmd->se_cmd, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called from qla_target_template->free_cmd(), and will call
|
|
|
|
* tcm_qla2xxx_release_cmd via normal struct target_core_fabric_ops
|
|
|
|
* release callback. qla_hw_data->hardware_lock is expected to be held
|
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
|
|
|
|
{
|
2017-06-13 21:47:28 -06:00
|
|
|
cmd->qpair->tgt_counters.core_qla_free_cmd++;
|
2014-09-25 04:14:58 -06:00
|
|
|
cmd->cmd_in_wq = 1;
|
2015-12-07 17:48:57 -07:00
|
|
|
|
2017-01-19 23:27:55 -07:00
|
|
|
WARN_ON(cmd->trc_flags & TRC_CMD_DONE);
|
|
|
|
cmd->trc_flags |= TRC_CMD_DONE;
|
2015-12-07 17:48:57 -07:00
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free);
|
2015-12-17 12:57:06 -07:00
|
|
|
queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called from struct target_core_fabric_ops->check_stop_free() context
|
|
|
|
*/
|
|
|
|
static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd)
|
|
|
|
{
|
2014-09-25 04:14:58 -06:00
|
|
|
struct qla_tgt_cmd *cmd;
|
|
|
|
|
|
|
|
if ((se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) == 0) {
|
|
|
|
cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd);
|
2017-01-19 23:27:55 -07:00
|
|
|
cmd->trc_flags |= TRC_CMD_CHK_STOP;
|
2014-09-25 04:14:58 -06:00
|
|
|
}
|
|
|
|
|
2015-04-27 05:52:36 -06:00
|
|
|
return target_put_sess_cmd(se_cmd);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tcm_qla2xxx_release_cmd - Callback from TCM Core to release underlying
|
|
|
|
* fabric descriptor @se_cmd command to release
|
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd;
|
|
|
|
|
|
|
|
if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) {
|
|
|
|
struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_mgmt_cmd, se_cmd);
|
|
|
|
qlt_free_mcmd(mcmd);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd);
|
|
|
|
qlt_free_cmd(cmd);
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
static void tcm_qla2xxx_release_session(struct kref *kref)
|
|
|
|
{
|
|
|
|
struct fc_port *sess = container_of(kref,
|
|
|
|
struct fc_port, sess_kref);
|
|
|
|
|
|
|
|
qlt_unreg_sess(sess);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_put_sess(struct fc_port *sess)
|
|
|
|
{
|
|
|
|
if (!sess)
|
|
|
|
return;
|
|
|
|
|
|
|
|
assert_spin_locked(&sess->vha->hw->tgt.sess_lock);
|
|
|
|
kref_put(&sess->sess_kref, tcm_qla2xxx_release_session);
|
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static void tcm_qla2xxx_close_session(struct se_session *se_sess)
|
|
|
|
{
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *sess = se_sess->fabric_sess_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
struct scsi_qla_host *vha;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
BUG_ON(!sess);
|
|
|
|
vha = sess->vha;
|
|
|
|
|
2015-12-17 12:57:04 -07:00
|
|
|
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
|
2016-05-02 07:45:23 -06:00
|
|
|
target_sess_cmd_list_set_waiting(se_sess);
|
2017-01-19 23:27:59 -07:00
|
|
|
tcm_qla2xxx_put_sess(sess);
|
2015-12-17 12:57:04 -07:00
|
|
|
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static u32 tcm_qla2xxx_sess_get_index(struct se_session *se_sess)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_cmd, se_cmd);
|
2015-12-07 17:48:57 -07:00
|
|
|
|
|
|
|
if (cmd->aborted) {
|
|
|
|
/* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task
|
|
|
|
* can get ahead of this cmd. tcm_qla2xxx_aborted_task
|
|
|
|
* already kick start the free.
|
|
|
|
*/
|
|
|
|
pr_debug("write_pending aborted cmd[%p] refcount %d "
|
|
|
|
"transport_state %x, t_state %x, se_cmd_flags %x\n",
|
2016-11-14 09:29:48 -07:00
|
|
|
cmd, kref_read(&cmd->se_cmd.cmd_kref),
|
2015-12-07 17:48:57 -07:00
|
|
|
cmd->se_cmd.transport_state,
|
|
|
|
cmd->se_cmd.t_state,
|
|
|
|
cmd->se_cmd.se_cmd_flags);
|
|
|
|
return 0;
|
|
|
|
}
|
2017-01-19 23:27:55 -07:00
|
|
|
cmd->trc_flags |= TRC_XFR_RDY;
|
2012-05-15 12:34:29 -06:00
|
|
|
cmd->bufflen = se_cmd->data_length;
|
2013-08-21 15:54:54 -06:00
|
|
|
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
cmd->sg_cnt = se_cmd->t_data_nents;
|
|
|
|
cmd->sg = se_cmd->t_data_sg;
|
|
|
|
|
2014-04-11 14:54:43 -06:00
|
|
|
cmd->prot_sg_cnt = se_cmd->t_prot_nents;
|
|
|
|
cmd->prot_sg = se_cmd->t_prot_sg;
|
|
|
|
cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size;
|
|
|
|
se_cmd->pi_err = 0;
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* qla_target.c:qlt_rdy_to_xfer() will call pci_map_sg() to setup
|
|
|
|
* the SGL mappings into PCIe memory for incoming FCP WRITE data.
|
|
|
|
*/
|
|
|
|
return qlt_rdy_to_xfer(cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_write_pending_status(struct se_cmd *se_cmd)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
/*
|
|
|
|
* Check for WRITE_PENDING status to determine if we need to wait for
|
|
|
|
* CTIO aborts to be posted via hardware in tcm_qla2xxx_handle_data().
|
|
|
|
*/
|
|
|
|
spin_lock_irqsave(&se_cmd->t_state_lock, flags);
|
|
|
|
if (se_cmd->t_state == TRANSPORT_WRITE_PENDING ||
|
|
|
|
se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) {
|
|
|
|
spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
|
|
|
|
wait_for_completion_timeout(&se_cmd->t_transport_stop_comp,
|
2015-12-07 17:48:57 -07:00
|
|
|
50);
|
2012-05-15 12:34:29 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd)
|
|
|
|
{
|
2015-07-21 16:07:55 -06:00
|
|
|
if (!(se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) {
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_cmd, se_cmd);
|
|
|
|
return cmd->state;
|
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called from process context in qla_target.c:qlt_do_work() code
|
|
|
|
*/
|
|
|
|
static int tcm_qla2xxx_handle_cmd(scsi_qla_host_t *vha, struct qla_tgt_cmd *cmd,
|
|
|
|
unsigned char *cdb, uint32_t data_length, int fcp_task_attr,
|
|
|
|
int data_dir, int bidi)
|
|
|
|
{
|
|
|
|
struct se_cmd *se_cmd = &cmd->se_cmd;
|
|
|
|
struct se_session *se_sess;
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *sess;
|
2016-05-10 02:23:17 -06:00
|
|
|
#ifdef CONFIG_TCM_QLA2XXX_DEBUG
|
|
|
|
struct se_portal_group *se_tpg;
|
|
|
|
struct tcm_qla2xxx_tpg *tpg;
|
|
|
|
#endif
|
2012-05-15 12:34:29 -06:00
|
|
|
int flags = TARGET_SCF_ACK_KREF;
|
|
|
|
|
|
|
|
if (bidi)
|
|
|
|
flags |= TARGET_SCF_BIDI_OP;
|
|
|
|
|
2016-02-10 16:59:14 -07:00
|
|
|
if (se_cmd->cpuid != WORK_CPU_UNBOUND)
|
|
|
|
flags |= TARGET_SCF_USE_CPUID;
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
sess = cmd->sess;
|
|
|
|
if (!sess) {
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_err("Unable to locate struct fc_port from qla_tgt_cmd\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
se_sess = sess->se_sess;
|
|
|
|
if (!se_sess) {
|
|
|
|
pr_err("Unable to locate active struct se_session\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2016-05-10 02:23:17 -06:00
|
|
|
#ifdef CONFIG_TCM_QLA2XXX_DEBUG
|
|
|
|
se_tpg = se_sess->se_tpg;
|
|
|
|
tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
if (unlikely(tpg->tpg_attrib.jam_host)) {
|
|
|
|
/* return, and dont run target_submit_cmd,discarding command */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-06-13 21:47:28 -06:00
|
|
|
cmd->qpair->tgt_counters.qla_core_sbt_cmd++;
|
2012-07-16 12:04:39 -06:00
|
|
|
return target_submit_cmd(se_cmd, se_sess, cdb, &cmd->sense_buffer[0],
|
2012-05-15 12:34:29 -06:00
|
|
|
cmd->unpacked_lun, data_length, fcp_task_attr,
|
|
|
|
data_dir, flags);
|
|
|
|
}
|
|
|
|
|
2012-07-08 13:58:44 -06:00
|
|
|
static void tcm_qla2xxx_handle_data_work(struct work_struct *work)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure that the complete FCP WRITE payload has been received.
|
|
|
|
* Otherwise return an exception via CHECK_CONDITION status.
|
|
|
|
*/
|
2014-09-25 04:14:58 -06:00
|
|
|
cmd->cmd_in_wq = 0;
|
2015-12-07 17:48:57 -07:00
|
|
|
|
2017-06-13 21:47:28 -06:00
|
|
|
cmd->qpair->tgt_counters.qla_core_ret_ctio++;
|
2012-05-15 12:34:29 -06:00
|
|
|
if (!cmd->write_data_transferred) {
|
|
|
|
/*
|
|
|
|
* Check if se_cmd has already been aborted via LUN_RESET, and
|
|
|
|
* waiting upon completion in tcm_qla2xxx_write_pending_status()
|
|
|
|
*/
|
2012-07-08 13:58:44 -06:00
|
|
|
if (cmd->se_cmd.transport_state & CMD_T_ABORTED) {
|
|
|
|
complete(&cmd->se_cmd.t_transport_stop_comp);
|
|
|
|
return;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2017-03-15 10:48:49 -06:00
|
|
|
switch (cmd->dif_err_code) {
|
|
|
|
case DIF_ERR_GRD:
|
|
|
|
cmd->se_cmd.pi_err =
|
|
|
|
TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED;
|
|
|
|
break;
|
|
|
|
case DIF_ERR_REF:
|
|
|
|
cmd->se_cmd.pi_err =
|
|
|
|
TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED;
|
|
|
|
break;
|
|
|
|
case DIF_ERR_APP:
|
|
|
|
cmd->se_cmd.pi_err =
|
|
|
|
TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED;
|
|
|
|
break;
|
|
|
|
case DIF_ERR_NONE:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-04-11 14:54:43 -06:00
|
|
|
if (cmd->se_cmd.pi_err)
|
|
|
|
transport_generic_request_failure(&cmd->se_cmd,
|
|
|
|
cmd->se_cmd.pi_err);
|
|
|
|
else
|
|
|
|
transport_generic_request_failure(&cmd->se_cmd,
|
|
|
|
TCM_CHECK_CONDITION_ABORT_CMD);
|
|
|
|
|
2012-07-08 13:58:44 -06:00
|
|
|
return;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
2012-07-08 13:58:44 -06:00
|
|
|
|
|
|
|
return target_execute_cmd(&cmd->se_cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called from qla_target.c:qlt_do_ctio_completion()
|
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
|
|
|
|
{
|
2017-01-19 23:27:55 -07:00
|
|
|
cmd->trc_flags |= TRC_DATA_IN;
|
2014-09-25 04:14:58 -06:00
|
|
|
cmd->cmd_in_wq = 1;
|
2012-07-08 13:58:44 -06:00
|
|
|
INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
|
2015-12-17 12:57:06 -07:00
|
|
|
queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2017-03-15 10:48:49 -06:00
|
|
|
static int tcm_qla2xxx_chk_dif_tags(uint32_t tag)
|
2014-04-11 14:54:43 -06:00
|
|
|
{
|
2017-03-15 10:48:49 -06:00
|
|
|
return 0;
|
2014-04-11 14:54:43 -06:00
|
|
|
}
|
|
|
|
|
2017-03-15 10:48:49 -06:00
|
|
|
static int tcm_qla2xxx_dif_tags(struct qla_tgt_cmd *cmd,
|
|
|
|
uint16_t *pfw_prot_opts)
|
2014-04-11 14:54:43 -06:00
|
|
|
{
|
2017-03-15 10:48:49 -06:00
|
|
|
struct se_cmd *se_cmd = &cmd->se_cmd;
|
|
|
|
|
|
|
|
if (!(se_cmd->prot_checks & TARGET_DIF_CHECK_GUARD))
|
|
|
|
*pfw_prot_opts |= PO_DISABLE_GUARD_CHECK;
|
|
|
|
|
|
|
|
if (!(se_cmd->prot_checks & TARGET_DIF_CHECK_APPTAG))
|
|
|
|
*pfw_prot_opts |= PO_DIS_APP_TAG_VALD;
|
|
|
|
|
|
|
|
return 0;
|
2014-04-11 14:54:43 -06:00
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Called from qla_target.c:qlt_issue_task_mgmt()
|
|
|
|
*/
|
2017-06-02 10:11:59 -06:00
|
|
|
static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, u64 lun,
|
2017-01-19 23:27:54 -07:00
|
|
|
uint16_t tmr_func, uint32_t tag)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *sess = mcmd->sess;
|
2012-05-15 12:34:29 -06:00
|
|
|
struct se_cmd *se_cmd = &mcmd->se_cmd;
|
2017-01-19 23:27:54 -07:00
|
|
|
int transl_tmr_func = 0;
|
2017-06-03 08:07:21 -06:00
|
|
|
int flags = TARGET_SCF_ACK_KREF;
|
2017-01-19 23:27:54 -07:00
|
|
|
|
|
|
|
switch (tmr_func) {
|
|
|
|
case QLA_TGT_ABTS:
|
|
|
|
pr_debug("%ld: ABTS received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_ABORT_TASK;
|
2017-06-03 08:07:21 -06:00
|
|
|
flags |= TARGET_SCF_LOOKUP_LUN_FROM_TAG;
|
2017-01-19 23:27:54 -07:00
|
|
|
break;
|
|
|
|
case QLA_TGT_2G_ABORT_TASK:
|
|
|
|
pr_debug("%ld: 2G Abort Task received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_ABORT_TASK;
|
|
|
|
break;
|
|
|
|
case QLA_TGT_CLEAR_ACA:
|
|
|
|
pr_debug("%ld: CLEAR_ACA received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_CLEAR_ACA;
|
|
|
|
break;
|
|
|
|
case QLA_TGT_TARGET_RESET:
|
|
|
|
pr_debug("%ld: TARGET_RESET received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_TARGET_WARM_RESET;
|
|
|
|
break;
|
|
|
|
case QLA_TGT_LUN_RESET:
|
|
|
|
pr_debug("%ld: LUN_RESET received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_LUN_RESET;
|
|
|
|
break;
|
|
|
|
case QLA_TGT_CLEAR_TS:
|
|
|
|
pr_debug("%ld: CLEAR_TS received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_CLEAR_TASK_SET;
|
|
|
|
break;
|
|
|
|
case QLA_TGT_ABORT_TS:
|
|
|
|
pr_debug("%ld: ABORT_TS received\n", sess->vha->host_no);
|
|
|
|
transl_tmr_func = TMR_ABORT_TASK_SET;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
pr_debug("%ld: Unknown task mgmt fn 0x%x\n",
|
|
|
|
sess->vha->host_no, tmr_func);
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
return target_submit_tmr(se_cmd, sess->se_sess, NULL, lun, mcmd,
|
2017-06-03 08:07:21 -06:00
|
|
|
transl_tmr_func, GFP_ATOMIC, tag, flags);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2018-05-01 10:01:53 -06:00
|
|
|
static struct qla_tgt_cmd *tcm_qla2xxx_find_cmd_by_tag(struct fc_port *sess,
|
|
|
|
uint64_t tag)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = NULL;
|
|
|
|
struct se_cmd *secmd;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
if (!sess->se_sess)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&sess->se_sess->sess_cmd_lock, flags);
|
|
|
|
list_for_each_entry(secmd, &sess->se_sess->sess_cmd_list, se_cmd_list) {
|
|
|
|
/* skip task management functions, including tmr->task_cmd */
|
|
|
|
if (secmd->se_cmd_flags & SCF_SCSI_TMR_CDB)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (secmd->tag == tag) {
|
|
|
|
cmd = container_of(secmd, struct qla_tgt_cmd, se_cmd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&sess->se_sess->sess_cmd_lock, flags);
|
|
|
|
|
|
|
|
return cmd;
|
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_cmd, se_cmd);
|
|
|
|
|
2015-12-07 17:48:57 -07:00
|
|
|
if (cmd->aborted) {
|
|
|
|
/* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task
|
|
|
|
* can get ahead of this cmd. tcm_qla2xxx_aborted_task
|
|
|
|
* already kick start the free.
|
|
|
|
*/
|
|
|
|
pr_debug("queue_data_in aborted cmd[%p] refcount %d "
|
|
|
|
"transport_state %x, t_state %x, se_cmd_flags %x\n",
|
2016-11-14 09:29:48 -07:00
|
|
|
cmd, kref_read(&cmd->se_cmd.cmd_kref),
|
2015-12-07 17:48:57 -07:00
|
|
|
cmd->se_cmd.transport_state,
|
|
|
|
cmd->se_cmd.t_state,
|
|
|
|
cmd->se_cmd.se_cmd_flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:55 -07:00
|
|
|
cmd->trc_flags |= TRC_XMIT_DATA;
|
2012-05-15 12:34:29 -06:00
|
|
|
cmd->bufflen = se_cmd->data_length;
|
2013-08-21 15:54:54 -06:00
|
|
|
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
cmd->sg_cnt = se_cmd->t_data_nents;
|
|
|
|
cmd->sg = se_cmd->t_data_sg;
|
|
|
|
cmd->offset = 0;
|
|
|
|
|
2014-04-11 14:54:43 -06:00
|
|
|
cmd->prot_sg_cnt = se_cmd->t_prot_nents;
|
|
|
|
cmd->prot_sg = se_cmd->t_prot_sg;
|
|
|
|
cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size;
|
|
|
|
se_cmd->pi_err = 0;
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Now queue completed DATA_IN the qla2xxx LLD and response ring
|
|
|
|
*/
|
|
|
|
return qlt_xmit_response(cmd, QLA_TGT_XMIT_DATA|QLA_TGT_XMIT_STATUS,
|
|
|
|
se_cmd->scsi_status);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_cmd, se_cmd);
|
|
|
|
int xmit_type = QLA_TGT_XMIT_STATUS;
|
|
|
|
|
2017-06-02 10:11:57 -06:00
|
|
|
if (cmd->aborted) {
|
|
|
|
/*
|
|
|
|
* Cmd can loop during Q-full. tcm_qla2xxx_aborted_task
|
|
|
|
* can get ahead of this cmd. tcm_qla2xxx_aborted_task
|
|
|
|
* already kick start the free.
|
|
|
|
*/
|
|
|
|
pr_debug(
|
|
|
|
"queue_data_in aborted cmd[%p] refcount %d transport_state %x, t_state %x, se_cmd_flags %x\n",
|
|
|
|
cmd, kref_read(&cmd->se_cmd.cmd_kref),
|
|
|
|
cmd->se_cmd.transport_state, cmd->se_cmd.t_state,
|
|
|
|
cmd->se_cmd.se_cmd_flags);
|
|
|
|
return 0;
|
|
|
|
}
|
2012-05-15 12:34:29 -06:00
|
|
|
cmd->bufflen = se_cmd->data_length;
|
|
|
|
cmd->sg = NULL;
|
|
|
|
cmd->sg_cnt = 0;
|
|
|
|
cmd->offset = 0;
|
2013-08-21 15:54:54 -06:00
|
|
|
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
|
2017-01-19 23:27:55 -07:00
|
|
|
if (cmd->trc_flags & TRC_XMIT_STATUS) {
|
|
|
|
pr_crit("Multiple calls for status = %p.\n", cmd);
|
2014-09-25 04:14:58 -06:00
|
|
|
dump_stack();
|
|
|
|
}
|
2017-01-19 23:27:55 -07:00
|
|
|
cmd->trc_flags |= TRC_XMIT_STATUS;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
if (se_cmd->data_direction == DMA_FROM_DEVICE) {
|
|
|
|
/*
|
|
|
|
* For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen
|
|
|
|
* for qla_tgt_xmit_response LLD code
|
|
|
|
*/
|
2013-06-05 10:54:17 -06:00
|
|
|
if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) {
|
|
|
|
se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT;
|
|
|
|
se_cmd->residual_count = 0;
|
|
|
|
}
|
2012-05-15 12:34:29 -06:00
|
|
|
se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT;
|
2013-06-05 10:54:17 -06:00
|
|
|
se_cmd->residual_count += se_cmd->data_length;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
cmd->bufflen = 0;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Now queue status response to qla2xxx LLD code and response ring
|
|
|
|
*/
|
|
|
|
return qlt_xmit_response(cmd, xmit_type, se_cmd->scsi_status);
|
|
|
|
}
|
|
|
|
|
2013-07-03 09:22:17 -06:00
|
|
|
static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
|
|
|
struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
|
|
|
|
struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_mgmt_cmd, se_cmd);
|
|
|
|
|
|
|
|
pr_debug("queue_tm_rsp: mcmd: %p func: 0x%02x response: 0x%02x\n",
|
|
|
|
mcmd, se_tmr->function, se_tmr->response);
|
|
|
|
/*
|
|
|
|
* Do translation between TCM TM response codes and
|
|
|
|
* QLA2xxx FC TM response codes.
|
|
|
|
*/
|
|
|
|
switch (se_tmr->response) {
|
|
|
|
case TMR_FUNCTION_COMPLETE:
|
|
|
|
mcmd->fc_tm_rsp = FC_TM_SUCCESS;
|
|
|
|
break;
|
|
|
|
case TMR_TASK_DOES_NOT_EXIST:
|
|
|
|
mcmd->fc_tm_rsp = FC_TM_BAD_CMD;
|
|
|
|
break;
|
|
|
|
case TMR_FUNCTION_REJECTED:
|
|
|
|
mcmd->fc_tm_rsp = FC_TM_REJECT;
|
|
|
|
break;
|
|
|
|
case TMR_LUN_DOES_NOT_EXIST:
|
|
|
|
default:
|
|
|
|
mcmd->fc_tm_rsp = FC_TM_FAILED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Queue the TM response to QLA2xxx LLD to build a
|
|
|
|
* CTIO response packet.
|
|
|
|
*/
|
|
|
|
qlt_xmit_tm_rsp(mcmd);
|
|
|
|
}
|
|
|
|
|
2014-03-22 15:55:56 -06:00
|
|
|
static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd)
|
|
|
|
{
|
|
|
|
struct qla_tgt_cmd *cmd = container_of(se_cmd,
|
|
|
|
struct qla_tgt_cmd, se_cmd);
|
2015-12-07 17:48:57 -07:00
|
|
|
|
|
|
|
if (qlt_abort_cmd(cmd))
|
|
|
|
return;
|
2014-03-22 15:55:56 -06:00
|
|
|
}
|
|
|
|
|
2012-05-18 16:37:53 -06:00
|
|
|
static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *,
|
2017-01-19 23:27:59 -07:00
|
|
|
struct tcm_qla2xxx_nacl *, struct fc_port *);
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
2015-12-17 12:57:04 -07:00
|
|
|
* Expected to be called with struct qla_hw_data->tgt.sess_lock held
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
2017-01-19 23:27:59 -07:00
|
|
|
static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct fc_port *sess)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
|
|
|
struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
|
|
|
|
struct se_portal_group *se_tpg = se_nacl->se_tpg;
|
|
|
|
struct se_wwn *se_wwn = se_tpg->se_tpg_wwn;
|
|
|
|
struct tcm_qla2xxx_lport *lport = container_of(se_wwn,
|
|
|
|
struct tcm_qla2xxx_lport, lport_wwn);
|
|
|
|
struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
|
|
|
|
struct tcm_qla2xxx_nacl, se_node_acl);
|
|
|
|
void *node;
|
|
|
|
|
|
|
|
pr_debug("fc_rport domain: port_id 0x%06x\n", nacl->nport_id);
|
|
|
|
|
|
|
|
node = btree_remove32(&lport->lport_fcport_map, nacl->nport_id);
|
2014-10-03 15:35:56 -06:00
|
|
|
if (WARN_ON(node && (node != se_nacl))) {
|
|
|
|
/*
|
|
|
|
* The nacl no longer matches what we think it should be.
|
|
|
|
* Most likely a new dynamic acl has been added while
|
|
|
|
* someone dropped the hardware lock. It clearly is a
|
|
|
|
* bug elsewhere, but this bit can't make things worse.
|
|
|
|
*/
|
|
|
|
btree_insert32(&lport->lport_fcport_map, nacl->nport_id,
|
|
|
|
node, GFP_ATOMIC);
|
|
|
|
}
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
pr_debug("Removed from fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%06x\n",
|
|
|
|
se_nacl, nacl->nport_wwnn, nacl->nport_id);
|
2012-05-18 16:37:53 -06:00
|
|
|
/*
|
|
|
|
* Now clear the se_nacl and session pointers from our HW lport lookup
|
|
|
|
* table mapping for this initiator's fabric S_ID and LOOP_ID entries.
|
|
|
|
*
|
|
|
|
* This is done ahead of callbacks into tcm_qla2xxx_free_session() ->
|
|
|
|
* target_wait_for_sess_cmds() before the session waits for outstanding
|
|
|
|
* I/O to complete, to avoid a race between session shutdown execution
|
|
|
|
* and incoming ATIOs or TMRs picking up a stale se_node_act reference.
|
|
|
|
*/
|
|
|
|
tcm_qla2xxx_clear_sess_lookup(lport, nacl, sess);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
static void tcm_qla2xxx_shutdown_sess(struct fc_port *sess)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
2015-12-17 12:57:04 -07:00
|
|
|
assert_spin_locked(&sess->vha->hw->tgt.sess_lock);
|
2013-06-12 14:27:54 -06:00
|
|
|
target_sess_cmd_list_set_waiting(sess->se_sess);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2015-04-13 11:51:14 -06:00
|
|
|
static int tcm_qla2xxx_init_nodeacl(struct se_node_acl *se_nacl,
|
|
|
|
const char *name)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
2015-04-13 11:51:14 -06:00
|
|
|
struct tcm_qla2xxx_nacl *nacl =
|
|
|
|
container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl);
|
2012-05-15 12:34:29 -06:00
|
|
|
u64 wwnn;
|
|
|
|
|
|
|
|
if (tcm_qla2xxx_parse_wwn(name, &wwnn, 1) < 0)
|
2015-04-13 11:51:14 -06:00
|
|
|
return -EINVAL;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
nacl->nport_wwnn = wwnn;
|
|
|
|
tcm_qla2xxx_format_wwn(&nacl->nport_name[0], TCM_QLA2XXX_NAMELEN, wwnn);
|
|
|
|
|
2015-04-13 11:51:14 -06:00
|
|
|
return 0;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Start items for tcm_qla2xxx_tpg_attrib_cit */
|
|
|
|
|
|
|
|
#define DEF_QLA_TPG_ATTRIB(name) \
|
|
|
|
\
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_attrib_##name##_show( \
|
|
|
|
struct config_item *item, char *page) \
|
2012-05-15 12:34:29 -06:00
|
|
|
{ \
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = attrib_to_tpg(item); \
|
2012-05-15 12:34:29 -06:00
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg); \
|
|
|
|
\
|
2013-10-09 12:05:59 -06:00
|
|
|
return sprintf(page, "%u\n", tpg->tpg_attrib.name); \
|
2012-05-15 12:34:29 -06:00
|
|
|
} \
|
|
|
|
\
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_attrib_##name##_store( \
|
|
|
|
struct config_item *item, const char *page, size_t count) \
|
2012-05-15 12:34:29 -06:00
|
|
|
{ \
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = attrib_to_tpg(item); \
|
2012-05-15 12:34:29 -06:00
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg); \
|
2015-10-03 07:32:55 -06:00
|
|
|
struct tcm_qla2xxx_tpg_attrib *a = &tpg->tpg_attrib; \
|
2012-05-15 12:34:29 -06:00
|
|
|
unsigned long val; \
|
|
|
|
int ret; \
|
|
|
|
\
|
|
|
|
ret = kstrtoul(page, 0, &val); \
|
|
|
|
if (ret < 0) { \
|
|
|
|
pr_err("kstrtoul() failed with" \
|
|
|
|
" ret: %d\n", ret); \
|
|
|
|
return -EINVAL; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
if ((val != 0) && (val != 1)) { \
|
|
|
|
pr_err("Illegal boolean value %lu\n", val); \
|
|
|
|
return -EINVAL; \
|
|
|
|
} \
|
|
|
|
\
|
2015-10-03 07:32:55 -06:00
|
|
|
a->name = val; \
|
|
|
|
\
|
|
|
|
return count; \
|
|
|
|
} \
|
|
|
|
CONFIGFS_ATTR(tcm_qla2xxx_tpg_attrib_, name)
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
DEF_QLA_TPG_ATTRIB(generate_node_acls);
|
|
|
|
DEF_QLA_TPG_ATTRIB(cache_dynamic_acls);
|
|
|
|
DEF_QLA_TPG_ATTRIB(demo_mode_write_protect);
|
|
|
|
DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);
|
2013-07-19 16:06:38 -06:00
|
|
|
DEF_QLA_TPG_ATTRIB(demo_mode_login_only);
|
2016-05-10 02:23:17 -06:00
|
|
|
#ifdef CONFIG_TCM_QLA2XXX_DEBUG
|
|
|
|
DEF_QLA_TPG_ATTRIB(jam_host);
|
|
|
|
#endif
|
2013-07-19 16:06:38 -06:00
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {
|
2015-10-03 07:32:55 -06:00
|
|
|
&tcm_qla2xxx_tpg_attrib_attr_generate_node_acls,
|
|
|
|
&tcm_qla2xxx_tpg_attrib_attr_cache_dynamic_acls,
|
|
|
|
&tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect,
|
|
|
|
&tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect,
|
|
|
|
&tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only,
|
2016-05-10 02:23:17 -06:00
|
|
|
#ifdef CONFIG_TCM_QLA2XXX_DEBUG
|
|
|
|
&tcm_qla2xxx_tpg_attrib_attr_jam_host,
|
|
|
|
#endif
|
2012-05-15 12:34:29 -06:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* End items for tcm_qla2xxx_tpg_attrib_cit */
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_enable_show(struct config_item *item,
|
|
|
|
char *page)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = to_tpg(item);
|
2012-05-15 12:34:29 -06:00
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
|
|
|
return snprintf(page, PAGE_SIZE, "%d\n",
|
|
|
|
atomic_read(&tpg->lport_tpg_enabled));
|
|
|
|
}
|
|
|
|
|
2014-02-19 17:53:07 -07:00
|
|
|
static void tcm_qla2xxx_depend_tpg(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *base_tpg = container_of(work,
|
|
|
|
struct tcm_qla2xxx_tpg, tpg_base_work);
|
|
|
|
struct se_portal_group *se_tpg = &base_tpg->se_tpg;
|
|
|
|
struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha;
|
|
|
|
|
2015-05-03 00:50:52 -06:00
|
|
|
if (!target_depend_item(&se_tpg->tpg_group.cg_item)) {
|
2014-02-19 17:53:07 -07:00
|
|
|
atomic_set(&base_tpg->lport_tpg_enabled, 1);
|
|
|
|
qlt_enable_vha(base_vha);
|
|
|
|
}
|
|
|
|
complete(&base_tpg->tpg_base_comp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_undepend_tpg(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *base_tpg = container_of(work,
|
|
|
|
struct tcm_qla2xxx_tpg, tpg_base_work);
|
|
|
|
struct se_portal_group *se_tpg = &base_tpg->se_tpg;
|
|
|
|
struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha;
|
|
|
|
|
|
|
|
if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) {
|
|
|
|
atomic_set(&base_tpg->lport_tpg_enabled, 0);
|
2015-05-03 00:50:52 -06:00
|
|
|
target_undepend_item(&se_tpg->tpg_group.cg_item);
|
2014-02-19 17:53:07 -07:00
|
|
|
}
|
|
|
|
complete(&base_tpg->tpg_base_comp);
|
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,
|
|
|
|
const char *page, size_t count)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = to_tpg(item);
|
2012-05-15 12:34:29 -06:00
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
unsigned long op;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = kstrtoul(page, 0, &op);
|
|
|
|
if (rc < 0) {
|
|
|
|
pr_err("kstrtoul() returned %d\n", rc);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if ((op != 1) && (op != 0)) {
|
|
|
|
pr_err("Illegal value for tpg_enable: %lu\n", op);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (op) {
|
2014-02-19 17:53:07 -07:00
|
|
|
if (atomic_read(&tpg->lport_tpg_enabled))
|
|
|
|
return -EEXIST;
|
|
|
|
|
|
|
|
INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_depend_tpg);
|
2012-05-15 12:34:29 -06:00
|
|
|
} else {
|
2014-02-19 17:53:07 -07:00
|
|
|
if (!atomic_read(&tpg->lport_tpg_enabled))
|
|
|
|
return count;
|
|
|
|
|
|
|
|
INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_undepend_tpg);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
2014-02-19 17:53:07 -07:00
|
|
|
init_completion(&tpg->tpg_base_comp);
|
|
|
|
schedule_work(&tpg->tpg_base_work);
|
|
|
|
wait_for_completion(&tpg->tpg_base_comp);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
2014-02-19 17:53:07 -07:00
|
|
|
if (op) {
|
|
|
|
if (!atomic_read(&tpg->lport_tpg_enabled))
|
|
|
|
return -ENODEV;
|
|
|
|
} else {
|
|
|
|
if (atomic_read(&tpg->lport_tpg_enabled))
|
|
|
|
return -EPERM;
|
|
|
|
}
|
2012-05-15 12:34:29 -06:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_dynamic_sessions_show(struct config_item *item,
|
|
|
|
char *page)
|
2015-03-06 21:43:34 -07:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
return target_show_dynamic_sessions(to_tpg(item), page);
|
2015-03-06 21:43:34 -07:00
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_store(struct config_item *item,
|
|
|
|
const char *page, size_t count)
|
2015-03-28 00:30:57 -06:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = to_tpg(item);
|
2015-03-28 00:30:57 -06:00
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
unsigned long val;
|
|
|
|
int ret = kstrtoul(page, 0, &val);
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
pr_err("kstrtoul() returned %d for fabric_prot_type\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
if (val != 0 && val != 1 && val != 3) {
|
|
|
|
pr_err("Invalid qla2xxx fabric_prot_type: %lu\n", val);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
tpg->tpg_attrib.fabric_prot_type = val;
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_show(struct config_item *item,
|
|
|
|
char *page)
|
2015-03-28 00:30:57 -06:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = to_tpg(item);
|
2015-03-28 00:30:57 -06:00
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
|
|
|
|
return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type);
|
|
|
|
}
|
2015-10-03 07:32:55 -06:00
|
|
|
|
2015-11-24 10:20:15 -07:00
|
|
|
CONFIGFS_ATTR(tcm_qla2xxx_tpg_, enable);
|
2015-10-03 07:32:55 -06:00
|
|
|
CONFIGFS_ATTR_RO(tcm_qla2xxx_tpg_, dynamic_sessions);
|
|
|
|
CONFIGFS_ATTR(tcm_qla2xxx_tpg_, fabric_prot_type);
|
2015-03-28 00:30:57 -06:00
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = {
|
2015-10-03 07:32:55 -06:00
|
|
|
&tcm_qla2xxx_tpg_attr_enable,
|
|
|
|
&tcm_qla2xxx_tpg_attr_dynamic_sessions,
|
|
|
|
&tcm_qla2xxx_tpg_attr_fabric_prot_type,
|
2012-05-15 12:34:29 -06:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct se_portal_group *tcm_qla2xxx_make_tpg(
|
|
|
|
struct se_wwn *wwn,
|
|
|
|
struct config_group *group,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport = container_of(wwn,
|
|
|
|
struct tcm_qla2xxx_lport, lport_wwn);
|
|
|
|
struct tcm_qla2xxx_tpg *tpg;
|
|
|
|
unsigned long tpgt;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (strstr(name, "tpgt_") != name)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
if (kstrtoul(name + 5, 10, &tpgt) || tpgt > USHRT_MAX)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
if ((tpgt != 1)) {
|
2012-05-15 12:34:29 -06:00
|
|
|
pr_err("In non NPIV mode, a single TPG=1 is used for HW port mappings\n");
|
|
|
|
return ERR_PTR(-ENOSYS);
|
|
|
|
}
|
|
|
|
|
|
|
|
tpg = kzalloc(sizeof(struct tcm_qla2xxx_tpg), GFP_KERNEL);
|
|
|
|
if (!tpg) {
|
|
|
|
pr_err("Unable to allocate struct tcm_qla2xxx_tpg\n");
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
}
|
|
|
|
tpg->lport = lport;
|
|
|
|
tpg->lport_tpgt = tpgt;
|
|
|
|
/*
|
|
|
|
* By default allow READ-ONLY TPG demo-mode access w/ cached dynamic
|
|
|
|
* NodeACLs
|
|
|
|
*/
|
2013-10-09 12:05:59 -06:00
|
|
|
tpg->tpg_attrib.generate_node_acls = 1;
|
|
|
|
tpg->tpg_attrib.demo_mode_write_protect = 1;
|
|
|
|
tpg->tpg_attrib.cache_dynamic_acls = 1;
|
|
|
|
tpg->tpg_attrib.demo_mode_login_only = 1;
|
2016-05-10 02:23:17 -06:00
|
|
|
tpg->tpg_attrib.jam_host = 0;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
2015-05-20 22:48:03 -06:00
|
|
|
ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);
|
2012-05-15 12:34:29 -06:00
|
|
|
if (ret < 0) {
|
|
|
|
kfree(tpg);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-01-14 21:40:38 -07:00
|
|
|
|
|
|
|
lport->tpg_1 = tpg;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
return &tpg->se_tpg;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
struct tcm_qla2xxx_lport *lport = tpg->lport;
|
|
|
|
struct scsi_qla_host *vha = lport->qla_vha;
|
|
|
|
/*
|
|
|
|
* Call into qla2x_target.c LLD logic to shutdown the active
|
|
|
|
* FC Nexuses and disable target mode operation for this qla_hw_data
|
|
|
|
*/
|
2014-01-14 21:40:38 -07:00
|
|
|
if (vha->vha_tgt.qla_tgt && !vha->vha_tgt.qla_tgt->tgt_stop)
|
|
|
|
qlt_stop_phase1(vha->vha_tgt.qla_tgt);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
core_tpg_deregister(se_tpg);
|
|
|
|
/*
|
|
|
|
* Clear local TPG=1 pointer for non NPIV mode.
|
|
|
|
*/
|
2014-02-19 17:52:15 -07:00
|
|
|
lport->tpg_1 = NULL;
|
2012-05-15 12:34:29 -06:00
|
|
|
kfree(tpg);
|
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_npiv_tpg_enable_show(struct config_item *item,
|
|
|
|
char *page)
|
2014-02-19 17:52:15 -07:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
return tcm_qla2xxx_tpg_enable_show(item, page);
|
2014-02-19 17:52:15 -07:00
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item,
|
|
|
|
const char *page, size_t count)
|
2014-02-19 17:52:15 -07:00
|
|
|
{
|
2015-10-03 07:32:55 -06:00
|
|
|
struct se_portal_group *se_tpg = to_tpg(item);
|
2014-02-19 17:52:15 -07:00
|
|
|
struct se_wwn *se_wwn = se_tpg->se_tpg_wwn;
|
|
|
|
struct tcm_qla2xxx_lport *lport = container_of(se_wwn,
|
|
|
|
struct tcm_qla2xxx_lport, lport_wwn);
|
|
|
|
struct scsi_qla_host *vha = lport->qla_vha;
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
unsigned long op;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = kstrtoul(page, 0, &op);
|
|
|
|
if (rc < 0) {
|
|
|
|
pr_err("kstrtoul() returned %d\n", rc);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if ((op != 1) && (op != 0)) {
|
|
|
|
pr_err("Illegal value for tpg_enable: %lu\n", op);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (op) {
|
|
|
|
if (atomic_read(&tpg->lport_tpg_enabled))
|
|
|
|
return -EEXIST;
|
|
|
|
|
|
|
|
atomic_set(&tpg->lport_tpg_enabled, 1);
|
|
|
|
qlt_enable_vha(vha);
|
|
|
|
} else {
|
|
|
|
if (!atomic_read(&tpg->lport_tpg_enabled))
|
|
|
|
return count;
|
|
|
|
|
|
|
|
atomic_set(&tpg->lport_tpg_enabled, 0);
|
|
|
|
qlt_stop_phase1(vha->vha_tgt.qla_tgt);
|
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
CONFIGFS_ATTR(tcm_qla2xxx_npiv_tpg_, enable);
|
2014-02-19 17:52:15 -07:00
|
|
|
|
|
|
|
static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = {
|
2015-10-03 07:32:55 -06:00
|
|
|
&tcm_qla2xxx_npiv_tpg_attr_enable,
|
2014-02-19 17:52:15 -07:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg(
|
|
|
|
struct se_wwn *wwn,
|
|
|
|
struct config_group *group,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport = container_of(wwn,
|
|
|
|
struct tcm_qla2xxx_lport, lport_wwn);
|
|
|
|
struct tcm_qla2xxx_tpg *tpg;
|
|
|
|
unsigned long tpgt;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (strstr(name, "tpgt_") != name)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
if (kstrtoul(name + 5, 10, &tpgt) || tpgt > USHRT_MAX)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
tpg = kzalloc(sizeof(struct tcm_qla2xxx_tpg), GFP_KERNEL);
|
|
|
|
if (!tpg) {
|
|
|
|
pr_err("Unable to allocate struct tcm_qla2xxx_tpg\n");
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
}
|
|
|
|
tpg->lport = lport;
|
|
|
|
tpg->lport_tpgt = tpgt;
|
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
/*
|
|
|
|
* By default allow READ-ONLY TPG demo-mode access w/ cached dynamic
|
|
|
|
* NodeACLs
|
|
|
|
*/
|
|
|
|
tpg->tpg_attrib.generate_node_acls = 1;
|
|
|
|
tpg->tpg_attrib.demo_mode_write_protect = 1;
|
|
|
|
tpg->tpg_attrib.cache_dynamic_acls = 1;
|
|
|
|
tpg->tpg_attrib.demo_mode_login_only = 1;
|
|
|
|
|
2015-05-20 22:48:03 -06:00
|
|
|
ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_FCP);
|
2012-05-15 12:34:29 -06:00
|
|
|
if (ret < 0) {
|
|
|
|
kfree(tpg);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-01-14 21:40:38 -07:00
|
|
|
lport->tpg_1 = tpg;
|
2012-05-15 12:34:29 -06:00
|
|
|
return &tpg->se_tpg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2015-12-17 12:57:04 -07:00
|
|
|
* Expected to be called with struct qla_hw_data->tgt.sess_lock held
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
2017-01-19 23:27:59 -07:00
|
|
|
static struct fc_port *tcm_qla2xxx_find_sess_by_s_id(
|
2012-05-15 12:34:29 -06:00
|
|
|
scsi_qla_host_t *vha,
|
|
|
|
const uint8_t *s_id)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
|
|
|
struct se_node_acl *se_nacl;
|
|
|
|
struct tcm_qla2xxx_nacl *nacl;
|
|
|
|
u32 key;
|
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
lport = vha->vha_tgt.target_lport_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
if (!lport) {
|
|
|
|
pr_err("Unable to locate struct tcm_qla2xxx_lport\n");
|
|
|
|
dump_stack();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-07-14 14:00:43 -06:00
|
|
|
key = sid_to_key(s_id);
|
2012-05-15 12:34:29 -06:00
|
|
|
pr_debug("find_sess_by_s_id: 0x%06x\n", key);
|
|
|
|
|
|
|
|
se_nacl = btree_lookup32(&lport->lport_fcport_map, key);
|
|
|
|
if (!se_nacl) {
|
|
|
|
pr_debug("Unable to locate s_id: 0x%06x\n", key);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
pr_debug("find_sess_by_s_id: located se_nacl: %p, initiatorname: %s\n",
|
|
|
|
se_nacl, se_nacl->initiatorname);
|
|
|
|
|
|
|
|
nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl);
|
2017-01-19 23:27:59 -07:00
|
|
|
if (!nacl->fc_port) {
|
|
|
|
pr_err("Unable to locate struct fc_port\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
return nacl->fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2015-12-17 12:57:04 -07:00
|
|
|
* Expected to be called with struct qla_hw_data->tgt.sess_lock held
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_set_sess_by_s_id(
|
|
|
|
struct tcm_qla2xxx_lport *lport,
|
|
|
|
struct se_node_acl *new_se_nacl,
|
|
|
|
struct tcm_qla2xxx_nacl *nacl,
|
|
|
|
struct se_session *se_sess,
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *fc_port,
|
2012-05-15 12:34:29 -06:00
|
|
|
uint8_t *s_id)
|
|
|
|
{
|
|
|
|
u32 key;
|
|
|
|
void *slot;
|
|
|
|
int rc;
|
|
|
|
|
2015-07-14 14:00:43 -06:00
|
|
|
key = sid_to_key(s_id);
|
2012-05-15 12:34:29 -06:00
|
|
|
pr_debug("set_sess_by_s_id: %06x\n", key);
|
|
|
|
|
|
|
|
slot = btree_lookup32(&lport->lport_fcport_map, key);
|
|
|
|
if (!slot) {
|
|
|
|
if (new_se_nacl) {
|
|
|
|
pr_debug("Setting up new fc_port entry to new_se_nacl\n");
|
|
|
|
nacl->nport_id = key;
|
|
|
|
rc = btree_insert32(&lport->lport_fcport_map, key,
|
|
|
|
new_se_nacl, GFP_ATOMIC);
|
|
|
|
if (rc)
|
|
|
|
printk(KERN_ERR "Unable to insert s_id into fcport_map: %06x\n",
|
|
|
|
(int)key);
|
|
|
|
} else {
|
|
|
|
pr_debug("Wiping nonexisting fc_port entry\n");
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
fc_port->se_sess = se_sess;
|
|
|
|
nacl->fc_port = fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
if (nacl->fc_port) {
|
2012-05-15 12:34:29 -06:00
|
|
|
if (new_se_nacl == NULL) {
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Clearing existing nacl->fc_port and fc_port entry\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
btree_remove32(&lport->lport_fcport_map, key);
|
2017-01-19 23:27:59 -07:00
|
|
|
nacl->fc_port = NULL;
|
2012-05-15 12:34:29 -06:00
|
|
|
return;
|
|
|
|
}
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Replacing existing nacl->fc_port and fc_port entry\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
btree_update32(&lport->lport_fcport_map, key, new_se_nacl);
|
2017-01-19 23:27:59 -07:00
|
|
|
fc_port->se_sess = se_sess;
|
|
|
|
nacl->fc_port = fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_se_nacl == NULL) {
|
|
|
|
pr_debug("Clearing existing fc_port entry\n");
|
|
|
|
btree_remove32(&lport->lport_fcport_map, key);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Replacing existing fc_port entry w/o active nacl->fc_port\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
btree_update32(&lport->lport_fcport_map, key, new_se_nacl);
|
2017-01-19 23:27:59 -07:00
|
|
|
fc_port->se_sess = se_sess;
|
|
|
|
nacl->fc_port = fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Setup nacl->fc_port %p by s_id for se_nacl: %p, initiatorname: %s\n",
|
|
|
|
nacl->fc_port, new_se_nacl, new_se_nacl->initiatorname);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2015-12-17 12:57:04 -07:00
|
|
|
* Expected to be called with struct qla_hw_data->tgt.sess_lock held
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
2017-01-19 23:27:59 -07:00
|
|
|
static struct fc_port *tcm_qla2xxx_find_sess_by_loop_id(
|
2012-05-15 12:34:29 -06:00
|
|
|
scsi_qla_host_t *vha,
|
|
|
|
const uint16_t loop_id)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
|
|
|
struct se_node_acl *se_nacl;
|
|
|
|
struct tcm_qla2xxx_nacl *nacl;
|
|
|
|
struct tcm_qla2xxx_fc_loopid *fc_loopid;
|
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
lport = vha->vha_tgt.target_lport_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
if (!lport) {
|
|
|
|
pr_err("Unable to locate struct tcm_qla2xxx_lport\n");
|
|
|
|
dump_stack();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_debug("find_sess_by_loop_id: Using loop_id: 0x%04x\n", loop_id);
|
|
|
|
|
|
|
|
fc_loopid = lport->lport_loopid_map + loop_id;
|
|
|
|
se_nacl = fc_loopid->se_nacl;
|
|
|
|
if (!se_nacl) {
|
|
|
|
pr_debug("Unable to locate se_nacl by loop_id: 0x%04x\n",
|
|
|
|
loop_id);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl);
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
if (!nacl->fc_port) {
|
|
|
|
pr_err("Unable to locate struct fc_port\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
return nacl->fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2015-12-17 12:57:04 -07:00
|
|
|
* Expected to be called with struct qla_hw_data->tgt.sess_lock held
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_set_sess_by_loop_id(
|
|
|
|
struct tcm_qla2xxx_lport *lport,
|
|
|
|
struct se_node_acl *new_se_nacl,
|
|
|
|
struct tcm_qla2xxx_nacl *nacl,
|
|
|
|
struct se_session *se_sess,
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *fc_port,
|
2012-05-15 12:34:29 -06:00
|
|
|
uint16_t loop_id)
|
|
|
|
{
|
|
|
|
struct se_node_acl *saved_nacl;
|
|
|
|
struct tcm_qla2xxx_fc_loopid *fc_loopid;
|
|
|
|
|
|
|
|
pr_debug("set_sess_by_loop_id: Using loop_id: 0x%04x\n", loop_id);
|
|
|
|
|
|
|
|
fc_loopid = &((struct tcm_qla2xxx_fc_loopid *)
|
|
|
|
lport->lport_loopid_map)[loop_id];
|
|
|
|
|
|
|
|
saved_nacl = fc_loopid->se_nacl;
|
|
|
|
if (!saved_nacl) {
|
|
|
|
pr_debug("Setting up new fc_loopid->se_nacl to new_se_nacl\n");
|
|
|
|
fc_loopid->se_nacl = new_se_nacl;
|
2017-01-19 23:27:59 -07:00
|
|
|
if (fc_port->se_sess != se_sess)
|
|
|
|
fc_port->se_sess = se_sess;
|
|
|
|
if (nacl->fc_port != fc_port)
|
|
|
|
nacl->fc_port = fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
if (nacl->fc_port) {
|
2012-05-15 12:34:29 -06:00
|
|
|
if (new_se_nacl == NULL) {
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Clearing nacl->fc_port and fc_loopid->se_nacl\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
fc_loopid->se_nacl = NULL;
|
2017-01-19 23:27:59 -07:00
|
|
|
nacl->fc_port = NULL;
|
2012-05-15 12:34:29 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Replacing existing nacl->fc_port and fc_loopid->se_nacl\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
fc_loopid->se_nacl = new_se_nacl;
|
2017-01-19 23:27:59 -07:00
|
|
|
if (fc_port->se_sess != se_sess)
|
|
|
|
fc_port->se_sess = se_sess;
|
|
|
|
if (nacl->fc_port != fc_port)
|
|
|
|
nacl->fc_port = fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_se_nacl == NULL) {
|
|
|
|
pr_debug("Clearing fc_loopid->se_nacl\n");
|
|
|
|
fc_loopid->se_nacl = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Replacing existing fc_loopid->se_nacl w/o active nacl->fc_port\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
fc_loopid->se_nacl = new_se_nacl;
|
2017-01-19 23:27:59 -07:00
|
|
|
if (fc_port->se_sess != se_sess)
|
|
|
|
fc_port->se_sess = se_sess;
|
|
|
|
if (nacl->fc_port != fc_port)
|
|
|
|
nacl->fc_port = fc_port;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_debug("Setup nacl->fc_port %p by loop_id for se_nacl: %p, initiatorname: %s\n",
|
|
|
|
nacl->fc_port, new_se_nacl, new_se_nacl->initiatorname);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2012-05-18 16:37:53 -06:00
|
|
|
/*
|
2015-12-17 12:57:04 -07:00
|
|
|
* Should always be called with qla_hw_data->tgt.sess_lock held.
|
2012-05-18 16:37:53 -06:00
|
|
|
*/
|
|
|
|
static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport,
|
2017-01-19 23:27:59 -07:00
|
|
|
struct tcm_qla2xxx_nacl *nacl, struct fc_port *sess)
|
2012-05-18 16:37:53 -06:00
|
|
|
{
|
|
|
|
struct se_session *se_sess = sess->se_sess;
|
|
|
|
unsigned char be_sid[3];
|
|
|
|
|
2017-01-19 23:27:58 -07:00
|
|
|
be_sid[0] = sess->d_id.b.domain;
|
|
|
|
be_sid[1] = sess->d_id.b.area;
|
|
|
|
be_sid[2] = sess->d_id.b.al_pa;
|
2012-05-18 16:37:53 -06:00
|
|
|
|
|
|
|
tcm_qla2xxx_set_sess_by_s_id(lport, NULL, nacl, se_sess,
|
|
|
|
sess, be_sid);
|
|
|
|
tcm_qla2xxx_set_sess_by_loop_id(lport, NULL, nacl, se_sess,
|
|
|
|
sess, sess->loop_id);
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
static void tcm_qla2xxx_free_session(struct fc_port *sess)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
|
|
|
struct qla_tgt *tgt = sess->tgt;
|
|
|
|
struct qla_hw_data *ha = tgt->ha;
|
2014-01-14 21:40:38 -07:00
|
|
|
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
|
2012-05-15 12:34:29 -06:00
|
|
|
struct se_session *se_sess;
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
|
|
|
|
|
|
|
BUG_ON(in_interrupt());
|
|
|
|
|
|
|
|
se_sess = sess->se_sess;
|
|
|
|
if (!se_sess) {
|
2017-01-19 23:27:59 -07:00
|
|
|
pr_err("struct fc_port->se_sess is NULL\n");
|
2012-05-15 12:34:29 -06:00
|
|
|
dump_stack();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
lport = vha->vha_tgt.target_lport_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
if (!lport) {
|
|
|
|
pr_err("Unable to locate struct tcm_qla2xxx_lport\n");
|
|
|
|
dump_stack();
|
|
|
|
return;
|
|
|
|
}
|
2013-05-15 01:44:07 -06:00
|
|
|
target_wait_for_sess_cmds(se_sess);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
transport_deregister_session_configfs(sess->se_sess);
|
|
|
|
transport_deregister_session(sess->se_sess);
|
|
|
|
}
|
|
|
|
|
2016-01-09 07:47:58 -07:00
|
|
|
static int tcm_qla2xxx_session_cb(struct se_portal_group *se_tpg,
|
|
|
|
struct se_session *se_sess, void *p)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
|
|
|
|
struct tcm_qla2xxx_tpg, se_tpg);
|
|
|
|
struct tcm_qla2xxx_lport *lport = tpg->lport;
|
|
|
|
struct qla_hw_data *ha = lport->qla_vha->hw;
|
|
|
|
struct se_node_acl *se_nacl = se_sess->se_node_acl;
|
|
|
|
struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
|
|
|
|
struct tcm_qla2xxx_nacl, se_node_acl);
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *qlat_sess = p;
|
2016-01-09 07:47:58 -07:00
|
|
|
uint16_t loop_id = qlat_sess->loop_id;
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned char be_sid[3];
|
|
|
|
|
2017-01-19 23:27:58 -07:00
|
|
|
be_sid[0] = qlat_sess->d_id.b.domain;
|
|
|
|
be_sid[1] = qlat_sess->d_id.b.area;
|
|
|
|
be_sid[2] = qlat_sess->d_id.b.al_pa;
|
2016-01-09 07:47:58 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* And now setup se_nacl and session pointers into HW lport internal
|
|
|
|
* mappings for fabric S_ID and LOOP_ID.
|
|
|
|
*/
|
|
|
|
spin_lock_irqsave(&ha->tgt.sess_lock, flags);
|
|
|
|
tcm_qla2xxx_set_sess_by_s_id(lport, se_nacl, nacl,
|
|
|
|
se_sess, qlat_sess, be_sid);
|
|
|
|
tcm_qla2xxx_set_sess_by_loop_id(lport, se_nacl, nacl,
|
|
|
|
se_sess, qlat_sess, loop_id);
|
|
|
|
spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Called via qlt_create_sess():ha->qla2x_tmpl->check_initiator_node_acl()
|
|
|
|
* to locate struct se_node_acl
|
|
|
|
*/
|
|
|
|
static int tcm_qla2xxx_check_initiator_node_acl(
|
|
|
|
scsi_qla_host_t *vha,
|
|
|
|
unsigned char *fc_wwpn,
|
2017-01-19 23:27:59 -07:00
|
|
|
struct fc_port *qlat_sess)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
|
|
|
struct tcm_qla2xxx_tpg *tpg;
|
|
|
|
struct se_session *se_sess;
|
|
|
|
unsigned char port_name[36];
|
2015-12-17 12:56:59 -07:00
|
|
|
int num_tags = (ha->cur_fw_xcb_count) ? ha->cur_fw_xcb_count :
|
2014-05-23 03:00:56 -06:00
|
|
|
TCM_QLA2XXX_DEFAULT_TAGS;
|
2012-05-15 12:34:29 -06:00
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
lport = vha->vha_tgt.target_lport_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
if (!lport) {
|
|
|
|
pr_err("Unable to locate struct tcm_qla2xxx_lport\n");
|
|
|
|
dump_stack();
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Locate the TPG=1 reference..
|
|
|
|
*/
|
|
|
|
tpg = lport->tpg_1;
|
|
|
|
if (!tpg) {
|
|
|
|
pr_err("Unable to lcoate struct tcm_qla2xxx_lport->tpg_1\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Format the FCP Initiator port_name into colon seperated values to
|
|
|
|
* match the format by tcm_qla2xxx explict ConfigFS NodeACLs.
|
|
|
|
*/
|
|
|
|
memset(&port_name, 0, 36);
|
2015-01-15 04:28:07 -07:00
|
|
|
snprintf(port_name, sizeof(port_name), "%8phC", fc_wwpn);
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Locate our struct se_node_acl either from an explict NodeACL created
|
|
|
|
* via ConfigFS, or via running in TPG demo mode.
|
|
|
|
*/
|
2016-01-09 07:47:58 -07:00
|
|
|
se_sess = target_alloc_session(&tpg->se_tpg, num_tags,
|
|
|
|
sizeof(struct qla_tgt_cmd),
|
|
|
|
TARGET_PROT_ALL, port_name,
|
|
|
|
qlat_sess, tcm_qla2xxx_session_cb);
|
|
|
|
if (IS_ERR(se_sess))
|
|
|
|
return PTR_ERR(se_sess);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:59 -07:00
|
|
|
static void tcm_qla2xxx_update_sess(struct fc_port *sess, port_id_t s_id,
|
2012-10-11 14:41:32 -06:00
|
|
|
uint16_t loop_id, bool conf_compl_supported)
|
|
|
|
{
|
|
|
|
struct qla_tgt *tgt = sess->tgt;
|
|
|
|
struct qla_hw_data *ha = tgt->ha;
|
2014-01-14 21:40:38 -07:00
|
|
|
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
|
|
|
|
struct tcm_qla2xxx_lport *lport = vha->vha_tgt.target_lport_ptr;
|
2012-10-11 14:41:32 -06:00
|
|
|
struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
|
|
|
|
struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
|
|
|
|
struct tcm_qla2xxx_nacl, se_node_acl);
|
|
|
|
u32 key;
|
|
|
|
|
|
|
|
|
2017-01-19 23:27:58 -07:00
|
|
|
if (sess->loop_id != loop_id || sess->d_id.b24 != s_id.b24)
|
2013-08-26 23:37:27 -06:00
|
|
|
pr_info("Updating session %p from port %8phC loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n",
|
|
|
|
sess, sess->port_name,
|
2017-01-19 23:27:58 -07:00
|
|
|
sess->loop_id, loop_id, sess->d_id.b.domain,
|
|
|
|
sess->d_id.b.area, sess->d_id.b.al_pa, s_id.b.domain,
|
2013-08-26 23:37:27 -06:00
|
|
|
s_id.b.area, s_id.b.al_pa);
|
2012-10-11 14:41:32 -06:00
|
|
|
|
|
|
|
if (sess->loop_id != loop_id) {
|
|
|
|
/*
|
|
|
|
* Because we can shuffle loop IDs around and we
|
|
|
|
* update different sessions non-atomically, we might
|
|
|
|
* have overwritten this session's old loop ID
|
|
|
|
* already, and we might end up overwriting some other
|
|
|
|
* session that will be updated later. So we have to
|
|
|
|
* be extra careful and we can't warn about those things...
|
|
|
|
*/
|
|
|
|
if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl)
|
|
|
|
lport->lport_loopid_map[sess->loop_id].se_nacl = NULL;
|
|
|
|
|
|
|
|
lport->lport_loopid_map[loop_id].se_nacl = se_nacl;
|
|
|
|
|
|
|
|
sess->loop_id = loop_id;
|
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:58 -07:00
|
|
|
if (sess->d_id.b24 != s_id.b24) {
|
|
|
|
key = (((u32) sess->d_id.b.domain << 16) |
|
|
|
|
((u32) sess->d_id.b.area << 8) |
|
|
|
|
((u32) sess->d_id.b.al_pa));
|
2012-10-11 14:41:32 -06:00
|
|
|
|
|
|
|
if (btree_lookup32(&lport->lport_fcport_map, key))
|
2017-01-19 23:27:58 -07:00
|
|
|
WARN(btree_remove32(&lport->lport_fcport_map, key) !=
|
|
|
|
se_nacl, "Found wrong se_nacl when updating s_id %x:%x:%x\n",
|
|
|
|
sess->d_id.b.domain, sess->d_id.b.area,
|
|
|
|
sess->d_id.b.al_pa);
|
2012-10-11 14:41:32 -06:00
|
|
|
else
|
|
|
|
WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n",
|
2017-01-19 23:27:58 -07:00
|
|
|
sess->d_id.b.domain, sess->d_id.b.area,
|
|
|
|
sess->d_id.b.al_pa);
|
2012-10-11 14:41:32 -06:00
|
|
|
|
|
|
|
key = (((u32) s_id.b.domain << 16) |
|
|
|
|
((u32) s_id.b.area << 8) |
|
|
|
|
((u32) s_id.b.al_pa));
|
|
|
|
|
|
|
|
if (btree_lookup32(&lport->lport_fcport_map, key)) {
|
|
|
|
WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n",
|
|
|
|
s_id.b.domain, s_id.b.area, s_id.b.al_pa);
|
|
|
|
btree_update32(&lport->lport_fcport_map, key, se_nacl);
|
|
|
|
} else {
|
2017-01-19 23:27:58 -07:00
|
|
|
btree_insert32(&lport->lport_fcport_map, key, se_nacl,
|
|
|
|
GFP_ATOMIC);
|
2012-10-11 14:41:32 -06:00
|
|
|
}
|
|
|
|
|
2017-01-19 23:27:58 -07:00
|
|
|
sess->d_id = s_id;
|
2012-10-11 14:41:32 -06:00
|
|
|
nacl->nport_id = key;
|
|
|
|
}
|
|
|
|
|
|
|
|
sess->conf_compl_supported = conf_compl_supported;
|
2015-07-14 14:00:44 -06:00
|
|
|
|
|
|
|
/* Reset logout parameters to default */
|
|
|
|
sess->logout_on_delete = 1;
|
|
|
|
sess->keep_nport_handle = 0;
|
2012-10-11 14:41:32 -06:00
|
|
|
}
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Calls into tcm_qla2xxx used by qla2xxx LLD I/O path.
|
|
|
|
*/
|
|
|
|
static struct qla_tgt_func_tmpl tcm_qla2xxx_template = {
|
2018-05-01 10:01:53 -06:00
|
|
|
.find_cmd_by_tag = tcm_qla2xxx_find_cmd_by_tag,
|
2012-05-15 12:34:29 -06:00
|
|
|
.handle_cmd = tcm_qla2xxx_handle_cmd,
|
|
|
|
.handle_data = tcm_qla2xxx_handle_data,
|
|
|
|
.handle_tmr = tcm_qla2xxx_handle_tmr,
|
|
|
|
.free_cmd = tcm_qla2xxx_free_cmd,
|
|
|
|
.free_mcmd = tcm_qla2xxx_free_mcmd,
|
|
|
|
.free_session = tcm_qla2xxx_free_session,
|
2012-10-11 14:41:32 -06:00
|
|
|
.update_sess = tcm_qla2xxx_update_sess,
|
2012-05-15 12:34:29 -06:00
|
|
|
.check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,
|
|
|
|
.find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id,
|
|
|
|
.find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id,
|
|
|
|
.clear_nacl_from_fcport_map = tcm_qla2xxx_clear_nacl_from_fcport_map,
|
2017-01-19 23:27:59 -07:00
|
|
|
.put_sess = tcm_qla2xxx_put_sess,
|
2012-05-15 12:34:29 -06:00
|
|
|
.shutdown_sess = tcm_qla2xxx_shutdown_sess,
|
2017-03-15 10:48:49 -06:00
|
|
|
.get_dif_tags = tcm_qla2xxx_dif_tags,
|
|
|
|
.chk_dif_tags = tcm_qla2xxx_chk_dif_tags,
|
2012-05-15 12:34:29 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_init_lport(struct tcm_qla2xxx_lport *lport)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = btree_init32(&lport->lport_fcport_map);
|
|
|
|
if (rc) {
|
|
|
|
pr_err("Unable to initialize lport->lport_fcport_map btree\n");
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
treewide: Use array_size() in vzalloc()
The vzalloc() function has no 2-factor argument form, so multiplication
factors need to be wrapped in array_size(). This patch replaces cases of:
vzalloc(a * b)
with:
vzalloc(array_size(a, b))
as well as handling cases of:
vzalloc(a * b * c)
with:
vzalloc(array3_size(a, b, c))
This does, however, attempt to ignore constant size factors like:
vzalloc(4 * 1024)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
vzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
vzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
vzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
vzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
vzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
vzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
vzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
vzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
vzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
vzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
vzalloc(
- sizeof(TYPE) * (COUNT_ID)
+ array_size(COUNT_ID, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(TYPE) * COUNT_ID
+ array_size(COUNT_ID, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(TYPE) * (COUNT_CONST)
+ array_size(COUNT_CONST, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(TYPE) * COUNT_CONST
+ array_size(COUNT_CONST, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(THING) * (COUNT_ID)
+ array_size(COUNT_ID, sizeof(THING))
, ...)
|
vzalloc(
- sizeof(THING) * COUNT_ID
+ array_size(COUNT_ID, sizeof(THING))
, ...)
|
vzalloc(
- sizeof(THING) * (COUNT_CONST)
+ array_size(COUNT_CONST, sizeof(THING))
, ...)
|
vzalloc(
- sizeof(THING) * COUNT_CONST
+ array_size(COUNT_CONST, sizeof(THING))
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
vzalloc(
- SIZE * COUNT
+ array_size(COUNT, SIZE)
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
vzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
vzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
vzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
vzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
vzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
vzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
vzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
vzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
vzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
vzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
vzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
vzalloc(C1 * C2 * C3, ...)
|
vzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants.
@@
expression E1, E2;
constant C1, C2;
@@
(
vzalloc(C1 * C2, ...)
|
vzalloc(
- E1 * E2
+ array_size(E1, E2)
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 15:27:37 -06:00
|
|
|
lport->lport_loopid_map =
|
|
|
|
vzalloc(array_size(65536,
|
|
|
|
sizeof(struct tcm_qla2xxx_fc_loopid)));
|
2012-05-15 12:34:29 -06:00
|
|
|
if (!lport->lport_loopid_map) {
|
|
|
|
pr_err("Unable to allocate lport->lport_loopid_map of %zu bytes\n",
|
|
|
|
sizeof(struct tcm_qla2xxx_fc_loopid) * 65536);
|
|
|
|
btree_destroy32(&lport->lport_fcport_map);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
pr_debug("qla2xxx: Allocated lport_loopid_map of %zu bytes\n",
|
|
|
|
sizeof(struct tcm_qla2xxx_fc_loopid) * 65536);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-01-14 21:38:58 -07:00
|
|
|
static int tcm_qla2xxx_lport_register_cb(struct scsi_qla_host *vha,
|
|
|
|
void *target_lport_ptr,
|
|
|
|
u64 npiv_wwpn, u64 npiv_wwnn)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
2014-01-14 21:38:58 -07:00
|
|
|
struct qla_hw_data *ha = vha->hw;
|
|
|
|
struct tcm_qla2xxx_lport *lport =
|
|
|
|
(struct tcm_qla2xxx_lport *)target_lport_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
2014-01-14 21:38:58 -07:00
|
|
|
* Setup tgt_ops, local pointer to vha and target_lport_ptr
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
2014-01-14 21:38:58 -07:00
|
|
|
ha->tgt.tgt_ops = &tcm_qla2xxx_template;
|
|
|
|
vha->vha_tgt.target_lport_ptr = target_lport_ptr;
|
2012-05-15 12:34:29 -06:00
|
|
|
lport->qla_vha = vha;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct se_wwn *tcm_qla2xxx_make_lport(
|
|
|
|
struct target_fabric_configfs *tf,
|
|
|
|
struct config_group *group,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
|
|
|
u64 wwpn;
|
|
|
|
int ret = -ENODEV;
|
|
|
|
|
|
|
|
if (tcm_qla2xxx_parse_wwn(name, &wwpn, 1) < 0)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
lport = kzalloc(sizeof(struct tcm_qla2xxx_lport), GFP_KERNEL);
|
|
|
|
if (!lport) {
|
|
|
|
pr_err("Unable to allocate struct tcm_qla2xxx_lport\n");
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
}
|
|
|
|
lport->lport_wwpn = wwpn;
|
|
|
|
tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN,
|
|
|
|
wwpn);
|
tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC
My draft of SPC-4 says the following about the SCSI name string in
inquiry VPD page 83h:
The SCSI NAME STRING field starts with either:
a) the four UTF-8 characters 'eui.' concatenated with 16, 24, or
32 hexadecimal digits (i.e., the UTF-8 characters 0 through 9
and A through F) for an EUI-64 based identifier (see
7.8.6.5). The first hexadecimal digit shall be the most
significant four bits of the first byte (i.e., most significant
byte) of the EUI-64 based identifier;
b) the four UTF-8 characters 'naa.' concatenated with 16 or 32
hexadecimal digits for an NAA identifier (see 7.8.6.6). The
first hexadecimal digit shall be the most significant four bits
of the first byte (i.e., most significant byte) of the NAA
identifier; or
c) the four UTF-8 characters 'iqn.' concatenated with an iSCSI
Name for an iSCSI-name based identifier (see iSCSI).
However, the .tpg_get_wwn method for tcm_qla2xxx formats the WWN so
the SCSI name string looks like "52:4a:93:7d:24:5f:b2:12,t,0x0001".
This patch corrects the code so that VPD 83h gives a SPC-compliant
SCSI name string like "naa.524a937d245fb212,t,0x0001" while leavig
other uses alone (so configfs will still work with ':' separated WWNs).
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Chad Dupuis <chad.dupuis@qlogic.com>
Cc: Arun Easi <arun.easi@qlogic.com>
Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-10-11 14:41:31 -06:00
|
|
|
sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
ret = tcm_qla2xxx_init_lport(lport);
|
|
|
|
if (ret != 0)
|
|
|
|
goto out;
|
|
|
|
|
2014-01-14 21:38:58 -07:00
|
|
|
ret = qlt_lport_register(lport, wwpn, 0, 0,
|
|
|
|
tcm_qla2xxx_lport_register_cb);
|
2012-05-15 12:34:29 -06:00
|
|
|
if (ret != 0)
|
|
|
|
goto out_lport;
|
|
|
|
|
|
|
|
return &lport->lport_wwn;
|
|
|
|
out_lport:
|
|
|
|
vfree(lport->lport_loopid_map);
|
|
|
|
btree_destroy32(&lport->lport_fcport_map);
|
|
|
|
out:
|
|
|
|
kfree(lport);
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_drop_lport(struct se_wwn *wwn)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport = container_of(wwn,
|
|
|
|
struct tcm_qla2xxx_lport, lport_wwn);
|
|
|
|
struct scsi_qla_host *vha = lport->qla_vha;
|
|
|
|
struct se_node_acl *node;
|
|
|
|
u32 key = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call into qla2x_target.c LLD logic to complete the
|
|
|
|
* shutdown of struct qla_tgt after the call to
|
|
|
|
* qlt_stop_phase1() from tcm_qla2xxx_drop_tpg() above..
|
|
|
|
*/
|
2014-01-14 21:40:38 -07:00
|
|
|
if (vha->vha_tgt.qla_tgt && !vha->vha_tgt.qla_tgt->tgt_stopped)
|
|
|
|
qlt_stop_phase2(vha->vha_tgt.qla_tgt);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
qlt_lport_deregister(vha);
|
|
|
|
|
|
|
|
vfree(lport->lport_loopid_map);
|
|
|
|
btree_for_each_safe32(&lport->lport_fcport_map, key, node)
|
|
|
|
btree_remove32(&lport->lport_fcport_map, key);
|
|
|
|
btree_destroy32(&lport->lport_fcport_map);
|
|
|
|
kfree(lport);
|
|
|
|
}
|
|
|
|
|
2014-01-14 21:38:58 -07:00
|
|
|
static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha,
|
|
|
|
void *target_lport_ptr,
|
|
|
|
u64 npiv_wwpn, u64 npiv_wwnn)
|
|
|
|
{
|
|
|
|
struct fc_vport *vport;
|
|
|
|
struct Scsi_Host *sh = base_vha->host;
|
|
|
|
struct scsi_qla_host *npiv_vha;
|
|
|
|
struct tcm_qla2xxx_lport *lport =
|
|
|
|
(struct tcm_qla2xxx_lport *)target_lport_ptr;
|
2014-02-19 17:53:07 -07:00
|
|
|
struct tcm_qla2xxx_lport *base_lport =
|
|
|
|
(struct tcm_qla2xxx_lport *)base_vha->vha_tgt.target_lport_ptr;
|
2014-01-14 21:38:58 -07:00
|
|
|
struct fc_vport_identifiers vport_id;
|
|
|
|
|
2017-01-19 23:28:01 -07:00
|
|
|
if (qla_ini_mode_enabled(base_vha)) {
|
2014-01-14 21:38:58 -07:00
|
|
|
pr_err("qla2xxx base_vha not enabled for target mode\n");
|
|
|
|
return -EPERM;
|
|
|
|
}
|
|
|
|
|
2014-02-19 17:53:07 -07:00
|
|
|
if (!base_lport || !base_lport->tpg_1 ||
|
|
|
|
!atomic_read(&base_lport->tpg_1->lport_tpg_enabled)) {
|
|
|
|
pr_err("qla2xxx base_lport or tpg_1 not available\n");
|
|
|
|
return -EPERM;
|
|
|
|
}
|
|
|
|
|
2014-01-14 21:38:58 -07:00
|
|
|
memset(&vport_id, 0, sizeof(vport_id));
|
|
|
|
vport_id.port_name = npiv_wwpn;
|
|
|
|
vport_id.node_name = npiv_wwnn;
|
|
|
|
vport_id.roles = FC_PORT_ROLE_FCP_INITIATOR;
|
|
|
|
vport_id.vport_type = FC_PORTTYPE_NPIV;
|
|
|
|
vport_id.disable = false;
|
|
|
|
|
|
|
|
vport = fc_vport_create(sh, 0, &vport_id);
|
|
|
|
if (!vport) {
|
|
|
|
pr_err("fc_vport_create failed for qla2xxx_npiv\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Setup local pointer to NPIV vhba + target_lport_ptr
|
|
|
|
*/
|
|
|
|
npiv_vha = (struct scsi_qla_host *)vport->dd_data;
|
|
|
|
npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr;
|
|
|
|
lport->qla_vha = npiv_vha;
|
|
|
|
scsi_host_get(npiv_vha->host);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
static struct se_wwn *tcm_qla2xxx_npiv_make_lport(
|
|
|
|
struct target_fabric_configfs *tf,
|
|
|
|
struct config_group *group,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport;
|
2014-01-14 21:38:58 -07:00
|
|
|
u64 phys_wwpn, npiv_wwpn, npiv_wwnn;
|
|
|
|
char *p, tmp[128];
|
2012-05-15 12:34:29 -06:00
|
|
|
int ret;
|
|
|
|
|
2014-01-14 21:38:58 -07:00
|
|
|
snprintf(tmp, 128, "%s", name);
|
|
|
|
|
|
|
|
p = strchr(tmp, '@');
|
|
|
|
if (!p) {
|
2017-02-23 03:57:23 -07:00
|
|
|
pr_err("Unable to locate NPIV '@' separator\n");
|
2014-01-14 21:38:58 -07:00
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
}
|
|
|
|
*p++ = '\0';
|
|
|
|
|
|
|
|
if (tcm_qla2xxx_parse_wwn(tmp, &phys_wwpn, 1) < 0)
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
if (tcm_qla2xxx_npiv_parse_wwn(p, strlen(p)+1,
|
|
|
|
&npiv_wwpn, &npiv_wwnn) < 0)
|
2012-05-15 12:34:29 -06:00
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
|
|
lport = kzalloc(sizeof(struct tcm_qla2xxx_lport), GFP_KERNEL);
|
|
|
|
if (!lport) {
|
|
|
|
pr_err("Unable to allocate struct tcm_qla2xxx_lport for NPIV\n");
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
}
|
|
|
|
lport->lport_npiv_wwpn = npiv_wwpn;
|
|
|
|
lport->lport_npiv_wwnn = npiv_wwnn;
|
tcm_qla2xxx: Format VPD page 83h SCSI name string according to SPC
My draft of SPC-4 says the following about the SCSI name string in
inquiry VPD page 83h:
The SCSI NAME STRING field starts with either:
a) the four UTF-8 characters 'eui.' concatenated with 16, 24, or
32 hexadecimal digits (i.e., the UTF-8 characters 0 through 9
and A through F) for an EUI-64 based identifier (see
7.8.6.5). The first hexadecimal digit shall be the most
significant four bits of the first byte (i.e., most significant
byte) of the EUI-64 based identifier;
b) the four UTF-8 characters 'naa.' concatenated with 16 or 32
hexadecimal digits for an NAA identifier (see 7.8.6.6). The
first hexadecimal digit shall be the most significant four bits
of the first byte (i.e., most significant byte) of the NAA
identifier; or
c) the four UTF-8 characters 'iqn.' concatenated with an iSCSI
Name for an iSCSI-name based identifier (see iSCSI).
However, the .tpg_get_wwn method for tcm_qla2xxx formats the WWN so
the SCSI name string looks like "52:4a:93:7d:24:5f:b2:12,t,0x0001".
This patch corrects the code so that VPD 83h gives a SPC-compliant
SCSI name string like "naa.524a937d245fb212,t,0x0001" while leavig
other uses alone (so configfs will still work with ':' separated WWNs).
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Chad Dupuis <chad.dupuis@qlogic.com>
Cc: Arun Easi <arun.easi@qlogic.com>
Cc: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
2012-10-11 14:41:31 -06:00
|
|
|
sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
2014-01-14 21:40:38 -07:00
|
|
|
ret = tcm_qla2xxx_init_lport(lport);
|
2012-05-15 12:34:29 -06:00
|
|
|
if (ret != 0)
|
|
|
|
goto out;
|
|
|
|
|
2014-01-14 21:38:58 -07:00
|
|
|
ret = qlt_lport_register(lport, phys_wwpn, npiv_wwpn, npiv_wwnn,
|
|
|
|
tcm_qla2xxx_lport_register_npiv_cb);
|
2014-01-14 21:40:38 -07:00
|
|
|
if (ret != 0)
|
|
|
|
goto out_lport;
|
|
|
|
|
2012-05-15 12:34:29 -06:00
|
|
|
return &lport->lport_wwn;
|
2014-01-14 21:40:38 -07:00
|
|
|
out_lport:
|
|
|
|
vfree(lport->lport_loopid_map);
|
|
|
|
btree_destroy32(&lport->lport_fcport_map);
|
2012-05-15 12:34:29 -06:00
|
|
|
out:
|
|
|
|
kfree(lport);
|
|
|
|
return ERR_PTR(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_npiv_drop_lport(struct se_wwn *wwn)
|
|
|
|
{
|
|
|
|
struct tcm_qla2xxx_lport *lport = container_of(wwn,
|
|
|
|
struct tcm_qla2xxx_lport, lport_wwn);
|
2014-01-14 21:38:58 -07:00
|
|
|
struct scsi_qla_host *npiv_vha = lport->qla_vha;
|
|
|
|
struct qla_hw_data *ha = npiv_vha->hw;
|
|
|
|
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
|
|
|
|
|
|
|
|
scsi_host_put(npiv_vha->host);
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
2014-01-14 21:40:38 -07:00
|
|
|
* Notify libfc that we want to release the vha->fc_vport
|
2012-05-15 12:34:29 -06:00
|
|
|
*/
|
2014-01-14 21:38:58 -07:00
|
|
|
fc_vport_terminate(npiv_vha->fc_vport);
|
|
|
|
scsi_host_put(base_vha->host);
|
2012-05-15 12:34:29 -06:00
|
|
|
kfree(lport);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
static ssize_t tcm_qla2xxx_wwn_version_show(struct config_item *item,
|
|
|
|
char *page)
|
2012-05-15 12:34:29 -06:00
|
|
|
{
|
|
|
|
return sprintf(page,
|
2017-06-21 05:40:05 -06:00
|
|
|
"TCM QLOGIC QLA2XXX NPIV capable fabric module %s on %s/%s on %s\n",
|
|
|
|
QLA2XXX_VERSION, utsname()->sysname,
|
|
|
|
utsname()->machine, utsname()->release);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
2015-10-03 07:32:55 -06:00
|
|
|
CONFIGFS_ATTR_RO(tcm_qla2xxx_wwn_, version);
|
2012-05-15 12:34:29 -06:00
|
|
|
|
|
|
|
static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = {
|
2015-10-03 07:32:55 -06:00
|
|
|
&tcm_qla2xxx_wwn_attr_version,
|
2012-05-15 12:34:29 -06:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
2015-04-08 12:01:35 -06:00
|
|
|
static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
|
|
|
|
.module = THIS_MODULE,
|
|
|
|
.name = "qla2xxx",
|
2015-04-13 11:51:16 -06:00
|
|
|
.node_acl_size = sizeof(struct tcm_qla2xxx_nacl),
|
2015-07-30 19:28:13 -06:00
|
|
|
/*
|
|
|
|
* XXX: Limit assumes single page per scatter-gather-list entry.
|
|
|
|
* Current maximum is ~4.9 MB per se_cmd->t_data_sg with PAGE_SIZE=4096
|
|
|
|
*/
|
|
|
|
.max_data_sg_nents = 1200,
|
2012-05-15 12:34:29 -06:00
|
|
|
.get_fabric_name = tcm_qla2xxx_get_fabric_name,
|
|
|
|
.tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn,
|
|
|
|
.tpg_get_tag = tcm_qla2xxx_get_tag,
|
|
|
|
.tpg_check_demo_mode = tcm_qla2xxx_check_demo_mode,
|
|
|
|
.tpg_check_demo_mode_cache = tcm_qla2xxx_check_demo_mode_cache,
|
|
|
|
.tpg_check_demo_mode_write_protect =
|
|
|
|
tcm_qla2xxx_check_demo_write_protect,
|
|
|
|
.tpg_check_prod_mode_write_protect =
|
|
|
|
tcm_qla2xxx_check_prod_write_protect,
|
2015-03-28 00:30:57 -06:00
|
|
|
.tpg_check_prot_fabric_only = tcm_qla2xxx_check_prot_fabric_only,
|
2013-07-19 16:06:38 -06:00
|
|
|
.tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only,
|
2012-05-15 12:34:29 -06:00
|
|
|
.tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
|
|
|
|
.check_stop_free = tcm_qla2xxx_check_stop_free,
|
|
|
|
.release_cmd = tcm_qla2xxx_release_cmd,
|
|
|
|
.close_session = tcm_qla2xxx_close_session,
|
|
|
|
.sess_get_index = tcm_qla2xxx_sess_get_index,
|
|
|
|
.sess_get_initiator_sid = NULL,
|
|
|
|
.write_pending = tcm_qla2xxx_write_pending,
|
|
|
|
.write_pending_status = tcm_qla2xxx_write_pending_status,
|
|
|
|
.set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs,
|
|
|
|
.get_cmd_state = tcm_qla2xxx_get_cmd_state,
|
|
|
|
.queue_data_in = tcm_qla2xxx_queue_data_in,
|
|
|
|
.queue_status = tcm_qla2xxx_queue_status,
|
|
|
|
.queue_tm_rsp = tcm_qla2xxx_queue_tm_rsp,
|
2014-03-22 15:55:56 -06:00
|
|
|
.aborted_task = tcm_qla2xxx_aborted_task,
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Setup function pointers for generic logic in
|
|
|
|
* target_core_fabric_configfs.c
|
|
|
|
*/
|
|
|
|
.fabric_make_wwn = tcm_qla2xxx_make_lport,
|
|
|
|
.fabric_drop_wwn = tcm_qla2xxx_drop_lport,
|
|
|
|
.fabric_make_tpg = tcm_qla2xxx_make_tpg,
|
|
|
|
.fabric_drop_tpg = tcm_qla2xxx_drop_tpg,
|
2015-04-13 11:51:14 -06:00
|
|
|
.fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl,
|
2015-04-08 12:01:35 -06:00
|
|
|
|
|
|
|
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
|
|
|
|
.tfc_tpg_base_attrs = tcm_qla2xxx_tpg_attrs,
|
|
|
|
.tfc_tpg_attrib_attrs = tcm_qla2xxx_tpg_attrib_attrs,
|
2012-05-15 12:34:29 -06:00
|
|
|
};
|
|
|
|
|
2015-04-08 12:01:35 -06:00
|
|
|
static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
|
|
|
|
.module = THIS_MODULE,
|
|
|
|
.name = "qla2xxx_npiv",
|
2015-04-13 11:51:16 -06:00
|
|
|
.node_acl_size = sizeof(struct tcm_qla2xxx_nacl),
|
2012-05-15 12:34:29 -06:00
|
|
|
.get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name,
|
2014-01-30 10:52:21 -07:00
|
|
|
.tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn,
|
2012-05-15 12:34:29 -06:00
|
|
|
.tpg_get_tag = tcm_qla2xxx_get_tag,
|
2014-01-14 21:40:38 -07:00
|
|
|
.tpg_check_demo_mode = tcm_qla2xxx_check_demo_mode,
|
|
|
|
.tpg_check_demo_mode_cache = tcm_qla2xxx_check_demo_mode_cache,
|
|
|
|
.tpg_check_demo_mode_write_protect = tcm_qla2xxx_check_demo_mode,
|
|
|
|
.tpg_check_prod_mode_write_protect =
|
|
|
|
tcm_qla2xxx_check_prod_write_protect,
|
2013-07-19 16:06:38 -06:00
|
|
|
.tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only,
|
2012-05-15 12:34:29 -06:00
|
|
|
.tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
|
2014-01-14 21:40:38 -07:00
|
|
|
.check_stop_free = tcm_qla2xxx_check_stop_free,
|
2012-05-15 12:34:29 -06:00
|
|
|
.release_cmd = tcm_qla2xxx_release_cmd,
|
|
|
|
.close_session = tcm_qla2xxx_close_session,
|
|
|
|
.sess_get_index = tcm_qla2xxx_sess_get_index,
|
|
|
|
.sess_get_initiator_sid = NULL,
|
|
|
|
.write_pending = tcm_qla2xxx_write_pending,
|
|
|
|
.write_pending_status = tcm_qla2xxx_write_pending_status,
|
|
|
|
.set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs,
|
|
|
|
.get_cmd_state = tcm_qla2xxx_get_cmd_state,
|
|
|
|
.queue_data_in = tcm_qla2xxx_queue_data_in,
|
|
|
|
.queue_status = tcm_qla2xxx_queue_status,
|
|
|
|
.queue_tm_rsp = tcm_qla2xxx_queue_tm_rsp,
|
2014-03-22 15:55:56 -06:00
|
|
|
.aborted_task = tcm_qla2xxx_aborted_task,
|
2012-05-15 12:34:29 -06:00
|
|
|
/*
|
|
|
|
* Setup function pointers for generic logic in
|
|
|
|
* target_core_fabric_configfs.c
|
|
|
|
*/
|
|
|
|
.fabric_make_wwn = tcm_qla2xxx_npiv_make_lport,
|
|
|
|
.fabric_drop_wwn = tcm_qla2xxx_npiv_drop_lport,
|
|
|
|
.fabric_make_tpg = tcm_qla2xxx_npiv_make_tpg,
|
|
|
|
.fabric_drop_tpg = tcm_qla2xxx_drop_tpg,
|
2015-04-13 11:51:14 -06:00
|
|
|
.fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl,
|
2015-04-08 12:01:35 -06:00
|
|
|
|
|
|
|
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
|
|
|
|
.tfc_tpg_base_attrs = tcm_qla2xxx_npiv_tpg_attrs,
|
2012-05-15 12:34:29 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static int tcm_qla2xxx_register_configfs(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2017-06-21 05:40:05 -06:00
|
|
|
pr_debug("TCM QLOGIC QLA2XXX fabric module %s on %s/%s on %s\n",
|
|
|
|
QLA2XXX_VERSION, utsname()->sysname,
|
|
|
|
utsname()->machine, utsname()->release);
|
2015-04-08 12:01:35 -06:00
|
|
|
|
|
|
|
ret = target_register_template(&tcm_qla2xxx_ops);
|
|
|
|
if (ret)
|
2012-05-15 12:34:29 -06:00
|
|
|
return ret;
|
|
|
|
|
2015-04-08 12:01:35 -06:00
|
|
|
ret = target_register_template(&tcm_qla2xxx_npiv_ops);
|
|
|
|
if (ret)
|
2012-05-15 12:34:29 -06:00
|
|
|
goto out_fabric;
|
|
|
|
|
|
|
|
tcm_qla2xxx_free_wq = alloc_workqueue("tcm_qla2xxx_free",
|
|
|
|
WQ_MEM_RECLAIM, 0);
|
|
|
|
if (!tcm_qla2xxx_free_wq) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto out_fabric_npiv;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
out_fabric_npiv:
|
2015-04-08 12:01:35 -06:00
|
|
|
target_unregister_template(&tcm_qla2xxx_npiv_ops);
|
2012-05-15 12:34:29 -06:00
|
|
|
out_fabric:
|
2015-04-08 12:01:35 -06:00
|
|
|
target_unregister_template(&tcm_qla2xxx_ops);
|
2012-05-15 12:34:29 -06:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tcm_qla2xxx_deregister_configfs(void)
|
|
|
|
{
|
|
|
|
destroy_workqueue(tcm_qla2xxx_free_wq);
|
|
|
|
|
2015-04-08 12:01:35 -06:00
|
|
|
target_unregister_template(&tcm_qla2xxx_ops);
|
|
|
|
target_unregister_template(&tcm_qla2xxx_npiv_ops);
|
2012-05-15 12:34:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int __init tcm_qla2xxx_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = tcm_qla2xxx_register_configfs();
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit tcm_qla2xxx_exit(void)
|
|
|
|
{
|
|
|
|
tcm_qla2xxx_deregister_configfs();
|
|
|
|
}
|
|
|
|
|
2015-08-02 16:21:50 -06:00
|
|
|
MODULE_DESCRIPTION("TCM QLA24XX+ series NPIV enabled fabric driver");
|
2012-05-15 12:34:29 -06:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
module_init(tcm_qla2xxx_init);
|
|
|
|
module_exit(tcm_qla2xxx_exit);
|