History log of /include/scsi/scsi_transport_iscsi.h
Revision Date Author Comments
6260a5d221225f4e6befd98c6001325a3007a8c4 27-Feb-2012 Nilesh Javali <nilesh.javali@qlogic.com> [SCSI] iscsi_transport: Add support to display CHAP list and delete CHAP entry

For offload iSCSI like qla4xxx CHAP entries are stored in FLASH.
This patch adds support to list CHAP entries stored in FLASH and
delete specified CHAP entry from FLASH using iscsi tools.

Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
ac20c7bf070df2b0feb410558ec4d75dbe59b701 13-Feb-2012 Vikas Chaudhary <vikas.chaudhary@qlogic.com> [SCSI] iscsi_transport: Added Ping support

Added ping support for iscsi adapter, application can use this
interface for diagnostic network connection.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
a11e25459558421ec5c4adc3fc46fe320ab74bd3 13-Feb-2012 Vikas Chaudhary <vikas.chaudhary@qlogic.com> [SCSI] scsi_transport_iscsi: added support for host event

Added support to post kernel host event to application using
netlink interface.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
aeddde2978f8931740032880134039fb937bb07c 19-Jan-2012 Vikas Chaudhary <vikas.chaudhary@qlogic.com> [SCSI] scsi_transport_iscsi: Added support to show port_state and port_speed in sysfs

sysfs patch to view port_state:
/sys/class/iscsi_host/host*/port_state

sysfs patch to view port_speed:
/sys/class/iscsi_host/host*/port_speed

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
587a1f1659e8b330b8738ef4901832a2b63f0bed 24-Jul-2011 Al Viro <viro@zeniv.linux.org.uk> switch ->is_visible() to returning umode_t

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
0c70d84b794c9a99f7395b617ecaef34c00d82ec 05-Dec-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: export pid of process that created

There could be multiple userspace entities creating/destroying/
recoverying sessions and also the kernel's iscsi drivers could
be doing this too. If the userspace apps do try to manage the kernel
ones it can get the driver/fw out of sync and cause the user to
loose the root disk, oopses or ping ponging becasue userspace
wants to do one thing but the kernel manager thought we
are trying to do another.

This patch fixes the problem by just exporting the pid of
the entity that created the session. Userspace programs like
iscsid, iscsiadm, iscsistart, qlogic's tools, etc, can then
figure out which sessions they own and only manage them.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
00c31889f7513e9ffa6b2b4de8ad6d7f59a61c80 06-Oct-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] qla4xxx: fix data alignment and use nl helpers

This has the driver use helpers for a common operation and fixes
a issue where if multiple iscsi params are sent they could be
sent at offsets that cause unaligned accesses. The nla helpers
account for the padding needed to align properly for the driver.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
8d4a690cd4f574bcb70c2cb89c227ba89a51351f 06-Oct-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: Replace iscsi_get_next_target_id with IDA

Replaced the iscsi_get_next_target_id with IDA to make
target-id allocation efficient for iscsi offload drivers

This patch should be applied after Jonathen Cameron Patch
"ida : simplified functions for id allocation"

Signed-off-by: John Soni Jose <jose0here@gmail.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
17fa575eec7254fb089f858cae135d64cd015440 25-Jul-2011 Manish Rangankar <manish.rangankar@qlogic.com> [SCSI] scsi_transport_iscsi: Add conn login, kernel to user, event to support offload session login.

Offload drivers like qla4xxx will offload the sending of the login/logout
pdus still, so this patch adds iscsi_conn_login_event which is
used by these types of drivers to notify userspace that the connection
has changed state.

It also adds a iscsi_is_session_online helper so the lld
can query the sessions state field.

Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
90eeb01a038e5fec0efdea4df008f3c18f67b82c 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add bsg support to iscsi class

This patch adds bsg support to the iscsi class. There is only
1 request, the host vendor one, supported. It is expected that
this would be used for things like flash updates.

This patch is made over this one
http://marc.info/?l=linux-scsi&m=131149780020992&w=2

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
f27fb2ef7bd88c9c5f67befe4d85e2155aa0e1a8 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: sysfs group is_visible callout for iscsi host attrs

The iscsi class currently does not support writable sysfs
attrs for LLD sysfs settings. This patch converts the
iscsi class and driver's host attrs to use the attribute
container sysfs group and the sysfs group's is_visible callout
to be able to support readable or writable sysfs attrs.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
b78dbba0053c6f14384d55b929d21b85d03c38bb 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: remove iface param mask

