summaryrefslogtreecommitdiff
path: root/usr/iscsi_sysfs.c
Commit message (Collapse)AuthorAgeFilesLines
* iscsid: don't sync qla4xxx flash sessionsMike Christie2011-11-011-0/+23
| | | | | | | | We do not want to sync iscsid with qla4xxx's flash/fw sessions, because the kernel/fw controls recovery. This uses the creator sysfs file to figure out if the session is ours or not.
* iscsiadm: fix printing of unknown host valuesMike Christie2011-10-101-2/+3
| | | | Add checks for if a driver does not export a host value.
* iscsi tools: fix up vlan supportMike Christie2011-10-061-16/+15
| | | | | | | | | | | This syncs userspace up with what has been sent to linux-scsi by fixing: 1. link_local_autocfg sysfs file naming. 2. init vlan, port and mtu sysfs handling so that they are initialized to 0 on failure to read them. 3. Change ISCSI_NET_PARAM_VLAN_ID to ISCSI_NET_PARAM_VLAN_TAG because we are setting the tag and not just the id.
* iscsi tools: fix default iface binding setupMike Christie2011-08-141-1/+6
| | | | | | | If a driver supports multiple ifaces only one is getting auto created. This modifies the default iface setup code so that it creates a iface per kernel iface or a iface per host if kernel ifaces are not supported.
* iscsi tools: add tgt reset to session info and fix unknown valuesMike Christie2011-08-141-9/+13
| | | | | | | | | | | | | | This patch adds tgt reset to the displayed timeouts. It also fixes recovery timeout handling. -1 is a valid setting in newer tools. If the kernel displays it then it is ok. And instead of printing "<NULL>" for settings we do not know the value for this prints out "<empty>" like is done in other places. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* iscsi tools: manage qla4xxx iscsi sessions with iscsiadmLalit Chandivade2011-08-141-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is based on initial work done by Mike Christie here, http://groups.google.com/group/open-iscsi/browse_thread/thread/193fe9037f3127da# This patch modifies iscsiadm so it can control sessions that are accessed through qla4xxx. To do discovery using the qla4xxx iscsi class interface first check the available qla4xxx iface ./iscsiadm -m iface -P 0 will display the different ifaces like this: qla4xxx.00:0e:1e:04:87:fa qla4xxx,00:0e:1e:04:87:fa,192.168.1.112,\ <empty>,<empty> qla4xxx.00:0e:1e:04:87:fe qla4xxx,00:0e:1e:04:87:fe,<empty>,<empty>,<empty> Issue discovery command ./iscsiadm -m discovery -t sendtargets -I qla4xxx.00:0e:1e:04:87:fa \ -p 192.168.1.10:3260 192.168.1.10:3260,1 iqn.2001-05.com.target:0-7d76ca2b7d54b541-disk2 192.168.1.10:3260,1 iqn.2001-05.com.target:0-46f6ca2b7d84b541-disk3 192.168.1.10:3260,1 iqn.2001-05.com.target:0-4c76ca2b7db4b541-disk4 192.168.1.10:3260,1 iqn.2001-05.com.target:0-7346ca2b6d04b6bb-disk1 To view discovered nodes do ./iscsiadm -m node To login ./iscsiadm -m node -T iqn.2001-05.com.target:0-7346ca2b6d04b6bb-disk1 \ -I qla4xxx.00:0e:1e:04:87:fa -p 192.168.1.10:3260 -l An error or ok message is displayed to indicate login failure or success. To see the sessions use ./iscsiadm -m session And then to logout do ./iscsiadm -m node -T iqn.2001-05.com.target:0-7346ca2b6d04b6bb-disk1 \ -I qla4xxx.00:0e:1e:04:87:fa -p 192.168.1.10:3260 -u An error or a ok message is displayed to indicate logout failure or success. Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com> Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* iscsiadm: print kernel iface infoMike Christie2011-08-141-11/+109
| | | | | | | | | | | | This patch prints the kernel's iface info. iscsiadm -m host -P 2 iscsiadm -m host -H $N -P 2 will print out the kernel's iface info for the ifaces under all hosts or for specific hosts. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* iscsiadm: add netconfig supportLalit Chandivade2011-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Current status: Using iscsiadm one cannot do any network configuration for qla4xxx adapters. However an iface is created for the qla4xxx ports using the hwaddress. \# ls /etc/iscsi/ifaces/ iface.example iface0 qla4xxx.00:0e:1e:04:8b:2a qla4xxx.00:0e:1e:04:8b:2e This allows user to issue sendtargets via the qla4xxx iscsi offload. 2. Current Proposal: Current proposal is to allow iscsiadm to configure the network settings for qla4xxx ports. This implementation is based on discussions at - http://marc.info/?l=linux-scsi&m=127066184916180&w=2 - http://groups.google.com/group/open-iscsi/browse_thread/thread/d8e8c2df71c95d69/8f731d95d46141a0?lnk=gst&q=iscsi+hba# 2.1 Changes in iscsiadm/iscsid 2.1.1 Add a new event: ISCSI_UEVENT_SET_IFACE_PARAMS 2.1.2 New structure/enum to represent a single network parameter - enum iscsi_net_param; - struct iscsi_iface_param_info; 2.1.3 Added new parameters in iface 2.1.4 Change in operations Add two new operations to iscsiadm apply: Apply the single iface settings applyall: Apply the iface settings of all iface having the same MAC address 2.2 Changes in sysfs network representation The new sysfs directory would look like this:- /sys/class/iscsi_iface/-| _______________________| | |- ipv4-iface-<host_no>-<iface_no>/ <-- for ipv4 |- bootproto |- enabled |- ipaddress |- subnet |- gateway |- mtu |- port |- vlan |- vlan_enabled |- vlan_priority |- ipv6-iface-<host_no>-<iface_no>/ <-- for ipv6 |- enabled |- ipaddr_autocfg |- ipaddress |- link_local_addr |- linklocal_autocfg |- mtu |- port |- router_addr |- vlan |- vlan_enabled |- vlan_priority 3. Flow: 3.1 User space code: - If user specify --op=update, then just update the iface config file - If use specify --op=applyall then ifaces for the host passed in. and build up the net config buffer. - Note: If --op is "apply" then only settings for single iface is read, the iface provided with -I option is only read. - The net config buffer will look like this. ----------------------------------------------------------------| | iscsi_net_param { | | iface_num = 0; | | len = 4; | | param = ISCSI_NET_PARAM_IPV4_ADDR; | | iface_type = ISCSI_IFACE_TYPE_IPV4; | | param_type = ISCSI_NET_PARAM; | | value[0] = ipaddress[0]; | | value[1] = ipaddress[1]; | | value[2] = ipaddress[2]; | | value[3] = ipaddress[3]; | | } | ----------------------------------------------------------------| | iscsi_net_param { | | iface_num = 0; | | len = 4; | | param = ISCSI_NET_PARAM_IPV4_GW; | | iface_type = ISCSI_IFACE_TYPE_IPV4; | | param_type = ISCSI_NET_PARAM; | | value[0] = ipgateway[0]; | | value[1] = ipgateway[1]; | | value[2] = ipgateway[2]; | | value[3] = ipgateway[3]; | | } | ----------------------------------------------------------------- | | | iscsi_net_param { | | iface_num = 1; | | len = 4; | | param = ISCSI_NET_PARAM_IPV4_ADDR; | | iface_type = ISCSI_IFACE_TYPE_IPV4; | | param_type = ISCSI_NET_PARAM; | | value[0] = ipaddress[0]; | | value[1] = ipaddress[1]; | | value[2] = ipaddress[2]; | | value[3] = ipaddress[3]; | | } | ----------------------------------------------------------------- ----------------------------------------------------------------- | iscsi_net_param { | | iface_num = 0; | | len = 4; | | param = ISCSI_NET_PARAM_IPV4_GW; | | iface_type = ISCSI_IFACE_TYPE_IPV4; | | param_type = ISCSI_NET_PARAM; | | value[0] = ipgateway[0]; | | value[1] = ipgateway[1]; | | value[2] = ipgateway[2]; | | value[3] = ipgateway[3]; | | } | ----------------------------------------------------------------- | iscsi_net_param { | | iface_num = 1; | | len = 1; | | param = ISCSI_NET_PARAM_IFACE_ENABLED; | | iface_type = ISCSI_IFACE_TYPE_IPV4; | | param_type = ISCSI_NET_PARAM; | | offset = 0; | | value[0] = 0; /* 0 = disable, default = 1 = enable */ | | } | ----------------------------------------------------------------- Each netconfig parameter has different size requirement for value field. e.g.: IPv4 address requires 4 bytes, IPv6 address requires 16 bytes etc. The memory allocated for each netconfig parameter is size of iscsi_net_param + length required for that parameter. The multiple IO Vector mechanism is used to send netconfig parameter from user space to kernel using Netlink interface. IO Vector 0 is used for Netlink message header. IO Vector 1 is used for iSCSI User Event (ev). - The ev will be sent down with event type = ISCSI_UEVENT_SET_NET_CONFIG IO Vector 2 onwards, each vector consists of the struct iscsi_net_param with parameter name followed by its value. The total size will be addition of all the IO vector sizes. 3.2 Kernel space code: - Once event is received, the buffer will look like struct iscsi_net_param with parameter name followed by its value, then next parameter and its value and so on. - the scsi_transport_iscsi would call the adapter's transport->set_net_config - In set_net_config each individual param can be decoded and set into the hardware. 4. qla4xxx configuration: iscsid, creates the iface for qla4xxx, based on the hwaddress. To display the iface related to qla4xxx execute following \# iscsiadm -m iface qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty> qla4xxx.00:0e:1e:04:8b:2e.ipv6 qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<e mpty> qla4xxx.00:0e:1e:04:8b:2a qla4xxx,00:0e:1e:04:8b:2a,20.15.0.66,<empty>,<emp ty> qla4xxx.00:0e:1e:04:8b:2a.ipv6 qla4xxx,00:0e:1e:04:8b:2a,2001:DB8:1111:2222::8888,<empty>,<empty> qla4xxx.00:0e:1e:04:8b:2a.ipv6.1 qla4xxx,00:0e:1e:04:8b:2a,2001:DB8:4444:5555::9999,<empty>,<empty> To setup network configuration there can be two methods 4. 1. User can manually modify the iface file, and issue an "apply" command. --------------------------------------------------------------------------- \#cat /etc/iscsi/ifaces/ iface.example iface0 qla4xxx.00:0e:1e:04:8b:2a qla4xxx.00:0e:1e:04:8b:2e Example: \# cat qla4xxx.00:0e:1e:04:8b:2a iface.iscsi_ifacename = qla4xxx.00:0e:1e:04:8b:2a iface.transport_name = qla4xxx iface.hwaddress = 00:0e:1e:04:8b:2a iface.state = enable iface.iface_num = 0 (default) iface.bootproto = static iface.ipaddress = 192.168.2.2 (decimal) iface.subnetmask = 255.255.255.0 (decimal) \# vi qla4xxx.00:0e:1e:04:8b:2a.ipv6 (If file does not exist, the one can create it) iface.iscsi_ifacename = qla4xxx.00:0e:1e:04:8b:2a.ipv6 iface.transport_name = qla4xxx iface.hwaddress = 00:0e:1e:04:8b:2a iface.ipaddress = 1111:2222::7777:8888 (hex) iface.iface_num = 0 \# iscsiadm -m iface -H 00:0e:1e:04:8b:2a --op=applyall This will find the ifaces on the host with MAC address 00:0e:1e:04:8b:2a and apply the settings to the hardware.. Note, this will read all the iface belonging to the same MAC address. Note2, Instead of a MAC address the host number can be passed in. 4.2. User can use iscsiadm to specify the values and then apply -------------------------------------------------------------- \# ls /etc/iscsi/ifaces/ iface.example iface0 qla4xxx.00:0e:1e:04:8b:2a qla4xxx.00:0e:1e:04:8b:2e \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \ -n iface.ipaddress -v 192.168.1.2 \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \ -n iface.gateway -v 192.168.1.1 \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \ -n iface.subnet_mask -v 255.255.255.0 \# iscsiadm -m iface -H 00:0e:1e:04:8b:2a -o applyall Setting up multiple IP: First interface (default, no need to set iface_num, it is 0 by default) \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \ -n iface.ipaddress -v 192.168.1.2 Create the second one if it does not exist \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a.1 -op=new \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \ -n iface.iface_num -v 1 (Mandatory) \# iscsiadm -m iface -I qla4xxx.00:0e:1e:04:8b:2a -o update \ -n iface.ipaddress -v 192.168.1.3 \# iscsiadm -m iface -H 00:0e:1e:04:8b:2a --op=applyall Note: If there are common settings for multiple interfaces then the settings from 0th iface would be considered valid. Note: To apply settings for a single iface, just say --op=apply Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com> Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com> [formatting fixes and addition of host param for applyall] Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsi tools: Displaying timeout and CHAP in iscisadm infoRahul Gupta2011-08-081-4/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | I have analysed and coded on some part of it on this weekend :- For timeout and CHAP I have taken following parameters values from /sys and printed it. For integers, like timeout:- while fetching from sysfs_get_str(), I am setting timeouts to -1 for indicating error and also in qla card's case where chap is not supported in /sys, and then while printing, checking same value by taking its complement. I found in iscsid.conf file setting timeout value to -1 to huge -ve value is valid (as after setting that can restart iscsid successfully) but not really sure does user uses it. I assume user never uses -1 for timeout in iscsid.conf file, so I have used it in following code for error purpose:- Signed-off-by: Rahul Gupta <rahulrgupta27@gmail.com> iSCSI user space TODO item-2 : Displaying timeout and CHAP.
* iscsi tools: handle compile warnings about unused variablesMike Christie2011-08-021-4/+0
| | | | | path is not used in a couple functions in iscsi_sysfs.c, so remove it.
* iscsi tools: fix iname sysfs handlingMike Christie2011-08-021-0/+2
| | | | | | | The initiatorname is optional and not supported by some drivers, so it may not be set during some operations. This fixes iscsi_sysfs_read_iface to not return error when it cannot be read in.
* iscsi tools: fix bnx2i boot due to MAC mismatchMike Christie2011-04-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The problem is current bnx2i boot firmware has 2 modes. 1. hba mode - Will export the iscsi MAC in ibft. 2. non hba mode - Will export the network MAC in ibft. [In both modes there should be a sysfs link to the network netdev from the ibft ethernet dir] For #1 we want to create a session using bnx2i. For #2 we want to use software iscsi (we can only use software iscsi since we do not know the MAC for the offload card). This patch fixes a bug where we would create a iscsi session using the offload card if the netdev that is found through the ibft sysfs tree was managed by a net driver that has a iscsi offload driver. With this patch we now determine if we use the offload card during boot based on if the /sys/class/iscsi_host/hostX/hwaddres matches the one in iBFT. If it does, then we know the iBFT MAC is the iscsi one and use the offload driver. Note that cxgb*i always uses 1 MAC for both iscsi and offload. So for that driver we always use offload. To get the netdev we follow the sysfs ethernet link to the netdev like is done with bnx2i.
* iscsi tools: fix iscsiadm exit codesMike Christie2011-01-311-29/+36
| | | | | | | | | iscsiadm/iscsistart return a mix of type of returns codes. Sometimes -1 and sometimes a EXYZ type of error code. This patch has them return a ISCSI_ERR value. See iscsiadm man page EXIT STATUS section for error code definitions.
* Use pass through interface for sendtargets (take4) Currenly offload cards ↵Mike Christie2011-01-311-1/+6
| | | | | | | | | | | | | | | | | | like bnx2i, be2iscsi, cxgb3i must use a normal eth for discovery. This patch allows us to do discovery using the iscsi class passthrough interface. Note1 that the dirver must set the CAP_TEXT_NEGO setting, which might requires scsi-misc. Limitations of patch: - MaxRecvDataSegmentLength is limited to 8K for discovery sessions when offload is used. V3: - bug fixes from Eddie Wai to call start conn after we have logged in. Fixed set param not setting all settings. Misc cleanups. V4: - fix iscsistart segfault due to missing initialization.
* open-iscsi: add transport cxgb4iKaren Xie2010-10-171-1/+1
| | | | | | This patch added the new transport cxgb4i. Signed-off-by: Karen Xie <kxie@chelsio.com>
* iscsid: support discovery daemon auto logoutMike Christie2010-03-221-0/+2
| | | | | | With this patch, if the sendtargets or isns daemon detects that a target is no longer sent it will logout the session.
* iscsi tools: fix compile errorsMike Christie2010-01-151-0/+2
| | | | | On some distros iscsi_sysfs.c is failing to compile due to missing includes for lstat functionality.
* iscsi sysfs: fix compilation warning about unsigned long long castMike Christie2009-05-201-2/+2
| | | | | uint64_t can be unsigned long long or unsigned long depending on the arch. This just has us use sscanf with PRIu64 to read in our uint64_t.
* iscsiadm: add host modeMike Christie2009-05-101-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prints out the info for iSCSI hosts in the system. EXAMPLE ------- iscsiadm -m host cxgb3i: [9] 10.10.15.50,[00:07:43:05:97:07],eth3 <empty> $TRANSPORT: [$HOST_NO] $HOST_IP,[$MAC},$NETDEV $INITIATORNAME EXAMPLE --------- iscsiadm -m host -P 2 Host Number: 9 State: running Transport: cxgb3i Initiatorname: <empty> IPaddress: 10.10.15.50 HWaddress: 00:07:43:05:97:07 Netdev: eth3 ********* Sessions: ********* Target: iqn.2001-04.com.home:meanminna Current Portal: 10.10.15.10:3260,1 Persistent Portal: 10.10.15.10:3260,1 ********** Interface: ********** Iface Name: cxgb3i Iface Transport: cxgb3i Iface Initiatorname: iqn.2005-06.com.redhat:noisymax Iface IPaddress: 10.10.15.50 Iface HWaddress: 00:07:43:05:97:07 Iface Netdev: eth3 SID: 8 iSCSI Connection State: LOGGED IN iSCSI Session State: LOGGED_IN Internal iscsid Session State: NO CHANGE ********** Interface: ********** Iface Name: cxgb3i.def Iface Transport: cxgb3i Iface Initiatorname: iqn.2005-06.com.redhat:madmax Iface IPaddress: 10.10.15.50 Iface HWaddress: 00:07:43:05:97:07 Iface Netdev: eth3 SID: 9 iSCSI Connection State: LOGGED IN iSCSI Session State: LOGGED_IN Internal iscsid Session State: NO CHANGE
* iscsiadm: fix iscsiadm output when value is not setMike Christie2009-05-101-9/+3
| | | | | If a value is not set we are returning either defaut or unknown or <empty>. This unifies us to use <empty>.
* iscsid: set queue depthMike Christie2009-04-121-0/+16
| | | | This sets node.session.queue_depth for the session's devices.
* iscsi tools: convert from strncpy to strlcpyMike Christie2009-02-071-3/+3
| | | | This has us use a safer strlcpy instead of strncpy when we can.
* iscsid: update transport handleMike Christie2008-12-051-15/+30
| | | | | | | This updates the transport handle when we do the handle check, so if the module is unloaded we pick up the new value. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* iscsiadm: print session and session info running through ifaces in iface modeMike Christie2008-12-051-7/+9
| | | | | | | | | | | | | | | | | If you run iscsiadm -m iface -P 1 or iscsiadm -m iface -I $my_iface -P 1 we print the iface info and if possible the host number and state (only for offload hbas). The P2 level will print the session running through a iface. The P3 level will print the negotiated iscsi params for each session. The P4 level will print the scsi devices accessed through each session.
* iscsid/iscsiadm: support multiple inititor names per host.Mike Christie2008-12-051-6/+40
| | | | | | | | | | | | | | If bnx2i and cxgb3i do a scsi_host per host device, we need to add the iface initiator port settings on the session, so we can create multiple initiator ports (each with different inames) per device/scsi_host. The current iname reflects that qla4xxx can have one iname per hba, and we were allocating a host per session for software. The iname on the host will remain so we can export and set the hba level qla4xxx setting. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* userspace - setting interface ip addressKaren Xie2008-12-051-3/+3
| | | | | | | | | | | | | | | Enable setting of the ip/mac address for iscsi traffic on a network interface via iface files. The format of the iface files is: iface.transport_name = <transport name> iface.net_ifacename = <ethX> iface.ipaddress = <ip adress> iface.hwaddress = <mac adress> This patch is based on the master branch of the git tree. Signed-off-by: Karen Xie <kxie@chelsio.com> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* iscsiadm: fix output orderingMike Christie2008-11-261-28/+4
| | | | | | | | Commands that printed out records were mixing up the ordering. This just has us use alphasort since it is safe for things like uclibc and we do not really care about the alphabetical ordering and are more concerned with targets/portals that are alike being grouped together.
* ibft: add support to use iscsi_ibft module and log into all portals found in ↵Mike Christie2008-11-261-229/+125
| | | | | | | | | | | | | | | | | | | | | firmware This adds the ibft sysfs module (iscsi_ibft) parsing support. It was original done by Konard, but I have ported it to use the sysfs.c helpers (add new ones and ported iscsi_sysfs.c too). This patch also modifies iscsistart and iscsiadm to print/log into all the portals found in firmware. It also changes the behavior of iscsiadm -m discovery -t fw so that we create db records for what is found. It is not fully hooked into the iface code, so it will use the different inititor name, but it will not create a iface for it (this means that if you have a record for the same portal that is bound to a iface with a iname you can run into problems).
* remove sysfs_fileMike Christie2008-06-131-4/+1
| | | | We do not need sysfs_file, so remove it.
* Fix login redirect failure handling.Mike Christie2008-06-131-2/+1
| | | | | | | | If the login redirect fails, we currently retry forever. This was because initiator.c could not figure out how to best cleanup the mess. But now we do :) so this patch allows the initiator to either retry the reopen or fail.
* Fix transport_name compat support.Mike Christie2008-06-131-12/+13
| | | | | | | | This lists the default iface stuff as unstable and adds back support for node.transport_name and iface.transport_name. We will not merge Doran's patch for now because I just do not have time to deal with regressions., but I am adding in a hack to make sure we do not change the transport name while a session is running.
* Fix sysfs handling of block:sdX and scsi bus changesMike Christie2008-05-311-300/+512
| | | | | | | | This has us use the udev_sysfs code instead of hacking our own. There are two items that need future proofing: 1. handling of iscsi_session class device symlinks 2. scanning opens /sys/class/iscsi_* dir instead of doing a proper search like udev_sysfs.
* pass ep to session creationMike Christie2008-05-191-0/+40
| | | | | | | | | | bnx2i allocates a host per session and iser accesses the device so we need to pass them a the leading connection so they can find the hardware that is it bound to. This also has us call ep_disconnect before calling the stop conn callout, so these driver do not have to worry about stopping the receiving path.
* Revert Release-transport-entry-when-the-transport-is-unload.patchMike Christie2008-05-191-15/+0
| | | | | | | | | We do not need a new event to figure out that a transport is missing. We can just check before accessing the transport. This reverts the original patch. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* Release transport entry when the transport is unloadedMike Christie2008-04-261-0/+15
| | | | | | | | | | When iscsid detects a new transport (e.g. iscsi_tcp, ib_iser), it allocates an entry for it in the transport list. If the transport is unloaded and then reloaded, iscsid would still use the old transport entry. Therefore, the transport entry must be deleted when the transport is unloaded. Signed-off-by: Erez Zilber <erezz@voltaire.com>
* break up iface code and add default iser, tcp/default and bnx2i ifacesMike Christie2008-04-201-0/+1
| | | | | | | | | | This patch moves the iface code to iface.c/.h. It also adds some default ifaces for iser and bnx2i. Currently if those modules are loaded then we will bind to them along with default/tcp when discovery is run. The user can then set the startup flag or delete the record. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* rm num_transports from sysfs header.Mike Christie2008-04-201-1/+1
| | | | | | rm num_transports from sysfs header. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* rm db paramMike Christie2008-04-201-2/+2
| | | | | | | There is no need to pass the db to almost every function. Just allocate it as static in idbm.c. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* add ifacename support toolsMike Christie2008-04-201-87/+86
| | | | Set ifacename so we can look it back up on iscsid restart.
* use scsi host dir defineMike Christie2008-03-201-3/+4
| | | | Use a scsi host dir define.
* Fix connection cleanup when iscsid is restarted.Mike Christie2008-02-211-0/+24
| | | | | | | | | If iscsid is restarted while a session is running, then the session is logged out we are leaving the iscsi connection in the kernel. The reason for this is because conn->ksetup is not set during the sync up. Instead of that hacky bool we can just check the kernel if there is a connection setup by looking in sysfs.
* uclibc supportMike Christie2008-02-201-4/+28
| | | | | | | | | | | Bug report and Patch from From Natanael Copa: I'm trying to compile open-iscsi on uclibc to be able to use it on embedded linux. I found out that there are 3 functions that are used that are not implemented in uclibc: getifaddrs, freeifaddrs and versionsort. None of those are in POSIX afaik.
* iscsid: fix log closing on startup errorsMike Christie2007-12-201-3/+3
| | | | During start if we exited we did not close the logging proc.
* print kernel session stateMike Christie2007-12-121-0/+7
| | | | | | | | drivers like qla4xxx do not use iscsid's state machine (there sm is in hw), so iscsid cannot print the state of the session or connection. In the kernel we export the session state, so this patch has iscsiadm print it with the other state values when running iscsiadm -session -P 1.
* Have iscsiadm --rescan pick up device size changes.Mike Christie2007-07-301-4/+19
| | | | | | iscsiadm --rescan was only picking up new devices. This has it now also pick up whatever /sys/block/sdX/device/rescan can pick up along with new devices.
* This patch decouples the initiator name from iscsid. This is needed forMike Christie2007-07-251-2/+10
| | | | | | | | | qlogic support since it uses its own. And it is needed for ibft/OF boot. And it is needed for Volatires initiatorname virtualization idea. I did not do the support for the latter piece. I just did the basics for boot and qlogic. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* Fix iscsid sync up when node file is not present.Mike Christie2007-07-231-1/+1
| | | | | | Kernel returns <NULL> if some value is not set and in the previous patch to handle this we forgot to include the check for the newline when transferring patch to upstream.
* Fix iscsid sync when not using chap and no recordMike Christie2007-06-261-1/+1
| | | | | | | When chap is not used <NULL> is returned by the kernel. During resync if there is not record, then we try to use the kernel's current values. We then end up trying to negotiate with the NULL string.
* rm extra includesMike Christie2007-06-231-12/+0
| | | | the includes had been getting crufty. rm includes we do not need
* rm queue.c usageMike Christie2007-06-221-1/+0
| | | | Our use of the queue.c is broken and not needed so remove it.