1 /* 2 * Copyright 2008 Cisco Systems, Inc. All rights reserved. 3 * Copyright 2007 Nuova Systems, Inc. All rights reserved. 4 * 5 * This program is free software; you may redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 10 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 11 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 12 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 13 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 14 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 15 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 16 * SOFTWARE. 17 */ 18 #include <linux/module.h> 19 #include <linux/mempool.h> 20 #include <linux/string.h> 21 #include <linux/slab.h> 22 #include <linux/errno.h> 23 #include <linux/init.h> 24 #include <linux/pci.h> 25 #include <linux/skbuff.h> 26 #include <linux/interrupt.h> 27 #include <linux/spinlock.h> 28 #include <linux/workqueue.h> 29 #include <linux/if_ether.h> 30 #include <scsi/fc/fc_fip.h> 31 #include <scsi/scsi_host.h> 32 #include <scsi/scsi_transport.h> 33 #include <scsi/scsi_transport_fc.h> 34 #include <scsi/scsi_tcq.h> 35 #include <scsi/libfc.h> 36 #include <scsi/fc_frame.h> 37 38 #include "vnic_dev.h" 39 #include "vnic_intr.h" 40 #include "vnic_stats.h" 41 #include "fnic_io.h" 42 #include "fnic_fip.h" 43 #include "fnic.h" 44 45 #define PCI_DEVICE_ID_CISCO_FNIC 0x0045 46 47 /* Timer to poll notification area for events. Used for MSI interrupts */ 48 #define FNIC_NOTIFY_TIMER_PERIOD (2 * HZ) 49 50 static struct kmem_cache *fnic_sgl_cache[FNIC_SGL_NUM_CACHES]; 51 static struct kmem_cache *fnic_io_req_cache; 52 static LIST_HEAD(fnic_list); 53 static DEFINE_SPINLOCK(fnic_list_lock); 54 55 /* Supported devices by fnic module */ 56 static struct pci_device_id fnic_id_table[] = { 57 { PCI_DEVICE(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_FNIC) }, 58 { 0, } 59 }; 60 61 MODULE_DESCRIPTION(DRV_DESCRIPTION); 62 MODULE_AUTHOR("Abhijeet Joglekar <abjoglek@cisco.com>, " 63 "Joseph R. Eykholt <jeykholt@cisco.com>"); 64 MODULE_LICENSE("GPL v2"); 65 MODULE_VERSION(DRV_VERSION); 66 MODULE_DEVICE_TABLE(pci, fnic_id_table); 67 68 unsigned int fnic_log_level; 69 module_param(fnic_log_level, int, S_IRUGO|S_IWUSR); 70 MODULE_PARM_DESC(fnic_log_level, "bit mask of fnic logging levels"); 71 72 73 unsigned int io_completions = FNIC_DFLT_IO_COMPLETIONS; 74 module_param(io_completions, int, S_IRUGO|S_IWUSR); 75 MODULE_PARM_DESC(io_completions, "Max CQ entries to process at a time"); 76 77 unsigned int fnic_trace_max_pages = 16; 78 module_param(fnic_trace_max_pages, uint, S_IRUGO|S_IWUSR); 79 MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages " 80 "for fnic trace buffer"); 81 82 unsigned int fnic_fc_trace_max_pages = 64; 83 module_param(fnic_fc_trace_max_pages, uint, S_IRUGO|S_IWUSR); 84 MODULE_PARM_DESC(fnic_fc_trace_max_pages, 85 "Total allocated memory pages for fc trace buffer"); 86 87 static unsigned int fnic_max_qdepth = FNIC_DFLT_QUEUE_DEPTH; 88 module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR); 89 MODULE_PARM_DESC(fnic_max_qdepth, "Queue depth to report for each LUN"); 90 91 static struct libfc_function_template fnic_transport_template = { 92 .frame_send = fnic_send, 93 .lport_set_port_id = fnic_set_port_id, 94 .fcp_abort_io = fnic_empty_scsi_cleanup, 95 .fcp_cleanup = fnic_empty_scsi_cleanup, 96 .exch_mgr_reset = fnic_exch_mgr_reset 97 }; 98 99 static int fnic_slave_alloc(struct scsi_device *sdev) 100 { 101 struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 102 103 if (!rport || fc_remote_port_chkready(rport)) 104 return -ENXIO; 105 106 scsi_change_queue_depth(sdev, fnic_max_qdepth); 107 return 0; 108 } 109 110 static struct scsi_host_template fnic_host_template = { 111 .module = THIS_MODULE, 112 .name = DRV_NAME, 113 .queuecommand = fnic_queuecommand, 114 .eh_timed_out = fc_eh_timed_out, 115 .eh_abort_handler = fnic_abort_cmd, 116 .eh_device_reset_handler = fnic_device_reset, 117 .eh_host_reset_handler = fnic_host_reset, 118 .slave_alloc = fnic_slave_alloc, 119 .change_queue_depth = scsi_change_queue_depth, 120 .this_id = -1, 121 .cmd_per_lun = 3, 122 .can_queue = FNIC_DFLT_IO_REQ, 123 .sg_tablesize = FNIC_MAX_SG_DESC_CNT, 124 .max_sectors = 0xffff, 125 .shost_groups = fnic_host_groups, 126 .track_queue_depth = 1, 127 .cmd_size = sizeof(struct fnic_cmd_priv), 128 }; 129 130 static void 131 fnic_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout) 132 { 133 if (timeout) 134 rport->dev_loss_tmo = timeout; 135 else 136 rport->dev_loss_tmo = 1; 137 } 138 139 static void fnic_get_host_speed(struct Scsi_Host *shost); 140 static struct scsi_transport_template *fnic_fc_transport; 141 static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *); 142 static void fnic_reset_host_stats(struct Scsi_Host *); 143 144 static struct fc_function_template fnic_fc_functions = { 145 146 .show_host_node_name = 1, 147 .show_host_port_name = 1, 148 .show_host_supported_classes = 1, 149 .show_host_supported_fc4s = 1, 150 .show_host_active_fc4s = 1, 151 .show_host_maxframe_size = 1, 152 .show_host_port_id = 1, 153 .show_host_supported_speeds = 1, 154 .get_host_speed = fnic_get_host_speed, 155 .show_host_speed = 1, 156 .show_host_port_type = 1, 157 .get_host_port_state = fc_get_host_port_state, 158 .show_host_port_state = 1, 159 .show_host_symbolic_name = 1, 160 .show_rport_maxframe_size = 1, 161 .show_rport_supported_classes = 1, 162 .show_host_fabric_name = 1, 163 .show_starget_node_name = 1, 164 .show_starget_port_name = 1, 165 .show_starget_port_id = 1, 166 .show_rport_dev_loss_tmo = 1, 167 .set_rport_dev_loss_tmo = fnic_set_rport_dev_loss_tmo, 168 .issue_fc_host_lip = fnic_reset, 169 .get_fc_host_stats = fnic_get_stats, 170 .reset_fc_host_stats = fnic_reset_host_stats, 171 .dd_fcrport_size = sizeof(struct fc_rport_libfc_priv), 172 .terminate_rport_io = fnic_terminate_rport_io, 173 .bsg_request = fc_lport_bsg_request, 174 }; 175 176 static void fnic_get_host_speed(struct Scsi_Host *shost) 177 { 178 struct fc_lport *lp = shost_priv(shost); 179 struct fnic *fnic = lport_priv(lp); 180 u32 port_speed = vnic_dev_port_speed(fnic->vdev); 181 182 /* Add in other values as they get defined in fw */ 183 switch (port_speed) { 184 case DCEM_PORTSPEED_10G: 185 fc_host_speed(shost) = FC_PORTSPEED_10GBIT; 186 break; 187 case DCEM_PORTSPEED_20G: 188 fc_host_speed(shost) = FC_PORTSPEED_20GBIT; 189 break; 190 case DCEM_PORTSPEED_25G: 191 fc_host_speed(shost) = FC_PORTSPEED_25GBIT; 192 break; 193 case DCEM_PORTSPEED_40G: 194 case DCEM_PORTSPEED_4x10G: 195 fc_host_speed(shost) = FC_PORTSPEED_40GBIT; 196 break; 197 case DCEM_PORTSPEED_100G: 198 fc_host_speed(shost) = FC_PORTSPEED_100GBIT; 199 break; 200 default: 201 fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; 202 break; 203 } 204 } 205 206 static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *host) 207 { 208 int ret; 209 struct fc_lport *lp = shost_priv(host); 210 struct fnic *fnic = lport_priv(lp); 211 struct fc_host_statistics *stats = &lp->host_stats; 212 struct vnic_stats *vs; 213 unsigned long flags; 214 215 if (time_before(jiffies, fnic->stats_time + HZ / FNIC_STATS_RATE_LIMIT)) 216 return stats; 217 fnic->stats_time = jiffies; 218 219 spin_lock_irqsave(&fnic->fnic_lock, flags); 220 ret = vnic_dev_stats_dump(fnic->vdev, &fnic->stats); 221 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 222 223 if (ret) { 224 FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, 225 "fnic: Get vnic stats failed" 226 " 0x%x", ret); 227 return stats; 228 } 229 vs = fnic->stats; 230 stats->tx_frames = vs->tx.tx_unicast_frames_ok; 231 stats->tx_words = vs->tx.tx_unicast_bytes_ok / 4; 232 stats->rx_frames = vs->rx.rx_unicast_frames_ok; 233 stats->rx_words = vs->rx.rx_unicast_bytes_ok / 4; 234 stats->error_frames = vs->tx.tx_errors + vs->rx.rx_errors; 235 stats->dumped_frames = vs->tx.tx_drops + vs->rx.rx_drop; 236 stats->invalid_crc_count = vs->rx.rx_crc_errors; 237 stats->seconds_since_last_reset = 238 (jiffies - fnic->stats_reset_time) / HZ; 239 stats->fcp_input_megabytes = div_u64(fnic->fcp_input_bytes, 1000000); 240 stats->fcp_output_megabytes = div_u64(fnic->fcp_output_bytes, 1000000); 241 242 return stats; 243 } 244 245 /* 246 * fnic_dump_fchost_stats 247 * note : dumps fc_statistics into system logs 248 */ 249 void fnic_dump_fchost_stats(struct Scsi_Host *host, 250 struct fc_host_statistics *stats) 251 { 252 FNIC_MAIN_NOTE(KERN_NOTICE, host, 253 "fnic: seconds since last reset = %llu\n", 254 stats->seconds_since_last_reset); 255 FNIC_MAIN_NOTE(KERN_NOTICE, host, 256 "fnic: tx frames = %llu\n", 257 stats->tx_frames); 258 FNIC_MAIN_NOTE(KERN_NOTICE, host, 259 "fnic: tx words = %llu\n", 260 stats->tx_words); 261 FNIC_MAIN_NOTE(KERN_NOTICE, host, 262 "fnic: rx frames = %llu\n", 263 stats->rx_frames); 264 FNIC_MAIN_NOTE(KERN_NOTICE, host, 265 "fnic: rx words = %llu\n", 266 stats->rx_words); 267 FNIC_MAIN_NOTE(KERN_NOTICE, host, 268 "fnic: lip count = %llu\n", 269 stats->lip_count); 270 FNIC_MAIN_NOTE(KERN_NOTICE, host, 271 "fnic: nos count = %llu\n", 272 stats->nos_count); 273 FNIC_MAIN_NOTE(KERN_NOTICE, host, 274 "fnic: error frames = %llu\n", 275 stats->error_frames); 276 FNIC_MAIN_NOTE(KERN_NOTICE, host, 277 "fnic: dumped frames = %llu\n", 278 stats->dumped_frames); 279 FNIC_MAIN_NOTE(KERN_NOTICE, host, 280 "fnic: link failure count = %llu\n", 281 stats->link_failure_count); 282 FNIC_MAIN_NOTE(KERN_NOTICE, host, 283 "fnic: loss of sync count = %llu\n", 284 stats->loss_of_sync_count); 285 FNIC_MAIN_NOTE(KERN_NOTICE, host, 286 "fnic: loss of signal count = %llu\n", 287 stats->loss_of_signal_count); 288 FNIC_MAIN_NOTE(KERN_NOTICE, host, 289 "fnic: prim seq protocol err count = %llu\n", 290 stats->prim_seq_protocol_err_count); 291 FNIC_MAIN_NOTE(KERN_NOTICE, host, 292 "fnic: invalid tx word count= %llu\n", 293 stats->invalid_tx_word_count); 294 FNIC_MAIN_NOTE(KERN_NOTICE, host, 295 "fnic: invalid crc count = %llu\n", 296 stats->invalid_crc_count); 297 FNIC_MAIN_NOTE(KERN_NOTICE, host, 298 "fnic: fcp input requests = %llu\n", 299 stats->fcp_input_requests); 300 FNIC_MAIN_NOTE(KERN_NOTICE, host, 301 "fnic: fcp output requests = %llu\n", 302 stats->fcp_output_requests); 303 FNIC_MAIN_NOTE(KERN_NOTICE, host, 304 "fnic: fcp control requests = %llu\n", 305 stats->fcp_control_requests); 306 FNIC_MAIN_NOTE(KERN_NOTICE, host, 307 "fnic: fcp input megabytes = %llu\n", 308 stats->fcp_input_megabytes); 309 FNIC_MAIN_NOTE(KERN_NOTICE, host, 310 "fnic: fcp output megabytes = %llu\n", 311 stats->fcp_output_megabytes); 312 return; 313 } 314 315 /* 316 * fnic_reset_host_stats : clears host stats 317 * note : called when reset_statistics set under sysfs dir 318 */ 319 static void fnic_reset_host_stats(struct Scsi_Host *host) 320 { 321 int ret; 322 struct fc_lport *lp = shost_priv(host); 323 struct fnic *fnic = lport_priv(lp); 324 struct fc_host_statistics *stats; 325 unsigned long flags; 326 327 /* dump current stats, before clearing them */ 328 stats = fnic_get_stats(host); 329 fnic_dump_fchost_stats(host, stats); 330 331 spin_lock_irqsave(&fnic->fnic_lock, flags); 332 ret = vnic_dev_stats_clear(fnic->vdev); 333 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 334 335 if (ret) { 336 FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host, 337 "fnic: Reset vnic stats failed" 338 " 0x%x", ret); 339 return; 340 } 341 fnic->stats_reset_time = jiffies; 342 memset(stats, 0, sizeof(*stats)); 343 344 return; 345 } 346 347 void fnic_log_q_error(struct fnic *fnic) 348 { 349 unsigned int i; 350 u32 error_status; 351 352 for (i = 0; i < fnic->raw_wq_count; i++) { 353 error_status = ioread32(&fnic->wq[i].ctrl->error_status); 354 if (error_status) 355 shost_printk(KERN_ERR, fnic->lport->host, 356 "WQ[%d] error_status" 357 " %d\n", i, error_status); 358 } 359 360 for (i = 0; i < fnic->rq_count; i++) { 361 error_status = ioread32(&fnic->rq[i].ctrl->error_status); 362 if (error_status) 363 shost_printk(KERN_ERR, fnic->lport->host, 364 "RQ[%d] error_status" 365 " %d\n", i, error_status); 366 } 367 368 for (i = 0; i < fnic->wq_copy_count; i++) { 369 error_status = ioread32(&fnic->wq_copy[i].ctrl->error_status); 370 if (error_status) 371 shost_printk(KERN_ERR, fnic->lport->host, 372 "CWQ[%d] error_status" 373 " %d\n", i, error_status); 374 } 375 } 376 377 void fnic_handle_link_event(struct fnic *fnic) 378 { 379 unsigned long flags; 380 381 spin_lock_irqsave(&fnic->fnic_lock, flags); 382 if (fnic->stop_rx_link_events) { 383 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 384 return; 385 } 386 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 387 388 queue_work(fnic_event_queue, &fnic->link_work); 389 390 } 391 392 static int fnic_notify_set(struct fnic *fnic) 393 { 394 int err; 395 396 switch (vnic_dev_get_intr_mode(fnic->vdev)) { 397 case VNIC_DEV_INTR_MODE_INTX: 398 err = vnic_dev_notify_set(fnic->vdev, FNIC_INTX_NOTIFY); 399 break; 400 case VNIC_DEV_INTR_MODE_MSI: 401 err = vnic_dev_notify_set(fnic->vdev, -1); 402 break; 403 case VNIC_DEV_INTR_MODE_MSIX: 404 err = vnic_dev_notify_set(fnic->vdev, FNIC_MSIX_ERR_NOTIFY); 405 break; 406 default: 407 shost_printk(KERN_ERR, fnic->lport->host, 408 "Interrupt mode should be set up" 409 " before devcmd notify set %d\n", 410 vnic_dev_get_intr_mode(fnic->vdev)); 411 err = -1; 412 break; 413 } 414 415 return err; 416 } 417 418 static void fnic_notify_timer(struct timer_list *t) 419 { 420 struct fnic *fnic = from_timer(fnic, t, notify_timer); 421 422 fnic_handle_link_event(fnic); 423 mod_timer(&fnic->notify_timer, 424 round_jiffies(jiffies + FNIC_NOTIFY_TIMER_PERIOD)); 425 } 426 427 static void fnic_fip_notify_timer(struct timer_list *t) 428 { 429 struct fnic *fnic = from_timer(fnic, t, fip_timer); 430 431 fnic_handle_fip_timer(fnic); 432 } 433 434 static void fnic_notify_timer_start(struct fnic *fnic) 435 { 436 switch (vnic_dev_get_intr_mode(fnic->vdev)) { 437 case VNIC_DEV_INTR_MODE_MSI: 438 /* 439 * Schedule first timeout immediately. The driver is 440 * initiatialized and ready to look for link up notification 441 */ 442 mod_timer(&fnic->notify_timer, jiffies); 443 break; 444 default: 445 /* Using intr for notification for INTx/MSI-X */ 446 break; 447 } 448 } 449 450 static int fnic_dev_wait(struct vnic_dev *vdev, 451 int (*start)(struct vnic_dev *, int), 452 int (*finished)(struct vnic_dev *, int *), 453 int arg) 454 { 455 unsigned long time; 456 int done; 457 int err; 458 int count; 459 460 count = 0; 461 462 err = start(vdev, arg); 463 if (err) 464 return err; 465 466 /* Wait for func to complete. 467 * Sometime schedule_timeout_uninterruptible take long time 468 * to wake up so we do not retry as we are only waiting for 469 * 2 seconds in while loop. By adding count, we make sure 470 * we try atleast three times before returning -ETIMEDOUT 471 */ 472 time = jiffies + (HZ * 2); 473 do { 474 err = finished(vdev, &done); 475 count++; 476 if (err) 477 return err; 478 if (done) 479 return 0; 480 schedule_timeout_uninterruptible(HZ / 10); 481 } while (time_after(time, jiffies) || (count < 3)); 482 483 return -ETIMEDOUT; 484 } 485 486 static int fnic_cleanup(struct fnic *fnic) 487 { 488 unsigned int i; 489 int err; 490 491 vnic_dev_disable(fnic->vdev); 492 for (i = 0; i < fnic->intr_count; i++) 493 vnic_intr_mask(&fnic->intr[i]); 494 495 for (i = 0; i < fnic->rq_count; i++) { 496 err = vnic_rq_disable(&fnic->rq[i]); 497 if (err) 498 return err; 499 } 500 for (i = 0; i < fnic->raw_wq_count; i++) { 501 err = vnic_wq_disable(&fnic->wq[i]); 502 if (err) 503 return err; 504 } 505 for (i = 0; i < fnic->wq_copy_count; i++) { 506 err = vnic_wq_copy_disable(&fnic->wq_copy[i]); 507 if (err) 508 return err; 509 } 510 511 /* Clean up completed IOs and FCS frames */ 512 fnic_wq_copy_cmpl_handler(fnic, io_completions); 513 fnic_wq_cmpl_handler(fnic, -1); 514 fnic_rq_cmpl_handler(fnic, -1); 515 516 /* Clean up the IOs and FCS frames that have not completed */ 517 for (i = 0; i < fnic->raw_wq_count; i++) 518 vnic_wq_clean(&fnic->wq[i], fnic_free_wq_buf); 519 for (i = 0; i < fnic->rq_count; i++) 520 vnic_rq_clean(&fnic->rq[i], fnic_free_rq_buf); 521 for (i = 0; i < fnic->wq_copy_count; i++) 522 vnic_wq_copy_clean(&fnic->wq_copy[i], 523 fnic_wq_copy_cleanup_handler); 524 525 for (i = 0; i < fnic->cq_count; i++) 526 vnic_cq_clean(&fnic->cq[i]); 527 for (i = 0; i < fnic->intr_count; i++) 528 vnic_intr_clean(&fnic->intr[i]); 529 530 mempool_destroy(fnic->io_req_pool); 531 for (i = 0; i < FNIC_SGL_NUM_CACHES; i++) 532 mempool_destroy(fnic->io_sgl_pool[i]); 533 534 return 0; 535 } 536 537 static void fnic_iounmap(struct fnic *fnic) 538 { 539 if (fnic->bar0.vaddr) 540 iounmap(fnic->bar0.vaddr); 541 } 542 543 /** 544 * fnic_get_mac() - get assigned data MAC address for FIP code. 545 * @lport: local port. 546 */ 547 static u8 *fnic_get_mac(struct fc_lport *lport) 548 { 549 struct fnic *fnic = lport_priv(lport); 550 551 return fnic->data_src_addr; 552 } 553 554 static void fnic_set_vlan(struct fnic *fnic, u16 vlan_id) 555 { 556 vnic_dev_set_default_vlan(fnic->vdev, vlan_id); 557 } 558 559 static int fnic_scsi_drv_init(struct fnic *fnic) 560 { 561 struct Scsi_Host *host = fnic->lport->host; 562 563 /* Configure maximum outstanding IO reqs*/ 564 if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) 565 host->can_queue = min_t(u32, FNIC_MAX_IO_REQ, 566 max_t(u32, FNIC_MIN_IO_REQ, 567 fnic->config.io_throttle_count)); 568 569 fnic->fnic_max_tag_id = host->can_queue; 570 host->max_lun = fnic->config.luns_per_tgt; 571 host->max_id = FNIC_MAX_FCP_TARGET; 572 host->max_cmd_len = FCOE_MAX_CMD_LEN; 573 574 host->nr_hw_queues = fnic->wq_copy_count; 575 if (host->nr_hw_queues > 1) 576 shost_printk(KERN_ERR, host, 577 "fnic: blk-mq is not supported"); 578 579 host->nr_hw_queues = fnic->wq_copy_count = 1; 580 581 shost_printk(KERN_INFO, host, 582 "fnic: can_queue: %d max_lun: %llu", 583 host->can_queue, host->max_lun); 584 585 shost_printk(KERN_INFO, host, 586 "fnic: max_id: %d max_cmd_len: %d nr_hw_queues: %d", 587 host->max_id, host->max_cmd_len, host->nr_hw_queues); 588 589 return 0; 590 } 591 592 static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 593 { 594 struct Scsi_Host *host; 595 struct fc_lport *lp; 596 struct fnic *fnic; 597 mempool_t *pool; 598 int err; 599 int i; 600 unsigned long flags; 601 602 /* 603 * Allocate SCSI Host and set up association between host, 604 * local port, and fnic 605 */ 606 lp = libfc_host_alloc(&fnic_host_template, sizeof(struct fnic)); 607 if (!lp) { 608 printk(KERN_ERR PFX "Unable to alloc libfc local port\n"); 609 err = -ENOMEM; 610 goto err_out; 611 } 612 host = lp->host; 613 fnic = lport_priv(lp); 614 fnic->lport = lp; 615 fnic->ctlr.lp = lp; 616 617 fnic->link_events = 0; 618 619 snprintf(fnic->name, sizeof(fnic->name) - 1, "%s%d", DRV_NAME, 620 host->host_no); 621 622 host->transportt = fnic_fc_transport; 623 624 fnic_stats_debugfs_init(fnic); 625 626 /* Setup PCI resources */ 627 pci_set_drvdata(pdev, fnic); 628 629 fnic->pdev = pdev; 630 631 err = pci_enable_device(pdev); 632 if (err) { 633 shost_printk(KERN_ERR, fnic->lport->host, 634 "Cannot enable PCI device, aborting.\n"); 635 goto err_out_free_hba; 636 } 637 638 err = pci_request_regions(pdev, DRV_NAME); 639 if (err) { 640 shost_printk(KERN_ERR, fnic->lport->host, 641 "Cannot enable PCI resources, aborting\n"); 642 goto err_out_disable_device; 643 } 644 645 pci_set_master(pdev); 646 647 /* Query PCI controller on system for DMA addressing 648 * limitation for the device. Try 47-bit first, and 649 * fail to 32-bit. Cisco VIC supports 47 bits only. 650 */ 651 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(47)); 652 if (err) { 653 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 654 if (err) { 655 shost_printk(KERN_ERR, fnic->lport->host, 656 "No usable DMA configuration " 657 "aborting\n"); 658 goto err_out_release_regions; 659 } 660 } 661 662 /* Map vNIC resources from BAR0 */ 663 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 664 shost_printk(KERN_ERR, fnic->lport->host, 665 "BAR0 not memory-map'able, aborting.\n"); 666 err = -ENODEV; 667 goto err_out_release_regions; 668 } 669 670 fnic->bar0.vaddr = pci_iomap(pdev, 0, 0); 671 fnic->bar0.bus_addr = pci_resource_start(pdev, 0); 672 fnic->bar0.len = pci_resource_len(pdev, 0); 673 674 if (!fnic->bar0.vaddr) { 675 shost_printk(KERN_ERR, fnic->lport->host, 676 "Cannot memory-map BAR0 res hdr, " 677 "aborting.\n"); 678 err = -ENODEV; 679 goto err_out_release_regions; 680 } 681 682 fnic->vdev = vnic_dev_register(NULL, fnic, pdev, &fnic->bar0); 683 if (!fnic->vdev) { 684 shost_printk(KERN_ERR, fnic->lport->host, 685 "vNIC registration failed, " 686 "aborting.\n"); 687 err = -ENODEV; 688 goto err_out_iounmap; 689 } 690 691 err = vnic_dev_cmd_init(fnic->vdev); 692 if (err) { 693 shost_printk(KERN_ERR, fnic->lport->host, 694 "vnic_dev_cmd_init() returns %d, aborting\n", 695 err); 696 goto err_out_vnic_unregister; 697 } 698 699 err = fnic_dev_wait(fnic->vdev, vnic_dev_open, 700 vnic_dev_open_done, CMD_OPENF_RQ_ENABLE_THEN_POST); 701 if (err) { 702 shost_printk(KERN_ERR, fnic->lport->host, 703 "vNIC dev open failed, aborting.\n"); 704 goto err_out_dev_cmd_deinit; 705 } 706 707 err = vnic_dev_init(fnic->vdev, 0); 708 if (err) { 709 shost_printk(KERN_ERR, fnic->lport->host, 710 "vNIC dev init failed, aborting.\n"); 711 goto err_out_dev_close; 712 } 713 714 err = vnic_dev_mac_addr(fnic->vdev, fnic->ctlr.ctl_src_addr); 715 if (err) { 716 shost_printk(KERN_ERR, fnic->lport->host, 717 "vNIC get MAC addr failed \n"); 718 goto err_out_dev_close; 719 } 720 /* set data_src for point-to-point mode and to keep it non-zero */ 721 memcpy(fnic->data_src_addr, fnic->ctlr.ctl_src_addr, ETH_ALEN); 722 723 /* Get vNIC configuration */ 724 err = fnic_get_vnic_config(fnic); 725 if (err) { 726 shost_printk(KERN_ERR, fnic->lport->host, 727 "Get vNIC configuration failed, " 728 "aborting.\n"); 729 goto err_out_dev_close; 730 } 731 732 fnic_scsi_drv_init(fnic); 733 734 fnic_get_res_counts(fnic); 735 736 err = fnic_set_intr_mode(fnic); 737 if (err) { 738 shost_printk(KERN_ERR, fnic->lport->host, 739 "Failed to set intr mode, " 740 "aborting.\n"); 741 goto err_out_dev_close; 742 } 743 744 err = fnic_alloc_vnic_resources(fnic); 745 if (err) { 746 shost_printk(KERN_ERR, fnic->lport->host, 747 "Failed to alloc vNIC resources, " 748 "aborting.\n"); 749 goto err_out_clear_intr; 750 } 751 752 753 /* initialize all fnic locks */ 754 spin_lock_init(&fnic->fnic_lock); 755 756 for (i = 0; i < FNIC_WQ_MAX; i++) 757 spin_lock_init(&fnic->wq_lock[i]); 758 759 for (i = 0; i < FNIC_WQ_COPY_MAX; i++) { 760 spin_lock_init(&fnic->wq_copy_lock[i]); 761 fnic->wq_copy_desc_low[i] = DESC_CLEAN_LOW_WATERMARK; 762 fnic->fw_ack_recd[i] = 0; 763 fnic->fw_ack_index[i] = -1; 764 } 765 766 for (i = 0; i < FNIC_IO_LOCKS; i++) 767 spin_lock_init(&fnic->io_req_lock[i]); 768 769 err = -ENOMEM; 770 fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache); 771 if (!fnic->io_req_pool) 772 goto err_out_free_resources; 773 774 pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); 775 if (!pool) 776 goto err_out_free_ioreq_pool; 777 fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool; 778 779 pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); 780 if (!pool) 781 goto err_out_free_dflt_pool; 782 fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool; 783 784 /* setup vlan config, hw inserts vlan header */ 785 fnic->vlan_hw_insert = 1; 786 fnic->vlan_id = 0; 787 788 /* Initialize the FIP fcoe_ctrl struct */ 789 fnic->ctlr.send = fnic_eth_send; 790 fnic->ctlr.update_mac = fnic_update_mac; 791 fnic->ctlr.get_src_addr = fnic_get_mac; 792 if (fnic->config.flags & VFCF_FIP_CAPABLE) { 793 shost_printk(KERN_INFO, fnic->lport->host, 794 "firmware supports FIP\n"); 795 /* enable directed and multicast */ 796 vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0); 797 vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS); 798 vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr); 799 fnic->set_vlan = fnic_set_vlan; 800 fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_AUTO); 801 timer_setup(&fnic->fip_timer, fnic_fip_notify_timer, 0); 802 spin_lock_init(&fnic->vlans_lock); 803 INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); 804 INIT_WORK(&fnic->event_work, fnic_handle_event); 805 skb_queue_head_init(&fnic->fip_frame_queue); 806 INIT_LIST_HEAD(&fnic->evlist); 807 INIT_LIST_HEAD(&fnic->vlans); 808 } else { 809 shost_printk(KERN_INFO, fnic->lport->host, 810 "firmware uses non-FIP mode\n"); 811 fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_NON_FIP); 812 fnic->ctlr.state = FIP_ST_NON_FIP; 813 } 814 fnic->state = FNIC_IN_FC_MODE; 815 816 atomic_set(&fnic->in_flight, 0); 817 fnic->state_flags = FNIC_FLAGS_NONE; 818 819 /* Enable hardware stripping of vlan header on ingress */ 820 fnic_set_nic_config(fnic, 0, 0, 0, 0, 0, 0, 1); 821 822 /* Setup notification buffer area */ 823 err = fnic_notify_set(fnic); 824 if (err) { 825 shost_printk(KERN_ERR, fnic->lport->host, 826 "Failed to alloc notify buffer, aborting.\n"); 827 goto err_out_free_max_pool; 828 } 829 830 /* Setup notify timer when using MSI interrupts */ 831 if (vnic_dev_get_intr_mode(fnic->vdev) == VNIC_DEV_INTR_MODE_MSI) 832 timer_setup(&fnic->notify_timer, fnic_notify_timer, 0); 833 834 /* allocate RQ buffers and post them to RQ*/ 835 for (i = 0; i < fnic->rq_count; i++) { 836 vnic_rq_enable(&fnic->rq[i]); 837 err = vnic_rq_fill(&fnic->rq[i], fnic_alloc_rq_frame); 838 if (err) { 839 shost_printk(KERN_ERR, fnic->lport->host, 840 "fnic_alloc_rq_frame can't alloc " 841 "frame\n"); 842 goto err_out_free_rq_buf; 843 } 844 } 845 846 /* 847 * Initialization done with PCI system, hardware, firmware. 848 * Add host to SCSI 849 */ 850 err = scsi_add_host(lp->host, &pdev->dev); 851 if (err) { 852 shost_printk(KERN_ERR, fnic->lport->host, 853 "fnic: scsi_add_host failed...exiting\n"); 854 goto err_out_free_rq_buf; 855 } 856 857 /* Start local port initiatialization */ 858 859 lp->link_up = 0; 860 861 lp->max_retry_count = fnic->config.flogi_retries; 862 lp->max_rport_retry_count = fnic->config.plogi_retries; 863 lp->service_params = (FCP_SPPF_INIT_FCN | FCP_SPPF_RD_XRDY_DIS | 864 FCP_SPPF_CONF_COMPL); 865 if (fnic->config.flags & VFCF_FCP_SEQ_LVL_ERR) 866 lp->service_params |= FCP_SPPF_RETRY; 867 868 lp->boot_time = jiffies; 869 lp->e_d_tov = fnic->config.ed_tov; 870 lp->r_a_tov = fnic->config.ra_tov; 871 lp->link_supported_speeds = FC_PORTSPEED_10GBIT; 872 fc_set_wwnn(lp, fnic->config.node_wwn); 873 fc_set_wwpn(lp, fnic->config.port_wwn); 874 875 fcoe_libfc_config(lp, &fnic->ctlr, &fnic_transport_template, 0); 876 877 if (!fc_exch_mgr_alloc(lp, FC_CLASS_3, FCPIO_HOST_EXCH_RANGE_START, 878 FCPIO_HOST_EXCH_RANGE_END, NULL)) { 879 err = -ENOMEM; 880 goto err_out_remove_scsi_host; 881 } 882 883 fc_lport_init_stats(lp); 884 fnic->stats_reset_time = jiffies; 885 886 fc_lport_config(lp); 887 888 if (fc_set_mfs(lp, fnic->config.maxdatafieldsize + 889 sizeof(struct fc_frame_header))) { 890 err = -EINVAL; 891 goto err_out_free_exch_mgr; 892 } 893 fc_host_maxframe_size(lp->host) = lp->mfs; 894 fc_host_dev_loss_tmo(lp->host) = fnic->config.port_down_timeout / 1000; 895 896 sprintf(fc_host_symbolic_name(lp->host), 897 DRV_NAME " v" DRV_VERSION " over %s", fnic->name); 898 899 spin_lock_irqsave(&fnic_list_lock, flags); 900 list_add_tail(&fnic->list, &fnic_list); 901 spin_unlock_irqrestore(&fnic_list_lock, flags); 902 903 INIT_WORK(&fnic->link_work, fnic_handle_link); 904 INIT_WORK(&fnic->frame_work, fnic_handle_frame); 905 skb_queue_head_init(&fnic->frame_queue); 906 skb_queue_head_init(&fnic->tx_queue); 907 908 /* Enable all queues */ 909 for (i = 0; i < fnic->raw_wq_count; i++) 910 vnic_wq_enable(&fnic->wq[i]); 911 for (i = 0; i < fnic->wq_copy_count; i++) 912 vnic_wq_copy_enable(&fnic->wq_copy[i]); 913 914 fc_fabric_login(lp); 915 916 err = fnic_request_intr(fnic); 917 if (err) { 918 shost_printk(KERN_ERR, fnic->lport->host, 919 "Unable to request irq.\n"); 920 goto err_out_free_exch_mgr; 921 } 922 923 vnic_dev_enable(fnic->vdev); 924 925 for (i = 0; i < fnic->intr_count; i++) 926 vnic_intr_unmask(&fnic->intr[i]); 927 928 fnic_notify_timer_start(fnic); 929 930 return 0; 931 932 err_out_free_exch_mgr: 933 fc_exch_mgr_free(lp); 934 err_out_remove_scsi_host: 935 fc_remove_host(lp->host); 936 scsi_remove_host(lp->host); 937 err_out_free_rq_buf: 938 for (i = 0; i < fnic->rq_count; i++) 939 vnic_rq_clean(&fnic->rq[i], fnic_free_rq_buf); 940 vnic_dev_notify_unset(fnic->vdev); 941 err_out_free_max_pool: 942 mempool_destroy(fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX]); 943 err_out_free_dflt_pool: 944 mempool_destroy(fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT]); 945 err_out_free_ioreq_pool: 946 mempool_destroy(fnic->io_req_pool); 947 err_out_free_resources: 948 fnic_free_vnic_resources(fnic); 949 err_out_clear_intr: 950 fnic_clear_intr_mode(fnic); 951 err_out_dev_close: 952 vnic_dev_close(fnic->vdev); 953 err_out_dev_cmd_deinit: 954 err_out_vnic_unregister: 955 vnic_dev_unregister(fnic->vdev); 956 err_out_iounmap: 957 fnic_iounmap(fnic); 958 err_out_release_regions: 959 pci_release_regions(pdev); 960 err_out_disable_device: 961 pci_disable_device(pdev); 962 err_out_free_hba: 963 fnic_stats_debugfs_remove(fnic); 964 scsi_host_put(lp->host); 965 err_out: 966 return err; 967 } 968 969 static void fnic_remove(struct pci_dev *pdev) 970 { 971 struct fnic *fnic = pci_get_drvdata(pdev); 972 struct fc_lport *lp = fnic->lport; 973 unsigned long flags; 974 975 /* 976 * Mark state so that the workqueue thread stops forwarding 977 * received frames and link events to the local port. ISR and 978 * other threads that can queue work items will also stop 979 * creating work items on the fnic workqueue 980 */ 981 spin_lock_irqsave(&fnic->fnic_lock, flags); 982 fnic->stop_rx_link_events = 1; 983 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 984 985 if (vnic_dev_get_intr_mode(fnic->vdev) == VNIC_DEV_INTR_MODE_MSI) 986 del_timer_sync(&fnic->notify_timer); 987 988 /* 989 * Flush the fnic event queue. After this call, there should 990 * be no event queued for this fnic device in the workqueue 991 */ 992 flush_workqueue(fnic_event_queue); 993 skb_queue_purge(&fnic->frame_queue); 994 skb_queue_purge(&fnic->tx_queue); 995 996 if (fnic->config.flags & VFCF_FIP_CAPABLE) { 997 del_timer_sync(&fnic->fip_timer); 998 skb_queue_purge(&fnic->fip_frame_queue); 999 fnic_fcoe_reset_vlans(fnic); 1000 fnic_fcoe_evlist_free(fnic); 1001 } 1002 1003 /* 1004 * Log off the fabric. This stops all remote ports, dns port, 1005 * logs off the fabric. This flushes all rport, disc, lport work 1006 * before returning 1007 */ 1008 fc_fabric_logoff(fnic->lport); 1009 1010 spin_lock_irqsave(&fnic->fnic_lock, flags); 1011 fnic->in_remove = 1; 1012 spin_unlock_irqrestore(&fnic->fnic_lock, flags); 1013 1014 fcoe_ctlr_destroy(&fnic->ctlr); 1015 fc_lport_destroy(lp); 1016 fnic_stats_debugfs_remove(fnic); 1017 1018 /* 1019 * This stops the fnic device, masks all interrupts. Completed 1020 * CQ entries are drained. Posted WQ/RQ/Copy-WQ entries are 1021 * cleaned up 1022 */ 1023 fnic_cleanup(fnic); 1024 1025 BUG_ON(!skb_queue_empty(&fnic->frame_queue)); 1026 BUG_ON(!skb_queue_empty(&fnic->tx_queue)); 1027 1028 spin_lock_irqsave(&fnic_list_lock, flags); 1029 list_del(&fnic->list); 1030 spin_unlock_irqrestore(&fnic_list_lock, flags); 1031 1032 fc_remove_host(fnic->lport->host); 1033 scsi_remove_host(fnic->lport->host); 1034 fc_exch_mgr_free(fnic->lport); 1035 vnic_dev_notify_unset(fnic->vdev); 1036 fnic_free_intr(fnic); 1037 fnic_free_vnic_resources(fnic); 1038 fnic_clear_intr_mode(fnic); 1039 vnic_dev_close(fnic->vdev); 1040 vnic_dev_unregister(fnic->vdev); 1041 fnic_iounmap(fnic); 1042 pci_release_regions(pdev); 1043 pci_disable_device(pdev); 1044 scsi_host_put(lp->host); 1045 } 1046 1047 static struct pci_driver fnic_driver = { 1048 .name = DRV_NAME, 1049 .id_table = fnic_id_table, 1050 .probe = fnic_probe, 1051 .remove = fnic_remove, 1052 }; 1053 1054 static int __init fnic_init_module(void) 1055 { 1056 size_t len; 1057 int err = 0; 1058 1059 printk(KERN_INFO PFX "%s, ver %s\n", DRV_DESCRIPTION, DRV_VERSION); 1060 1061 /* Create debugfs entries for fnic */ 1062 err = fnic_debugfs_init(); 1063 if (err < 0) { 1064 printk(KERN_ERR PFX "Failed to create fnic directory " 1065 "for tracing and stats logging\n"); 1066 fnic_debugfs_terminate(); 1067 } 1068 1069 /* Allocate memory for trace buffer */ 1070 err = fnic_trace_buf_init(); 1071 if (err < 0) { 1072 printk(KERN_ERR PFX 1073 "Trace buffer initialization Failed. " 1074 "Fnic Tracing utility is disabled\n"); 1075 fnic_trace_free(); 1076 } 1077 1078 /* Allocate memory for fc trace buffer */ 1079 err = fnic_fc_trace_init(); 1080 if (err < 0) { 1081 printk(KERN_ERR PFX "FC trace buffer initialization Failed " 1082 "FC frame tracing utility is disabled\n"); 1083 fnic_fc_trace_free(); 1084 } 1085 1086 /* Create a cache for allocation of default size sgls */ 1087 len = sizeof(struct fnic_dflt_sgl_list); 1088 fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = kmem_cache_create 1089 ("fnic_sgl_dflt", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, 1090 SLAB_HWCACHE_ALIGN, 1091 NULL); 1092 if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) { 1093 printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n"); 1094 err = -ENOMEM; 1095 goto err_create_fnic_sgl_slab_dflt; 1096 } 1097 1098 /* Create a cache for allocation of max size sgls*/ 1099 len = sizeof(struct fnic_sgl_list); 1100 fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = kmem_cache_create 1101 ("fnic_sgl_max", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, 1102 SLAB_HWCACHE_ALIGN, 1103 NULL); 1104 if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) { 1105 printk(KERN_ERR PFX "failed to create fnic max sgl slab\n"); 1106 err = -ENOMEM; 1107 goto err_create_fnic_sgl_slab_max; 1108 } 1109 1110 /* Create a cache of io_req structs for use via mempool */ 1111 fnic_io_req_cache = kmem_cache_create("fnic_io_req", 1112 sizeof(struct fnic_io_req), 1113 0, SLAB_HWCACHE_ALIGN, NULL); 1114 if (!fnic_io_req_cache) { 1115 printk(KERN_ERR PFX "failed to create fnic io_req slab\n"); 1116 err = -ENOMEM; 1117 goto err_create_fnic_ioreq_slab; 1118 } 1119 1120 fnic_event_queue = create_singlethread_workqueue("fnic_event_wq"); 1121 if (!fnic_event_queue) { 1122 printk(KERN_ERR PFX "fnic work queue create failed\n"); 1123 err = -ENOMEM; 1124 goto err_create_fnic_workq; 1125 } 1126 1127 fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); 1128 if (!fnic_fip_queue) { 1129 printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); 1130 err = -ENOMEM; 1131 goto err_create_fip_workq; 1132 } 1133 1134 fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); 1135 if (!fnic_fc_transport) { 1136 printk(KERN_ERR PFX "fc_attach_transport error\n"); 1137 err = -ENOMEM; 1138 goto err_fc_transport; 1139 } 1140 1141 /* register the driver with PCI system */ 1142 err = pci_register_driver(&fnic_driver); 1143 if (err < 0) { 1144 printk(KERN_ERR PFX "pci register error\n"); 1145 goto err_pci_register; 1146 } 1147 return err; 1148 1149 err_pci_register: 1150 fc_release_transport(fnic_fc_transport); 1151 err_fc_transport: 1152 destroy_workqueue(fnic_fip_queue); 1153 err_create_fip_workq: 1154 destroy_workqueue(fnic_event_queue); 1155 err_create_fnic_workq: 1156 kmem_cache_destroy(fnic_io_req_cache); 1157 err_create_fnic_ioreq_slab: 1158 kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); 1159 err_create_fnic_sgl_slab_max: 1160 kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); 1161 err_create_fnic_sgl_slab_dflt: 1162 fnic_trace_free(); 1163 fnic_fc_trace_free(); 1164 fnic_debugfs_terminate(); 1165 return err; 1166 } 1167 1168 static void __exit fnic_cleanup_module(void) 1169 { 1170 pci_unregister_driver(&fnic_driver); 1171 destroy_workqueue(fnic_event_queue); 1172 if (fnic_fip_queue) 1173 destroy_workqueue(fnic_fip_queue); 1174 kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); 1175 kmem_cache_destroy(fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); 1176 kmem_cache_destroy(fnic_io_req_cache); 1177 fc_release_transport(fnic_fc_transport); 1178 fnic_trace_free(); 1179 fnic_fc_trace_free(); 1180 fnic_debugfs_terminate(); 1181 } 1182 1183 module_init(fnic_init_module); 1184 module_exit(fnic_cleanup_module); 1185 1186