We can replace the iface param mask with the
attr_is_visible callback.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1d063c17298d7cd26cfe350f1e93e1727b4aa53f 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: sysfs group is_visible callout for session attrs

The iscsi class currently does not support writable sysfs
attrs for LLD sysfs settings. This patch converts the
iscsi class and driver's session attrs to use the attribute
container sysfs group and the sysfs group's is_visible callout
to be able to support readable or writable sysfs attrs.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
3128c6c73cdf3df92c3165bfb785ae50114d18bf 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi cls: sysfs group is_visible callout for conn attrs

The iscsi class currently does not support writable sysfs
attrs for LLD sysfs settings. This patch converts the
iscsi class and drivers to use the attribute container
sysfs group and the sysfs group's is_visible callout
to be able to support readable or writable sysfs attrs.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
8d07913dbe79568eafe5bb73806a08aac294d4e6 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add iface representation

A iscsi host can have multiple interfaces. This patch
adds a new iface iscsi class for this. It exports the
network settings now, and will be extended to also
export iscsi initiator port settings like the isid
and initiator name for drivers that can support multiple
initiator ports.

Based on patch from Lalit Chandivade.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
56c155b5ca427c9a6312bb0e31865f1c8ab10b2b 25-Jul-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi_transport: add support for net settings

Allows user space (iscsiadm) to send down network configuration
parameters for LLD to set private network configuration on the iSCSI
adapters.

Based on patch from Lalit Chandivade.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
289324b0c6007171d67bf1ab0827355ae3374773 16-Feb-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add callout to get iscsi_endpoint values

For drivers using the ep callbacks the addr and port
are attached to the endpoint instead of the conn.
This adds a callout to the iscsi_transport to get
ep values. It also adds locking around the get
param call to make sure that ep_disconnect does
not free the LLD's ep interconnect structs from
under us (the ep has a refcount so it will not
go away but the LLD may have structs from other
subsystems that are not allocated in the ep so
we need to protect them from getting freed).

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
bbc5261b2cb5e69754c935ea2466fb22775f0e48 16-Feb-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: remove unused active variable

The active variable on the iscsi_cls_conn is not used
so this patch removes it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
22a39fbbfecfea703b686a4626a631d706ccb3ee 16-Feb-2011 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: fix iscsi_endpoint leak

When iscsid restarts it does not know the connection's
endpoint, so it is getting leaked. This fixes the problem
by having the iscsi class force a disconnect before a
new connection is bound.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
c01be6dcb2b5cce4feaf48035be6395e5cd7d47c 22-Jul-2010 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi_transport: wait on session in error handler path

wait for session to come online in eh_device_reset_handler
and eh_target_reset_handler

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
43514774ff40c4fbe0cbbd3d8293a359f1a9fe71 09-Jun-2009 Michael Chan <mchan@broadcom.com> [SCSI] iscsi class: Add new NETLINK_ISCSI messages for cnic/bnx2i driver.

Add ISCSI_NETLINK messages for iSCSI NICs to get information such as
path from userspace. Original iscsid messages are now always sent as
multicast to group 1. The new messages are sent to group 2.

The multicast changes were made by Mike Christie.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
10eb0f013c63c71c82ede77945a5f390c10cfda6 14-May-2009 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: pass ep connect shost

When we create the tcp/ip connection by calling ep_connect, we currently
just go by the routing table info.

I think there are two problems with this.

1. Some drivers do not have access to a routing table. Some drivers like
qla4xxx do not even know about other ports.

2. If you have two initiator ports on the same subnet, the user may have
set things up so that session1 was supposed to be run through port1. and
session2 was supposed to be run through port2. It looks like we could
end with both sessions going through one of the ports.

Fixes for cxgb3i from Karen Xie.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
5e7facb77ff4b6961d936773fb1f175f7abf76b7 05-Mar-2009 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: remove host no argument from session creation callout

We do not need to have llds set the host no for the session's
parent, because we know the session's parent is going to be
the host. This removes it from the session creation callback
and converts the drivers.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
06d25af4edb60f9e9c7e74d342a6963a32e3392f 05-Mar-2009 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: fix lock dep warning on logout

