diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2010-07-20 18:20:56 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 10:05:59 -0400 |
commit | 251748a99e631a2c46edcf9e519cfc60fae8153d (patch) | |
tree | 6255e513473fffde4691f761c53e82440d763d18 /drivers/scsi/libfc/fc_lport.c | |
parent | 079ecd8cfe95dfd28b74f3a00d66fdbcdfc8c611 (diff) |
[SCSI] libfc: add fc_frame_sid() and fc_frame_did() functions
To pave the way for eliminating exchanges from incoming requests,
add simple inline fc_frame_sid() and fc_frame_did() functions
which get the FC_IDs from the frame header. This can be almost
as efficient as getting them from the sequence/exchange.
Move ntohll, htonll, ntoh24 and hton24 to <scsi/fc_frame.h>
since we need them there and that's included by <scsi/libfc.h>
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>
Diffstat (limited to 'drivers/scsi/libfc/fc_lport.c')
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index ec9850c46170..be3c2cee829f 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -800,7 +800,6 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in, | |||
800 | struct fc_lport *lport) | 800 | struct fc_lport *lport) |
801 | { | 801 | { |
802 | struct fc_frame *fp; | 802 | struct fc_frame *fp; |
803 | struct fc_frame_header *fh; | ||
804 | struct fc_seq *sp; | 803 | struct fc_seq *sp; |
805 | struct fc_exch *ep; | 804 | struct fc_exch *ep; |
806 | struct fc_els_flogi *flp; | 805 | struct fc_els_flogi *flp; |
@@ -813,8 +812,7 @@ static void fc_lport_recv_flogi_req(struct fc_seq *sp_in, | |||
813 | FC_LPORT_DBG(lport, "Received FLOGI request while in state %s\n", | 812 | FC_LPORT_DBG(lport, "Received FLOGI request while in state %s\n", |
814 | fc_lport_state(lport)); | 813 | fc_lport_state(lport)); |
815 | 814 | ||
816 | fh = fc_frame_header_get(rx_fp); | 815 | remote_fid = fc_frame_sid(rx_fp); |
817 | remote_fid = ntoh24(fh->fh_s_id); | ||
818 | flp = fc_frame_payload_get(rx_fp, sizeof(*flp)); | 816 | flp = fc_frame_payload_get(rx_fp, sizeof(*flp)); |
819 | if (!flp) | 817 | if (!flp) |
820 | goto out; | 818 | goto out; |
@@ -910,7 +908,7 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp, | |||
910 | recv = fc_lport_recv_flogi_req; | 908 | recv = fc_lport_recv_flogi_req; |
911 | break; | 909 | break; |
912 | case ELS_LOGO: | 910 | case ELS_LOGO: |
913 | if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) | 911 | if (fc_frame_sid(fp) == FC_FID_FLOGI) |
914 | recv = fc_lport_recv_logo_req; | 912 | recv = fc_lport_recv_logo_req; |
915 | break; | 913 | break; |
916 | case ELS_RSCN: | 914 | case ELS_RSCN: |
@@ -1468,7 +1466,6 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1468 | void *lp_arg) | 1466 | void *lp_arg) |
1469 | { | 1467 | { |
1470 | struct fc_lport *lport = lp_arg; | 1468 | struct fc_lport *lport = lp_arg; |
1471 | struct fc_frame_header *fh; | ||
1472 | struct fc_els_flogi *flp; | 1469 | struct fc_els_flogi *flp; |
1473 | u32 did; | 1470 | u32 did; |
1474 | u16 csp_flags; | 1471 | u16 csp_flags; |
@@ -1496,8 +1493,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1496 | goto err; | 1493 | goto err; |
1497 | } | 1494 | } |
1498 | 1495 | ||
1499 | fh = fc_frame_header_get(fp); | 1496 | did = fc_frame_did(fp); |
1500 | did = ntoh24(fh->fh_d_id); | ||
1501 | if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { | 1497 | if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { |
1502 | flp = fc_frame_payload_get(fp, sizeof(*flp)); | 1498 | flp = fc_frame_payload_get(fp, sizeof(*flp)); |
1503 | if (flp) { | 1499 | if (flp) { |
@@ -1523,7 +1519,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1523 | "Port (%6.6x) entered " | 1519 | "Port (%6.6x) entered " |
1524 | "point-to-point mode\n", | 1520 | "point-to-point mode\n", |
1525 | lport->host->host_no, did); | 1521 | lport->host->host_no, did); |
1526 | fc_lport_ptp_setup(lport, ntoh24(fh->fh_s_id), | 1522 | fc_lport_ptp_setup(lport, fc_frame_sid(fp), |
1527 | get_unaligned_be64( | 1523 | get_unaligned_be64( |
1528 | &flp->fl_wwpn), | 1524 | &flp->fl_wwpn), |
1529 | get_unaligned_be64( | 1525 | get_unaligned_be64( |