mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 07:04:10 +08:00
51a07f8464
This patch converts qla2xxx target code to use generic percpu_ida tag allocation provided by target-core, thus removing the original kmem_cache_zalloc() for each struct qla_tgt_cmd descriptor in the incoming ATIO packet fast-path. This includes the conversion of qlt_handle_cmd_for_atio() to perform qla_tgt_sess lookup before dispatching a command descriptor into qla_tgt_wq process context, along with handling the case where no active session exists, and subsequently kicking off a seperate process context for qlt_create_sess_from_atio() to create a new one. It also includes moving tag allocation into generic code within qlt_get_tag(), so that the same logic can be shared between qlt_handle_cmd_for_atio() + qlt_create_sess_from_atio() contexts. Also, __qlt_do_work() has been made generic between both normal process context in qlt_do_work() + qlt_create_sess_from_atio(). Next, update qlt_free_cmd() to release the percpu-ida tags, and drop the now-unused global qla_tgt_cmd_cachep. Finally in tcm_qla2xxx code, tcm_qla2xxx_check_initiator_node_acl() has been updated to use transport_init_session_tags() along with a hardcoded TCM_QLA2XXX_DEFAULT_TAGS=2088 as the number of qla_tgt_cmd descriptors to pre-allocate per qla_tgt_sess instance. (Use ha->fw_xcb_count if available to calculate num_tags, and also factor in extra pad tags - Quinn) Cc: Saurav Kashyap <saurav.kashyap@qlogic.com> Cc: Quinn Tran <quinn.tran@qlogic.com> Cc: Giridhar Malavali <giridhar.malavali@qlogic.com> Cc: Chad Dupuis <chad.dupuis@qlogic.com> Cc: Roland Dreier <roland@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
84 lines
2.6 KiB
C
84 lines
2.6 KiB
C
#include <target/target_core_base.h>
|
|
#include <linux/btree.h>
|
|
|
|
#define TCM_QLA2XXX_VERSION "v0.1"
|
|
/* length of ASCII WWPNs including pad */
|
|
#define TCM_QLA2XXX_NAMELEN 32
|
|
/*
|
|
* Number of pre-allocated per-session tags, based upon the worst-case
|
|
* per port number of iocbs
|
|
*/
|
|
#define TCM_QLA2XXX_DEFAULT_TAGS 2088
|
|
|
|
#include "qla_target.h"
|
|
|
|
struct tcm_qla2xxx_nacl {
|
|
/* From libfc struct fc_rport->port_id */
|
|
u32 nport_id;
|
|
/* Binary World Wide unique Node Name for remote FC Initiator Nport */
|
|
u64 nport_wwnn;
|
|
/* ASCII formatted WWPN for FC Initiator Nport */
|
|
char nport_name[TCM_QLA2XXX_NAMELEN];
|
|
/* Pointer to qla_tgt_sess */
|
|
struct qla_tgt_sess *qla_tgt_sess;
|
|
/* Pointer to TCM FC nexus */
|
|
struct se_session *nport_nexus;
|
|
/* Returned by tcm_qla2xxx_make_nodeacl() */
|
|
struct se_node_acl se_node_acl;
|
|
};
|
|
|
|
struct tcm_qla2xxx_tpg_attrib {
|
|
int generate_node_acls;
|
|
int cache_dynamic_acls;
|
|
int demo_mode_write_protect;
|
|
int prod_mode_write_protect;
|
|
int demo_mode_login_only;
|
|
};
|
|
|
|
struct tcm_qla2xxx_tpg {
|
|
/* FC lport target portal group tag for TCM */
|
|
u16 lport_tpgt;
|
|
/* Atomic bit to determine TPG active status */
|
|
atomic_t lport_tpg_enabled;
|
|
/* Pointer back to tcm_qla2xxx_lport */
|
|
struct tcm_qla2xxx_lport *lport;
|
|
/* Used by tcm_qla2xxx_tpg_attrib_cit */
|
|
struct tcm_qla2xxx_tpg_attrib tpg_attrib;
|
|
/* Returned by tcm_qla2xxx_make_tpg() */
|
|
struct se_portal_group se_tpg;
|
|
/* Items for dealing with configfs_depend_item */
|
|
struct completion tpg_base_comp;
|
|
struct work_struct tpg_base_work;
|
|
};
|
|
|
|
struct tcm_qla2xxx_fc_loopid {
|
|
struct se_node_acl *se_nacl;
|
|
};
|
|
|
|
struct tcm_qla2xxx_lport {
|
|
/* SCSI protocol the lport is providing */
|
|
u8 lport_proto_id;
|
|
/* Binary World Wide unique Port Name for FC Target Lport */
|
|
u64 lport_wwpn;
|
|
/* Binary World Wide unique Port Name for FC NPIV Target Lport */
|
|
u64 lport_npiv_wwpn;
|
|
/* Binary World Wide unique Node Name for FC NPIV Target Lport */
|
|
u64 lport_npiv_wwnn;
|
|
/* ASCII formatted WWPN for FC Target Lport */
|
|
char lport_name[TCM_QLA2XXX_NAMELEN];
|
|
/* ASCII formatted naa WWPN for VPD page 83 etc */
|
|
char lport_naa_name[TCM_QLA2XXX_NAMELEN];
|
|
/* map for fc_port pointers in 24-bit FC Port ID space */
|
|
struct btree_head32 lport_fcport_map;
|
|
/* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */
|
|
struct tcm_qla2xxx_fc_loopid *lport_loopid_map;
|
|
/* Pointer to struct scsi_qla_host from qla2xxx LLD */
|
|
struct scsi_qla_host *qla_vha;
|
|
/* Pointer to struct qla_tgt pointer */
|
|
struct qla_tgt lport_qla_tgt;
|
|
/* Pointer to TPG=1 for non NPIV mode */
|
|
struct tcm_qla2xxx_tpg *tpg_1;
|
|
/* Returned by tcm_qla2xxx_make_lport() */
|
|
struct se_wwn lport_wwn;
|
|
};
|