Commit Graph

198 Commits

Author SHA1 Message Date
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
Edward Tomasz Napierala
53ed4b300e Strip trailing whitespace.
MFC after:	2 weeks
2018-04-10 08:14:31 +00:00
John-Mark Gurney
3762b440dc minor work smithing... 2018-03-24 04:21:22 +00:00
Edward Tomasz Napierala
8eebe1bf66 Add missing SPDX tags for ctld(8).
MFC after:	2 weeks
2018-01-24 16:37:29 +00:00
Eitan Adler
dae3a64fb9 userland: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:01 +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
Edward Tomasz Napierala
74864a1eaa Use proper naming in a debug message.
MFC after:	2 weeks
2017-11-04 14:13:58 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Baptiste Daroussin
a6aeb2b6e4 Fix ctld segfaulting when using ucl conf file format and having duplicated
lun or target

Submitted by:	Nikita Kozlov <nikita.kozlov at blade-group.com>
MFC after:	3 days
Sponsored by:	blade
Differential Revision:	https://reviews.freebsd.org/D12646
2017-10-15 08:03:14 +00:00
Edward Tomasz Napierala
33481e53e7 Make ctld(8) mention cfiscsi(4).
MFC after:	2 weeks
2017-05-28 16:41:42 +00:00
Alexander Motin
9215e501b9 Do not register in CTL portal groups without portals.
From config synthax point of view such portal groups are not incorrect,
but they are useless since can not receive any connection.  And since
CTL port resource is very limited, it is good to save it.

MFC after:	2 weeks
2017-04-10 10:38:12 +00:00
Enji Cooper
653e7d6396 Split iscsi(4) ctl frontend off of ctl(4) as cfiscsi(4)
The goal of this work is to remove the explicit dependency for ctl(4)
on iscsi(4), so end-users without iscsi(4) support in the kernel can
use ctl(4) for its other functions.

This allows those without iscsi(4) support built into the kernel to use
ctl(4) as a test mechanism. As a sidenote, this was possible around the
10.0-RELEASE period, but made impossible for end-users without iscsi(4)
between 10.0-RELEASE and 11.0-RELEASE.

Automatically load cfiscsi(4) from ctladm(8) and ctld(8) for backwards
compatibility with previously releases. The automatic loading feature is
compiled into the beforementioned tools if MK_ISCSI == yes when building
world.

Add a manpage for cfiscsi(4) and refer to it in ctl(4).

Differential Revision:	D10099
MFC after:	2 months
Relnotes:	yes
Reviewed by:	mav, trasz
Sponsored by:	Dell EMC Isilon
2017-03-30 04:56:27 +00:00
Enji Cooper
9118b1b092 ctld: sort #includes per style(9)
- Only include sys/types.h or sys/param.h, not both.
- Sort alphabetically.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 18:59:49 +00:00
Enji Cooper
f040054c54 Allow WARNS to be overridden by the end-user
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-27 18:40:20 +00:00
Marcelo Araujo
5116725078 Use nitems() from sys/param.h.
Reviewed by:	np
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9945
2017-03-11 04:01:35 +00:00
Enji Cooper
64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +00:00
Alexander Motin
04108b8b21 Fix build with ICL_KERNEL_PROXY.
MFC after:	2 weeks
2017-01-20 17:43:36 +00:00
Alexander Motin
7aceb7fcd4 Fix wrong way assignment in r312190. 2017-01-14 19:58:51 +00:00
Alexander Motin
59c6e3a58f Decouple iSCSI connection limits from defaults.
If initiator does not negotiate some parameter, it expects one to get
default value, not some unknown remote hardware limit.  On the side side,
if some parameter is negotiated, its default value from RFC should not
be used for anything.
2017-01-14 18:04:12 +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
Xin LI
9a913ec291 Plug another leak with malformed IPv6 address.
MFC after:	2 weeks
2016-11-28 07:41:01 +00:00
Xin LI
203632f263 Don't leak 'str' when we see a malformed IPv6 address.
MFC after:	2 weeks
2016-11-28 07:33:26 +00:00
Alexander Motin
2668ec0761 There appeared to be even more copy/pastes. :)
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2016-10-31 16:06:57 +00:00
Alexander Motin
42f97fac5d Fix wrong copy/paste in error message.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2016-10-31 16:01:22 +00:00
Navdeep Parhar
97b84d344d Make the iSCSI parameter negotiation more flexible.
Decouple the send and receive limits on the amount of data in a single
iSCSI PDU.  MaxRecvDataSegmentLength is declarative, not negotiated, and
is direction-specific so there is no reason for both ends to limit
themselves to the same min(initiator, target) value in both directions.