We never should hit the lock up that is spit out when
lock dep is on and we logout. But we have been using the
shost work queue in a odd way. This patch has us use the
work queue for scanning instead of creating our own,
and this ends up also killing the lock dep warnings.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2ff79d52d56eebcffd83e9327b89d7daedf1e897 02-Dec-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: pass opcode into alloc_pdu callout

We do not need to allocate a itt for data_out, so this
passes the opcode to the alloc_pdu callout.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
262ef63627977acb7d8dd38c4f0f290bf49fbbfd 02-Dec-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: allow drivers to modify the itt sent to the target

bnx2i and cxgb3i need to encode LLD info in the itt so that
the firmware/hardware can process the pdu. This patch allows
the LLDs to encode info in the task->hdr->itt that they
setup in the alloc_pdu callout (any resources that are allocated
can be freed with the pdu in the cleanup_task callout). If
the LLD encodes info in the itt they should implement a
parse_pdu_itt callout. If parse_pdu_itt is not implemented
libiscsi will do the right thing for the LLD.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
577577da6d197ea3dcf3ee19c4f902fbd3a9390a 02-Dec-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: prepare libiscsi for new offload engines by modifying unsol data code

cxgb3i offloads data transfers. It does not offload the entire scsi/iscsi
procssing like qla4xxx and it does not offload the iscsi sequence
processing like how bnx2i does. cxgb3i relies on iscsi_tcp for the
seqeunce handling so this changes how we transfer unsolicitied data by
adding a common r2t struct and helpers.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
21536062d98938dfcfbae593a26c154e359749dc 24-Sep-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: fix endpoint id handling

Some endpoint code was using unsigned int and some
was using uint64_t. This converts it all to uint64_t.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
e5bd7b54e93ef7151469a12b8c28d863b9f8a088 24-Sep-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: Support drivers initiating session removal

If the driver knows when hardware is removed like with cxgb3i,
bnx2i, qla4xxx and iser then we will want to remove the sessions/devices
that are bound to that device before removing the host.

cxgb3i and in the future bnx2i will remove the host and that will
remove all the sessions on the hba. iser can call iscsi_kill_session
when it gets an event that indicates that a hca is removed.
And when qla4xxx is hooked in to the lib (it is only hooked into
the class right now) it can call iscsi remove host like the
partial offload card drivers.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
aab0de245150c09e61c30962feb16aacde508dc3 02-May-2008 Kay Sievers <kay.sievers@vrfy.org> driver core: remove KOBJ_NAME_LEN define

Kobjects do not have a limit in name size since a while, so stop
pretending that they do.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d82ff9be733a2e6da4f6c2ab4e9216f3f536503d 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add endpoint class

Add sysfs representation for the endpoint, so userspace can match the
host and session to the endpoint. This will allow us to set the host's
parent correctly at host creation time.

The next patches will convert tcp and iser, and fix iser's dma_mask
bug.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
7970634b81a6e3561954517bca42615542c4535b 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: user device_for_each_child instead of duplicating session list

Currently we duplicate the list of sessions, because we were using the
test for if a session was on the host list to indicate if the session
was bound or unbound. We can instead use the target_id and fix up
the class so that drivers like bnx2i do not have to manage the target id
space.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9c19a7d0387124a508d2cdb38ebf8cd484631ad0 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: rename iscsi_cmd_task to iscsi_task

This is the second part of the iscsi task merging, and
all it does it rename iscsi_cmd_task to iscsi_task and
mtask/ctask to just task.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
3e5c28ad0391389959ccae81c938c7533efb3490 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: merge iscsi_mgmt_task and iscsi_cmd_task

There is no need to have the mgmt and cmd tasks separate
structs. It used to save a lot of memory when we overprealocated
memory for tasks, but the next patches will set up the
driver so in the future they can use a mempool or some other
common scsi command allocator and common tagging.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
5d91e209fb21fb9cc765729d4c6a85a9fb6c9187 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: remove session/conn_data_size from iscsi_transport

This removes the session and conn data_size fields from the iscsi_transport.
Just pass in the value like with host allocation. This patch also makes
it so the LLD iscsi_conn data is allocated with the iscsi_cls_conn.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a4804cd6eb19318ae8d08ea967cfeaaf5c5b68a6 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: add iscsi host helpers

This finishes the host/session unbinding, by adding some helpers
to add and remove hosts and the session they manage.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
756135215ec743be6fdce2bdebe8cdb9f8a231f6 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: remove session and host binding in libiscsi

bnx2i allocates a host per netdevice but will use libiscsi,
so this unbinds the session from the host in that code.

