svn commit: r319152 - in stable/11: . share/man/man4 sys/cam/ctl sys/conf sys/modules sys/modules/cfiscsi sys/modules/ctl usr.sbin/ctladm usr.sbin/ctld

Ngie Cooper ngie at FreeBSD.org
Mon May 29 18:17:37 UTC 2017


Author: ngie
Date: Mon May 29 18:17:34 2017
New Revision: 319152
URL: https://svnweb.freebsd.org/changeset/base/319152

Log:
  MFC r314659,r314676:
  
  r314659:
  
  usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
  
  This simplifies make logic/output
  
  r314676:
  
  Fix build after r314656
  
  Some of the changes I introduced to use .ALLSRC were correct in spirit,
  but incorrect in reality -- in particular, ../Makefile.inc hadn't been
  pulled in via bsd.init.mk (via bsd.lib.mk, bsd.prog.mk), so the value
  of .ALLSRC (evaluated immediately) was empty. .include bsd.init.mk
  explicitly so we can be certain that the values used as dependencies in
  the targets are defined when the target recipe has been evaluated.
  
  Reminder: thou shalt separate out separate functional changes before
            committing them.
  
  (YUGE) Pointyhat to:	ngie
  In collaboration with:	bdrewery

Added:
  stable/11/share/man/man4/cfiscsi.4
     - copied unchanged from r316212, head/share/man/man4/cfiscsi.4
  stable/11/sys/modules/cfiscsi/
     - copied from r316212, head/sys/modules/cfiscsi/
Modified:
  stable/11/UPDATING
  stable/11/share/man/man4/Makefile
  stable/11/share/man/man4/ctl.4
  stable/11/sys/cam/ctl/ctl_frontend_iscsi.c
  stable/11/sys/conf/files
  stable/11/sys/modules/Makefile
  stable/11/sys/modules/ctl/Makefile
  stable/11/usr.sbin/ctladm/Makefile
  stable/11/usr.sbin/ctladm/ctladm.c
  stable/11/usr.sbin/ctld/Makefile
  stable/11/usr.sbin/ctld/kernel.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/UPDATING
==============================================================================
--- stable/11/UPDATING	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/UPDATING	Mon May 29 18:17:34 2017	(r319152)
@@ -22,6 +22,19 @@ from older version of current across the
 	installed. To continue using aarch64-binutils, set
 	CROSS_BINUTILS_PREFIX=/usr/local/aarch64-freebsd/bin .
 
+20170529:
+	The ctl.ko module no longer implements the iSCSI target frontend:
+	cfiscsi.ko does instead.
+
+	If building cfiscsi.ko as a kernel module, the module can be loaded
+	via one of the following methods:
+	- `cfiscsi_load="YES"` in loader.conf(5).
+	- Add `cfiscsi` to `$kld_list` in rc.conf(5).
+	- ctladm(8)/ctld(8), when compiled with iSCSI support
+	  (`WITH_ISCSI=yes` in src.conf(5))
+
+	Please see cfiscsi(4) for more details.
+
 20170511:
 	The mmcsd.ko module now additionally depends on geom_flashmap.ko.
 	Also, mmc.ko and mmcsd.ko need to be a matching pair built from the

Modified: stable/11/share/man/man4/Makefile
==============================================================================
--- stable/11/share/man/man4/Makefile	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/share/man/man4/Makefile	Mon May 29 18:17:34 2017	(r319152)
@@ -894,6 +894,7 @@ _dtrace_udp.4=	dtrace_udp.4
 .endif
 
 .if ${MK_ISCSI} != "no"
+MAN+=		cfiscsi.4
 MAN+=		iscsi.4
 MAN+=		iscsi_initiator.4
 MAN+=		iser.4

