Commit Graph

38 Commits

Author SHA1 Message Date
Richard Scheffenegger
ea8f1280a2 Add network QoS support for PCP to iscsi target.
Mak the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the target
side only.

Reviewed by:	mav, trasz, bcr
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26740
2020-10-24 21:10:53 +00:00
Richard Scheffenegger
64ffe6d440 Add DSCP support for network QoS to iscsi target.
In order to prioritize iSCSI traffic across a network,
DSCP can be used. In order not to rely on "ipfw setdscp"
or in-network reclassification, this adds the dscp value
directly to the portal group (where TCP sessions are accepted).

The incoming iSCSI session is first handled by ctld for any
CHAP authentication and the socket is then handed off to the
in-kernel iscsi driver without modification of the socket
parameters. Simply setting up the socket in ctld is sufficient
to keep sending outgoing iSCSI related traffic with the
configured DSCP value.

Reviewed by:	mav, trasz
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26385
2020-09-27 21:43:19 +00:00
Marcelo Araujo
8951f05525 Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports.

This revision introduces two changes to CTL:
- Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls.
  Removes ctl_be_arg structure and associated logic and replaces it with
  nv(3)-based logic for passing in and out arguments.
- Allows creating multiple ioctl frontend ports using either ctladm(8) or
  ctld(8).
  New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3.
  Those device nodes respond only to CTL_IO ioctl.

New command-line options for ctladm:
# creates new ioctl frontend port with using free pp and vp=0
ctladm port -c
# creates new ioctl frontend port with pp=10 and vp=0
ctladm port -c -O pp=10
# creates new ioctl frontend port with pp=11 and vp=12
ctladm port -c -O pp=11 -O vp=12
# removes port with number 4 (it's a "targ_port" number, not pp number)
ctladm port -r -p 4

New syntax for ctl.conf:
target ... {
    port ioctl/<pp>
    ...
}

