Package: open-iscsi / 2.0.874-3~deb9u1

bugfixes/move_offload_discovery_to_fw_get_targets.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Description: Move iscsistart offload discovery/setup to fw_get_targets()
Author: Andrew Patterson <andrew.patterson@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)