Here is another set of patches to get boot from iSCSI working on debian with bnx2x devices. They are:
* Revert "Don't ignore offloading NICs in iscsistart." * Check for the presence of /sbin/iscsiuio before using hardware offload for bnx2x devices. * Move iscsistart offload discovery/setup to fw_get_targets() * Fix broken long command-line options in iscsiuio. I have tested these patches using bnx2x devices configured as both software initiators and using hardware offload. -- Andrew Patterson Hewlett-Packard Enterprise
>From 17b79c2a25a9ba5a105661f49bf435148ff30277 Mon Sep 17 00:00:00 2001 From: Andrew Patterson <andrew.patter...@hpe.com> Date: Tue, 17 Jan 2017 10:25:37 -0700 Subject: [PATCH 4/7] Revert "Don't ignore offloading NICs in iscsistart." This reverts commit 02c3051a7718dc26c71bd682da1f8d44358ffa96. --- .../iscsistart-offloading-interfaces.patch | 24 ---------------------- debian/patches/series | 1 - 2 files changed, 25 deletions(-) delete mode 100644 debian/patches/bugfixes/iscsistart-offloading-interfaces.patch diff --git a/debian/patches/bugfixes/iscsistart-offloading-interfaces.patch b/debian/patches/bugfixes/iscsistart-offloading-interfaces.patch deleted file mode 100644 index d9a383c..0000000 --- a/debian/patches/bugfixes/iscsistart-offloading-interfaces.patch +++ /dev/null @@ -1,24 +0,0 @@ -Description: Don't ignore offloading NICs in iscsistart -Author: Christian Seiler <christ...@iwakd.de> -Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4Gx3I/GUObdlVvCQAJ#!msg/open-iscsi/PsT65Z4Gx3I/GUObdlVvCQAJ -Bug-Debian: https://bugs.debian.org/850057 -Last-Update: 2017-01-04 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ ---- a/utils/fwparam_ibft/fw_entry.c -+++ b/utils/fwparam_ibft/fw_entry.c -@@ -65,10 +65,14 @@ int fw_setup_nics(void) - * to force iSCSI traffic through correct NIC - */ - list_for_each_entry(context, &targets, list) { -+ /* Debian: don't ignore offload NICs here, see Debian -+ * bug #850057 for details. */ -+#if 0 - /* if it is a offload nic ignore it */ - if (!net_get_transport_name_from_netdev(context->iface, - transport)) - continue; -+#endif - - if (iface_prev == NULL || strcmp(context->iface, iface_prev)) { - /* Note: test above works because there is a diff --git a/debian/patches/series b/debian/patches/series index a109715..6a2a532 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,4 +2,3 @@ bugfixes/no-make-clean-kernel.patch debian/var-run-lock.patch debian/dont-link-against-openssl.patch debian/udeb-without-libmount.patch -bugfixes/iscsistart-offloading-interfaces.patch -- 2.8.0.rc3
>From 1f6a5beb286a03fbba82da053f648f9c52c721c5 Mon Sep 17 00:00:00 2001 From: Andrew Patterson <andrew.patter...@hpe.com> Date: Thu, 19 Jan 2017 15:26:48 -0700 Subject: [PATCH 5/7] iscsiuio must be present to use hardware offload for bnx2x Check for the presence of /sbin/iscsiuio before using hardware offload for bnx2x devices. --- .../need_iscsiuio_for_hardware_offload.patch | 48 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 49 insertions(+) create mode 100644 debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch diff --git a/debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch b/debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch new file mode 100644 index 0000000..0bb0d57 --- /dev/null +++ b/debian/patches/bugfixes/need_iscsiuio_for_hardware_offload.patch @@ -0,0 +1,48 @@ +Description: iscsiuio must be present to use hardware offload for bnx2x +Author: Andrew Patterson <andrew.patter...@hpe.com> +Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4Gx3I/GUObdlVvCQAJ#!msg/open-iscsi/PsT65Z4Gx3I/GUObdlVvCQAJ +Bug-Debian: https://bugs.debian.org/850057 +Last-Update: 2017-01-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/include/iscsi_net_util.h ++++ b/include/iscsi_net_util.h +@@ -2,6 +2,7 @@ + #define __ISCSI_NET_UTIL_h__ + + #define ISCSI_HWADDRESS_BUF_SIZE 18 ++#define ISCSIUIO_PATH "/sbin/iscsiuio" + + extern int net_get_transport_name_from_netdev(char *netdev, char *transport); + extern int net_get_netdev_from_hwaddress(char *hwaddress, char *netdev); +--- a/usr/iscsi_net_util.c ++++ b/usr/iscsi_net_util.c +@@ -27,6 +27,7 @@ + #include <sys/socket.h> + #include <sys/ioctl.h> + #include <sys/socket.h> ++#include <sys/stat.h> + #include <linux/sockios.h> + #include <linux/if_vlan.h> + #include <net/if_arp.h> +@@ -81,6 +82,20 @@ + goto close_sock; + } + ++ /* ++ * iSCSI hardware offload for bnx2x is only supported if the ++ * iscsiuio executable is available. ++ */ ++ if (!strcmp(drvinfo.driver, "bnx2x")) { ++ struct stat buf; ++ ++ if (stat(ISCSIUIO_PATH, &buf)) { ++ log_debug(1, "ISCSI offload not supported."); ++ err = ENODEV; ++ goto close_sock; ++ } ++ } ++ + for (i = 0; net_drivers[i].net_drv_name != NULL; i++) { + struct iscsi_net_driver *net_driver = &net_drivers[i]; + diff --git a/debian/patches/series b/debian/patches/series index 6a2a532..b88a1f4 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ bugfixes/no-make-clean-kernel.patch debian/var-run-lock.patch debian/dont-link-against-openssl.patch debian/udeb-without-libmount.patch +bugfixes/need_iscsiuio_for_hardware_offload.patch -- 2.8.0.rc3
>From 011130234680e32a6c9a7c40f312983ee3d96907 Mon Sep 17 00:00:00 2001 From: Andrew Patterson <andrew.patter...@hpe.com> Date: Sun, 22 Jan 2017 19:21:20 -0700 Subject: [PATCH 6/7] Move iscsistart offload discovery/setup to fw_get_targets() Move iscsistart offload discovery/setup from dump_targets() (--fwparam_print) to fw_get_targets() (--fwparam_network). --- .../move_offload_discovery_to_fw_get_targets.patch | 91 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 92 insertions(+) create mode 100644 debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch diff --git a/debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch b/debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch new file mode 100644 index 0000000..135db12 --- /dev/null +++ b/debian/patches/bugfixes/move_offload_discovery_to_fw_get_targets.patch @@ -0,0 +1,91 @@ +Description: Move iscsistart offload discovery/setup to fw_get_targets() +Author: Andrew Patterson <andrew.patter...@hpe.com> +Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4$ +Bug-Debian: https://bugs.debian.org/850057 +Last-Update: 2017-01-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/utils/fwparam_ibft/fw_entry.c ++++ b/utils/fwparam_ibft/fw_entry.c +@@ -64,26 +64,40 @@ + * For each target in iBFT bring up required NIC and use routing + * to force iSCSI traffic through correct NIC + */ +- list_for_each_entry(context, &targets, list) { +- /* if it is a offload nic ignore it */ +- if (!net_get_transport_name_from_netdev(context->iface, +- transport)) +- continue; +- ++ list_for_each_entry(context, &targets, list) { + if (iface_prev == NULL || strcmp(context->iface, iface_prev)) { +- /* Note: test above works because there is a +- * maximum of two targets in the iBFT +- */ +- iface_prev = context->iface; +- needs_bringup = 1; ++ /* Note: test above works because there is a ++ * maximum of two targets in the iBFT ++ */ ++ iface_prev = context->iface; ++ needs_bringup = 1; + } ++ if (net_get_transport_name_from_netdev(context->iface, transport)) { ++ /* Setup software NIC, */ ++ printf("Setting up software interface %s\n", context->iface); ++ err = net_setup_netdev(context->iface, context->ipaddr, ++ context->mask, context->gateway, ++ context->vlan, ++ context->target_ipaddr, needs_bringup); ++ if (err) { ++ printf("Setting up software interface %s failed\n", ++ context->iface); ++ ret = err; ++ } ++ } else { ++ /* Setup offload NIC. */ ++ struct iface_rec iface; ++ ++ memset(&iface, 0, sizeof(iface)); ++ iface_setup_defaults(&iface); ++ printf("Setting up offload interface %s\n", context->iface); ++ if (!iface_setup_from_boot_context(&iface, context)) { ++ printf("Setting up offload interface %s failed\n", ++ context->iface); + +- err = net_setup_netdev(context->iface, context->ipaddr, +- context->mask, context->gateway, +- context->vlan, +- context->target_ipaddr, needs_bringup); +- if (err) +- ret = err; ++ ret = ISCSI_ERR; ++ } ++ } + } + + fw_free_targets(&targets); +@@ -147,11 +161,7 @@ + + static void dump_initiator(struct boot_context *context) + { +- struct iface_rec iface; +- +- memset(&iface, 0, sizeof(iface)); +- iface_setup_defaults(&iface); +- iface_setup_from_boot_context(&iface, context); ++ char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN]; + + if (strlen(context->initiatorname)) + printf("%s = %s\n", IFACE_INAME, context->initiatorname); +@@ -159,7 +169,9 @@ + if (strlen(context->isid)) + printf("%s = %s\n", IFACE_ISID, context->isid); + +- printf("%s = %s\n", IFACE_TRANSPORTNAME, iface.transport_name); ++ memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN); ++ if (!net_get_transport_name_from_netdev(context->iface, transport_name)) ++ printf("%s = %s\n", IFACE_TRANSPORTNAME, transport_name); + } + + static void dump_target(struct boot_context *context) diff --git a/debian/patches/series b/debian/patches/series index b88a1f4..1eb9014 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ debian/var-run-lock.patch debian/dont-link-against-openssl.patch debian/udeb-without-libmount.patch bugfixes/need_iscsiuio_for_hardware_offload.patch +bugfixes/move_offload_discovery_to_fw_get_targets.patch -- 2.8.0.rc3
>From ed2c6ce46254e79bab0df398d0d07aed9cfb4f7c Mon Sep 17 00:00:00 2001 From: Andrew Patterson <andrew.patter...@hpe.com> Date: Tue, 24 Jan 2017 15:21:55 -0700 Subject: [PATCH 7/7] Fix iscsiuio long options Fix broken long command-line options in iscsiuio. --- .../bugfixes/fix_iscsiuio_long_options.patch | 71 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 72 insertions(+) create mode 100644 debian/patches/bugfixes/fix_iscsiuio_long_options.patch diff --git a/debian/patches/bugfixes/fix_iscsiuio_long_options.patch b/debian/patches/bugfixes/fix_iscsiuio_long_options.patch new file mode 100644 index 0000000..6d01e4e --- /dev/null +++ b/debian/patches/bugfixes/fix_iscsiuio_long_options.patch @@ -0,0 +1,71 @@ +Description: Fix iscsiuio long options +Author: Andrew Patterson <andrew.patter...@hpe.com> +Bug: https://groups.google.com/forum/?_escaped_fragment_=msg/open-iscsi/PsT65Z4$ +Bug-Debian: https://bugs.debian.org/850057 +Last-Update: 2017-01-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/iscsiuio/src/unix/main.c ++++ b/iscsiuio/src/unix/main.c +@@ -82,10 +82,12 @@ + * Global Variables + ******************************************************************************/ + static const struct option long_options[] = { +- {"debug", 0, 0, 0}, +- {"version", 0, 0, 0}, +- {"help", 0, 0, 0}, +- {0, 0, 0, 0} ++ {"foreground", no_argument, NULL, 'f'}, ++ {"debug", required_argument, NULL, 'd'}, ++ {"pid", required_argument, NULL, 'p'}, ++ {"version", no_argument, NULL, 'v'}, ++ {"help", no_argument, NULL, 'h'}, ++ {NULL, no_argument, NULL, 0} + }; + + struct options opt = { +@@ -172,7 +174,7 @@ + printf("iscsiuio daemon.\n" + "-f, --foreground make the program run in the foreground\n" + "-d, --debug debuglevel print debugging information\n" +- "-p, --pid=pidfile use pid file (default %s).\n" ++ "-p, --pid pidfile use pid file (default %s).\n" + "-h, --help display this help and exit\n" + "-v, --version display version and exit\n", + default_pid_filepath); +--- a/iscsiuio/docs/iscsiuio.8 ++++ b/iscsiuio/docs/iscsiuio.8 +@@ -45,7 +45,7 @@ + .SH PARAMETERS + There are very few parameters when running this application. + .TP +-.BI -d <debug level> ++.BI -d|--debug <debug level> + This is to enable debug mode where debug messages will be sent to stdout + The following debug modes are supported + .P +@@ -61,20 +61,20 @@ + .PP + .TP + .TP +-.BI -f ++.BI -f|--foreground + This is to enable foreground mode so that this application doesn't get sent + into the background. + .PP + .TP +-.BI -v ++.BI -v|--version + This is to print the version. + .PP + .TP +-.BI -p <pidfile> ++.BI -p|--pid <pidfile> + Use pidfile (default /var/run/iscsiuio.pid ) + .PP + .TP +-.BI -h ++.BI -h|--help + Display this help and exit. + + diff --git a/debian/patches/series b/debian/patches/series index 1eb9014..fe8d47f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ debian/dont-link-against-openssl.patch debian/udeb-without-libmount.patch bugfixes/need_iscsiuio_for_hardware_offload.patch bugfixes/move_offload_discovery_to_fw_get_targets.patch +bugfixes/fix_iscsiuio_long_options.patch -- 2.8.0.rc3