Skip to content

Commit 5919a59

Browse files
Vasu Devjejb
authored andcommitted
[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>
1 parent 8976f42 commit 5919a59

4 files changed

Lines changed: 13 additions & 54 deletions

File tree

‎drivers/scsi/fcoe/Makefile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ obj-$(CONFIG_FCOE) += fcoe.o
44

55
fcoe-y := \
66
libfcoe.o \
7-
fcoe_sw.o \
8-
fc_transport_fcoe.o
7+
fcoe_sw.o

‎drivers/scsi/fcoe/fcoe_sw.c‎

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636

3737
#include <scsi/libfc.h>
3838
#include <scsi/libfcoe.h>
39-
#include <scsi/fc_transport_fcoe.h>
4039

4140
#define FCOE_SW_VERSION "0.1"
4241
#define FCOE_SW_NAME "fcoesw"
@@ -302,7 +301,7 @@ static inline int fcoe_sw_em_config(struct fc_lport *lp)
302301
*
303302
* Returns: 0 if link is OK for use by FCoE.
304303
*/
305-
static int fcoe_sw_destroy(struct net_device *netdev)
304+
int fcoe_sw_destroy(struct net_device *netdev)
306305
{
307306
struct fc_lport *lp = NULL;
308307
struct fcoe_softc *fc;
@@ -415,7 +414,7 @@ static struct libfc_function_template fcoe_sw_libfc_fcn_templ = {
415414
*
416415
* Returns : 0 on success
417416
*/
418-
static int fcoe_sw_create(struct net_device *netdev)
417+
int fcoe_sw_create(struct net_device *netdev)
419418
{
420419
int rc;
421420
struct fc_lport *lp = NULL;
@@ -494,28 +493,7 @@ static int fcoe_sw_create(struct net_device *netdev)
494493
}
495494

496495
/**
497-
* fcoe_sw_match() - The FCoE SW transport match function
498-
*
499-
* Returns : false always
500-
*/
501-
static 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 */
508-
struct 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
496+
* fcoe_sw_init() - attach to scsi transport
519497
*
520498
* Returns : 0 on success
521499
*/
@@ -530,23 +508,16 @@ int __init fcoe_sw_init(void)
530508
return -ENODEV;
531509
}
532510

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);
538511
return 0;
539512
}
540513

541514
/**
542-
* fcoe_sw_exit() - Unregisters fcoe_sw_transport
515+
* fcoe_sw_exit() - detach from scsi transport
543516
*
544517
* Returns : 0 on success
545518
*/
546519
int __exit fcoe_sw_exit(void)
547520
{
548-
/* dettach the transport */
549521
fc_release_transport(scsi_transport_fcoe_sw);
550-
fcoe_transport_unregister(&fcoe_sw_transport);
551522
return 0;
552523
}

‎drivers/scsi/fcoe/libfcoe.c‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include <scsi/libfc.h>
4545
#include <scsi/fc_frame.h>
4646
#include <scsi/libfcoe.h>
47-
#include <scsi/fc_transport_fcoe.h>
4847

4948
static int debug_fcoe;
5049

@@ -1081,10 +1080,9 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
10811080
rc = -ENODEV;
10821081
goto out_putdev;
10831082
}
1084-
/* pass to transport */
1085-
rc = fcoe_transport_release(netdev);
1083+
rc = fcoe_sw_destroy(netdev);
10861084
if (rc) {
1087-
printk(KERN_ERR "fcoe: fcoe_transport_release(%s) failed\n",
1085+
printk(KERN_ERR "fcoe: fcoe_sw_destroy(%s) failed\n",
10881086
netdev->name);
10891087
rc = -EIO;
10901088
goto out_putdev;
@@ -1121,10 +1119,9 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
11211119
}
11221120
fcoe_ethdrv_get(netdev);
11231121

1124-
/* pass to transport */
1125-
rc = fcoe_transport_attach(netdev);
1122+
rc = fcoe_sw_create(netdev);
11261123
if (rc) {
1127-
printk(KERN_ERR "fcoe: fcoe_transport_attach(%s) failed\n",
1124+
printk(KERN_ERR "fcoe: fcoe_sw_create(%s) failed\n",
11281125
netdev->name);
11291126
fcoe_ethdrv_put(netdev);
11301127
rc = -EIO;
@@ -1429,10 +1426,6 @@ EXPORT_SYMBOL_GPL(fcoe_libfc_config);
14291426
/**
14301427
* fcoe_init() - fcoe module loading initialization
14311428
*
1432-
* Initialization routine
1433-
* 1. Will create fc transport software structure
1434-
* 2. initialize the link list of port information structure
1435-
*
14361429
* Returns 0 on success, negative on failure
14371430
*/
14381431
static int __init fcoe_init(void)
@@ -1464,9 +1457,6 @@ static int __init fcoe_init(void)
14641457

14651458
mod_timer(&fcoe_timer, jiffies + (10 * HZ));
14661459

1467-
/* initiatlize the fcoe transport */
1468-
fcoe_transport_init();
1469-
14701460
fcoe_sw_init();
14711461

14721462
return 0;
@@ -1495,9 +1485,9 @@ static void __exit fcoe_exit(void)
14951485
/* Stop the timer */
14961486
del_timer_sync(&fcoe_timer);
14971487

1498-
/* releases the associated fcoe transport for each lport */
1488+
/* releases the associated fcoe hosts */
14991489
list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list)
1500-
fcoe_transport_release(fc->real_dev);
1490+
fcoe_sw_destroy(fc->real_dev);
15011491

15021492
unregister_hotcpu_notifier(&fcoe_cpu_notifier);
15031493

@@ -1507,8 +1497,5 @@ static void __exit fcoe_exit(void)
15071497

15081498
/* remove sw trasnport */
15091499
fcoe_sw_exit();
1510-
1511-
/* detach the transport */
1512-
fcoe_transport_exit();
15131500
}
15141501
module_exit(fcoe_exit);

‎include/scsi/libfcoe.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,6 @@ int fcoe_libfc_config(struct fc_lport *, struct libfc_function_template *);
149149
/* fcoe sw hba */
150150
int __init fcoe_sw_init(void);
151151
int __exit fcoe_sw_exit(void);
152+
int fcoe_sw_create(struct net_device *);
153+
int fcoe_sw_destroy(struct net_device *);
152154
#endif /* _LIBFCOE_H */

0 commit comments

Comments
 (0)