]>
Commit | Line | Data |
---|---|---|
92d7f7b0 JS |
1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | |
3 | * Fibre Channel Host Bus Adapters. * | |
a89a96bd | 4 | * Copyright (C) 2004-2013 Emulex. All rights reserved. * |
92d7f7b0 JS |
5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | |
8 | * * | |
9 | * This program is free software; you can redistribute it and/or * | |
10 | * modify it under the terms of version 2 of the GNU General * | |
11 | * Public License as published by the Free Software Foundation. * | |
12 | * This program is distributed in the hope that it will be useful. * | |
13 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * | |
14 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * | |
15 | * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * | |
16 | * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * | |
17 | * TO BE LEGALLY INVALID. See the GNU General Public License for * | |
18 | * more details, a copy of which can be found in the file COPYING * | |
19 | * included with this package. * | |
20 | *******************************************************************/ | |
21 | ||
22 | #include <linux/blkdev.h> | |
23 | #include <linux/delay.h> | |
24 | #include <linux/dma-mapping.h> | |
25 | #include <linux/idr.h> | |
26 | #include <linux/interrupt.h> | |
27 | #include <linux/kthread.h> | |
28 | #include <linux/pci.h> | |
5a0e3ad6 | 29 | #include <linux/slab.h> |
92d7f7b0 JS |
30 | #include <linux/spinlock.h> |
31 | ||
32 | #include <scsi/scsi.h> | |
33 | #include <scsi/scsi_device.h> | |
34 | #include <scsi/scsi_host.h> | |
35 | #include <scsi/scsi_transport_fc.h> | |
da0436e9 | 36 | #include "lpfc_hw4.h" |
92d7f7b0 JS |
37 | #include "lpfc_hw.h" |
38 | #include "lpfc_sli.h" | |
da0436e9 | 39 | #include "lpfc_sli4.h" |
ea2151b4 | 40 | #include "lpfc_nl.h" |
92d7f7b0 JS |
41 | #include "lpfc_disc.h" |
42 | #include "lpfc_scsi.h" | |
43 | #include "lpfc.h" | |
44 | #include "lpfc_logmsg.h" | |
45 | #include "lpfc_crtn.h" | |
46 | #include "lpfc_version.h" | |
47 | #include "lpfc_vport.h" | |
48 | ||
49 | inline void lpfc_vport_set_state(struct lpfc_vport *vport, | |
50 | enum fc_vport_state new_state) | |
51 | { | |
52 | struct fc_vport *fc_vport = vport->fc_vport; | |
53 | ||
54 | if (fc_vport) { | |
55 | /* | |
56 | * When the transport defines fc_vport_set state we will replace | |
57 | * this code with the following line | |
58 | */ | |
59 | /* fc_vport_set_state(fc_vport, new_state); */ | |
60 | if (new_state != FC_VPORT_INITIALIZING) | |
61 | fc_vport->vport_last_state = fc_vport->vport_state; | |
62 | fc_vport->vport_state = new_state; | |
63 | } | |
64 | ||
65 | /* for all the error states we will set the invternal state to FAILED */ | |
66 | switch (new_state) { | |
67 | case FC_VPORT_NO_FABRIC_SUPP: | |
68 | case FC_VPORT_NO_FABRIC_RSCS: | |
69 | case FC_VPORT_FABRIC_LOGOUT: | |
70 | case FC_VPORT_FABRIC_REJ_WWN: | |
71 | case FC_VPORT_FAILED: | |
72 | vport->port_state = LPFC_VPORT_FAILED; | |
73 | break; | |
74 | case FC_VPORT_LINKDOWN: | |
75 | vport->port_state = LPFC_VPORT_UNKNOWN; | |
76 | break; | |
77 | default: | |
78 | /* do nothing */ | |
79 | break; | |
80 | } | |
81 | } | |
82 | ||
16a3a208 | 83 | int |
92d7f7b0 JS |
84 | lpfc_alloc_vpi(struct lpfc_hba *phba) |
85 | { | |
6d368e53 | 86 | unsigned long vpi; |
92d7f7b0 JS |
87 | |
88 | spin_lock_irq(&phba->hbalock); | |
858c9f6c JS |
89 | /* Start at bit 1 because vpi zero is reserved for the physical port */ |
90 | vpi = find_next_zero_bit(phba->vpi_bmask, (phba->max_vpi + 1), 1); | |
92d7f7b0 JS |
91 | if (vpi > phba->max_vpi) |
92 | vpi = 0; | |
93 | else | |
94 | set_bit(vpi, phba->vpi_bmask); | |
da0436e9 JS |
95 | if (phba->sli_rev == LPFC_SLI_REV4) |
96 | phba->sli4_hba.max_cfg_param.vpi_used++; | |
92d7f7b0 JS |
97 | spin_unlock_irq(&phba->hbalock); |
98 | return vpi; | |
99 | } | |
100 | ||
101 | static void | |
102 | lpfc_free_vpi(struct lpfc_hba *phba, int vpi) | |
103 | { | |
da0436e9 JS |
104 | if (vpi == 0) |
105 | return; | |
92d7f7b0 JS |
106 | spin_lock_irq(&phba->hbalock); |
107 | clear_bit(vpi, phba->vpi_bmask); | |
da0436e9 JS |
108 | if (phba->sli_rev == LPFC_SLI_REV4) |
109 | phba->sli4_hba.max_cfg_param.vpi_used--; | |
92d7f7b0 JS |
110 | spin_unlock_irq(&phba->hbalock); |
111 | } | |
112 | ||
113 | static int | |
114 | lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport) | |
115 | { | |
116 | LPFC_MBOXQ_t *pmb; | |
117 | MAILBOX_t *mb; | |
118 | struct lpfc_dmabuf *mp; | |
119 | int rc; | |
120 | ||
121 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | |
122 | if (!pmb) { | |
123 | return -ENOMEM; | |
124 | } | |
f4b4c68f | 125 | mb = &pmb->u.mb; |
92d7f7b0 | 126 | |
9f1177a3 JS |
127 | rc = lpfc_read_sparam(phba, pmb, vport->vpi); |
128 | if (rc) { | |
129 | mempool_free(pmb, phba->mbox_mem_pool); | |
130 | return -ENOMEM; | |
131 | } | |
132 | ||
92d7f7b0 JS |
133 | /* |
134 | * Grab buffer pointer and clear context1 so we can use | |
135 | * lpfc_sli_issue_box_wait | |
136 | */ | |
137 | mp = (struct lpfc_dmabuf *) pmb->context1; | |
138 | pmb->context1 = NULL; | |
139 | ||
140 | pmb->vport = vport; | |
141 | rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2); | |
142 | if (rc != MBX_SUCCESS) { | |
98c9ea5c JS |
143 | if (signal_pending(current)) { |
144 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT, | |
145 | "1830 Signal aborted mbxCmd x%x\n", | |
146 | mb->mbxCommand); | |
147 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | |
148 | kfree(mp); | |
149 | if (rc != MBX_TIMEOUT) | |
150 | mempool_free(pmb, phba->mbox_mem_pool); | |
151 | return -EINTR; | |
152 | } else { | |
153 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT, | |
154 | "1818 VPort failed init, mbxCmd x%x " | |
155 | "READ_SPARM mbxStatus x%x, rc = x%x\n", | |
156 | mb->mbxCommand, mb->mbxStatus, rc); | |
157 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | |
158 | kfree(mp); | |
159 | if (rc != MBX_TIMEOUT) | |
160 | mempool_free(pmb, phba->mbox_mem_pool); | |
161 | return -EIO; | |
162 | } | |
92d7f7b0 JS |
163 | } |
164 | ||
165 | memcpy(&vport->fc_sparam, mp->virt, sizeof (struct serv_parm)); | |
166 | memcpy(&vport->fc_nodename, &vport->fc_sparam.nodeName, | |
167 | sizeof (struct lpfc_name)); | |
168 | memcpy(&vport->fc_portname, &vport->fc_sparam.portName, | |
169 | sizeof (struct lpfc_name)); | |
170 | ||
171 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | |
172 | kfree(mp); | |
173 | mempool_free(pmb, phba->mbox_mem_pool); | |
174 | ||
175 | return 0; | |
176 | } | |
177 | ||
178 | static int | |
179 | lpfc_valid_wwn_format(struct lpfc_hba *phba, struct lpfc_name *wwn, | |
180 | const char *name_type) | |
181 | { | |
182 | /* ensure that IEEE format 1 addresses | |
183 | * contain zeros in bits 59-48 | |
184 | */ | |
185 | if (!((wwn->u.wwn[0] >> 4) == 1 && | |
186 | ((wwn->u.wwn[0] & 0xf) != 0 || (wwn->u.wwn[1] & 0xf) != 0))) | |
187 | return 1; | |
188 | ||
189 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | |
e8b62011 | 190 | "1822 Invalid %s: %02x:%02x:%02x:%02x:" |
92d7f7b0 | 191 | "%02x:%02x:%02x:%02x\n", |
e8b62011 | 192 | name_type, |
92d7f7b0 JS |
193 | wwn->u.wwn[0], wwn->u.wwn[1], |
194 | wwn->u.wwn[2], wwn->u.wwn[3], | |
195 | wwn->u.wwn[4], wwn->u.wwn[5], | |
196 | wwn->u.wwn[6], wwn->u.wwn[7]); | |
197 | return 0; | |
198 | } | |
199 | ||
200 | static int | |
201 | lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport) | |
202 | { | |
203 | struct lpfc_vport *vport; | |
549e55cd | 204 | unsigned long flags; |
92d7f7b0 | 205 | |
549e55cd | 206 | spin_lock_irqsave(&phba->hbalock, flags); |
92d7f7b0 JS |
207 | list_for_each_entry(vport, &phba->port_list, listentry) { |
208 | if (vport == new_vport) | |
209 | continue; | |
210 | /* If they match, return not unique */ | |
211 | if (memcmp(&vport->fc_sparam.portName, | |
549e55cd JS |
212 | &new_vport->fc_sparam.portName, |
213 | sizeof(struct lpfc_name)) == 0) { | |
214 | spin_unlock_irqrestore(&phba->hbalock, flags); | |
92d7f7b0 | 215 | return 0; |
549e55cd | 216 | } |
92d7f7b0 | 217 | } |
549e55cd | 218 | spin_unlock_irqrestore(&phba->hbalock, flags); |
92d7f7b0 JS |
219 | return 1; |
220 | } | |
221 | ||
90160e01 | 222 | /** |
3621a710 | 223 | * lpfc_discovery_wait - Wait for driver discovery to quiesce |
90160e01 JS |
224 | * @vport: The virtual port for which this call is being executed. |
225 | * | |
226 | * This driver calls this routine specifically from lpfc_vport_delete | |
227 | * to enforce a synchronous execution of vport | |
228 | * delete relative to discovery activities. The | |
229 | * lpfc_vport_delete routine should not return until it | |
230 | * can reasonably guarantee that discovery has quiesced. | |
231 | * Post FDISC LOGO, the driver must wait until its SAN teardown is | |
232 | * complete and all resources recovered before allowing | |
233 | * cleanup. | |
234 | * | |
235 | * This routine does not require any locks held. | |
236 | **/ | |
237 | static void lpfc_discovery_wait(struct lpfc_vport *vport) | |
238 | { | |
239 | struct lpfc_hba *phba = vport->phba; | |
240 | uint32_t wait_flags = 0; | |
241 | unsigned long wait_time_max; | |
242 | unsigned long start_time; | |
243 | ||
244 | wait_flags = FC_RSCN_MODE | FC_RSCN_DISCOVERY | FC_NLP_MORE | | |
245 | FC_RSCN_DEFERRED | FC_NDISC_ACTIVE | FC_DISC_TMO; | |
246 | ||
247 | /* | |
248 | * The time constraint on this loop is a balance between the | |
249 | * fabric RA_TOV value and dev_loss tmo. The driver's | |
250 | * devloss_tmo is 10 giving this loop a 3x multiplier minimally. | |
251 | */ | |
252 | wait_time_max = msecs_to_jiffies(((phba->fc_ratov * 3) + 3) * 1000); | |
253 | wait_time_max += jiffies; | |
254 | start_time = jiffies; | |
255 | while (time_before(jiffies, wait_time_max)) { | |
256 | if ((vport->num_disc_nodes > 0) || | |
257 | (vport->fc_flag & wait_flags) || | |
258 | ((vport->port_state > LPFC_VPORT_FAILED) && | |
259 | (vport->port_state < LPFC_VPORT_READY))) { | |
21e9a0a5 | 260 | lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT, |
90160e01 | 261 | "1833 Vport discovery quiesce Wait:" |
21e9a0a5 | 262 | " state x%x fc_flags x%x" |
90160e01 JS |
263 | " num_nodes x%x, waiting 1000 msecs" |
264 | " total wait msecs x%x\n", | |
21e9a0a5 JS |
265 | vport->port_state, vport->fc_flag, |
266 | vport->num_disc_nodes, | |
90160e01 JS |
267 | jiffies_to_msecs(jiffies - start_time)); |
268 | msleep(1000); | |
269 | } else { | |
270 | /* Base case. Wait variants satisfied. Break out */ | |
21e9a0a5 | 271 | lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT, |
90160e01 | 272 | "1834 Vport discovery quiesced:" |
21e9a0a5 | 273 | " state x%x fc_flags x%x" |
90160e01 | 274 | " wait msecs x%x\n", |
21e9a0a5 | 275 | vport->port_state, vport->fc_flag, |
90160e01 JS |
276 | jiffies_to_msecs(jiffies |
277 | - start_time)); | |
278 | break; | |
279 | } | |
280 | } | |
281 | ||
282 | if (time_after(jiffies, wait_time_max)) | |
21e9a0a5 | 283 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
90160e01 | 284 | "1835 Vport discovery quiesce failed:" |
21e9a0a5 JS |
285 | " state x%x fc_flags x%x wait msecs x%x\n", |
286 | vport->port_state, vport->fc_flag, | |
90160e01 JS |
287 | jiffies_to_msecs(jiffies - start_time)); |
288 | } | |
289 | ||
92d7f7b0 JS |
290 | int |
291 | lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |
292 | { | |
293 | struct lpfc_nodelist *ndlp; | |
3de2a653 JS |
294 | struct Scsi_Host *shost = fc_vport->shost; |
295 | struct lpfc_vport *pport = (struct lpfc_vport *) shost->hostdata; | |
92d7f7b0 JS |
296 | struct lpfc_hba *phba = pport->phba; |
297 | struct lpfc_vport *vport = NULL; | |
298 | int instance; | |
299 | int vpi; | |
300 | int rc = VPORT_ERROR; | |
98c9ea5c | 301 | int status; |
92d7f7b0 | 302 | |
eada272d | 303 | if ((phba->sli_rev < 3) || !(phba->cfg_enable_npiv)) { |
92d7f7b0 | 304 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
e8b62011 | 305 | "1808 Create VPORT failed: " |
92d7f7b0 | 306 | "NPIV is not enabled: SLImode:%d\n", |
e8b62011 | 307 | phba->sli_rev); |
92d7f7b0 JS |
308 | rc = VPORT_INVAL; |
309 | goto error_out; | |
310 | } | |
311 | ||
312 | vpi = lpfc_alloc_vpi(phba); | |
313 | if (vpi == 0) { | |
314 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | |
e8b62011 | 315 | "1809 Create VPORT failed: " |
92d7f7b0 | 316 | "Max VPORTs (%d) exceeded\n", |
e8b62011 | 317 | phba->max_vpi); |
92d7f7b0 JS |
318 | rc = VPORT_NORESOURCES; |
319 | goto error_out; | |
320 | } | |
321 | ||
92d7f7b0 JS |
322 | /* Assign an unused board number */ |
323 | if ((instance = lpfc_get_instance()) < 0) { | |
324 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | |
e8b62011 JS |
325 | "1810 Create VPORT failed: Cannot get " |
326 | "instance number\n"); | |
92d7f7b0 JS |
327 | lpfc_free_vpi(phba, vpi); |
328 | rc = VPORT_NORESOURCES; | |
329 | goto error_out; | |
330 | } | |
331 | ||
3de2a653 | 332 | vport = lpfc_create_port(phba, instance, &fc_vport->dev); |
92d7f7b0 JS |
333 | if (!vport) { |
334 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | |
e8b62011 | 335 | "1811 Create VPORT failed: vpi x%x\n", vpi); |
92d7f7b0 JS |
336 | lpfc_free_vpi(phba, vpi); |
337 | rc = VPORT_NORESOURCES; | |
338 | goto error_out; | |
339 | } | |
340 | ||
341 | vport->vpi = vpi; | |
858c9f6c JS |
342 | lpfc_debugfs_initialize(vport); |
343 | ||
98c9ea5c JS |
344 | if ((status = lpfc_vport_sparm(phba, vport))) { |
345 | if (status == -EINTR) { | |
346 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
347 | "1831 Create VPORT Interrupted.\n"); | |
348 | rc = VPORT_ERROR; | |
349 | } else { | |
350 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
351 | "1813 Create VPORT failed. " | |
352 | "Cannot get sparam\n"); | |
353 | rc = VPORT_NORESOURCES; | |
354 | } | |
92d7f7b0 JS |
355 | lpfc_free_vpi(phba, vpi); |
356 | destroy_port(vport); | |
92d7f7b0 JS |
357 | goto error_out; |
358 | } | |
359 | ||
1c6834a7 JS |
360 | u64_to_wwn(fc_vport->node_name, vport->fc_nodename.u.wwn); |
361 | u64_to_wwn(fc_vport->port_name, vport->fc_portname.u.wwn); | |
92d7f7b0 JS |
362 | |
363 | memcpy(&vport->fc_sparam.portName, vport->fc_portname.u.wwn, 8); | |
364 | memcpy(&vport->fc_sparam.nodeName, vport->fc_nodename.u.wwn, 8); | |
365 | ||
366 | if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") || | |
367 | !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) { | |
e8b62011 JS |
368 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
369 | "1821 Create VPORT failed. " | |
370 | "Invalid WWN format\n"); | |
92d7f7b0 JS |
371 | lpfc_free_vpi(phba, vpi); |
372 | destroy_port(vport); | |
373 | rc = VPORT_INVAL; | |
374 | goto error_out; | |
375 | } | |
376 | ||
377 | if (!lpfc_unique_wwpn(phba, vport)) { | |
e8b62011 JS |
378 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
379 | "1823 Create VPORT failed. " | |
380 | "Duplicate WWN on HBA\n"); | |
92d7f7b0 JS |
381 | lpfc_free_vpi(phba, vpi); |
382 | destroy_port(vport); | |
383 | rc = VPORT_INVAL; | |
384 | goto error_out; | |
385 | } | |
386 | ||
eada272d JS |
387 | /* Create binary sysfs attribute for vport */ |
388 | lpfc_alloc_sysfs_attr(vport); | |
389 | ||
572709e2 JS |
390 | /* Set the DFT_LUN_Q_DEPTH accordingly */ |
391 | vport->cfg_lun_queue_depth = phba->pport->cfg_lun_queue_depth; | |
392 | ||
92d7f7b0 JS |
393 | *(struct lpfc_vport **)fc_vport->dd_data = vport; |
394 | vport->fc_vport = fc_vport; | |
395 | ||
4258e98e JS |
396 | /* At this point we are fully registered with SCSI Layer. */ |
397 | vport->load_flag |= FC_ALLOW_FDMI; | |
8663cbbe JS |
398 | if (phba->cfg_enable_SmartSAN || |
399 | (phba->cfg_fdmi_on == LPFC_FDMI_SUPPORT)) { | |
4258e98e JS |
400 | /* Setup appropriate attribute masks */ |
401 | vport->fdmi_hba_mask = phba->pport->fdmi_hba_mask; | |
402 | vport->fdmi_port_mask = phba->pport->fdmi_port_mask; | |
403 | } | |
404 | ||
1c6834a7 JS |
405 | /* |
406 | * In SLI4, the vpi must be activated before it can be used | |
407 | * by the port. | |
408 | */ | |
409 | if ((phba->sli_rev == LPFC_SLI_REV4) && | |
76a95d75 JS |
410 | (pport->fc_flag & FC_VFI_REGISTERED)) { |
411 | rc = lpfc_sli4_init_vpi(vport); | |
1c6834a7 JS |
412 | if (rc) { |
413 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | |
414 | "1838 Failed to INIT_VPI on vpi %d " | |
415 | "status %d\n", vpi, rc); | |
416 | rc = VPORT_NORESOURCES; | |
417 | lpfc_free_vpi(phba, vpi); | |
418 | goto error_out; | |
419 | } | |
420 | } else if (phba->sli_rev == LPFC_SLI_REV4) { | |
421 | /* | |
422 | * Driver cannot INIT_VPI now. Set the flags to | |
423 | * init_vpi when reg_vfi complete. | |
424 | */ | |
425 | vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; | |
426 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); | |
427 | rc = VPORT_OK; | |
428 | goto out; | |
429 | } | |
430 | ||
92d7f7b0 | 431 | if ((phba->link_state < LPFC_LINK_UP) || |
1c6834a7 | 432 | (pport->port_state < LPFC_FABRIC_CFG_LINK) || |
76a95d75 | 433 | (phba->fc_topology == LPFC_TOPOLOGY_LOOP)) { |
92d7f7b0 JS |
434 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); |
435 | rc = VPORT_OK; | |
436 | goto out; | |
437 | } | |
438 | ||
439 | if (disable) { | |
eada272d | 440 | lpfc_vport_set_state(vport, FC_VPORT_DISABLED); |
92d7f7b0 JS |
441 | rc = VPORT_OK; |
442 | goto out; | |
443 | } | |
444 | ||
445 | /* Use the Physical nodes Fabric NDLP to determine if the link is | |
446 | * up and ready to FDISC. | |
447 | */ | |
448 | ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); | |
e47c9093 JS |
449 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && |
450 | ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { | |
858c9f6c JS |
451 | if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) { |
452 | lpfc_set_disctmo(vport); | |
453 | lpfc_initial_fdisc(vport); | |
454 | } else { | |
455 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); | |
e8b62011 JS |
456 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
457 | "0262 No NPIV Fabric support\n"); | |
858c9f6c | 458 | } |
92d7f7b0 JS |
459 | } else { |
460 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | |
461 | } | |
462 | rc = VPORT_OK; | |
463 | ||
464 | out: | |
a58cbd52 JS |
465 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
466 | "1825 Vport Created.\n"); | |
92d7f7b0 JS |
467 | lpfc_host_attrib_init(lpfc_shost_from_vport(vport)); |
468 | error_out: | |
469 | return rc; | |
470 | } | |
471 | ||
311464ec | 472 | static int |
92d7f7b0 JS |
473 | disable_vport(struct fc_vport *fc_vport) |
474 | { | |
475 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; | |
476 | struct lpfc_hba *phba = vport->phba; | |
477 | struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL; | |
478 | long timeout; | |
fedd3b7b | 479 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
92d7f7b0 JS |
480 | |
481 | ndlp = lpfc_findnode_did(vport, Fabric_DID); | |
e47c9093 JS |
482 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) |
483 | && phba->link_state >= LPFC_LINK_UP) { | |
92d7f7b0 JS |
484 | vport->unreg_vpi_cmpl = VPORT_INVAL; |
485 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); | |
486 | if (!lpfc_issue_els_npiv_logo(vport, ndlp)) | |
487 | while (vport->unreg_vpi_cmpl == VPORT_INVAL && timeout) | |
488 | timeout = schedule_timeout(timeout); | |
489 | } | |
490 | ||
491 | lpfc_sli_host_down(vport); | |
492 | ||
493 | /* Mark all nodes for discovery so we can remove them by | |
494 | * calling lpfc_cleanup_rpis(vport, 1) | |
495 | */ | |
496 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { | |
e47c9093 JS |
497 | if (!NLP_CHK_NODE_ACT(ndlp)) |
498 | continue; | |
92d7f7b0 JS |
499 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) |
500 | continue; | |
501 | lpfc_disc_state_machine(vport, ndlp, NULL, | |
502 | NLP_EVT_DEVICE_RECOVERY); | |
503 | } | |
504 | lpfc_cleanup_rpis(vport, 1); | |
505 | ||
506 | lpfc_stop_vport_timers(vport); | |
507 | lpfc_unreg_all_rpis(vport); | |
508 | lpfc_unreg_default_rpis(vport); | |
509 | /* | |
510 | * Completion of unreg_vpi (lpfc_mbx_cmpl_unreg_vpi) does the | |
511 | * scsi_host_put() to release the vport. | |
512 | */ | |
513 | lpfc_mbx_unreg_vpi(vport); | |
fedd3b7b JS |
514 | spin_lock_irq(shost->host_lock); |
515 | vport->fc_flag |= FC_VPORT_NEEDS_INIT_VPI; | |
516 | spin_unlock_irq(shost->host_lock); | |
92d7f7b0 JS |
517 | |
518 | lpfc_vport_set_state(vport, FC_VPORT_DISABLED); | |
a58cbd52 JS |
519 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
520 | "1826 Vport Disabled.\n"); | |
92d7f7b0 JS |
521 | return VPORT_OK; |
522 | } | |
523 | ||
311464ec | 524 | static int |
92d7f7b0 JS |
525 | enable_vport(struct fc_vport *fc_vport) |
526 | { | |
527 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; | |
528 | struct lpfc_hba *phba = vport->phba; | |
529 | struct lpfc_nodelist *ndlp = NULL; | |
72100cc4 | 530 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
92d7f7b0 JS |
531 | |
532 | if ((phba->link_state < LPFC_LINK_UP) || | |
76a95d75 | 533 | (phba->fc_topology == LPFC_TOPOLOGY_LOOP)) { |
92d7f7b0 JS |
534 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); |
535 | return VPORT_OK; | |
536 | } | |
537 | ||
72100cc4 | 538 | spin_lock_irq(shost->host_lock); |
92d7f7b0 JS |
539 | vport->load_flag |= FC_LOADING; |
540 | vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; | |
72100cc4 | 541 | spin_unlock_irq(shost->host_lock); |
92d7f7b0 JS |
542 | |
543 | /* Use the Physical nodes Fabric NDLP to determine if the link is | |
544 | * up and ready to FDISC. | |
545 | */ | |
546 | ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); | |
e47c9093 JS |
547 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) |
548 | && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { | |
858c9f6c JS |
549 | if (phba->link_flag & LS_NPIV_FAB_SUPPORTED) { |
550 | lpfc_set_disctmo(vport); | |
551 | lpfc_initial_fdisc(vport); | |
552 | } else { | |
553 | lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP); | |
e8b62011 JS |
554 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, |
555 | "0264 No NPIV Fabric support\n"); | |
858c9f6c | 556 | } |
92d7f7b0 JS |
557 | } else { |
558 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | |
559 | } | |
a58cbd52 JS |
560 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
561 | "1827 Vport Enabled.\n"); | |
92d7f7b0 JS |
562 | return VPORT_OK; |
563 | } | |
564 | ||
565 | int | |
566 | lpfc_vport_disable(struct fc_vport *fc_vport, bool disable) | |
567 | { | |
568 | if (disable) | |
569 | return disable_vport(fc_vport); | |
570 | else | |
571 | return enable_vport(fc_vport); | |
572 | } | |
573 | ||
574 | ||
575 | int | |
576 | lpfc_vport_delete(struct fc_vport *fc_vport) | |
577 | { | |
578 | struct lpfc_nodelist *ndlp = NULL; | |
92d7f7b0 | 579 | struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; |
cc82355a | 580 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
92d7f7b0 JS |
581 | struct lpfc_hba *phba = vport->phba; |
582 | long timeout; | |
16a3a208 | 583 | bool ns_ndlp_referenced = false; |
92d7f7b0 | 584 | |
51ef4c26 JS |
585 | if (vport->port_type == LPFC_PHYSICAL_PORT) { |
586 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
587 | "1812 vport_delete failed: Cannot delete " | |
588 | "physical host\n"); | |
589 | return VPORT_ERROR; | |
590 | } | |
21e9a0a5 JS |
591 | |
592 | /* If the vport is a static vport fail the deletion. */ | |
593 | if ((vport->vport_flag & STATIC_VPORT) && | |
594 | !(phba->pport->load_flag & FC_UNLOADING)) { | |
595 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, | |
596 | "1837 vport_delete failed: Cannot delete " | |
597 | "static vport.\n"); | |
598 | return VPORT_ERROR; | |
599 | } | |
d439d286 JS |
600 | spin_lock_irq(&phba->hbalock); |
601 | vport->load_flag |= FC_UNLOADING; | |
602 | spin_unlock_irq(&phba->hbalock); | |
51ef4c26 JS |
603 | /* |
604 | * If we are not unloading the driver then prevent the vport_delete | |
605 | * from happening until after this vport's discovery is finished. | |
606 | */ | |
607 | if (!(phba->pport->load_flag & FC_UNLOADING)) { | |
608 | int check_count = 0; | |
609 | while (check_count < ((phba->fc_ratov * 3) + 3) && | |
610 | vport->port_state > LPFC_VPORT_FAILED && | |
611 | vport->port_state < LPFC_VPORT_READY) { | |
612 | check_count++; | |
613 | msleep(1000); | |
614 | } | |
615 | if (vport->port_state > LPFC_VPORT_FAILED && | |
616 | vport->port_state < LPFC_VPORT_READY) | |
617 | return -EAGAIN; | |
618 | } | |
92d7f7b0 JS |
619 | /* |
620 | * This is a bit of a mess. We want to ensure the shost doesn't get | |
621 | * torn down until we're done with the embedded lpfc_vport structure. | |
622 | * | |
623 | * Beyond holding a reference for this function, we also need a | |
624 | * reference for outstanding I/O requests we schedule during delete | |
625 | * processing. But once we scsi_remove_host() we can no longer obtain | |
626 | * a reference through scsi_host_get(). | |
627 | * | |
628 | * So we take two references here. We release one reference at the | |
629 | * bottom of the function -- after delinking the vport. And we | |
630 | * release the other at the completion of the unreg_vpi that get's | |
631 | * initiated after we've disposed of all other resources associated | |
632 | * with the port. | |
633 | */ | |
d7c255b2 | 634 | if (!scsi_host_get(shost)) |
92d7f7b0 | 635 | return VPORT_INVAL; |
d7c255b2 JS |
636 | if (!scsi_host_get(shost)) { |
637 | scsi_host_put(shost); | |
638 | return VPORT_INVAL; | |
639 | } | |
eada272d JS |
640 | lpfc_free_sysfs_attr(vport); |
641 | ||
858c9f6c | 642 | lpfc_debugfs_terminate(vport); |
eada272d | 643 | |
16a3a208 JS |
644 | /* |
645 | * The call to fc_remove_host might release the NameServer ndlp. Since | |
646 | * we might need to use the ndlp to send the DA_ID CT command, | |
647 | * increment the reference for the NameServer ndlp to prevent it from | |
648 | * being released. | |
649 | */ | |
650 | ndlp = lpfc_findnode_did(vport, NameServer_DID); | |
651 | if (ndlp && NLP_CHK_NODE_ACT(ndlp)) { | |
652 | lpfc_nlp_get(ndlp); | |
653 | ns_ndlp_referenced = true; | |
654 | } | |
655 | ||
eada272d | 656 | /* Remove FC host and then SCSI host with the vport */ |
cc82355a JS |
657 | fc_remove_host(shost); |
658 | scsi_remove_host(shost); | |
92d7f7b0 JS |
659 | |
660 | ndlp = lpfc_findnode_did(phba->pport, Fabric_DID); | |
e47c9093 JS |
661 | |
662 | /* In case of driver unload, we shall not perform fabric logo as the | |
663 | * worker thread already stopped at this stage and, in this case, we | |
664 | * can safely skip the fabric logo. | |
665 | */ | |
666 | if (phba->pport->load_flag & FC_UNLOADING) { | |
667 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && | |
668 | ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && | |
669 | phba->link_state >= LPFC_LINK_UP) { | |
670 | /* First look for the Fabric ndlp */ | |
671 | ndlp = lpfc_findnode_did(vport, Fabric_DID); | |
672 | if (!ndlp) | |
673 | goto skip_logo; | |
674 | else if (!NLP_CHK_NODE_ACT(ndlp)) { | |
675 | ndlp = lpfc_enable_node(vport, ndlp, | |
676 | NLP_STE_UNUSED_NODE); | |
677 | if (!ndlp) | |
678 | goto skip_logo; | |
679 | } | |
680 | /* Remove ndlp from vport npld list */ | |
681 | lpfc_dequeue_node(vport, ndlp); | |
682 | ||
683 | /* Indicate free memory when release */ | |
684 | spin_lock_irq(&phba->ndlp_lock); | |
685 | NLP_SET_FREE_REQ(ndlp); | |
686 | spin_unlock_irq(&phba->ndlp_lock); | |
687 | /* Kick off release ndlp when it can be safely done */ | |
688 | lpfc_nlp_put(ndlp); | |
689 | } | |
690 | goto skip_logo; | |
691 | } | |
692 | ||
693 | /* Otherwise, we will perform fabric logo as needed */ | |
694 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && | |
695 | ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && | |
58da1ffb | 696 | phba->link_state >= LPFC_LINK_UP && |
76a95d75 | 697 | phba->fc_topology != LPFC_TOPOLOGY_LOOP) { |
7ee5d43e JS |
698 | if (vport->cfg_enable_da_id) { |
699 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); | |
700 | if (!lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0)) | |
701 | while (vport->ct_flags && timeout) | |
702 | timeout = schedule_timeout(timeout); | |
703 | else | |
704 | lpfc_printf_log(vport->phba, KERN_WARNING, | |
705 | LOG_VPORT, | |
706 | "1829 CT command failed to " | |
e4e74273 | 707 | "delete objects on fabric\n"); |
7ee5d43e | 708 | } |
92d7f7b0 JS |
709 | /* First look for the Fabric ndlp */ |
710 | ndlp = lpfc_findnode_did(vport, Fabric_DID); | |
711 | if (!ndlp) { | |
712 | /* Cannot find existing Fabric ndlp, allocate one */ | |
713 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | |
714 | if (!ndlp) | |
715 | goto skip_logo; | |
716 | lpfc_nlp_init(vport, ndlp, Fabric_DID); | |
e47c9093 JS |
717 | /* Indicate free memory when release */ |
718 | NLP_SET_FREE_REQ(ndlp); | |
92d7f7b0 | 719 | } else { |
73d91e50 | 720 | if (!NLP_CHK_NODE_ACT(ndlp)) { |
e47c9093 JS |
721 | ndlp = lpfc_enable_node(vport, ndlp, |
722 | NLP_STE_UNUSED_NODE); | |
723 | if (!ndlp) | |
724 | goto skip_logo; | |
73d91e50 | 725 | } |
e47c9093 | 726 | |
73d91e50 | 727 | /* Remove ndlp from vport list */ |
92d7f7b0 | 728 | lpfc_dequeue_node(vport, ndlp); |
e47c9093 JS |
729 | spin_lock_irq(&phba->ndlp_lock); |
730 | if (!NLP_CHK_FREE_REQ(ndlp)) | |
731 | /* Indicate free memory when release */ | |
732 | NLP_SET_FREE_REQ(ndlp); | |
733 | else { | |
734 | /* Skip this if ndlp is already in free mode */ | |
735 | spin_unlock_irq(&phba->ndlp_lock); | |
736 | goto skip_logo; | |
737 | } | |
738 | spin_unlock_irq(&phba->ndlp_lock); | |
92d7f7b0 | 739 | } |
73d91e50 JS |
740 | |
741 | /* | |
742 | * If the vpi is not registered, then a valid FDISC doesn't | |
743 | * exist and there is no need for a ELS LOGO. Just cleanup | |
744 | * the ndlp. | |
745 | */ | |
746 | if (!(vport->vpi_state & LPFC_VPI_REGISTERED)) { | |
747 | lpfc_nlp_put(ndlp); | |
5ffc266e | 748 | goto skip_logo; |
73d91e50 JS |
749 | } |
750 | ||
92d7f7b0 JS |
751 | vport->unreg_vpi_cmpl = VPORT_INVAL; |
752 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); | |
753 | if (!lpfc_issue_els_npiv_logo(vport, ndlp)) | |
754 | while (vport->unreg_vpi_cmpl == VPORT_INVAL && timeout) | |
755 | timeout = schedule_timeout(timeout); | |
756 | } | |
757 | ||
90160e01 JS |
758 | if (!(phba->pport->load_flag & FC_UNLOADING)) |
759 | lpfc_discovery_wait(vport); | |
760 | ||
92d7f7b0 | 761 | skip_logo: |
16a3a208 JS |
762 | |
763 | /* | |
764 | * If the NameServer ndlp has been incremented to allow the DA_ID CT | |
765 | * command to be sent, decrement the ndlp now. | |
766 | */ | |
767 | if (ns_ndlp_referenced) { | |
768 | ndlp = lpfc_findnode_did(vport, NameServer_DID); | |
769 | lpfc_nlp_put(ndlp); | |
770 | } | |
771 | ||
87af33fe | 772 | lpfc_cleanup(vport); |
92d7f7b0 JS |
773 | lpfc_sli_host_down(vport); |
774 | ||
92d7f7b0 | 775 | lpfc_stop_vport_timers(vport); |
87af33fe JS |
776 | |
777 | if (!(phba->pport->load_flag & FC_UNLOADING)) { | |
e47c9093 | 778 | lpfc_unreg_all_rpis(vport); |
87af33fe JS |
779 | lpfc_unreg_default_rpis(vport); |
780 | /* | |
781 | * Completion of unreg_vpi (lpfc_mbx_cmpl_unreg_vpi) | |
782 | * does the scsi_host_put() to release the vport. | |
783 | */ | |
cc82355a JS |
784 | if (!(vport->vpi_state & LPFC_VPI_REGISTERED) || |
785 | lpfc_mbx_unreg_vpi(vport)) | |
d7c255b2 JS |
786 | scsi_host_put(shost); |
787 | } else | |
788 | scsi_host_put(shost); | |
92d7f7b0 JS |
789 | |
790 | lpfc_free_vpi(phba, vport->vpi); | |
791 | vport->work_port_events = 0; | |
792 | spin_lock_irq(&phba->hbalock); | |
793 | list_del_init(&vport->listentry); | |
794 | spin_unlock_irq(&phba->hbalock); | |
a58cbd52 JS |
795 | lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT, |
796 | "1828 Vport Deleted.\n"); | |
92d7f7b0 | 797 | scsi_host_put(shost); |
51ef4c26 | 798 | return VPORT_OK; |
92d7f7b0 JS |
799 | } |
800 | ||
549e55cd JS |
801 | struct lpfc_vport ** |
802 | lpfc_create_vport_work_array(struct lpfc_hba *phba) | |
803 | { | |
804 | struct lpfc_vport *port_iterator; | |
805 | struct lpfc_vport **vports; | |
806 | int index = 0; | |
21e9a0a5 | 807 | vports = kzalloc((phba->max_vports + 1) * sizeof(struct lpfc_vport *), |
549e55cd JS |
808 | GFP_KERNEL); |
809 | if (vports == NULL) | |
810 | return NULL; | |
811 | spin_lock_irq(&phba->hbalock); | |
812 | list_for_each_entry(port_iterator, &phba->port_list, listentry) { | |
df9e1b59 JS |
813 | if (port_iterator->load_flag & FC_UNLOADING) |
814 | continue; | |
e8b62011 | 815 | if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) { |
df9e1b59 | 816 | lpfc_printf_vlog(port_iterator, KERN_ERR, LOG_VPORT, |
e8b62011 JS |
817 | "1801 Create vport work array FAILED: " |
818 | "cannot do scsi_host_get\n"); | |
549e55cd | 819 | continue; |
e8b62011 | 820 | } |
549e55cd JS |
821 | vports[index++] = port_iterator; |
822 | } | |
823 | spin_unlock_irq(&phba->hbalock); | |
824 | return vports; | |
825 | } | |
826 | ||
827 | void | |
09372820 | 828 | lpfc_destroy_vport_work_array(struct lpfc_hba *phba, struct lpfc_vport **vports) |
549e55cd JS |
829 | { |
830 | int i; | |
831 | if (vports == NULL) | |
832 | return; | |
98fc5dd9 | 833 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) |
549e55cd JS |
834 | scsi_host_put(lpfc_shost_from_vport(vports[i])); |
835 | kfree(vports); | |
836 | } | |
ea2151b4 JS |
837 | |
838 | ||
839 | /** | |
3621a710 | 840 | * lpfc_vport_reset_stat_data - Reset the statistical data for the vport |
ea2151b4 JS |
841 | * @vport: Pointer to vport object. |
842 | * | |
843 | * This function resets the statistical data for the vport. This function | |
844 | * is called with the host_lock held | |
845 | **/ | |
846 | void | |
847 | lpfc_vport_reset_stat_data(struct lpfc_vport *vport) | |
848 | { | |
849 | struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL; | |
850 | ||
851 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { | |
852 | if (!NLP_CHK_NODE_ACT(ndlp)) | |
853 | continue; | |
854 | if (ndlp->lat_data) | |
855 | memset(ndlp->lat_data, 0, LPFC_MAX_BUCKET_COUNT * | |
856 | sizeof(struct lpfc_scsicmd_bkt)); | |
857 | } | |
858 | } | |
859 | ||
860 | ||
861 | /** | |
3621a710 | 862 | * lpfc_alloc_bucket - Allocate data buffer required for statistical data |
ea2151b4 JS |
863 | * @vport: Pointer to vport object. |
864 | * | |
865 | * This function allocates data buffer required for all the FC | |
866 | * nodes of the vport to collect statistical data. | |
867 | **/ | |
868 | void | |
869 | lpfc_alloc_bucket(struct lpfc_vport *vport) | |
870 | { | |
871 | struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL; | |
872 | ||
873 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { | |
874 | if (!NLP_CHK_NODE_ACT(ndlp)) | |
875 | continue; | |
876 | ||
877 | kfree(ndlp->lat_data); | |
878 | ndlp->lat_data = NULL; | |
879 | ||
880 | if (ndlp->nlp_state == NLP_STE_MAPPED_NODE) { | |
881 | ndlp->lat_data = kcalloc(LPFC_MAX_BUCKET_COUNT, | |
882 | sizeof(struct lpfc_scsicmd_bkt), | |
883 | GFP_ATOMIC); | |
884 | ||
885 | if (!ndlp->lat_data) | |
886 | lpfc_printf_vlog(vport, KERN_ERR, LOG_NODE, | |
887 | "0287 lpfc_alloc_bucket failed to " | |
888 | "allocate statistical data buffer DID " | |
889 | "0x%x\n", ndlp->nlp_DID); | |
890 | } | |
891 | } | |
892 | } | |
893 | ||
894 | /** | |
3621a710 | 895 | * lpfc_free_bucket - Free data buffer required for statistical data |
ea2151b4 JS |
896 | * @vport: Pointer to vport object. |
897 | * | |
898 | * Th function frees statistical data buffer of all the FC | |
899 | * nodes of the vport. | |
900 | **/ | |
901 | void | |
902 | lpfc_free_bucket(struct lpfc_vport *vport) | |
903 | { | |
904 | struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL; | |
905 | ||
906 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { | |
907 | if (!NLP_CHK_NODE_ACT(ndlp)) | |
908 | continue; | |
909 | ||
910 | kfree(ndlp->lat_data); | |
911 | ndlp->lat_data = NULL; | |
912 | } | |
913 | } |