aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc_fcoe.c')
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c98
1 files changed, 12 insertions, 86 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e476e8753079..e2e647509a73 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -21,7 +21,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
21 21
22#define DRV_MODULE_NAME "bnx2fc" 22#define DRV_MODULE_NAME "bnx2fc"
23#define DRV_MODULE_VERSION BNX2FC_VERSION 23#define DRV_MODULE_VERSION BNX2FC_VERSION
24#define DRV_MODULE_RELDATE "Jan 25, 2011" 24#define DRV_MODULE_RELDATE "Mar 17, 2011"
25 25
26 26
27static char version[] __devinitdata = 27static char version[] __devinitdata =
@@ -437,17 +437,16 @@ static int bnx2fc_l2_rcv_thread(void *arg)
437 set_current_state(TASK_INTERRUPTIBLE); 437 set_current_state(TASK_INTERRUPTIBLE);
438 while (!kthread_should_stop()) { 438 while (!kthread_should_stop()) {
439 schedule(); 439 schedule();
440 set_current_state(TASK_RUNNING);
441 spin_lock_bh(&bg->fcoe_rx_list.lock); 440 spin_lock_bh(&bg->fcoe_rx_list.lock);
442 while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) != NULL) { 441 while ((skb = __skb_dequeue(&bg->fcoe_rx_list)) != NULL) {
443 spin_unlock_bh(&bg->fcoe_rx_list.lock); 442 spin_unlock_bh(&bg->fcoe_rx_list.lock);
444 bnx2fc_recv_frame(skb); 443 bnx2fc_recv_frame(skb);
445 spin_lock_bh(&bg->fcoe_rx_list.lock); 444 spin_lock_bh(&bg->fcoe_rx_list.lock);
446 } 445 }
446 __set_current_state(TASK_INTERRUPTIBLE);
447 spin_unlock_bh(&bg->fcoe_rx_list.lock); 447 spin_unlock_bh(&bg->fcoe_rx_list.lock);
448 set_current_state(TASK_INTERRUPTIBLE);
449 } 448 }
450 set_current_state(TASK_RUNNING); 449 __set_current_state(TASK_RUNNING);
451 return 0; 450 return 0;
452} 451}
453 452
@@ -569,7 +568,6 @@ int bnx2fc_percpu_io_thread(void *arg)
569 set_current_state(TASK_INTERRUPTIBLE); 568 set_current_state(TASK_INTERRUPTIBLE);
570 while (!kthread_should_stop()) { 569 while (!kthread_should_stop()) {
571 schedule(); 570 schedule();
572 set_current_state(TASK_RUNNING);
573 spin_lock_bh(&p->fp_work_lock); 571 spin_lock_bh(&p->fp_work_lock);
574 while (!list_empty(&p->work_list)) { 572 while (!list_empty(&p->work_list)) {
575 list_splice_init(&p->work_list, &work_list); 573 list_splice_init(&p->work_list, &work_list);
@@ -583,10 +581,10 @@ int bnx2fc_percpu_io_thread(void *arg)
583 581
584 spin_lock_bh(&p->fp_work_lock); 582 spin_lock_bh(&p->fp_work_lock);
585 } 583 }
584 __set_current_state(TASK_INTERRUPTIBLE);
586 spin_unlock_bh(&p->fp_work_lock); 585 spin_unlock_bh(&p->fp_work_lock);
587 set_current_state(TASK_INTERRUPTIBLE);
588 } 586 }
589 set_current_state(TASK_RUNNING); 587 __set_current_state(TASK_RUNNING);
590 588
591 return 0; 589 return 0;
592} 590}
@@ -661,31 +659,6 @@ static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev)
661 return 0; 659 return 0;
662} 660}
663 661
664static int bnx2fc_mfs_update(struct fc_lport *lport)
665{
666 struct fcoe_port *port = lport_priv(lport);
667 struct bnx2fc_hba *hba = port->priv;
668 struct net_device *netdev = hba->netdev;
669 u32 mfs;
670 u32 max_mfs;
671
672 mfs = netdev->mtu - (sizeof(struct fcoe_hdr) +
673 sizeof(struct fcoe_crc_eof));
674 max_mfs = BNX2FC_MAX_PAYLOAD + sizeof(struct fc_frame_header);
675 BNX2FC_HBA_DBG(lport, "mfs = %d, max_mfs = %d\n", mfs, max_mfs);
676 if (mfs > max_mfs)
677 mfs = max_mfs;
678
679 /* Adjust mfs to be a multiple of 256 bytes */
680 mfs = (((mfs - sizeof(struct fc_frame_header)) / BNX2FC_MIN_PAYLOAD) *
681 BNX2FC_MIN_PAYLOAD);
682 mfs = mfs + sizeof(struct fc_frame_header);
683
684 BNX2FC_HBA_DBG(lport, "Set MFS = %d\n", mfs);
685 if (fc_set_mfs(lport, mfs))
686 return -EINVAL;
687 return 0;
688}
689static void bnx2fc_link_speed_update(struct fc_lport *lport) 662static void bnx2fc_link_speed_update(struct fc_lport *lport)
690{ 663{
691 struct fcoe_port *port = lport_priv(lport); 664 struct fcoe_port *port = lport_priv(lport);
@@ -754,7 +727,7 @@ static int bnx2fc_net_config(struct fc_lport *lport)
754 !hba->phys_dev->ethtool_ops->get_pauseparam) 727 !hba->phys_dev->ethtool_ops->get_pauseparam)
755 return -EOPNOTSUPP; 728 return -EOPNOTSUPP;
756 729
757 if (bnx2fc_mfs_update(lport)) 730 if (fc_set_mfs(lport, BNX2FC_MFS))
758 return -EINVAL; 731 return -EINVAL;
759 732
760 skb_queue_head_init(&port->fcoe_pending_queue); 733 skb_queue_head_init(&port->fcoe_pending_queue);
@@ -825,14 +798,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event)
825 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state)) 798 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state))
826 printk(KERN_ERR "indicate_netevent: "\ 799 printk(KERN_ERR "indicate_netevent: "\
827 "adapter is not UP!!\n"); 800 "adapter is not UP!!\n");
828 /* fall thru to update mfs if MTU has changed */
829 case NETDEV_CHANGEMTU:
830 BNX2FC_HBA_DBG(lport, "NETDEV_CHANGEMTU event\n");
831 bnx2fc_mfs_update(lport);
832 mutex_lock(&lport->lp_mutex);
833 list_for_each_entry(vport, &lport->vports, list)
834 bnx2fc_mfs_update(vport);
835 mutex_unlock(&lport->lp_mutex);
836 break; 801 break;
837 802
838 case NETDEV_DOWN: 803 case NETDEV_DOWN:
@@ -1095,13 +1060,6 @@ static int bnx2fc_netdev_setup(struct bnx2fc_hba *hba)
1095 struct netdev_hw_addr *ha; 1060 struct netdev_hw_addr *ha;
1096 int sel_san_mac = 0; 1061 int sel_san_mac = 0;
1097 1062
1098 /* Do not support for bonding device */
1099 if ((netdev->priv_flags & IFF_MASTER_ALB) ||
1100 (netdev->priv_flags & IFF_SLAVE_INACTIVE) ||
1101 (netdev->priv_flags & IFF_MASTER_8023AD)) {
1102 return -EOPNOTSUPP;
1103 }
1104
1105 /* setup Source MAC Address */ 1063 /* setup Source MAC Address */
1106 rcu_read_lock(); 1064 rcu_read_lock();
1107 for_each_dev_addr(physdev, ha) { 1065 for_each_dev_addr(physdev, ha) {
@@ -1432,16 +1390,9 @@ static int bnx2fc_destroy(struct net_device *netdev)
1432 struct net_device *phys_dev; 1390 struct net_device *phys_dev;
1433 int rc = 0; 1391 int rc = 0;
1434 1392
1435 if (!rtnl_trylock()) 1393 rtnl_lock();
1436 return restart_syscall();
1437 1394
1438 mutex_lock(&bnx2fc_dev_lock); 1395 mutex_lock(&bnx2fc_dev_lock);
1439#ifdef CONFIG_SCSI_BNX2X_FCOE_MODULE
1440 if (THIS_MODULE->state != MODULE_STATE_LIVE) {
1441 rc = -ENODEV;
1442 goto netdev_err;
1443 }
1444#endif
1445 /* obtain physical netdev */ 1396 /* obtain physical netdev */
1446 if (netdev->priv_flags & IFF_802_1Q_VLAN) 1397 if (netdev->priv_flags & IFF_802_1Q_VLAN)
1447 phys_dev = vlan_dev_real_dev(netdev); 1398 phys_dev = vlan_dev_real_dev(netdev);
@@ -1805,18 +1756,10 @@ static int bnx2fc_disable(struct net_device *netdev)
1805 struct ethtool_drvinfo drvinfo; 1756 struct ethtool_drvinfo drvinfo;
1806 int rc = 0; 1757 int rc = 0;
1807 1758
1808 if (!rtnl_trylock()) { 1759 rtnl_lock();
1809 printk(KERN_ERR PFX "retrying for rtnl_lock\n");
1810 return -EIO;
1811 }
1812 1760
1813 mutex_lock(&bnx2fc_dev_lock); 1761 mutex_lock(&bnx2fc_dev_lock);
1814 1762
1815 if (THIS_MODULE->state != MODULE_STATE_LIVE) {
1816 rc = -ENODEV;
1817 goto nodev;
1818 }
1819
1820 /* obtain physical netdev */ 1763 /* obtain physical netdev */
1821 if (netdev->priv_flags & IFF_802_1Q_VLAN) 1764 if (netdev->priv_flags & IFF_802_1Q_VLAN)
1822 phys_dev = vlan_dev_real_dev(netdev); 1765 phys_dev = vlan_dev_real_dev(netdev);
@@ -1867,19 +1810,11 @@ static int bnx2fc_enable(struct net_device *netdev)
1867 struct ethtool_drvinfo drvinfo; 1810 struct ethtool_drvinfo drvinfo;
1868 int rc = 0; 1811 int rc = 0;
1869 1812
1870 if (!rtnl_trylock()) { 1813 rtnl_lock();
1871 printk(KERN_ERR PFX "retrying for rtnl_lock\n");
1872 return -EIO;
1873 }
1874 1814
1875 BNX2FC_MISC_DBG("Entered %s\n", __func__); 1815 BNX2FC_MISC_DBG("Entered %s\n", __func__);
1876 mutex_lock(&bnx2fc_dev_lock); 1816 mutex_lock(&bnx2fc_dev_lock);
1877 1817
1878 if (THIS_MODULE->state != MODULE_STATE_LIVE) {
1879 rc = -ENODEV;
1880 goto nodev;
1881 }
1882
1883 /* obtain physical netdev */ 1818 /* obtain physical netdev */
1884 if (netdev->priv_flags & IFF_802_1Q_VLAN) 1819 if (netdev->priv_flags & IFF_802_1Q_VLAN)
1885 phys_dev = vlan_dev_real_dev(netdev); 1820 phys_dev = vlan_dev_real_dev(netdev);
@@ -1942,18 +1877,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
1942 return -EIO; 1877 return -EIO;
1943 } 1878 }
1944 1879
1945 if (!rtnl_trylock()) { 1880 rtnl_lock();
1946 printk(KERN_ERR "trying for rtnl_lock\n");
1947 return -EIO;
1948 }
1949 mutex_lock(&bnx2fc_dev_lock);
1950 1881
1951#ifdef CONFIG_SCSI_BNX2X_FCOE_MODULE 1882 mutex_lock(&bnx2fc_dev_lock);
1952 if (THIS_MODULE->state != MODULE_STATE_LIVE) {
1953 rc = -ENODEV;
1954 goto mod_err;
1955 }
1956#endif
1957 1883
1958 if (!try_module_get(THIS_MODULE)) { 1884 if (!try_module_get(THIS_MODULE)) {
1959 rc = -EINVAL; 1885 rc = -EINVAL;
@@ -2506,7 +2432,7 @@ static struct scsi_host_template bnx2fc_shost_template = {
2506 .change_queue_type = fc_change_queue_type, 2432 .change_queue_type = fc_change_queue_type,
2507 .this_id = -1, 2433 .this_id = -1,
2508 .cmd_per_lun = 3, 2434 .cmd_per_lun = 3,
2509 .can_queue = (BNX2FC_MAX_OUTSTANDING_CMNDS/2), 2435 .can_queue = BNX2FC_CAN_QUEUE,
2510 .use_clustering = ENABLE_CLUSTERING, 2436 .use_clustering = ENABLE_CLUSTERING,
2511 .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD, 2437 .sg_tablesize = BNX2FC_MAX_BDS_PER_CMD,
2512 .max_sectors = 512, 2438 .max_sectors = 512,