ISCSISTART: Bring up the corresponding network interface for iboot

This is needed for the iSCSI offload boot.

Snip from M. Christie:
Note that we must bring up the interface before iface_setup_from_boot_context,
because we will want iscsi_sysfs_get_host_no_from_hwaddress to be able to match
a MAC to a iscsi host.  For some bnx2i cards, the card has to be ifupd for the
iscsi interface to have a MAC. If it is not ifupd we have seen MACs with all
zeros or no iscsi_hosts on different cards.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
ISCSID: Passing more net params from ibft to iface

Added the passing of the vlan_id, subnet_mask, and gateway attributes
from the ibft context to the iface struct for the connection request.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsi tools: Convert '-r' argument to an integer before checking if it is a path

If there is a file in the CWD named '1' and you were trying to run
'iscsiadm -m session -r 1 ...', the command would fail with "1 is not a
directory".

Root cause: The code that parses the -r option's argument tries lstat(2)
first, falling back to atoi(3) only if lstat fails.

This change inverts the order of checks, first with strtol(3) to see if
the argument given is a positive integer, then falling back to lstat(2)
only if it is not.

Signed-off-by: Jim Ramsay <jim_ramsay@dell.com>
Acked-by: Lee Duncan <lduncan@suse.com>
Update README for removal of DBM requirement

Removed in 093b1f4 (2006)

Signed-off-by: Andy Grover <agrover@redhat.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsi tools: fix get_random_bytes error handling

Bug report from Rahul:

There seems to be a bug in function get_random_bytes(). I reported
this earlier as well but somehow it didn't appear here.

get_random_bytes(unsigned char *data, unsigned int length)
{
	long r;
        unsigned n;
	int fd;

	fd = open("/dev/urandom", O_RDONLY);
        	while (length > 0) {

	if (!fd || read(fd, &r, sizeof(long)) != -1)      <<<< the condition is
incorrect

Acked-by: Lee Duncan <lduncan@suse.com>
A modified version of an upstream patch (commit d571cdfc0b3c):

>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>
Acked-by: Lee Duncan <lduncan@suse.com>
ISCSID: Modified the Makefile for iscsiuio compilation

This patch modifies the open-iscsi Makefile to include the compilation,
binary/manpage install, and clean of the iscsiuio source.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
ISCSID: Added iscsiuio source to the open-iscsi pkg

This patch adds the iscsiuio source files to the open-iscsi package.
iscsiuio version: 0.7.6.1g

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsid/iscsiadm: add support for emulex one connect storage

Add support for emulex one connect storage driver.

Acked-by: Lee Duncan <lduncan@suse.com>
ISCSIUIO: Updated iscsiuio to version 0.7.8.1b for perf optimization

uIP v0.7.8.1b (May 01, 2013)
=======================================================
   Enhancements
   ------------
   1. Change:  Performance optimization by caching the page size
      Impact:  All

   2. Change:  Fixed a bug in the tx completion interrupt handler
      Impact:  10G only

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsid: Fix strlen parameter

The target socket name is passed as parameter, don't use the hardwired
one.

Signed-off-by: Jan Vesely <jvesely@redhat.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsiuio: Change socket bind to use the same struct size as iscsid

Without this patch connections to iscsiuio fail, and strace prints:

connect(8, {sa_family=AF_FILE, path=@"ISCSID_UIP_ABSTRACT_NAMESPACE"}, 32) = -1 ECONNREFUSED (Connection refused)

Note that updating mgmt_ipc_listen and ipc_connect to use sizeof(addr) instead
of the precomputed values also fixes the issue.
Looks like "(Null bytes in the name have no special significance.)" [man 7 unix] is the culprit here.

Signed-off-by: Jan Vesely <jvesely@redhat.com>
Acked-by: Lee Duncan <lduncan@suse.com>
Make rescan run in parallel

Patch from Saggi Mizrahi:

This fixes a problem where a host which is inaccessible would block the
scan of other hosts in the system.

[compilation and minor cosmetic fixes by Mike Christie]
Signed-off-by: Saggi Mizrahi <smizrahi@redhat.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsi tools: sync iscsi_if.h with kernel space

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

Acked-by: Lee Duncan <lduncan@suse.com>
ISCSISTART: Saved ibft boot info to the session

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>
Acked-by: Lee Duncan <lduncan@suse.com>
ISCSID: Added the extraction of the session boot info

This patch does the work to extract the corresponding
<boot_root>->ethernetN net params as specified from the kernel
session boot_nic sysfs entry based on the transport param
use_boot_info.

This is only populated for iscsi_tcp and bnx2i.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
ISCSID: Added iface content override fix

Patch provided by Mike Christie.

This patch fixes the unconditional overwrite of the iface struct
even when the corresponding iface info from the node config was
found and extracted.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
iscsi tools: Bug fix on IPC address copy (version 2)

This patch merges Yufei Ren <yufei.ren@stonybrook.edu> patch
with comments from the list plus what I think is a bug in the
addr_len usage.

For the addr_len use, it looks like we were using that as the
arg to memcpy, but that value included the length of the pathname
string and also the offset of sun_path in the sockaddr_un and so
that is too long.

Acked-by: Lee Duncan <lduncan@suse.com>
ISCSIUIO: Added tx doorbell override mechanism

Added a new tx doorbell field in the uio path to work with new
bnx2x/cnic drivers that supports VF_RSS.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>
ISCSIUIO: Added fix for the iface.subnet_mask decoding for IPv6

Fixed a inet_pton decode error for the iface.subnet_mask for IPv6.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Lee Duncan <lduncan@suse.com>