summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Patterson <andrew.patterson@hpe.com>2017-05-31 09:40:32 -0600
committerAndrew Patterson <andrew.patterson@hpe.com>2017-06-02 09:25:31 -0600
commitf780a822c3f42a5789933e27de0123b9c52c4cf3 (patch)
tree70642f51c4d015c50fc9d158d193c099057494c0
parent9ab03b44b754bf9d72cb95e0b86361fbda6232c2 (diff)
downloadopen-iscsi-f780a822c3f42a5789933e27de0123b9c52c4cf3.tar.gz
iscsiuio must be present to use hardware offload for bnx2{,x}
Check for the presence of /sbin/iscsiuio before using hardware offload for bnx2 and bnx2x devices.
-rw-r--r--include/iscsi_net_util.h1
-rw-r--r--usr/iscsi_net_util.c17
2 files changed, 18 insertions, 0 deletions
diff --git a/include/iscsi_net_util.h b/include/iscsi_net_util.h
index cbf3637..16d48e3 100644
--- 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);
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c
index 06df9b3..6339082 100644
--- a/usr/iscsi_net_util.c
+++ b/usr/iscsi_net_util.c
@@ -25,6 +25,7 @@
#include <net/route.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/sockios.h>
@@ -81,6 +82,22 @@ int net_get_transport_name_from_netdev(char *netdev, char *transport)
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)) {
+ 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];