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 /include/scsi | |
| 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 'include/scsi')
| -rw-r--r-- | include/scsi/fc_encode.h | 18 | ||||
| -rw-r--r-- | include/scsi/libfc.h | 2 |
2 files changed, 9 insertions, 11 deletions
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h index 8eb0a0fc0a71..9b4867c9c2d2 100644 --- a/include/scsi/fc_encode.h +++ b/include/scsi/fc_encode.h | |||
| @@ -74,7 +74,7 @@ static inline void fc_adisc_fill(struct fc_lport *lport, struct fc_frame *fp) | |||
| 74 | adisc->adisc_cmd = ELS_ADISC; | 74 | adisc->adisc_cmd = ELS_ADISC; |
| 75 | put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn); | 75 | put_unaligned_be64(lport->wwpn, &adisc->adisc_wwpn); |
| 76 | put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn); | 76 | put_unaligned_be64(lport->wwnn, &adisc->adisc_wwnn); |
| 77 | hton24(adisc->adisc_port_id, fc_host_port_id(lport->host)); | 77 | hton24(adisc->adisc_port_id, lport->port_id); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| @@ -127,15 +127,13 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
| 127 | 127 | ||
| 128 | case FC_NS_RFT_ID: | 128 | case FC_NS_RFT_ID: |
| 129 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); | 129 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rft)); |
| 130 | hton24(ct->payload.rft.fid.fp_fid, | 130 | hton24(ct->payload.rft.fid.fp_fid, lport->port_id); |
| 131 | fc_host_port_id(lport->host)); | ||
| 132 | ct->payload.rft.fts = lport->fcts; | 131 | ct->payload.rft.fts = lport->fcts; |
| 133 | break; | 132 | break; |
| 134 | 133 | ||
| 135 | case FC_NS_RFF_ID: | 134 | case FC_NS_RFF_ID: |
| 136 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); | 135 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rff_id)); |
| 137 | hton24(ct->payload.rff.fr_fid.fp_fid, | 136 | hton24(ct->payload.rff.fr_fid.fp_fid, lport->port_id); |
| 138 | fc_host_port_id(lport->host)); | ||
| 139 | ct->payload.rff.fr_type = FC_TYPE_FCP; | 137 | ct->payload.rff.fr_type = FC_TYPE_FCP; |
| 140 | if (lport->service_params & FCP_SPPF_INIT_FCN) | 138 | if (lport->service_params & FCP_SPPF_INIT_FCN) |
| 141 | ct->payload.rff.fr_feat = FCP_FEAT_INIT; | 139 | ct->payload.rff.fr_feat = FCP_FEAT_INIT; |
| @@ -145,16 +143,14 @@ static inline int fc_ct_fill(struct fc_lport *lport, | |||
| 145 | 143 | ||
| 146 | case FC_NS_RNN_ID: | 144 | case FC_NS_RNN_ID: |
| 147 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); | 145 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rn_id)); |
| 148 | hton24(ct->payload.rn.fr_fid.fp_fid, | 146 | hton24(ct->payload.rn.fr_fid.fp_fid, lport->port_id); |
| 149 | fc_host_port_id(lport->host)); | ||
| 150 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); | 147 | put_unaligned_be64(lport->wwnn, &ct->payload.rn.fr_wwn); |
| 151 | break; | 148 | break; |
| 152 | 149 | ||
| 153 | case FC_NS_RSPN_ID: | 150 | case FC_NS_RSPN_ID: |
| 154 | len = strnlen(fc_host_symbolic_name(lport->host), 255); | 151 | len = strnlen(fc_host_symbolic_name(lport->host), 255); |
| 155 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); | 152 | ct = fc_ct_hdr_fill(fp, op, sizeof(struct fc_ns_rspn) + len); |
| 156 | hton24(ct->payload.spn.fr_fid.fp_fid, | 153 | hton24(ct->payload.spn.fr_fid.fp_fid, lport->port_id); |
| 157 | fc_host_port_id(lport->host)); | ||
| 158 | strncpy(ct->payload.spn.fr_name, | 154 | strncpy(ct->payload.spn.fr_name, |
| 159 | fc_host_symbolic_name(lport->host), len); | 155 | fc_host_symbolic_name(lport->host), len); |
| 160 | ct->payload.spn.fr_name_len = len; | 156 | ct->payload.spn.fr_name_len = len; |
| @@ -268,7 +264,7 @@ static inline void fc_logo_fill(struct fc_lport *lport, struct fc_frame *fp) | |||
| 268 | logo = fc_frame_payload_get(fp, sizeof(*logo)); | 264 | logo = fc_frame_payload_get(fp, sizeof(*logo)); |
| 269 | memset(logo, 0, sizeof(*logo)); | 265 | memset(logo, 0, sizeof(*logo)); |
| 270 | logo->fl_cmd = ELS_LOGO; | 266 | logo->fl_cmd = ELS_LOGO; |
| 271 | hton24(logo->fl_n_port_id, fc_host_port_id(lport->host)); | 267 | hton24(logo->fl_n_port_id, lport->port_id); |
| 272 | logo->fl_n_port_wwn = htonll(lport->wwpn); | 268 | logo->fl_n_port_wwn = htonll(lport->wwpn); |
| 273 | } | 269 | } |
| 274 | 270 | ||
| @@ -295,7 +291,7 @@ static inline void fc_rec_fill(struct fc_lport *lport, struct fc_frame *fp) | |||
| 295 | rec = fc_frame_payload_get(fp, sizeof(*rec)); | 291 | rec = fc_frame_payload_get(fp, sizeof(*rec)); |
| 296 | memset(rec, 0, sizeof(*rec)); | 292 | memset(rec, 0, sizeof(*rec)); |
| 297 | rec->rec_cmd = ELS_REC; | 293 | rec->rec_cmd = ELS_REC; |
| 298 | hton24(rec->rec_s_id, fc_host_port_id(lport->host)); | 294 | hton24(rec->rec_s_id, lport->port_id); |
| 299 | rec->rec_ox_id = htons(ep->oxid); | 295 | rec->rec_ox_id = htons(ep->oxid); |
| 300 | rec->rec_rx_id = htons(ep->rxid); | 296 | rec->rec_rx_id = htons(ep->rxid); |
| 301 | } | 297 | } |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 1755fa7e9271..7495c0ba67ee 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
| @@ -780,6 +780,7 @@ struct fc_disc { | |||
| 780 | * @dev_stats: FCoE device stats (TODO: libfc should not be | 780 | * @dev_stats: FCoE device stats (TODO: libfc should not be |
| 781 | * FCoE aware) | 781 | * FCoE aware) |
| 782 | * @retry_count: Number of retries in the current state | 782 | * @retry_count: Number of retries in the current state |
| 783 | * @port_id: FC Port ID | ||
| 783 | * @wwpn: World Wide Port Name | 784 | * @wwpn: World Wide Port Name |
| 784 | * @wwnn: World Wide Node Name | 785 | * @wwnn: World Wide Node Name |
| 785 | * @service_params: Common service parameters | 786 | * @service_params: Common service parameters |
| @@ -826,6 +827,7 @@ struct fc_lport { | |||
| 826 | u8 retry_count; | 827 | u8 retry_count; |
| 827 | 828 | ||
| 828 | /* Fabric information */ | 829 | /* Fabric information */ |
| 830 | u32 port_id; | ||
| 829 | u64 wwpn; | 831 | u64 wwpn; |
| 830 | u64 wwnn; | 832 | u64 wwnn; |
| 831 | unsigned int service_params; | 833 | unsigned int service_params; |