This will also be useful for the iser parent device dma settings
fixes.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
32c6e1b9a2e27076b7070a9ec56a9e5437ebd725 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: rename iscsi_host to iscsi_cls_host

This renames the iscsi_host to iscsi_cls_host to match the other
structs, because libiscsi wants to use the iscsi_host name in
the future.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
d3826721b198001c55353b1c54e10843068aae63 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class, iscsi drivers: remove unused iscsi_transport attrs

max_cmd_len and max_conn are not really used. max_cmd_len is
always 16 and can be set by the LLD. max_conn is always one
since we do not support MCS.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
40753caa364bfba60ebd5e2a8bdf366ef175d03c 21-May-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class, iscsi_tcp/iser: add host arg to session creation

iscsi offload (bnx2i and qla4xx) allocate a scsi host per hba,
so the session creation path needs a shost/host_no argument.
Software iscsi/iser will follow the same behabior as before
where it allcoates a host per session, but in the future iser
will probably look more like bnx2i where the host's parent is
the hardware (rnic for iser and for bnx2i it is the nic), because
it does not use a socket layer like how iscsi_tcp does.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
45ab33b6c190c4a8c58f1d13be2ff89ee62024ba 04-Mar-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: regression - fix races with state manipulation and blocking/unblocking

For qla4xxx, we could be starting a session, but some error (network,
target, IO from a device that got started, etc) could cause the session
to fail and curring the block/unblock and state manipulation could race
with each other. This patch just has those operations done in the
single threaded iscsi eh work queue, so that way they are serialized.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
322d739da83bbff0309c202181f79c08d9534880 31-Jan-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: fix up iscsi printk prefix

Some iscsi class messages have the dev_printk prefix and some libiscsi
and iscsi_tcp messages have "iscsi" or the module name as a prefix which
is normally pretty useless when trying to figure out which session
or connection the message is attached to. This patch adds iscsi lib
and class dev_printks so all messages have a common prefix that
can be used to figure out which object printed it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
8aae18adb240a9eb1999b8245c56522cbefc9047 31-Jan-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add async scan helper

In qla4xxx's probe it will call the iscsi session setup functions
for session that got setup on the initial start. This then makes
it easy for the iscsi class to export a helper which indicates
when those scans are done.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
bd976f62cd6c6dda1ce57bf3e84447e94844868a 31-Jan-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add session scanning

This just adds iscsi session scanning which works like fc rport scanning.
The future patches will hook the drivers into Mathew Wilcox's async
scanning infrastructure, so userspace does not have to special case
iscsi and so userspace does not have to make a extra special case for
hardware iscsi root scanning.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
6eabafbe6616266e8de61980a7dac5ecc1ba1113 31-Jan-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class, libiscsi: add iscsi sysfs session state file

This adds a iscsi session state file which exports the session
state for both software and hardware iscsi. It also hooks libiscsi
in.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a8ac6311cc21d78fa284cd43f56df2063f536bf1 13-Dec-2007 Olaf Kirch <olaf.kirch@oracle.com> [SCSI] iscsi: convert xmit path to iscsi chunks

Convert xmit to iscsi chunks.

from michaelc@cs.wisc.edu:

Bug fixes, more digest integration, sg chaining conversion and other
sg wrapper changes, coding style sync up, and removal of io fields,
like pdu_sent, that are not needed.

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2697478903d0ad8bdbf868b1346ae4b891662bb1 13-Dec-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: fix shutdown

We were using the device delete sysfs file to remove each device
then logout. Now in 2.6.21 this will not work because
the sysfs delete file returns immediately and does not wait for
the device removal to complete. This causes a hang if a cache sync
is needed during shutdown. Before .21, that approach had other
problems, so this patch fixes the shutdown code so that we remove the target
and unbind the session before logging out and shut down the session

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
b3a7ea8d50f6028964b468d13a095dfb2508b2fb 13-Dec-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: do not block session during logout

There is not need to block the session during logout. Since
we are going to fail the commands that were blocked just fail them
immediately instead.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
d773c082da27c445c832324cfb4a357498613a38 02-Oct-2007 Michael S. Tsirkin <mst@dev.mellanox.co.il> [SCSI] scsi_transport_iscsi: add list, mutex includes