Copied: stable/11/share/man/man4/cfiscsi.4 (from r316212, head/share/man/man4/cfiscsi.4)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/11/share/man/man4/cfiscsi.4	Mon May 29 18:17:34 2017	(r319152, copy of r316212, head/share/man/man4/cfiscsi.4)
@@ -0,0 +1,104 @@
+.\" Copyright (c) 2013 Edward Tomasz Napierala
+.\" Copyright (c) 2015-2017 Alexander Motin <mav at FreeBSD.org>
+.\" Copyright (c) 2017 Ngie Cooper <ngie at FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd March 29, 2017
+.Dt CFISCSI 4
+.Os
+.Sh NAME
+.Nm cfiscsi
+.Nd CAM Target Layer iSCSI target frontend
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device cfiscsi"
+.Cd "device ctl"
+.Cd "device iscsi"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+cfiscsi_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+subsystem provides iSCSI target device emulation via
+.Xr ctl 4
+and
+.Xr iscsi 4 .
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va kern.cam.ctl.iscsi.debug
+Verbosity level for log messages from the kernel part of iSCSI target.
+Set to 0 to disable logging or 1 to warn about potential problems.
+Larger values enable debugging output.
+Defaults to 1.
+.It Va kern.cam.ctl.iscsi.maxtags
+The number of outstanding commands to advertise to each iSCSI initiator.
+Current implementation is not very accurate, so do not set this below 2.
+Defaults to 256.
+.It Va kern.cam.ctl.iscsi.ping_timeout
+The number of seconds to wait for the iSCSI initiator to respond to a NOP-In
+PDU.
+In the event that there is no response within that time the session gets
+forcibly terminated.
+Set to 0 to disable sending NOP-In PDUs.
+Defaults to 5.
+.El
+.Sh SEE ALSO
+.Xr ctl 4 ,
+.Xr iscsi 4
+.Sh HISTORY
+The
+.Nm
+subsystem first appeared in
+.Fx 10.0
+as part of the
+.Xr ctl 4
+driver.
+It was split off of
+.Xr ctl 4
+in
+.Fx 12.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+subsystem was developed by
+.An Edward Tomasz Napierala Aq Mt trasz at FreeBSD.org
+under sponsorship from the FreeBSD Foundation.
+This manual page was written by
+.An Ngie Cooper Aq Mt ngie at FreeBSD.org .

Modified: stable/11/share/man/man4/ctl.4
==============================================================================
--- stable/11/share/man/man4/ctl.4	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/share/man/man4/ctl.4	Mon May 29 18:17:34 2017	(r319152)
@@ -24,18 +24,17 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd March 19, 2017
+.Dd March 29, 2017
 .Dt CTL 4
 .Os
 .Sh NAME
 .Nm ctl
-.Nd CAM Target Layer / iSCSI target subsystem
+.Nd CAM Target Layer
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
-.Cd "device iscsi"
 .Cd "device ctl"
 .Ed
 .Pp
@@ -106,11 +105,8 @@ Provides access for local user-level app
 .Xr ioctl 2
 based API.
 .It iscsi
-Combined with
-.Xr iscsi 4
-and
-.Xr ctld 8 ,
-provides access for remote systems via iSCSI protocol.
+Provides access for remote systems via the iSCSI protocol using
+.Xr cfiscsi 4 .
 .It tpc
 Internal frontend used to receive requests from Third Party Copy engine,
 implementing copy offload operations.
@@ -194,24 +190,9 @@ the opposite change -- opens.
 If there is no primary node (both nodes are secondary, or secondary node has
 no connection to primary one), secondary node(s) report Transitioning state.
 State with two primary nodes is illegal (split brain condition).
