aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorVasu Dev <vasu.dev@intel.com>2009-03-27 12:03:29 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-03 10:23:00 -0400
commit5919a59503577c2dc6eaa8bfba0f7bde3f9924ba (patch)
tree8b24bf78c4d21296990a598128cd334b59e4b0db /drivers/scsi
parent8976f424d43c80ea32b6e847226e1a8ccdb6e748 (diff)
[SCSI] fcoe: prep work to completely remove fc_transport_fcoe code
The fcoe transport code was added for generic FCoE transport infrastructure to allow additional offload related module loading on demand, this is not required anymore after recently added different offload approach by having offload related func ops in netdev. This patch removes fcoe transport related code use, calls functions directly between existing libfcoe.c and fcoe_sw.c for now, for example fcoe_sw_destroy and fcoe_sw_create calling. The fcoe_sw.c and libfcoe.c code will be further consolidated in later patches and then also the default fcoe sw transport code file fcoe_sw.c will be completely removed. The fcoe transport code files are completely removed in next patch to keep this patch simple for reviewing. [This patch is an update to a previous patch. This update resolves a build error as well as fixes a defect related to not calling fc_release_transport().] Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/fcoe/Makefile3
-rw-r--r--drivers/scsi/fcoe/fcoe_sw.c37
-rw-r--r--drivers/scsi/fcoe/libfcoe.c25
3 files changed, 11 insertions, 54 deletions
diff --git a/drivers/scsi/fcoe/Makefile b/drivers/scsi/fcoe/Makefile
index b78da06d7c0e..e950adfe68c6 100644
--- a/drivers/scsi/fcoe/Makefile
+++ b/drivers/scsi/fcoe/Makefile
@@ -4,5 +4,4 @@ obj-$(CONFIG_FCOE) += fcoe.o
4 4
5fcoe-y := \ 5fcoe-y := \
6 libfcoe.o \ 6 libfcoe.o \
7 fcoe_sw.o \ 7 fcoe_sw.o
8 fc_transport_fcoe.o
diff --git a/drivers/scsi/fcoe/fcoe_sw.c b/drivers/scsi/fcoe/fcoe_sw.c
index a6753903fd40..f0602205f06f 100644
--- a/drivers/scsi/fcoe/fcoe_sw.c
+++ b/drivers/scsi/fcoe/fcoe_sw.c
@@ -36,7 +36,6 @@
36 36
37#include <scsi/libfc.h> 37#include <scsi/libfc.h>
38#include <scsi/libfcoe.h> 38#include <scsi/libfcoe.h>
39#include <scsi/fc_transport_fcoe.h>
40 39
41#define FCOE_SW_VERSION "0.1" 40#define FCOE_SW_VERSION "0.1"
42#define FCOE_SW_NAME "fcoesw" 41#define FCOE_SW_NAME "fcoesw"
@@ -302,7 +301,7 @@ static inline int fcoe_sw_em_config(struct fc_lport *lp)
302 * 301 *
303 * Returns: 0 if link is OK for use by FCoE. 302 * Returns: 0 if link is OK for use by FCoE.
304 */ 303 */
305static int fcoe_sw_destroy(struct net_device *netdev) 304int fcoe_sw_destroy(struct net_device *netdev)
306{ 305{
307 struct fc_lport *lp = NULL; 306 struct fc_lport *lp = NULL;
308 struct fcoe_softc *fc; 307 struct fcoe_softc *fc;
@@ -415,7 +414,7 @@ static struct libfc_function_template fcoe_sw_libfc_fcn_templ = {
415 * 414 *
416 * Returns : 0 on success 415 * Returns : 0 on success
417 */ 416 */
418static int fcoe_sw_create(struct net_device *netdev) 417int fcoe_sw_create(struct net_device *netdev)
419{ 418{
420 int rc; 419 int rc;
421 struct fc_lport *lp = NULL; 420 struct fc_lport *lp = NULL;
@@ -494,28 +493,7 @@ out_host_put:
494} 493}
495 494
496/** 495/**
497 * fcoe_sw_match() - The FCoE SW transport match function 496 * fcoe_sw_init() - attach to scsi transport
498 *
499 * Returns : false always
500 */
501static bool fcoe_sw_match(struct net_device *netdev)
502{
503 /* FIXME - for sw transport, always return false */
504 return false;
505}
506
507/* the sw hba fcoe transport */
508struct fcoe_transport fcoe_sw_transport = {
509 .name = "fcoesw",
510 .create = fcoe_sw_create,
511 .destroy = fcoe_sw_destroy,
512 .match = fcoe_sw_match,
513 .vendor = 0x0,
514 .device = 0xffff,
515};
516
517/**
518 * fcoe_sw_init() - Registers fcoe_sw_transport
519 * 497 *
520 * Returns : 0 on success 498 * Returns : 0 on success
521 */ 499 */
@@ -530,23 +508,16 @@ int __init fcoe_sw_init(void)
530 return -ENODEV; 508 return -ENODEV;
531 } 509 }
532 510
533 mutex_init(&fcoe_sw_transport.devlock);
534 INIT_LIST_HEAD(&fcoe_sw_transport.devlist);
535
536 /* register sw transport */
537 fcoe_transport_register(&fcoe_sw_transport);
538 return 0; 511 return 0;
539} 512}
540 513
541/** 514/**
542 * fcoe_sw_exit() - Unregisters fcoe_sw_transport 515 * fcoe_sw_exit() - detach from scsi transport
543 * 516 *
544 * Returns : 0 on success 517 * Returns : 0 on success
545 */ 518 */
546int __exit fcoe_sw_exit(void) 519int __exit fcoe_sw_exit(void)
547{ 520{
548 /* dettach the transport */
549 fc_release_transport(scsi_transport_fcoe_sw); 521 fc_release_transport(scsi_transport_fcoe_sw);
550 fcoe_transport_unregister(&fcoe_sw_transport);
551 return 0; 522 return 0;
552} 523}
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 951d2448ad61..334db95f36af 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -44,7 +44,6 @@
44#include <scsi/libfc.h> 44#include <scsi/libfc.h>
45#include <scsi/fc_frame.h> 45#include <scsi/fc_frame.h>
46#include <scsi/libfcoe.h> 46#include <scsi/libfcoe.h>
47#include <scsi/fc_transport_fcoe.h>
48 47
49static int debug_fcoe; 48static int debug_fcoe;
50 49
@@ -1081,10 +1080,9 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
1081 rc = -ENODEV; 1080 rc = -ENODEV;
1082 goto out_putdev; 1081 goto out_putdev;
1083 } 1082 }
1084 /* pass to transport */ 1083 rc = fcoe_sw_destroy(netdev);
1085 rc = fcoe_transport_release(netdev);
1086 if (rc) { 1084 if (rc) {
1087 printk(KERN_ERR "fcoe: fcoe_transport_release(%s) failed\n", 1085 printk(KERN_ERR "fcoe: fcoe_sw_destroy(%s) failed\n",
1088 netdev->name); 1086 netdev->name);
1089 rc = -EIO; 1087 rc = -EIO;
1090 goto out_putdev; 1088 goto out_putdev;
@@ -1121,10 +1119,9 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
1121 } 1119 }
1122 fcoe_ethdrv_get(netdev); 1120 fcoe_ethdrv_get(netdev);
1123 1121
1124 /* pass to transport */ 1122 rc = fcoe_sw_create(netdev);
1125 rc = fcoe_transport_attach(netdev);
1126 if (rc) { 1123 if (rc) {
1127 printk(KERN_ERR "fcoe: fcoe_transport_attach(%s) failed\n", 1124 printk(KERN_ERR "fcoe: fcoe_sw_create(%s) failed\n",
1128 netdev->name); 1125 netdev->name);
1129 fcoe_ethdrv_put(netdev); 1126 fcoe_ethdrv_put(netdev);
1130 rc = -EIO; 1127 rc = -EIO;
@@ -1429,10 +1426,6 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config);
1429/** 1426/**
1430 * fcoe_init() - fcoe module loading initialization 1427 * fcoe_init() - fcoe module loading initialization
1431 * 1428 *
1432 * Initialization routine
1433 * 1. Will create fc transport software structure
1434 * 2. initialize the link list of port information structure
1435 *
1436 * Returns 0 on success, negative on failure 1429 * Returns 0 on success, negative on failure
1437 */ 1430 */
1438static int __init fcoe_init(void) 1431static int __init fcoe_init(void)
@@ -1464,9 +1457,6 @@ static int __init fcoe_init(void)
1464 1457
1465 mod_timer(&fcoe_timer, jiffies + (10 * HZ)); 1458 mod_timer(&fcoe_timer, jiffies + (10 * HZ));
1466 1459
1467 /* initiatlize the fcoe transport */
1468 fcoe_transport_init();
1469
1470 fcoe_sw_init(); 1460 fcoe_sw_init();
1471 1461
1472 return 0; 1462 return 0;
@@ -1495,9 +1485,9 @@ static void __exit fcoe_exit(void)
1495 /* Stop the timer */ 1485 /* Stop the timer */
1496 del_timer_sync(&fcoe_timer); 1486 del_timer_sync(&fcoe_timer);
1497 1487
1498 /* releases the associated fcoe transport for each lport */ 1488 /* releases the associated fcoe hosts */
1499 list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list) 1489 list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list)
1500 fcoe_transport_release(fc->real_dev); 1490 fcoe_sw_destroy(fc->real_dev);
1501 1491
1502 unregister_hotcpu_notifier(&fcoe_cpu_notifier); 1492 unregister_hotcpu_notifier(&fcoe_cpu_notifier);
1503 1493
@@ -1507,8 +1497,5 @@ static void __exit fcoe_exit(void)
1507 1497
1508 /* remove sw trasnport */ 1498 /* remove sw trasnport */
1509 fcoe_sw_exit(); 1499 fcoe_sw_exit();
1510
1511 /* detach the transport */
1512 fcoe_transport_exit();
1513} 1500}
1514module_exit(fcoe_exit); 1501module_exit(fcoe_exit);