Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367359
b: refs/heads/master
c: baa4d64
h: refs/heads/master
i:
  367357: a2ec4ba
  367355: d2d76c3
  367351: 1f83bdd
  367343: 4d4b07d
  367327: 5c9f32a
  367295: ba3c7d9
  367231: 1ead25a
  367103: ca901e4
v: v3
  • Loading branch information
Nicholas Bellinger committed Apr 25, 2013
1 parent 7dfe59f commit 066e864
Show file tree
Hide file tree
Showing 10 changed files with 381 additions and 316 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f99306337ba1871afc8568e8b36004ce3cee039
refs/heads/master: baa4d64b147a4064626f6597646ae8a330d9e2ed
35 changes: 28 additions & 7 deletions trunk/drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#include "iscsi_target_device.h"
#include "iscsi_target_stat.h"

#include <target/iscsi/iscsi_transport.h>

static LIST_HEAD(g_tiqn_list);
static LIST_HEAD(g_np_list);
static DEFINE_SPINLOCK(tiqn_lock);
Expand Down Expand Up @@ -401,8 +403,7 @@ struct iscsi_np *iscsit_add_np(
spin_unlock_bh(&np_lock);

pr_debug("CORE[0] - Added Network Portal: %s:%hu on %s\n",
np->np_ip, np->np_port, (np->np_network_transport == ISCSI_TCP) ?
"TCP" : "SCTP");
np->np_ip, np->np_port, np->np_transport->name);

return np;
}
Expand Down Expand Up @@ -441,11 +442,10 @@ int iscsit_reset_np_thread(
return 0;
}

static int iscsit_del_np_comm(struct iscsi_np *np)
static void iscsit_free_np(struct iscsi_np *np)
{
if (np->np_socket)
sock_release(np->np_socket);
return 0;
}

int iscsit_del_np(struct iscsi_np *np)
Expand All @@ -467,20 +467,32 @@ int iscsit_del_np(struct iscsi_np *np)
send_sig(SIGINT, np->np_thread, 1);
kthread_stop(np->np_thread);
}
iscsit_del_np_comm(np);

np->np_transport->iscsit_free_np(np);

spin_lock_bh(&np_lock);
list_del(&np->np_list);
spin_unlock_bh(&np_lock);

pr_debug("CORE[0] - Removed Network Portal: %s:%hu on %s\n",
np->np_ip, np->np_port, (np->np_network_transport == ISCSI_TCP) ?
"TCP" : "SCTP");
np->np_ip, np->np_port, np->np_transport->name);

iscsit_put_transport(np->np_transport);
kfree(np);
return 0;
}

static struct iscsit_transport iscsi_target_transport = {
.name = "iSCSI/TCP",
.transport_type = ISCSI_TCP,
.owner = NULL,
.iscsit_setup_np = iscsit_setup_np,
.iscsit_accept_np = iscsit_accept_np,
.iscsit_free_np = iscsit_free_np,
.iscsit_get_login_rx = iscsit_get_login_rx,
.iscsit_put_login_tx = iscsit_put_login_tx,
};

static int __init iscsi_target_init_module(void)
{
int ret = 0;
Expand Down Expand Up @@ -557,6 +569,8 @@ static int __init iscsi_target_init_module(void)
goto ooo_out;
}

iscsit_register_transport(&iscsi_target_transport);

if (iscsit_load_discovery_tpg() < 0)
goto r2t_out;

Expand Down Expand Up @@ -587,6 +601,7 @@ static void __exit iscsi_target_cleanup_module(void)
iscsi_deallocate_thread_sets();
iscsi_thread_set_free();
iscsit_release_discovery_tpg();
iscsit_unregister_transport(&iscsi_target_transport);
kmem_cache_destroy(lio_cmd_cache);
kmem_cache_destroy(lio_qr_cache);
kmem_cache_destroy(lio_dr_cache);
Expand Down Expand Up @@ -4053,6 +4068,12 @@ int iscsit_close_connection(

if (conn->sock)
sock_release(conn->sock);

if (conn->conn_transport->iscsit_free_conn)
conn->conn_transport->iscsit_free_conn(conn);

iscsit_put_transport(conn->conn_transport);

conn->thread_set = NULL;

pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
Expand Down
15 changes: 12 additions & 3 deletions trunk/drivers/target/iscsi/iscsi_target_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

#define ISCSI_IOV_DATA_BUFFER 5

enum tpg_np_network_transport_table {
enum iscsit_transport_type {
ISCSI_TCP = 0,
ISCSI_SCTP_TCP = 1,
ISCSI_SCTP_UDP = 2,
Expand Down Expand Up @@ -503,6 +503,7 @@ struct iscsi_conn {
u16 login_port;
u16 local_port;
int net_size;
int login_family;
u32 auth_id;
u32 conn_flags;
/* Used for iscsi_tx_login_rsp() */
Expand Down Expand Up @@ -562,9 +563,12 @@ struct iscsi_conn {
struct list_head immed_queue_list;
struct list_head response_queue_list;
struct iscsi_conn_ops *conn_ops;
struct iscsi_login *conn_login;
struct iscsit_transport *conn_transport;
struct iscsi_param_list *param_list;
/* Used for per connection auth state machine */
void *auth_protocol;
void *context;
struct iscsi_login_thread_s *login_thread;
struct iscsi_portal_group *tpg;
/* Pointer to parent session */
Expand Down Expand Up @@ -663,17 +667,20 @@ struct iscsi_login {
u8 first_request;
u8 version_min;
u8 version_max;
u8 login_complete;
u8 login_failed;
char isid[6];
u32 cmd_sn;
itt_t init_task_tag;
u32 initial_exp_statsn;
u32 rsp_length;
u16 cid;
u16 tsih;
char *req;
char *rsp;
char req[ISCSI_HDR_LEN];
char rsp[ISCSI_HDR_LEN];
char *req_buf;
char *rsp_buf;
struct iscsi_conn *conn;
} ____cacheline_aligned;

struct iscsi_node_attrib {
Expand Down Expand Up @@ -754,6 +761,8 @@ struct iscsi_np {
struct task_struct *np_thread;
struct timer_list np_login_timer;
struct iscsi_portal_group *np_login_tpg;
void *np_context;
struct iscsit_transport *np_transport;
struct list_head np_list;
} ____cacheline_aligned;

Expand Down
Loading

0 comments on commit 066e864

Please sign in to comment.