]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[SCSI] libfc: change elsct to use FC_ID instead of rdata
authorJoe Eykholt <jeykholt@cisco.com>
Tue, 25 Aug 2009 21:00:55 +0000 (14:00 -0700)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 10 Sep 2009 17:07:41 +0000 (12:07 -0500)
tt.elsct_send is used by both FCP and by the rport state machine.
After further patches, these two modules will use different
structures for the remote port.

So, change elsct_send to use the FC_ID instead of the fc_rport_priv
as its argument.  It currently only uses the FC_ID anyway.

For CT requests the destination FC_ID is still implicitly 0xfffffc.
After further patches the did arg on CT requests will be used to
specify the FC_ID being inquired about for GPN_ID or other queries.

Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/libfc/fc_disc.c
drivers/scsi/libfc/fc_elsct.c
drivers/scsi/libfc/fc_fcp.c
drivers/scsi/libfc/fc_lport.c
drivers/scsi/libfc/fc_rport.c
include/scsi/fc_encode.h
include/scsi/libfc.h

index 448ffc388656820962685dd932980ba3f97c60ea..4b1f9faf639a4574ae706b9e497ac894133b00d1 100644 (file)
@@ -526,7 +526,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
        if (!fp)
                goto err;
 
-       if (lport->tt.elsct_send(lport, NULL, fp,
+       if (lport->tt.elsct_send(lport, 0, fp,
                                 FC_NS_GPN_FT,
                                 fc_disc_gpn_ft_resp,
                                 disc, lport->e_d_tov))
index 2b8a3bbc0399519f699eff74ea7d515b0fd25c55..5e8b011af50e69cc4100a6f9fa3312a8bdfa5db4 100644 (file)
@@ -32,7 +32,7 @@
  * fc_elsct_send - sends ELS/CT frame
  */
 static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
-                                   struct fc_rport_priv *rdata,
+                                   u32 did,
                                    struct fc_frame *fp,
                                    unsigned int op,
                                    void (*resp)(struct fc_seq *,
@@ -41,16 +41,17 @@ static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
                                    void *arg, u32 timer_msec)
 {
        enum fc_rctl r_ctl;
-       u32 did = FC_FID_NONE;
        enum fc_fh_type fh_type;
        int rc;
 
        /* ELS requests */
        if ((op >= ELS_LS_RJT) && (op <= ELS_AUTH_ELS))
-               rc = fc_els_fill(lport, rdata, fp, op, &r_ctl, &did, &fh_type);
-       else
+               rc = fc_els_fill(lport, did, fp, op, &r_ctl, &fh_type);
+       else {
                /* CT requests */
-               rc = fc_ct_fill(lport, fp, op, &r_ctl, &did, &fh_type);
+               rc = fc_ct_fill(lport, fp, op, &r_ctl, &fh_type);
+               did = FC_FID_DIR_SERV;
+       }
 
        if (rc)
                return NULL;
index a622096eb315f8b10e15765f1c92da7df10ca691..59a4408b27b5b4d4bd3eb248e66442a9c7c98ba7 100644 (file)
@@ -1308,7 +1308,7 @@ static void fc_fcp_rec(struct fc_fcp_pkt *fsp)
        fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id,
                       fc_host_port_id(rp->local_port->host), FC_TYPE_ELS,
                       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
-       if (lp->tt.elsct_send(lp, rport->dd_data, fp, ELS_REC, fc_fcp_rec_resp,
+       if (lp->tt.elsct_send(lp, rport->port_id, fp, ELS_REC, fc_fcp_rec_resp,
                              fsp, jiffies_to_msecs(FC_SCSI_REC_TOV))) {
                fc_fcp_pkt_hold(fsp);           /* hold while REC outstanding */
                return;
index 3c15abd35ffa1eb28ee7acc9fcf41a1ff0249354..aa605d2012e071ce32f98a261d0db26c5423b0ae 100644 (file)
@@ -1217,7 +1217,7 @@ static void fc_lport_enter_scr(struct fc_lport *lport)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, NULL, fp, ELS_SCR,
+       if (!lport->tt.elsct_send(lport, FC_FID_FCTRL, fp, ELS_SCR,
                                  fc_lport_scr_resp, lport, lport->e_d_tov))
                fc_lport_error(lport, fp);
 }
@@ -1258,7 +1258,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, NULL, fp, FC_NS_RFT_ID,
+       if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RFT_ID,
                                  fc_lport_rft_id_resp,
                                  lport, lport->e_d_tov))
                fc_lport_error(lport, fp);
@@ -1287,7 +1287,7 @@ static void fc_lport_enter_rpn_id(struct fc_lport *lport)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, NULL, fp, FC_NS_RPN_ID,
+       if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RPN_ID,
                                  fc_lport_rpn_id_resp,
                                  lport, lport->e_d_tov))
                fc_lport_error(lport, fp);
@@ -1443,8 +1443,8 @@ static void fc_lport_enter_logo(struct fc_lport *lport)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, NULL, fp, ELS_LOGO, fc_lport_logo_resp,
-                                 lport, lport->e_d_tov))
+       if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_LOGO,
+                                 fc_lport_logo_resp, lport, lport->e_d_tov))
                fc_lport_error(lport, fp);
 }
 
