[Pkg-iscsi-maintainers] [SCM] Debian Open-iSCSI Packaging branch, upstream-mnc, updated. 2.0-872-193-gde2c0e7
Mike Christie
michaelc at cs.wisc.edu
Sat Apr 7 15:44:09 UTC 2012
The following commit has been merged in the upstream-mnc branch:
commit f7d12fb72514952fa16608ccded046fbf6955ac8
Author: Mike Christie <michaelc at cs.wisc.edu>
Date: Sat Mar 10 04:22:41 2012 -0600
iscsi tools: have iscsiadm load offload modules
This has iscsiadm load the offload modules that do not
have pci tables (bnx2i, cxgb3i, cxgb4i) when
iscsiadm -m iface
is run.
diff --git a/usr/iface.c b/usr/iface.c
index 1d346ff..3afa273 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -532,6 +532,8 @@ void iface_setup_host_bindings(void)
}
idbm_unlock();
+ transport_probe_for_offload();
+
if (iscsi_sysfs_for_each_host(NULL, &nr_found,
__iface_setup_host_bindings))
log_error("Could not scan scsi hosts. HW/OFFLOAD iscsi "
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c
index e801b48..7edc0b9 100644
--- a/usr/iscsi_net_util.c
+++ b/usr/iscsi_net_util.c
@@ -39,12 +39,10 @@ struct iscsi_net_driver {
};
static struct iscsi_net_driver net_drivers[] = {
-#ifdef OFFLOAD_BOOT_SUPPORTED
{"cxgb3", "cxgb3i" },
{"cxgb4", "cxgb4i" },
{"bnx2", "bnx2i" },
{"bnx2x", "bnx2i"},
-#endif
{NULL, NULL}
};
@@ -74,7 +72,7 @@ int net_get_transport_name_from_netdev(char *netdev, char *transport)
ifr.ifr_data = (caddr_t)&drvinfo;
err = ioctl(fd, SIOCETHTOOL, &ifr);
if (err < 0) {
- log_error("Could not get driver.");
+ log_error("Could not get driver %s.", netdev);
err = errno;
goto close_sock;
}
diff --git a/usr/transport.c b/usr/transport.c
index b435537..04c7493 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -20,7 +20,11 @@
#include <unistd.h>
#include <errno.h>
#include <libkmod.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include "sysdeps.h"
#include "iscsi_err.h"
#include "initiator.h"
#include "transport.h"
@@ -100,6 +104,52 @@ static struct iscsi_transport_template *iscsi_transport_templates[] = {
NULL
};
+int transport_probe_for_offload(void)
+{
+ struct if_nameindex *ifni;
+ char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN];
+ int i, sockfd;
+ struct ifreq if_hwaddr;
+
+ ifni = if_nameindex();
+ if (!ifni) {
+ log_error("Could not search for transport modules: %s",
+ strerror(errno));
+ return ISCSI_ERR_TRANS_NOT_FOUND;
+ }
+
+ sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (sockfd < 0) {
+ log_error("Could not open socket for ioctl: %s",
+ strerror(errno));
+ goto free_ifni;
+ }
+
+ for (i = 0; ifni[i].if_index && ifni[i].if_name; i++) {
+ struct if_nameindex *n = &ifni[i];
+
+ log_debug(6, "kmod probe found %s\n", n->if_name);
+
+ strlcpy(if_hwaddr.ifr_name, n->if_name, IFNAMSIZ);
+ if (ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr) < 0)
+ continue;
+
+ /* check for ARPHRD_ETHER (ethernet) */
+ if (if_hwaddr.ifr_hwaddr.sa_family != 1)
+ continue;
+
+ if (net_get_transport_name_from_netdev(n->if_name,
+ transport_name))
+ continue;
+
+ transport_load_kmod(transport_name);
+ }
+
+free_ifni:
+ if_freenameindex(ifni);
+ return 0;
+}
+
int transport_load_kmod(char *transport_name)
{
struct kmod_ctx *ctx;
diff --git a/usr/transport.h b/usr/transport.h
index 4c46587..672561b 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -49,5 +49,6 @@ struct iscsi_transport {
extern int set_transport_template(struct iscsi_transport *t);
extern int transport_load_kmod(char *transport_name);
+extern int transport_probe_for_offload(void);
#endif
--
Debian Open-iSCSI Packaging
More information about the Pkg-iscsi-maintainers
mailing list