scsi/scsi_transport_iscsi.h uses struct mutex and struct list_head,
so while linux/mutex.h and linux/list.h seem to be pulled in indirectly
by one of the headers it includes, the right thing
is to include linux/mutex.h and linus/list.h directly.

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Acked-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1548271ece9e9312fd5feb41fd58773b56a71d39 30-May-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: make can_queue configurable

This patch allows us to set can_queue and cmds_per_lun from userspace
when we create the session/host. From there we can set it on a per
target basis. The patch fully converts iscsi_tcp, but only hooks
up ib_iser for cmd_per_lun since it currently has a lots of preallocations
based on can_queue.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: Roland Dreier <rdreier@cisco.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
77a23c21aaa723f6b0ffc4a701be8c8e5a32346d 30-May-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] libiscsi: fix iscsi cmdsn allocation

The cmdsn allocation and pdu transmit code can race, and we can end
up sending a pdu with cmdsn 10 before a pdu with 5. The target will
then fail the connection/session. This patch fixes the problem by
delaying the cmdsn allocation until we are about to send the pdu.

This also removes the xmitmutex. We were using the connection xmitmutex
during error handling to handle races with mtask and ctask cleanup and
completion. For ctasks we now have nice refcounting and for the mtask,
if we hit the case where the mtask timesout and it is floating
around somewhere in the driver, we end up dropping the session.
And to handle session level cleanup, we use the xmit suspend bit
along with scsi_flush_queue and the session lock to make sure
that the xmit thread is not possibly transmitting a task while
we are trying to kill it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: Roland Dreier <rdreier@cisco.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1d9bf13a9cf91f8faf221e98a64dd1157bcf5fa9 30-May-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: add iscsi host set param event

The iscsi class uses the set_param event to set session
and connection params. This patch adds a set_host_param
so we can set host level values.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2174a04ee7d8304a270de183fbc58b36dd05b395 30-May-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi_transport, qla4xxx: have class lookup host for drivers

We are going to be adding more host level sysfs attrs and
set_params, so this patch has them take a scsi_host instead
of either a scsi_host or host no.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: David C Somayajulu <david.somayajulu@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1819dc8143eff2a5850af274bcf8bcbc3e73ec76 30-May-2007 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi_transport: export hw address

Add hw address sysfs file.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
c4028958b6ecad064b1a6303a6a5906d4fe48d73 22-Nov-2006 David Howells <dhowells@redhat.com> WorkStruct: make allyesconfig

Fix up for make allyesconfig.

Signed-Off-By: David Howells <dhowells@redhat.com>
43a145a3440c5c5f24ff2888801e40e2242187e6 17-Oct-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi class: fix slab corruption during restart

