summaryrefslogtreecommitdiffstats
path: root/sys/dev/iscsi
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2016-05-17 11:10:44 +0000
committertrasz <trasz@FreeBSD.org>2016-05-17 11:10:44 +0000
commit3397aa77757ffdca348184a150cef5b85eeae641 (patch)
tree565aaf66b848141f4310e0c54e8f55ce54fe02fd /sys/dev/iscsi
parent8da898f26c04f1b12f46ec60020d7d15d03799a9 (diff)
downloadFreeBSD-src-3397aa77757ffdca348184a150cef5b85eeae641.zip
FreeBSD-src-3397aa77757ffdca348184a150cef5b85eeae641.tar.gz
Add icl_conn_connect() ICL method, required for iSER.
Obtained from: Mellanox Technologies (earlier version) MFC after: 1 month Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/iscsi')
-rw-r--r--sys/dev/iscsi/icl.c1
-rw-r--r--sys/dev/iscsi/icl.h14
-rw-r--r--sys/dev/iscsi/icl_conn_if.m13
-rw-r--r--sys/dev/iscsi/icl_proxy.c19
-rw-r--r--sys/dev/iscsi/icl_soft.c17
-rw-r--r--sys/dev/iscsi/icl_wrappers.h12
-rw-r--r--sys/dev/iscsi/iscsi.c3
7 files changed, 52 insertions, 27 deletions
diff --git a/sys/dev/iscsi/icl.c b/sys/dev/iscsi/icl.c
index c679523..921fc2a 100644
--- a/sys/dev/iscsi/icl.c
+++ b/sys/dev/iscsi/icl.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
+#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/sx.h>
diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h
index b2d956f..521ac8f 100644
--- a/sys/dev/iscsi/icl.h
+++ b/sys/dev/iscsi/icl.h
@@ -139,12 +139,6 @@ struct sockaddr;
struct icl_listen;
/*
- * Initiator part.
- */
-int icl_conn_connect(struct icl_conn *ic, bool rdma,
- int domain, int socktype, int protocol,
- struct sockaddr *from_sa, struct sockaddr *to_sa);
-/*
* Target part.
*/
struct icl_listen *icl_listen_new(void (*accept_cb)(struct socket *,
@@ -156,9 +150,11 @@ int icl_listen_add(struct icl_listen *il, bool rdma,
int icl_listen_remove(struct icl_listen *il, struct sockaddr *sa);
/*
- * This one is not a public API; only to be used by icl_proxy.c.
+ * Those two are not a public API; only to be used between icl_soft.c and icl_proxy.c.
*/
-int icl_conn_handoff_sock(struct icl_conn *ic, struct socket *so);
-
+int icl_soft_handoff_sock(struct icl_conn *ic, struct socket *so);
+int icl_soft_proxy_connect(struct icl_conn *ic, int domain,
+ int socktype, int protocol, struct sockaddr *from_sa,
+ struct sockaddr *to_sa);
#endif /* ICL_KERNEL_PROXY */
#endif /* !ICL_H */
diff --git a/sys/dev/iscsi/icl_conn_if.m b/sys/dev/iscsi/icl_conn_if.m
index f7ebc82..11df311 100644
--- a/sys/dev/iscsi/icl_conn_if.m
+++ b/sys/dev/iscsi/icl_conn_if.m
@@ -29,6 +29,7 @@
# $FreeBSD$
#
+#include <sys/socket.h>
#include <dev/iscsi/icl.h>
INTERFACE icl_conn;
@@ -106,3 +107,15 @@ METHOD void transfer_done {
struct icl_conn *_ic;
void *_prv;
};
+
+#
+# The function below is only used with ICL_KERNEL_PROXY.
+#
+METHOD int connect {
+ struct icl_conn *_ic;
+ int _domain;
+ int _socktype;
+ int _protocol;
+ struct sockaddr *_from_sa;
+ struct sockaddr *_to_sa;
+};
diff --git a/sys/dev/iscsi/icl_proxy.c b/sys/dev/iscsi/icl_proxy.c
index b9bf27d..f91bea3 100644
--- a/sys/dev/iscsi/icl_proxy.c
+++ b/sys/dev/iscsi/icl_proxy.c
@@ -105,8 +105,8 @@ struct icl_listen {
static MALLOC_DEFINE(M_ICL_PROXY, "ICL_PROXY", "iSCSI common layer proxy");
-static int
-icl_conn_connect_tcp(struct icl_conn *ic, int domain, int socktype,
+int
+icl_soft_proxy_connect(struct icl_conn *ic, int domain, int socktype,
int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
{
struct socket *so;
@@ -153,26 +153,13 @@ icl_conn_connect_tcp(struct icl_conn *ic, int domain, int socktype,
return (error);
}
- error = icl_conn_handoff_sock(ic, so);
+ error = icl_soft_handoff_sock(ic, so);
if (error != 0)
soclose(so);
return (error);
}
-int
-icl_conn_connect(struct icl_conn *ic, bool rdma, int domain, int socktype,
- int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
-{
-
- if (rdma) {
- ICL_DEBUG("RDMA not supported");
- return (EOPNOTSUPP);
- }
-
- return (icl_conn_connect_tcp(ic, domain, socktype, protocol, from_sa, to_sa));
-}
-
struct icl_listen *
icl_listen_new(void (*accept_cb)(struct socket *, struct sockaddr *, int))
{
diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index 63f0da9..1216375 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -101,6 +101,9 @@ static icl_conn_task_setup_t icl_soft_conn_task_setup;
static icl_conn_task_done_t icl_soft_conn_task_done;
static icl_conn_transfer_setup_t icl_soft_conn_transfer_setup;
static icl_conn_transfer_done_t icl_soft_conn_transfer_done;
+#ifdef ICL_KERNEL_PROXY
+static icl_conn_connect_t icl_soft_conn_connect;
+#endif
static kobj_method_t icl_soft_methods[] = {
KOBJMETHOD(icl_conn_new_pdu, icl_soft_conn_new_pdu),
@@ -117,6 +120,9 @@ static kobj_method_t icl_soft_methods[] = {
KOBJMETHOD(icl_conn_task_done, icl_soft_conn_task_done),
KOBJMETHOD(icl_conn_transfer_setup, icl_soft_conn_transfer_setup),
KOBJMETHOD(icl_conn_transfer_done, icl_soft_conn_transfer_done),
+#ifdef ICL_KERNEL_PROXY
+ KOBJMETHOD(icl_conn_connect, icl_soft_conn_connect),
+#endif
{ 0, 0 }
};
@@ -1460,7 +1466,16 @@ icl_soft_limits(size_t *limitp)
#ifdef ICL_KERNEL_PROXY
int
-icl_conn_handoff_sock(struct icl_conn *ic, struct socket *so)
+icl_soft_conn_connect(struct icl_conn *ic, int domain, int socktype,
+ int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
+{
+
+ return (icl_soft_proxy_connect(ic, domain, socktype, protocol,
+ from_sa, to_sa));
+}
+
+int
+icl_soft_handoff_sock(struct icl_conn *ic, struct socket *so)
{
int error;
diff --git a/sys/dev/iscsi/icl_wrappers.h b/sys/dev/iscsi/icl_wrappers.h
index 4da8131..cb22d16 100644
--- a/sys/dev/iscsi/icl_wrappers.h
+++ b/sys/dev/iscsi/icl_wrappers.h
@@ -135,4 +135,16 @@ icl_conn_transfer_done(struct icl_conn *ic, void *prv)
ICL_CONN_TRANSFER_DONE(ic, prv);
}
+/*
+ * The function below is only used with ICL_KERNEL_PROXY.
+ */
+static inline int
+icl_conn_connect(struct icl_conn *ic, int domain, int socktype,
+ int protocol, struct sockaddr *from_sa, struct sockaddr *to_sa)
+{
+
+ return (ICL_CONN_CONNECT(ic, domain, socktype, protocol,
+ from_sa, to_sa));
+}
+
#endif /* !ICL_WRAPPERS_H */
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 90b262b..9c8080c 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/module.h>
+#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/sx.h>
@@ -1559,7 +1560,7 @@ iscsi_ioctl_daemon_connect(struct iscsi_softc *sc,
is->is_timeout = 0;
ISCSI_SESSION_UNLOCK(is);
- error = icl_conn_connect(is->is_conn, idc->idc_iser, idc->idc_domain,
+ error = icl_conn_connect(is->is_conn, idc->idc_domain,
idc->idc_socktype, idc->idc_protocol, from_sa, to_sa);
free(from_sa, M_SONAME);
free(to_sa, M_SONAME);
OpenPOWER on IntegriCloud