History log of /netbsd-current/sys/dev/iscsi/iscsi_send.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.40 25-Nov-2023 mlelstv

Adapt to bignum representation of target.
Fix negotiation for mutual authentication.
Prepare for more CHAP types.
Fix crashes for invalid socket descriptors passed to kernel.
Protect usecount with connection mutex, avoids race on connection close.
Minor cosmetics.


Revision tags: thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.39 13-Sep-2022 mlelstv

kill_session now uses the session id to avoid stale session pointers.
protect network socket with rwlock to handle recconnects.
always take over socket from iscsid to prevent leaks.
keep a good connection alive.
don't forget child device when config_detach fails.
fix locking when reassigning CCBs.
pducount is protected by lock, no need for atomic.
some code rework, refined debug messages.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 thorpej-i2c-spi-conf-base
# 1.38 06-Jun-2021 mlelstv

Schedule command timeout without connection lock being held to prevent
a deadlock.


Revision tags: netbsd-9-3-RELEASE cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.37 04-Mar-2018 mlelstv

branches: 1.37.22; 1.37.26;
Return temporary errors when the session is trying to recover the last
connection. The scsipi layer will retry.


# 1.36 03-Dec-2017 christos

- add a prefix to struct members (but not the ioctl ones because they affect
the API)
- use consistent variable names.


# 1.35 03-Dec-2017 mlelstv

add debug messages


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.34 25-Feb-2017 mlelstv

branches: 1.34.6;
Use correct lock for session wakeup.


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

branches: 1.32.2;
Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


# 1.39 13-Sep-2022 mlelstv

kill_session now uses the session id to avoid stale session pointers.
protect network socket with rwlock to handle recconnects.
always take over socket from iscsid to prevent leaks.
keep a good connection alive.
don't forget child device when config_detach fails.
fix locking when reassigning CCBs.
pducount is protected by lock, no need for atomic.
some code rework, refined debug messages.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 thorpej-i2c-spi-conf-base
# 1.38 06-Jun-2021 mlelstv

Schedule command timeout without connection lock being held to prevent
a deadlock.


Revision tags: netbsd-9-3-RELEASE cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.37 04-Mar-2018 mlelstv

branches: 1.37.22; 1.37.26;
Return temporary errors when the session is trying to recover the last
connection. The scsipi layer will retry.


# 1.36 03-Dec-2017 christos

- add a prefix to struct members (but not the ioctl ones because they affect
the API)
- use consistent variable names.


# 1.35 03-Dec-2017 mlelstv

add debug messages


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.34 25-Feb-2017 mlelstv

branches: 1.34.6;
Use correct lock for session wakeup.


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

branches: 1.32.2;
Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


# 1.38 06-Jun-2021 mlelstv

Schedule command timeout without connection lock being held to prevent
a deadlock.


Revision tags: cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.37 04-Mar-2018 mlelstv

Return temporary errors when the session is trying to recover the last
connection. The scsipi layer will retry.


# 1.36 03-Dec-2017 christos

- add a prefix to struct members (but not the ioctl ones because they affect
the API)
- use consistent variable names.


# 1.35 03-Dec-2017 mlelstv

add debug messages


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.34 25-Feb-2017 mlelstv

branches: 1.34.6;
Use correct lock for session wakeup.


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

branches: 1.32.2;
Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


Revision tags: isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.37 04-Mar-2018 mlelstv

Return temporary errors when the session is trying to recover the last
connection. The scsipi layer will retry.


# 1.36 03-Dec-2017 christos

- add a prefix to struct members (but not the ioctl ones because they affect
the API)
- use consistent variable names.


# 1.35 03-Dec-2017 mlelstv

add debug messages


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.34 25-Feb-2017 mlelstv

branches: 1.34.6;
Use correct lock for session wakeup.


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

branches: 1.32.2;
Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


# 1.36 03-Dec-2017 christos

- add a prefix to struct members (but not the ioctl ones because they affect
the API)
- use consistent variable names.


# 1.35 03-Dec-2017 mlelstv

add debug messages


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.34 25-Feb-2017 mlelstv

branches: 1.34.6;
Use correct lock for session wakeup.


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

branches: 1.32.2;
Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


# 1.34 25-Feb-2017 mlelstv

Use correct lock for session wakeup.


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


# 1.33 05-Feb-2017 mlelstv

Destroy callouts when cleaning up.


Revision tags: nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 1.32 25-Dec-2016 mlelstv

Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

branches: 1.31.2;
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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi


# 1.32 25-Dec-2016 mlelstv

Lock correctly around CV calls.
Fix handling of session termination.
Enable MPSAFE processing for scsipi.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.31 15-Jun-2016 mlelstv

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.


# 1.30 05-Jun-2016 mlelstv

Handle freeing of PDU when referencing CCB is freed.


# 1.29 05-Jun-2016 mlelstv

wrong assertion.


# 1.28 05-Jun-2016 mlelstv