@@ -1567,7 +1567,7 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
        if (!fp)
                return fc_lport_error(lport, fp);
 
-       if (!lport->tt.elsct_send(lport, NULL, fp, ELS_FLOGI,
+       if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_FLOGI,
                                  fc_lport_flogi_resp, lport, lport->e_d_tov))
                fc_lport_error(lport, fp);
 }
index 13d3d758fb0e0f1d691ba4a3ef6ed4f55f4c3887..20371b445bb1a3145d6ff7e288e32cdbe23eb7a9 100644 (file)
@@ -593,7 +593,7 @@ static void fc_rport_enter_plogi(struct fc_rport_priv *rdata)
        }
        rdata->e_d_tov = lport->e_d_tov;
 
-       if (!lport->tt.elsct_send(lport, rdata, fp, ELS_PLOGI,
+       if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_PLOGI,
                                  fc_rport_plogi_resp, rdata, lport->e_d_tov))
                fc_rport_error_retry(rdata, fp);
        else
@@ -747,7 +747,7 @@ static void fc_rport_enter_prli(struct fc_rport_priv *rdata)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, rdata, fp, ELS_PRLI,
+       if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_PRLI,
                                  fc_rport_prli_resp, rdata, lport->e_d_tov))
                fc_rport_error_retry(rdata, fp);
        else
@@ -845,7 +845,7 @@ static void fc_rport_enter_rtv(struct fc_rport_priv *rdata)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, rdata, fp, ELS_RTV,
+       if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_RTV,
                                     fc_rport_rtv_resp, rdata, lport->e_d_tov))
                fc_rport_error_retry(rdata, fp);
        else
@@ -876,7 +876,7 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
                return;
        }
 
-       if (!lport->tt.elsct_send(lport, rdata, fp, ELS_LOGO,
+       if (!lport->tt.elsct_send(lport, rport->port_id, fp, ELS_LOGO,
                                  fc_rport_logo_resp, rdata, lport->e_d_tov))
                fc_rport_error_retry(rdata, fp);
        else
index 3ede1abad4b70d39a51318e0703ceb88fed7863d..24bf764f988480bf6324281c1a45b17bf0691450 100644 (file)
@@ -79,8 +79,9 @@ static inline struct fc_ct_req *fc_ct_hdr_fill(const struct fc_frame *fp,
 /**
  * fc_ct_fill - Fill in a name service request frame
  */
-static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
-                     unsigned int op, enum fc_rctl *r_ctl, u32 *did,
+static inline int fc_ct_fill(struct fc_lport *lport,
+                     struct fc_frame *fp,
+                     unsigned int op, enum fc_rctl *r_ctl,
                      enum fc_fh_type *fh_type)
 {
        struct fc_ct_req *ct;
@@ -110,7 +111,6 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
                return -EINVAL;
        }
        *r_ctl = FC_RCTL_DD_UNSOL_CTL;
-       *did = FC_FID_DIR_SERV;
        *fh_type = FC_TYPE_CT;
        return 0;
 }
@@ -250,53 +250,37 @@ static inline void fc_scr_fill(struct fc_lport *lport, struct fc_frame *fp)
  * fc_els_fill - Fill in an ELS  request frame
  */
 static inline int fc_els_fill(struct fc_lport *lport,
-                      struct fc_rport_priv *rdata,
+                      u32 did,
                       struct fc_frame *fp, unsigned int op,
-                      enum fc_rctl *r_ctl, u32 *did, enum fc_fh_type *fh_type)
+                      enum fc_rctl *r_ctl, enum fc_fh_type *fh_type)
 {
-       struct fc_rport *rport = PRIV_TO_RPORT(rdata);
-
        switch (op) {
        case ELS_PLOGI:
                fc_plogi_fill(lport, fp, ELS_PLOGI);
-               *did = rport->port_id;
                break;
 
        case ELS_FLOGI:
                fc_flogi_fill(lport, fp);
-               *did = FC_FID_FLOGI;
                break;
 
        case ELS_LOGO:
                fc_logo_fill(lport, fp);
-               *did = FC_FID_FLOGI;
-               /*
-                * if rport is valid then it
-                * is port logo, therefore
-                * set did to rport id.
-                */
-               if (rdata)
-                       *did = rport->port_id;
                break;
 
        case ELS_RTV:
                fc_rtv_fill(lport, fp);
-               *did = rport->port_id;
                break;
 
        case ELS_REC:
                fc_rec_fill(lport, fp);
-               *did = rport->port_id;
                break;
 
        case ELS_PRLI:
                fc_prli_fill(lport, fp);
-               *did = rport->port_id;
                break;
 
        case ELS_SCR:
                fc_scr_fill(lport, fp);
-               *did = FC_FID_FCTRL;
                break;
 
        default:
index df57cb762dc20dd4e73b653e2ed34617b017503a..2473167464c2081f13024e295ec132985117b8bc 100644 (file)
@@ -424,7 +424,7 @@ struct libfc_function_template {
         * STATUS: OPTIONAL
         */
        struct fc_seq *(*elsct_send)(struct fc_lport *lport,
-                                    struct fc_rport_priv *,
+                                    u32 did,
                                     struct fc_frame *fp,
                                     unsigned int op,
                                     void (*resp)(struct fc_seq *,