aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe/fcoe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/fcoe/fcoe.c')
-rw-r--r--drivers/scsi/fcoe/fcoe.c108
1 files changed, 53 insertions, 55 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index c15878e88157..0a5609bb5817 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -45,8 +45,6 @@
45 45
46#include "fcoe.h" 46#include "fcoe.h"
47 47
48static int debug_fcoe;
49
50MODULE_AUTHOR("Open-FCoE.org"); 48MODULE_AUTHOR("Open-FCoE.org");
51MODULE_DESCRIPTION("FCoE"); 49MODULE_DESCRIPTION("FCoE");
52MODULE_LICENSE("GPL v2"); 50MODULE_LICENSE("GPL v2");
@@ -305,23 +303,22 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
305#ifdef NETIF_F_FCOE_CRC 303#ifdef NETIF_F_FCOE_CRC
306 if (netdev->features & NETIF_F_FCOE_CRC) { 304 if (netdev->features & NETIF_F_FCOE_CRC) {
307 lp->crc_offload = 1; 305 lp->crc_offload = 1;
308 printk(KERN_DEBUG "fcoe:%s supports FCCRC offload\n", 306 FCOE_NETDEV_DBG(netdev, "Supports FCCRC offload\n");
309 netdev->name);
310 } 307 }
311#endif 308#endif
312#ifdef NETIF_F_FSO 309#ifdef NETIF_F_FSO
313 if (netdev->features & NETIF_F_FSO) { 310 if (netdev->features & NETIF_F_FSO) {
314 lp->seq_offload = 1; 311 lp->seq_offload = 1;
315 lp->lso_max = netdev->gso_max_size; 312 lp->lso_max = netdev->gso_max_size;
316 printk(KERN_DEBUG "fcoe:%s supports LSO for max len 0x%x\n", 313 FCOE_NETDEV_DBG(netdev, "Supports LSO for max len 0x%x\n",
317 netdev->name, lp->lso_max); 314 lp->lso_max);
318 } 315 }
319#endif 316#endif
320 if (netdev->fcoe_ddp_xid) { 317 if (netdev->fcoe_ddp_xid) {
321 lp->lro_enabled = 1; 318 lp->lro_enabled = 1;
322 lp->lro_xid = netdev->fcoe_ddp_xid; 319 lp->lro_xid = netdev->fcoe_ddp_xid;
323 printk(KERN_DEBUG "fcoe:%s supports LRO for max xid 0x%x\n", 320 FCOE_NETDEV_DBG(netdev, "Supports LRO for max xid 0x%x\n",
324 netdev->name, lp->lro_xid); 321 lp->lro_xid);
325 } 322 }
326 skb_queue_head_init(&fc->fcoe_pending_queue); 323 skb_queue_head_init(&fc->fcoe_pending_queue);
327 fc->fcoe_pending_queue_active = 0; 324 fc->fcoe_pending_queue_active = 0;
@@ -407,7 +404,8 @@ static int fcoe_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
407 /* add the new host to the SCSI-ml */ 404 /* add the new host to the SCSI-ml */
408 rc = scsi_add_host(lp->host, dev); 405 rc = scsi_add_host(lp->host, dev);
409 if (rc) { 406 if (rc) {
410 FC_DBG("fcoe_shost_config:error on scsi_add_host\n"); 407 FCOE_NETDEV_DBG(fcoe_netdev(lp), "fcoe_shost_config: "
408 "error on scsi_add_host\n");
411 return rc; 409 return rc;
412 } 410 }
413 sprintf(fc_host_symbolic_name(lp->host), "%s v%s over %s", 411 sprintf(fc_host_symbolic_name(lp->host), "%s v%s over %s",
@@ -448,8 +446,7 @@ static int fcoe_if_destroy(struct net_device *netdev)
448 446
449 BUG_ON(!netdev); 447 BUG_ON(!netdev);
450 448
451 printk(KERN_DEBUG "fcoe_if_destroy:interface on %s\n", 449 FCOE_NETDEV_DBG(netdev, "Destroying interface\n");
452 netdev->name);
453 450
454 lp = fcoe_hostlist_lookup(netdev); 451 lp = fcoe_hostlist_lookup(netdev);
455 if (!lp) 452 if (!lp)
@@ -560,8 +557,7 @@ static int fcoe_if_create(struct net_device *netdev)
560 557
561 BUG_ON(!netdev); 558 BUG_ON(!netdev);
562 559
563 printk(KERN_DEBUG "fcoe_if_create:interface on %s\n", 560 FCOE_NETDEV_DBG(netdev, "Create Interface\n");
564 netdev->name);
565 561
566 lp = fcoe_hostlist_lookup(netdev); 562 lp = fcoe_hostlist_lookup(netdev);
567 if (lp) 563 if (lp)
@@ -570,7 +566,7 @@ static int fcoe_if_create(struct net_device *netdev)
570 shost = libfc_host_alloc(&fcoe_shost_template, 566 shost = libfc_host_alloc(&fcoe_shost_template,
571 sizeof(struct fcoe_softc)); 567 sizeof(struct fcoe_softc));
572 if (!shost) { 568 if (!shost) {
573 FC_DBG("Could not allocate host structure\n"); 569 FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n");
574 return -ENOMEM; 570 return -ENOMEM;
575 } 571 }
576 lp = shost_priv(shost); 572 lp = shost_priv(shost);
@@ -579,7 +575,8 @@ static int fcoe_if_create(struct net_device *netdev)
579 /* configure fc_lport, e.g., em */ 575 /* configure fc_lport, e.g., em */
580 rc = fcoe_lport_config(lp); 576 rc = fcoe_lport_config(lp);
581 if (rc) { 577 if (rc) {
582 FC_DBG("Could not configure lport\n"); 578 FCOE_NETDEV_DBG(netdev, "Could not configure lport for the "
579 "interface\n");
583 goto out_host_put; 580 goto out_host_put;
584 } 581 }
585 582
@@ -593,28 +590,32 @@ static int fcoe_if_create(struct net_device *netdev)
593 /* configure lport network properties */ 590 /* configure lport network properties */
594 rc = fcoe_netdev_config(lp, netdev); 591 rc = fcoe_netdev_config(lp, netdev);
595 if (rc) { 592 if (rc) {
596 FC_DBG("Could not configure netdev for the interface\n"); 593 FCOE_NETDEV_DBG(netdev, "Could not configure netdev for the "
594 "interface\n");
597 goto out_netdev_cleanup; 595 goto out_netdev_cleanup;
598 } 596 }
599 597
600 /* configure lport scsi host properties */ 598 /* configure lport scsi host properties */
601 rc = fcoe_shost_config(lp, shost, &netdev->dev); 599 rc = fcoe_shost_config(lp, shost, &netdev->dev);
602 if (rc) { 600 if (rc) {
603 FC_DBG("Could not configure shost for lport\n"); 601 FCOE_NETDEV_DBG(netdev, "Could not configure shost for the "
602 "interface\n");
604 goto out_netdev_cleanup; 603 goto out_netdev_cleanup;
605 } 604 }
606 605
607 /* lport exch manager allocation */ 606 /* lport exch manager allocation */
608 rc = fcoe_em_config(lp); 607 rc = fcoe_em_config(lp);
609 if (rc) { 608 if (rc) {
610 FC_DBG("Could not configure em for lport\n"); 609 FCOE_NETDEV_DBG(netdev, "Could not configure the EM for the "
610 "interface\n");
611 goto out_netdev_cleanup; 611 goto out_netdev_cleanup;
612 } 612 }
613 613
614 /* Initialize the library */ 614 /* Initialize the library */
615 rc = fcoe_libfc_config(lp, &fcoe_libfc_fcn_templ); 615 rc = fcoe_libfc_config(lp, &fcoe_libfc_fcn_templ);
616 if (rc) { 616 if (rc) {
617 FC_DBG("Could not configure libfc for lport!\n"); 617 FCOE_NETDEV_DBG(netdev, "Could not configure libfc for the "
618 "interface\n");
618 goto out_lp_destroy; 619 goto out_lp_destroy;
619 } 620 }
620 621
@@ -653,7 +654,7 @@ static int __init fcoe_if_init(void)
653 fc_attach_transport(&fcoe_transport_function); 654 fc_attach_transport(&fcoe_transport_function);
654 655
655 if (!scsi_transport_fcoe_sw) { 656 if (!scsi_transport_fcoe_sw) {
656 printk(KERN_ERR "fcoe_init:fc_attach_transport() failed\n"); 657 printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n");
657 return -ENODEV; 658 return -ENODEV;
658 } 659 }
659 660
@@ -714,7 +715,7 @@ static void fcoe_percpu_thread_destroy(unsigned int cpu)
714 unsigned targ_cpu = smp_processor_id(); 715 unsigned targ_cpu = smp_processor_id();
715#endif /* CONFIG_SMP */ 716#endif /* CONFIG_SMP */
716 717
717 printk(KERN_DEBUG "fcoe: Destroying receive thread for CPU %d\n", cpu); 718 FCOE_DBG("Destroying receive thread for CPU %d\n", cpu);
718 719
719 /* Prevent any new skbs from being queued for this CPU. */ 720 /* Prevent any new skbs from being queued for this CPU. */
720 p = &per_cpu(fcoe_percpu, cpu); 721 p = &per_cpu(fcoe_percpu, cpu);
@@ -736,8 +737,8 @@ static void fcoe_percpu_thread_destroy(unsigned int cpu)
736 p0 = &per_cpu(fcoe_percpu, targ_cpu); 737 p0 = &per_cpu(fcoe_percpu, targ_cpu);
737 spin_lock_bh(&p0->fcoe_rx_list.lock); 738 spin_lock_bh(&p0->fcoe_rx_list.lock);
738 if (p0->thread) { 739 if (p0->thread) {
739 FC_DBG("Moving frames from CPU %d to CPU %d\n", 740 FCOE_DBG("Moving frames from CPU %d to CPU %d\n",
740 cpu, targ_cpu); 741 cpu, targ_cpu);
741 742
742 while ((skb = __skb_dequeue(&p->fcoe_rx_list)) != NULL) 743 while ((skb = __skb_dequeue(&p->fcoe_rx_list)) != NULL)
743 __skb_queue_tail(&p0->fcoe_rx_list, skb); 744 __skb_queue_tail(&p0->fcoe_rx_list, skb);
@@ -803,12 +804,12 @@ static int fcoe_cpu_callback(struct notifier_block *nfb,
803 switch (action) { 804 switch (action) {
804 case CPU_ONLINE: 805 case CPU_ONLINE:
805 case CPU_ONLINE_FROZEN: 806 case CPU_ONLINE_FROZEN:
806 FC_DBG("CPU %x online: Create Rx thread\n", cpu); 807 FCOE_DBG("CPU %x online: Create Rx thread\n", cpu);
807 fcoe_percpu_thread_create(cpu); 808 fcoe_percpu_thread_create(cpu);
808 break; 809 break;
809 case CPU_DEAD: 810 case CPU_DEAD:
810 case CPU_DEAD_FROZEN: 811 case CPU_DEAD_FROZEN:
811 FC_DBG("CPU %x offline: Remove Rx thread\n", cpu); 812 FCOE_DBG("CPU %x offline: Remove Rx thread\n", cpu);
812 fcoe_percpu_thread_destroy(cpu); 813 fcoe_percpu_thread_destroy(cpu);
813 break; 814 break;
814 default: 815 default:
@@ -846,24 +847,21 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
846 fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type); 847 fc = container_of(ptype, struct fcoe_softc, fcoe_packet_type);
847 lp = fc->ctlr.lp; 848 lp = fc->ctlr.lp;
848 if (unlikely(lp == NULL)) { 849 if (unlikely(lp == NULL)) {
849 FC_DBG("cannot find hba structure"); 850 FCOE_NETDEV_DBG(dev, "Cannot find hba structure");
850 goto err2; 851 goto err2;
851 } 852 }
852 if (!lp->link_up) 853 if (!lp->link_up)
853 goto err2; 854 goto err2;
854 855
855 if (unlikely(debug_fcoe)) { 856 FCOE_NETDEV_DBG(dev, "skb_info: len:%d data_len:%d head:%p "
856 FC_DBG("skb_info: len:%d data_len:%d head:%p data:%p tail:%p " 857 "data:%p tail:%p end:%p sum:%d dev:%s",
857 "end:%p sum:%d dev:%s", skb->len, skb->data_len, 858 skb->len, skb->data_len, skb->head, skb->data,
858 skb->head, skb->data, skb_tail_pointer(skb), 859 skb_tail_pointer(skb), skb_end_pointer(skb),
859 skb_end_pointer(skb), skb->csum, 860 skb->csum, skb->dev ? skb->dev->name : "<NULL>");
860 skb->dev ? skb->dev->name : "<NULL>");
861
862 }
863 861
864 /* check for FCOE packet type */ 862 /* check for FCOE packet type */
865 if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { 863 if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) {
866 FC_DBG("wrong FC type frame"); 864 FCOE_NETDEV_DBG(dev, "Wrong FC type frame");
867 goto err; 865 goto err;
868 } 866 }
869 867
@@ -901,8 +899,9 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *dev,
901 * the first CPU now. For non-SMP systems this 899 * the first CPU now. For non-SMP systems this
902 * will check the same CPU twice. 900 * will check the same CPU twice.
903 */ 901 */
904 FC_DBG("CPU is online, but no receive thread ready " 902 FCOE_NETDEV_DBG(dev, "CPU is online, but no receive thread "
905 "for incoming skb- using first online CPU.\n"); 903 "ready for incoming skb- using first online "
904 "CPU.\n");
906 905
907 spin_unlock_bh(&fps->fcoe_rx_list.lock); 906 spin_unlock_bh(&fps->fcoe_rx_list.lock);
908 cpu = first_cpu(cpu_online_map); 907 cpu = first_cpu(cpu_online_map);
@@ -1201,19 +1200,17 @@ int fcoe_percpu_receive_thread(void *arg)
1201 fr = fcoe_dev_from_skb(skb); 1200 fr = fcoe_dev_from_skb(skb);
1202 lp = fr->fr_dev; 1201 lp = fr->fr_dev;
1203 if (unlikely(lp == NULL)) { 1202 if (unlikely(lp == NULL)) {
1204 FC_DBG("invalid HBA Structure"); 1203 FCOE_NETDEV_DBG(skb->dev, "Invalid HBA Structure");
1205 kfree_skb(skb); 1204 kfree_skb(skb);
1206 continue; 1205 continue;
1207 } 1206 }
1208 1207
1209 if (unlikely(debug_fcoe)) { 1208 FCOE_NETDEV_DBG(skb->dev, "skb_info: len:%d data_len:%d "
1210 FC_DBG("skb_info: len:%d data_len:%d head:%p data:%p " 1209 "head:%p data:%p tail:%p end:%p sum:%d dev:%s",
1211 "tail:%p end:%p sum:%d dev:%s", 1210 skb->len, skb->data_len,
1212 skb->len, skb->data_len, 1211 skb->head, skb->data, skb_tail_pointer(skb),
1213 skb->head, skb->data, skb_tail_pointer(skb), 1212 skb_end_pointer(skb), skb->csum,
1214 skb_end_pointer(skb), skb->csum, 1213 skb->dev ? skb->dev->name : "<NULL>");
1215 skb->dev ? skb->dev->name : "<NULL>");
1216 }
1217 1214
1218 /* 1215 /*
1219 * Save source MAC address before discarding header. 1216 * Save source MAC address before discarding header.
@@ -1233,7 +1230,7 @@ int fcoe_percpu_receive_thread(void *arg)
1233 stats = fc_lport_get_stats(lp); 1230 stats = fc_lport_get_stats(lp);
1234 if (unlikely(FC_FCOE_DECAPS_VER(hp) != FC_FCOE_VER)) { 1231 if (unlikely(FC_FCOE_DECAPS_VER(hp) != FC_FCOE_VER)) {
1235 if (stats->ErrorFrames < 5) 1232 if (stats->ErrorFrames < 5)
1236 printk(KERN_WARNING "FCoE version " 1233 printk(KERN_WARNING "fcoe: FCoE version "
1237 "mismatch: The frame has " 1234 "mismatch: The frame has "
1238 "version %x, but the " 1235 "version %x, but the "
1239 "initiator supports version " 1236 "initiator supports version "
@@ -1286,7 +1283,7 @@ int fcoe_percpu_receive_thread(void *arg)
1286 if (fr_flags(fp) & FCPHF_CRC_UNCHECKED) { 1283 if (fr_flags(fp) & FCPHF_CRC_UNCHECKED) {
1287 if (le32_to_cpu(fr_crc(fp)) != 1284 if (le32_to_cpu(fr_crc(fp)) !=
1288 ~crc32(~0, skb->data, fr_len)) { 1285 ~crc32(~0, skb->data, fr_len)) {
1289 if (debug_fcoe || stats->InvalidCRCCount < 5) 1286 if (stats->InvalidCRCCount < 5)
1290 printk(KERN_WARNING "fcoe: dropping " 1287 printk(KERN_WARNING "fcoe: dropping "
1291 "frame with CRC error\n"); 1288 "frame with CRC error\n");
1292 stats->InvalidCRCCount++; 1289 stats->InvalidCRCCount++;
@@ -1432,7 +1429,8 @@ static int fcoe_device_notification(struct notifier_block *notifier,
1432 case NETDEV_REGISTER: 1429 case NETDEV_REGISTER:
1433 break; 1430 break;
1434 default: 1431 default:
1435 FC_DBG("Unknown event %ld from netdev netlink\n", event); 1432 FCOE_NETDEV_DBG(real_dev, "Unknown event %ld "
1433 "from netdev netlink\n", event);
1436 } 1434 }
1437 if (link_possible && !fcoe_link_ok(lp)) 1435 if (link_possible && !fcoe_link_ok(lp))
1438 fcoe_ctlr_link_up(&fc->ctlr); 1436 fcoe_ctlr_link_up(&fc->ctlr);
@@ -1505,8 +1503,8 @@ static int fcoe_ethdrv_get(const struct net_device *netdev)
1505 1503
1506 owner = fcoe_netdev_to_module_owner(netdev); 1504 owner = fcoe_netdev_to_module_owner(netdev);
1507 if (owner) { 1505 if (owner) {
1508 printk(KERN_DEBUG "fcoe:hold driver module %s for %s\n", 1506 FCOE_NETDEV_DBG(netdev, "Hold driver module %s\n",
1509 module_name(owner), netdev->name); 1507 module_name(owner));
1510 return try_module_get(owner); 1508 return try_module_get(owner);
1511 } 1509 }
1512 return -ENODEV; 1510 return -ENODEV;
@@ -1527,8 +1525,8 @@ static int fcoe_ethdrv_put(const struct net_device *netdev)
1527 1525
1528 owner = fcoe_netdev_to_module_owner(netdev); 1526 owner = fcoe_netdev_to_module_owner(netdev);
1529 if (owner) { 1527 if (owner) {
1530 printk(KERN_DEBUG "fcoe:release driver module %s for %s\n", 1528 FCOE_NETDEV_DBG(netdev, "Release driver module %s\n",
1531 module_name(owner), netdev->name); 1529 module_name(owner));
1532 module_put(owner); 1530 module_put(owner);
1533 return 0; 1531 return 0;
1534 } 1532 }
@@ -1559,7 +1557,7 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
1559 } 1557 }
1560 rc = fcoe_if_destroy(netdev); 1558 rc = fcoe_if_destroy(netdev);
1561 if (rc) { 1559 if (rc) {
1562 printk(KERN_ERR "fcoe: fcoe_if_destroy(%s) failed\n", 1560 printk(KERN_ERR "fcoe: Failed to destroy interface (%s)\n",
1563 netdev->name); 1561 netdev->name);
1564 rc = -EIO; 1562 rc = -EIO;
1565 goto out_putdev; 1563 goto out_putdev;
@@ -1598,7 +1596,7 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
1598 1596
1599 rc = fcoe_if_create(netdev); 1597 rc = fcoe_if_create(netdev);
1600 if (rc) { 1598 if (rc) {
1601 printk(KERN_ERR "fcoe: fcoe_if_create(%s) failed\n", 1599 printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
1602 netdev->name); 1600 netdev->name);
1603 fcoe_ethdrv_put(netdev); 1601 fcoe_ethdrv_put(netdev);
1604 rc = -EIO; 1602 rc = -EIO;