Need session mutex to read serial number.


# 1.27 05-Jun-2016 mlelstv

Add missing mutex_exit().


# 1.26 05-Jun-2016 mlelstv

Whitespace, braces.


# 1.25 05-Jun-2016 mlelstv

Replace the simple tag counter with the command tag coming down from scsipi.
Also set attributes according to tag types.


# 1.24 05-Jun-2016 mlelstv

No need to acquire KERNEL_LOCK when entering network code.
Also use the socket callbacks.


# 1.23 05-Jun-2016 mlelstv

Make PDU init routines record serial number in CCB too.


# 1.22 05-Jun-2016 mlelstv

Fix locking for pdu flags here, in particular PDUF_INQUEUE.


# 1.21 05-Jun-2016 mlelstv

More debugging output, changed debug levels for some.


# 1.20 03-Jun-2016 mlelstv

fix debug message


# 1.19 01-Jun-2016 mlelstv

don't sleep in run_xfer path.


# 1.18 01-Jun-2016 mlelstv

refactor callouts
remove timed out ccbs and connections from cleanup queue when stopping timeout.


# 1.17 01-Jun-2016 mlelstv

factor out sernum handling.
make incrementing sernum atomic.
declare variables for atomic operations as volatile.


# 1.16 29-May-2016 mlelstv

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.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.15 24-Dec-2015 knakahara

fix amd64/conf/ALL build failure


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.14 30-May-2015 joerg

Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT


# 1.13 30-May-2015 joerg

Remove ISCSI_PERFTEST.


# 1.12 30-May-2015 joerg

Remove ISCSI_TEST_MODE and corresponding dev/iscsi_test.h header.


# 1.11 15-May-2015 joerg

Remove conditionals for NetBSD before 4.0.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.10 25-Sep-2014 tls

branches: 1.10.2;
The "throttling" code in the in-kernel iSCSI initiator is very questionable;
it sleeps on a ccb that appears highly unlikely to wake up, since it seems
to be waiting to _submit_ that very ccb! This is doubtless why someone tried
to disable it in the default case via several #defines.

Unfortunately one of those #defines is later tested backwards. Fix that.
The in-kernel initiator now seems to survive a system build without hanging.


# 1.9 05-Sep-2014 matt

Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 tls-maxphys-base
# 1.8 29-Dec-2012 mlelstv

branches: 1.8.12;
- defer session cleanup to not force detachments
- use more and explicit locking
- improve connection recovery
- use larger timeouts
- handle ccb buffer underflow correctly
- simplify throttling code

Sessions can now temporarily exist without a valid
connection, you also need to update iscsid(8).


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 1.7 09-Sep-2012 mhitch

branches: 1.7.2;
Remove an erroneous change that crept in. It was part of an earlier,
incorrect fix I had done for writing > 64K bytes. It was still in the
set of changes mlelstv had committed. I noticed it at the time, but did
not think it was problematic - until now. This fixes the ccb corruption
I was seeing and fixes PR kern/46896.


# 1.6 12-Aug-2012 mlelstv

Don't use common variables, also prefix global variables to avoid
namespace pollution.


# 1.5 24-Jun-2012 mlelstv

Add more debugging, fix filehandle usage, login negotiation and session
shutdown.
Add #ifdef'd code to send negotiation parameters in hex instead of base64,
so it works against older Linux targets.


# 1.4 19-Jun-2012 martin

assemble_login_parameters() has a strange error reporting convention:
errors are positive numbers, so <= 0 is good, not >= ...
This makes CHAP authenticated iscsi logins work.


# 1.3 09-Jun-2012 mlelstv

Close file descriptor passed into the kernel on success.
Fix locking of file handle. More cleanup on error paths.
Keep track of CCBs, so they cannot be used after a session ends.
Handle CCB timeouts even when the connection is terminated.
Compute firstdata, firstimmed correctly.


# 1.2 05-Jun-2012 mhitch

Fix system freeze when trying to write to a raw iSCSI device with MAXPHYS
bytes. Newfs does large writes when initializing the filesystem.
First, don't copy the head of a TAILQ to make a copy - the first entry will
still point back to the original head. This caused the ccb list to link to
itself, resulting in a continous loop processing the same ccb and blocked
interrupts. Use TAILQ_CONCAT() to copy the list.
Next, the ccb disposition was not set in the ccb when the ccb was throttled,
losing the CCBDISP_SCSIPI, so when a throttled ccb was resent, it failed to
call scscipi_done(), and left that I/O hanging.
I am now able to newfs an iSCSI device, was well as issued large writes
using dd.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.1 23-Oct-2011 agc

branches: 1.1.2; 1.1.8;
Start to move the in-kernel iSCSI initiator, kindly contributed to the
NetBSD Foundation by Wasabi Systems, from

othersrc/external/bsd/iscsi/sys/dev/iscsi

to

src/sys/dev/iscsi