target ... {
    port ioctl/<pp>/<vp>
    ...

Note: Most of this work was made by jceel@, thank you.

Submitted by:	jceel
Reworked by:	myself
Reviewed by:	mav (earlier versions and recently during the rework)
Obtained from:  FreeNAS and TrueOS
Relnotes:	Yes
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D9299
2018-05-10 03:50:20 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Alexander Motin
dad99db247 Add MAX_LUNS overflow safety checks.
While this MAX_LUNS limitation is too synthetic and should be removed,
it is better to enforce it while it is here.

MFC after:	2 weeks
2016-12-27 17:13:31 +00:00
Jakub Wojciech Klama
5c734b0410 Add an additional, libucl-based configuration file parser to ctld.
Default ctld behavior remains unchanged - libucl parser can be selected
explicitly by adding -u switch to ctld command line.

Reviewed by:	trasz
Approved by:	trasz (mentor)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D4534
2016-02-03 15:45:13 +00:00
Alexander Motin
398290f29a Introduce portal group options in ctl.conf.
While CTL has concept of port options, used at least for iSCSI ports now,
before this change it was impossible to set them manually.  There still
no user-configurable port options now, but I am planning to change that.
2015-11-09 18:33:36 +00:00
Alexander Motin
91be33dc78 Add to CTL initial support for CDROMs and removable devices.
Relnotes:	yes
2015-09-27 13:47:28 +00:00
Alexander Motin
3933f7b112 Add ctl-lun config option for consistency in HA setups. 2015-09-15 13:37:48 +00:00
Alexander Motin
db7bf2baae Add two new portal group options "tag" and "foreign".
They are going to be useful in clustered setups.
2015-09-07 13:43:05 +00:00
Xin LI
a7c4ad3926 Eliminate unused headers. 2015-04-14 18:13:55 +00:00
Edward Tomasz Napierala
a9d7821075 Move the "offload" clause from the target section to portal-group
section; it makes more sense there.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-28 12:02:32 +00:00
Edward Tomasz Napierala
f584f51d96 Add missing error check.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-26 09:08:48 +00:00
Alexander Motin
057abcb004 Teach ctld(8) to control non-iSCSI CTL ports.
This change introduces new target option "port", that assigns current target
to specified CTL port.  On config application ctld(8) will apply LUN mapping
according to target configuration to specified port and bring the port up.
On shutdown cltd(8) will remove the mapping and put the port down.

This change allows to configure both iSCSI and FibreChannel targets in the
same configuration file in alike way.

Kernel side support was added earlier at r278037.

MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2015-02-07 13:19:04 +00:00
Edward Tomasz Napierala
07b49a3eed Make it possible to set (via ctl.conf(5)) and query (via ctladm islist -v)
target iSCSI offload.  Add mechanism to query maximum receive data segment
size supported by chosen hardware offload module, and use it in ctld(8)
to determine the value to advertise to the other side.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-06 21:03:25 +00:00
Alexander Motin
92847ee1f3 Add support for multiple portal groups per target.
This change allows multiple "portal-group" options to be specified per
target.  Each of them may include new optional auth-group name parameter
to override per-target auth parameters for specific portal group.

Kernel side support was added earlier at r278161.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2015-02-06 17:43:13 +00:00
Alexander Motin
920c6cbadc CTL LUN mapping rewrite.
Replace iSCSI-specific LUN mapping mechanism with new one, working for any
ports.  By default all ports are created without LUN mapping, exposing all
CTL LUNs as before.  But, if needed, LUN mapping can be manually set on
per-port basis via ctladm.  For its iSCSI ports ctld does it via ioctl(2).
The next step will be to teach ctld to work with FibreChannel ports also.

Respecting additional flexibility of the new mechanism, ctl.conf now allows
alternative syntax for LUN definition.  LUNs can now be defined in global
context, and then referenced from targets by unique name, as needed.  It
allows same LUN to be exposed several times via multiple targets.

While there, increase limit for LUNs per target in ctld from 256 to 1024.
Some initiators do not support LUNs above 255, but that is not our problem.

Discussed with:	trasz
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
2015-02-01 21:50:28 +00:00
Edward Tomasz Napierala
6dbdbf825d Add support for sending redirections to iSCSI target.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-11-09 13:01:09 +00:00
Edward Tomasz Napierala
dbb1ee18cc Keep the token list sorted.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-29 12:12:27 +00:00
Edward Tomasz Napierala
f948858032 Make it possible to optionally use semicolon to separate statements.
This makes it possible to format stuff like this:

target xxx {
	lun 0 { path /foo/bar; size 4G; }
}

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-29 12:10:39 +00:00
Edward Tomasz Napierala
bd833b11c2 Simplify code; no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-29 09:36:02 +00:00
Edward Tomasz Napierala
0537488353 Add discovery-filter. This makes it possible to restrict which targets
are returned during discovery based on initiator portal, name, and CHAP
credentials.

Reviewed by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-29 09:26:55 +00:00
Edward Tomasz Napierala
d9b4554dbd Fix build after previous commit. While here, improve error messages.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-28 10:39:29 +00:00
Edward Tomasz Napierala
4524db570f Remove the distinction between strings and numbers from ctld(8) yacc parser.
This fixes problems with passing strings that look like numbers to clauses
that expect strings; previously it caused syntax errors and had to be worked
by user, using quotes.  The workaround introduced in r267833 is no longer
neccessary.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-28 10:25:59 +00:00
Alexander Motin
829603e21f Add basic iSNS client to the iSCSI target.
This makes ctld(8) register its iSCSI targets and portals on configured
iSNS servers to allow initiators find them without active discovery.

Fetching of allowed initiators from iSNS is not implemented now, so target
ACLs still should be configured manually.

Reviewed by:	trasz@
MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2014-10-25 12:50:26 +00:00
Edward Tomasz Napierala
2bd282696a Whitespace fixes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-22 09:17:17 +00:00
Josh Paetzel
c9593e36b4 Fix issues in config parser relating to lun serial numbers.
Without this fix some serial numbers needed to be quoted
to avoid the config parser bailing out.

Submitted by:	delphij
Sponsored by:	iXsystems
2014-06-24 19:12:55 +00:00
Edward Tomasz Napierala
a113ac0506 Rework the way we enable CTL iSCSI port. Previously conf_apply()
needed it to be already enabled, because listening in proxy mode
requires it; however, it's conf_apply() that opens pidfiles,
so it resulted in port being enabled before pidfile was opened.
This was not so bad, but it was also disabled when pidfile couldn't
be opened due to ctld already running; this means that starting
second ctld instance screwed up the first.

Sponsored by:	The FreeBSD Foundation
2014-04-16 10:43:12 +00:00
Edward Tomasz Napierala
6dc3a9f496 Show proper configuration file line numbers in error messages.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:37:49 +00:00
Edward Tomasz Napierala
e76ce4484d Use new auth-type "deny" instead of using "chap" with no chap entries;
it's cleaner this way, and gives better feedback to the user.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:32:36 +00:00
Edward Tomasz Napierala
e7977549f7 Add a new auth-group "default", defaulting to deny, and make it possible
to redefine it.  From now on, assigning auth-group to a target is no longer
mandatory.

Sponsored by:	The FreeBSD Foundation
2014-02-11 11:29:05 +00:00
Edward Tomasz Napierala
252d941cc3 Make it possible to redefine portal-group "default".
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:27:25 +00:00
Edward Tomasz Napierala
df9900fb5b Add auth-type.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:26:05 +00:00
Edward Tomasz Napierala
f7ae5bf8de Rename a variable, no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:14:50 +00:00
Edward Tomasz Napierala
e1c0d0d8a3 Yacc cleanup; no functional changes.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:11:37 +00:00
Edward Tomasz Napierala
8cb2e95863 Implement initiator-name and initiator-portal restrictions.
Sponsored by:	The FreeBSD Foundation
2014-02-11 11:08:04 +00:00
Edward Tomasz Napierala
5d02cc7ff9 Fix typos.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2013-12-02 09:23:34 +00:00
Edward Tomasz Napierala
009ea47eb2 Bring in the new iSCSI target and initiator.
Reviewed by:	ken (parts)
Approved by:	re (delphij)
Sponsored by:	FreeBSD Foundation
2013-09-14 15:29:06 +00:00