Commit 4ba3069f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits)
  target: Set additional sense length field in sense data
  target: Remove legacy device status check from transport_execute_tasks
  target: Remove __transport_execute_tasks() for each processing context
  target: Remove extra se_device->execute_task_lock access in fast path
  target: Drop se_device TCQ queue_depth usage from I/O path
  target: Fix possible NULL pointer with __transport_execute_tasks
  target: Remove TFO->check_release_cmd() fabric API caller
  tcm_fc: Convert ft_send_work to use target_submit_cmd
  target: Add target_submit_cmd() for process context fabric submission
  target: Make target_put_sess_cmd use target_release_cmd_kref
  target: Set response format in INQUIRY response
  target: tcm_mod_builder: small fixups
  Documentation/target: Fix tcm_mod_builder.py build breakage
  target: remove overagressive ____cacheline_aligned annoations
  tcm_loop: bump max_sectors
  target/configs: remove trailing newline from udev_path and alias
  iscsi-target: fix chap identifier simple_strtoul usage
  target: remove useless casts
  target: simplify target_check_cdb_and_preempt
  target: Move core_scsi3_check_cdb_abort_and_preempt
  ...
parents 507a03c1 895f3022
This diff is collapsed.
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_tmr.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_parameters.h" #include "iscsi_target_parameters.h"
...@@ -284,8 +283,8 @@ static struct iscsi_np *iscsit_get_np( ...@@ -284,8 +283,8 @@ static struct iscsi_np *iscsit_get_np(
sock_in6 = (struct sockaddr_in6 *)sockaddr; sock_in6 = (struct sockaddr_in6 *)sockaddr;
sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr; sock_in6_e = (struct sockaddr_in6 *)&np->np_sockaddr;
if (!memcmp((void *)&sock_in6->sin6_addr.in6_u, if (!memcmp(&sock_in6->sin6_addr.in6_u,
(void *)&sock_in6_e->sin6_addr.in6_u, &sock_in6_e->sin6_addr.in6_u,
sizeof(struct in6_addr))) sizeof(struct in6_addr)))
ip_match = 1; ip_match = 1;
...@@ -1225,7 +1224,7 @@ static void iscsit_do_crypto_hash_buf( ...@@ -1225,7 +1224,7 @@ static void iscsit_do_crypto_hash_buf(
crypto_hash_init(hash); crypto_hash_init(hash);
sg_init_one(&sg, (u8 *)buf, payload_length); sg_init_one(&sg, buf, payload_length);
crypto_hash_update(hash, &sg, payload_length); crypto_hash_update(hash, &sg, payload_length);
if (padding) { if (padding) {
...@@ -1603,7 +1602,7 @@ static int iscsit_handle_nop_out( ...@@ -1603,7 +1602,7 @@ static int iscsit_handle_nop_out(
/* /*
* Attach ping data to struct iscsi_cmd->buf_ptr. * Attach ping data to struct iscsi_cmd->buf_ptr.
*/ */
cmd->buf_ptr = (void *)ping_data; cmd->buf_ptr = ping_data;
cmd->buf_ptr_size = payload_length; cmd->buf_ptr_size = payload_length;
pr_debug("Got %u bytes of NOPOUT ping" pr_debug("Got %u bytes of NOPOUT ping"
...@@ -3197,7 +3196,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) ...@@ -3197,7 +3196,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
end_of_buf = 1; end_of_buf = 1;
goto eob; goto eob;
} }
memcpy((void *)payload + payload_len, buf, len); memcpy(payload + payload_len, buf, len);
payload_len += len; payload_len += len;
spin_lock(&tiqn->tiqn_tpg_lock); spin_lock(&tiqn->tiqn_tpg_lock);
...@@ -3229,7 +3228,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd) ...@@ -3229,7 +3228,7 @@ static int iscsit_build_sendtargets_response(struct iscsi_cmd *cmd)
end_of_buf = 1; end_of_buf = 1;
goto eob; goto eob;
} }
memcpy((void *)payload + payload_len, buf, len); memcpy(payload + payload_len, buf, len);
payload_len += len; payload_len += len;
} }
spin_unlock(&tpg->tpg_np_lock); spin_unlock(&tpg->tpg_np_lock);
...@@ -3486,7 +3485,7 @@ int iscsi_target_tx_thread(void *arg) ...@@ -3486,7 +3485,7 @@ int iscsi_target_tx_thread(void *arg)
struct iscsi_conn *conn; struct iscsi_conn *conn;
struct iscsi_queue_req *qr = NULL; struct iscsi_queue_req *qr = NULL;
struct se_cmd *se_cmd; struct se_cmd *se_cmd;
struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; struct iscsi_thread_set *ts = arg;
/* /*
* Allow ourselves to be interrupted by SIGINT so that a * Allow ourselves to be interrupted by SIGINT so that a
* connection recovery / failure event can be triggered externally. * connection recovery / failure event can be triggered externally.
...@@ -3775,7 +3774,7 @@ int iscsi_target_rx_thread(void *arg) ...@@ -3775,7 +3774,7 @@ int iscsi_target_rx_thread(void *arg)
u8 buffer[ISCSI_HDR_LEN], opcode; u8 buffer[ISCSI_HDR_LEN], opcode;
u32 checksum = 0, digest = 0; u32 checksum = 0, digest = 0;
struct iscsi_conn *conn = NULL; struct iscsi_conn *conn = NULL;
struct iscsi_thread_set *ts = (struct iscsi_thread_set *)arg; struct iscsi_thread_set *ts = arg;
struct kvec iov; struct kvec iov;
/* /*
* Allow ourselves to be interrupted by SIGINT so that a * Allow ourselves to be interrupted by SIGINT so that a
......
...@@ -82,7 +82,7 @@ static void chap_gen_challenge( ...@@ -82,7 +82,7 @@ static void chap_gen_challenge(
unsigned int *c_len) unsigned int *c_len)
{ {
unsigned char challenge_asciihex[CHAP_CHALLENGE_LENGTH * 2 + 1]; unsigned char challenge_asciihex[CHAP_CHALLENGE_LENGTH * 2 + 1];
struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; struct iscsi_chap *chap = conn->auth_protocol;
memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1);
...@@ -120,7 +120,7 @@ static struct iscsi_chap *chap_server_open( ...@@ -120,7 +120,7 @@ static struct iscsi_chap *chap_server_open(
if (!conn->auth_protocol) if (!conn->auth_protocol)
return NULL; return NULL;
chap = (struct iscsi_chap *) conn->auth_protocol; chap = conn->auth_protocol;
/* /*
* We only support MD5 MDA presently. * We only support MD5 MDA presently.
*/ */
...@@ -165,14 +165,15 @@ static int chap_server_compute_md5( ...@@ -165,14 +165,15 @@ static int chap_server_compute_md5(
unsigned int *nr_out_len) unsigned int *nr_out_len)
{ {
char *endptr; char *endptr;
unsigned char id, digest[MD5_SIGNATURE_SIZE]; unsigned long id;
unsigned char digest[MD5_SIGNATURE_SIZE];
unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2];
unsigned char identifier[10], *challenge = NULL; unsigned char identifier[10], *challenge = NULL;
unsigned char *challenge_binhex = NULL; unsigned char *challenge_binhex = NULL;
unsigned char client_digest[MD5_SIGNATURE_SIZE]; unsigned char client_digest[MD5_SIGNATURE_SIZE];
unsigned char server_digest[MD5_SIGNATURE_SIZE]; unsigned char server_digest[MD5_SIGNATURE_SIZE];
unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH]; unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH];
struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; struct iscsi_chap *chap = conn->auth_protocol;
struct crypto_hash *tfm; struct crypto_hash *tfm;
struct hash_desc desc; struct hash_desc desc;
struct scatterlist sg; struct scatterlist sg;
...@@ -246,7 +247,7 @@ static int chap_server_compute_md5( ...@@ -246,7 +247,7 @@ static int chap_server_compute_md5(
goto out; goto out;
} }
sg_init_one(&sg, (void *)&chap->id, 1); sg_init_one(&sg, &chap->id, 1);
ret = crypto_hash_update(&desc, &sg, 1); ret = crypto_hash_update(&desc, &sg, 1);
if (ret < 0) { if (ret < 0) {
pr_err("crypto_hash_update() failed for id\n"); pr_err("crypto_hash_update() failed for id\n");
...@@ -254,7 +255,7 @@ static int chap_server_compute_md5( ...@@ -254,7 +255,7 @@ static int chap_server_compute_md5(
goto out; goto out;
} }
sg_init_one(&sg, (void *)&auth->password, strlen(auth->password)); sg_init_one(&sg, &auth->password, strlen(auth->password));
ret = crypto_hash_update(&desc, &sg, strlen(auth->password)); ret = crypto_hash_update(&desc, &sg, strlen(auth->password));
if (ret < 0) { if (ret < 0) {
pr_err("crypto_hash_update() failed for password\n"); pr_err("crypto_hash_update() failed for password\n");
...@@ -262,7 +263,7 @@ static int chap_server_compute_md5( ...@@ -262,7 +263,7 @@ static int chap_server_compute_md5(
goto out; goto out;
} }
sg_init_one(&sg, (void *)chap->challenge, CHAP_CHALLENGE_LENGTH); sg_init_one(&sg, chap->challenge, CHAP_CHALLENGE_LENGTH);
ret = crypto_hash_update(&desc, &sg, CHAP_CHALLENGE_LENGTH); ret = crypto_hash_update(&desc, &sg, CHAP_CHALLENGE_LENGTH);
if (ret < 0) { if (ret < 0) {
pr_err("crypto_hash_update() failed for challenge\n"); pr_err("crypto_hash_update() failed for challenge\n");
...@@ -305,14 +306,17 @@ static int chap_server_compute_md5( ...@@ -305,14 +306,17 @@ static int chap_server_compute_md5(
} }
if (type == HEX) if (type == HEX)
id = (unsigned char)simple_strtoul((char *)&identifier[2], id = simple_strtoul(&identifier[2], &endptr, 0);
&endptr, 0);
else else
id = (unsigned char)simple_strtoul(identifier, &endptr, 0); id = simple_strtoul(identifier, &endptr, 0);
if (id > 255) {
pr_err("chap identifier: %lu greater than 255\n", id);
goto out;
}
/* /*
* RFC 1994 says Identifier is no more than octet (8 bits). * RFC 1994 says Identifier is no more than octet (8 bits).
*/ */
pr_debug("[server] Got CHAP_I=%d\n", id); pr_debug("[server] Got CHAP_I=%lu\n", id);
/* /*
* Get CHAP_C. * Get CHAP_C.
*/ */
...@@ -351,7 +355,7 @@ static int chap_server_compute_md5( ...@@ -351,7 +355,7 @@ static int chap_server_compute_md5(
goto out; goto out;
} }
sg_init_one(&sg, (void *)&id, 1); sg_init_one(&sg, &id, 1);
ret = crypto_hash_update(&desc, &sg, 1); ret = crypto_hash_update(&desc, &sg, 1);
if (ret < 0) { if (ret < 0) {
pr_err("crypto_hash_update() failed for id\n"); pr_err("crypto_hash_update() failed for id\n");
...@@ -359,7 +363,7 @@ static int chap_server_compute_md5( ...@@ -359,7 +363,7 @@ static int chap_server_compute_md5(
goto out; goto out;
} }
sg_init_one(&sg, (void *)auth->password_mutual, sg_init_one(&sg, auth->password_mutual,
strlen(auth->password_mutual)); strlen(auth->password_mutual));
ret = crypto_hash_update(&desc, &sg, strlen(auth->password_mutual)); ret = crypto_hash_update(&desc, &sg, strlen(auth->password_mutual));
if (ret < 0) { if (ret < 0) {
...@@ -371,7 +375,7 @@ static int chap_server_compute_md5( ...@@ -371,7 +375,7 @@ static int chap_server_compute_md5(
/* /*
* Convert received challenge to binary hex. * Convert received challenge to binary hex.
*/ */
sg_init_one(&sg, (void *)challenge_binhex, challenge_len); sg_init_one(&sg, challenge_binhex, challenge_len);
ret = crypto_hash_update(&desc, &sg, challenge_len); ret = crypto_hash_update(&desc, &sg, challenge_len);
if (ret < 0) { if (ret < 0) {
pr_err("crypto_hash_update() failed for ma challenge\n"); pr_err("crypto_hash_update() failed for ma challenge\n");
...@@ -414,7 +418,7 @@ static int chap_got_response( ...@@ -414,7 +418,7 @@ static int chap_got_response(
char *nr_out_ptr, char *nr_out_ptr,
unsigned int *nr_out_len) unsigned int *nr_out_len)
{ {
struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; struct iscsi_chap *chap = conn->auth_protocol;
switch (chap->digest_type) { switch (chap->digest_type) {
case CHAP_DIGEST_MD5: case CHAP_DIGEST_MD5:
...@@ -437,7 +441,7 @@ u32 chap_main_loop( ...@@ -437,7 +441,7 @@ u32 chap_main_loop(
int *in_len, int *in_len,
int *out_len) int *out_len)
{ {
struct iscsi_chap *chap = (struct iscsi_chap *) conn->auth_protocol; struct iscsi_chap *chap = conn->auth_protocol;
if (!chap) { if (!chap) {
chap = chap_server_open(conn, auth, in_text, out_text, out_len); chap = chap_server_open(conn, auth, in_text, out_text, out_len);
......
...@@ -22,12 +22,8 @@ ...@@ -22,12 +22,8 @@
#include <linux/configfs.h> #include <linux/configfs.h>
#include <linux/export.h> #include <linux/export.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_fabric_configfs.h> #include <target/target_core_fabric_configfs.h>
#include <target/target_core_fabric_lib.h>
#include <target/target_core_device.h>
#include <target/target_core_tpg.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
...@@ -56,8 +52,7 @@ struct iscsi_portal_group *lio_get_tpg_from_tpg_item( ...@@ -56,8 +52,7 @@ struct iscsi_portal_group *lio_get_tpg_from_tpg_item(
{ {
struct se_portal_group *se_tpg = container_of(to_config_group(item), struct se_portal_group *se_tpg = container_of(to_config_group(item),
struct se_portal_group, tpg_group); struct se_portal_group, tpg_group);
struct iscsi_portal_group *tpg = struct iscsi_portal_group *tpg = se_tpg->se_tpg_fabric_ptr;
(struct iscsi_portal_group *)se_tpg->se_tpg_fabric_ptr;
int ret; int ret;
if (!tpg) { if (!tpg) {
...@@ -1225,7 +1220,7 @@ struct se_portal_group *lio_target_tiqn_addtpg( ...@@ -1225,7 +1220,7 @@ struct se_portal_group *lio_target_tiqn_addtpg(
ret = core_tpg_register( ret = core_tpg_register(
&lio_target_fabric_configfs->tf_ops, &lio_target_fabric_configfs->tf_ops,
wwn, &tpg->tpg_se_tpg, (void *)tpg, wwn, &tpg->tpg_se_tpg, tpg,
TRANSPORT_TPG_TYPE_NORMAL); TRANSPORT_TPG_TYPE_NORMAL);
if (ret < 0) if (ret < 0)
return NULL; return NULL;
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_device.h" #include "iscsi_target_device.h"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_seq_pdu_list.h" #include "iscsi_target_seq_pdu_list.h"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_seq_pdu_list.h" #include "iscsi_target_seq_pdu_list.h"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_datain_values.h" #include "iscsi_target_datain_values.h"
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/crypto.h> #include <linux/crypto.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_tq.h" #include "iscsi_target_tq.h"
...@@ -143,7 +143,7 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn) ...@@ -143,7 +143,7 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn)
list_for_each_entry_safe(se_sess, se_sess_tmp, &se_tpg->tpg_sess_list, list_for_each_entry_safe(se_sess, se_sess_tmp, &se_tpg->tpg_sess_list,
sess_list) { sess_list) {
sess_p = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess_p = se_sess->fabric_sess_ptr;
spin_lock(&sess_p->conn_lock); spin_lock(&sess_p->conn_lock);
if (atomic_read(&sess_p->session_fall_back_to_erl0) || if (atomic_read(&sess_p->session_fall_back_to_erl0) ||
atomic_read(&sess_p->session_logout) || atomic_read(&sess_p->session_logout) ||
...@@ -151,9 +151,9 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn) ...@@ -151,9 +151,9 @@ int iscsi_check_for_session_reinstatement(struct iscsi_conn *conn)
spin_unlock(&sess_p->conn_lock); spin_unlock(&sess_p->conn_lock);
continue; continue;
} }
if (!memcmp((void *)sess_p->isid, (void *)conn->sess->isid, 6) && if (!memcmp(sess_p->isid, conn->sess->isid, 6) &&
(!strcmp((void *)sess_p->sess_ops->InitiatorName, (!strcmp(sess_p->sess_ops->InitiatorName,
(void *)initiatorname_param->value) && initiatorname_param->value) &&
(sess_p->sess_ops->SessionType == sessiontype))) { (sess_p->sess_ops->SessionType == sessiontype))) {
atomic_set(&sess_p->session_reinstatement, 1); atomic_set(&sess_p->session_reinstatement, 1);
spin_unlock(&sess_p->conn_lock); spin_unlock(&sess_p->conn_lock);
...@@ -229,7 +229,7 @@ static int iscsi_login_zero_tsih_s1( ...@@ -229,7 +229,7 @@ static int iscsi_login_zero_tsih_s1(
iscsi_login_set_conn_values(sess, conn, pdu->cid); iscsi_login_set_conn_values(sess, conn, pdu->cid);
sess->init_task_tag = pdu->itt; sess->init_task_tag = pdu->itt;
memcpy((void *)&sess->isid, (void *)pdu->isid, 6); memcpy(&sess->isid, pdu->isid, 6);
sess->exp_cmd_sn = pdu->cmdsn; sess->exp_cmd_sn = pdu->cmdsn;
INIT_LIST_HEAD(&sess->sess_conn_list); INIT_LIST_HEAD(&sess->sess_conn_list);
INIT_LIST_HEAD(&sess->sess_ooo_cmdsn_list); INIT_LIST_HEAD(&sess->sess_ooo_cmdsn_list);
...@@ -440,8 +440,7 @@ static int iscsi_login_non_zero_tsih_s2( ...@@ -440,8 +440,7 @@ static int iscsi_login_non_zero_tsih_s2(
atomic_read(&sess_p->session_logout) || atomic_read(&sess_p->session_logout) ||
(sess_p->time2retain_timer_flags & ISCSI_TF_EXPIRED)) (sess_p->time2retain_timer_flags & ISCSI_TF_EXPIRED))
continue; continue;
if (!memcmp((const void *)sess_p->isid, if (!memcmp(sess_p->isid, pdu->isid, 6) &&
(const void *)pdu->isid, 6) &&
(sess_p->tsih == pdu->tsih)) { (sess_p->tsih == pdu->tsih)) {
iscsit_inc_session_usage_count(sess_p); iscsit_inc_session_usage_count(sess_p);
iscsit_stop_time2retain_timer(sess_p); iscsit_stop_time2retain_timer(sess_p);
...@@ -654,7 +653,7 @@ static int iscsi_post_login_handler( ...@@ -654,7 +653,7 @@ static int iscsi_post_login_handler(
spin_lock_bh(&se_tpg->session_lock); spin_lock_bh(&se_tpg->session_lock);
__transport_register_session(&sess->tpg->tpg_se_tpg, __transport_register_session(&sess->tpg->tpg_se_tpg,
se_sess->se_node_acl, se_sess, (void *)sess); se_sess->se_node_acl, se_sess, sess);
pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n"); pr_debug("Moving to TARG_SESS_STATE_LOGGED_IN.\n");
sess->session_state = TARG_SESS_STATE_LOGGED_IN; sess->session_state = TARG_SESS_STATE_LOGGED_IN;
...@@ -811,7 +810,7 @@ int iscsi_target_setup_login_socket( ...@@ -811,7 +810,7 @@ int iscsi_target_setup_login_socket(
* Setup the np->np_sockaddr from the passed sockaddr setup * Setup the np->np_sockaddr from the passed sockaddr setup
* in iscsi_target_configfs.c code.. * in iscsi_target_configfs.c code..
*/ */
memcpy((void *)&np->np_sockaddr, (void *)sockaddr, memcpy(&np->np_sockaddr, sockaddr,
sizeof(struct __kernel_sockaddr_storage)); sizeof(struct __kernel_sockaddr_storage));
if (sockaddr->ss_family == AF_INET6) if (sockaddr->ss_family == AF_INET6)
...@@ -821,6 +820,7 @@ int iscsi_target_setup_login_socket( ...@@ -821,6 +820,7 @@ int iscsi_target_setup_login_socket(
/* /*
* Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY. * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY.
*/ */
/* FIXME: Someone please explain why this is endian-safe */
opt = 1; opt = 1;
if (np->np_network_transport == ISCSI_TCP) { if (np->np_network_transport == ISCSI_TCP) {
ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
...@@ -832,6 +832,7 @@ int iscsi_target_setup_login_socket( ...@@ -832,6 +832,7 @@ int iscsi_target_setup_login_socket(
} }
} }
/* FIXME: Someone please explain why this is endian-safe */
ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char *)&opt, sizeof(opt)); (char *)&opt, sizeof(opt));
if (ret < 0) { if (ret < 0) {
...@@ -1206,7 +1207,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) ...@@ -1206,7 +1207,7 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
int iscsi_target_login_thread(void *arg) int iscsi_target_login_thread(void *arg)
{ {
struct iscsi_np *np = (struct iscsi_np *)arg; struct iscsi_np *np = arg;
int ret; int ret;
allow_signal(SIGINT); allow_signal(SIGINT);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_tpg.h> #include <target/target_core_fabric.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_parameters.h" #include "iscsi_target_parameters.h"
...@@ -732,7 +732,7 @@ static void iscsi_initiatorname_tolower( ...@@ -732,7 +732,7 @@ static void iscsi_initiatorname_tolower(
u32 iqn_size = strlen(param_buf), i; u32 iqn_size = strlen(param_buf), i;
for (i = 0; i < iqn_size; i++) { for (i = 0; i < iqn_size; i++) {
c = (char *)&param_buf[i]; c = &param_buf[i];
if (!isupper(*c)) if (!isupper(*c))
continue; continue;
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
******************************************************************************/ ******************************************************************************/
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_device.h" #include "iscsi_target_device.h"
...@@ -135,7 +134,7 @@ extern int iscsit_na_nopin_timeout( ...@@ -135,7 +134,7 @@ extern int iscsit_na_nopin_timeout(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
spin_lock(&sess->conn_lock); spin_lock(&sess->conn_lock);
list_for_each_entry(conn, &sess->sess_conn_list, list_for_each_entry(conn, &sess->sess_conn_list,
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/export.h> #include <linux/export.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
...@@ -746,7 +745,7 @@ static ssize_t iscsi_stat_sess_show_attr_node( ...@@ -746,7 +745,7 @@ static ssize_t iscsi_stat_sess_show_attr_node(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%u\n", ret = snprintf(page, PAGE_SIZE, "%u\n",
sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX); sess->sess_ops->SessionType ? 0 : ISCSI_NODE_INDEX);
...@@ -770,7 +769,7 @@ static ssize_t iscsi_stat_sess_show_attr_indx( ...@@ -770,7 +769,7 @@ static ssize_t iscsi_stat_sess_show_attr_indx(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%u\n", ret = snprintf(page, PAGE_SIZE, "%u\n",
sess->session_index); sess->session_index);
...@@ -794,7 +793,7 @@ static ssize_t iscsi_stat_sess_show_attr_cmd_pdus( ...@@ -794,7 +793,7 @@ static ssize_t iscsi_stat_sess_show_attr_cmd_pdus(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus); ret = snprintf(page, PAGE_SIZE, "%u\n", sess->cmd_pdus);
} }
...@@ -817,7 +816,7 @@ static ssize_t iscsi_stat_sess_show_attr_rsp_pdus( ...@@ -817,7 +816,7 @@ static ssize_t iscsi_stat_sess_show_attr_rsp_pdus(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus); ret = snprintf(page, PAGE_SIZE, "%u\n", sess->rsp_pdus);
} }
...@@ -840,7 +839,7 @@ static ssize_t iscsi_stat_sess_show_attr_txdata_octs( ...@@ -840,7 +839,7 @@ static ssize_t iscsi_stat_sess_show_attr_txdata_octs(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%llu\n", ret = snprintf(page, PAGE_SIZE, "%llu\n",
(unsigned long long)sess->tx_data_octets); (unsigned long long)sess->tx_data_octets);
...@@ -864,7 +863,7 @@ static ssize_t iscsi_stat_sess_show_attr_rxdata_octs( ...@@ -864,7 +863,7 @@ static ssize_t iscsi_stat_sess_show_attr_rxdata_octs(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%llu\n", ret = snprintf(page, PAGE_SIZE, "%llu\n",
(unsigned long long)sess->rx_data_octets); (unsigned long long)sess->rx_data_octets);
...@@ -888,7 +887,7 @@ static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors( ...@@ -888,7 +887,7 @@ static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%u\n", ret = snprintf(page, PAGE_SIZE, "%u\n",
sess->conn_digest_errors); sess->conn_digest_errors);
...@@ -912,7 +911,7 @@ static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors( ...@@ -912,7 +911,7 @@ static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors(
spin_lock_bh(&se_nacl->nacl_sess_lock); spin_lock_bh(&se_nacl->nacl_sess_lock);
se_sess = se_nacl->nacl_sess; se_sess = se_nacl->nacl_sess;
if (se_sess) { if (se_sess) {
sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; sess = se_sess->fabric_sess_ptr;
if (sess) if (sess)
ret = snprintf(page, PAGE_SIZE, "%u\n", ret = snprintf(page, PAGE_SIZE, "%u\n",
sess->conn_timeout_errors); sess->conn_timeout_errors);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_seq_pdu_list.h" #include "iscsi_target_seq_pdu_list.h"
......
...@@ -19,10 +19,8 @@ ...@@ -19,10 +19,8 @@
******************************************************************************/ ******************************************************************************/
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/target_core_tpg.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
#include "iscsi_target_erl0.h" #include "iscsi_target_erl0.h"
...@@ -72,7 +70,7 @@ int iscsit_load_discovery_tpg(void) ...@@ -72,7 +70,7 @@ int iscsit_load_discovery_tpg(void)
ret = core_tpg_register( ret = core_tpg_register(
&lio_target_fabric_configfs->tf_ops, &lio_target_fabric_configfs->tf_ops,
NULL, &tpg->tpg_se_tpg, (void *)tpg, NULL, &tpg->tpg_se_tpg, tpg,
TRANSPORT_TPG_TYPE_DISCOVERY); TRANSPORT_TPG_TYPE_DISCOVERY);
if (ret < 0) { if (ret < 0) {
kfree(tpg); kfree(tpg);
......
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#include <scsi/scsi_tcq.h> #include <scsi/scsi_tcq.h>
#include <scsi/iscsi_proto.h> #include <scsi/iscsi_proto.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_tmr.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include "iscsi_target_core.h" #include "iscsi_target_core.h"
...@@ -289,7 +287,7 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr( ...@@ -289,7 +287,7 @@ struct iscsi_cmd *iscsit_allocate_se_cmd_for_tmr(
} }
se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd, se_cmd->se_tmr_req = core_tmr_alloc_req(se_cmd,
(void *)cmd->tmr_req, tcm_function, cmd->tmr_req, tcm_function,
GFP_KERNEL); GFP_KERNEL);
if (!se_cmd->se_tmr_req) if (!se_cmd->se_tmr_req)
goto out; goto out;
...@@ -1066,7 +1064,7 @@ static void iscsit_handle_nopin_response_timeout(unsigned long data) ...@@ -1066,7 +1064,7 @@ static void iscsit_handle_nopin_response_timeout(unsigned long data)
if (tiqn) { if (tiqn) {
spin_lock_bh(&tiqn->sess_err_stats.lock); spin_lock_bh(&tiqn->sess_err_stats.lock);
strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name, strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name,
(void *)conn->sess->sess_ops->InitiatorName); conn->sess->sess_ops->InitiatorName);
tiqn->sess_err_stats.last_sess_failure_type = tiqn->sess_err_stats.last_sess_failure_type =
ISCSI_SESS_ERR_CXN_TIMEOUT; ISCSI_SESS_ERR_CXN_TIMEOUT;
tiqn->sess_err_stats.cxn_timeout_errors++; tiqn->sess_err_stats.cxn_timeout_errors++;
......
...@@ -33,14 +33,9 @@ ...@@ -33,14 +33,9 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_fabric_configfs.h> #include <target/target_core_fabric_configfs.h>
#include <target/target_core_fabric_lib.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/target_core_device.h>
#include <target/target_core_tpg.h>
#include <target/target_core_tmr.h>
#include "tcm_loop.h" #include "tcm_loop.h"
...@@ -421,11 +416,11 @@ static struct scsi_host_template tcm_loop_driver_template = { ...@@ -421,11 +416,11 @@ static struct scsi_host_template tcm_loop_driver_template = {
.queuecommand = tcm_loop_queuecommand, .queuecommand = tcm_loop_queuecommand,
.change_queue_depth = tcm_loop_change_queue_depth, .change_queue_depth = tcm_loop_change_queue_depth,
.eh_device_reset_handler = tcm_loop_device_reset, .eh_device_reset_handler = tcm_loop_device_reset,
.can_queue = TL_SCSI_CAN_QUEUE, .can_queue = 1024,
.this_id = -1, .this_id = -1,
.sg_tablesize = TL_SCSI_SG_TABLESIZE, .sg_tablesize = 256,
.cmd_per_lun = TL_SCSI_CMD_PER_LUN, .cmd_per_lun = 1024,
.max_sectors = TL_SCSI_MAX_SECTORS, .max_sectors = 0xFFFF,
.use_clustering = DISABLE_CLUSTERING, .use_clustering = DISABLE_CLUSTERING,
.slave_alloc = tcm_loop_slave_alloc, .slave_alloc = tcm_loop_slave_alloc,
.slave_configure = tcm_loop_slave_configure, .slave_configure = tcm_loop_slave_configure,
...@@ -564,8 +559,7 @@ static char *tcm_loop_get_fabric_name(void) ...@@ -564,8 +559,7 @@ static char *tcm_loop_get_fabric_name(void)
static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg)
{ {
struct tcm_loop_tpg *tl_tpg = struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr;
(struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr;
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
/* /*
* tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba() * tl_proto_id is set at tcm_loop_configfs.c:tcm_loop_make_scsi_hba()
...@@ -592,8 +586,7 @@ static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg) ...@@ -592,8 +586,7 @@ static u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *se_tpg)
static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg)
{ {
struct tcm_loop_tpg *tl_tpg = struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr;
(struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr;
/* /*
* Return the passed NAA identifier for the SAS Target Port * Return the passed NAA identifier for the SAS Target Port
*/ */
...@@ -602,8 +595,7 @@ static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg) ...@@ -602,8 +595,7 @@ static char *tcm_loop_get_endpoint_wwn(struct se_portal_group *se_tpg)
static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg) static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg)
{ {
struct tcm_loop_tpg *tl_tpg = struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr;
(struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr;
/* /*
* This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83
* to represent the SCSI Target Port. * to represent the SCSI Target Port.
...@@ -623,8 +615,7 @@ static u32 tcm_loop_get_pr_transport_id( ...@@ -623,8 +615,7 @@ static u32 tcm_loop_get_pr_transport_id(
int *format_code, int *format_code,
unsigned char *buf) unsigned char *buf)
{ {
struct tcm_loop_tpg *tl_tpg = struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr;
(struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr;
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
switch (tl_hba->tl_proto_id) { switch (tl_hba->tl_proto_id) {
...@@ -653,8 +644,7 @@ static u32 tcm_loop_get_pr_transport_id_len( ...@@ -653,8 +644,7 @@ static u32 tcm_loop_get_pr_transport_id_len(
struct t10_pr_registration *pr_reg, struct t10_pr_registration *pr_reg,
int *format_code) int *format_code)
{ {
struct tcm_loop_tpg *tl_tpg = struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr;
(struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr;
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
switch (tl_hba->tl_proto_id) { switch (tl_hba->tl_proto_id) {
...@@ -687,8 +677,7 @@ static char *tcm_loop_parse_pr_out_transport_id( ...@@ -687,8 +677,7 @@ static char *tcm_loop_parse_pr_out_transport_id(
u32 *out_tid_len, u32 *out_tid_len,
char **port_nexus_ptr) char **port_nexus_ptr)
{ {
struct tcm_loop_tpg *tl_tpg = struct tcm_loop_tpg *tl_tpg = se_tpg->se_tpg_fabric_ptr;
(struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr;
struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba;
switch (tl_hba->tl_proto_id) { switch (tl_hba->tl_proto_id) {
......
#define TCM_LOOP_VERSION "v2.1-rc1" #define TCM_LOOP_VERSION "v2.1-rc1"
#define TL_WWN_ADDR_LEN 256 #define TL_WWN_ADDR_LEN 256
#define TL_TPGS_PER_HBA 32 #define TL_TPGS_PER_HBA 32
/*
* Defaults for struct scsi_host_template tcm_loop_driver_template
*
* We use large can_queue and cmd_per_lun here and let TCM enforce
* the underlying se_device_t->queue_depth.
*/
#define TL_SCSI_CAN_QUEUE 1024
#define TL_SCSI_CMD_PER_LUN 1024
#define TL_SCSI_MAX_SECTORS 1024
#define TL_SCSI_SG_TABLESIZE 256
/* /*
* Used in tcm_loop_driver_probe() for struct Scsi_Host->max_cmd_len * Used in tcm_loop_driver_probe() for struct Scsi_Host->max_cmd_len
*/ */
......
...@@ -32,13 +32,12 @@ ...@@ -32,13 +32,12 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_hba.h"
#include "target_core_ua.h" #include "target_core_ua.h"
static int core_alua_check_transition(int state, int *primary); static int core_alua_check_transition(int state, int *primary);
......
...@@ -29,10 +29,11 @@ ...@@ -29,10 +29,11 @@
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_backend.h>
#include <target/target_core_fabric_ops.h> #include <target/target_core_fabric.h>
#include "target_core_internal.h"
#include "target_core_ua.h" #include "target_core_ua.h"
#include "target_core_cdb.h"
static void static void
target_fill_alua_data(struct se_port *port, unsigned char *buf) target_fill_alua_data(struct se_port *port, unsigned char *buf)
...@@ -93,6 +94,18 @@ target_emulate_inquiry_std(struct se_cmd *cmd) ...@@ -93,6 +94,18 @@ target_emulate_inquiry_std(struct se_cmd *cmd)
} }
buf[2] = dev->transport->get_device_rev(dev); buf[2] = dev->transport->get_device_rev(dev);
/*
* NORMACA and HISUP = 0, RESPONSE DATA FORMAT = 2
*
* SPC4 says:
* A RESPONSE DATA FORMAT field set to 2h indicates that the
* standard INQUIRY data is in the format defined in this
* standard. Response data format values less than 2h are
* obsolete. Response data format values greater than 2h are
* reserved.
*/
buf[3] = 2;
/* /*
* Enable SCCS and TPGS fields for Emulated ALUA * Enable SCCS and TPGS fields for Emulated ALUA
*/ */
...@@ -115,11 +128,9 @@ target_emulate_inquiry_std(struct se_cmd *cmd) ...@@ -115,11 +128,9 @@ target_emulate_inquiry_std(struct se_cmd *cmd)
goto out; goto out;
} }
snprintf((unsigned char *)&buf[8], 8, "LIO-ORG"); snprintf(&buf[8], 8, "LIO-ORG");
snprintf((unsigned char *)&buf[16], 16, "%s", snprintf(&buf[16], 16, "%s", dev->se_sub_dev->t10_wwn.model);
&dev->se_sub_dev->t10_wwn.model[0]); snprintf(&buf[32], 4, "%s", dev->se_sub_dev->t10_wwn.revision);
snprintf((unsigned char *)&buf[32], 4, "%s",
&dev->se_sub_dev->t10_wwn.revision[0]);
buf[4] = 31; /* Set additional length to 31 */ buf[4] = 31; /* Set additional length to 31 */
out: out:
...@@ -138,8 +149,7 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) ...@@ -138,8 +149,7 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf)
SDF_EMULATED_VPD_UNIT_SERIAL) { SDF_EMULATED_VPD_UNIT_SERIAL) {
u32 unit_serial_len; u32 unit_serial_len;
unit_serial_len = unit_serial_len = strlen(dev->se_sub_dev->t10_wwn.unit_serial);
strlen(&dev->se_sub_dev->t10_wwn.unit_serial[0]);
unit_serial_len++; /* For NULL Terminator */ unit_serial_len++; /* For NULL Terminator */
if (((len + 4) + unit_serial_len) > cmd->data_length) { if (((len + 4) + unit_serial_len) > cmd->data_length) {
...@@ -148,8 +158,8 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf) ...@@ -148,8 +158,8 @@ target_emulate_evpd_80(struct se_cmd *cmd, unsigned char *buf)
buf[3] = (len & 0xff); buf[3] = (len & 0xff);
return 0; return 0;
} }
len += sprintf((unsigned char *)&buf[4], "%s", len += sprintf(&buf[4], "%s",
&dev->se_sub_dev->t10_wwn.unit_serial[0]); dev->se_sub_dev->t10_wwn.unit_serial);
len++; /* Extra Byte for NULL Terminator */ len++; /* Extra Byte for NULL Terminator */
buf[3] = len; buf[3] = len;
} }
...@@ -279,14 +289,13 @@ target_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf) ...@@ -279,14 +289,13 @@ target_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
len += (prod_len + unit_serial_len); len += (prod_len + unit_serial_len);
goto check_port; goto check_port;
} }
id_len += sprintf((unsigned char *)&buf[off+12], id_len += sprintf(&buf[off+12], "%s:%s", prod,
"%s:%s", prod,
&dev->se_sub_dev->t10_wwn.unit_serial[0]); &dev->se_sub_dev->t10_wwn.unit_serial[0]);
} }
buf[off] = 0x2; /* ASCII */ buf[off] = 0x2; /* ASCII */
buf[off+1] = 0x1; /* T10 Vendor ID */ buf[off+1] = 0x1; /* T10 Vendor ID */
buf[off+2] = 0x0; buf[off+2] = 0x0;
memcpy((unsigned char *)&buf[off+4], "LIO-ORG", 8); memcpy(&buf[off+4], "LIO-ORG", 8);
/* Extra Byte for NULL Terminator */ /* Extra Byte for NULL Terminator */
id_len++; id_len++;
/* Identifier Length */ /* Identifier Length */
......
#ifndef TARGET_CORE_CDB_H
#define TARGET_CORE_CDB_H
int target_emulate_inquiry(struct se_task *task);
int target_emulate_readcapacity(struct se_task *task);
int target_emulate_readcapacity_16(struct se_task *task);
int target_emulate_modesense(struct se_task *task);
int target_emulate_request_sense(struct se_task *task);
int target_emulate_unmap(struct se_task *task);
int target_emulate_write_same(struct se_task *task);
int target_emulate_synchronize_cache(struct se_task *task);
int target_emulate_noop(struct se_task *task);
#endif /* TARGET_CORE_CDB_H */
...@@ -39,18 +39,16 @@ ...@@ -39,18 +39,16 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_fabric_configfs.h> #include <target/target_core_fabric_configfs.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
#include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_hba.h"
#include "target_core_pr.h" #include "target_core_pr.h"
#include "target_core_rd.h" #include "target_core_rd.h"
#include "target_core_stat.h"
extern struct t10_alua_lu_gp *default_lu_gp; extern struct t10_alua_lu_gp *default_lu_gp;
...@@ -1452,7 +1450,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata( ...@@ -1452,7 +1450,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata(
return -ENOMEM; return -ENOMEM;
orig = opts; orig = opts;
while ((ptr = strsep(&opts, ",")) != NULL) { while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr) if (!*ptr)
continue; continue;
...@@ -1631,7 +1629,7 @@ static struct config_item_type target_core_dev_pr_cit = { ...@@ -1631,7 +1629,7 @@ static struct config_item_type target_core_dev_pr_cit = {
static ssize_t target_core_show_dev_info(void *p, char *page) static ssize_t target_core_show_dev_info(void *p, char *page)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
struct se_hba *hba = se_dev->se_dev_hba; struct se_hba *hba = se_dev->se_dev_hba;
struct se_subsystem_api *t = hba->transport; struct se_subsystem_api *t = hba->transport;
int bl = 0; int bl = 0;
...@@ -1659,7 +1657,7 @@ static ssize_t target_core_store_dev_control( ...@@ -1659,7 +1657,7 @@ static ssize_t target_core_store_dev_control(
const char *page, const char *page,
size_t count) size_t count)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
struct se_hba *hba = se_dev->se_dev_hba; struct se_hba *hba = se_dev->se_dev_hba;
struct se_subsystem_api *t = hba->transport; struct se_subsystem_api *t = hba->transport;
...@@ -1682,7 +1680,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_control = { ...@@ -1682,7 +1680,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_control = {
static ssize_t target_core_show_dev_alias(void *p, char *page) static ssize_t target_core_show_dev_alias(void *p, char *page)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
if (!(se_dev->su_dev_flags & SDF_USING_ALIAS)) if (!(se_dev->su_dev_flags & SDF_USING_ALIAS))
return 0; return 0;
...@@ -1695,7 +1693,7 @@ static ssize_t target_core_store_dev_alias( ...@@ -1695,7 +1693,7 @@ static ssize_t target_core_store_dev_alias(
const char *page, const char *page,
size_t count) size_t count)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
struct se_hba *hba = se_dev->se_dev_hba; struct se_hba *hba = se_dev->se_dev_hba;
ssize_t read_bytes; ssize_t read_bytes;
...@@ -1710,6 +1708,9 @@ static ssize_t target_core_store_dev_alias( ...@@ -1710,6 +1708,9 @@ static ssize_t target_core_store_dev_alias(
read_bytes = snprintf(&se_dev->se_dev_alias[0], SE_DEV_ALIAS_LEN, read_bytes = snprintf(&se_dev->se_dev_alias[0], SE_DEV_ALIAS_LEN,
"%s", page); "%s", page);
if (se_dev->se_dev_alias[read_bytes - 1] == '\n')
se_dev->se_dev_alias[read_bytes - 1] = '\0';
pr_debug("Target_Core_ConfigFS: %s/%s set alias: %s\n", pr_debug("Target_Core_ConfigFS: %s/%s set alias: %s\n",
config_item_name(&hba->hba_group.cg_item), config_item_name(&hba->hba_group.cg_item),
config_item_name(&se_dev->se_dev_group.cg_item), config_item_name(&se_dev->se_dev_group.cg_item),
...@@ -1728,7 +1729,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_alias = { ...@@ -1728,7 +1729,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_alias = {
static ssize_t target_core_show_dev_udev_path(void *p, char *page) static ssize_t target_core_show_dev_udev_path(void *p, char *page)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH)) if (!(se_dev->su_dev_flags & SDF_USING_UDEV_PATH))
return 0; return 0;
...@@ -1741,7 +1742,7 @@ static ssize_t target_core_store_dev_udev_path( ...@@ -1741,7 +1742,7 @@ static ssize_t target_core_store_dev_udev_path(
const char *page, const char *page,
size_t count) size_t count)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
struct se_hba *hba = se_dev->se_dev_hba; struct se_hba *hba = se_dev->se_dev_hba;
ssize_t read_bytes; ssize_t read_bytes;
...@@ -1756,6 +1757,9 @@ static ssize_t target_core_store_dev_udev_path( ...@@ -1756,6 +1757,9 @@ static ssize_t target_core_store_dev_udev_path(
read_bytes = snprintf(&se_dev->se_dev_udev_path[0], SE_UDEV_PATH_LEN, read_bytes = snprintf(&se_dev->se_dev_udev_path[0], SE_UDEV_PATH_LEN,
"%s", page); "%s", page);
if (se_dev->se_dev_udev_path[read_bytes - 1] == '\n')
se_dev->se_dev_udev_path[read_bytes - 1] = '\0';
pr_debug("Target_Core_ConfigFS: %s/%s set udev_path: %s\n", pr_debug("Target_Core_ConfigFS: %s/%s set udev_path: %s\n",
config_item_name(&hba->hba_group.cg_item), config_item_name(&hba->hba_group.cg_item),
config_item_name(&se_dev->se_dev_group.cg_item), config_item_name(&se_dev->se_dev_group.cg_item),
...@@ -1777,7 +1781,7 @@ static ssize_t target_core_store_dev_enable( ...@@ -1777,7 +1781,7 @@ static ssize_t target_core_store_dev_enable(
const char *page, const char *page,
size_t count) size_t count)
{ {
struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *se_dev = p;
struct se_device *dev; struct se_device *dev;
struct se_hba *hba = se_dev->se_dev_hba; struct se_hba *hba = se_dev->se_dev_hba;
struct se_subsystem_api *t = hba->transport; struct se_subsystem_api *t = hba->transport;
...@@ -1822,7 +1826,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_enable = { ...@@ -1822,7 +1826,7 @@ static struct target_core_configfs_attribute target_core_attr_dev_enable = {
static ssize_t target_core_show_alua_lu_gp(void *p, char *page) static ssize_t target_core_show_alua_lu_gp(void *p, char *page)
{ {
struct se_device *dev; struct se_device *dev;
struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *su_dev = p;
struct config_item *lu_ci; struct config_item *lu_ci;
struct t10_alua_lu_gp *lu_gp; struct t10_alua_lu_gp *lu_gp;
struct t10_alua_lu_gp_member *lu_gp_mem; struct t10_alua_lu_gp_member *lu_gp_mem;
...@@ -1860,7 +1864,7 @@ static ssize_t target_core_store_alua_lu_gp( ...@@ -1860,7 +1864,7 @@ static ssize_t target_core_store_alua_lu_gp(
size_t count) size_t count)
{ {
struct se_device *dev; struct se_device *dev;
struct se_subsystem_dev *su_dev = (struct se_subsystem_dev *)p; struct se_subsystem_dev *su_dev = p;
struct se_hba *hba = su_dev->se_dev_hba; struct se_hba *hba = su_dev->se_dev_hba;
struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL;
struct t10_alua_lu_gp_member *lu_gp_mem; struct t10_alua_lu_gp_member *lu_gp_mem;
......
...@@ -42,13 +42,11 @@ ...@@ -42,13 +42,11 @@
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_tpg.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_hba.h"
#include "target_core_pr.h" #include "target_core_pr.h"
#include "target_core_ua.h" #include "target_core_ua.h"
...@@ -1134,8 +1132,6 @@ int se_dev_set_emulate_rest_reord(struct se_device *dev, int flag) ...@@ -1134,8 +1132,6 @@ int se_dev_set_emulate_rest_reord(struct se_device *dev, int flag)
*/ */
int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth)
{ {
u32 orig_queue_depth = dev->queue_depth;
if (atomic_read(&dev->dev_export_obj.obj_access_count)) { if (atomic_read(&dev->dev_export_obj.obj_access_count)) {
pr_err("dev[%p]: Unable to change SE Device TCQ while" pr_err("dev[%p]: Unable to change SE Device TCQ while"
" dev_export_obj: %d count exists\n", dev, " dev_export_obj: %d count exists\n", dev,
...@@ -1169,11 +1165,6 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) ...@@ -1169,11 +1165,6 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth)
} }
dev->se_sub_dev->se_dev_attrib.queue_depth = dev->queue_depth = queue_depth; dev->se_sub_dev->se_dev_attrib.queue_depth = dev->queue_depth = queue_depth;
if (queue_depth > orig_queue_depth)
atomic_add(queue_depth - orig_queue_depth, &dev->depth_left);
else if (queue_depth < orig_queue_depth)
atomic_sub(orig_queue_depth - queue_depth, &dev->depth_left);
pr_debug("dev[%p]: SE Device TCQ Depth changed to: %u\n", pr_debug("dev[%p]: SE Device TCQ Depth changed to: %u\n",
dev, queue_depth); dev, queue_depth);
return 0; return 0;
......
...@@ -36,18 +36,14 @@ ...@@ -36,18 +36,14 @@
#include <linux/configfs.h> #include <linux/configfs.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_fabric.h>
#include <target/target_core_tpg.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_fabric_configfs.h> #include <target/target_core_fabric_configfs.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
#include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_hba.h"
#include "target_core_pr.h" #include "target_core_pr.h"
#include "target_core_stat.h"
#define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \ #define TF_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \
static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf) \
......
...@@ -34,13 +34,10 @@ ...@@ -34,13 +34,10 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_lib.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include "target_core_hba.h" #include "target_core_internal.h"
#include "target_core_pr.h" #include "target_core_pr.h"
/* /*
...@@ -402,7 +399,7 @@ char *iscsi_parse_pr_out_transport_id( ...@@ -402,7 +399,7 @@ char *iscsi_parse_pr_out_transport_id(
add_len = ((buf[2] >> 8) & 0xff); add_len = ((buf[2] >> 8) & 0xff);
add_len |= (buf[3] & 0xff); add_len |= (buf[3] & 0xff);
tid_len = strlen((char *)&buf[4]); tid_len = strlen(&buf[4]);
tid_len += 4; /* Add four bytes for iSCSI Transport ID header */ tid_len += 4; /* Add four bytes for iSCSI Transport ID header */
tid_len += 1; /* Add one byte for NULL terminator */ tid_len += 1; /* Add one byte for NULL terminator */
padding = ((-tid_len) & 3); padding = ((-tid_len) & 3);
...@@ -423,11 +420,11 @@ char *iscsi_parse_pr_out_transport_id( ...@@ -423,11 +420,11 @@ char *iscsi_parse_pr_out_transport_id(
* format. * format.
*/ */
if (format_code == 0x40) { if (format_code == 0x40) {
p = strstr((char *)&buf[4], ",i,0x"); p = strstr(&buf[4], ",i,0x");
if (!p) { if (!p) {
pr_err("Unable to locate \",i,0x\" seperator" pr_err("Unable to locate \",i,0x\" seperator"
" for Initiator port identifier: %s\n", " for Initiator port identifier: %s\n",
(char *)&buf[4]); &buf[4]);
return NULL; return NULL;
} }
*p = '\0'; /* Terminate iSCSI Name */ *p = '\0'; /* Terminate iSCSI Name */
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_transport.h>
#include "target_core_file.h" #include "target_core_file.h"
...@@ -86,7 +85,7 @@ static void fd_detach_hba(struct se_hba *hba) ...@@ -86,7 +85,7 @@ static void fd_detach_hba(struct se_hba *hba)
static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name) static void *fd_allocate_virtdevice(struct se_hba *hba, const char *name)
{ {
struct fd_dev *fd_dev; struct fd_dev *fd_dev;
struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; struct fd_host *fd_host = hba->hba_ptr;
fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL); fd_dev = kzalloc(sizeof(struct fd_dev), GFP_KERNEL);
if (!fd_dev) { if (!fd_dev) {
...@@ -114,8 +113,8 @@ static struct se_device *fd_create_virtdevice( ...@@ -114,8 +113,8 @@ static struct se_device *fd_create_virtdevice(
struct se_device *dev; struct se_device *dev;
struct se_dev_limits dev_limits; struct se_dev_limits dev_limits;
struct queue_limits *limits; struct queue_limits *limits;
struct fd_dev *fd_dev = (struct fd_dev *) p; struct fd_dev *fd_dev = p;
struct fd_host *fd_host = (struct fd_host *) hba->hba_ptr; struct fd_host *fd_host = hba->hba_ptr;
mm_segment_t old_fs; mm_segment_t old_fs;
struct file *file; struct file *file;
struct inode *inode = NULL; struct inode *inode = NULL;
...@@ -240,7 +239,7 @@ static struct se_device *fd_create_virtdevice( ...@@ -240,7 +239,7 @@ static struct se_device *fd_create_virtdevice(
*/ */
static void fd_free_device(void *p) static void fd_free_device(void *p)
{ {
struct fd_dev *fd_dev = (struct fd_dev *) p; struct fd_dev *fd_dev = p;
if (fd_dev->fd_file) { if (fd_dev->fd_file) {
filp_close(fd_dev->fd_file, NULL); filp_close(fd_dev->fd_file, NULL);
...@@ -498,7 +497,7 @@ static ssize_t fd_set_configfs_dev_params( ...@@ -498,7 +497,7 @@ static ssize_t fd_set_configfs_dev_params(
orig = opts; orig = opts;
while ((ptr = strsep(&opts, ",")) != NULL) { while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr) if (!*ptr)
continue; continue;
...@@ -559,7 +558,7 @@ static ssize_t fd_set_configfs_dev_params( ...@@ -559,7 +558,7 @@ static ssize_t fd_set_configfs_dev_params(
static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev) static ssize_t fd_check_configfs_dev_params(struct se_hba *hba, struct se_subsystem_dev *se_dev)
{ {
struct fd_dev *fd_dev = (struct fd_dev *) se_dev->se_dev_su_ptr; struct fd_dev *fd_dev = se_dev->se_dev_su_ptr;
if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) { if (!(fd_dev->fbd_flags & FBDF_HAS_PATH)) {
pr_err("Missing fd_dev_name=\n"); pr_err("Missing fd_dev_name=\n");
......
...@@ -37,11 +37,10 @@ ...@@ -37,11 +37,10 @@
#include <net/tcp.h> #include <net/tcp.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_tpg.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include "target_core_hba.h" #include "target_core_internal.h"
static LIST_HEAD(subsystem_list); static LIST_HEAD(subsystem_list);
static DEFINE_MUTEX(subsystem_mutex); static DEFINE_MUTEX(subsystem_mutex);
......
#ifndef TARGET_CORE_HBA_H
#define TARGET_CORE_HBA_H
extern struct se_hba *core_alloc_hba(const char *, u32, u32);
extern int core_delete_hba(struct se_hba *);
#endif /* TARGET_CORE_HBA_H */
...@@ -42,8 +42,7 @@ ...@@ -42,8 +42,7 @@
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_transport.h>
#include "target_core_iblock.h" #include "target_core_iblock.h"
...@@ -391,7 +390,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_hba *hba, ...@@ -391,7 +390,7 @@ static ssize_t iblock_set_configfs_dev_params(struct se_hba *hba,
orig = opts; orig = opts;
while ((ptr = strsep(&opts, ",")) != NULL) { while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr) if (!*ptr)
continue; continue;
...@@ -465,7 +464,7 @@ static ssize_t iblock_show_configfs_dev_params( ...@@ -465,7 +464,7 @@ static ssize_t iblock_show_configfs_dev_params(
if (bd) { if (bd) {
bl += sprintf(b + bl, "Major: %d Minor: %d %s\n", bl += sprintf(b + bl, "Major: %d Minor: %d %s\n",
MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ? MAJOR(bd->bd_dev), MINOR(bd->bd_dev), (!bd->bd_contains) ?
"" : (bd->bd_holder == (struct iblock_dev *)ibd) ? "" : (bd->bd_holder == ibd) ?
"CLAIMED: IBLOCK" : "CLAIMED: OS"); "CLAIMED: IBLOCK" : "CLAIMED: OS");
} else { } else {
bl += sprintf(b + bl, "Major: 0 Minor: 0\n"); bl += sprintf(b + bl, "Major: 0 Minor: 0\n");
......
#ifndef TARGET_CORE_INTERNAL_H
#define TARGET_CORE_INTERNAL_H
/* target_core_alua.c */
extern struct t10_alua_lu_gp *default_lu_gp;
/* target_core_cdb.c */
int target_emulate_inquiry(struct se_task *task);
int target_emulate_readcapacity(struct se_task *task);
int target_emulate_readcapacity_16(struct se_task *task);
int target_emulate_modesense(struct se_task *task);
int target_emulate_request_sense(struct se_task *task);
int target_emulate_unmap(struct se_task *task);
int target_emulate_write_same(struct se_task *task);
int target_emulate_synchronize_cache(struct se_task *task);
int target_emulate_noop(struct se_task *task);
/* target_core_device.c */
struct se_dev_entry *core_get_se_deve_from_rtpi(struct se_node_acl *, u16);
int core_free_device_list_for_node(struct se_node_acl *,
struct se_portal_group *);
void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *);
void core_update_device_list_access(u32, u32, struct se_node_acl *);
int core_update_device_list_for_node(struct se_lun *, struct se_lun_acl *,
u32, u32, struct se_node_acl *, struct se_portal_group *, int);
void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *);
int core_dev_export(struct se_device *, struct se_portal_group *,
struct se_lun *);
void core_dev_unexport(struct se_device *, struct se_portal_group *,
struct se_lun *);
int target_report_luns(struct se_task *);
void se_release_device_for_hba(struct se_device *);
void se_release_vpd_for_dev(struct se_device *);
int se_free_virtual_device(struct se_device *, struct se_hba *);
int se_dev_check_online(struct se_device *);
int se_dev_check_shutdown(struct se_device *);
void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *);
int se_dev_set_task_timeout(struct se_device *, u32);
int se_dev_set_max_unmap_lba_count(struct se_device *, u32);
int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32);
int se_dev_set_unmap_granularity(struct se_device *, u32);
int se_dev_set_unmap_granularity_alignment(struct se_device *, u32);
int se_dev_set_emulate_dpo(struct se_device *, int);
int se_dev_set_emulate_fua_write(struct se_device *, int);
int se_dev_set_emulate_fua_read(struct se_device *, int);
int se_dev_set_emulate_write_cache(struct se_device *, int);
int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int);
int se_dev_set_emulate_tas(struct se_device *, int);
int se_dev_set_emulate_tpu(struct se_device *, int);
int se_dev_set_emulate_tpws(struct se_device *, int);
int se_dev_set_enforce_pr_isids(struct se_device *, int);
int se_dev_set_is_nonrot(struct se_device *, int);
int se_dev_set_emulate_rest_reord(struct se_device *dev, int);
int se_dev_set_queue_depth(struct se_device *, u32);
int se_dev_set_max_sectors(struct se_device *, u32);
int se_dev_set_optimal_sectors(struct se_device *, u32);
int se_dev_set_block_size(struct se_device *, u32);
struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *,
struct se_device *, u32);
int core_dev_del_lun(struct se_portal_group *, u32);
struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32);
struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *,
u32, char *, int *);
int core_dev_add_initiator_node_lun_acl(struct se_portal_group *,
struct se_lun_acl *, u32, u32);
int core_dev_del_initiator_node_lun_acl(struct se_portal_group *,
struct se_lun *, struct se_lun_acl *);
void core_dev_free_initiator_node_lun_acl(struct se_portal_group *,
struct se_lun_acl *lacl);
int core_dev_setup_virtual_lun0(void);
void core_dev_release_virtual_lun0(void);
/* target_core_hba.c */
struct se_hba *core_alloc_hba(const char *, u32, u32);
int core_delete_hba(struct se_hba *);
/* target_core_tmr.c */
int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
struct list_head *, struct se_cmd *);
/* target_core_tpg.c */
extern struct se_device *g_lun0_dev;
struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
const char *);
struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
unsigned char *);
void core_tpg_add_node_to_devs(struct se_node_acl *, struct se_portal_group *);
void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *);
struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32);
int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *,
u32, void *);
struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *);
int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *);
/* target_core_transport.c */
extern struct kmem_cache *se_tmr_req_cache;
int init_se_kmem_caches(void);
void release_se_kmem_caches(void);
u32 scsi_get_new_index(scsi_index_t);
void transport_subsystem_check_init(void);
void transport_cmd_finish_abort(struct se_cmd *, int);
void __transport_remove_task_from_execute_queue(struct se_task *,
struct se_device *);
unsigned char *transport_dump_cmd_direction(struct se_cmd *);
void transport_dump_dev_state(struct se_device *, char *, int *);
void transport_dump_dev_info(struct se_device *, struct se_lun *,
unsigned long long, char *, int *);
void transport_dump_vpd_proto_id(struct t10_vpd *, unsigned char *, int);
int transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int);
int transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int);
int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int);
bool target_stop_task(struct se_task *task, unsigned long *flags);
int transport_clear_lun_from_sessions(struct se_lun *);
void transport_send_task_abort(struct se_cmd *);
/* target_core_stat.c */
void target_stat_setup_dev_default_groups(struct se_subsystem_dev *);
void target_stat_setup_port_default_groups(struct se_lun *);
void target_stat_setup_mappedlun_default_groups(struct se_lun_acl *);
#endif /* TARGET_CORE_INTERNAL_H */
...@@ -33,14 +33,11 @@ ...@@ -33,14 +33,11 @@
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_tmr.h> #include <target/target_core_fabric.h>
#include <target/target_core_tpg.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include "target_core_hba.h" #include "target_core_internal.h"
#include "target_core_pr.h" #include "target_core_pr.h"
#include "target_core_ua.h" #include "target_core_ua.h"
...@@ -2984,21 +2981,6 @@ static void core_scsi3_release_preempt_and_abort( ...@@ -2984,21 +2981,6 @@ static void core_scsi3_release_preempt_and_abort(
} }
} }
int core_scsi3_check_cdb_abort_and_preempt(
struct list_head *preempt_and_abort_list,
struct se_cmd *cmd)
{
struct t10_pr_registration *pr_reg, *pr_reg_tmp;
list_for_each_entry_safe(pr_reg, pr_reg_tmp, preempt_and_abort_list,
pr_reg_abort_list) {
if (pr_reg->pr_res_key == cmd->pr_res_key)
return 0;
}
return 1;
}
static int core_scsi3_pro_preempt( static int core_scsi3_pro_preempt(
struct se_cmd *cmd, struct se_cmd *cmd,
int type, int type,
......
...@@ -60,8 +60,6 @@ extern void core_scsi3_free_pr_reg_from_nacl(struct se_device *, ...@@ -60,8 +60,6 @@ extern void core_scsi3_free_pr_reg_from_nacl(struct se_device *,
struct se_node_acl *); struct se_node_acl *);
extern void core_scsi3_free_all_registrations(struct se_device *); extern void core_scsi3_free_all_registrations(struct se_device *);
extern unsigned char *core_scsi3_pr_dump_type(int); extern unsigned char *core_scsi3_pr_dump_type(int);
extern int core_scsi3_check_cdb_abort_and_preempt(struct list_head *,
struct se_cmd *);
extern int target_scsi3_emulate_pr_in(struct se_task *task); extern int target_scsi3_emulate_pr_in(struct se_task *task);
extern int target_scsi3_emulate_pr_out(struct se_task *task); extern int target_scsi3_emulate_pr_out(struct se_task *task);
......
...@@ -44,8 +44,7 @@ ...@@ -44,8 +44,7 @@
#include <scsi/scsi_tcq.h> #include <scsi/scsi_tcq.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_transport.h>
#include "target_core_pscsi.h" #include "target_core_pscsi.h"
...@@ -105,7 +104,7 @@ static void pscsi_detach_hba(struct se_hba *hba) ...@@ -105,7 +104,7 @@ static void pscsi_detach_hba(struct se_hba *hba)
static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag)
{ {
struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; struct pscsi_hba_virt *phv = hba->hba_ptr;
struct Scsi_Host *sh = phv->phv_lld_host; struct Scsi_Host *sh = phv->phv_lld_host;
/* /*
* Release the struct Scsi_Host * Release the struct Scsi_Host
...@@ -351,7 +350,6 @@ static struct se_device *pscsi_add_device_to_list( ...@@ -351,7 +350,6 @@ static struct se_device *pscsi_add_device_to_list(
* scsi_device_put() and the pdv->pdv_sd cleared. * scsi_device_put() and the pdv->pdv_sd cleared.
*/ */
pdv->pdv_sd = sd; pdv->pdv_sd = sd;
dev = transport_add_device_to_core_hba(hba, &pscsi_template, dev = transport_add_device_to_core_hba(hba, &pscsi_template,
se_dev, dev_flags, pdv, se_dev, dev_flags, pdv,
&dev_limits, NULL, NULL); &dev_limits, NULL, NULL);
...@@ -406,7 +404,7 @@ static struct se_device *pscsi_create_type_disk( ...@@ -406,7 +404,7 @@ static struct se_device *pscsi_create_type_disk(
__releases(sh->host_lock) __releases(sh->host_lock)
{ {
struct se_device *dev; struct se_device *dev;
struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr;
struct Scsi_Host *sh = sd->host; struct Scsi_Host *sh = sd->host;
struct block_device *bd; struct block_device *bd;
u32 dev_flags = 0; u32 dev_flags = 0;
...@@ -454,7 +452,7 @@ static struct se_device *pscsi_create_type_rom( ...@@ -454,7 +452,7 @@ static struct se_device *pscsi_create_type_rom(
__releases(sh->host_lock) __releases(sh->host_lock)
{ {
struct se_device *dev; struct se_device *dev;
struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr;
struct Scsi_Host *sh = sd->host; struct Scsi_Host *sh = sd->host;
u32 dev_flags = 0; u32 dev_flags = 0;
...@@ -489,7 +487,7 @@ static struct se_device *pscsi_create_type_other( ...@@ -489,7 +487,7 @@ static struct se_device *pscsi_create_type_other(
__releases(sh->host_lock) __releases(sh->host_lock)
{ {
struct se_device *dev; struct se_device *dev;
struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)pdv->pdv_se_hba->hba_ptr; struct pscsi_hba_virt *phv = pdv->pdv_se_hba->hba_ptr;
struct Scsi_Host *sh = sd->host; struct Scsi_Host *sh = sd->host;
u32 dev_flags = 0; u32 dev_flags = 0;
...@@ -510,10 +508,10 @@ static struct se_device *pscsi_create_virtdevice( ...@@ -510,10 +508,10 @@ static struct se_device *pscsi_create_virtdevice(
struct se_subsystem_dev *se_dev, struct se_subsystem_dev *se_dev,
void *p) void *p)
{ {
struct pscsi_dev_virt *pdv = (struct pscsi_dev_virt *)p; struct pscsi_dev_virt *pdv = p;
struct se_device *dev; struct se_device *dev;
struct scsi_device *sd; struct scsi_device *sd;
struct pscsi_hba_virt *phv = (struct pscsi_hba_virt *)hba->hba_ptr; struct pscsi_hba_virt *phv = hba->hba_ptr;
struct Scsi_Host *sh = phv->phv_lld_host; struct Scsi_Host *sh = phv->phv_lld_host;
int legacy_mode_enable = 0; int legacy_mode_enable = 0;
...@@ -818,7 +816,7 @@ static ssize_t pscsi_set_configfs_dev_params(struct se_hba *hba, ...@@ -818,7 +816,7 @@ static ssize_t pscsi_set_configfs_dev_params(struct se_hba *hba,
orig = opts; orig = opts;
while ((ptr = strsep(&opts, ",")) != NULL) { while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr) if (!*ptr)
continue; continue;
...@@ -1144,7 +1142,7 @@ static unsigned char *pscsi_get_sense_buffer(struct se_task *task) ...@@ -1144,7 +1142,7 @@ static unsigned char *pscsi_get_sense_buffer(struct se_task *task)
{ {
struct pscsi_plugin_task *pt = PSCSI_TASK(task); struct pscsi_plugin_task *pt = PSCSI_TASK(task);
return (unsigned char *)&pt->pscsi_sense[0]; return pt->pscsi_sense;
} }
/* pscsi_get_device_rev(): /* pscsi_get_device_rev():
......
...@@ -37,9 +37,7 @@ ...@@ -37,9 +37,7 @@
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include "target_core_rd.h" #include "target_core_rd.h"
...@@ -474,7 +472,7 @@ static ssize_t rd_set_configfs_dev_params( ...@@ -474,7 +472,7 @@ static ssize_t rd_set_configfs_dev_params(
orig = opts; orig = opts;
while ((ptr = strsep(&opts, ",")) != NULL) { while ((ptr = strsep(&opts, ",\n")) != NULL) {
if (!*ptr) if (!*ptr)
continue; continue;
......
...@@ -43,12 +43,12 @@ ...@@ -43,12 +43,12 @@
#include <scsi/scsi_host.h> #include <scsi/scsi_host.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_backend.h>
#include <target/target_core_fabric_ops.h> #include <target/target_core_fabric.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
#include "target_core_hba.h" #include "target_core_internal.h"
#ifndef INITIAL_JIFFIES #ifndef INITIAL_JIFFIES
#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ)) #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
...@@ -1755,8 +1755,7 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident( ...@@ -1755,8 +1755,7 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident(
/* scsiAttIntrPortName+scsiAttIntrPortIdentifier */ /* scsiAttIntrPortName+scsiAttIntrPortIdentifier */
memset(buf, 0, 64); memset(buf, 0, 64);
if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL)
tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, tpg->se_tpg_tfo->sess_get_initiator_sid(se_sess, buf, 64);
(unsigned char *)&buf[0], 64);
ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf); ret = snprintf(page, PAGE_SIZE, "%s+i+%s\n", nacl->initiatorname, buf);
spin_unlock_irq(&nacl->nacl_sess_lock); spin_unlock_irq(&nacl->nacl_sess_lock);
......
#ifndef TARGET_CORE_STAT_H
#define TARGET_CORE_STAT_H
extern void target_stat_setup_dev_default_groups(struct se_subsystem_dev *);
extern void target_stat_setup_port_default_groups(struct se_lun *);
extern void target_stat_setup_mappedlun_default_groups(struct se_lun_acl *);
#endif /*** TARGET_CORE_STAT_H ***/
...@@ -32,12 +32,11 @@ ...@@ -32,12 +32,11 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_tmr.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_pr.h" #include "target_core_pr.h"
...@@ -101,6 +100,21 @@ static void core_tmr_handle_tas_abort( ...@@ -101,6 +100,21 @@ static void core_tmr_handle_tas_abort(
transport_cmd_finish_abort(cmd, 0); transport_cmd_finish_abort(cmd, 0);
} }
static int target_check_cdb_and_preempt(struct list_head *list,
struct se_cmd *cmd)
{
struct t10_pr_registration *reg;
if (!list)
return 0;
list_for_each_entry(reg, list, pr_reg_abort_list) {
if (reg->pr_res_key == cmd->pr_res_key)
return 0;
}
return 1;
}
static void core_tmr_drain_tmr_list( static void core_tmr_drain_tmr_list(
struct se_device *dev, struct se_device *dev,
struct se_tmr_req *tmr, struct se_tmr_req *tmr,
...@@ -132,9 +146,7 @@ static void core_tmr_drain_tmr_list( ...@@ -132,9 +146,7 @@ static void core_tmr_drain_tmr_list(
* parameter (eg: for PROUT PREEMPT_AND_ABORT service action * parameter (eg: for PROUT PREEMPT_AND_ABORT service action
* skip non regisration key matching TMRs. * skip non regisration key matching TMRs.
*/ */
if (preempt_and_abort_list && if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd))
(core_scsi3_check_cdb_abort_and_preempt(
preempt_and_abort_list, cmd) != 0))
continue; continue;
spin_lock(&cmd->t_state_lock); spin_lock(&cmd->t_state_lock);
...@@ -211,9 +223,7 @@ static void core_tmr_drain_task_list( ...@@ -211,9 +223,7 @@ static void core_tmr_drain_task_list(
* For PREEMPT_AND_ABORT usage, only process commands * For PREEMPT_AND_ABORT usage, only process commands
* with a matching reservation key. * with a matching reservation key.
*/ */
if (preempt_and_abort_list && if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd))
(core_scsi3_check_cdb_abort_and_preempt(
preempt_and_abort_list, cmd) != 0))
continue; continue;
/* /*
* Not aborting PROUT PREEMPT_AND_ABORT CDB.. * Not aborting PROUT PREEMPT_AND_ABORT CDB..
...@@ -222,7 +232,7 @@ static void core_tmr_drain_task_list( ...@@ -222,7 +232,7 @@ static void core_tmr_drain_task_list(
continue; continue;
list_move_tail(&task->t_state_list, &drain_task_list); list_move_tail(&task->t_state_list, &drain_task_list);
atomic_set(&task->task_state_active, 0); task->t_state_active = false;
/* /*
* Remove from task execute list before processing drain_task_list * Remove from task execute list before processing drain_task_list
*/ */
...@@ -321,9 +331,7 @@ static void core_tmr_drain_cmd_list( ...@@ -321,9 +331,7 @@ static void core_tmr_drain_cmd_list(
* For PREEMPT_AND_ABORT usage, only process commands * For PREEMPT_AND_ABORT usage, only process commands
* with a matching reservation key. * with a matching reservation key.
*/ */
if (preempt_and_abort_list && if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd))
(core_scsi3_check_cdb_abort_and_preempt(
preempt_and_abort_list, cmd) != 0))
continue; continue;
/* /*
* Not aborting PROUT PREEMPT_AND_ABORT CDB.. * Not aborting PROUT PREEMPT_AND_ABORT CDB..
......
...@@ -39,13 +39,10 @@ ...@@ -39,13 +39,10 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_backend.h>
#include <target/target_core_tpg.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include "target_core_hba.h" #include "target_core_internal.h"
#include "target_core_stat.h"
extern struct se_device *g_lun0_dev; extern struct se_device *g_lun0_dev;
......
This diff is collapsed.
...@@ -30,13 +30,11 @@ ...@@ -30,13 +30,11 @@
#include <scsi/scsi_cmnd.h> #include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_device.h> #include <target/target_core_fabric.h>
#include <target/target_core_transport.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include "target_core_internal.h"
#include "target_core_alua.h" #include "target_core_alua.h"
#include "target_core_hba.h"
#include "target_core_pr.h" #include "target_core_pr.h"
#include "target_core_ua.h" #include "target_core_ua.h"
......
...@@ -39,12 +39,8 @@ ...@@ -39,12 +39,8 @@
#include <scsi/fc_encode.h> #include <scsi/fc_encode.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_device.h>
#include <target/target_core_tpg.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/target_core_tmr.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
#include "tcm_fc.h" #include "tcm_fc.h"
...@@ -367,6 +363,11 @@ static void ft_send_tm(struct ft_cmd *cmd) ...@@ -367,6 +363,11 @@ static void ft_send_tm(struct ft_cmd *cmd)
struct ft_sess *sess; struct ft_sess *sess;
u8 tm_func; u8 tm_func;
transport_init_se_cmd(&cmd->se_cmd, &ft_configfs->tf_ops,
cmd->sess->se_sess, 0, DMA_NONE, 0,
&cmd->ft_sense_buffer[0]);
target_get_sess_cmd(cmd->sess->se_sess, &cmd->se_cmd, false);
fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp)); fcp = fc_frame_payload_get(cmd->req_frame, sizeof(*fcp));
switch (fcp->fc_tm_flags) { switch (fcp->fc_tm_flags) {
...@@ -420,7 +421,6 @@ static void ft_send_tm(struct ft_cmd *cmd) ...@@ -420,7 +421,6 @@ static void ft_send_tm(struct ft_cmd *cmd)
sess = cmd->sess; sess = cmd->sess;
transport_send_check_condition_and_sense(&cmd->se_cmd, transport_send_check_condition_and_sense(&cmd->se_cmd,
cmd->se_cmd.scsi_sense_reason, 0); cmd->se_cmd.scsi_sense_reason, 0);
transport_generic_free_cmd(&cmd->se_cmd, 0);
ft_sess_put(sess); ft_sess_put(sess);
return; return;
} }
...@@ -536,7 +536,6 @@ static void ft_send_work(struct work_struct *work) ...@@ -536,7 +536,6 @@ static void ft_send_work(struct work_struct *work)
{ {
struct ft_cmd *cmd = container_of(work, struct ft_cmd, work); struct ft_cmd *cmd = container_of(work, struct ft_cmd, work);
struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame); struct fc_frame_header *fh = fc_frame_header_get(cmd->req_frame);
struct se_cmd *se_cmd;
struct fcp_cmnd *fcp; struct fcp_cmnd *fcp;
int data_dir = 0; int data_dir = 0;
u32 data_len; u32 data_len;
...@@ -591,15 +590,6 @@ static void ft_send_work(struct work_struct *work) ...@@ -591,15 +590,6 @@ static void ft_send_work(struct work_struct *work)
data_len = ntohl(fcp->fc_dl); data_len = ntohl(fcp->fc_dl);
cmd->cdb = fcp->fc_cdb; cmd->cdb = fcp->fc_cdb;
} }
se_cmd = &cmd->se_cmd;
/*
* Initialize struct se_cmd descriptor from target_core_mod
* infrastructure
*/
transport_init_se_cmd(se_cmd, &ft_configfs->tf_ops, cmd->sess->se_sess,
data_len, data_dir, task_attr,
&cmd->ft_sense_buffer[0]);
/* /*
* Check for FCP task management flags * Check for FCP task management flags
*/ */
...@@ -607,39 +597,20 @@ static void ft_send_work(struct work_struct *work) ...@@ -607,39 +597,20 @@ static void ft_send_work(struct work_struct *work)
ft_send_tm(cmd); ft_send_tm(cmd);
return; return;
} }
fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd); fc_seq_exch(cmd->seq)->lp->tt.seq_set_resp(cmd->seq, ft_recv_seq, cmd);
cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun); cmd->lun = scsilun_to_int((struct scsi_lun *)fcp->fc_lun);
ret = transport_lookup_cmd_lun(&cmd->se_cmd, cmd->lun); /*
* Use a single se_cmd->cmd_kref as we expect to release se_cmd
* directly from ft_check_stop_free callback in response path.
*/
ret = target_submit_cmd(&cmd->se_cmd, cmd->sess->se_sess, cmd->cdb,
&cmd->ft_sense_buffer[0], cmd->lun, data_len,
task_attr, data_dir, 0);
pr_debug("r_ctl %x alloc target_submit_cmd %d\n", fh->fh_r_ctl, ret);
if (ret < 0) { if (ret < 0) {
ft_dump_cmd(cmd, __func__); ft_dump_cmd(cmd, __func__);
transport_send_check_condition_and_sense(&cmd->se_cmd,
cmd->se_cmd.scsi_sense_reason, 0);
return;
}
ret = transport_generic_allocate_tasks(se_cmd, cmd->cdb);
pr_debug("r_ctl %x alloc task ret %d\n", fh->fh_r_ctl, ret);
ft_dump_cmd(cmd, __func__);
if (ret == -ENOMEM) {
transport_send_check_condition_and_sense(se_cmd,
TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
transport_generic_free_cmd(se_cmd, 0);
return;
}
if (ret == -EINVAL) {
if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT)
ft_queue_status(se_cmd);
else
transport_send_check_condition_and_sense(se_cmd,
se_cmd->scsi_sense_reason, 0);
transport_generic_free_cmd(se_cmd, 0);
return; return;
} }
transport_handle_cdb_direct(se_cmd);
return; return;
err: err:
......
...@@ -41,12 +41,8 @@ ...@@ -41,12 +41,8 @@
#include <scsi/libfc.h> #include <scsi/libfc.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_fabric_configfs.h> #include <target/target_core_fabric_configfs.h>
#include <target/target_core_fabric_lib.h>
#include <target/target_core_device.h>
#include <target/target_core_tpg.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
......
...@@ -48,10 +48,7 @@ ...@@ -48,10 +48,7 @@
#include <scsi/fc_encode.h> #include <scsi/fc_encode.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_device.h>
#include <target/target_core_tpg.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
......
...@@ -40,10 +40,7 @@ ...@@ -40,10 +40,7 @@
#include <scsi/libfc.h> #include <scsi/libfc.h>
#include <target/target_core_base.h> #include <target/target_core_base.h>
#include <target/target_core_transport.h> #include <target/target_core_fabric.h>
#include <target/target_core_fabric_ops.h>
#include <target/target_core_device.h>
#include <target/target_core_tpg.h>
#include <target/target_core_configfs.h> #include <target/target_core_configfs.h>
#include <target/configfs_macros.h> #include <target/configfs_macros.h>
......
#ifndef TARGET_CORE_BACKEND_H
#define TARGET_CORE_BACKEND_H
#define TRANSPORT_PLUGIN_PHBA_PDEV 1
#define TRANSPORT_PLUGIN_VHBA_PDEV 2
#define TRANSPORT_PLUGIN_VHBA_VDEV 3
struct se_subsystem_api {
struct list_head sub_api_list;
char name[16];
struct module *owner;
u8 transport_type;
unsigned int fua_write_emulated : 1;
unsigned int write_cache_emulated : 1;
int (*attach_hba)(struct se_hba *, u32);
void (*detach_hba)(struct se_hba *);
int (*pmode_enable_hba)(struct se_hba *, unsigned long);
void *(*allocate_virtdevice)(struct se_hba *, const char *);
struct se_device *(*create_virtdevice)(struct se_hba *,
struct se_subsystem_dev *, void *);
void (*free_device)(void *);
int (*transport_complete)(struct se_task *task);
struct se_task *(*alloc_task)(unsigned char *cdb);
int (*do_task)(struct se_task *);
int (*do_discard)(struct se_device *, sector_t, u32);
void (*do_sync_cache)(struct se_task *);
void (*free_task)(struct se_task *);
ssize_t (*check_configfs_dev_params)(struct se_hba *,
struct se_subsystem_dev *);
ssize_t (*set_configfs_dev_params)(struct se_hba *,
struct se_subsystem_dev *, const char *, ssize_t);
ssize_t (*show_configfs_dev_params)(struct se_hba *,
struct se_subsystem_dev *, char *);
u32 (*get_device_rev)(struct se_device *);
u32 (*get_device_type)(struct se_device *);
sector_t (*get_blocks)(struct se_device *);
unsigned char *(*get_sense_buffer)(struct se_task *);
};
int transport_subsystem_register(struct se_subsystem_api *);
void transport_subsystem_release(struct se_subsystem_api *);
struct se_device *transport_add_device_to_core_hba(struct se_hba *,
struct se_subsystem_api *, struct se_subsystem_dev *, u32,
void *, struct se_dev_limits *, const char *, const char *);
void transport_complete_sync_cache(struct se_cmd *, int);
void transport_complete_task(struct se_task *, int);
void target_get_task_cdb(struct se_task *, unsigned char *);
void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
/* core helpers also used by command snooping in pscsi */
void *transport_kmap_first_data_page(struct se_cmd *);
void transport_kunmap_first_data_page(struct se_cmd *);
#endif /* TARGET_CORE_BACKEND_H */
This diff is collapsed.
#ifndef TARGET_CORE_DEVICE_H
#define TARGET_CORE_DEVICE_H
extern int transport_lookup_cmd_lun(struct se_cmd *, u32);
extern int transport_lookup_tmr_lun(struct se_cmd *, u32);
extern struct se_dev_entry *core_get_se_deve_from_rtpi(
struct se_node_acl *, u16);
extern int core_free_device_list_for_node(struct se_node_acl *,
struct se_portal_group *);
extern void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *);
extern void core_update_device_list_access(u32, u32, struct se_node_acl *);
extern int core_update_device_list_for_node(struct se_lun *, struct se_lun_acl *, u32,
u32, struct se_node_acl *,
struct se_portal_group *, int);
extern void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *);
extern int core_dev_export(struct se_device *, struct se_portal_group *,
struct se_lun *);
extern void core_dev_unexport(struct se_device *, struct se_portal_group *,
struct se_lun *);
extern int target_report_luns(struct se_task *);
extern void se_release_device_for_hba(struct se_device *);
extern void se_release_vpd_for_dev(struct se_device *);
extern void se_clear_dev_ports(struct se_device *);
extern int se_free_virtual_device(struct se_device *, struct se_hba *);
extern int se_dev_check_online(struct se_device *);
extern int se_dev_check_shutdown(struct se_device *);
extern void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *);
extern int se_dev_set_task_timeout(struct se_device *, u32);
extern int se_dev_set_max_unmap_lba_count(struct se_device *, u32);
extern int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32);
extern int se_dev_set_unmap_granularity(struct se_device *, u32);
extern int se_dev_set_unmap_granularity_alignment(struct se_device *, u32);
extern int se_dev_set_emulate_dpo(struct se_device *, int);
extern int se_dev_set_emulate_fua_write(struct se_device *, int);
extern int se_dev_set_emulate_fua_read(struct se_device *, int);
extern int se_dev_set_emulate_write_cache(struct se_device *, int);
extern int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int);
extern int se_dev_set_emulate_tas(struct se_device *, int);
extern int se_dev_set_emulate_tpu(struct se_device *, int);
extern int se_dev_set_emulate_tpws(struct se_device *, int);
extern int se_dev_set_enforce_pr_isids(struct se_device *, int);
extern int se_dev_set_is_nonrot(struct se_device *, int);
extern int se_dev_set_emulate_rest_reord(struct se_device *dev, int);
extern int se_dev_set_queue_depth(struct se_device *, u32);
extern int se_dev_set_max_sectors(struct se_device *, u32);
extern int se_dev_set_optimal_sectors(struct se_device *, u32);
extern int se_dev_set_block_size(struct se_device *, u32);
extern struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *,
struct se_device *, u32);
extern int core_dev_del_lun(struct se_portal_group *, u32);
extern struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32);
extern struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *,
u32, char *, int *);
extern int core_dev_add_initiator_node_lun_acl(struct se_portal_group *,
struct se_lun_acl *, u32, u32);
extern int core_dev_del_initiator_node_lun_acl(struct se_portal_group *,
struct se_lun *, struct se_lun_acl *);
extern void core_dev_free_initiator_node_lun_acl(struct se_portal_group *,
struct se_lun_acl *lacl);
extern int core_dev_setup_virtual_lun0(void);
extern void core_dev_release_virtual_lun0(void);
#endif /* TARGET_CORE_DEVICE_H */
/* Defined in target_core_configfs.h */ #ifndef TARGET_CORE_FABRIC_H
struct target_fabric_configfs; #define TARGET_CORE_FABRIC_H
struct target_core_fabric_ops { struct target_core_fabric_ops {
struct configfs_subsystem *tf_subsys; struct configfs_subsystem *tf_subsys;
...@@ -52,10 +52,6 @@ struct target_core_fabric_ops { ...@@ -52,10 +52,6 @@ struct target_core_fabric_ops {
* Returning 0 will signal a descriptor has not been released. * Returning 0 will signal a descriptor has not been released.
*/ */
int (*check_stop_free)(struct se_cmd *); int (*check_stop_free)(struct se_cmd *);
/*
* Optional check for active I/O shutdown
*/
int (*check_release_cmd)(struct se_cmd *);
void (*release_cmd)(struct se_cmd *); void (*release_cmd)(struct se_cmd *);
/* /*
* Called with spin_lock_bh(struct se_portal_group->session_lock held. * Called with spin_lock_bh(struct se_portal_group->session_lock held.
...@@ -103,3 +99,89 @@ struct target_core_fabric_ops { ...@@ -103,3 +99,89 @@ struct target_core_fabric_ops {
struct config_group *, const char *); struct config_group *, const char *);
void (*fabric_drop_nodeacl)(struct se_node_acl *); void (*fabric_drop_nodeacl)(struct se_node_acl *);
}; };
struct se_session *transport_init_session(void);
void __transport_register_session(struct se_portal_group *,
struct se_node_acl *, struct se_session *, void *);
void transport_register_session(struct se_portal_group *,
struct se_node_acl *, struct se_session *, void *);
void transport_free_session(struct se_session *);
void transport_deregister_session_configfs(struct se_session *);
void transport_deregister_session(struct se_session *);
void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
struct se_session *, u32, int, int, unsigned char *);
int transport_lookup_cmd_lun(struct se_cmd *, u32);
int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
unsigned char *, u32, u32, int, int, int);
int transport_handle_cdb_direct(struct se_cmd *);
int transport_generic_handle_cdb_map(struct se_cmd *);
int transport_generic_handle_data(struct se_cmd *);
int transport_generic_map_mem_to_cmd(struct se_cmd *cmd,
struct scatterlist *, u32, struct scatterlist *, u32);
void transport_do_task_sg_chain(struct se_cmd *);
int transport_generic_new_cmd(struct se_cmd *);
void transport_generic_process_write(struct se_cmd *);
void transport_generic_free_cmd(struct se_cmd *, int);
bool transport_wait_for_tasks(struct se_cmd *);
int transport_check_aborted_status(struct se_cmd *, int);
int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
void target_get_sess_cmd(struct se_session *, struct se_cmd *, bool);
int target_put_sess_cmd(struct se_session *, struct se_cmd *);
void target_splice_sess_cmd_list(struct se_session *);
void target_wait_for_sess_cmds(struct se_session *, int);
int core_alua_check_nonop_delay(struct se_cmd *);
struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
void core_tmr_release_req(struct se_tmr_req *);
int transport_generic_handle_tmr(struct se_cmd *);
int transport_lookup_tmr_lun(struct se_cmd *, u32);
struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
unsigned char *);
void core_tpg_clear_object_luns(struct se_portal_group *);
struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *,
struct se_node_acl *, const char *, u32);
int core_tpg_del_initiator_node_acl(struct se_portal_group *,
struct se_node_acl *, int);
int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
unsigned char *, u32, int);
int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *,
struct se_portal_group *, void *, int);
int core_tpg_deregister(struct se_portal_group *);
/* SAS helpers */
u8 sas_get_fabric_proto_ident(struct se_portal_group *);
u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *, unsigned char *);
u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *);
char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *,
u32 *, char **);
/* FC helpers */
u8 fc_get_fabric_proto_ident(struct se_portal_group *);
u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *, unsigned char *);
u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *);
char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *,
u32 *, char **);
/* iSCSI helpers */
u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *, unsigned char *);
u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *);
char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *,
u32 *, char **);
#endif /* TARGET_CORE_FABRICH */
#ifndef TARGET_CORE_FABRIC_LIB_H
#define TARGET_CORE_FABRIC_LIB_H
extern u8 sas_get_fabric_proto_ident(struct se_portal_group *);
extern u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *, unsigned char *);
extern u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *);
extern char *sas_parse_pr_out_transport_id(struct se_portal_group *,
const char *, u32 *, char **);
extern u8 fc_get_fabric_proto_ident(struct se_portal_group *);
extern u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *, unsigned char *);
extern u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *);
extern char *fc_parse_pr_out_transport_id(struct se_portal_group *,
const char *, u32 *, char **);
extern u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
extern u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *, unsigned char *);
extern u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
struct t10_pr_registration *, int *);
extern char *iscsi_parse_pr_out_transport_id(struct se_portal_group *,
const char *, u32 *, char **);
#endif /* TARGET_CORE_FABRIC_LIB_H */
#ifndef TARGET_CORE_TMR_H
#define TARGET_CORE_TMR_H
/* fabric independent task management function values */
enum tcm_tmreq_table {
TMR_ABORT_TASK = 1,
TMR_ABORT_TASK_SET = 2,
TMR_CLEAR_ACA = 3,
TMR_CLEAR_TASK_SET = 4,
TMR_LUN_RESET = 5,
TMR_TARGET_WARM_RESET = 6,
TMR_TARGET_COLD_RESET = 7,
TMR_FABRIC_TMR = 255,
};
/* fabric independent task management response values */
enum tcm_tmrsp_table {
TMR_FUNCTION_COMPLETE = 0,
TMR_TASK_DOES_NOT_EXIST = 1,
TMR_LUN_DOES_NOT_EXIST = 2,
TMR_TASK_STILL_ALLEGIANT = 3,
TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
TMR_FUNCTION_REJECTED = 255,
};
extern struct kmem_cache *se_tmr_req_cache;
extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
extern void core_tmr_release_req(struct se_tmr_req *);
extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
struct list_head *, struct se_cmd *);
#endif /* TARGET_CORE_TMR_H */
#ifndef TARGET_CORE_TPG_H
#define TARGET_CORE_TPG_H
extern struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
const char *);
extern struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
unsigned char *);
extern void core_tpg_add_node_to_devs(struct se_node_acl *,
struct se_portal_group *);
extern struct se_node_acl *core_tpg_check_initiator_node_acl(
struct se_portal_group *,
unsigned char *);
extern void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *);
extern void core_tpg_wait_for_mib_ref(struct se_node_acl *);
extern void core_tpg_clear_object_luns(struct se_portal_group *);
extern struct se_node_acl *core_tpg_add_initiator_node_acl(
struct se_portal_group *,
struct se_node_acl *,
const char *, u32);
extern int core_tpg_del_initiator_node_acl(struct se_portal_group *,
struct se_node_acl *, int);
extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
unsigned char *, u32, int);
extern int core_tpg_register(struct target_core_fabric_ops *,
struct se_wwn *,
struct se_portal_group *, void *,
int);
extern int core_tpg_deregister(struct se_portal_group *);
extern struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32);
extern int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, u32,
void *);
extern struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *);
extern int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *);
#endif /* TARGET_CORE_TPG_H */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment