author | Peter Dunlap <Peter.Dunlap@Sun.COM> |
Tue, 24 Mar 2009 17:50:49 -0600 | |
changeset 9162 | b011b0287065 |
parent 8488 | c882253f3351 |
child 9201 | d1e93b2ab63d |
permissions | -rw-r--r-- |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2 |
* CDDL HEADER START |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
3 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
7 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
11 |
* and limitations under the License. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
12 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
18 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
19 |
* CDDL HEADER END |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
20 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
21 |
/* |
8488
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
22 |
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
23 |
* Use is subject to license terms. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
24 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
25 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
26 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
27 |
* ISCSID -- |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
28 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
29 |
* Discovery of targets and access to the persistent storage starts here. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
30 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
31 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
32 |
#include <sys/thread.h> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
33 |
#include <sys/types.h> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
34 |
#include <sys/proc.h> /* declares: p0 */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
35 |
#include <sys/cmn_err.h> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
36 |
#include <sys/scsi/adapters/iscsi_if.h> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
37 |
#include <netinet/in.h> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
38 |
#include "iscsi_targetparam.h" |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
39 |
#include "isns_client.h" |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
40 |
#include "isns_protocol.h" |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
41 |
#include "persistent.h" |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
42 |
#include "iscsi.h" |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
43 |
#include <sys/ethernet.h> |
8194 | 44 |
#include <sys/bootprops.h> |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
45 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
46 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
47 |
* local function prototypes |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
48 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
49 |
static boolean_t iscsid_init_config(iscsi_hba_t *ihp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
50 |
static boolean_t iscsid_init_targets(iscsi_hba_t *ihp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
51 |
static void iscsid_thread_static(iscsi_thread_t *thread, void *p); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
52 |
static void iscsid_thread_sendtgts(iscsi_thread_t *thread, void *p); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
53 |
static void iscsid_thread_isns(iscsi_thread_t *thread, void *p); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
54 |
static void iscsid_thread_slp(iscsi_thread_t *thread, void *p); |
8194 | 55 |
static void iscsid_thread_boot_wd(iscsi_thread_t *thread, void *p); |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
56 |
static void iscsid_threads_create(iscsi_hba_t *ihp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
57 |
static void iscsid_threads_destroy(void); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
58 |
static int iscsid_copyto_param_set(uint32_t param_id, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
59 |
iscsi_login_params_t *params, iscsi_param_set_t *ipsp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
60 |
static void iscsid_add_pg_list_to_cache(iscsi_hba_t *ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
61 |
isns_portal_group_list_t *pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
62 |
static void iscsid_set_default_initiator_node_settings(iscsi_hba_t *ihp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
63 |
static void iscsid_remove_target_param(char *name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
64 |
static boolean_t iscsid_add(iscsi_hba_t *ihp, iSCSIDiscoveryMethod_t method, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
65 |
struct sockaddr *addr_dsc, char *target_name, int tpgt, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
66 |
struct sockaddr *addr_tgt); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
67 |
static void iscsi_discovery_event(iscsi_hba_t *ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
68 |
iSCSIDiscoveryMethod_t m, boolean_t start); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
69 |
static void iscsi_send_sysevent(iscsi_hba_t *ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
70 |
char *subclass, nvlist_t *np); |
8194 | 71 |
static boolean_t iscsid_boot_init_config(iscsi_hba_t *ihp); |
72 |
static iscsi_sess_t *iscsi_add_boot_sess(iscsi_hba_t *ihp, int isid); |
|
73 |
static boolean_t iscsid_make_entry(ib_boot_prop_t *boot_prop_entry, |
|
74 |
entry_t *entry); |
|
75 |
||
76 |
extern int modrootloaded; |
|
77 |
int iscsi_configroot_retry = 20; |
|
78 |
static boolean_t iscsi_configroot_printed = FALSE; |
|
9162
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
79 |
static int iscsi_net_up = 0; |
8194 | 80 |
extern ib_boot_prop_t *iscsiboot_prop; |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
81 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
82 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
83 |
* iSCSI target discovery thread table |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
84 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
85 |
typedef struct iscsid_thr_table { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
86 |
void (*func_start)(iscsi_thread_t *, void *); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
87 |
iscsi_thread_t *thr_id; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
88 |
iSCSIDiscoveryMethod_t method; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
89 |
char *name; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
90 |
} iscsid_thr_table; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
91 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
92 |
static iscsid_thr_table iscsid_thr[] = { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
93 |
{ iscsid_thread_static, NULL, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
94 |
iSCSIDiscoveryMethodStatic, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
95 |
"Static" }, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
96 |
{ iscsid_thread_sendtgts, NULL, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
97 |
iSCSIDiscoveryMethodSendTargets, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
98 |
"SendTarget" }, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
99 |
{ iscsid_thread_slp, NULL, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
100 |
iSCSIDiscoveryMethodSLP, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
101 |
"SLP" }, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
102 |
{ iscsid_thread_isns, NULL, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
103 |
iSCSIDiscoveryMethodISNS, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
104 |
"iSNS" }, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
105 |
{ NULL, NULL, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
106 |
iSCSIDiscoveryMethodUnknown, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
107 |
NULL } |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
108 |
}; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
109 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
110 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
111 |
* discovery method event table |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
112 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
113 |
iSCSIDiscoveryMethod_t for_failure[] = { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
114 |
iSCSIDiscoveryMethodStatic, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
115 |
iSCSIDiscoveryMethodSLP, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
116 |
iSCSIDiscoveryMethodISNS, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
117 |
iSCSIDiscoveryMethodSendTargets, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
118 |
iSCSIDiscoveryMethodUnknown /* terminating value */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
119 |
}; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
120 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
121 |
/* |
8194 | 122 |
* The following private tunable, set in /etc/system, e.g., |
123 |
* set iscsi:iscsi_boot_max_delay = 360 |
|
124 |
* , provides with customer a max wait time in |
|
125 |
* seconds to wait for boot lun online during iscsi boot. |
|
126 |
* Defaults to 180s. |
|
127 |
*/ |
|
128 |
int iscsi_boot_max_delay = ISCSI_BOOT_DEFAULT_MAX_DELAY; |
|
129 |
||
130 |
/* |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
131 |
* discovery configuration semaphore |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
132 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
133 |
ksema_t iscsid_config_semaphore; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
134 |
|
8194 | 135 |
static iscsi_thread_t *iscsi_boot_wd_handle = NULL; |
136 |
||
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
137 |
#define CHECK_METHOD(v) ((dm & v) ? B_TRUE : B_FALSE) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
138 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
139 |
/* |
8194 | 140 |
* Check if IP is valid |
141 |
*/ |
|
142 |
static boolean_t |
|
143 |
iscsid_ip_check(char *ip) |
|
144 |
{ |
|
145 |
int i = 0; |
|
146 |
||
147 |
if (!ip) |
|
148 |
return (B_FALSE); |
|
149 |
for (; (ip[i] == 0) && (i < IB_IP_BUFLEN); i++) {} |
|
150 |
if (i == IB_IP_BUFLEN) { |
|
151 |
/* invalid IP address */ |
|
152 |
return (B_FALSE); |
|
153 |
} |
|
154 |
return (B_TRUE); |
|
155 |
} |
|
156 |
||
157 |
/* |
|
158 |
* Make an entry for the boot target. |
|
159 |
* return B_TRUE upon success |
|
160 |
* B_FALSE if fail |
|
161 |
*/ |
|
162 |
static boolean_t |
|
163 |
iscsid_make_entry(ib_boot_prop_t *boot_prop_entry, entry_t *entry) |
|
164 |
{ |
|
165 |
if (entry == NULL || boot_prop_entry == NULL) { |
|
166 |
return (B_FALSE); |
|
167 |
} |
|
168 |
||
169 |
if (!iscsid_ip_check( |
|
170 |
(char *)&boot_prop_entry->boot_tgt.tgt_ip_u)) |
|
171 |
return (B_FALSE); |
|
172 |
||
173 |
if (boot_prop_entry->boot_tgt.sin_family != AF_INET && |
|
174 |
boot_prop_entry->boot_tgt.sin_family != AF_INET6) |
|
175 |
return (B_FALSE); |
|
176 |
||
177 |
entry->e_vers = ISCSI_INTERFACE_VERSION; |
|
178 |
||
179 |
mutex_enter(&iscsi_oid_mutex); |
|
180 |
entry->e_oid = iscsi_oid++; |
|
181 |
mutex_exit(&iscsi_oid_mutex); |
|
182 |
||
183 |
entry->e_tpgt = ISCSI_DEFAULT_TPGT; |
|
184 |
||
185 |
if (boot_prop_entry->boot_tgt.sin_family == AF_INET) { |
|
186 |
entry->e_u.u_in4.s_addr = |
|
187 |
boot_prop_entry->boot_tgt.tgt_ip_u.u_in4.s_addr; |
|
188 |
entry->e_insize = sizeof (struct in_addr); |
|
189 |
} else { |
|
190 |
(void) bcopy( |
|
191 |
&boot_prop_entry->boot_tgt.tgt_ip_u.u_in6.s6_addr, |
|
192 |
entry->e_u.u_in6.s6_addr, 16); |
|
193 |
entry->e_insize = sizeof (struct in6_addr); |
|
194 |
} |
|
195 |
||
196 |
entry->e_port = boot_prop_entry->boot_tgt.tgt_port; |
|
197 |
entry->e_boot = B_TRUE; |
|
198 |
return (B_TRUE); |
|
199 |
} |
|
200 |
||
201 |
/* |
|
202 |
* Create the boot session |
|
203 |
*/ |
|
204 |
static void |
|
205 |
iscsi_boot_session_create(iscsi_hba_t *ihp, |
|
206 |
ib_boot_prop_t *boot_prop_table) |
|
207 |
{ |
|
208 |
iSCSIDiscoveryMethod_t dm; |
|
209 |
entry_t e; |
|
210 |
iscsi_sockaddr_t addr_dsc; |
|
211 |
||
212 |
if (ihp == NULL || boot_prop_table == NULL) { |
|
213 |
return; |
|
214 |
} |
|
215 |
||
216 |
if (!iscsid_ip_check( |
|
217 |
(char *)&boot_prop_table->boot_tgt.tgt_ip_u)) { |
|
218 |
return; |
|
219 |
} |
|
220 |
||
221 |
if (boot_prop_table->boot_tgt.tgt_name != NULL) { |
|
222 |
dm = iSCSIDiscoveryMethodStatic | |
|
223 |
iSCSIDiscoveryMethodBoot; |
|
224 |
if (!iscsid_make_entry(boot_prop_table, &e)) |
|
225 |
return; |
|
226 |
iscsid_addr_to_sockaddr(e.e_insize, &e.e_u, |
|
227 |
e.e_port, &addr_dsc.sin); |
|
228 |
||
229 |
(void) iscsid_add(ihp, dm, &addr_dsc.sin, |
|
230 |
(char *)boot_prop_table->boot_tgt.tgt_name, |
|
231 |
e.e_tpgt, &addr_dsc.sin); |
|
232 |
} else { |
|
233 |
dm = iSCSIDiscoveryMethodSendTargets | |
|
234 |
iSCSIDiscoveryMethodBoot; |
|
235 |
if (!iscsid_make_entry(boot_prop_table, &e)) |
|
236 |
return; |
|
237 |
iscsid_addr_to_sockaddr(e.e_insize, &e.e_u, |
|
238 |
e.e_port, &addr_dsc.sin); |
|
239 |
iscsid_do_sendtgts(&e); |
|
240 |
(void) iscsid_login_tgt(ihp, NULL, dm, |
|
241 |
&addr_dsc.sin); |
|
242 |
} |
|
243 |
} |
|
244 |
||
245 |
/* |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
246 |
* iscsid_init -- load data from persistent storage and start discovery threads |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
247 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
248 |
* If restart is B_TRUE than someone has issued an ISCSI_DB_RELOAD ioctl. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
249 |
* The most likely reason is that a new database has been copied into |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
250 |
* /etc/iscsi and the driver needs to read the contents. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
251 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
252 |
boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
253 |
iscsid_init(iscsi_hba_t *ihp, boolean_t restart) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
254 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
255 |
boolean_t rval = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
256 |
iSCSIDiscoveryMethod_t dm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
257 |
iSCSIDiscoveryMethod_t *fdm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
258 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
259 |
sema_init(&iscsid_config_semaphore, 1, NULL, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
260 |
SEMA_DRIVER, NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
261 |
|
8194 | 262 |
if (iscsiboot_prop) { |
263 |
if (ihp->persistent_loaded) { |
|
264 |
rval = persistent_init(B_TRUE); |
|
265 |
} else { |
|
266 |
rval = persistent_init(B_FALSE); |
|
267 |
if (rval) |
|
268 |
ihp->persistent_loaded = B_TRUE; |
|
269 |
} |
|
270 |
} else { |
|
271 |
rval = persistent_init(restart); |
|
272 |
if (restart == B_FALSE) { |
|
273 |
ihp->persistent_loaded = B_TRUE; |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
274 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
275 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
276 |
|
8194 | 277 |
if ((modrootloaded == 0) && (iscsiboot_prop != NULL) && rval) { |
278 |
if (!iscsid_boot_init_config(ihp)) { |
|
279 |
rval = B_FALSE; |
|
280 |
} else { |
|
281 |
iscsi_boot_session_create(ihp, iscsiboot_prop); |
|
282 |
iscsi_boot_wd_handle = |
|
283 |
iscsi_thread_create(ihp->hba_dip, |
|
284 |
"BootWD", iscsid_thread_boot_wd, ihp); |
|
285 |
if (iscsi_boot_wd_handle) { |
|
286 |
rval = iscsi_thread_start( |
|
287 |
iscsi_boot_wd_handle); |
|
288 |
} else { |
|
289 |
rval = B_FALSE; |
|
290 |
} |
|
291 |
} |
|
292 |
if (!rval) { |
|
293 |
cmn_err(CE_NOTE, "Initializaton of iscsi initiator" |
|
294 |
" partially failed"); |
|
295 |
} |
|
296 |
} else { |
|
297 |
if (rval == B_TRUE) { |
|
298 |
rval = iscsid_init_config(ihp); |
|
299 |
if (rval == B_TRUE) { |
|
300 |
rval = iscsid_init_targets(ihp); |
|
301 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
302 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
303 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
304 |
if (rval == B_TRUE) { |
8194 | 305 |
if (restart == B_FALSE) { |
306 |
iscsid_threads_create(ihp); |
|
307 |
} |
|
308 |
||
309 |
dm = persistent_disc_meth_get(); |
|
310 |
rval = iscsid_enable_discovery(ihp, dm, B_FALSE); |
|
311 |
if (rval == B_TRUE) { |
|
312 |
rval = iscsid_disable_discovery(ihp, ~dm); |
|
313 |
} |
|
314 |
||
315 |
} |
|
316 |
if (rval == B_FALSE) { |
|
317 |
/* |
|
318 |
* In case of failure the events still need to be sent |
|
319 |
* because the door daemon will pause until all these |
|
320 |
* events have occurred. |
|
321 |
*/ |
|
322 |
for (fdm = &for_failure[0]; *fdm != |
|
323 |
iSCSIDiscoveryMethodUnknown; fdm++) { |
|
324 |
/* ---- Send both start and end events ---- */ |
|
325 |
iscsi_discovery_event(ihp, *fdm, B_TRUE); |
|
326 |
iscsi_discovery_event(ihp, *fdm, B_FALSE); |
|
327 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
328 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
329 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
330 |
return (rval); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
331 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
332 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
333 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
334 |
* iscsid_fini -- do whatever is required to clean up |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
335 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
336 |
/* ARGSUSED */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
337 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
338 |
iscsid_fini() |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
339 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
340 |
iscsid_threads_destroy(); |
8194 | 341 |
if (iscsi_boot_wd_handle != NULL) { |
342 |
iscsi_thread_destroy(iscsi_boot_wd_handle); |
|
343 |
iscsi_boot_wd_handle = NULL; |
|
344 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
345 |
persistent_fini(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
346 |
sema_destroy(&iscsid_config_semaphore); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
347 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
348 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
349 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
350 |
* iscsid_props -- returns discovery thread information, used by ioctl code |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
351 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
352 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
353 |
iscsid_props(iSCSIDiscoveryProperties_t *props) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
354 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
355 |
iSCSIDiscoveryMethod_t dm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
356 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
357 |
dm = persistent_disc_meth_get(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
358 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
359 |
props->vers = ISCSI_INTERFACE_VERSION; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
360 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
361 |
/* ---- change once thread is implemented ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
362 |
props->iSNSDiscoverySettable = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
363 |
props->SLPDiscoverySettable = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
364 |
props->StaticDiscoverySettable = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
365 |
props->SendTargetsDiscoverySettable = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
366 |
props->iSNSDiscoveryMethod = iSNSDiscoveryMethodStatic; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
367 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
368 |
props->iSNSDiscoveryEnabled = CHECK_METHOD(iSCSIDiscoveryMethodISNS); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
369 |
props->StaticDiscoveryEnabled = |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
370 |
CHECK_METHOD(iSCSIDiscoveryMethodStatic); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
371 |
props->SendTargetsDiscoveryEnabled = |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
372 |
CHECK_METHOD(iSCSIDiscoveryMethodSendTargets); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
373 |
props->SLPDiscoveryEnabled = CHECK_METHOD(iSCSIDiscoveryMethodSLP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
374 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
375 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
376 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
377 |
* iscsid_enable_discovery - start specified discovery methods |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
378 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
379 |
/* ARGSUSED */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
380 |
boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
381 |
iscsid_enable_discovery(iscsi_hba_t *ihp, iSCSIDiscoveryMethod_t idm, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
382 |
boolean_t poke) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
383 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
384 |
boolean_t rval = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
385 |
iscsid_thr_table *dt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
386 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
387 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
388 |
* start the specified discovery method(s) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
389 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
390 |
for (dt = &iscsid_thr[0]; dt->method != iSCSIDiscoveryMethodUnknown; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
391 |
dt++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
392 |
if (idm & dt->method) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
393 |
if (dt->thr_id != NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
394 |
rval = iscsi_thread_start(dt->thr_id); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
395 |
if (rval == B_FALSE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
396 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
397 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
398 |
if (poke == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
399 |
iscsi_thread_send_wakeup(dt->thr_id); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
400 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
401 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
402 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
403 |
* unexpected condition. The threads for each |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
404 |
* discovery method should have started at |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
405 |
* initialization |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
406 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
407 |
ASSERT(B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
408 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
409 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
410 |
} /* END for() */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
411 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
412 |
return (rval); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
413 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
414 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
415 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
416 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
417 |
* iscsid_disable_discovery - stop specified discovery methods |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
418 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
419 |
boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
420 |
iscsid_disable_discovery(iscsi_hba_t *ihp, iSCSIDiscoveryMethod_t idm) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
421 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
422 |
boolean_t rval = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
423 |
iscsid_thr_table *dt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
424 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
425 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
426 |
* stop the specified discovery method(s) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
427 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
428 |
for (dt = &iscsid_thr[0]; dt->method != iSCSIDiscoveryMethodUnknown; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
429 |
dt++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
430 |
if (idm & dt->method) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
431 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
432 |
/* signal discovery event change - begin */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
433 |
iscsi_discovery_event(ihp, dt->method, B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
434 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
435 |
/* Attempt to logout of all associated targets */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
436 |
rval = iscsid_del(ihp, NULL, dt->method, NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
437 |
if (rval == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
438 |
/* Successfully logged out of targets */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
439 |
if (dt->thr_id != NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
440 |
rval = iscsi_thread_stop(dt->thr_id); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
441 |
if (rval == B_FALSE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
442 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
443 |
* signal discovery |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
444 |
* event change - end |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
445 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
446 |
iscsi_discovery_event(ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
447 |
dt->method, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
448 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
449 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
450 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
451 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
452 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
453 |
* unexpected condition. The threads |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
454 |
* for each discovery method should |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
455 |
* have started at initialization |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
456 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
457 |
ASSERT(B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
458 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
459 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
460 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
461 |
/* signal discovery event change - end */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
462 |
iscsi_discovery_event(ihp, dt->method, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
463 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
464 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
465 |
} /* END for() */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
466 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
467 |
return (rval); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
468 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
469 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
470 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
471 |
* iscsid_poke_discovery - wakeup discovery methods to find any new targets |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
472 |
* and wait for all discovery processes to complete. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
473 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
474 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
475 |
iscsid_poke_discovery(iscsi_hba_t *ihp, iSCSIDiscoveryMethod_t method) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
476 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
477 |
#define ISCSI_DISCOVERY_DELAY 1 |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
478 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
479 |
iSCSIDiscoveryMethod_t dm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
480 |
iscsid_thr_table *dt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
481 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
482 |
ASSERT(ihp != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
483 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
484 |
/* reset discovery flags */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
485 |
mutex_enter(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
486 |
ihp->hba_discovery_in_progress = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
487 |
ihp->hba_discovery_events = iSCSIDiscoveryMethodUnknown; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
488 |
mutex_exit(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
489 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
490 |
/* start all enabled discovery methods */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
491 |
dm = persistent_disc_meth_get(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
492 |
for (dt = &iscsid_thr[0]; dt->method != iSCSIDiscoveryMethodUnknown; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
493 |
dt++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
494 |
if ((method == iSCSIDiscoveryMethodUnknown) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
495 |
(method == dt->method)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
496 |
if ((dm & dt->method) && (dt->thr_id != NULL)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
497 |
iscsi_thread_send_wakeup(dt->thr_id); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
498 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
499 |
iscsi_discovery_event(ihp, dt->method, B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
500 |
iscsi_discovery_event(ihp, dt->method, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
501 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
502 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
503 |
iscsi_discovery_event(ihp, dt->method, B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
504 |
iscsi_discovery_event(ihp, dt->method, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
505 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
506 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
507 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
508 |
mutex_enter(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
509 |
while (ihp->hba_discovery_events != ISCSI_ALL_DISCOVERY_METHODS) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
510 |
mutex_exit(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
511 |
delay(SEC_TO_TICK(ISCSI_DISCOVERY_DELAY)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
512 |
mutex_enter(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
513 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
514 |
ihp->hba_discovery_in_progress = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
515 |
mutex_exit(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
516 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
517 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
518 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
519 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
520 |
* iscsid_do_sendtgts - issue send targets command to the given discovery |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
521 |
* address and then add the discovered targets to the discovery queue |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
522 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
523 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
524 |
iscsid_do_sendtgts(entry_t *disc_addr) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
525 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
526 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
527 |
#define SENDTGTS_DEFAULT_NUM_TARGETS 10 |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
528 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
529 |
int stl_sz; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
530 |
int stl_num_tgts = SENDTGTS_DEFAULT_NUM_TARGETS; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
531 |
iscsi_sendtgts_list_t *stl_hdr = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
532 |
boolean_t retry = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
533 |
char inp_buf[INET6_ADDRSTRLEN]; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
534 |
const char *ip; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
535 |
int ctr; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
536 |
int rc; |
8194 | 537 |
iscsi_hba_t *ihp; |
538 |
iSCSIDiscoveryMethod_t dm = iSCSIDiscoveryMethodSendTargets; |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
539 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
540 |
/* allocate and initialize sendtargets list header */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
541 |
stl_sz = sizeof (*stl_hdr) + ((stl_num_tgts - 1) * |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
542 |
sizeof (iscsi_sendtgts_entry_t)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
543 |
stl_hdr = kmem_zalloc(stl_sz, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
544 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
545 |
retry_sendtgts: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
546 |
stl_hdr->stl_in_cnt = stl_num_tgts; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
547 |
bcopy(disc_addr, &(stl_hdr->stl_entry), |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
548 |
sizeof (stl_hdr->stl_entry)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
549 |
stl_hdr->stl_entry.e_vers = ISCSI_INTERFACE_VERSION; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
550 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
551 |
/* lock interface so only one SendTargets operation occurs */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
552 |
if ((ihp = (iscsi_hba_t *)ddi_get_soft_state(iscsi_state, 0)) == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
553 |
cmn_err(CE_NOTE, "!iscsi discovery failure - SendTargets. " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
554 |
"failure to get soft state"); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
555 |
kmem_free(stl_hdr, stl_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
556 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
557 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
558 |
sema_p(&ihp->hba_sendtgts_semaphore); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
559 |
rc = iscsi_ioctl_sendtgts_get(ihp, stl_hdr); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
560 |
sema_v(&ihp->hba_sendtgts_semaphore); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
561 |
if (rc) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
562 |
ip = inet_ntop((disc_addr->e_insize == |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
563 |
sizeof (struct in_addr) ? AF_INET : AF_INET6), |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
564 |
&disc_addr->e_u, inp_buf, sizeof (inp_buf)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
565 |
cmn_err(CE_NOTE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
566 |
"iscsi discovery failure - SendTargets (%s)\n", ip); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
567 |
kmem_free(stl_hdr, stl_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
568 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
569 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
570 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
571 |
/* check if all targets received */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
572 |
if (stl_hdr->stl_in_cnt < stl_hdr->stl_out_cnt) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
573 |
if (retry == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
574 |
stl_num_tgts = stl_hdr->stl_out_cnt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
575 |
kmem_free(stl_hdr, stl_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
576 |
stl_sz = sizeof (*stl_hdr) + |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
577 |
((stl_num_tgts - 1) * |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
578 |
sizeof (iscsi_sendtgts_entry_t)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
579 |
stl_hdr = kmem_zalloc(stl_sz, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
580 |
retry = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
581 |
goto retry_sendtgts; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
582 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
583 |
ip = inet_ntop((disc_addr->e_insize == |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
584 |
sizeof (struct in_addr) ? |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
585 |
AF_INET : AF_INET6), &disc_addr->e_u, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
586 |
inp_buf, sizeof (inp_buf)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
587 |
cmn_err(CE_NOTE, "iscsi discovery failure - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
588 |
"SendTargets overflow (%s)\n", ip); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
589 |
kmem_free(stl_hdr, stl_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
590 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
591 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
592 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
593 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
594 |
for (ctr = 0; ctr < stl_hdr->stl_out_cnt; ctr++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
595 |
iscsi_sockaddr_t addr_dsc; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
596 |
iscsi_sockaddr_t addr_tgt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
597 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
598 |
iscsid_addr_to_sockaddr(disc_addr->e_insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
599 |
&disc_addr->e_u, disc_addr->e_port, &addr_dsc.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
600 |
iscsid_addr_to_sockaddr( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
601 |
stl_hdr->stl_list[ctr].ste_ipaddr.a_addr.i_insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
602 |
&(stl_hdr->stl_list[ctr].ste_ipaddr.a_addr.i_addr), |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
603 |
stl_hdr->stl_list[ctr].ste_ipaddr.a_port, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
604 |
&addr_tgt.sin); |
8194 | 605 |
if (disc_addr->e_boot == B_TRUE) { |
606 |
dm = dm | iSCSIDiscoveryMethodBoot; |
|
607 |
} |
|
608 |
(void) iscsid_add(ihp, dm, |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
609 |
&addr_dsc.sin, (char *)stl_hdr->stl_list[ctr].ste_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
610 |
stl_hdr->stl_list[ctr].ste_tpgt, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
611 |
&addr_tgt.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
612 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
613 |
kmem_free(stl_hdr, stl_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
614 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
615 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
616 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
617 |
iscsid_do_isns_query_one_server(iscsi_hba_t *ihp, entry_t *isns_server) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
618 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
619 |
int pg_sz, query_status; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
620 |
iscsi_addr_t *ap; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
621 |
isns_portal_group_list_t *pg_list; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
622 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
623 |
ap = (iscsi_addr_t *)kmem_zalloc(sizeof (iscsi_addr_t), KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
624 |
ap->a_port = isns_server->e_port; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
625 |
ap->a_addr.i_insize = isns_server->e_insize; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
626 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
627 |
if (isns_server->e_insize == sizeof (struct in_addr)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
628 |
ap->a_addr.i_addr.in4.s_addr = (isns_server->e_u.u_in4.s_addr); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
629 |
} else if (isns_server->e_insize == sizeof (struct in6_addr)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
630 |
bcopy(&(isns_server->e_u.u_in6.s6_addr), |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
631 |
ap->a_addr.i_addr.in6.s6_addr, 16); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
632 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
633 |
kmem_free(ap, sizeof (iscsi_addr_t)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
634 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
635 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
636 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
637 |
pg_list = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
638 |
query_status = isns_query_one_server( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
639 |
ap, ihp->hba_isid, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
640 |
ihp->hba_name, ihp->hba_alias, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
641 |
ISNS_INITIATOR_NODE_TYPE, &pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
642 |
kmem_free(ap, sizeof (iscsi_addr_t)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
643 |
if (query_status != isns_ok || pg_list == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
644 |
DTRACE_PROBE1(iscsid_do_isns_query_one_server_status, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
645 |
int, query_status); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
646 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
647 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
648 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
649 |
iscsid_add_pg_list_to_cache(ihp, pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
650 |
pg_sz = sizeof (isns_portal_group_list_t); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
651 |
if (pg_list->pg_out_cnt > 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
652 |
pg_sz += (pg_list->pg_out_cnt - 1) * |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
653 |
sizeof (isns_portal_group_t); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
654 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
655 |
kmem_free(pg_list, pg_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
656 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
657 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
658 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
659 |
iscsid_do_isns_query(iscsi_hba_t *ihp) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
660 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
661 |
int pg_sz, query_status; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
662 |
isns_portal_group_list_t *pg_list; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
663 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
664 |
pg_list = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
665 |
query_status = isns_query(ihp->hba_isid, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
666 |
ihp->hba_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
667 |
ihp->hba_alias, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
668 |
ISNS_INITIATOR_NODE_TYPE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
669 |
&pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
670 |
if ((query_status != isns_ok && |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
671 |
query_status != isns_op_partially_failed) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
672 |
pg_list == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
673 |
DTRACE_PROBE1(iscsid_do_isns_query_status, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
674 |
int, query_status); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
675 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
676 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
677 |
iscsid_add_pg_list_to_cache(ihp, pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
678 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
679 |
pg_sz = sizeof (isns_portal_group_list_t); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
680 |
if (pg_list->pg_out_cnt > 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
681 |
pg_sz += (pg_list->pg_out_cnt - 1) * |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
682 |
sizeof (isns_portal_group_t); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
683 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
684 |
kmem_free(pg_list, pg_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
685 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
686 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
687 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
688 |
* iscsid_config_one - for the given target name, attempt |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
689 |
* to login to all targets associated with name. If target |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
690 |
* name is not found in discovery queue, reset the discovery |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
691 |
* queue, kick the discovery processes, and then retry. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
692 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
693 |
* NOTE: The caller of this function must hold the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
694 |
* iscsid_config_semaphore across this call. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
695 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
696 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
697 |
iscsid_config_one(iscsi_hba_t *ihp, char *name, boolean_t protect) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
698 |
{ |
8194 | 699 |
boolean_t rc = B_FALSE; |
700 |
int retry = 0; |
|
701 |
int lun_online = 0; |
|
702 |
int cur_sec = 0; |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
703 |
|
8194 | 704 |
if (!modrootloaded && (iscsiboot_prop != NULL)) { |
705 |
if (!iscsi_configroot_printed) { |
|
706 |
cmn_err(CE_NOTE, "Configuring" |
|
707 |
" iSCSI boot session..."); |
|
708 |
iscsi_configroot_printed = B_TRUE; |
|
709 |
} |
|
9162
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
710 |
if (iscsi_net_up == 0) { |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
711 |
if (iscsi_net_interface() == ISCSI_STATUS_SUCCESS) { |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
712 |
iscsi_net_up = 1; |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
713 |
} else { |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
714 |
cmn_err(CE_WARN, "Failed to configure interface" |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
715 |
" for iSCSI boot session"); |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
716 |
return; |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
717 |
} |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
718 |
} |
8194 | 719 |
while (rc == B_FALSE && retry < |
720 |
iscsi_configroot_retry) { |
|
721 |
rc = iscsid_login_tgt(ihp, name, |
|
722 |
iSCSIDiscoveryMethodBoot, NULL); |
|
723 |
if (rc == B_FALSE) { |
|
724 |
/* |
|
725 |
* create boot session |
|
726 |
*/ |
|
727 |
iscsi_boot_session_create(ihp, |
|
728 |
iscsiboot_prop); |
|
729 |
} else { |
|
730 |
/* |
|
731 |
* The boot session has been created, if |
|
732 |
* the target lun has not been online, |
|
733 |
* we should wait here for a while |
|
734 |
*/ |
|
735 |
do { |
|
736 |
lun_online = |
|
737 |
iscsiboot_prop->boot_tgt.lun_online; |
|
738 |
if (lun_online == 0) { |
|
739 |
delay(SEC_TO_TICK(1)); |
|
740 |
cur_sec++; |
|
741 |
} |
|
742 |
} while ((lun_online == 0) && |
|
743 |
(cur_sec < iscsi_boot_max_delay)); |
|
744 |
} |
|
745 |
retry++; |
|
746 |
} |
|
747 |
if (!rc) { |
|
748 |
cmn_err(CE_WARN, "Failed to configure iSCSI" |
|
749 |
" boot session"); |
|
750 |
} |
|
751 |
} else { |
|
752 |
rc = iscsid_login_tgt(ihp, name, iSCSIDiscoveryMethodUnknown, |
|
753 |
NULL); |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
754 |
/* |
8194 | 755 |
* If we didn't login to the device we might have |
756 |
* to update our discovery information and attempt |
|
757 |
* the login again. |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
758 |
*/ |
8194 | 759 |
if (rc == B_FALSE) { |
760 |
/* |
|
761 |
* Stale /dev links can cause us to get floods |
|
762 |
* of config requests. Prevent these repeated |
|
763 |
* requests from causing unneeded discovery updates |
|
764 |
* if ISCSI_CONFIG_STORM_PROTECT is set. |
|
765 |
*/ |
|
766 |
if ((protect == B_FALSE) || |
|
767 |
(ddi_get_lbolt() > ihp->hba_config_lbolt + |
|
768 |
SEC_TO_TICK(ihp->hba_config_storm_delay))) { |
|
769 |
ihp->hba_config_lbolt = ddi_get_lbolt(); |
|
770 |
iscsid_poke_discovery(ihp, |
|
771 |
iSCSIDiscoveryMethodUnknown); |
|
772 |
(void) iscsid_login_tgt(ihp, name, |
|
773 |
iSCSIDiscoveryMethodUnknown, NULL); |
|
774 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
775 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
776 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
777 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
778 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
779 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
780 |
* iscsid_config_all - reset the discovery queue, kick the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
781 |
* discovery processes, and login to all targets found |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
782 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
783 |
* NOTE: The caller of this function must hold the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
784 |
* iscsid_config_semaphore across this call. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
785 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
786 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
787 |
iscsid_config_all(iscsi_hba_t *ihp, boolean_t protect) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
788 |
{ |
8194 | 789 |
boolean_t rc = B_FALSE; |
790 |
int retry = 0; |
|
791 |
int lun_online = 0; |
|
792 |
int cur_sec = 0; |
|
793 |
||
794 |
if (!modrootloaded && iscsiboot_prop != NULL) { |
|
795 |
if (!iscsi_configroot_printed) { |
|
796 |
cmn_err(CE_NOTE, "Configuring" |
|
797 |
" iSCSI boot session..."); |
|
798 |
iscsi_configroot_printed = B_TRUE; |
|
799 |
} |
|
9162
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
800 |
if (iscsi_net_up == 0) { |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
801 |
if (iscsi_net_interface() == ISCSI_STATUS_SUCCESS) { |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
802 |
iscsi_net_up = 1; |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
803 |
} |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
804 |
} |
8194 | 805 |
while (rc == B_FALSE && retry < |
806 |
iscsi_configroot_retry) { |
|
807 |
rc = iscsid_login_tgt(ihp, NULL, |
|
808 |
iSCSIDiscoveryMethodBoot, NULL); |
|
809 |
if (rc == B_FALSE) { |
|
810 |
/* |
|
811 |
* No boot session has been created. |
|
812 |
* We would like to create the boot |
|
813 |
* Session first. |
|
814 |
*/ |
|
815 |
iscsi_boot_session_create(ihp, |
|
816 |
iscsiboot_prop); |
|
817 |
} else { |
|
818 |
/* |
|
819 |
* The boot session has been created, if |
|
820 |
* the target lun has not been online, |
|
821 |
* we should wait here for a while |
|
822 |
*/ |
|
823 |
do { |
|
824 |
lun_online = |
|
825 |
iscsiboot_prop->boot_tgt.lun_online; |
|
826 |
if (lun_online == 0) { |
|
827 |
delay(SEC_TO_TICK(1)); |
|
828 |
cur_sec++; |
|
829 |
} |
|
830 |
} while ((lun_online == 0) && |
|
831 |
(cur_sec < iscsi_boot_max_delay)); |
|
832 |
} |
|
833 |
retry++; |
|
834 |
} |
|
835 |
if (!rc) { |
|
836 |
cmn_err(CE_WARN, "Failed to configure" |
|
837 |
" boot session"); |
|
838 |
} |
|
839 |
} else { |
|
840 |
/* |
|
841 |
* Stale /dev links can cause us to get floods |
|
842 |
* of config requests. Prevent these repeated |
|
843 |
* requests from causing unneeded discovery updates |
|
844 |
* if ISCSI_CONFIG_STORM_PROTECT is set. |
|
845 |
*/ |
|
846 |
if ((protect == B_FALSE) || |
|
847 |
(ddi_get_lbolt() > ihp->hba_config_lbolt + |
|
848 |
SEC_TO_TICK(ihp->hba_config_storm_delay))) { |
|
849 |
ihp->hba_config_lbolt = ddi_get_lbolt(); |
|
850 |
iscsid_poke_discovery(ihp, |
|
851 |
iSCSIDiscoveryMethodUnknown); |
|
852 |
} |
|
853 |
(void) iscsid_login_tgt(ihp, NULL, |
|
854 |
iSCSIDiscoveryMethodUnknown, NULL); |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
855 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
856 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
857 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
858 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
859 |
* isns_scn_callback - iSNS client received an SCN |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
860 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
861 |
* This code processes the iSNS client SCN events. These |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
862 |
* could relate to the addition, removal, or update of a |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
863 |
* logical unit. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
864 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
865 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
866 |
isns_scn_callback(void *arg) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
867 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
868 |
int i, pg_sz; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
869 |
int qry_status; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
870 |
isns_portal_group_list_t *pg_list; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
871 |
uint32_t scn_type; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
872 |
iscsi_hba_t *ihp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
873 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
874 |
if (arg == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
875 |
/* No argument */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
876 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
877 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
878 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
879 |
if ((ihp = (iscsi_hba_t *)ddi_get_soft_state(iscsi_state, 0)) == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
880 |
return; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
881 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
882 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
883 |
scn_type = ((isns_scn_callback_arg_t *)arg)->scn_type; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
884 |
DTRACE_PROBE1(isns_scn_callback_scn_type, int, scn_type); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
885 |
switch (scn_type) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
886 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
887 |
* ISNS_OBJ_ADDED - An object has been added. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
888 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
889 |
case ISNS_OBJ_ADDED: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
890 |
/* Query iSNS server for contact information */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
891 |
pg_list = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
892 |
qry_status = isns_query_one_node( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
893 |
((isns_scn_callback_arg_t *)arg)->source_key_attr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
894 |
ihp->hba_isid, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
895 |
ihp->hba_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
896 |
(uint8_t *)"", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
897 |
ISNS_INITIATOR_NODE_TYPE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
898 |
&pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
899 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
900 |
/* Verify portal group is found */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
901 |
if ((qry_status != isns_ok && |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
902 |
qry_status != isns_op_partially_failed) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
903 |
pg_list == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
904 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
905 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
906 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
907 |
DTRACE_PROBE1(pg_list, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
908 |
isns_portal_group_list_t *, pg_list); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
909 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
910 |
/* Add all portals for logical unit to discovery cache */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
911 |
for (i = 0; i < pg_list->pg_out_cnt; i++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
912 |
iscsi_sockaddr_t addr_dsc; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
913 |
iscsi_sockaddr_t addr_tgt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
914 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
915 |
iscsid_addr_to_sockaddr( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
916 |
pg_list->pg_list[i].isns_server_ip.i_insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
917 |
&pg_list->pg_list[i].isns_server_ip.i_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
918 |
pg_list->pg_list[i].isns_server_port, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
919 |
&addr_dsc.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
920 |
iscsid_addr_to_sockaddr(pg_list->pg_list[i].insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
921 |
&pg_list->pg_list[i].pg_ip_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
922 |
pg_list->pg_list[i].pg_port, &addr_tgt.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
923 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
924 |
(void) iscsid_add(ihp, iSCSIDiscoveryMethodISNS, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
925 |
&addr_dsc.sin, (char *)pg_list->pg_list[i]. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
926 |
pg_iscsi_name, pg_list->pg_list[i].pg_tag, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
927 |
&addr_tgt.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
928 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
929 |
/* Force target to login */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
930 |
(void) iscsid_login_tgt(ihp, (char *)pg_list-> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
931 |
pg_list[i].pg_iscsi_name, iSCSIDiscoveryMethodISNS, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
932 |
NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
933 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
934 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
935 |
if (pg_list != NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
936 |
pg_sz = sizeof (isns_portal_group_list_t); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
937 |
if (pg_list->pg_out_cnt > 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
938 |
pg_sz += (pg_list->pg_out_cnt - 1) * |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
939 |
sizeof (isns_portal_group_t); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
940 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
941 |
kmem_free(pg_list, pg_sz); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
942 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
943 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
944 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
945 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
946 |
* ISNS_OBJ_REMOVED - logical unit has been removed |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
947 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
948 |
case ISNS_OBJ_REMOVED: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
949 |
if (iscsid_del(ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
950 |
(char *)((isns_scn_callback_arg_t *)arg)-> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
951 |
source_key_attr, iSCSIDiscoveryMethodISNS, NULL) != |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
952 |
B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
953 |
cmn_err(CE_NOTE, "iscsi initiator - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
954 |
"isns remove scn failed for target %s\n", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
955 |
(char *)((isns_scn_callback_arg_t *)arg)-> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
956 |
source_key_attr); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
957 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
958 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
959 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
960 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
961 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
962 |
* ISNS_OBJ_UPDATED - logical unit has changed |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
963 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
964 |
case ISNS_OBJ_UPDATED: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
965 |
cmn_err(CE_NOTE, "iscsi initiator - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
966 |
"received iSNS update SCN for %s\n", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
967 |
(char *)((isns_scn_callback_arg_t *)arg)-> |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
968 |
source_key_attr); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
969 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
970 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
971 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
972 |
* ISNS_OBJ_UNKNOWN - |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
973 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
974 |
default: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
975 |
cmn_err(CE_NOTE, "iscsi initiator - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
976 |
"received unknown iSNS SCN type 0x%x\n", scn_type); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
977 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
978 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
979 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
980 |
kmem_free(arg, sizeof (isns_scn_callback_arg_t)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
981 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
982 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
983 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
984 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
985 |
* iscsid_add - Creates discovered session and connection |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
986 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
987 |
static boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
988 |
iscsid_add(iscsi_hba_t *ihp, iSCSIDiscoveryMethod_t method, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
989 |
struct sockaddr *addr_dsc, char *target_name, int tpgt, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
990 |
struct sockaddr *addr_tgt) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
991 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
992 |
boolean_t rtn = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
993 |
iscsi_sess_t *isp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
994 |
iscsi_conn_t *icp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
995 |
uint_t oid; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
996 |
int idx; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
997 |
int isid; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
998 |
iscsi_config_sess_t *ics; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
999 |
int size; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1000 |
char *tmp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1001 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1002 |
ASSERT(ihp != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1003 |
ASSERT(addr_dsc != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1004 |
ASSERT(target_name != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1005 |
ASSERT(addr_tgt != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1006 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1007 |
/* setup initial buffer for configured session information */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1008 |
size = sizeof (*ics); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1009 |
ics = kmem_zalloc(size, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1010 |
ics->ics_in = 1; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1011 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1012 |
/* get configured sessions information */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1013 |
tmp = target_name; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1014 |
if (persistent_get_config_session(tmp, ics) == B_FALSE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1015 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1016 |
* No target information available check for |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1017 |
* initiator information. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1018 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1019 |
tmp = (char *)ihp->hba_name; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1020 |
if (persistent_get_config_session(tmp, ics) == B_FALSE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1021 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1022 |
* No hba information is |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1023 |
* found. So assume default |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1024 |
* one session unbound behavior. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1025 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1026 |
ics->ics_out = 1; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1027 |
ics->ics_bound = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1028 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1029 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1030 |
|
8194 | 1031 |
if (iscsiboot_prop && (ics->ics_out > 1) && |
1032 |
!iscsi_chk_bootlun_mpxio(ihp)) { |
|
1033 |
/* |
|
1034 |
* iscsi boot with mpxio disabled |
|
1035 |
* no need to search configured boot session |
|
1036 |
*/ |
|
1037 |
||
1038 |
if (iscsi_cmp_boot_ini_name(tmp) || |
|
1039 |
iscsi_cmp_boot_tgt_name(tmp)) { |
|
1040 |
ics->ics_out = 1; |
|
1041 |
ics->ics_bound = B_FALSE; |
|
1042 |
} |
|
1043 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1044 |
/* Check to see if we need to get more information */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1045 |
if (ics->ics_out > 1) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1046 |
/* record new size and free last buffer */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1047 |
idx = ics->ics_out; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1048 |
size = ISCSI_SESSION_CONFIG_SIZE(ics->ics_out); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1049 |
kmem_free(ics, sizeof (*ics)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1050 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1051 |
/* allocate new buffer */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1052 |
ics = kmem_zalloc(size, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1053 |
ics->ics_in = idx; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1054 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1055 |
/* get configured sessions information */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1056 |
if (persistent_get_config_session(tmp, ics) != B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1057 |
cmn_err(CE_NOTE, "iscsi session(%s) - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1058 |
"unable to get configured session information\n", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1059 |
target_name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1060 |
kmem_free(ics, size); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1061 |
return (B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1062 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1063 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1064 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1065 |
/* loop for all configured sessions */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1066 |
rw_enter(&ihp->hba_sess_list_rwlock, RW_WRITER); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1067 |
for (isid = 0; isid < ics->ics_out; isid++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1068 |
/* create or find matching session */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1069 |
isp = iscsi_sess_create(ihp, method, addr_dsc, target_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1070 |
tpgt, isid, ISCSI_SESS_TYPE_NORMAL, &oid); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1071 |
if (isp == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1072 |
rtn = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1073 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1074 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1075 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1076 |
/* create or find matching connection */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1077 |
if (!ISCSI_SUCCESS(iscsi_conn_create(addr_tgt, isp, &icp))) { |
9162
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1078 |
/* |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1079 |
* Teardown the session we just created. It can't |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1080 |
* have any luns or connections associated with it |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1081 |
* so this should always succeed (luckily since what |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1082 |
* would we do if it failed?) |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1083 |
*/ |
b011b0287065
PSARC 2008/395 iSER: iSCSI Extensions for RDMA
Peter Dunlap <Peter.Dunlap@Sun.COM>
parents:
8488
diff
changeset
|
1084 |
(void) iscsi_sess_destroy(isp); |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1085 |
rtn = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1086 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1087 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1088 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1089 |
rw_exit(&ihp->hba_sess_list_rwlock); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1090 |
kmem_free(ics, size); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1091 |
return (rtn); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1092 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1093 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1094 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1095 |
* iscsid_del - Attempts to delete all associated sessions |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1096 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1097 |
boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1098 |
iscsid_del(iscsi_hba_t *ihp, char *target_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1099 |
iSCSIDiscoveryMethod_t method, struct sockaddr *addr_dsc) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1100 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1101 |
boolean_t rtn = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1102 |
iscsi_status_t status; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1103 |
iscsi_sess_t *isp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1104 |
char name[ISCSI_MAX_NAME_LEN]; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1105 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1106 |
ASSERT(ihp != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1107 |
/* target name can be NULL or !NULL */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1108 |
/* addr_dsc can be NULL or !NULL */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1109 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1110 |
rw_enter(&ihp->hba_sess_list_rwlock, RW_WRITER); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1111 |
isp = ihp->hba_sess_list; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1112 |
while (isp != NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1113 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1114 |
* If no target_name is listed (meaning all targets) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1115 |
* or this specific target was listed. And the same |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1116 |
* discovery method discovered this target then |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1117 |
* continue evaulation. Otherwise fail. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1118 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1119 |
if (((target_name == NULL) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1120 |
(strcmp((char *)isp->sess_name, target_name) == 0)) && |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1121 |
(isp->sess_discovered_by == method)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1122 |
boolean_t try_destroy; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1123 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1124 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1125 |
* If iSNS, SendTargets, or Static then special |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1126 |
* handling for disc_addr. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1127 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1128 |
if ((method == iSCSIDiscoveryMethodISNS) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1129 |
(method == iSCSIDiscoveryMethodSendTargets)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1130 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1131 |
* If NULL addr_dsc (meaning all disc_addr) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1132 |
* or matching discovered addr. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1133 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1134 |
if ((addr_dsc == NULL) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1135 |
(bcmp(addr_dsc, &isp->sess_discovered_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1136 |
SIZEOF_SOCKADDR( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1137 |
&isp->sess_discovered_addr.sin)) == 0)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1138 |
try_destroy = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1139 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1140 |
try_destroy = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1141 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1142 |
} else if (method == iSCSIDiscoveryMethodStatic) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1143 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1144 |
* If NULL addr_dsc (meaning all disc_addr) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1145 |
* or matching active connection. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1146 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1147 |
if ((addr_dsc == NULL) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1148 |
((isp->sess_conn_act != NULL) && |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1149 |
(bcmp(addr_dsc, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1150 |
&isp->sess_conn_act->conn_base_addr.sin, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1151 |
SIZEOF_SOCKADDR( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1152 |
&isp->sess_conn_act->conn_base_addr.sin)) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1153 |
== 0))) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1154 |
try_destroy = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1155 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1156 |
try_destroy = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1157 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1158 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1159 |
/* Unknown discovery specified */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1160 |
try_destroy = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1161 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1162 |
|
8194 | 1163 |
if (try_destroy == B_TRUE && |
1164 |
isp->sess_boot == B_FALSE) { |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1165 |
(void) strcpy(name, (char *)isp->sess_name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1166 |
status = iscsi_sess_destroy(isp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1167 |
if (ISCSI_SUCCESS(status)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1168 |
iscsid_remove_target_param(name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1169 |
isp = ihp->hba_sess_list; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1170 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1171 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1172 |
* The most likely destroy failure |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1173 |
* is that ndi/mdi offline failed. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1174 |
* This means that the resource is |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1175 |
* in_use/busy. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1176 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1177 |
cmn_err(CE_NOTE, "iscsi session(%d) - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1178 |
"session logout failed (%d)\n", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1179 |
isp->sess_oid, status); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1180 |
isp = isp->sess_next; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1181 |
rtn = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1182 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1183 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1184 |
isp = isp->sess_next; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1185 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1186 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1187 |
isp = isp->sess_next; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1188 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1189 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1190 |
rw_exit(&ihp->hba_sess_list_rwlock); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1191 |
return (rtn); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1192 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1193 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1194 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1195 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1196 |
* iscsid_login_tgt - request target(s) to login |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1197 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1198 |
boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1199 |
iscsid_login_tgt(iscsi_hba_t *ihp, char *target_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1200 |
iSCSIDiscoveryMethod_t method, struct sockaddr *addr_dsc) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1201 |
{ |
8488
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1202 |
boolean_t rtn = B_FALSE; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1203 |
iscsi_sess_t *isp = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1204 |
iscsi_sess_list_t *isp_list = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1205 |
iscsi_sess_list_t *last_sess = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1206 |
iscsi_sess_list_t *cur_sess = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1207 |
int total = 0; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1208 |
ddi_taskq_t *login_taskq = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1209 |
char taskq_name[ISCSI_TH_MAX_NAME_LEN] = {0}; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1210 |
time_t time_stamp; |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1211 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1212 |
ASSERT(ihp != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1213 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1214 |
rw_enter(&ihp->hba_sess_list_rwlock, RW_WRITER); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1215 |
/* Loop thru sessions */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1216 |
isp = ihp->hba_sess_list; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1217 |
while (isp != NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1218 |
boolean_t try_online; |
8194 | 1219 |
if (!(method & iSCSIDiscoveryMethodBoot)) { |
1220 |
if (target_name == NULL) { |
|
1221 |
if (method == iSCSIDiscoveryMethodUnknown) { |
|
1222 |
/* unknown method mean login to all */ |
|
1223 |
try_online = B_TRUE; |
|
1224 |
} else if (isp->sess_discovered_by & method) { |
|
1225 |
if ((method == |
|
1226 |
iSCSIDiscoveryMethodISNS) || |
|
1227 |
(method == |
|
1228 |
iSCSIDiscoveryMethodSendTargets)) { |
|
1229 |
#define SESS_DISC_ADDR isp->sess_discovered_addr.sin |
|
1230 |
if ((addr_dsc == NULL) || |
|
1231 |
(bcmp( |
|
1232 |
&isp->sess_discovered_addr, |
|
1233 |
addr_dsc, SIZEOF_SOCKADDR( |
|
1234 |
&SESS_DISC_ADDR)) |
|
1235 |
== 0)) { |
|
1236 |
/* |
|
1237 |
* iSNS or sendtarget |
|
1238 |
* discovery and |
|
1239 |
* discovery address |
|
1240 |
* is NULL or match |
|
1241 |
*/ |
|
1242 |
try_online = B_TRUE; |
|
1243 |
} else { |
|
1244 |
/* addr_dsc not a match */ |
|
1245 |
try_online = B_FALSE; |
|
1246 |
} |
|
1247 |
#undef SESS_DISC_ADDR |
|
1248 |
} else { |
|
1249 |
/* static configuration */ |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1250 |
try_online = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1251 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1252 |
} else { |
8194 | 1253 |
/* method not a match */ |
1254 |
try_online = B_FALSE; |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1255 |
} |
8194 | 1256 |
} else if (strcmp(target_name, |
1257 |
(char *)isp->sess_name) == 0) { |
|
1258 |
/* target_name match */ |
|
1259 |
try_online = B_TRUE; |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1260 |
} else { |
8194 | 1261 |
/* target_name not a match */ |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1262 |
try_online = B_FALSE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1263 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1264 |
} else { |
8194 | 1265 |
/* |
1266 |
* online the boot session. |
|
1267 |
*/ |
|
1268 |
if (isp->sess_boot == B_TRUE) { |
|
1269 |
try_online = B_TRUE; |
|
1270 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1271 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1272 |
|
8488
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1273 |
if (try_online == B_TRUE && |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1274 |
isp->sess_type == ISCSI_SESS_TYPE_NORMAL) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1275 |
total++; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1276 |
/* Copy these sessions to the list. */ |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1277 |
if (isp_list == NULL) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1278 |
isp_list = |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1279 |
(iscsi_sess_list_t *)kmem_zalloc( |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1280 |
sizeof (iscsi_sess_list_t), KM_SLEEP); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1281 |
last_sess = isp_list; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1282 |
last_sess->session = isp; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1283 |
last_sess->next = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1284 |
} else { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1285 |
last_sess->next = |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1286 |
(iscsi_sess_list_t *)kmem_zalloc( |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1287 |
sizeof (iscsi_sess_list_t), KM_SLEEP); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1288 |
last_sess->next->session = isp; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1289 |
last_sess->next->next = NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1290 |
last_sess = last_sess->next; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1291 |
} |
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1292 |
rtn = B_TRUE; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1293 |
} |
8488
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1294 |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1295 |
isp = isp->sess_next; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1296 |
} |
8488
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1297 |
|
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1298 |
if (total > 0) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1299 |
time_stamp = ddi_get_time(); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1300 |
(void) snprintf(taskq_name, (ISCSI_TH_MAX_NAME_LEN - 1), |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1301 |
"login_queue.%lx", time_stamp); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1302 |
|
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1303 |
login_taskq = ddi_taskq_create(ihp->hba_dip, |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1304 |
taskq_name, total, TASKQ_DEFAULTPRI, 0); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1305 |
if (login_taskq == NULL) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1306 |
while (isp_list != NULL) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1307 |
cur_sess = isp_list; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1308 |
isp_list = isp_list->next; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1309 |
kmem_free(cur_sess, sizeof (iscsi_sess_list_t)); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1310 |
} |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1311 |
rtn = B_FALSE; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1312 |
rw_exit(&ihp->hba_sess_list_rwlock); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1313 |
return (rtn); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1314 |
} |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1315 |
|
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1316 |
for (cur_sess = isp_list; cur_sess != NULL; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1317 |
cur_sess = cur_sess->next) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1318 |
if (ddi_taskq_dispatch(login_taskq, |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1319 |
iscsi_sess_online, (void *)cur_sess->session, |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1320 |
DDI_SLEEP) != DDI_SUCCESS) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1321 |
cmn_err(CE_NOTE, "Can't dispatch the task " |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1322 |
"for login to the target: %s", |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1323 |
cur_sess->session->sess_name); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1324 |
} |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1325 |
} |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1326 |
|
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1327 |
ddi_taskq_wait(login_taskq); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1328 |
ddi_taskq_destroy(login_taskq); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1329 |
while (isp_list != NULL) { |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1330 |
cur_sess = isp_list; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1331 |
isp_list = isp_list->next; |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1332 |
kmem_free(cur_sess, sizeof (iscsi_sess_list_t)); |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1333 |
} |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1334 |
|
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1335 |
} |
c882253f3351
6775008 iSCSI initiator can hang at boot if targets are unavailable
bing zhao - Sun Microsystems - Beijing China <Bing.Zhao@Sun.COM>
parents:
8194
diff
changeset
|
1336 |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1337 |
rw_exit(&ihp->hba_sess_list_rwlock); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1338 |
return (rtn); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1339 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1340 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1341 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1342 |
* +--------------------------------------------------------------------+ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1343 |
* | Local Helper Functions | |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1344 |
* +--------------------------------------------------------------------+ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1345 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1346 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1347 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1348 |
* iscsid_init_config -- initialize configuration parameters of iSCSI initiator |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1349 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1350 |
static boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1351 |
iscsid_init_config(iscsi_hba_t *ihp) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1352 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1353 |
iscsi_param_set_t ips; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1354 |
void *v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1355 |
char *name; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1356 |
char *initiatorName; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1357 |
persistent_param_t pp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1358 |
uint32_t param_id; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1359 |
int rc; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1360 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1361 |
/* allocate memory to hold initiator names */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1362 |
initiatorName = kmem_zalloc(ISCSI_MAX_NAME_LEN, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1363 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1364 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1365 |
* initialize iSCSI initiator name |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1366 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1367 |
bzero(&ips, sizeof (ips)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1368 |
if (persistent_initiator_name_get(initiatorName, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1369 |
ISCSI_MAX_NAME_LEN) == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1370 |
ips.s_vers = ISCSI_INTERFACE_VERSION; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1371 |
ips.s_param = ISCSI_LOGIN_PARAM_INITIATOR_NAME; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1372 |
|
8194 | 1373 |
if (iscsiboot_prop && !iscsi_cmp_boot_ini_name(initiatorName)) { |
1374 |
(void) strncpy(initiatorName, |
|
1375 |
(const char *)iscsiboot_prop->boot_init.ini_name, |
|
1376 |
ISCSI_MAX_NAME_LEN); |
|
1377 |
(void) strncpy((char *)ips.s_value.v_name, |
|
1378 |
(const char *)iscsiboot_prop->boot_init.ini_name, |
|
1379 |
sizeof (ips.s_value.v_name)); |
|
1380 |
(void) iscsi_set_params(&ips, ihp, B_TRUE); |
|
1381 |
cmn_err(CE_NOTE, "Set initiator's name" |
|
1382 |
" from firmware"); |
|
1383 |
} else { |
|
1384 |
(void) strncpy((char *)ips.s_value.v_name, |
|
1385 |
initiatorName, sizeof (ips.s_value.v_name)); |
|
1386 |
||
1387 |
(void) iscsi_set_params(&ips, ihp, B_FALSE); |
|
1388 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1389 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1390 |
/* |
8194 | 1391 |
* if no initiator-node name available it is most |
1392 |
* likely due to a fresh install, or the persistent |
|
1393 |
* store is not working correctly. Set |
|
1394 |
* a default initiator name so that the initiator can |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1395 |
* be brought up properly. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1396 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1397 |
iscsid_set_default_initiator_node_settings(ihp); |
8194 | 1398 |
(void) strncpy(initiatorName, (const char *)ihp->hba_name, |
1399 |
ISCSI_MAX_NAME_LEN); |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1400 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1401 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1402 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1403 |
* initialize iSCSI initiator alias (if any) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1404 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1405 |
bzero(&ips, sizeof (ips)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1406 |
if (persistent_alias_name_get((char *)ips.s_value.v_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1407 |
sizeof (ips.s_value.v_name)) == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1408 |
ips.s_param = ISCSI_LOGIN_PARAM_INITIATOR_ALIAS; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1409 |
(void) iscsi_set_params(&ips, ihp, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1410 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1411 |
/* EMPTY */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1412 |
/* No alias defined - not a problem. */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1413 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1414 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1415 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1416 |
* load up the overriden iSCSI initiator parameters |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1417 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1418 |
name = kmem_zalloc(ISCSI_MAX_NAME_LEN, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1419 |
persistent_param_lock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1420 |
v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1421 |
while (persistent_param_next(&v, name, &pp) == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1422 |
if (strncmp(name, initiatorName, ISCSI_MAX_NAME_LEN) == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1423 |
ips.s_oid = ihp->hba_oid; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1424 |
ips.s_vers = ISCSI_INTERFACE_VERSION; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1425 |
for (param_id = 0; param_id < ISCSI_NUM_LOGIN_PARAM; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1426 |
param_id++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1427 |
if (pp.p_bitmap & (1 << param_id)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1428 |
rc = iscsid_copyto_param_set(param_id, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1429 |
&pp.p_params, &ips); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1430 |
if (rc == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1431 |
rc = iscsi_set_params(&ips, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1432 |
ihp, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1433 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1434 |
if (rc != 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1435 |
/* note error but continue */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1436 |
cmn_err(CE_NOTE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1437 |
"Failed to set " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1438 |
"param %d for OID %d", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1439 |
ips.s_param, ips.s_oid); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1440 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1441 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1442 |
} /* END for() */ |
8194 | 1443 |
if (iscsiboot_prop && |
1444 |
iscsi_chk_bootlun_mpxio(ihp)) { |
|
1445 |
(void) iscsi_reconfig_boot_sess(ihp); |
|
1446 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1447 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1448 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1449 |
} /* END while() */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1450 |
persistent_param_unlock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1451 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1452 |
kmem_free(initiatorName, ISCSI_MAX_NAME_LEN); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1453 |
kmem_free(name, ISCSI_MAX_NAME_LEN); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1454 |
return (B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1455 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1456 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1457 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1458 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1459 |
* iscsid_init_targets -- Load up the driver with known static targets and |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1460 |
* targets whose parameters have been modified. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1461 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1462 |
* This is done so that the CLI can find a list of targets the driver |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1463 |
* currently knows about. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1464 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1465 |
* The driver doesn't need to log into these targets. Log in is done based |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1466 |
* upon the enabled discovery methods. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1467 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1468 |
static boolean_t |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1469 |
iscsid_init_targets(iscsi_hba_t *ihp) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1470 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1471 |
void *v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1472 |
char *name; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1473 |
iscsi_param_set_t ips; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1474 |
persistent_param_t pp; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1475 |
char *iname; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1476 |
uint32_t param_id; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1477 |
int rc; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1478 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1479 |
ASSERT(ihp != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1480 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1481 |
/* allocate memory to hold target names */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1482 |
name = kmem_zalloc(ISCSI_MAX_NAME_LEN, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1483 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1484 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1485 |
* load up targets whose parameters have been overriden |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1486 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1487 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1488 |
/* ---- only need to be set once ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1489 |
bzero(&ips, sizeof (ips)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1490 |
ips.s_vers = ISCSI_INTERFACE_VERSION; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1491 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1492 |
/* allocate memory to hold initiator name */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1493 |
iname = kmem_zalloc(ISCSI_MAX_NAME_LEN, KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1494 |
(void) persistent_initiator_name_get(iname, ISCSI_MAX_NAME_LEN); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1495 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1496 |
persistent_param_lock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1497 |
v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1498 |
while (persistent_param_next(&v, name, &pp) == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1499 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1500 |
if (strncmp(iname, name, ISCSI_MAX_NAME_LEN) == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1501 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1502 |
* target name matched initiator's name so, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1503 |
* continue to next target. Initiator's |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1504 |
* parmeters have already been set. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1505 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1506 |
continue; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1507 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1508 |
|
8194 | 1509 |
if (iscsiboot_prop && iscsi_cmp_boot_tgt_name(name) && |
1510 |
!iscsi_chk_bootlun_mpxio(ihp)) { |
|
1511 |
/* |
|
1512 |
* boot target is not mpxio enabled |
|
1513 |
* simply ignore these overriden parameters |
|
1514 |
*/ |
|
1515 |
continue; |
|
1516 |
} |
|
1517 |
||
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1518 |
ips.s_oid = iscsi_targetparam_get_oid((unsigned char *)name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1519 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1520 |
for (param_id = 0; param_id < ISCSI_NUM_LOGIN_PARAM; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1521 |
param_id++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1522 |
if (pp.p_bitmap & (1 << param_id)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1523 |
rc = iscsid_copyto_param_set(param_id, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1524 |
&pp.p_params, &ips); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1525 |
if (rc == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1526 |
rc = iscsi_set_params(&ips, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1527 |
ihp, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1528 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1529 |
if (rc != 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1530 |
/* note error but continue ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1531 |
cmn_err(CE_NOTE, "Failed to set " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1532 |
"param %d for OID %d", |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1533 |
ips.s_param, ips.s_oid); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1534 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1535 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1536 |
} /* END for() */ |
8194 | 1537 |
if (iscsiboot_prop && iscsi_cmp_boot_tgt_name(name) && |
1538 |
iscsi_chk_bootlun_mpxio(ihp)) { |
|
1539 |
(void) iscsi_reconfig_boot_sess(ihp); |
|
1540 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1541 |
} /* END while() */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1542 |
persistent_param_unlock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1543 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1544 |
kmem_free(iname, ISCSI_MAX_NAME_LEN); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1545 |
kmem_free(name, ISCSI_MAX_NAME_LEN); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1546 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1547 |
return (B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1548 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1549 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1550 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1551 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1552 |
* iscsid_thread_static -- If static discovery is enabled, this routine obtains |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1553 |
* all statically configured targets from the peristent store and issues a |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1554 |
* login request to the driver. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1555 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1556 |
/* ARGSUSED */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1557 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1558 |
iscsid_thread_static(iscsi_thread_t *thread, void *p) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1559 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1560 |
iSCSIDiscoveryMethod_t dm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1561 |
entry_t entry; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1562 |
char name[ISCSI_MAX_NAME_LEN]; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1563 |
void *v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1564 |
iscsi_hba_t *ihp = (iscsi_hba_t *)p; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1565 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1566 |
while (iscsi_thread_wait(thread, -1) != 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1567 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodStatic, B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1568 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1569 |
/* ---- ensure static target discovery is enabled ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1570 |
dm = persistent_disc_meth_get(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1571 |
if ((dm & iSCSIDiscoveryMethodStatic) == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1572 |
cmn_err(CE_NOTE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1573 |
"iscsi discovery failure - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1574 |
"StaticTargets method is not enabled"); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1575 |
iscsi_discovery_event(ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1576 |
iSCSIDiscoveryMethodStatic, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1577 |
continue; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1578 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1579 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1580 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1581 |
* walk list of the statically configured targets from the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1582 |
* persistent store |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1583 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1584 |
v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1585 |
persistent_static_addr_lock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1586 |
while (persistent_static_addr_next(&v, name, &entry) == |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1587 |
B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1588 |
iscsi_sockaddr_t addr; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1589 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1590 |
iscsid_addr_to_sockaddr(entry.e_insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1591 |
&(entry.e_u), entry.e_port, &addr.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1592 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1593 |
(void) iscsid_add(ihp, iSCSIDiscoveryMethodStatic, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1594 |
&addr.sin, name, entry.e_tpgt, &addr.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1595 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1596 |
persistent_static_addr_unlock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1597 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodStatic, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1598 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1599 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1600 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1601 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1602 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1603 |
* iscsid_thread_sendtgts -- If SendTargets discovery is enabled, this routine |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1604 |
* obtains all target discovery addresses configured from the peristent store |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1605 |
* and probe the IP/port addresses for possible targets. It will then issue |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1606 |
* a login request to the driver for all discoveryed targets. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1607 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1608 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1609 |
iscsid_thread_sendtgts(iscsi_thread_t *thread, void *p) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1610 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1611 |
iscsi_hba_t *ihp = (iscsi_hba_t *)p; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1612 |
iSCSIDiscoveryMethod_t dm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1613 |
entry_t entry; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1614 |
void *v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1615 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1616 |
while (iscsi_thread_wait(thread, -1) != 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1617 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodSendTargets, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1618 |
B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1619 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1620 |
/* ---- ensure SendTargets discovery is enabled ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1621 |
dm = persistent_disc_meth_get(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1622 |
if ((dm & iSCSIDiscoveryMethodSendTargets) == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1623 |
cmn_err(CE_NOTE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1624 |
"iscsi discovery failure - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1625 |
"SendTargets method is not enabled"); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1626 |
iscsi_discovery_event(ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1627 |
iSCSIDiscoveryMethodSendTargets, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1628 |
continue; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1629 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1630 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1631 |
* walk list of the SendTarget discovery addresses from the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1632 |
* persistent store |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1633 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1634 |
v = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1635 |
persistent_disc_addr_lock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1636 |
while (persistent_disc_addr_next(&v, &entry) == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1637 |
iscsid_do_sendtgts(&entry); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1638 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1639 |
persistent_disc_addr_unlock(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1640 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1641 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodSendTargets, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1642 |
B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1643 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1644 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1645 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1646 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1647 |
* iscsid_thread_slp -- If SLP discovery is enabled, this routine provides |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1648 |
* the SLP discovery service. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1649 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1650 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1651 |
iscsid_thread_slp(iscsi_thread_t *thread, void *p) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1652 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1653 |
iscsi_hba_t *ihp = (iscsi_hba_t *)p; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1654 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1655 |
do { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1656 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1657 |
* Even though we don't have support for SLP at this point |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1658 |
* we'll send the events if someone has enabled this thread. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1659 |
* If this is not done the daemon waiting for discovery to |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1660 |
* complete will pause forever holding up the boot process. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1661 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1662 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodSLP, B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1663 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodSLP, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1664 |
} while (iscsi_thread_wait(thread, -1) != 0); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1665 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1666 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1667 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1668 |
* iscsid_thread_isns -- |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1669 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1670 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1671 |
iscsid_thread_isns(iscsi_thread_t *thread, void *ptr) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1672 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1673 |
iscsi_hba_t *ihp = (iscsi_hba_t *)ptr; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1674 |
iSCSIDiscoveryMethod_t dm; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1675 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1676 |
while (iscsi_thread_wait(thread, -1) != 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1677 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodISNS, B_TRUE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1678 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1679 |
/* ---- ensure iSNS discovery is enabled ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1680 |
dm = persistent_disc_meth_get(); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1681 |
if ((dm & iSCSIDiscoveryMethodISNS) == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1682 |
cmn_err(CE_NOTE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1683 |
"iscsi discovery failure - " |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1684 |
"iSNS method is not enabled"); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1685 |
iscsi_discovery_event(ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1686 |
iSCSIDiscoveryMethodISNS, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1687 |
continue; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1688 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1689 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1690 |
(void) isns_reg(ihp->hba_isid, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1691 |
ihp->hba_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1692 |
ISCSI_MAX_NAME_LEN, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1693 |
ihp->hba_alias, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1694 |
ISCSI_MAX_NAME_LEN, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1695 |
ISNS_INITIATOR_NODE_TYPE, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1696 |
isns_scn_callback); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1697 |
iscsid_do_isns_query(ihp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1698 |
iscsi_discovery_event(ihp, iSCSIDiscoveryMethodISNS, B_FALSE); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1699 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1700 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1701 |
/* Thread stopped. Deregister from iSNS servers(s). */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1702 |
(void) isns_dereg(ihp->hba_isid, ihp->hba_name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1703 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1704 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1705 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1706 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1707 |
* iscsid_threads_create -- Creates all the discovery threads. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1708 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1709 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1710 |
iscsid_threads_create(iscsi_hba_t *ihp) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1711 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1712 |
iscsid_thr_table *t; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1713 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1714 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1715 |
* start a thread for each discovery method |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1716 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1717 |
for (t = &iscsid_thr[0]; t->method != iSCSIDiscoveryMethodUnknown; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1718 |
t++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1719 |
if (t->thr_id == NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1720 |
t->thr_id = iscsi_thread_create(ihp->hba_dip, t->name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1721 |
t->func_start, ihp); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1722 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1723 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1724 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1725 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1726 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1727 |
* iscsid_threads_destroy -- Destroys all the discovery threads. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1728 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1729 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1730 |
iscsid_threads_destroy(void) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1731 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1732 |
iscsid_thr_table *t; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1733 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1734 |
for (t = &iscsid_thr[0]; t->method != iSCSIDiscoveryMethodUnknown; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1735 |
t++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1736 |
if (t->thr_id != NULL) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1737 |
iscsi_thread_destroy(t->thr_id); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1738 |
t->thr_id = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1739 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1740 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1741 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1742 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1743 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1744 |
* iscsid_copyto_param_set - helper function for iscsid_init_params. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1745 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1746 |
static int |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1747 |
iscsid_copyto_param_set(uint32_t param_id, iscsi_login_params_t *params, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1748 |
iscsi_param_set_t *ipsp) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1749 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1750 |
int rtn = 0; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1751 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1752 |
if (param_id >= ISCSI_NUM_LOGIN_PARAM) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1753 |
return (EINVAL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1754 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1755 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1756 |
switch (param_id) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1757 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1758 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1759 |
* Boolean parameters |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1760 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1761 |
case ISCSI_LOGIN_PARAM_DATA_SEQUENCE_IN_ORDER: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1762 |
ipsp->s_value.v_bool = params->data_pdu_in_order; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1763 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1764 |
case ISCSI_LOGIN_PARAM_IMMEDIATE_DATA: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1765 |
ipsp->s_value.v_bool = params->immediate_data; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1766 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1767 |
case ISCSI_LOGIN_PARAM_INITIAL_R2T: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1768 |
ipsp->s_value.v_bool = params->initial_r2t; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1769 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1770 |
case ISCSI_LOGIN_PARAM_DATA_PDU_IN_ORDER: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1771 |
ipsp->s_value.v_bool = params->data_pdu_in_order; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1772 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1773 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1774 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1775 |
* Integer parameters |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1776 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1777 |
case ISCSI_LOGIN_PARAM_HEADER_DIGEST: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1778 |
ipsp->s_value.v_integer = params->header_digest; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1779 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1780 |
case ISCSI_LOGIN_PARAM_DATA_DIGEST: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1781 |
ipsp->s_value.v_integer = params->data_digest; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1782 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1783 |
case ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_RETAIN: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1784 |
ipsp->s_value.v_integer = params->default_time_to_retain; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1785 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1786 |
case ISCSI_LOGIN_PARAM_DEFAULT_TIME_2_WAIT: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1787 |
ipsp->s_value.v_integer = params->default_time_to_wait; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1788 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1789 |
case ISCSI_LOGIN_PARAM_MAX_RECV_DATA_SEGMENT_LENGTH: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1790 |
ipsp->s_value.v_integer = params->max_recv_data_seg_len; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1791 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1792 |
case ISCSI_LOGIN_PARAM_FIRST_BURST_LENGTH: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1793 |
ipsp->s_value.v_integer = params->first_burst_length; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1794 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1795 |
case ISCSI_LOGIN_PARAM_MAX_BURST_LENGTH: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1796 |
ipsp->s_value.v_integer = params->max_burst_length; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1797 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1798 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1799 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1800 |
* Integer parameters which currently are unsettable |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1801 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1802 |
case ISCSI_LOGIN_PARAM_MAX_CONNECTIONS: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1803 |
case ISCSI_LOGIN_PARAM_OUTSTANDING_R2T: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1804 |
case ISCSI_LOGIN_PARAM_ERROR_RECOVERY_LEVEL: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1805 |
/* ---- drop through to default case ---- */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1806 |
default: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1807 |
rtn = EINVAL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1808 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1809 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1810 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1811 |
/* if all is well, set the parameter identifier */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1812 |
if (rtn == 0) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1813 |
ipsp->s_param = param_id; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1814 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1815 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1816 |
return (rtn); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1817 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1818 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1819 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1820 |
* iscsid_add_pg_list_to_cache - Add portal groups in the list to the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1821 |
* discovery cache. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1822 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1823 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1824 |
iscsid_add_pg_list_to_cache(iscsi_hba_t *ihp, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1825 |
isns_portal_group_list_t *pg_list) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1826 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1827 |
int i; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1828 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1829 |
for (i = 0; i < pg_list->pg_out_cnt; i++) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1830 |
iscsi_sockaddr_t addr_dsc; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1831 |
iscsi_sockaddr_t addr_tgt; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1832 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1833 |
iscsid_addr_to_sockaddr( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1834 |
pg_list->pg_list[i].isns_server_ip.i_insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1835 |
&pg_list->pg_list[i].isns_server_ip.i_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1836 |
pg_list->pg_list[i].isns_server_port, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1837 |
&addr_dsc.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1838 |
iscsid_addr_to_sockaddr( |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1839 |
pg_list->pg_list[i].insize, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1840 |
&pg_list->pg_list[i].pg_ip_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1841 |
pg_list->pg_list[i].pg_port, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1842 |
&addr_tgt.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1843 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1844 |
(void) iscsid_add(ihp, iSCSIDiscoveryMethodISNS, &addr_dsc.sin, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1845 |
(char *)pg_list->pg_list[i].pg_iscsi_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1846 |
pg_list->pg_list[i].pg_tag, &addr_tgt.sin); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1847 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1848 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1849 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1850 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1851 |
* set_initiator_name - set default initiator name and alias. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1852 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1853 |
* This sets the default initiator name and alias. The |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1854 |
* initiator name is composed of sun's reverse domain name |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1855 |
* and registration followed and a unique classifier. This |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1856 |
* classifier is the mac address of the first NIC in the |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1857 |
* host and a timestamp to make sure the classifier is |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1858 |
* unique if the NIC is moved between hosts. The alias |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1859 |
* is just the hostname. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1860 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1861 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1862 |
iscsid_set_default_initiator_node_settings(iscsi_hba_t *ihp) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1863 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1864 |
int i; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1865 |
time_t x; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1866 |
struct ether_addr eaddr; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1867 |
char val[10]; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1868 |
iscsi_chap_props_t *chap = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1869 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1870 |
/* Set default initiator-node name */ |
8194 | 1871 |
if (iscsiboot_prop && iscsiboot_prop->boot_init.ini_name != NULL) { |
1872 |
(void) strncpy((char *)ihp->hba_name, |
|
1873 |
(const char *)iscsiboot_prop->boot_init.ini_name, |
|
1874 |
ISCSI_MAX_NAME_LEN); |
|
1875 |
} else { |
|
1876 |
(void) snprintf((char *)ihp->hba_name, |
|
1877 |
ISCSI_MAX_NAME_LEN, |
|
1878 |
"iqn.1986-03.com.sun:01:"); |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1879 |
|
8194 | 1880 |
(void) localetheraddr(NULL, &eaddr); |
1881 |
for (i = 0; i < ETHERADDRL; i++) { |
|
1882 |
(void) snprintf(val, sizeof (val), "%02x", |
|
1883 |
eaddr.ether_addr_octet[i]); |
|
1884 |
(void) strncat((char *)ihp->hba_name, val, |
|
1885 |
ISCSI_MAX_NAME_LEN); |
|
1886 |
} |
|
1887 |
||
1888 |
/* Set default initiator-node alias */ |
|
1889 |
x = ddi_get_time(); |
|
1890 |
(void) snprintf(val, sizeof (val), ".%lx", x); |
|
1891 |
(void) strncat((char *)ihp->hba_name, val, ISCSI_MAX_NAME_LEN); |
|
1892 |
||
1893 |
if (ihp->hba_alias[0] == '\0') { |
|
1894 |
(void) strncpy((char *)ihp->hba_alias, |
|
1895 |
utsname.nodename, ISCSI_MAX_NAME_LEN); |
|
1896 |
ihp->hba_alias_length = strlen((char *)ihp->hba_alias); |
|
1897 |
(void) persistent_alias_name_set( |
|
1898 |
(char *)ihp->hba_alias); |
|
1899 |
} |
|
1900 |
} |
|
7836
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1901 |
(void) persistent_initiator_name_set((char *)ihp->hba_name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1902 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1903 |
/* Set default initiator-node CHAP settings */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1904 |
if (persistent_initiator_name_get((char *)ihp->hba_name, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1905 |
ISCSI_MAX_NAME_LEN) == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1906 |
chap = (iscsi_chap_props_t *)kmem_zalloc(sizeof (*chap), |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1907 |
KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1908 |
if (persistent_chap_get((char *)ihp->hba_name, chap) == |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1909 |
B_FALSE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1910 |
bcopy((char *)ihp->hba_name, chap->c_user, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1911 |
strlen((char *)ihp->hba_name)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1912 |
chap->c_user_len = strlen((char *)ihp->hba_name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1913 |
(void) persistent_chap_set((char *)ihp->hba_name, chap); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1914 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1915 |
kmem_free(chap, sizeof (*chap)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1916 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1917 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1918 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1919 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1920 |
iscsid_remove_target_param(char *name) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1921 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1922 |
persistent_param_t *pparam; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1923 |
uint32_t t_oid; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1924 |
iscsi_config_sess_t *ics; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1925 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1926 |
ASSERT(name != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1927 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1928 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1929 |
* Remove target-param <-> target mapping. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1930 |
* Only remove if there is not any overridden |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1931 |
* parameters in the persistent store |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1932 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1933 |
pparam = (persistent_param_t *)kmem_zalloc(sizeof (*pparam), KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1934 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1935 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1936 |
* setup initial buffer for configured session |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1937 |
* information |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1938 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1939 |
ics = (iscsi_config_sess_t *)kmem_zalloc(sizeof (*ics), KM_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1940 |
ics->ics_in = 1; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1941 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1942 |
if ((persistent_param_get(name, pparam) == B_FALSE) && |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1943 |
(persistent_get_config_session(name, ics) == B_FALSE)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1944 |
t_oid = iscsi_targetparam_get_oid((uchar_t *)name); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1945 |
(void) iscsi_targetparam_remove_target(t_oid); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1946 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1947 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1948 |
kmem_free(pparam, sizeof (*pparam)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1949 |
pparam = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1950 |
kmem_free(ics, sizeof (*ics)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1951 |
ics = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1952 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1953 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1954 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1955 |
* iscsid_addr_to_sockaddr - convert other types to struct sockaddr |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1956 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1957 |
void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1958 |
iscsid_addr_to_sockaddr(int src_insize, void *src_addr, int src_port, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1959 |
struct sockaddr *dst_addr) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1960 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1961 |
ASSERT((src_insize == sizeof (struct in_addr)) || |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1962 |
(src_insize == sizeof (struct in6_addr))); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1963 |
ASSERT(src_addr != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1964 |
ASSERT(dst_addr != NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1965 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1966 |
bzero(dst_addr, sizeof (*dst_addr)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1967 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1968 |
/* translate discovery information */ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1969 |
if (src_insize == sizeof (struct in_addr)) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1970 |
struct sockaddr_in *addr_in = |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1971 |
(struct sockaddr_in *)dst_addr; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1972 |
addr_in->sin_family = AF_INET; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1973 |
bcopy(src_addr, &addr_in->sin_addr.s_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1974 |
sizeof (struct in_addr)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1975 |
addr_in->sin_port = htons(src_port); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1976 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1977 |
struct sockaddr_in6 *addr_in6 = |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1978 |
(struct sockaddr_in6 *)dst_addr; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1979 |
addr_in6->sin6_family = AF_INET6; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1980 |
bcopy(src_addr, &addr_in6->sin6_addr.s6_addr, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1981 |
sizeof (struct in6_addr)); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1982 |
addr_in6->sin6_port = htons(src_port); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1983 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1984 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1985 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1986 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1987 |
* iscsi_discovery_event -- send event associated with discovery operations |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1988 |
* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1989 |
* Each discovery event has a start and end event. Which is sent is based |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1990 |
* on the boolean argument start with the obvious results. |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1991 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1992 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1993 |
iscsi_discovery_event(iscsi_hba_t *ihp, iSCSIDiscoveryMethod_t m, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1994 |
boolean_t start) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1995 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1996 |
char *subclass = NULL; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1997 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1998 |
mutex_enter(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
1999 |
switch (m) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2000 |
case iSCSIDiscoveryMethodStatic: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2001 |
if (start == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2002 |
subclass = ESC_ISCSI_STATIC_START; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2003 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2004 |
ihp->hba_discovery_events |= iSCSIDiscoveryMethodStatic; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2005 |
subclass = ESC_ISCSI_STATIC_END; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2006 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2007 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2008 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2009 |
case iSCSIDiscoveryMethodSendTargets: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2010 |
if (start == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2011 |
subclass = ESC_ISCSI_SEND_TARGETS_START; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2012 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2013 |
ihp->hba_discovery_events |= |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2014 |
iSCSIDiscoveryMethodSendTargets; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2015 |
subclass = ESC_ISCSI_SEND_TARGETS_END; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2016 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2017 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2018 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2019 |
case iSCSIDiscoveryMethodSLP: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2020 |
if (start == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2021 |
subclass = ESC_ISCSI_SLP_START; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2022 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2023 |
ihp->hba_discovery_events |= iSCSIDiscoveryMethodSLP; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2024 |
subclass = ESC_ISCSI_SLP_END; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2025 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2026 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2027 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2028 |
case iSCSIDiscoveryMethodISNS: |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2029 |
if (start == B_TRUE) { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2030 |
subclass = ESC_ISCSI_ISNS_START; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2031 |
} else { |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2032 |
ihp->hba_discovery_events |= iSCSIDiscoveryMethodISNS; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2033 |
subclass = ESC_ISCSI_ISNS_END; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2034 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2035 |
break; |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2036 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2037 |
mutex_exit(&ihp->hba_discovery_events_mutex); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2038 |
iscsi_send_sysevent(ihp, subclass, NULL); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2039 |
} |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2040 |
|
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2041 |
/* |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2042 |
* iscsi_send_sysevent -- send sysevent using iscsi class |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2043 |
*/ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2044 |
static void |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2045 |
iscsi_send_sysevent(iscsi_hba_t *ihp, char *subclass, nvlist_t *np) |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2046 |
{ |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2047 |
(void) ddi_log_sysevent(ihp->hba_dip, DDI_VENDOR_SUNW, EC_ISCSI, |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2048 |
subclass, np, NULL, DDI_SLEEP); |
4e95154b5b7a
6745433 Merge NWS consolidation into OS/Net consolidation
John Forte <John.Forte@Sun.COM>
parents:
diff
changeset
|
2049 |
} |
8194 | 2050 |
|
2051 |
static boolean_t |
|
2052 |
iscsid_boot_init_config(iscsi_hba_t *ihp) |
|
2053 |
{ |
|
2054 |
if (strlen((const char *)iscsiboot_prop->boot_init.ini_name) != 0) { |
|
2055 |
bcopy(iscsiboot_prop->boot_init.ini_name, |
|
2056 |
ihp->hba_name, |
|
2057 |
strlen((const char *)iscsiboot_prop->boot_init.ini_name)); |
|
2058 |
} |
|
2059 |
/* or using default login param for boot session */ |
|
2060 |
return (B_TRUE); |
|
2061 |
} |
|
2062 |
||
2063 |
boolean_t |
|
2064 |
iscsi_reconfig_boot_sess(iscsi_hba_t *ihp) |
|
2065 |
{ |
|
2066 |
iscsi_config_sess_t *ics; |
|
2067 |
int idx; |
|
2068 |
iscsi_sess_t *isp, *t_isp; |
|
2069 |
int isid, size; |
|
2070 |
char *name; |
|
2071 |
boolean_t rtn = B_TRUE; |
|
2072 |
||
2073 |
if (iscsiboot_prop == NULL) { |
|
2074 |
return (B_FALSE); |
|
2075 |
} |
|
2076 |
size = sizeof (*ics); |
|
2077 |
ics = kmem_zalloc(size, KM_SLEEP); |
|
2078 |
ics->ics_in = 1; |
|
2079 |
||
2080 |
/* get information of number of sessions to be configured */ |
|
2081 |
name = (char *)iscsiboot_prop->boot_tgt.tgt_name; |
|
2082 |
if (persistent_get_config_session(name, ics) == B_FALSE) { |
|
2083 |
/* |
|
2084 |
* No target information available to check |
|
2085 |
* initiator information. Assume one session |
|
2086 |
* by default. |
|
2087 |
*/ |
|
2088 |
name = (char *)iscsiboot_prop->boot_init.ini_name; |
|
2089 |
if (persistent_get_config_session(name, ics) == B_FALSE) { |
|
2090 |
ics->ics_out = 1; |
|
2091 |
ics->ics_bound = B_TRUE; |
|
2092 |
} |
|
2093 |
} |
|
2094 |
||
2095 |
/* get necessary information */ |
|
2096 |
if (ics->ics_out > 1) { |
|
2097 |
idx = ics->ics_out; |
|
2098 |
size = ISCSI_SESSION_CONFIG_SIZE(ics->ics_out); |
|
2099 |
kmem_free(ics, sizeof (*ics)); |
|
2100 |
||
2101 |
ics = kmem_zalloc(size, KM_SLEEP); |
|
2102 |
ics->ics_in = idx; |
|
2103 |
||
2104 |
/* get configured sessions information */ |
|
2105 |
if (persistent_get_config_session((char *)name, |
|
2106 |
ics) != B_TRUE) { |
|
2107 |
cmn_err(CE_NOTE, "session(%s) - " |
|
2108 |
"failed to setup multiple sessions", |
|
2109 |
name); |
|
2110 |
kmem_free(ics, size); |
|
2111 |
return (B_FALSE); |
|
2112 |
} |
|
2113 |
} |
|
2114 |
||
2115 |
/* create a temporary session to keep boot session connective */ |
|
2116 |
t_isp = iscsi_add_boot_sess(ihp, ISCSI_MAX_CONFIG_SESSIONS); |
|
2117 |
if (t_isp == NULL) { |
|
2118 |
cmn_err(CE_NOTE, "session(%s) - " |
|
2119 |
"failed to setup multiple sessions", name); |
|
2120 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2121 |
kmem_free(ics, size); |
|
2122 |
return (B_FALSE); |
|
2123 |
} |
|
2124 |
||
2125 |
/* destroy all old boot sessions */ |
|
2126 |
rw_enter(&ihp->hba_sess_list_rwlock, RW_WRITER); |
|
2127 |
isp = ihp->hba_sess_list; |
|
2128 |
while (isp != NULL) { |
|
2129 |
if (iscsi_chk_bootlun_mpxio(ihp) && isp->sess_boot) { |
|
2130 |
if (isp->sess_isid[5] != ISCSI_MAX_CONFIG_SESSIONS) { |
|
2131 |
/* |
|
2132 |
* destroy all stale sessions |
|
2133 |
* except temporary boot session |
|
2134 |
*/ |
|
2135 |
if (ISCSI_SUCCESS(iscsi_sess_destroy( |
|
2136 |
isp))) { |
|
2137 |
isp = ihp->hba_sess_list; |
|
2138 |
} else { |
|
2139 |
/* |
|
2140 |
* couldn't destroy stale sessions |
|
2141 |
* at least poke it to disconnect |
|
2142 |
*/ |
|
2143 |
mutex_enter(&isp->sess_state_mutex); |
|
2144 |
iscsi_sess_state_machine(isp, |
|
2145 |
ISCSI_SESS_EVENT_N7); |
|
2146 |
mutex_exit(&isp->sess_state_mutex); |
|
2147 |
isp = isp->sess_next; |
|
2148 |
cmn_err(CE_NOTE, "session(%s) - " |
|
2149 |
"failed to setup multiple" |
|
2150 |
" sessions", name); |
|
2151 |
} |
|
2152 |
} else { |
|
2153 |
isp = isp->sess_next; |
|
2154 |
} |
|
2155 |
} else { |
|
2156 |
isp = isp->sess_next; |
|
2157 |
} |
|
2158 |
} |
|
2159 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2160 |
||
2161 |
for (isid = 0; isid < ics->ics_out; isid++) { |
|
2162 |
isp = iscsi_add_boot_sess(ihp, isid); |
|
2163 |
if (isp == NULL) { |
|
2164 |
cmn_err(CE_NOTE, "session(%s) - failed to setup" |
|
2165 |
" multiple sessions", name); |
|
2166 |
rtn = B_FALSE; |
|
2167 |
break; |
|
2168 |
} |
|
2169 |
} |
|
2170 |
if (!rtn && (isid == 0)) { |
|
2171 |
/* |
|
2172 |
* fail to create any new boot session |
|
2173 |
* so only the temporary session is alive |
|
2174 |
* quit without destroying it |
|
2175 |
*/ |
|
2176 |
kmem_free(ics, size); |
|
2177 |
return (rtn); |
|
2178 |
} |
|
2179 |
||
2180 |
rw_enter(&ihp->hba_sess_list_rwlock, RW_WRITER); |
|
2181 |
if (!ISCSI_SUCCESS(iscsi_sess_destroy(t_isp))) { |
|
2182 |
/* couldn't destroy temp boot session */ |
|
2183 |
cmn_err(CE_NOTE, "session(%s) - " |
|
2184 |
"failed to setup multiple sessions", name); |
|
2185 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2186 |
rtn = B_FALSE; |
|
2187 |
} |
|
2188 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2189 |
||
2190 |
kmem_free(ics, size); |
|
2191 |
return (rtn); |
|
2192 |
} |
|
2193 |
||
2194 |
static iscsi_sess_t * |
|
2195 |
iscsi_add_boot_sess(iscsi_hba_t *ihp, int isid) |
|
2196 |
{ |
|
2197 |
iscsi_sess_t *isp; |
|
2198 |
iscsi_conn_t *icp; |
|
2199 |
uint_t oid; |
|
2200 |
||
2201 |
iscsi_sockaddr_t addr_dst; |
|
2202 |
||
2203 |
addr_dst.sin.sa_family = iscsiboot_prop->boot_tgt.sin_family; |
|
2204 |
if (addr_dst.sin.sa_family == AF_INET) { |
|
2205 |
bcopy(&iscsiboot_prop->boot_tgt.tgt_ip_u.u_in4.s_addr, |
|
2206 |
&addr_dst.sin4.sin_addr.s_addr, sizeof (struct in_addr)); |
|
2207 |
addr_dst.sin4.sin_port = |
|
2208 |
htons(iscsiboot_prop->boot_tgt.tgt_port); |
|
2209 |
} else { |
|
2210 |
bcopy(&iscsiboot_prop->boot_tgt.tgt_ip_u.u_in6.s6_addr, |
|
2211 |
&addr_dst.sin6.sin6_addr.s6_addr, |
|
2212 |
sizeof (struct in6_addr)); |
|
2213 |
addr_dst.sin6.sin6_port = |
|
2214 |
htons(iscsiboot_prop->boot_tgt.tgt_port); |
|
2215 |
} |
|
2216 |
||
2217 |
rw_enter(&ihp->hba_sess_list_rwlock, RW_WRITER); |
|
2218 |
isp = iscsi_sess_create(ihp, |
|
2219 |
iSCSIDiscoveryMethodBoot|iSCSIDiscoveryMethodStatic, |
|
2220 |
(struct sockaddr *)&addr_dst, |
|
2221 |
(char *)iscsiboot_prop->boot_tgt.tgt_name, |
|
2222 |
ISCSI_DEFAULT_TPGT, isid, ISCSI_SESS_TYPE_NORMAL, &oid); |
|
2223 |
if (isp == NULL) { |
|
2224 |
/* create temp booting session failed */ |
|
2225 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2226 |
return (NULL); |
|
2227 |
} |
|
2228 |
isp->sess_boot = B_TRUE; |
|
2229 |
||
2230 |
if (!ISCSI_SUCCESS(iscsi_conn_create((struct sockaddr *)&addr_dst, |
|
2231 |
isp, &icp))) { |
|
2232 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2233 |
return (NULL); |
|
2234 |
} |
|
2235 |
||
2236 |
rw_exit(&ihp->hba_sess_list_rwlock); |
|
2237 |
/* now online created session */ |
|
2238 |
if (iscsid_login_tgt(ihp, (char *)iscsiboot_prop->boot_tgt.tgt_name, |
|
2239 |
iSCSIDiscoveryMethodBoot|iSCSIDiscoveryMethodStatic, |
|
2240 |
(struct sockaddr *)&addr_dst) == B_FALSE) { |
|
2241 |
return (NULL); |
|
2242 |
} |
|
2243 |
||
2244 |
return (isp); |
|
2245 |
} |
|
2246 |
||
2247 |
static void |
|
2248 |
iscsid_thread_boot_wd(iscsi_thread_t *thread, void *p) |
|
2249 |
{ |
|
2250 |
int rc = 1; |
|
2251 |
iscsi_hba_t *ihp = (iscsi_hba_t *)p; |
|
2252 |
||
2253 |
while (rc != 0) { |
|
2254 |
if (iscsiboot_prop && (modrootloaded == 1) && |
|
2255 |
(ihp->persistent_loaded == B_TRUE)) { |
|
2256 |
(void) iscsid_init(ihp, B_FALSE); |
|
2257 |
(void) iscsi_reconfig_boot_sess(ihp); |
|
2258 |
iscsid_poke_discovery(ihp, iSCSIDiscoveryMethodUnknown); |
|
2259 |
(void) iscsid_login_tgt(ihp, NULL, |
|
2260 |
iSCSIDiscoveryMethodUnknown, NULL); |
|
2261 |
break; |
|
2262 |
} |
|
2263 |
rc = iscsi_thread_wait(thread, SEC_TO_TICK(1)); |
|
2264 |
} |
|
2265 |
} |
|
2266 |
||
2267 |
boolean_t |
|
2268 |
iscsi_cmp_boot_tgt_name(char *name) |
|
2269 |
{ |
|
2270 |
if (iscsiboot_prop && (strncmp((const char *)name, |
|
2271 |
(const char *)iscsiboot_prop->boot_tgt.tgt_name, |
|
2272 |
ISCSI_MAX_NAME_LEN) == 0)) { |
|
2273 |
return (B_TRUE); |
|
2274 |
} else { |
|
2275 |
return (B_FALSE); |
|
2276 |
} |
|
2277 |
} |
|
2278 |
||
2279 |
boolean_t |
|
2280 |
iscsi_cmp_boot_ini_name(char *name) |
|
2281 |
{ |
|
2282 |
if (iscsiboot_prop && (strncmp((const char *)name, |
|
2283 |
(const char *)iscsiboot_prop->boot_init.ini_name, |
|
2284 |
ISCSI_MAX_NAME_LEN) == 0)) { |
|
2285 |
return (B_TRUE); |
|
2286 |
} else { |
|
2287 |
return (B_FALSE); |
|
2288 |
} |
|
2289 |
} |
|
2290 |
||
2291 |
boolean_t |
|
2292 |
iscsi_chk_bootlun_mpxio(iscsi_hba_t *ihp) |
|
2293 |
{ |
|
2294 |
iscsi_sess_t *isp; |
|
2295 |
iscsi_lun_t *ilp; |
|
2296 |
isp = ihp->hba_sess_list; |
|
2297 |
boolean_t tgt_mpxio_enabled = B_FALSE; |
|
2298 |
boolean_t bootlun_found = B_FALSE; |
|
2299 |
uint16_t lun_num; |
|
2300 |
||
2301 |
if (iscsiboot_prop == NULL) { |
|
2302 |
return (B_FALSE); |
|
2303 |
} |
|
2304 |
||
2305 |
if (!ihp->hba_mpxio_enabled) { |
|
2306 |
return (B_FALSE); |
|
2307 |
} |
|
2308 |
||
2309 |
lun_num = *((uint64_t *)(iscsiboot_prop->boot_tgt.tgt_boot_lun)); |
|
2310 |
||
2311 |
while (isp != NULL) { |
|
2312 |
if ((strncmp((char *)isp->sess_name, |
|
2313 |
(const char *)iscsiboot_prop->boot_tgt.tgt_name, |
|
2314 |
ISCSI_MAX_NAME_LEN) == 0) && |
|
2315 |
(isp->sess_boot == B_TRUE)) { |
|
2316 |
/* |
|
2317 |
* found boot session. |
|
2318 |
* check its mdi path info is null or not |
|
2319 |
*/ |
|
2320 |
ilp = isp->sess_lun_list; |
|
2321 |
while (ilp != NULL) { |
|
2322 |
if (lun_num == ilp->lun_num) { |
|
2323 |
if (ilp->lun_pip) { |
|
2324 |
tgt_mpxio_enabled = B_TRUE; |
|
2325 |
} |
|
2326 |
bootlun_found = B_TRUE; |
|
2327 |
} |
|
2328 |
ilp = ilp->lun_next; |
|
2329 |
} |
|
2330 |
} |
|
2331 |
isp = isp->sess_next; |
|
2332 |
} |
|
2333 |
if (bootlun_found) { |
|
2334 |
return (tgt_mpxio_enabled); |
|
2335 |
} else { |
|
2336 |
/* |
|
2337 |
* iscsiboot_prop not NULL while no boot lun found |
|
2338 |
* in most cases this is none iscsi boot while iscsiboot_prop |
|
2339 |
* is not NULL, in this scenario return iscsi HBA's mpxio config |
|
2340 |
*/ |
|
2341 |
return (ihp->hba_mpxio_enabled); |
|
2342 |
} |
|
2343 |
} |