Commit Graph

1953 Commits

Author SHA1 Message Date
Baptiste Daroussin
b4b4b5304b Revert crap accidentally committed 2017-01-28 16:31:23 +00:00
Baptiste Daroussin
814aaaa7da Revert r312923 a better approach will be taken later 2017-01-28 16:30:14 +00:00
Yoshihiro Takahashi
2b375b4edd Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes:	yes
2017-01-28 02:22:15 +00:00
Scott Long
bf1a889535 Squash a couple of uses of xpt_print_path()
Sponsored by:	Netflix
2017-01-27 21:55:47 +00:00
Warner Losh
e831795b8a Remove nested #ifdef that can't possibly be false. 2017-01-27 08:30:43 +00:00
Jung-uk Kim
a196ef645a Fix libcam build. It was broken with r312827. 2017-01-27 00:17:07 +00:00
Scott Long
a136ca542c Fix a development mis-merge from r312827
Sponsored by:	Netflix
2017-01-26 20:18:03 +00:00
Scott Long
ab3e89f1ab Refactor xpt_print_path, xpt_print, and xpt_path_string. Implement
all of them in terms of an sbuf-based back-end, xpt_path_sbuf.  This
unifies the implementation, but more importantly it stops the output
fropm being split between 4 or more invocations of printf.  The
multiple invocations cause interleaving of the messages on the
console during boot, making the output of disk discovery often
unintelligible.  This change helps a lot, but more work is needed.

