libfc, fcoe, bnx2fc: Always use fcoe_disc_init for discovery layer initialization
authorRobert Love <robert.w.love@intel.com>
Mon, 25 Mar 2013 18:00:27 +0000 (11:00 -0700)
committerRobert Love <robert.w.love@intel.com>
Mon, 25 Mar 2013 23:01:10 +0000 (16:01 -0700)
Currently libfcoe is doing some libfc discovery layer initialization outside of
libfc. This patch moves this code into libfc and sets up a split in discovery
(one time) initialization code and (re-configurable) settings that will come in
the next patch.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Jack Morgan <jack.morgan@intel.com>
Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
drivers/scsi/fcoe/fcoe_ctlr.c
drivers/scsi/libfc/fc_disc.c
include/scsi/libfc.h

index cc4791cf575b30f1e716c04339cb6fc007cd20a5..b867b1bfa908d906df35a038b7e1f8acf9c6f628 100644 (file)
@@ -939,7 +939,7 @@ static int bnx2fc_libfc_config(struct fc_lport *lport)
        fc_elsct_init(lport);
        fc_exch_init(lport);
        fc_rport_init(lport);
-       fc_disc_init(lport);
+       fc_disc_init(lport, lport);
        return 0;
 }
 
index 08c3bc398da2c1b234dadb62a56f1e1b47da5500..ba2f977a6e1db8a417d54a378e21ec740ff8d54b 100644 (file)
@@ -2826,6 +2826,8 @@ unlock:
 int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,
                      const struct libfc_function_template *tt, int init_fcp)
 {
+       void *priv = lport;
+
        /* Set the function pointers set by the LLDD */
        memcpy(&lport->tt, tt, sizeof(*tt));
        if (init_fcp && fc_fcp_init(lport))
@@ -2842,12 +2844,11 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip,
                lport->tt.disc_start = fcoe_ctlr_disc_start;
                lport->tt.disc_stop = fcoe_ctlr_disc_stop;
                lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final;
-               mutex_init(&lport->disc.disc_mutex);
-               INIT_LIST_HEAD(&lport->disc.rports);
-               lport->disc.priv = fip;
-       } else {
-               fc_disc_init(lport);
+               priv = fip;
        }
+
+       fc_disc_init(lport, priv);
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(fcoe_libfc_config);
index 8e561e6a557cd956188366488d5b4ed3dfe66021..141c54b970826ed5c53a11b2911ad88a7a7ff77e 100644 (file)
@@ -714,8 +714,9 @@ static void fc_disc_stop_final(struct fc_lport *lport)
 /**
  * fc_disc_init() - Initialize the discovery layer for a local port
  * @lport: The local port that needs the discovery layer to be initialized
+ * @priv: Private data structre for users of the discovery layer
  */
-int fc_disc_init(struct fc_lport *lport)
+int fc_disc_init(struct fc_lport *lport, void *priv)
 {
        struct fc_disc *disc;
 
@@ -736,7 +737,7 @@ int fc_disc_init(struct fc_lport *lport)
        mutex_init(&disc->disc_mutex);
        INIT_LIST_HEAD(&disc->rports);
 
-       disc->priv = lport;
+       disc->priv = priv;
 
        return 0;
 }
index 399162b50a8d3479e68183f63f8e227f8db5f6c5..add2a498bd44fcdf1d1faddb6e585d4f2ba9268a 100644 (file)
@@ -1074,7 +1074,7 @@ void fc_rport_terminate_io(struct fc_rport *);
 /*
  * DISCOVERY LAYER
  *****************************/
-int fc_disc_init(struct fc_lport *);
+int fc_disc_init(struct fc_lport *, void *);
 
 static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)
 {