Commit Graph

82 Commits

Author SHA1 Message Date
mlelstv 7442aaf8ef Use correct lock for session wakeup. 2017-02-25 12:03:57 +00:00
mlelstv 61e95c24aa Destroy callouts when cleaning up. 2017-02-05 12:05:46 +00:00
mlelstv 015f574c37 Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.
2016-12-25 06:55:28 +00:00
mlelstv d48455317c Work around an issue with MSG_WAITALL that would block for too long by
replacing it with a receive loop.
2016-06-15 04:33:52 +00:00
mlelstv bbe94f43d2 Remove throttling code, instead signal scsipi layer to reduce the openings
and retry the command. Start with a small openings number and let scsipi
request to grow it up to the current send window.

Adjust ccb and pdu counts to avoid ressource shortages. These are still
very ad-hoc numbers, but seem to be sufficient for a Gigabit link.

Use separate condvar for PDU pool and add counter to help debugging.

Revert setting PDU disposition to UNUSED before freeing. free_pdu
uses this as a flag to detect already returned PDUs.

Add reference counter for open commands to defer unmapping a session
that would lead to crashes in scsipi.

Move session cleanup to cleanup thread.

Use get_sernum to retrieve current serial number where possible and
make it check for immediate commands itself.

Adjust debug output.
2016-06-15 04:30:30 +00:00
mlelstv ae0ee83b73 drop unused debug helper routine 2016-06-15 03:51:55 +00:00
mlelstv e27d88e376 Fix field name in response pdu. 2016-06-15 03:40:59 +00:00
mlelstv eafa082213 use correct comparison of serial numbers 2016-06-05 15:04:31 +00:00
mlelstv 35a1d99d03 Don't resume throttled CCBs when connection is terminating, except for
those being actively waited for. Stop unthrottling when reaching MaxCmdSN
again.
2016-06-05 14:00:12 +00:00
mlelstv 3e27116260 Handle freeing of PDU when referencing CCB is freed. 2016-06-05 13:54:28 +00:00
mlelstv 7465018a7b More debug output. Dump pending CCBs when cleaning up. 2016-06-05 13:45:56 +00:00
mlelstv 7b7c8b93ad more debug output 2016-06-05 11:01:39 +00:00
mlelstv 62f45d0b81 acquire session lock when changing throttling queue 2016-06-05 09:21:14 +00:00
mlelstv 6bd66ce750 wrong assertion. 2016-06-05 09:12:48 +00:00
mlelstv c13976ae8f Need session mutex to read serial number. 2016-06-05 09:09:57 +00:00
mlelstv 3f22eb9b95 initialize before check. 2016-06-05 09:03:10 +00:00
mlelstv 7610d4bd71 appease compiler 2016-06-05 08:30:13 +00:00
mlelstv 44d00f8ce2 Add missing mutex_exit(). 2016-06-05 06:19:59 +00:00
mlelstv 3e2f1d8997 ensure that timeout counter is cleared when ccb is (re-)used. 2016-06-05 05:41:53 +00:00
mlelstv aba29f3a78 Whitespace, braces. 2016-06-05 05:40:29 +00:00
mlelstv 334be04930 Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.
2016-06-05 05:36:57 +00:00
mlelstv 530dbb3782 No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.
2016-06-05 05:31:43 +00:00
mlelstv 36dadbea16 Keep 1 CCB free for private use. This avoids frequent recovery in scsipi when
resources appear to be exhausted.
2016-06-05 05:29:01 +00:00
mlelstv 68dc548575 Make PDU init routines record serial number in CCB too. 2016-06-05 05:25:59 +00:00
mlelstv aac72e4bc4 Fix locking for pdu flags here, in particular PDUF_INQUEUE. 2016-06-05 05:18:58 +00:00
mlelstv febd01647c Handle ExpCmdSN and MaxCmdSN updates as specified. Don't compare
serial numbers as integers.
2016-06-05 05:11:57 +00:00
mlelstv d5741a228e Fix serial number check and account for commands in flight to avoid
unnecessary recovery actions.
2016-06-05 05:07:23 +00:00
mlelstv cac97d38f5 Tear down sysctls only after detaching children. This lets you enable
debugging while detaching hangs.
2016-06-05 04:53:22 +00:00
mlelstv 015cdd4666 ignore invalid ITT 2016-06-05 04:51:57 +00:00
mlelstv 64fa3c070d Whitespace 2016-06-05 04:50:23 +00:00
mlelstv 026739d4d4 When stopping a callout, wait until the cleanup thread has processed them. 2016-06-05 04:48:17 +00:00
mlelstv fb85db7754 More debugging output, changed debug levels for some. 2016-06-05 04:36:05 +00:00
mlelstv b42d0dd764 use sernum handling function 2016-06-03 06:55:16 +00:00
mlelstv 872a46d86d fix debug message 2016-06-03 06:53:40 +00:00
mlelstv c0d66217b0 don't sleep in run_xfer path. 2016-06-01 05:31:59 +00:00
mlelstv 5762a6113b refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.
2016-06-01 05:13:07 +00:00
mlelstv 62dba08e32 factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.
2016-06-01 04:19:08 +00:00
mlelstv de2e673f8c close session when last connection is removed. 2016-06-01 04:07:03 +00:00
mlelstv 996d520880 Several improvements to the ISCSI driver.
- Enable debug messages but set log level to be quiet. Provide a
  system (hw.iscsi.debug) to set the log level at run time.
- Replace old tsleep/wakeup synchronization with mutexes and condvars.
- Defer actions from callouts (basically timeouts) to the cleanup thread.
- Protect lists and unique ids with mutexes. protect connection usecount
  by using atomic operations.
- Assert kernel lock when calling into scsipi and network code.
- Use this to make send/receive/cleanup threads MPSAFE.

- Fix handling of out-of-CCB/out-of-PDU conditions against the scsipi layer.
- Bump number of PDUs to 128 to avoid virtually all out-of-PDU conditions

- Make use of softc structure for attach/detach operations.
- Track open file handles to prevent detach when busy.

- Move some global variables to make them static.

- Fix 'Overlapping Commands Attempted' error by marking commands as
  simply ordered (ATTR_SIMPLE) like FreeBSD.
2016-05-29 13:51:16 +00:00
knakahara 257075d266 fix amd64/conf/ALL build failure 2015-12-24 03:41:03 +00:00
dholland 59f989c072 Use value *before* freeing it. Found by brainy, reported by maxv. 2015-09-19 18:32:42 +00:00
christos e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
joerg e754774175 Create a per-device state for iscsi(4), effectively making it a cloning
device.
2015-05-30 20:09:47 +00:00
joerg 7169751760 Save space by making ack flag booleans. 2015-05-30 18:12:09 +00:00
joerg b869fee6c4 Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT 2015-05-30 18:09:31 +00:00
joerg 8adffa949a Remove ISCSI_PERFTEST. 2015-05-30 18:00:09 +00:00
joerg e38564c63d Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header. 2015-05-30 16:12:33 +00:00
joerg 73311a5466 Don't pre-compute string sizes in a relatively cold function. 2015-05-15 18:28:36 +00:00
joerg d8b0a2809a Drop conditional support for writing large numbers as hex. 2015-05-15 16:25:50 +00:00
joerg 8f2555d84b Remove conditionals for NetBSD before 4.0. 2015-05-15 16:24:30 +00:00