Deleted Added
full compact
ctl_frontend_iscsi.c (265501) ctl_frontend_iscsi.c (265505)
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265501 2014-05-07 06:46:59Z trasz $
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265505 2014-05-07 07:25:47Z trasz $
30 */
31
32/*
33 * CTL frontend for the iSCSI protocol.
34 */
35
36#include <sys/cdefs.h>
30 */
31
32/*
33 * CTL frontend for the iSCSI protocol.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265501 2014-05-07 06:46:59Z trasz $");
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 265505 2014-05-07 07:25:47Z trasz $");
38
39#include <sys/param.h>
40#include <sys/capability.h>
41#include <sys/condvar.h>
42#include <sys/file.h>
43#include <sys/kernel.h>
44#include <sys/kthread.h>
45#include <sys/lock.h>

--- 47 unchanged lines hidden (view full) ---

93SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, login_timeout, CTLFLAG_RWTUN,
94 &login_timeout, 60, "Time to wait for ctld(8) to finish Login Phase, in seconds");
95static int maxcmdsn_delta = 256;
96TUNABLE_INT("kern.cam.ctl.iscsi.maxcmdsn_delta", &maxcmdsn_delta);
97SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN,
98 &maxcmdsn_delta, 256, "Number of commands the initiator can send "
99 "without confirmation");
100
38
39#include <sys/param.h>
40#include <sys/capability.h>
41#include <sys/condvar.h>
42#include <sys/file.h>
43#include <sys/kernel.h>
44#include <sys/kthread.h>
45#include <sys/lock.h>

--- 47 unchanged lines hidden (view full) ---

93SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, login_timeout, CTLFLAG_RWTUN,
94 &login_timeout, 60, "Time to wait for ctld(8) to finish Login Phase, in seconds");
95static int maxcmdsn_delta = 256;
96TUNABLE_INT("kern.cam.ctl.iscsi.maxcmdsn_delta", &maxcmdsn_delta);
97SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN,
98 &maxcmdsn_delta, 256, "Number of commands the initiator can send "
99 "without confirmation");
100
101#define CFISCSI_DEBUG(X, ...) \
102 if (debug > 1) { \
103 printf("%s: " X "\n", __func__, ## __VA_ARGS__);\
101#define CFISCSI_DEBUG(X, ...) \
102 do { \
103 if (debug > 1) { \
104 printf("%s: " X "\n", \
105 __func__, ## __VA_ARGS__); \
106 } \
104 } while (0)
105
107 } while (0)
108
106#define CFISCSI_WARN(X, ...) \
107 if (debug > 0) { \
108 printf("WARNING: %s: " X "\n", \
109 __func__, ## __VA_ARGS__); \
109#define CFISCSI_WARN(X, ...) \
110 do { \
111 if (debug > 0) { \
112 printf("WARNING: %s: " X "\n", \
113 __func__, ## __VA_ARGS__); \
114 } \
110 } while (0)
111
115 } while (0)
116
112#define CFISCSI_SESSION_DEBUG(S, X, ...) \
113 if (debug > 1) { \
114 printf("%s: %s (%s): " X "\n", \
115 __func__, S->cs_initiator_addr, \
116 S->cs_initiator_name, ## __VA_ARGS__); \
117#define CFISCSI_SESSION_DEBUG(S, X, ...) \
118 do { \
119 if (debug > 1) { \
120 printf("%s: %s (%s): " X "\n", \
121 __func__, S->cs_initiator_addr, \
122 S->cs_initiator_name, ## __VA_ARGS__); \
123 } \
117 } while (0)
118
124 } while (0)
125
119#define CFISCSI_SESSION_WARN(S, X, ...) \
120 if (debug > 0) { \
121 printf("WARNING: %s (%s): " X "\n", \
122 S->cs_initiator_addr, \
123 S->cs_initiator_name, ## __VA_ARGS__); \
126#define CFISCSI_SESSION_WARN(S, X, ...) \
127 do { \
128 if (debug > 0) { \
129 printf("WARNING: %s (%s): " X "\n", \
130 S->cs_initiator_addr, \
131 S->cs_initiator_name, ## __VA_ARGS__); \
132 } \
124 } while (0)
125
126#define CFISCSI_SESSION_LOCK(X) mtx_lock(&X->cs_lock)
127#define CFISCSI_SESSION_UNLOCK(X) mtx_unlock(&X->cs_lock)
128#define CFISCSI_SESSION_LOCK_ASSERT(X) mtx_assert(&X->cs_lock, MA_OWNED)
129
130#define CONN_SESSION(X) ((struct cfiscsi_session *)(X)->ic_prv0)
131#define PDU_SESSION(X) CONN_SESSION((X)->ip_conn)

--- 2656 unchanged lines hidden ---
133 } while (0)
134
135#define CFISCSI_SESSION_LOCK(X) mtx_lock(&X->cs_lock)
136#define CFISCSI_SESSION_UNLOCK(X) mtx_unlock(&X->cs_lock)
137#define CFISCSI_SESSION_LOCK_ASSERT(X) mtx_assert(&X->cs_lock, MA_OWNED)
138
139#define CONN_SESSION(X) ((struct cfiscsi_session *)(X)->ic_prv0)
140#define PDU_SESSION(X) CONN_SESSION((X)->ip_conn)

--- 2656 unchanged lines hidden ---