diff options
author | Tejun Heo <tj@kernel.org> | 2009-07-03 18:13:18 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-07-03 18:13:18 -0400 |
commit | c43768cbb7655ea5ff782ae250f6e2ef4297cf98 (patch) | |
tree | 3982e41dde3eecaa3739a5d1a8ed18d04bd74f01 /drivers/scsi/libfc/fc_disc.c | |
parent | 1a8dd307cc0a2119be4e578c517795464e6dabba (diff) | |
parent | 746a99a5af60ee676afa2ba469ccd1373493c7e7 (diff) |
Merge branch 'master' into for-next
Pull linus#master to merge PER_CPU_DEF_ATTRIBUTES and alpha build fix
changes. As alpha in percpu tree uses 'weak' attribute instead of
inline assembly, there's no need for __used attribute.
Conflicts:
arch/alpha/include/asm/percpu.h
arch/mn10300/kernel/vmlinux.lds.S
include/linux/percpu-defs.h
Diffstat (limited to 'drivers/scsi/libfc/fc_disc.c')
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 4c880656990b..6fabf66972b9 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -45,14 +45,6 @@ | |||
45 | 45 | ||
46 | #define FC_DISC_DELAY 3 | 46 | #define FC_DISC_DELAY 3 |
47 | 47 | ||
48 | static int fc_disc_debug; | ||
49 | |||
50 | #define FC_DEBUG_DISC(fmt...) \ | ||
51 | do { \ | ||
52 | if (fc_disc_debug) \ | ||
53 | FC_DBG(fmt); \ | ||
54 | } while (0) | ||
55 | |||
56 | static void fc_disc_gpn_ft_req(struct fc_disc *); | 48 | static void fc_disc_gpn_ft_req(struct fc_disc *); |
57 | static void fc_disc_gpn_ft_resp(struct fc_seq *, struct fc_frame *, void *); | 49 | static void fc_disc_gpn_ft_resp(struct fc_seq *, struct fc_frame *, void *); |
58 | static int fc_disc_new_target(struct fc_disc *, struct fc_rport *, | 50 | static int fc_disc_new_target(struct fc_disc *, struct fc_rport *, |
@@ -137,8 +129,8 @@ static void fc_disc_rport_callback(struct fc_lport *lport, | |||
137 | struct fc_rport_libfc_priv *rdata = rport->dd_data; | 129 | struct fc_rport_libfc_priv *rdata = rport->dd_data; |
138 | struct fc_disc *disc = &lport->disc; | 130 | struct fc_disc *disc = &lport->disc; |
139 | 131 | ||
140 | FC_DEBUG_DISC("Received a %d event for port (%6x)\n", event, | 132 | FC_DISC_DBG(disc, "Received a %d event for port (%6x)\n", event, |
141 | rport->port_id); | 133 | rport->port_id); |
142 | 134 | ||
143 | switch (event) { | 135 | switch (event) { |
144 | case RPORT_EV_CREATED: | 136 | case RPORT_EV_CREATED: |
@@ -191,8 +183,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, | |||
191 | 183 | ||
192 | lport = disc->lport; | 184 | lport = disc->lport; |
193 | 185 | ||
194 | FC_DEBUG_DISC("Received an RSCN event on port (%6x)\n", | 186 | FC_DISC_DBG(disc, "Received an RSCN event\n"); |
195 | fc_host_port_id(lport->host)); | ||
196 | 187 | ||
197 | /* make sure the frame contains an RSCN message */ | 188 | /* make sure the frame contains an RSCN message */ |
198 | rp = fc_frame_payload_get(fp, sizeof(*rp)); | 189 | rp = fc_frame_payload_get(fp, sizeof(*rp)); |
@@ -225,8 +216,8 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, | |||
225 | */ | 216 | */ |
226 | switch (fmt) { | 217 | switch (fmt) { |
227 | case ELS_ADDR_FMT_PORT: | 218 | case ELS_ADDR_FMT_PORT: |
228 | FC_DEBUG_DISC("Port address format for port (%6x)\n", | 219 | FC_DISC_DBG(disc, "Port address format for port " |
229 | ntoh24(pp->rscn_fid)); | 220 | "(%6x)\n", ntoh24(pp->rscn_fid)); |
230 | dp = kzalloc(sizeof(*dp), GFP_KERNEL); | 221 | dp = kzalloc(sizeof(*dp), GFP_KERNEL); |
231 | if (!dp) { | 222 | if (!dp) { |
232 | redisc = 1; | 223 | redisc = 1; |
@@ -243,19 +234,19 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, | |||
243 | case ELS_ADDR_FMT_DOM: | 234 | case ELS_ADDR_FMT_DOM: |
244 | case ELS_ADDR_FMT_FAB: | 235 | case ELS_ADDR_FMT_FAB: |
245 | default: | 236 | default: |
246 | FC_DEBUG_DISC("Address format is (%d)\n", fmt); | 237 | FC_DISC_DBG(disc, "Address format is (%d)\n", fmt); |
247 | redisc = 1; | 238 | redisc = 1; |
248 | break; | 239 | break; |
249 | } | 240 | } |
250 | } | 241 | } |
251 | lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); | 242 | lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); |
252 | if (redisc) { | 243 | if (redisc) { |
253 | FC_DEBUG_DISC("RSCN received: rediscovering\n"); | 244 | FC_DISC_DBG(disc, "RSCN received: rediscovering\n"); |
254 | fc_disc_restart(disc); | 245 | fc_disc_restart(disc); |
255 | } else { | 246 | } else { |
256 | FC_DEBUG_DISC("RSCN received: not rediscovering. " | 247 | FC_DISC_DBG(disc, "RSCN received: not rediscovering. " |
257 | "redisc %d state %d in_prog %d\n", | 248 | "redisc %d state %d in_prog %d\n", |
258 | redisc, lport->state, disc->pending); | 249 | redisc, lport->state, disc->pending); |
259 | list_for_each_entry_safe(dp, next, &disc_ports, peers) { | 250 | list_for_each_entry_safe(dp, next, &disc_ports, peers) { |
260 | list_del(&dp->peers); | 251 | list_del(&dp->peers); |
261 | rport = lport->tt.rport_lookup(lport, dp->ids.port_id); | 252 | rport = lport->tt.rport_lookup(lport, dp->ids.port_id); |
@@ -270,7 +261,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, | |||
270 | fc_frame_free(fp); | 261 | fc_frame_free(fp); |
271 | return; | 262 | return; |
272 | reject: | 263 | reject: |
273 | FC_DEBUG_DISC("Received a bad RSCN frame\n"); | 264 | FC_DISC_DBG(disc, "Received a bad RSCN frame\n"); |
274 | rjt_data.fp = NULL; | 265 | rjt_data.fp = NULL; |
275 | rjt_data.reason = ELS_RJT_LOGIC; | 266 | rjt_data.reason = ELS_RJT_LOGIC; |
276 | rjt_data.explan = ELS_EXPL_NONE; | 267 | rjt_data.explan = ELS_EXPL_NONE; |
@@ -302,7 +293,8 @@ static void fc_disc_recv_req(struct fc_seq *sp, struct fc_frame *fp, | |||
302 | mutex_unlock(&disc->disc_mutex); | 293 | mutex_unlock(&disc->disc_mutex); |
303 | break; | 294 | break; |
304 | default: | 295 | default: |
305 | FC_DBG("Received an unsupported request. opcode (%x)\n", op); | 296 | FC_DISC_DBG(disc, "Received an unsupported request, " |
297 | "the opcode is (%x)\n", op); | ||
306 | break; | 298 | break; |
307 | } | 299 | } |
308 | } | 300 | } |
@@ -320,12 +312,10 @@ static void fc_disc_restart(struct fc_disc *disc) | |||
320 | struct fc_rport_libfc_priv *rdata, *next; | 312 | struct fc_rport_libfc_priv *rdata, *next; |
321 | struct fc_lport *lport = disc->lport; | 313 | struct fc_lport *lport = disc->lport; |
322 | 314 | ||
323 | FC_DEBUG_DISC("Restarting discovery for port (%6x)\n", | 315 | FC_DISC_DBG(disc, "Restarting discovery\n"); |
324 | fc_host_port_id(lport->host)); | ||
325 | 316 | ||
326 | list_for_each_entry_safe(rdata, next, &disc->rports, peers) { | 317 | list_for_each_entry_safe(rdata, next, &disc->rports, peers) { |
327 | rport = PRIV_TO_RPORT(rdata); | 318 | rport = PRIV_TO_RPORT(rdata); |
328 | FC_DEBUG_DISC("list_del(%6x)\n", rport->port_id); | ||
329 | list_del(&rdata->peers); | 319 | list_del(&rdata->peers); |
330 | lport->tt.rport_logoff(rport); | 320 | lport->tt.rport_logoff(rport); |
331 | } | 321 | } |
@@ -485,8 +475,7 @@ static void fc_disc_done(struct fc_disc *disc) | |||
485 | struct fc_lport *lport = disc->lport; | 475 | struct fc_lport *lport = disc->lport; |
486 | enum fc_disc_event event; | 476 | enum fc_disc_event event; |
487 | 477 | ||
488 | FC_DEBUG_DISC("Discovery complete for port (%6x)\n", | 478 | FC_DISC_DBG(disc, "Discovery complete\n"); |
489 | fc_host_port_id(lport->host)); | ||
490 | 479 | ||
491 | event = disc->event; | 480 | event = disc->event; |
492 | disc->event = DISC_EV_NONE; | 481 | disc->event = DISC_EV_NONE; |
@@ -510,10 +499,10 @@ static void fc_disc_error(struct fc_disc *disc, struct fc_frame *fp) | |||
510 | { | 499 | { |
511 | struct fc_lport *lport = disc->lport; | 500 | struct fc_lport *lport = disc->lport; |
512 | unsigned long delay = 0; | 501 | unsigned long delay = 0; |
513 | if (fc_disc_debug) | 502 | |
514 | FC_DBG("Error %ld, retries %d/%d\n", | 503 | FC_DISC_DBG(disc, "Error %ld, retries %d/%d\n", |
515 | PTR_ERR(fp), disc->retry_count, | 504 | PTR_ERR(fp), disc->retry_count, |
516 | FC_DISC_RETRY_LIMIT); | 505 | FC_DISC_RETRY_LIMIT); |
517 | 506 | ||
518 | if (!fp || PTR_ERR(fp) == -FC_EX_TIMEOUT) { | 507 | if (!fp || PTR_ERR(fp) == -FC_EX_TIMEOUT) { |
519 | /* | 508 | /* |
@@ -649,9 +638,9 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | |||
649 | &disc->rogue_rports); | 638 | &disc->rogue_rports); |
650 | lport->tt.rport_login(rport); | 639 | lport->tt.rport_login(rport); |
651 | } else | 640 | } else |
652 | FC_DBG("Failed to allocate memory for " | 641 | printk(KERN_WARNING "libfc: Failed to allocate " |
653 | "the newly discovered port (%6x)\n", | 642 | "memory for the newly discovered port " |
654 | dp.ids.port_id); | 643 | "(%6x)\n", dp.ids.port_id); |
655 | } | 644 | } |
656 | 645 | ||
657 | if (np->fp_flags & FC_NS_FID_LAST) { | 646 | if (np->fp_flags & FC_NS_FID_LAST) { |
@@ -671,9 +660,8 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | |||
671 | */ | 660 | */ |
672 | if (error == 0 && len > 0 && len < sizeof(*np)) { | 661 | if (error == 0 && len > 0 && len < sizeof(*np)) { |
673 | if (np != &disc->partial_buf) { | 662 | if (np != &disc->partial_buf) { |
674 | FC_DEBUG_DISC("Partial buffer remains " | 663 | FC_DISC_DBG(disc, "Partial buffer remains " |
675 | "for discovery by (%6x)\n", | 664 | "for discovery\n"); |
676 | fc_host_port_id(lport->host)); | ||
677 | memcpy(&disc->partial_buf, np, len); | 665 | memcpy(&disc->partial_buf, np, len); |
678 | } | 666 | } |
679 | disc->buf_len = (unsigned char) len; | 667 | disc->buf_len = (unsigned char) len; |
@@ -721,8 +709,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
721 | int error; | 709 | int error; |
722 | 710 | ||
723 | mutex_lock(&disc->disc_mutex); | 711 | mutex_lock(&disc->disc_mutex); |
724 | FC_DEBUG_DISC("Received a GPN_FT response on port (%6x)\n", | 712 | FC_DISC_DBG(disc, "Received a GPN_FT response\n"); |
725 | fc_host_port_id(disc->lport->host)); | ||
726 | 713 | ||
727 | if (IS_ERR(fp)) { | 714 | if (IS_ERR(fp)) { |
728 | fc_disc_error(disc, fp); | 715 | fc_disc_error(disc, fp); |
@@ -738,30 +725,30 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
738 | disc->seq_count == 0) { | 725 | disc->seq_count == 0) { |
739 | cp = fc_frame_payload_get(fp, sizeof(*cp)); | 726 | cp = fc_frame_payload_get(fp, sizeof(*cp)); |
740 | if (!cp) { | 727 | if (!cp) { |
741 | FC_DBG("GPN_FT response too short, len %d\n", | 728 | FC_DISC_DBG(disc, "GPN_FT response too short, len %d\n", |
742 | fr_len(fp)); | 729 | fr_len(fp)); |
743 | } else if (ntohs(cp->ct_cmd) == FC_FS_ACC) { | 730 | } else if (ntohs(cp->ct_cmd) == FC_FS_ACC) { |
744 | 731 | ||
745 | /* Accepted, parse the response. */ | 732 | /* Accepted, parse the response. */ |
746 | buf = cp + 1; | 733 | buf = cp + 1; |
747 | len -= sizeof(*cp); | 734 | len -= sizeof(*cp); |
748 | } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) { | 735 | } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) { |
749 | FC_DBG("GPN_FT rejected reason %x exp %x " | 736 | FC_DISC_DBG(disc, "GPN_FT rejected reason %x exp %x " |
750 | "(check zoning)\n", cp->ct_reason, | 737 | "(check zoning)\n", cp->ct_reason, |
751 | cp->ct_explan); | 738 | cp->ct_explan); |
752 | disc->event = DISC_EV_FAILED; | 739 | disc->event = DISC_EV_FAILED; |
753 | fc_disc_done(disc); | 740 | fc_disc_done(disc); |
754 | } else { | 741 | } else { |
755 | FC_DBG("GPN_FT unexpected response code %x\n", | 742 | FC_DISC_DBG(disc, "GPN_FT unexpected response code " |
756 | ntohs(cp->ct_cmd)); | 743 | "%x\n", ntohs(cp->ct_cmd)); |
757 | } | 744 | } |
758 | } else if (fr_sof(fp) == FC_SOF_N3 && | 745 | } else if (fr_sof(fp) == FC_SOF_N3 && |
759 | seq_cnt == disc->seq_count) { | 746 | seq_cnt == disc->seq_count) { |
760 | buf = fh + 1; | 747 | buf = fh + 1; |
761 | } else { | 748 | } else { |
762 | FC_DBG("GPN_FT unexpected frame - out of sequence? " | 749 | FC_DISC_DBG(disc, "GPN_FT unexpected frame - out of sequence? " |
763 | "seq_cnt %x expected %x sof %x eof %x\n", | 750 | "seq_cnt %x expected %x sof %x eof %x\n", |
764 | seq_cnt, disc->seq_count, fr_sof(fp), fr_eof(fp)); | 751 | seq_cnt, disc->seq_count, fr_sof(fp), fr_eof(fp)); |
765 | } | 752 | } |
766 | if (buf) { | 753 | if (buf) { |
767 | error = fc_disc_gpn_ft_parse(disc, buf, len); | 754 | error = fc_disc_gpn_ft_parse(disc, buf, len); |