The transport class recv mempools are causing slab corruption.
We could hack around netlink's lack of mempool support like dm,
but it is just too ulgy (dm's hack is ugly enough :) when you need
to support broadcast.

This patch removes the recv pools. We have not used them even when
we were allocting 20 MB per session and the system only had 64 MBs.
And we have no pools on the send side and have been ok there. When
Peter's work gets merged we can use that since the network guys
are in favor of that approach and are not going to add mempools
everywhere.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1c83469d36a9dd30dbf1fb9fc5ca3be3a0e64ff4 24-Jul-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi bugfixes: fix oops when iser is flushing io

When we enter recovery and flush the running commands
we cannot freee the connection before flushing the commands.
Some commands may have a reference to the connection
that needs to be released before. iscsi_stop was forcing
the term and suspend too early and was causing a oops
in iser, so this patch removes those callbacks all together
and allows the LLD to handle that detail.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
53cb8a1f45e06a2627a6d89b151cccb95fa45cbf 28-Jun-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: add async notification of session events

This patch adds or modifies the transport class functions
used to notify userspace of session state events.

We modify the session addition up event and add a destruction event
to notify userspace of session creation, relogin and destruction.

And we modify the conn error event to be sent by broadcast
since multiple listeners may want to listen for it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
6a8a0d3621745279a131d95f0204dc9ddac60d55 28-Jun-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: pass target nr to session creation

So the drivers do not use the channel numbers, but some do
use the target numbers. We were just adding some goofy
variable that just increases for the target nr. This is useless
for software iscsi because it is always zero. And for qla4xxx
the target nr is actually the index of the target/session
in its FW or FLASH tables. We needed to expose this to userspace
so apps could access those numbers so this patch just adds the
target nr to the iscsi session creation functions. This way
when qla4xxx's Hw thinks a session is at target nr 4
in its hw, it is exposed as that number in sysfs.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
8434aa8b6fe5af27a33b8aa830c24e3680356c83 28-Jun-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: break up session creation into two stages

qla4xxx is initialized in two steps like other HW drivers.
It allocates the host, sets up the HW, then adds the host.
For iscsi part of HW setup is setting up persistent iscsi
sessions. At that time, the interupts are off and the driver
is not completely set up so we just want to allocate them.
We do not want to add them to sysfs and expose them to userspace
because userspace could try to do lots of fun things with them
like scanning and at that time the driver is not ready.

So this patch breakes up the session creation like other
functions that use the driver model in two the alloc
and add parts. When the driver is ready, it can then add
the sessions and userspace can begin using them.

This also fixes a bug in the addition error patch where
we forgot to do a get on the session.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
e6f3b63f50b4bb9fdc9025e0c3994acd265ad3a2 28-Jun-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: rm channel usage from iscsi

I do not remember what I was thinking when we added the channel
as a argument to the session create function. It was probably
due to too much cut and paste work from the FC transport class.

The channel is meaningless for iscsi drivers so this patch drops
its usage everywhere in the iscsi related code.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
a54a52caad4bd6166cb7fa64e4e93031fa2fda5d 28-Jun-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: fixup set/get param functions

Reduce duplication in the software iscsi_transport modules by
adding a libiscsi function to handle the common grunt work.

This also has the drivers return specifc -EXXX values for different
errors so userspace can finally handle them in a sane way.

Also just pass the sysfs buffers to the drivers so HW iscsi can
get/set its string values, like targetname, and initiatorname.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
01cb225dad8da2e717356fab03240e2f4a8d01bf 28-Jun-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: add target discvery event to transport class

Patch from david.somayajulu@qlogic.com:

Add target discovery event. We may have a setup where the iscsi traffic
is on a different netowrk than the other network traffic. In this case
we will want to do discovery though the iscsi card. This patch adds
a event to the transport class that can be used by hw iscsi cards that
support this.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
3219e5294150aee7d389e19029f49b44fb6b5c9f 30-May-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: fix writepsace race

We can race and misset the suspend bit if iscsi_write_space is
called then iscsi_send returns with a failure indicating
there is no space.

To handle this this patch returns a error upwards allowing xmitworker
to decide if we need to try and transmit again. For the no
write space case xmitworker will not retry, and instead
let iscsi_write_space queue it back up if needed (this relies
on the work queue code to properly requeue us if needed).

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
656cffc95f0cb8211aa75eaca249e6ff4f59ec83 19-May-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: fix command requeues during iscsi recovery

Do not flush queues then block session. This will cause commands
to needlessly swing around on us and remove goofy
recovery_failed field and replace with state value.

And do not start recovery from within the host reset function.
This causeis too many problems becuase open-iscsi was desinged to
call out to userspace then have userpscae decide if we should
go into recovery or kill the session.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
264faaaa12544e7914928ad57ccba21907cad56b 03-May-2006 Or Gerlitz <ogerlitz@voltaire.com> [SCSI] iscsi: add transport end point callbacks

add transport end point callbacks so iscsi drivers that cannot connect
from userspace, like iscsi tcp, using sockets do not have to
implement their own socket infrastructure.

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7996a778ff8c717cb1a7a294475c59cc8f1e9fb8 07-Apr-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: add libiscsi

There is a lot of code duplcited between iscsi_tcp
and the upcoming iscsi_iser driver. This patch puts
the duplicated code in a lib. There is more code
to move around but this takes care of the
basics. For iscsi_offload if they use the lib we will
probably move some things around. For example in the
queuecommand we will not assume that the LLD wants
to do queue_work, but it is better to handle that
later when we know for sure what iscsi_offload looks
like (we could probably do this for iscsi_iser though to).

Ideally I would like to get the iscsi_transports modules
to a place where all they really have to do is put data
on the wire, but how to do that will hopefully be more clear
when we see other modules like iscsi_offload. Or maybe
iscsi_offload will not use the lib and it will just be
iscsi_iser and iscsi_tcp and maybe the iscsi_tcp_tgt if that
is allowed in mainline.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
30a6c65236f9d26e3325cae468f330b833a3878c 07-Apr-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: fix up iscsi eh

The current iscsi_tcp eh is not nicely setup for dm-multipath
and performs some extra task management functions when they
are not needed.

The attached patch:

- Fixes the TMF issues. If a session is rebuilt
then we do not send aborts.

- Fixes the problem where if the host reset fired, we would
return SUCCESS even though we had not really done anything
yet. This ends up causing problem with scsi_error.c's TUR.

- If someone has turned on the userspace nop daemon code to try
and detect network problems before the scsi command timeout
we can now drop and clean up the session before the scsi command
timesout and fires the eh speeding up the time it takes for a
command to go from one patch to another. For network problems
we fail the command with DID_BUS_BUSY so if failfast is set
scsi_decide_disposition fails the command up to dm for it to
try on another path.

- And we had to add some basic iscsi session block code. Previously
if we were trying to repair a session we would retrun a MLQUEUE code
in the queuecommand. This worked but it was not the most efficient
or pretty thing to do since it would take a while to relogin
to the target. For iscsi_tcp/open-iscsi a lot of the iscsi error handler
is in userspace the block code is pretty bare. We will be
adding to that for qla4xxx.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
fd7255f51a13ea915099c7e488001dfbbeb05104 07-Apr-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: add sysfs attrs for uspace sync up

For iscsi boot when going from initramfs to the real root we
need to stop the userpsace iscsi daemon. To later restart it
iscsid needs to be able to rebuild itself and part of that
process is matching a session running the kernel with the
iscsid representation. To do this the attached patch
adds several required iscsi values. If the LLD does not provide
them becuase, login is done in userspace, then the transport
class and userspace set ths up for the LLD.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
b5c7a12dc29ae0990d9e867749bdd717a3160325 07-Apr-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: rm kernel iscsi handles usage for session and connection

from hare@suse.de and michaelc@cs.wisc.edu

hw iscsi like qla4xxx does not allocate a host per session and
for userspace it is difficult to restart iscsid using the
"iscsi handles" for the session and connection, so this
patch just has the class or userspace allocate the id for
the session and connection.

Note: this breaks userspace and requires users to upgrade to the newest
open-iscsi tools. Sorry about his but open-iscsi is still too new to
say we have a stable user-kernel api and we were not good nough
designers to know that other hw iscsi drivers and iscsid itself would
need such changes. Actually we sorta did but at the time we did not
have the HW available to us so we could only guess.

Luckily, the only tools hooking into the class are the open-iscsi ones
or other tools like iscsitart hook into the open-iscsi engine from
userspace or prgroams like anaconda call our tools so they are not affected.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7b7232f3fb5ecd7c30cb52df368070cc5f5ca614 02-Feb-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi update: cleanup iscsi class interface

From:
michaelc@cs.wisc.edu
fujita.tomonori@lab.ntt.co.jp
da-x@monatomic.org

and err path fixup from:
ogerlitz@voltaire.com

This patch cleans up that interface by having the lld and class
pass a iscsi_cls_session or iscsi_cls_conn between each other when
the function is used by HW and SW iscsi llds. This way the lld
does not have to remember if it has to send a handle or pointer
and a handle or pointer to connection, session or host.

This also has the class verify the session handle that gets passed from
userspace instead of using the pointer passed into the kernel directly.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
7b8631b53bea286b68847a939b87135198335b66 14-Jan-2006 Mike Christie <michaelc@cs.wisc.edu> [SCSI] iscsi: seperate iscsi interface from setup functions

This is the second version of the patch to address Christoph's comments.
Instead of doing the lib, I just kept everything in scsi_trnapsort_iscsi.c
like the FC and SPI class. This was becuase the driver model and sysfs
class is tied to the session and connection setup so separating did not
buy very much at this time.

The reason for this patch was becuase HW iscsi LLDs like qla4xxx cannot
use the iscsi class becuase the scsi_host was tied to the interface and
class code. This patch just seperates the session from scsi host so
that LLDs that allocate the host per some resource like pci device
can still use the class.

This is also fixes a couple refcount bugs that can be triggered
when users have a sysfs file open, close the session, then
read or write to the file.

Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
39e84790d3b65a4af1ea1fb0d8f06c3ad75304b3 05-Aug-2005 Alex Aizman <itn780@yahoo.com> [SCSI] open-iscsi/linux-iscsi-5 Initiator: Header files

open-iscsi-headers.patch - common header files:
- iscsi_if.h (user/kernel #defines and user/kernel events);
- iscsi_proto.h (RFC3720 #defines and types);
- scsi_transport_iscsi.h (transport API, transport #defines and types).

Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!