diff options
-rw-r--r-- | include/iscsi_net_util.h | 1 | ||||
-rw-r--r-- | usr/iscsi_net_util.c | 17 |
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]; |