From e0d7fcb5ecad495a54f7334e410f5e16e1da7f78 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Fri, 19 Dec 2008 16:56:58 +0100 Subject: [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 Acked-by: Felix Beck Signed-off-by: James Bottomley --- drivers/s390/scsi/zfcp_fc.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'drivers/s390/scsi/zfcp_fc.c') diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index f009f2a7ec3..396f05ed912 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -11,6 +11,20 @@ #include "zfcp_ext.h" +enum rscn_address_format { + RSCN_PORT_ADDRESS = 0x0, + RSCN_AREA_ADDRESS = 0x1, + RSCN_DOMAIN_ADDRESS = 0x2, + RSCN_FABRIC_ADDRESS = 0x3, +}; + +static u32 rscn_range_mask[] = { + [RSCN_PORT_ADDRESS] = 0xFFFFFF, + [RSCN_AREA_ADDRESS] = 0xFFFF00, + [RSCN_DOMAIN_ADDRESS] = 0xFF0000, + [RSCN_FABRIC_ADDRESS] = 0x000000, +}; + struct ct_iu_gpn_ft_req { struct ct_hdr header; u8 flags; @@ -160,22 +174,7 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req) for (i = 1; i < no_entries; i++) { /* skip head and start with 1st element */ fcp_rscn_element++; - switch (fcp_rscn_element->addr_format) { - case ZFCP_PORT_ADDRESS: - range_mask = ZFCP_PORTS_RANGE_PORT; - break; - case ZFCP_AREA_ADDRESS: - range_mask = ZFCP_PORTS_RANGE_AREA; - break; - case ZFCP_DOMAIN_ADDRESS: - range_mask = ZFCP_PORTS_RANGE_DOMAIN; - break; - case ZFCP_FABRIC_ADDRESS: - range_mask = ZFCP_PORTS_RANGE_FABRIC; - break; - default: - continue; - } + range_mask = rscn_range_mask[fcp_rscn_element->addr_format]; _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element); } schedule_work(&fsf_req->adapter->scan_work); -- cgit v1.2.3