Reviewed by:	ken, mav
Sponsored by:	Netflix
2017-01-26 20:08:58 +00:00
Edward Tomasz Napierala
5ab1cf33f7 Bring the ctl headers a bit closer to style(9). No functional changes. 2017-01-25 22:52:57 +00:00
Warner Losh
b20c0a07fb Preening pass to fix up trailing white space and other minor style(9)
nits (though I'm sure others remain).

MFC After: 3 days
2017-01-25 02:05:08 +00:00
Alexander Motin
e7037673ca Make CTL ramdisk backend a real RAM disk.
If "capacity" LU option is set, ramdisk backend now implements featured
thin provisioned disk, storing data in malloc(9) allocated memory blocks
of pblocksize bytes (default PAGE_SIZE or 4KB).  Additionally ~0.2% of LU
size is used for indirection tree (bigger pblocksize reduce the overhead).
Backend supports all unmap and anchor operations.  If configured capacity
is overflowed, proper error conditions are reported.

If "capacity" LU option is not set, the backend operates mostly the same
as before without allocating real storage: writes go to nowhere, reads
return zeroes, reporting that all LBAs are unmapped.

This backend is still mostly oriented on testing and benchmarking (it is
still a volatile RAM disk), but now it should allow to run real FS tests,
not only simple dumb dd.

MFC after:	2 weeks
2017-01-24 12:13:41 +00:00
Alexander Motin
b96d9778eb Fix overrun handling issue in r312291.
MFC after:	1 week
2017-01-23 17:44:33 +00:00
Edward Tomasz Napierala
f308ab7043 Remove max_targets and max_target_id CTL port variables; they were unused.
This changes the CTL frontend ABI and thus shouldn't be MFC-ed.

Reviewed by:	mav@
2017-01-22 20:06:15 +00:00
Edward Tomasz Napierala
c6646787ab Add SCSI descriptors for USB Mass Storage.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2017-01-22 15:32:17 +00:00
Alexander Motin
0c629e2884 Add initial support for CTL module unloading.
It is only a first step and not perfect, but better then nothing.
The main blocker is CAM target frontend, that can not be unloaded,
since CAM does not have mechanism to unregister periph driver now.

MFC after:	2 weeks
2017-01-21 19:38:26 +00:00
Alan Somers
c9bd03d87f Fix "camcontrol timestamp -s" with LTO-7 drives
The length of the scsi_set_timestamp_parameters struct was incorrect.  LTO-5
drives don't care, but LTO-7 drives do.

Reviewed by:	Sam Klopsch
MFC after:	2 weeks
Sponsored by:	Spectra Logic Corp
2017-01-20 17:54:24 +00:00
Alexander Motin
640603fbf6 Remove writing 'residual' field of struct ctl_scsiio.
This field has no practical use and never readed.  Initiators already
receive respective residual size from frontends.  Removed field had
different semantics, which looks useless, and was never passed through
by any frontend.

While there, fix kern_data_resid field support in case of HA, missed in
r312291.

MFC after:	13 days
2017-01-17 18:32:47 +00:00
Sean Bruno
23030355c6 Add 4k quirk for Micron 5100 and Intel S3610 SSDs
Submitted by:	Jason Wolfe <j@nitrology.com>
MFH:		1 week
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D9209
2017-01-17 14:52:48 +00:00
Alexander Motin
a8d32bff70 Improve error message on duplicate iSCSI port.
MFC after:	2 weeks
2017-01-17 14:13:14 +00:00
Alexander Motin
eb6ac6f9db Make CTL frontends report kern_data_resid for under-/overruns.
It seems like kern_data_resid was never really implemented.  This change
finally does it.  Now frontends update this field while transferring data,
while CTL/backends getting it can more flexibly handle the result.
At this point behavior should not change significantly, still reporting
errors on write overrun, but that may be changed later, if we decide so.

CAM target frontend still does not properly handle overruns due to CAM API
limitations.  We may need to add some fields to struct ccb_accept_tio to
pass information about initiator requested transfer size(s).

MFC after:	2 weeks
2017-01-16 16:19:55 +00:00
Conrad Meyer
1d64db52f3 Fix a variety of cosmetic typos and misspellings
No functional change.

PR:		216096, 216097, 216098, 216101, 216102, 216106, 216109, 216110
Reported by:	Bulat <bltsrc at mail.ru>
Sponsored by:	Dell EMC Isilon
2017-01-15 18:00:45 +00:00
Conrad Meyer
db4fcadf52 "Buses" is the preferred plural of "bus"
Replace archaic "busses" with modern form "buses."

Intentionally excluded:
* Old/random drivers I didn't recognize
  * Old hardware in general
* Use of "busses" in code as identifiers

No functional change.

http://grammarist.com/spelling/buses-busses/

PR:		216099
Reported by:	bltsrc at mail.ru
Sponsored by:	Dell EMC Isilon
2017-01-15 17:54:01 +00:00
Alexander Motin
953f538e0e Add under-/overrun support to IOCTL and CAM SIM frontends.
MFC after:	1 week
2017-01-15 13:57:42 +00:00
Alexander Motin
f319059631 When in kernel, map ctl_scsi_zero_io() to ctl_zero_io().
MFC after:	1 week
2017-01-15 13:51:44 +00:00
Alexander Motin
4902e14dc8 Improve CAM_CDB_POINTER support.
MFC after:	2 weeks
2017-01-13 08:31:55 +00:00
Alexander Motin
17160457b4 Report random flash storage as non-rotating to GEOM_DISK.
While doing it, introduce respective constants in geom_disk.h.

MFC after:	1 week
2017-01-12 08:53:10 +00:00
Alexander Motin
4982dca18d Do not wait for HA thread shutdown if scheduler is stopped.
This wait loop made system hang on panic instead of reboot.

MFC after:	1 week
2017-01-10 20:16:16 +00:00
Alexander Motin
7c07ea9aa2 Fix malloc(M_WAITOK) under mutex, introduced at r311787.
MFC after:	13 days
2017-01-10 10:33:36 +00:00
Alexander Motin
bb8f9017b3 Rewrite CTL statistics in more simple and scalable way.
Instead of collecting statistics for each combination of ports and logical
units, that consumed ~45KB per LU with present number of ports, collect
separate statistics for every port and every logical unit separately, that
consume only 176 bytes per each single LU/port.  This reduces struct
ctl_lun size down to just 6KB.

Also new IOCTL API/ABI does not hardcode number of LUs/ports, and should
allow handling of very large quantities.

MFC after:	2 weeks (probably keeping old API enabled for some time)
2017-01-09 18:18:15 +00:00
Alexander Motin
0e2d6474ca Allocate memory for prevent flags only for removable LUs.
This array takes 64KB of RAM now, that was more then half of struct ctl_lun
size.  If at some point we support more ports, this may need another tune.

MFC after:	2 weeks
2017-01-09 16:21:06 +00:00
Alexander Motin
81241f2828 Make CTL_GETSTATS ioctl return partial data if buffer is small.
MFC after:	2 weeks
2017-01-08 13:26:34 +00:00
Alexander Motin
54644e21e8 Make 'camcontrol modepage' support subpages.
MFC after:	2 weeks
2017-01-07 09:56:12 +00:00
Alexander Motin
f9b66e4c7d Fix bootverbose affecting code logic in r294558.
Reported by:	Jilles Tjoelker <jilles@stack.nl>
2017-01-05 16:30:13 +00:00
Alan Somers
4195c7de24 Always null-terminate ccb_pathinq.(sim_vid|hba_vid|dev_name)
The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are
fixed-length strings. AFAICT the only place they're read is in
sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.
However, the kernel doesn't null-terminate them. A bunch of copy-pasted code
uses strncpy to write them, and doesn't guarantee null-termination. For at
least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually
overflows. You can see the result by doing "camcontrol negotiate da0 -v".

This change null-terminates those fields everywhere they're set in the
kernel. It also shortens a few strings to ensure they'll fit within the
16-character field.

PR:		215474
Reported by:	Coverity
CID:		1009997 1010000 1010001 1010002 1010003 1010004 1010005
CID:		1331519 1010006 1215097 1010007 1288967 1010008 1306000
CID:		1211924 1010009 1010010 1010011 1010012 1010013 1010014
CID:		1147190 1010017 1010016 1010018 1216435 1010020 1010021
CID:		1010022 1009666 1018185 1010023 1010025 1010026 1010027
CID:		1010028 1010029 1010030 1010031 1010033 1018186 1018187
CID:		1010035 1010036 1010042 1010041 1010040 1010039
Reviewed by:	imp, sephe, slm
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9037
Differential Revision:	https://reviews.freebsd.org/D9038
2017-01-04 20:26:42 +00:00
Edward Tomasz Napierala
3a408ce90d Don't release the cfiscsi session refcount too early. It wasn't
observed to fix any actual error, but it's the right thing to do
from the correctness point of view.

Tested by:	Eugene M. Zheganin <emz at norma.perm.ru>
MFC after:	1 month
2017-01-04 12:50:44 +00:00
Alexander Motin
49fe3b378b Fix build with enabled debug after r310778.
MFC after:	2 weeks
2016-12-29 18:08:04 +00:00
Alexander Motin
9cbbfd2f5c Improve use of I/O's private area.
- Since I/Os are allocates from per-port pools, make allocations store
pointer to CTL softc there, and use it where needed instead of global.
 - Created bunch of helper macros to access LUN, port and CTL softc.

MFC after:	 2 weeks
2016-12-29 15:09:34 +00:00
Alexander Motin
e67ac203a6 Allow more efficient use of private area.
There are 16 bytes of space, so we may store two pointers in one.

MFC after:	2 weeks
2016-12-27 23:56:46 +00:00
Alexander Motin
ca734d8a13 Do not update "saved" mode page on every MODE SELECT.
We do not have non-volatile memory to really save those values, so we
neither report nor support this capability.  Also saved mode pages are
not replicated between HA peers now.

MFC after:	2 weeks
2016-12-27 22:38:44 +00:00
Alexander Motin
2e0a1f828e Fix/synchronize field types in struct ctl_modepage_header.
MFC after:	2 weeks
2016-12-27 22:31:06 +00:00
Alexander Motin
2c966e8500 Missed piece of r310640.
MFC after:	2 weeks
2016-12-27 22:28:14 +00:00
Alexander Motin
3722787c8a Add support for revert to defaults (RTD) bit in MODE SELECT.
MFC after:	2 weeks
2016-12-27 21:11:54 +00:00
Alexander Motin
ee5e44e076 Decouple limits on number of LUNs per port and LUs per CTL.
Those two values are not directly related, so make them independent.
This does not change any limits immediately, but makes number of LUNs
per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size.
After this change increasing CTL_MAX_LUNS should be pretty cheap,
and even making it tunable should be easy.

MFC after:	2 weeks
2016-12-27 18:23:16 +00:00
Alexander Motin
92efdd4305 Fix improperly used nexus.targ_lun.
MFC after:	2 weeks
2016-12-26 08:47:35 +00:00
Alexander Motin
a16253002c Some random code cleaning.
- Reduce indentation.
 - Remove extra braces.
 - Add few missing savety checks.

MFC after:	2 weeks
2016-12-25 20:17:15 +00:00
Alexander Motin
4124315924 Remove CTL_MAX_LUNS from places where it is not required.
MFC after:	2 weeks
2016-12-25 13:34:02 +00:00
Alexander Motin
a3dd837892 Improve third-party copy error reporting.
For EXTENDED COPY:
 - improve parameters checking to report some errors before copy start;
 - forward sense data from copy target as descriptor in case of error;
 - report which CSCD reported error in sense key specific information.
For WRITE USING TOKEN:
 - pass through real sense data from copy target instead of reporting
our copy error, since for initiator its a "simple" write, not a copy.

MFC after:	2 weeks
2016-12-25 09:40:44 +00:00
Alexander Motin
4fc0d1d757 Improve length handling when writing sense data.
- Allow maximal sense size limitation via Control Extension mode page.
 - When sense size limited, include descriptors atomically: whole or none.
 - Set new SDAT_OVFL bit if some descriptors don't fit the limit.
 - Report real written sense length instead of static maximal 252 bytes.

MFC after:	2 weeks
2016-12-24 17:42:34 +00:00
Alexander Motin
5bb5027e27 Implement printing forwarded sense data.
MFC after:	2 weeks
2016-12-23 21:56:08 +00:00
Alexander Motin
368cbc2c67 Add place-holders for TAPE STREAM MIRRORING subcommands of XCOPY.
We do not support tapes, so this is only a comments.

MFC after:	2 weeks
2016-12-23 14:54:40 +00:00