summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAndrew Patterson <andrew.patterson@hpe.com>2017-05-31 09:44:49 -0600
committerAndrew Patterson <andrew.patterson@hpe.com>2017-06-02 09:25:31 -0600
commit3ae35d3ab24f774ba9e17c9a746520a035bc873a (patch)
treee52deb96f8ca1d32c10d7d2b319e21f8646a38d4 /utils
parentf780a822c3f42a5789933e27de0123b9c52c4cf3 (diff)
downloadopen-iscsi-3ae35d3ab24f774ba9e17c9a746520a035bc873a.tar.gz
iscsistart: move offload discovery/setup to fw_get_targets()
Move iscsistart offload discovery/setup from dump_targets() (--fwparam_print) to fw_get_targets() (--fwparam_network).
Diffstat (limited to 'utils')
-rw-r--r--utils/fwparam_ibft/fw_entry.c60
1 files changed, 36 insertions, 24 deletions
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c
index 0a1b46b..42d1a55 100644
--- a/utils/fwparam_ibft/fw_entry.c
+++ b/utils/fwparam_ibft/fw_entry.c
@@ -64,26 +64,40 @@ int fw_setup_nics(void)
* 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);
+
+ ret = ISCSI_ERR;
+ }
}
-
- err = net_setup_netdev(context->iface, context->ipaddr,
- context->mask, context->gateway,
- context->vlan,
- context->target_ipaddr, needs_bringup);
- if (err)
- ret = err;
}
fw_free_targets(&targets);
@@ -147,11 +161,7 @@ void fw_free_targets(struct list_head *list)
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 @@ static void dump_initiator(struct boot_context *context)
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)