Date: Tue, 17 May 2016 11:10:44 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300044 - in head/sys: cam/ctl dev/iscsi Message-ID: <201605171110.u4HBAiDu002267@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Tue May 17 11:10:44 2016 New Revision: 300044 URL: https://svnweb.freebsd.org/changeset/base/300044 Log: Add icl_conn_connect() ICL method, required for iSER. Obtained from: Mellanox Technologies (earlier version) MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/dev/iscsi/icl.c head/sys/dev/iscsi/icl.h head/sys/dev/iscsi/icl_conn_if.m head/sys/dev/iscsi/icl_proxy.c head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi/icl_wrappers.h head/sys/dev/iscsi/iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Tue May 17 09:56:22 2016 (r300043) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Tue May 17 11:10:44 2016 (r300044) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mutex.h> #include <sys/queue.h> #include <sys/sbuf.h> +#include <sys/socket.h> #include <sys/sysctl.h> #include <sys/systm.h> #include <sys/uio.h> Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/icl.c Tue May 17 11:10:44 2016 (r300044) @@ -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> Modified: head/sys/dev/iscsi/icl.h ============================================================================== --- head/sys/dev/iscsi/icl.h Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/icl.h Tue May 17 11:10:44 2016 (r300044) @@ -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 * 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 */ Modified: head/sys/dev/iscsi/icl_conn_if.m ============================================================================== --- head/sys/dev/iscsi/icl_conn_if.m Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/icl_conn_if.m Tue May 17 11:10:44 2016 (r300044) @@ -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; +}; Modified: head/sys/dev/iscsi/icl_proxy.c ============================================================================== --- head/sys/dev/iscsi/icl_proxy.c Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/icl_proxy.c Tue May 17 11:10:44 2016 (r300044) @@ -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 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)) { Modified: head/sys/dev/iscsi/icl_soft.c ============================================================================== --- head/sys/dev/iscsi/icl_soft.c Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/icl_soft.c Tue May 17 11:10:44 2016 (r300044) @@ -101,6 +101,9 @@ static icl_conn_task_setup_t icl_soft_co 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; Modified: head/sys/dev/iscsi/icl_wrappers.h ============================================================================== --- head/sys/dev/iscsi/icl_wrappers.h Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/icl_wrappers.h Tue May 17 11:10:44 2016 (r300044) @@ -135,4 +135,16 @@ icl_conn_transfer_done(struct icl_conn * 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 */ Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue May 17 09:56:22 2016 (r300043) +++ head/sys/dev/iscsi/iscsi.c Tue May 17 11:10:44 2016 (r300044) @@ -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_ 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605171110.u4HBAiDu002267>