From f2085cbf68170b0ebbd85e5433c6ce5d1597123c Mon Sep 17 00:00:00 2001 From: trasz Date: Wed, 7 May 2014 07:32:45 +0000 Subject: MFC r264526: Properly identify target portal when running in proxy mode. While here, remove CTL_ISCSI_CLOSE, it wasn't used or implemented anyway. Sponsored by: The FreeBSD Foundation --- sys/dev/iscsi/icl.h | 18 ++++++++++-------- sys/dev/iscsi/icl_proxy.c | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) (limited to 'sys/dev/iscsi') diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index d5f5aa2..e30c3d1 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -118,16 +118,17 @@ struct icl_listen; struct icl_listen_sock { TAILQ_ENTRY(icl_listen_sock) ils_next; - struct icl_listen *ils_listen; - struct socket *ils_socket; - bool ils_running; - bool ils_disconnecting; + struct icl_listen *ils_listen; + struct socket *ils_socket; + bool ils_running; + bool ils_disconnecting; + int ils_id; }; struct icl_listen { TAILQ_HEAD(, icl_listen_sock) il_sockets; struct sx il_lock; - void (*il_accept)(struct socket *); + void (*il_accept)(struct socket *, int); }; /* @@ -139,10 +140,11 @@ int icl_conn_connect(struct icl_conn *ic, bool rdma, /* * Target part. */ -struct icl_listen *icl_listen_new(void (*accept_cb)(struct socket *)); +struct icl_listen *icl_listen_new(void (*accept_cb)(struct socket *, int)); void icl_listen_free(struct icl_listen *il); -int icl_listen_add(struct icl_listen *il, bool rdma, int domain, - int socktype, int protocol, struct sockaddr *sa); +int icl_listen_add(struct icl_listen *il, bool rdma, + int domain, int socktype, int protocol, + struct sockaddr *sa, int portal_id); int icl_listen_remove(struct icl_listen *il, struct sockaddr *sa); /* diff --git a/sys/dev/iscsi/icl_proxy.c b/sys/dev/iscsi/icl_proxy.c index 41e64c3..18c9d20 100644 --- a/sys/dev/iscsi/icl_proxy.c +++ b/sys/dev/iscsi/icl_proxy.c @@ -182,7 +182,7 @@ icl_conn_connect(struct icl_conn *ic, bool rdma, int domain, int socktype, } struct icl_listen * -icl_listen_new(void (*accept_cb)(struct socket *)) +icl_listen_new(void (*accept_cb)(struct socket *, int)) { struct icl_listen *il; @@ -298,13 +298,13 @@ icl_accept_thread(void *arg) soclose(so); } - (ils->ils_listen->il_accept)(so); + (ils->ils_listen->il_accept)(so, ils->ils_id); } } static int -icl_listen_add_tcp(struct icl_listen *il, int domain, int socktype, int protocol, - struct sockaddr *sa) +icl_listen_add_tcp(struct icl_listen *il, int domain, int socktype, + int protocol, struct sockaddr *sa, int portal_id) { struct icl_listen_sock *ils; struct socket *so; @@ -348,6 +348,7 @@ icl_listen_add_tcp(struct icl_listen *il, int domain, int socktype, int protocol ils = malloc(sizeof(*ils), M_ICL_PROXY, M_ZERO | M_WAITOK); ils->ils_listen = il; ils->ils_socket = so; + ils->ils_id = portal_id; error = kthread_add(icl_accept_thread, ils, NULL, NULL, 0, 0, "iclacc"); if (error != 0) { @@ -366,8 +367,8 @@ icl_listen_add_tcp(struct icl_listen *il, int domain, int socktype, int protocol } int -icl_listen_add(struct icl_listen *il, bool rdma, int domain, int socktype, int protocol, - struct sockaddr *sa) +icl_listen_add(struct icl_listen *il, bool rdma, int domain, int socktype, + int protocol, struct sockaddr *sa, int portal_id) { if (rdma) { @@ -375,12 +376,14 @@ icl_listen_add(struct icl_listen *il, bool rdma, int domain, int socktype, int p ICL_DEBUG("RDMA not supported"); return (EOPNOTSUPP); #else - return (icl_listen_add_rdma(il, domain, socktype, protocol, sa)); + return (icl_listen_add_rdma(il, domain, socktype, protocol, + sa, portal_id)); #endif } - return (icl_listen_add_tcp(il, domain, socktype, protocol, sa)); + return (icl_listen_add_tcp(il, domain, socktype, protocol, sa, + portal_id)); } int -- cgit v1.1