Add kobj interface between ICL and the rest of the iSCSI stack.
Review note - icl.c was moved to icl_soft.c. MFC after: 1 month Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
5bfb054e01
commit
321b17ec15
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277963
@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <cam/ctl/ctl_private.h>
|
||||
|
||||
#include <dev/iscsi/icl.h>
|
||||
#include <dev/iscsi/icl_wrappers.h>
|
||||
#include <dev/iscsi/iscsi_proto.h>
|
||||
#include <cam/ctl/ctl_frontend_iscsi.h>
|
||||
|
||||
@ -1241,7 +1242,7 @@ cfiscsi_session_new(struct cfiscsi_softc *softc)
|
||||
cv_init(&cs->cs_login_cv, "cfiscsi_login");
|
||||
#endif
|
||||
|
||||
cs->cs_conn = icl_conn_new("cfiscsi", &cs->cs_lock);
|
||||
cs->cs_conn = icl_new_conn(NULL, "cfiscsi", &cs->cs_lock);
|
||||
cs->cs_conn->ic_receive = cfiscsi_receive_callback;
|
||||
cs->cs_conn->ic_error = cfiscsi_error_callback;
|
||||
cs->cs_conn->ic_prv0 = cs;
|
||||
@ -2013,6 +2014,7 @@ cfiscsi_ioctl_port_create(struct ctl_req *req)
|
||||
return;
|
||||
}
|
||||
port = &ct->ct_port;
|
||||
// WAT
|
||||
if (ct->ct_state == CFISCSI_TARGET_STATE_DYING)
|
||||
goto done;
|
||||
|
||||
|
@ -1521,6 +1521,7 @@ ipw_monitor.fw optional ipwmonitorfw | ipwfw \
|
||||
clean "ipw_monitor.fw"
|
||||
dev/iscsi/icl.c optional iscsi | ctl
|
||||
dev/iscsi/icl_proxy.c optional iscsi | ctl
|
||||
dev/iscsi/icl_soft.c optional iscsi | ctl
|
||||
dev/iscsi/iscsi.c optional iscsi scbus
|
||||
dev/iscsi_initiator/iscsi.c optional iscsi_initiator scbus
|
||||
dev/iscsi_initiator/iscsi_subr.c optional iscsi_initiator scbus
|
||||
|
1437
sys/dev/iscsi/icl.c
1437
sys/dev/iscsi/icl.c
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,32 @@
|
||||
* and receive iSCSI PDUs.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/kobj.h>
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
SYSCTL_DECL(_kern_icl);
|
||||
|
||||
extern int icl_debug;
|
||||
|
||||
#define ICL_DEBUG(X, ...) \
|
||||
do { \
|
||||
if (icl_debug > 1) \
|
||||
printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define ICL_WARN(X, ...) \
|
||||
do { \
|
||||
if (icl_debug > 0) { \
|
||||
printf("WARNING: %s: " X "\n", \
|
||||
__func__, ## __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
struct icl_conn;
|
||||
struct ccb_scsiio;
|
||||
union ctl_io;
|
||||
|
||||
struct icl_pdu {
|
||||
STAILQ_ENTRY(icl_pdu) ip_next;
|
||||
@ -57,13 +82,6 @@ struct icl_pdu {
|
||||
uint32_t ip_prv2;
|
||||
};
|
||||
|
||||
struct icl_pdu *icl_pdu_new(struct icl_conn *ic, int flags);
|
||||
size_t icl_pdu_data_segment_length(const struct icl_pdu *ip);
|
||||
int icl_pdu_append_data(struct icl_pdu *ip, const void *addr, size_t len, int flags);
|
||||
void icl_pdu_get_data(struct icl_pdu *ip, size_t off, void *addr, size_t len);
|
||||
void icl_pdu_queue(struct icl_pdu *ip);
|
||||
void icl_pdu_free(struct icl_pdu *ip);
|
||||
|
||||
#define ICL_CONN_STATE_INVALID 0
|
||||
#define ICL_CONN_STATE_BHS 1
|
||||
#define ICL_CONN_STATE_AHS 2
|
||||
@ -74,6 +92,7 @@ void icl_pdu_free(struct icl_pdu *ip);
|
||||
#define ICL_MAX_DATA_SEGMENT_LENGTH (128 * 1024)
|
||||
|
||||
struct icl_conn {
|
||||
KOBJ_FIELDS;
|
||||
struct mtx *ic_lock;
|
||||
struct socket *ic_socket;
|
||||
#ifdef DIAGNOSTIC
|
||||
@ -104,11 +123,14 @@ struct icl_conn {
|
||||
void *ic_prv0;
|
||||
};
|
||||
|
||||
struct icl_conn *icl_conn_new(const char *name, struct mtx *lock);
|
||||
void icl_conn_free(struct icl_conn *ic);
|
||||
int icl_conn_handoff(struct icl_conn *ic, int fd);
|
||||
void icl_conn_close(struct icl_conn *ic);
|
||||
bool icl_conn_connected(struct icl_conn *ic);
|
||||
struct icl_conn *icl_new_conn(const char *offload, const char *name,
|
||||
struct mtx *lock);
|
||||
int icl_limits(const char *offload, size_t *limitp);
|
||||
|
||||
int icl_register(const char *offload, int priority,
|
||||
int (*limits)(size_t *),
|
||||
struct icl_conn *(*new_conn)(const char *, struct mtx *));
|
||||
int icl_unregister(const char *offload);
|
||||
|
||||
#ifdef ICL_KERNEL_PROXY
|
||||
|
||||
|
1537
sys/dev/iscsi/icl_soft.c
Normal file
1537
sys/dev/iscsi/icl_soft.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
|
||||
#include <dev/iscsi/icl.h>
|
||||
#include <dev/iscsi/icl_wrappers.h>
|
||||
#include <dev/iscsi/iscsi_ioctl.h>
|
||||
#include <dev/iscsi/iscsi_proto.h>
|
||||
#include <dev/iscsi/iscsi.h>
|
||||
@ -1730,7 +1731,7 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
|
||||
return (EBUSY);
|
||||
}
|
||||
|
||||
is->is_conn = icl_conn_new("iscsi", &is->is_lock);
|
||||
is->is_conn = icl_new_conn(NULL, "iscsi", &is->is_lock);
|
||||
is->is_conn->ic_receive = iscsi_receive_callback;
|
||||
is->is_conn->ic_error = iscsi_error_callback;
|
||||
is->is_conn->ic_prv0 = is;
|
||||
|
@ -22,8 +22,11 @@ SRCS+= scsi_ctl.c
|
||||
SRCS+= bus_if.h
|
||||
SRCS+= device_if.h
|
||||
SRCS+= vnode_if.h
|
||||
SRCS+= icl_conn_if.h
|
||||
SRCS+= opt_cam.h
|
||||
|
||||
#CFLAGS+=-DICL_KERNEL_PROXY
|
||||
|
||||
MFILES= kern/bus_if.m kern/device_if.m dev/iscsi/icl_conn_if.m
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -6,10 +6,15 @@ KMOD= iscsi
|
||||
SRCS= iscsi.c
|
||||
SRCS+= icl.c
|
||||
SRCS+= icl_proxy.c
|
||||
SRCS+= icl_soft.c
|
||||
SRCS+= opt_cam.h
|
||||
SRCS+= bus_if.h
|
||||
SRCS+= device_if.h
|
||||
SRCS+= icl_conn_if.c
|
||||
SRCS+= icl_conn_if.h
|
||||
|
||||
#CFLAGS+=-DICL_KERNEL_PROXY
|
||||
|
||||
MFILES= kern/bus_if.m kern/device_if.m dev/iscsi/icl_conn_if.m
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user