diff options
author | Robert Love <robert.w.love@intel.com> | 2010-05-07 18:18:41 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-05-16 22:22:34 -0400 |
commit | 7b2787ec15b9d1c2f716da61b0eec21a3f5e6520 (patch) | |
tree | 39b098d4253fa266ea75bf1f7feb75458e78b77d /drivers/scsi/libfc | |
parent | 5e4f8fe7b58f4da5043b7f219fe9193cddd9262e (diff) |
[SCSI] libfc: Move the port_id into lport
This patch creates a port_id member in struct fc_lport.
This allows libfc to just deal with fc_lport instances
instead of calling into the fc_host to get the port_id.
This change helps in only using symbols necessary for
operation from the libfc structures. libfc still needs
to change the fc_host_port_id() if the port_id changes
so the presentation layer (scsi_transport_fc) can provide
the user with the correct value, but libfc shouldn't
rely on the presentation layer for operational values.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_elsct.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_fcp.c | 14 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_libfc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 16 | ||||
-rw-r--r-- | drivers/scsi/libfc/fc_npiv.c | 4 |
7 files changed, 23 insertions, 19 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index b292272d296f..c7985da88099 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -440,7 +440,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | |||
440 | ids.port_id = ntoh24(np->fp_fid); | 440 | ids.port_id = ntoh24(np->fp_fid); |
441 | ids.port_name = ntohll(np->fp_wwpn); | 441 | ids.port_name = ntohll(np->fp_wwpn); |
442 | 442 | ||
443 | if (ids.port_id != fc_host_port_id(lport->host) && | 443 | if (ids.port_id != lport->port_id && |
444 | ids.port_name != lport->wwpn) { | 444 | ids.port_name != lport->wwpn) { |
445 | rdata = lport->tt.rport_create(lport, ids.port_id); | 445 | rdata = lport->tt.rport_create(lport, ids.port_id); |
446 | if (rdata) { | 446 | if (rdata) { |
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c index 53748724f2c5..e9412b710fab 100644 --- a/drivers/scsi/libfc/fc_elsct.c +++ b/drivers/scsi/libfc/fc_elsct.c | |||
@@ -63,7 +63,7 @@ struct fc_seq *fc_elsct_send(struct fc_lport *lport, u32 did, | |||
63 | return NULL; | 63 | return NULL; |
64 | } | 64 | } |
65 | 65 | ||
66 | fc_fill_fc_hdr(fp, r_ctl, did, fc_host_port_id(lport->host), fh_type, | 66 | fc_fill_fc_hdr(fp, r_ctl, did, lport->port_id, fh_type, |
67 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); | 67 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); |
68 | 68 | ||
69 | return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec); | 69 | return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec); |
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 6addbd6e41e2..104e0fba7c43 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
@@ -1927,7 +1927,7 @@ static void fc_exch_rrq(struct fc_exch *ep) | |||
1927 | did = ep->sid; | 1927 | did = ep->sid; |
1928 | 1928 | ||
1929 | fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did, | 1929 | fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did, |
1930 | fc_host_port_id(lport->host), FC_TYPE_ELS, | 1930 | lport->port_id, FC_TYPE_ELS, |
1931 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); | 1931 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); |
1932 | 1932 | ||
1933 | if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep, | 1933 | if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep, |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 81a7c976b373..ec1f66c4a9d4 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
@@ -490,7 +490,7 @@ crc_err: | |||
490 | if (stats->InvalidCRCCount++ < 5) | 490 | if (stats->InvalidCRCCount++ < 5) |
491 | printk(KERN_WARNING "libfc: CRC error on data " | 491 | printk(KERN_WARNING "libfc: CRC error on data " |
492 | "frame for port (%6.6x)\n", | 492 | "frame for port (%6.6x)\n", |
493 | fc_host_port_id(lport->host)); | 493 | lport->port_id); |
494 | put_cpu(); | 494 | put_cpu(); |
495 | /* | 495 | /* |
496 | * Assume the frame is total garbage. | 496 | * Assume the frame is total garbage. |
@@ -1109,7 +1109,7 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp, | |||
1109 | rpriv = rport->dd_data; | 1109 | rpriv = rport->dd_data; |
1110 | 1110 | ||
1111 | fc_fill_fc_hdr(fp, FC_RCTL_DD_UNSOL_CMD, rport->port_id, | 1111 | fc_fill_fc_hdr(fp, FC_RCTL_DD_UNSOL_CMD, rport->port_id, |
1112 | fc_host_port_id(rpriv->local_port->host), FC_TYPE_FCP, | 1112 | rpriv->local_port->port_id, FC_TYPE_FCP, |
1113 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); | 1113 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); |
1114 | 1114 | ||
1115 | seq = lport->tt.exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy, | 1115 | seq = lport->tt.exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy, |
@@ -1382,7 +1382,7 @@ static void fc_fcp_rec(struct fc_fcp_pkt *fsp) | |||
1382 | 1382 | ||
1383 | fr_seq(fp) = fsp->seq_ptr; | 1383 | fr_seq(fp) = fsp->seq_ptr; |
1384 | fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id, | 1384 | fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id, |
1385 | fc_host_port_id(rpriv->local_port->host), FC_TYPE_ELS, | 1385 | rpriv->local_port->port_id, FC_TYPE_ELS, |
1386 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); | 1386 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); |
1387 | if (lport->tt.elsct_send(lport, rport->port_id, fp, ELS_REC, | 1387 | if (lport->tt.elsct_send(lport, rport->port_id, fp, ELS_REC, |
1388 | fc_fcp_rec_resp, fsp, | 1388 | fc_fcp_rec_resp, fsp, |
@@ -1640,7 +1640,7 @@ static void fc_fcp_srr(struct fc_fcp_pkt *fsp, enum fc_rctl r_ctl, u32 offset) | |||
1640 | srr->srr_rel_off = htonl(offset); | 1640 | srr->srr_rel_off = htonl(offset); |
1641 | 1641 | ||
1642 | fc_fill_fc_hdr(fp, FC_RCTL_ELS4_REQ, rport->port_id, | 1642 | fc_fill_fc_hdr(fp, FC_RCTL_ELS4_REQ, rport->port_id, |
1643 | fc_host_port_id(rpriv->local_port->host), FC_TYPE_FCP, | 1643 | rpriv->local_port->port_id, FC_TYPE_FCP, |
1644 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); | 1644 | FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0); |
1645 | 1645 | ||
1646 | seq = lport->tt.exch_seq_send(lport, fp, fc_fcp_srr_resp, NULL, | 1646 | seq = lport->tt.exch_seq_send(lport, fp, fc_fcp_srr_resp, NULL, |
@@ -2101,12 +2101,12 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd) | |||
2101 | 2101 | ||
2102 | if (fc_fcp_lport_queue_ready(lport)) { | 2102 | if (fc_fcp_lport_queue_ready(lport)) { |
2103 | shost_printk(KERN_INFO, shost, "libfc: Host reset succeeded " | 2103 | shost_printk(KERN_INFO, shost, "libfc: Host reset succeeded " |
2104 | "on port (%6.6x)\n", fc_host_port_id(lport->host)); | 2104 | "on port (%6.6x)\n", lport->port_id); |
2105 | return SUCCESS; | 2105 | return SUCCESS; |
2106 | } else { | 2106 | } else { |
2107 | shost_printk(KERN_INFO, shost, "libfc: Host reset failed, " | 2107 | shost_printk(KERN_INFO, shost, "libfc: Host reset failed, " |
2108 | "port (%6.6x) is not ready.\n", | 2108 | "port (%6.6x) is not ready.\n", |
2109 | fc_host_port_id(lport->host)); | 2109 | lport->port_id); |
2110 | return FAILED; | 2110 | return FAILED; |
2111 | } | 2111 | } |
2112 | } | 2112 | } |
@@ -2191,7 +2191,7 @@ void fc_fcp_destroy(struct fc_lport *lport) | |||
2191 | 2191 | ||
2192 | if (!list_empty(&si->scsi_pkt_queue)) | 2192 | if (!list_empty(&si->scsi_pkt_queue)) |
2193 | printk(KERN_ERR "libfc: Leaked SCSI packets when destroying " | 2193 | printk(KERN_ERR "libfc: Leaked SCSI packets when destroying " |
2194 | "port (%6.6x)\n", fc_host_port_id(lport->host)); | 2194 | "port (%6.6x)\n", lport->port_id); |
2195 | 2195 | ||
2196 | mempool_destroy(si->scsi_pkt_pool); | 2196 | mempool_destroy(si->scsi_pkt_pool); |
2197 | kfree(si); | 2197 | kfree(si); |
diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h index efc6b3fe6f35..f5c0ca4b6ef8 100644 --- a/drivers/scsi/libfc/fc_libfc.h +++ b/drivers/scsi/libfc/fc_libfc.h | |||
@@ -47,7 +47,7 @@ extern unsigned int fc_debug_logging; | |||
47 | FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ | 47 | FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ |
48 | printk(KERN_INFO "host%u: lport %6.6x: " fmt, \ | 48 | printk(KERN_INFO "host%u: lport %6.6x: " fmt, \ |
49 | (lport)->host->host_no, \ | 49 | (lport)->host->host_no, \ |
50 | fc_host_port_id((lport)->host), ##args)) | 50 | (lport)->port_id, ##args)) |
51 | 51 | ||
52 | #define FC_DISC_DBG(disc, fmt, args...) \ | 52 | #define FC_DISC_DBG(disc, fmt, args...) \ |
53 | FC_CHECK_LOGGING(FC_DISC_LOGGING, \ | 53 | FC_CHECK_LOGGING(FC_DISC_LOGGING, \ |
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 7159bcfa8ec3..79c9e3ccd341 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -565,7 +565,7 @@ void __fc_linkup(struct fc_lport *lport) | |||
565 | void fc_linkup(struct fc_lport *lport) | 565 | void fc_linkup(struct fc_lport *lport) |
566 | { | 566 | { |
567 | printk(KERN_INFO "host%d: libfc: Link up on port (%6.6x)\n", | 567 | printk(KERN_INFO "host%d: libfc: Link up on port (%6.6x)\n", |
568 | lport->host->host_no, fc_host_port_id(lport->host)); | 568 | lport->host->host_no, lport->port_id); |
569 | 569 | ||
570 | mutex_lock(&lport->lp_mutex); | 570 | mutex_lock(&lport->lp_mutex); |
571 | __fc_linkup(lport); | 571 | __fc_linkup(lport); |
@@ -595,7 +595,7 @@ void __fc_linkdown(struct fc_lport *lport) | |||
595 | void fc_linkdown(struct fc_lport *lport) | 595 | void fc_linkdown(struct fc_lport *lport) |
596 | { | 596 | { |
597 | printk(KERN_INFO "host%d: libfc: Link down on port (%6.6x)\n", | 597 | printk(KERN_INFO "host%d: libfc: Link down on port (%6.6x)\n", |
598 | lport->host->host_no, fc_host_port_id(lport->host)); | 598 | lport->host->host_no, lport->port_id); |
599 | 599 | ||
600 | mutex_lock(&lport->lp_mutex); | 600 | mutex_lock(&lport->lp_mutex); |
601 | __fc_linkdown(lport); | 601 | __fc_linkdown(lport); |
@@ -697,7 +697,7 @@ void fc_lport_disc_callback(struct fc_lport *lport, enum fc_disc_event event) | |||
697 | case DISC_EV_FAILED: | 697 | case DISC_EV_FAILED: |
698 | printk(KERN_ERR "host%d: libfc: " | 698 | printk(KERN_ERR "host%d: libfc: " |
699 | "Discovery failed for port (%6.6x)\n", | 699 | "Discovery failed for port (%6.6x)\n", |
700 | lport->host->host_no, fc_host_port_id(lport->host)); | 700 | lport->host->host_no, lport->port_id); |
701 | mutex_lock(&lport->lp_mutex); | 701 | mutex_lock(&lport->lp_mutex); |
702 | fc_lport_enter_reset(lport); | 702 | fc_lport_enter_reset(lport); |
703 | mutex_unlock(&lport->lp_mutex); | 703 | mutex_unlock(&lport->lp_mutex); |
@@ -745,7 +745,11 @@ static void fc_lport_set_port_id(struct fc_lport *lport, u32 port_id, | |||
745 | printk(KERN_INFO "host%d: Assigned Port ID %6.6x\n", | 745 | printk(KERN_INFO "host%d: Assigned Port ID %6.6x\n", |
746 | lport->host->host_no, port_id); | 746 | lport->host->host_no, port_id); |
747 | 747 | ||
748 | lport->port_id = port_id; | ||
749 | |||
750 | /* Update the fc_host */ | ||
748 | fc_host_port_id(lport->host) = port_id; | 751 | fc_host_port_id(lport->host) = port_id; |
752 | |||
749 | if (lport->tt.lport_set_port_id) | 753 | if (lport->tt.lport_set_port_id) |
750 | lport->tt.lport_set_port_id(lport, port_id, fp); | 754 | lport->tt.lport_set_port_id(lport, port_id, fp); |
751 | } | 755 | } |
@@ -950,7 +954,7 @@ static void fc_lport_reset_locked(struct fc_lport *lport) | |||
950 | lport->tt.exch_mgr_reset(lport, 0, 0); | 954 | lport->tt.exch_mgr_reset(lport, 0, 0); |
951 | fc_host_fabric_name(lport->host) = 0; | 955 | fc_host_fabric_name(lport->host) = 0; |
952 | 956 | ||
953 | if (fc_host_port_id(lport->host)) | 957 | if (lport->port_id) |
954 | fc_lport_set_port_id(lport, 0, NULL); | 958 | fc_lport_set_port_id(lport, 0, NULL); |
955 | } | 959 | } |
956 | 960 | ||
@@ -1695,7 +1699,7 @@ static int fc_lport_els_request(struct fc_bsg_job *job, | |||
1695 | fh = fc_frame_header_get(fp); | 1699 | fh = fc_frame_header_get(fp); |
1696 | fh->fh_r_ctl = FC_RCTL_ELS_REQ; | 1700 | fh->fh_r_ctl = FC_RCTL_ELS_REQ; |
1697 | hton24(fh->fh_d_id, did); | 1701 | hton24(fh->fh_d_id, did); |
1698 | hton24(fh->fh_s_id, fc_host_port_id(lport->host)); | 1702 | hton24(fh->fh_s_id, lport->port_id); |
1699 | fh->fh_type = FC_TYPE_ELS; | 1703 | fh->fh_type = FC_TYPE_ELS; |
1700 | hton24(fh->fh_f_ctl, FC_FC_FIRST_SEQ | | 1704 | hton24(fh->fh_f_ctl, FC_FC_FIRST_SEQ | |
1701 | FC_FC_END_SEQ | FC_FC_SEQ_INIT); | 1705 | FC_FC_END_SEQ | FC_FC_SEQ_INIT); |
@@ -1755,7 +1759,7 @@ static int fc_lport_ct_request(struct fc_bsg_job *job, | |||
1755 | fh = fc_frame_header_get(fp); | 1759 | fh = fc_frame_header_get(fp); |
1756 | fh->fh_r_ctl = FC_RCTL_DD_UNSOL_CTL; | 1760 | fh->fh_r_ctl = FC_RCTL_DD_UNSOL_CTL; |
1757 | hton24(fh->fh_d_id, did); | 1761 | hton24(fh->fh_d_id, did); |
1758 | hton24(fh->fh_s_id, fc_host_port_id(lport->host)); | 1762 | hton24(fh->fh_s_id, lport->port_id); |
1759 | fh->fh_type = FC_TYPE_CT; | 1763 | fh->fh_type = FC_TYPE_CT; |
1760 | hton24(fh->fh_f_ctl, FC_FC_FIRST_SEQ | | 1764 | hton24(fh->fh_f_ctl, FC_FC_FIRST_SEQ | |
1761 | FC_FC_END_SEQ | FC_FC_SEQ_INIT); | 1765 | FC_FC_END_SEQ | FC_FC_SEQ_INIT); |
diff --git a/drivers/scsi/libfc/fc_npiv.c b/drivers/scsi/libfc/fc_npiv.c index 45b6f1e2df92..dd2b43bb1c70 100644 --- a/drivers/scsi/libfc/fc_npiv.c +++ b/drivers/scsi/libfc/fc_npiv.c | |||
@@ -69,7 +69,7 @@ struct fc_lport *fc_vport_id_lookup(struct fc_lport *n_port, u32 port_id) | |||
69 | struct fc_lport *lport = NULL; | 69 | struct fc_lport *lport = NULL; |
70 | struct fc_lport *vn_port; | 70 | struct fc_lport *vn_port; |
71 | 71 | ||
72 | if (fc_host_port_id(n_port->host) == port_id) | 72 | if (n_port->port_id == port_id) |
73 | return n_port; | 73 | return n_port; |
74 | 74 | ||
75 | if (port_id == FC_FID_FLOGI) | 75 | if (port_id == FC_FID_FLOGI) |
@@ -77,7 +77,7 @@ struct fc_lport *fc_vport_id_lookup(struct fc_lport *n_port, u32 port_id) | |||
77 | 77 | ||
78 | mutex_lock(&n_port->lp_mutex); | 78 | mutex_lock(&n_port->lp_mutex); |
79 | list_for_each_entry(vn_port, &n_port->vports, list) { | 79 | list_for_each_entry(vn_port, &n_port->vports, list) { |
80 | if (fc_host_port_id(vn_port->host) == port_id) { | 80 | if (vn_port->port_id == port_id) { |
81 | lport = vn_port; | 81 | lport = vn_port; |
82 | break; | 82 | break; |
83 | } | 83 | } |