summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Make DB and ISCSIHOME directories configurable.Lee Duncan2022-03-251-1/+6
| | | | | | | | | | | | | | | | | | | | This commit adds two new top-level build options: one for the "home" directory for open-iscsi called "HOMEDIR", and one for the "database" directory, called "DBROOT". One can now override the defaults of "/etc/iscsi" for either or both of these directories on the make command line. The README and man pages are updated with details about these new options. Some Makefile cleanup/repair was done as well. Installation of the initiatorname.iscsi file, was moved out of the top-level Makefile into the etc subdirectory, and installation of man ages moved from the top-level Makefile to the doc subdirectory. Also, this fixes some issues from commit fd14dd8316b1 ("Clean p Makefile build system."), which incorrectly changed the DESTDIR ariable in the Makefiles. This current commit also fixes the top-level variable names for moving DBROOT and HOMEDIR.
* iscsid: add error code for req timeoutsiscsistart-fixesMike Christie2021-12-031-0/+2
| | | | | | | | ISCSI_ERR_SESSION_NOT_CONNECTED does not make sense to return when a request times out if the request is not for login. This adds a new error code. Signed-off-by: Mike Christie <michael.christie@oracle.com>
* Change iscsi IP type from defines to enum.Lee Duncan2021-09-011-2/+5
| | | | | | | This lets the compiler help us find errors, if any. Change the declaration and usage to match. Simplify the function that decides, while we are at it. Should be no functional change.
* Fix issue with zero-length arrays at end of structLee Duncan2020-06-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common practice in C coding, over the years, has been to add a zero-length array at the end of the structure when trying to represent a possibly-empty array of bytes that may be appended to the struct. But the gcc-10 compiler does not like such structures, taking the zero-length literally. The following errors are fixed by this commit: > iscsiadm.c: In function ‘session_stats’: > iscsiadm.c:939:56: error: array subscript ‘(<unknown>) + -1’ is outside the bounds of an interior zero-length array ‘struct iscsi_stats_custom[0]’ [-Werror=zero-length-bounds] > 939 | (unsigned long long)rsp.u.getstats.stats.custom[i].value); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ > In file included from initiator.h:29, > from iscsiadm.c:36: > ../include/iscsi_if.h:844:28: note: while referencing ‘custom’ > 844 | struct iscsi_stats_custom custom[0] > | ^~~~~~ > iscsiadm.c:938:56: error: array subscript ‘(<unknown>) + -1’ is outside the bounds of an interior zero-length array ‘struct iscsi_stats_custom[0]’ [-Werror=zero-length-bounds] > 938 | printf("\t%s: %llu\n", rsp.u.getstats.stats.custom[i].desc, > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ > In file included from initiator.h:29, > from iscsiadm.c:36: > ../include/iscsi_if.h:844:28: note: while referencing ‘custom’ > 844 | struct iscsi_stats_custom custom[0] > | ^~~~~~ > cc1: all warnings being treated as errors The work around is to convert the two "custom[0]" structure members to use "custom[]".
* Updates to support gcc -fno-common option.Lee Duncan2020-01-281-2/+4
| | | | | | This meant cleaning up the definition of some global variables, so that they were only defined in one place and refered to as external elsewhere.
* Create a new error for "target not connected".Lee Duncan2018-09-261-0/+2
| | | | | | | The session_logout_qtask() function now recognizes a new state of "target likely not connected" if syncing up, in connection wait state, and re-opening the connection.
* Keep iscsi_if in sync with kernel version.Lee Duncan2018-04-121-0/+10
| | | | | | | | Add in a new enum for iscsi_param and iscsi_err, and add a couple of new (higher) port speeds. Also added a note about having to keep this file in sync with the kernel version.
* Add in tracking IP prefix length, in addition to mask.Lee Duncan2018-01-181-0/+1
| | | | | The modern IP standard stresses the IP prefix length rather than the mask, so track the IP prefix length.
* Fix duplicate define of __bitwiseLee Duncan2017-12-021-0/+2
| | | | | | Gcc version 7.2.1 and linux glibc devel version 4.14 define __bitwise and does not need open-iscsi to do it, so check for define before doing it ourselves.
* iscsi_if.h: use attribute instead of '__packed'Khazhismel Kumykov2017-09-051-1/+1
| | | | | | More consistent, doesn't rely on __packed being defined in userspace. Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
* iscsiuio must be present to use hardware offload for bnx2{,x}Andrew Patterson2017-06-021-0/+1
| | | | | Check for the presence of /sbin/iscsiuio before using hardware offload for bnx2 and bnx2x devices.
* iscsistart: support booting over a VLANChris Leech2016-04-121-1/+2
| | | | | | | Adds code to check for VLAN devices if the boot configuration specifies a VLAN ID. Does not create VLANs, they need to already be in place.
* iscsiadm: fix parallel rescan handling of exit codesChris Leech2016-04-121-0/+2
| | | | | | | | | | | | | | | | | The parallel rescan patches work, in so much as the rescans happen, but if a target is specified the non-matching cases cause warning to be printed and a non-zero exit code. To reproduce: have more than one session to different targets, issue a node mode rescan command to one of them (-m node -T <iqn.target> -R). The problem is that while exit() takes an int, only the low byte is part of the exit code and it's combined with other exit status information. iscsiadm tries to use exit(-1) to indicate a non-match (not a fatal error). The value retrieved with wait() after an exit(-1) is actually 65280. Fix this by making use of the wait.h macros for checking the exit code.
* Make running actors event-drivenAndy Grover2015-01-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of waking up frequently to check if actors need to run, set an alarm for the first timeout and use a signalfd to get us out of poll() when the alarm expires and SIGALRM is sent. alarm(2) only has second granularity but we are using delayed actors for multi-second timeout handling so this is ok. All callsites were multiplying by 1000 for wait-in-msec, so just change actor_timer() callsites to pass timeout in seconds. Fold actor_check() into actor_poll(). Remove actor_timer_mod, not used. Rename actor_list to ready_list for clarity. Remove poll_list, no longer needed. Remove ACTOR_POLL_WAITING state, no longer needed. Add some more helpful macros to list.h. Based on earlier work by Chris Leech. Signed-off-by: Andy Grover <agrover@redhat.com>
* fwparam_ibft: Check iBFT target and NIC flagsHannes Reinecke2014-11-141-0/+2
| | | | | | | | Check the iBFT NIC and Target flags for valid boot. Since some adapters correctly set Bit 0 and others set Bit 1 for NICs, allow either value there. Signed-off-by: Lee Duncan <lduncan@suse.com>
* Represent DHCP "origin" as an enum, not a string.Hannes Reinecke2014-11-141-1/+10
| | | | | | | | | | | | | | | See IBFT standard for location of "origin" field in iBFT table, and see MS document: http://msdn.microsoft.com/en-us/library/aa366281.aspx for description of enums, duplicated here in part: typedef enum { IpPrefixOriginOther = 0, IpPrefixOriginManual, IpPrefixOriginWellKnown, IpPrefixOriginDhcp, IpPrefixOriginRouterAdvertisement, IpPrefixOriginUnchanged = 16 } IP_PREFIX_ORIGIN;
* Parse 'origin' value from iBFTHannes Reinecke2014-09-041-0/+1
| | | | | | | | | | | iBFT has an 'origin' field which indicates the origin of the network address. If that is set to '3' it indicates that DHCP has been used; there is no need to evaluate the 'dhcp' field here. In fact. latest iPXE sets the 'origin' field, but not the 'dhcp' field. Signed-off-by: Hannes Reinecke <hare@suse.de>
* iscsi_tool: Add offload host statistics support.Lalit Chandivade2013-12-221-2/+114
| | | | | Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsi_if.h: Additional parameters for network param settingsAdheer Chandravanshi2013-12-221-0/+79
| | | | | | | | | Added support to display and update additional network parameters through iscsiadm Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com> Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsi_if.h: Remove numbers used for network parameter settingsHarish Zunjarrao2013-12-221-19/+19
| | | | | | Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com> Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsiadm: Add support to set CHAP entry using host chap modeAdheer Chandravanshi2013-12-221-1/+18
| | | | | | | | | | Provide support to add and update CHAP entry using chap submode of iscsiadm host mode. Both, new and update, iscsiadm operations perform the same function. Currently only one entry can be added or updated at a time. Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* [PATCH v5 1/3] ISCSISTART: Saved ibft boot info to the sessionMike Christie2013-09-112-0/+4
| | | | | | | | | | | | | | | Patch and description from Eddie Wai: Three new session sysfs parameters are introduced: boot_root - holds the ibft boot root folder name boot_nic - holds the ibft boot ethernetN name boot_target - holds the ibft boot targetN name This patch copies over the /sys/firmware/<boot_root>/ethernetN/targetN info from the boot context to the node_rec. Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
* iscsi tools: sync iscsi_if.h with kernel spaceMike Christie2013-09-111-131/+73
| | | | | | | | | | | This patches syncs iscsi_if.h with upstream commit commit ae542edb11c79706cd74d7bd54ebd7702965a7f3 Author: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Date: Mon Jul 1 05:54:11 2013 -0400 [SCSI] scsi_transport_iscsi: Exporting new attrs for iscsi session and conne
* Fix discovery error return without return valueLee Duncan2013-06-261-0/+2
| | | | | | | | openSUSE Build Service compiler noticed that one discovery error path did not have a return value, so an appropriate error is now being returned. Signed-of-by: Lee Duncan <lduncan@suse.com>
* From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>Mike Christie2013-05-281-1/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This support lets the user manage the target entries in adapter flash and perform various operations like add, delete, login, logout, and update the target information. The sysfs entries will look as cited below: /sys/bus/iscsi_flashnode/devices/flashnode_sess-<host_no>:<flashnode_id>/<session attrs> /sys/bus/iscsi_flashnode/devices/flashnode_conn-<host_no>:<flashnode_id>:<conn_id>/<conn attrs> Operations using iscsiadm: ========================= List all target nodes stored in the FLASH of the adapter \# iscsiadm -m host -H hostno -C flashnode -o show View all parameters of one particular flash node \# iscsiadm -m host -H hostno -C flashnode -x <flashnode_idx> -o show Update an entry and commit to adapter FLASH \# iscsiadm -m host -H hostno -C flashnode -x <flashnode_idx> -n <name> -v <value> -o update Multiple name, value pairs can be specified in a single command for update operation Delete an entry \# iscsiadm -m host -H hostno -C flashnode -x <flashnode_idx> -o delete Create a new entry \# iscsiadm -m host -H hostno -C flashnode -o new -A <ipv4/ipv6> \# iscsiadm -m host -H hostno -C flashnode -x <flashnode_idx> -n <name> -v <value> -o update Example, create new entry: \#iscsiadm -m host -H 7 -C flashnode -o new -A ipv4 Flashnode index: 2 New flashnode for host7 added \#iscsiadm -m host -H 7 -C flashnode -o show qla4xxx: [0] 192.168.1.12:3260,2 iqn.2002-03.com.compellent:5000d310004b0716 qla4xxx: [1] 192.168.1.12:3260,2 qla4xxx: [2] Here - The newly created entry is at flashnode_idx 2, use it to update the entry \# iscsiadm -m host -H 7 -C flashnode -x 2 -o update flashnode.conn[0].ipaddress -v 192.168.1.13 \#iscsiadm -m host -H 7 -C flashnode -o show qla4xxx: [0] 192.168.1.12:3260,2 iqn.2002-03.com.compellent:5000d310004b0716 qla4xxx: [1] 192.168.1.12:3260,2 qla4xxx: [2] 192.168.1.13:3260,0 Login \# iscsiadm -m host -H hostno -C flashnode -x <flashnode_idx> -o login Logout \# iscsiadm -m host -H hostno -C flashnode -x <flashnode_idx> -o logout \# iscsiadm -m session -r sid -u Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* ISCSID: Added socket communication hooks for uipMike Christie2013-05-281-0/+2
| | | | | | | | | | | | | From Eddie Wai: This patch adds the communication path between iscsid->iscsiuio. It utilizes the set_net_config func ptr in the iscsi_transport_template to initiate the callbacks. Two new files are introduced: uip_mgmt_ipc.h and uip_mgmt_ipc.c Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
* iscsi tools: have iscsi tools bring up offload net ifaceMike Christie2012-03-221-0/+1
| | | | | | | bnx2i and cxgb*i need the network interface that the offload engine attaches to brought up before we can connect. This patch has the iscsi tools do this before trying to create a tcp/ip connection.
* iscsiadm: print ping status stringMike Christie2012-03-061-1/+16
| | | | When a ping fails print more useful info.
* iscsi tools: Add support to display a host's CHAP list and deleteMike Christie2012-03-062-1/+33
| | | | | | | | | | | | Drivers like qla4xxx store the CHAP info in a table that is managed at the host level. This patch allows you to see and delete the CHAP entries on the host. Patch from: Nilesh Javali <nilesh.javali@qlogic.com> [lots of bug fixes by Mike Christie] Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsi tools: added ping supportMike Christie2012-03-062-2/+21
| | | | | | | | | From: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Added ping support for network connection diagnostics. [cleaned up output by Mike Christie] Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsi tools: update iscsi_if.h for host eventMike Christie2012-03-061-1/+14
| | | | | | | Patch from: Vikas Chaudhary <vikas.chaudhary@qlogic.com> [added code to print link up/down message by Mike Christie] Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
* iscsi tools: fix ipv6 ibft/firmware bootMike Christie2011-10-121-7/+8
| | | | | | | The address buffers are too short for many ipv6 addresses and if ibft/firmware gives us a hostname. As a result iscsistart and iscsiadm were printing/getting a truncated address which would cause login and network startup to fail.
* iscsi tools: fix up vlan supportMike Christie2011-10-061-4/+5
| | | | | | | | | | | 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: manage qla4xxx iscsi sessions with iscsiadmLalit Chandivade2011-08-141-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: add netconfig supportLalit Chandivade2011-08-141-3/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: convert discovery code to iscsi error codesMike Christie2011-01-311-0/+4
| | | | | This just converts the iscsi discovery code to the iscsi_err.h error codes.
* iscsid: add new auth error codeMike Christie2011-01-311-0/+2
| | | | | | Add a new auth error code to make it easier for users to tell if it failed due to a auth error vs other target login error.
* iscsi tools: fix iscsiadm exit codesMike Christie2011-01-311-0/+63
| | | | | | | | | 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/+5
| | | | | | | | | | | | | | | | | | 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.
* iscsi boot: add support for iscsi boot sysfs moduleMike Christie2010-07-101-0/+2
| | | | | | This patch modifies the ibft sysfs code to support the iscsi boot sysfs module which is used by be2iscsi to export be2iscsi boot info.
* iscsid: support discovery daemon auto logoutMike Christie2010-03-221-0/+12
| | | | | | With this patch, if the sendtargets or isns daemon detects that a target is no longer sent it will logout the session.
* iscsi tools: use open-isns servicesMike Christie2010-03-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the native isns code with open-isns's libisns. I included the open-isns code in the open-iscsi tarball to make distribution easier since some distros use different isns clients and may not want to carry open-isns. This is based on open-isns commit 5e09f36d3446e41de0b8361601ffec4cd140d513. Changes in iSNS behavior/use: - To do discovery you must pass the ip and optionally the port to iscsiadm: iscsiadm -m discovery -t st -p 10.15.0.9 This command accepts the same ops as sendtargets so you can add/remove/update the node records that are created. It also supports ifaces properly now. - isns.address and isns.port in iscsid.conf are no longer used. - ESI is temporarily not supported. This will be fixed in the next patch when SCNs support is added. - The iscsiadm isns discovery command is not marked as stable. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
* iscsi tools: nic setup cleanupMike Christie2010-01-151-2/+4
| | | | | | This just breaks up the network part of the nic setup code to a new function that lives in the net utils code, so it can be used by other callers one day.
* ibft boot: do not setup nic if offload can be usedMike Christie2010-01-151-0/+1
| | | | | | If the nic has a iscsi offload function then do not set up the nic with the ibft net settings. We will use those values for the iscsi net settings.
* iscsi tools: merge functions to get net iface name from mac addressMike Christie2010-01-151-0/+8
| | | | | | There are 3 functions to get the net iface name from the mac address. This merges them into one function and moves it to a new file.
* ibft boot: mv setup nics to fw_entry.c so iscsiadm can use itMike Christie2010-01-131-0/+1
| | | | This just mvs setup_nics to fw_entry.c so iscsiadm can use it.
* iscsi mod: sync to linux-2.6-iscsi tree's 2.6.33 feature window patchesMike Christie2009-11-062-0/+53
| | | | | Sync kernel modules with what is being sent for the 2.6.33 feature window.
* iscsid: fix bound ep connect event numberMike Christie2009-05-131-3/+2
| | | | | | Fix bad merge. The bound ep connect event number should be 19. When transferring patches from the offload tree to head this got set to the wrong value.
* bind offloaded connection to portMike Christie2009-05-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we are using a offload card, then iface_set_param will match the iface info to a scsi_host and pass that info down to setup the net settings of the port (currently we just set the ip address). 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. Also how do you edit the routing table for the offload cards? You cannot use normal net tools like route can you? 3. If we set up hostA in the iface_set_param step, but then the routing info leads us to hostB, we are stuck. I did the attached patches to fix this. Basically we just pass down the scsi host we want to go through.
* iscsi tools: convert from strncat to strlcatMike Christie2009-02-071-0/+27
| | | | | We messed up strncat in so many different ways that strlat could fix. This patch converts the userspace uses of strncat to strlcat.