-.It Va kern.cam.ctl.iscsi.debug
-Verbosity level for log messages from the kernel part of iSCSI target.
-Set to 0 to disable logging or 1 to warn about potential problems.
-Larger values enable debugging output.
-Defaults to 1.
-.It Va kern.cam.ctl.iscsi.maxtags
-The number of outstanding commands to advertise to each iSCSI initiator.
-Current implementation is not very accurate, so do not set this below 2.
-Defaults to 256.
-.It Va kern.cam.ctl.iscsi.ping_timeout
-The number of seconds to wait for the iSCSI initiator to respond to a NOP-In
-PDU.
-In the event that there is no response within that time the session gets
-forcibly terminated.
-Set to 0 to disable sending NOP-In PDUs.
-Defaults to 5.
 .El
 .Sh SEE ALSO
+.Xr cfiscsi 4 ,
 .Xr cfumass 4 ,
 .Xr ctladm 8 ,
 .Xr ctld 8 ,

Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c	Mon May 29 18:17:34 2017	(r319152)
@@ -184,8 +184,8 @@ static struct ctl_frontend cfiscsi_front
 	.ioctl = cfiscsi_ioctl,
 	.shutdown = cfiscsi_shutdown,
 };
-CTL_FRONTEND_DECLARE(ctlcfiscsi, cfiscsi_frontend);
-MODULE_DEPEND(ctlcfiscsi, icl, 1, 1, 1);
+CTL_FRONTEND_DECLARE(cfiscsi, cfiscsi_frontend);
+MODULE_DEPEND(cfiscsi, icl, 1, 1, 1);
 
 static struct icl_pdu *
 cfiscsi_pdu_new_response(struct icl_pdu *request, int flags)

Modified: stable/11/sys/conf/files
==============================================================================
--- stable/11/sys/conf/files	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/sys/conf/files	Mon May 29 18:17:34 2017	(r319152)
@@ -102,7 +102,7 @@ cam/ctl/ctl_cmd_table.c		optional ctl
 cam/ctl/ctl_frontend.c		optional ctl
 cam/ctl/ctl_frontend_cam_sim.c	optional ctl
 cam/ctl/ctl_frontend_ioctl.c	optional ctl
-cam/ctl/ctl_frontend_iscsi.c	optional ctl
+cam/ctl/ctl_frontend_iscsi.c	optional ctl cfiscsi
 cam/ctl/ctl_ha.c		optional ctl
 cam/ctl/ctl_scsi_all.c		optional ctl
 cam/ctl/ctl_tpc.c		optional ctl
@@ -1750,10 +1750,10 @@ ipw_monitor.fw			optional ipwmonitorfw |
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"ipw_monitor.fw"
-dev/iscsi/icl.c			optional iscsi | ctl
-dev/iscsi/icl_conn_if.m		optional iscsi | ctl
-dev/iscsi/icl_soft.c		optional iscsi | ctl
-dev/iscsi/icl_soft_proxy.c	optional iscsi | ctl
+dev/iscsi/icl.c			optional iscsi
+dev/iscsi/icl_conn_if.m		optional cfiscsi | iscsi
+dev/iscsi/icl_soft.c		optional iscsi
+dev/iscsi/icl_soft_proxy.c	optional iscsi
 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

Modified: stable/11/sys/modules/Makefile
==============================================================================
--- stable/11/sys/modules/Makefile	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/sys/modules/Makefile	Mon May 29 18:17:34 2017	(r319152)
@@ -492,6 +492,7 @@ _ipfilter=	ipfilter
 .endif
 
 .if ${MK_ISCSI} != "no" || defined(ALL_MODULES)
+SUBDIR+=	cfiscsi
 SUBDIR+=	iscsi
 SUBDIR+=	iscsi_initiator
 .endif

Modified: stable/11/sys/modules/ctl/Makefile
==============================================================================
--- stable/11/sys/modules/ctl/Makefile	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/sys/modules/ctl/Makefile	Mon May 29 18:17:34 2017	(r319152)
@@ -12,7 +12,6 @@ SRCS+=	ctl_cmd_table.c
 SRCS+=	ctl_frontend.c
 SRCS+=	ctl_frontend_cam_sim.c
 SRCS+=	ctl_frontend_ioctl.c
