diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2008-12-19 10:56:58 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:38:27 -0500 |
commit | e0d7fcb5ecad495a54f7334e410f5e16e1da7f78 (patch) | |
tree | f891ec120082f334fada993d6c6bb54e279ff010 /drivers | |
parent | 3623ecba19660d1d838f8b1a4d1e80007d603617 (diff) |
[SCSI] zfcp: Simplify mask lookups for incoming RSCNs
Use an array for looking up the mask corresponding to the 2-bit
information instead of the switch/case.
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Acked-by: Felix Beck <felix@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 14 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.c | 31 |
2 files changed, 15 insertions, 30 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 9ca91316e068..4f3b7a5ce7fe 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -159,20 +159,6 @@ struct fcp_rscn_element { | |||
159 | u32 nport_did:24; | 159 | u32 nport_did:24; |
160 | } __attribute__((packed)); | 160 | } __attribute__((packed)); |
161 | 161 | ||
162 | #define ZFCP_PORT_ADDRESS 0x0 | ||
163 | #define ZFCP_AREA_ADDRESS 0x1 | ||
164 | #define ZFCP_DOMAIN_ADDRESS 0x2 | ||
165 | #define ZFCP_FABRIC_ADDRESS 0x3 | ||
166 | |||
167 | #define ZFCP_PORTS_RANGE_PORT 0xFFFFFF | ||
168 | #define ZFCP_PORTS_RANGE_AREA 0xFFFF00 | ||
169 | #define ZFCP_PORTS_RANGE_DOMAIN 0xFF0000 | ||
170 | #define ZFCP_PORTS_RANGE_FABRIC 0x000000 | ||
171 | |||
172 | #define ZFCP_NO_PORTS_PER_AREA 0x100 | ||
173 | #define ZFCP_NO_PORTS_PER_DOMAIN 0x10000 | ||
174 | #define ZFCP_NO_PORTS_PER_FABRIC 0x1000000 | ||
175 | |||
176 | /* see fc-ph */ | 162 | /* see fc-ph */ |
177 | struct fcp_logo { | 163 | struct fcp_logo { |
178 | u32 command; | 164 | u32 command; |
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index f009f2a7ec3e..396f05ed912f 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c | |||
@@ -11,6 +11,20 @@ | |||
11 | 11 | ||
12 | #include "zfcp_ext.h" | 12 | #include "zfcp_ext.h" |
13 | 13 | ||
14 | enum rscn_address_format { | ||
15 | RSCN_PORT_ADDRESS = 0x0, | ||
16 | RSCN_AREA_ADDRESS = 0x1, | ||
17 | RSCN_DOMAIN_ADDRESS = 0x2, | ||
18 | RSCN_FABRIC_ADDRESS = 0x3, | ||
19 | }; | ||
20 | |||
21 | static u32 rscn_range_mask[] = { | ||
22 | [RSCN_PORT_ADDRESS] = 0xFFFFFF, | ||
23 | [RSCN_AREA_ADDRESS] = 0xFFFF00, | ||
24 | [RSCN_DOMAIN_ADDRESS] = 0xFF0000, | ||
25 | [RSCN_FABRIC_ADDRESS] = 0x000000, | ||
26 | }; | ||
27 | |||
14 | struct ct_iu_gpn_ft_req { | 28 | struct ct_iu_gpn_ft_req { |
15 | struct ct_hdr header; | 29 | struct ct_hdr header; |
16 | u8 flags; | 30 | u8 flags; |
@@ -160,22 +174,7 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) | |||
160 | for (i = 1; i < no_entries; i++) { | 174 | for (i = 1; i < no_entries; i++) { |
161 | /* skip head and start with 1st element */ | 175 | /* skip head and start with 1st element */ |
162 | fcp_rscn_element++; | 176 | fcp_rscn_element++; |
163 | switch (fcp_rscn_element->addr_format) { | 177 | range_mask = rscn_range_mask[fcp_rscn_element->addr_format]; |
164 | case ZFCP_PORT_ADDRESS: | ||
165 | range_mask = ZFCP_PORTS_RANGE_PORT; | ||
166 | break; | ||
167 | case ZFCP_AREA_ADDRESS: | ||
168 | range_mask = ZFCP_PORTS_RANGE_AREA; | ||
169 | break; | ||
170 | case ZFCP_DOMAIN_ADDRESS: | ||
171 | range_mask = ZFCP_PORTS_RANGE_DOMAIN; | ||
172 | break; | ||
173 | case ZFCP_FABRIC_ADDRESS: | ||
174 | range_mask = ZFCP_PORTS_RANGE_FABRIC; | ||
175 | break; | ||
176 | default: | ||
177 | continue; | ||
178 | } | ||
179 | _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element); | 178 | _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element); |
180 | } | 179 | } |
181 | schedule_work(&fsf_req->adapter->scan_work); | 180 | schedule_work(&fsf_req->adapter->scan_work); |