Package: open-iscsi / 2.0.874-3~deb9u1

bugfixes/need_iscsiuio_for_hardware_offload.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Description: iscsiuio must be present to use hardware offload for bnx2x
Author: Andrew Patterson <andrew.patterson@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,22 @@ int net_get_transport_name_from_netdev(c
 		goto close_sock;
 	}
 
+	/*
+	 * iSCSI hardware offload for bnx2{,x} is only supported if the
+	 * iscsiuio executable is available.
+	 */
+	if (!strcmp(drvinfo.driver, "bnx2x") ||
+	    !strcmp(drvinfo.driver, "bnx2")) {
+		struct stat buf;
+
+		if (stat(ISCSIUIO_PATH, &buf) < 0) {
+			log_debug(1, "ISCSI offload not supported "
+			             "(%s not found).", ISCSIUIO_PATH);
+			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];