aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe/fcoe.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-05-19 00:08:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-19 00:08:20 -0400
commitbb803cfbecb03a0cf8dc7e1864f18dda6631af00 (patch)
tree6c0989693bea6f50cfa5c6bb14f52ec19668def3 /drivers/scsi/fcoe/fcoe.c
parent3878fb6fdbceecca20b15748f807340854220f06 (diff)
parent511e11e396dc596825ce04d53d7f6d579404bc01 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/scsi/fcoe/fcoe.c
Diffstat (limited to 'drivers/scsi/fcoe/fcoe.c')
-rw-r--r--drivers/scsi/fcoe/fcoe.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index f2d16127bd0a..ce33f107b0a0 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -57,7 +57,7 @@ DEFINE_RWLOCK(fcoe_hostlist_lock);
57DEFINE_TIMER(fcoe_timer, NULL, 0, 0); 57DEFINE_TIMER(fcoe_timer, NULL, 0, 0);
58DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu); 58DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu);
59 59
60/* Function Prototyes */ 60/* Function Prototypes */
61static int fcoe_reset(struct Scsi_Host *shost); 61static int fcoe_reset(struct Scsi_Host *shost);
62static int fcoe_xmit(struct fc_lport *, struct fc_frame *); 62static int fcoe_xmit(struct fc_lport *, struct fc_frame *);
63static int fcoe_rcv(struct sk_buff *, struct net_device *, 63static int fcoe_rcv(struct sk_buff *, struct net_device *,
@@ -190,7 +190,6 @@ static void fcoe_update_src_mac(struct fcoe_ctlr *fip, u8 *old, u8 *new)
190/** 190/**
191 * fcoe_lport_config() - sets up the fc_lport 191 * fcoe_lport_config() - sets up the fc_lport
192 * @lp: ptr to the fc_lport 192 * @lp: ptr to the fc_lport
193 * @shost: ptr to the parent scsi host
194 * 193 *
195 * Returns: 0 for success 194 * Returns: 0 for success
196 */ 195 */
@@ -351,6 +350,7 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
351 dev_unicast_add(fc->real_dev, flogi_maddr, ETH_ALEN); 350 dev_unicast_add(fc->real_dev, flogi_maddr, ETH_ALEN);
352 if (fc->ctlr.spma) 351 if (fc->ctlr.spma)
353 dev_unicast_add(fc->real_dev, fc->ctlr.ctl_src_addr, ETH_ALEN); 352 dev_unicast_add(fc->real_dev, fc->ctlr.ctl_src_addr, ETH_ALEN);
353 dev_mc_add(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
354 rtnl_unlock(); 354 rtnl_unlock();
355 355
356 /* 356 /*
@@ -470,7 +470,7 @@ static int fcoe_if_destroy(struct net_device *netdev)
470 if (lp->emp) 470 if (lp->emp)
471 fc_exch_mgr_free(lp->emp); 471 fc_exch_mgr_free(lp->emp);
472 472
473 /* Free the per-CPU revieve threads */ 473 /* Free the per-CPU receive threads */
474 fcoe_percpu_clean(lp); 474 fcoe_percpu_clean(lp);
475 475
476 /* Free existing skbs */ 476 /* Free existing skbs */
@@ -755,7 +755,7 @@ static void fcoe_percpu_thread_destroy(unsigned int cpu)
755 } 755 }
756#else 756#else
757 /* 757 /*
758 * This a non-SMP scenario where the singluar Rx thread is 758 * This a non-SMP scenario where the singular Rx thread is
759 * being removed. Free all skbs and stop the thread. 759 * being removed. Free all skbs and stop the thread.
760 */ 760 */
761 spin_lock_bh(&p->fcoe_rx_list.lock); 761 spin_lock_bh(&p->fcoe_rx_list.lock);
@@ -812,7 +812,7 @@ static struct notifier_block fcoe_cpu_notifier = {
812 * @skb: the receive skb 812 * @skb: the receive skb
813 * @dev: associated net device 813 * @dev: associated net device
814 * @ptype: context 814 * @ptype: context
815 * @odldev: last device 815 * @olddev: last device
816 * 816 *
817 * this function will receive the packet and build fc frame and pass it up 817 * this function will receive the packet and build fc frame and pass it up
818 * 818 *
@@ -919,7 +919,6 @@ err2:
919 kfree_skb(skb); 919 kfree_skb(skb);
920 return -1; 920 return -1;
921} 921}
922EXPORT_SYMBOL_GPL(fcoe_rcv);
923 922
924/** 923/**
925 * fcoe_start_io() - pass to netdev to start xmit for fcoe 924 * fcoe_start_io() - pass to netdev to start xmit for fcoe
@@ -940,7 +939,7 @@ static inline int fcoe_start_io(struct sk_buff *skb)
940} 939}
941 940
942/** 941/**
943 * fcoe_get_paged_crc_eof() - in case we need alloc a page for crc_eof 942 * fcoe_get_paged_crc_eof() - in case we need to alloc a page for crc_eof
944 * @skb: the skb to be xmitted 943 * @skb: the skb to be xmitted
945 * @tlen: total len 944 * @tlen: total len
946 * 945 *
@@ -982,7 +981,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
982 981
983/** 982/**
984 * fcoe_fc_crc() - calculates FC CRC in this fcoe skb 983 * fcoe_fc_crc() - calculates FC CRC in this fcoe skb
985 * @fp: the fc_frame containg data to be checksummed 984 * @fp: the fc_frame containing data to be checksummed
986 * 985 *
987 * This uses crc32() to calculate the crc for fc frame 986 * This uses crc32() to calculate the crc for fc frame
988 * Return : 32 bit crc 987 * Return : 32 bit crc
@@ -1046,7 +1045,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
1046 wlen = skb->len / FCOE_WORD_TO_BYTE; 1045 wlen = skb->len / FCOE_WORD_TO_BYTE;
1047 1046
1048 if (!lp->link_up) { 1047 if (!lp->link_up) {
1049 kfree(skb); 1048 kfree_skb(skb);
1050 return 0; 1049 return 0;
1051 } 1050 }
1052 1051
@@ -1097,7 +1096,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
1097 cp = NULL; 1096 cp = NULL;
1098 } 1097 }
1099 1098
1100 /* adjust skb netowrk/transport offsets to match mac/fcoe/fc */ 1099 /* adjust skb network/transport offsets to match mac/fcoe/fc */
1101 skb_push(skb, elen + hlen); 1100 skb_push(skb, elen + hlen);
1102 skb_reset_mac_header(skb); 1101 skb_reset_mac_header(skb);
1103 skb_reset_network_header(skb); 1102 skb_reset_network_header(skb);
@@ -1158,7 +1157,6 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
1158 1157
1159 return 0; 1158 return 0;
1160} 1159}
1161EXPORT_SYMBOL_GPL(fcoe_xmit);
1162 1160
1163/** 1161/**
1164 * fcoe_percpu_receive_thread() - recv thread per cpu 1162 * fcoe_percpu_receive_thread() - recv thread per cpu
@@ -1331,17 +1329,16 @@ void fcoe_watchdog(ulong vp)
1331 1329
1332 1330
1333/** 1331/**
1334 * fcoe_check_wait_queue() - put the skb into fcoe pending xmit queue 1332 * fcoe_check_wait_queue() - attempt to clear the transmit backlog
1335 * @lp: the fc_port for this skb 1333 * @lp: the fc_lport
1336 * @skb: the associated skb to be xmitted
1337 * 1334 *
1338 * This empties the wait_queue, dequeue the head of the wait_queue queue 1335 * This empties the wait_queue, dequeue the head of the wait_queue queue
1339 * and calls fcoe_start_io() for each packet, if all skb have been 1336 * and calls fcoe_start_io() for each packet, if all skb have been
1340 * transmitted, return qlen or -1 if a error occurs, then restore 1337 * transmitted, return qlen or -1 if a error occurs, then restore
1341 * wait_queue and try again later. 1338 * wait_queue and try again later.
1342 * 1339 *
1343 * The wait_queue is used when the skb transmit fails. skb will go 1340 * The wait_queue is used when the skb transmit fails. skb will go
1344 * in the wait_queue which will be emptied by the time function OR 1341 * in the wait_queue which will be emptied by the timer function or
1345 * by the next skb transmit. 1342 * by the next skb transmit.
1346 * 1343 *
1347 * Returns: 0 for success 1344 * Returns: 0 for success
@@ -1390,10 +1387,6 @@ out:
1390 */ 1387 */
1391static void fcoe_dev_setup() 1388static void fcoe_dev_setup()
1392{ 1389{
1393 /*
1394 * here setup a interface specific wd time to
1395 * monitor the link state
1396 */
1397 register_netdevice_notifier(&fcoe_notifier); 1390 register_netdevice_notifier(&fcoe_notifier);
1398} 1391}
1399 1392
@@ -1472,10 +1465,9 @@ out:
1472 1465
1473/** 1466/**
1474 * fcoe_if_to_netdev() - parse a name buffer to get netdev 1467 * fcoe_if_to_netdev() - parse a name buffer to get netdev
1475 * @ifname: fixed array for output parsed ifname
1476 * @buffer: incoming buffer to be copied 1468 * @buffer: incoming buffer to be copied
1477 * 1469 *
1478 * Returns: NULL or ptr to netdeive 1470 * Returns: NULL or ptr to net_device
1479 */ 1471 */
1480static struct net_device *fcoe_if_to_netdev(const char *buffer) 1472static struct net_device *fcoe_if_to_netdev(const char *buffer)
1481{ 1473{
@@ -1493,7 +1485,7 @@ static struct net_device *fcoe_if_to_netdev(const char *buffer)
1493} 1485}
1494 1486
1495/** 1487/**
1496 * fcoe_netdev_to_module_owner() - finds out the nic drive moddule of the netdev 1488 * fcoe_netdev_to_module_owner() - finds out the driver module of the netdev
1497 * @netdev: the target netdev 1489 * @netdev: the target netdev
1498 * 1490 *
1499 * Returns: ptr to the struct module, NULL for failure 1491 * Returns: ptr to the struct module, NULL for failure
@@ -1523,7 +1515,7 @@ fcoe_netdev_to_module_owner(const struct net_device *netdev)
1523 * Holds the Ethernet driver module by try_module_get() for 1515 * Holds the Ethernet driver module by try_module_get() for
1524 * the corresponding netdev. 1516 * the corresponding netdev.
1525 * 1517 *
1526 * Returns: 0 for succsss 1518 * Returns: 0 for success
1527 */ 1519 */
1528static int fcoe_ethdrv_get(const struct net_device *netdev) 1520static int fcoe_ethdrv_get(const struct net_device *netdev)
1529{ 1521{
@@ -1545,7 +1537,7 @@ static int fcoe_ethdrv_get(const struct net_device *netdev)
1545 * Releases the Ethernet driver module by module_put for 1537 * Releases the Ethernet driver module by module_put for
1546 * the corresponding netdev. 1538 * the corresponding netdev.
1547 * 1539 *
1548 * Returns: 0 for succsss 1540 * Returns: 0 for success
1549 */ 1541 */
1550static int fcoe_ethdrv_put(const struct net_device *netdev) 1542static int fcoe_ethdrv_put(const struct net_device *netdev)
1551{ 1543{
@@ -1563,7 +1555,7 @@ static int fcoe_ethdrv_put(const struct net_device *netdev)
1563 1555
1564/** 1556/**
1565 * fcoe_destroy() - handles the destroy from sysfs 1557 * fcoe_destroy() - handles the destroy from sysfs
1566 * @buffer: expcted to be a eth if name 1558 * @buffer: expected to be an eth if name
1567 * @kp: associated kernel param 1559 * @kp: associated kernel param
1568 * 1560 *
1569 * Returns: 0 for success 1561 * Returns: 0 for success
@@ -1600,7 +1592,7 @@ out_nodev:
1600 1592
1601/** 1593/**
1602 * fcoe_create() - Handles the create call from sysfs 1594 * fcoe_create() - Handles the create call from sysfs
1603 * @buffer: expcted to be a eth if name 1595 * @buffer: expected to be an eth if name
1604 * @kp: associated kernel param 1596 * @kp: associated kernel param
1605 * 1597 *
1606 * Returns: 0 for success 1598 * Returns: 0 for success
@@ -1687,7 +1679,6 @@ int fcoe_link_ok(struct fc_lport *lp)
1687 1679
1688 return rc; 1680 return rc;
1689} 1681}
1690EXPORT_SYMBOL_GPL(fcoe_link_ok);
1691 1682
1692/** 1683/**
1693 * fcoe_percpu_clean() - Clear the pending skbs for an lport 1684 * fcoe_percpu_clean() - Clear the pending skbs for an lport
@@ -1719,7 +1710,6 @@ void fcoe_percpu_clean(struct fc_lport *lp)
1719 spin_unlock_bh(&pp->fcoe_rx_list.lock); 1710 spin_unlock_bh(&pp->fcoe_rx_list.lock);
1720 } 1711 }
1721} 1712}
1722EXPORT_SYMBOL_GPL(fcoe_percpu_clean);
1723 1713
1724/** 1714/**
1725 * fcoe_clean_pending_queue() - Dequeue a skb and free it 1715 * fcoe_clean_pending_queue() - Dequeue a skb and free it
@@ -1740,7 +1730,6 @@ void fcoe_clean_pending_queue(struct fc_lport *lp)
1740 } 1730 }
1741 spin_unlock_bh(&fc->fcoe_pending_queue.lock); 1731 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
1742} 1732}
1743EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue);
1744 1733
1745/** 1734/**
1746 * fcoe_reset() - Resets the fcoe 1735 * fcoe_reset() - Resets the fcoe
@@ -1754,11 +1743,10 @@ int fcoe_reset(struct Scsi_Host *shost)
1754 fc_lport_reset(lport); 1743 fc_lport_reset(lport);
1755 return 0; 1744 return 0;
1756} 1745}
1757EXPORT_SYMBOL_GPL(fcoe_reset);
1758 1746
1759/** 1747/**
1760 * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device 1748 * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device
1761 * @device: this is currently ptr to net_device 1749 * @dev: this is currently ptr to net_device
1762 * 1750 *
1763 * Returns: NULL or the located fcoe_softc 1751 * Returns: NULL or the located fcoe_softc
1764 */ 1752 */
@@ -1792,11 +1780,10 @@ struct fc_lport *fcoe_hostlist_lookup(const struct net_device *netdev)
1792 1780
1793 return (fc) ? fc->ctlr.lp : NULL; 1781 return (fc) ? fc->ctlr.lp : NULL;
1794} 1782}
1795EXPORT_SYMBOL_GPL(fcoe_hostlist_lookup);
1796 1783
1797/** 1784/**
1798 * fcoe_hostlist_add() - Add a lport to lports list 1785 * fcoe_hostlist_add() - Add a lport to lports list
1799 * @lp: ptr to the fc_lport to badded 1786 * @lp: ptr to the fc_lport to be added
1800 * 1787 *
1801 * Returns: 0 for success 1788 * Returns: 0 for success
1802 */ 1789 */
@@ -1813,11 +1800,10 @@ int fcoe_hostlist_add(const struct fc_lport *lp)
1813 } 1800 }
1814 return 0; 1801 return 0;
1815} 1802}
1816EXPORT_SYMBOL_GPL(fcoe_hostlist_add);
1817 1803
1818/** 1804/**
1819 * fcoe_hostlist_remove() - remove a lport from lports list 1805 * fcoe_hostlist_remove() - remove a lport from lports list
1820 * @lp: ptr to the fc_lport to badded 1806 * @lp: ptr to the fc_lport to be removed
1821 * 1807 *
1822 * Returns: 0 for success 1808 * Returns: 0 for success
1823 */ 1809 */
@@ -1833,7 +1819,6 @@ int fcoe_hostlist_remove(const struct fc_lport *lp)
1833 1819
1834 return 0; 1820 return 0;
1835} 1821}
1836EXPORT_SYMBOL_GPL(fcoe_hostlist_remove);
1837 1822
1838/** 1823/**
1839 * fcoe_init() - fcoe module loading initialization 1824 * fcoe_init() - fcoe module loading initialization