-SRCS+=	ctl_frontend_iscsi.c
 SRCS+=	ctl_ha.c
 SRCS+=	ctl_scsi_all.c
 SRCS+=	ctl_tpc.c
@@ -23,11 +22,10 @@ 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
+MFILES=	kern/bus_if.m kern/device_if.m
 
 .include <bsd.kmod.mk>

Modified: stable/11/usr.sbin/ctladm/Makefile
==============================================================================
--- stable/11/usr.sbin/ctladm/Makefile	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/usr.sbin/ctladm/Makefile	Mon May 29 18:17:34 2017	(r319152)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PROG=		ctladm
 SRCS=		ctladm.c util.c ctl_util.c ctl_scsi_all.c
 .PATH:		${SRCTOP}/sys/cam/ctl
@@ -17,4 +19,8 @@ WARNS?= 3
 LIBADD=		cam sbuf bsdxml util
 MAN=		ctladm.8
 
+.if ${MK_ISCSI} != "no"
+CFLAGS+=	-DWANT_ISCSI
+.endif
+
 .include <bsd.prog.mk>

Modified: stable/11/usr.sbin/ctladm/ctladm.c
==============================================================================
--- stable/11/usr.sbin/ctladm/ctladm.c	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/usr.sbin/ctladm/ctladm.c	Mon May 29 18:17:34 2017	(r319152)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/callout.h>
 #include <sys/ioctl.h>
 #include <sys/linker.h>
+#include <sys/module.h>
 #include <sys/queue.h>
 #include <sys/sbuf.h>
 #include <sys/stat.h>
@@ -4147,6 +4148,13 @@ main(int argc, char **argv)
 			retval = 1;
 			goto bailout;
 		}
+#ifdef	WANT_ISCSI
+		else {
+			if (modfind("cfiscsi") == -1 &&
+			    kldload("cfiscsi") == -1)
+				warn("couldn't load cfiscsi");
+		}
+#endif
 	} else if ((command != CTLADM_CMD_HELP)
 		&& ((cmdargs & CTLADM_ARG_DEVICE) == 0)) {
 		fprintf(stderr, "%s: you must specify a device with the "

Modified: stable/11/usr.sbin/ctld/Makefile
==============================================================================
--- stable/11/usr.sbin/ctld/Makefile	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/usr.sbin/ctld/Makefile	Mon May 29 18:17:34 2017	(r319152)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 CFLAGS+=-I${SRCTOP}/contrib/libucl/include
 .PATH:  ${SRCTOP}/contrib/libucl/include
 
@@ -21,4 +23,8 @@ CLEANFILES=	y.tab.c y.tab.h y.output
 WARNS?=		6
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
+.if ${MK_ISCSI} != "no"
+CFLAGS+=	-DWANT_ISCSI
+.endif
+
 .include <bsd.prog.mk>

Modified: stable/11/usr.sbin/ctld/kernel.c
==============================================================================
--- stable/11/usr.sbin/ctld/kernel.c	Mon May 29 16:26:37 2017	(r319151)
+++ stable/11/usr.sbin/ctld/kernel.c	Mon May 29 18:17:34 2017	(r319152)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/callout.h>
 #include <sys/ioctl.h>
 #include <sys/linker.h>
+#include <sys/module.h>
 #include <sys/queue.h>
 #include <sys/sbuf.h>
 #include <sys/stat.h>
@@ -90,6 +91,14 @@ kernel_init(void)
 	}
 	if (ctl_fd < 0)
 		log_err(1, "failed to open %s", CTL_DEFAULT_DEV);
+#ifdef	WANT_ISCSI
+	else {
+		saved_errno = errno;
+		if (modfind("cfiscsi") == -1 && kldload("cfiscsi") == -1)
+			log_warn("couldn't load cfiscsi");
+		errno = saved_errno;
+	}
+#endif
 }
 
 /*


More information about the svn-src-all mailing list