Allow iSCSI drivers to report their send, receive, first burst, and max
burst limits explicitly instead of using hardcoded values or trying to
derive all of them from the receive limit (which was the only limit
reported by the drivers prior to this change).

Display the send and receive limits separately in the userspace iSCSI
utilities.

Reviewed by:	jpaetzel@ (earlier version), trasz@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7279
2016-08-25 05:22:53 +00:00
Marcelo Araujo
f3ccb446d2 Fix calloc(3) argument order.
Reviewed by:	trasz
MFC after:	4 weeks.
Differential Revision:	https://reviews.freebsd.org/D7532
2016-08-22 15:01:39 +00:00
Navdeep Parhar
fd936afb97 ctld(8): Fix MaxBurstLength negotiation.
The target must reply with the selected value of MaxBurstSize instead of
just echoing back the initiator's offered value.

Reviewed by:	mav@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7278
2016-07-22 19:28:23 +00:00
Edward Tomasz Napierala
2b30a69dc0 Add documentation for "ctld -u", the UCL configuration file format.
Submitted by:	jceel@
Reviewed by:	wblock@
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7222
2016-07-21 08:22:25 +00:00
Edward Tomasz Napierala
f9a2051818 Fix ctld(8) to not exit when reloading configuration with invalid
initiator-portal clause.

MFC after:	3 days
2016-07-09 20:01:07 +00:00
Edward Tomasz Napierala
2317fdfa8c Don't cap FirstBurstLength to maximum MaxRecvDataSegmentLength claimed
by the offload driver; there is no reason to do so, and it actually
harms performance.

MFC after:	1 month
2016-06-09 07:19:02 +00:00
Edward Tomasz Napierala
4e5408f10c Report negotiated MaxBurstLength and FirstBurstLength in "iscsictl -v"
and "ctladm islist -v" outputs.

MFC after:	1 month
2016-06-05 08:48:37 +00:00
Edward Tomasz Napierala
ba4a30ae97 Describe default value for "offload".
MFC after:	1 month
2016-06-01 11:45:06 +00:00
Edward Tomasz Napierala
78a89597fe Fix error message.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-05-19 14:45:34 +00:00
Don Lewis
ec77f107fa pdu_delete(request) frees request, so move the call after
login_new_response(request) to avoid a use-after-free error

Reported by:	Coverity
Reviewed by:	1331219, 1331220
2016-05-16 04:43:47 +00:00
Edward Tomasz Napierala
e321146fc5 Make the usage() mention the -u option added in r295212.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-04-12 16:07:41 +00:00
Edward Tomasz Napierala
e19462c33b Use the log_errno value passed to the function instead of the errno global
variable.

Suggested by:	Daniel Braniss
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-15 11:03:45 +00:00
Jakub Wojciech Klama
bb3844b388 Check value returned from ucl_parser_add_file().
Reviewed by:	trasz
Approved by:	trasz (mentor)
MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2016-03-13 19:50:17 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Bryan Drewery
9d8a81b4e4 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:14:30 +00:00
Alexander Motin
c85285a96b Don't check CmdSN for initial login request.
This fixes connection errors for some initiators not starting CmdSN
from zero.

While there, fix wrong status details reported for couple errors.

MFC after:	3 days
2016-02-12 10:58:13 +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
Bryan Drewery
b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Edward Tomasz Napierala
05c3dfeedf Add missing error checks.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-11-14 16:18:22 +00:00
Edward Tomasz Napierala
6bfb8cccc3 Cosmetics; no functional changes.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-11-14 16:15:38 +00:00
Edward Tomasz Napierala
c2ef20fdb7 Don't try to avoid calling free(3) with NULL argument.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-11-14 16:06:01 +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
Eitan Adler
463a577b27 Fix a ton of speelling errors
arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
2015-10-21 05:37:09 +00:00
Alexander Motin
cf8f2fa24b Document CD block size of 2048. 2015-10-02 11:27:34 +00:00
Alexander Motin
6f2f92a5bf Set default block size for CD to expected 2048 bytes. 2015-10-02 11:16:46 +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