All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>,
	Felix Beck <felix@linux.vnet.ibm.com>
Subject: [patch 07/11] zfcp: Simplify mask lookups for incoming RSCNs
Date: Fri, 19 Dec 2008 16:56:58 +0100	[thread overview]
Message-ID: <20081219155754.721970000@de.ibm.com> (raw)
In-Reply-To: 20081219155651.010878000@de.ibm.com

[-- Attachment #1: rscn-range.diff --]
[-- Type: text/plain, Size: 2512 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

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>
---
 drivers/s390/scsi/zfcp_def.h |   14 --------------
 drivers/s390/scsi/zfcp_fc.c  |   31 +++++++++++++++----------------
 2 files changed, 15 insertions(+), 30 deletions(-)

--- a/drivers/s390/scsi/zfcp_def.h	2008-12-19 14:38:34.000000000 +0100
+++ b/drivers/s390/scsi/zfcp_def.h	2008-12-19 14:38:37.000000000 +0100
@@ -158,20 +158,6 @@ struct fcp_rscn_element {
         u32 nport_did:24;
 } __attribute__((packed));
 
-#define ZFCP_PORT_ADDRESS   0x0
-#define ZFCP_AREA_ADDRESS   0x1
-#define ZFCP_DOMAIN_ADDRESS 0x2
-#define ZFCP_FABRIC_ADDRESS 0x3
-
-#define ZFCP_PORTS_RANGE_PORT   0xFFFFFF
-#define ZFCP_PORTS_RANGE_AREA   0xFFFF00
-#define ZFCP_PORTS_RANGE_DOMAIN 0xFF0000
-#define ZFCP_PORTS_RANGE_FABRIC 0x000000
-
-#define ZFCP_NO_PORTS_PER_AREA    0x100
-#define ZFCP_NO_PORTS_PER_DOMAIN  0x10000
-#define ZFCP_NO_PORTS_PER_FABRIC  0x1000000
-
 /* see fc-ph */
 struct fcp_logo {
         u32 command;
--- a/drivers/s390/scsi/zfcp_fc.c	2008-12-19 14:38:13.000000000 +0100
+++ b/drivers/s390/scsi/zfcp_fc.c	2008-12-19 14:38:37.000000000 +0100
@@ -8,6 +8,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;
@@ -157,22 +171,7 @@ static void zfcp_fc_incoming_rscn(struct
 	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);

-- 

  parent reply	other threads:[~2008-12-19 15:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19 15:56 [patch 00/11] zfcp patches for 2.6.29 Christof Schmitt
2008-12-19 15:56 ` [patch 01/11] zfcp: Fix message line break Christof Schmitt
2008-12-19 15:56 ` [patch 02/11] zfcp: register with SCSI layer on ccw registration Christof Schmitt
2008-12-19 15:56 ` [patch 03/11] zfcp: Simplify SBAL allocation to fix sparse warnings Christof Schmitt
2008-12-19 15:56 ` [patch 04/11] zfcp: Remove adapter list Christof Schmitt
2008-12-19 15:56 ` [patch 05/11] zfcp: fix compile warning Christof Schmitt
2008-12-19 15:56 ` [patch 06/11] zfcp: Remove initial device data from zfcp_data Christof Schmitt
2008-12-19 15:56 ` Christof Schmitt [this message]
2008-12-19 15:56 ` [patch 08/11] zfcp: remove DID_DID flag Christof Schmitt
2008-12-19 15:57 ` [patch 09/11] zfcp: Remove busid macro Christof Schmitt
2008-12-19 15:57 ` [patch 10/11] zfcp: Add support for unchained FSF requests Christof Schmitt
2008-12-19 15:57 ` [patch 11/11] zfcp: Remove unnecessary warning message Christof Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081219155754.721970000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=felix@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.