diff options
author | Peter Tiedemann <ptiedem@de.ibm.com> | 2008-07-18 09:24:57 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-22 17:53:46 -0400 |
commit | aa3f2cb63086e474a2ac3836d01fc6d9db393846 (patch) | |
tree | dfeb9dea4c7bd3a5fce6f223f4e261e6a0fe1ac2 /drivers/s390/net | |
parent | b805da74dee3a8de8a29654078c5198f2fb0e15b (diff) |
s390/net/ctcm: message cleanup
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/ctcm_dbug.c | 29 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_dbug.h | 39 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_fsms.c | 402 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_main.c | 514 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_main.h | 31 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_mpc.c | 1110 | ||||
-rw-r--r-- | drivers/s390/net/ctcm_mpc.h | 2 |
7 files changed, 882 insertions, 1245 deletions
diff --git a/drivers/s390/net/ctcm_dbug.c b/drivers/s390/net/ctcm_dbug.c index 8eb25d00b2e7..1ca58f153470 100644 --- a/drivers/s390/net/ctcm_dbug.c +++ b/drivers/s390/net/ctcm_dbug.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/stddef.h> | 9 | #include <linux/stddef.h> |
10 | #include <linux/string.h> | ||
10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
12 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
@@ -22,15 +23,13 @@ | |||
22 | * Debug Facility Stuff | 23 | * Debug Facility Stuff |
23 | */ | 24 | */ |
24 | 25 | ||
25 | DEFINE_PER_CPU(char[256], ctcm_dbf_txt_buf); | ||
26 | |||
27 | struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = { | 26 | struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = { |
28 | [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, 5, NULL}, | 27 | [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, CTC_DBF_INFO, NULL}, |
29 | [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, 3, NULL}, | 28 | [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, CTC_DBF_ERROR, NULL}, |
30 | [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, 3, NULL}, | 29 | [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, CTC_DBF_ERROR, NULL}, |
31 | [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 64, 5, NULL}, | 30 | [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 80, CTC_DBF_INFO, NULL}, |
32 | [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 64, 3, NULL}, | 31 | [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 80, CTC_DBF_ERROR, NULL}, |
33 | [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 64, 3, NULL}, | 32 | [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 80, CTC_DBF_ERROR, NULL}, |
34 | }; | 33 | }; |
35 | 34 | ||
36 | void ctcm_unregister_dbf_views(void) | 35 | void ctcm_unregister_dbf_views(void) |
@@ -65,3 +64,17 @@ int ctcm_register_dbf_views(void) | |||
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |
67 | 66 | ||
67 | void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *fmt, ...) | ||
68 | { | ||
69 | char dbf_txt_buf[64]; | ||
70 | va_list args; | ||
71 | |||
72 | if (level > (ctcm_dbf[dbf_nix].id)->level) | ||
73 | return; | ||
74 | va_start(args, fmt); | ||
75 | vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args); | ||
76 | va_end(args); | ||
77 | |||
78 | debug_text_event(ctcm_dbf[dbf_nix].id, level, dbf_txt_buf); | ||
79 | } | ||
80 | |||
diff --git a/drivers/s390/net/ctcm_dbug.h b/drivers/s390/net/ctcm_dbug.h index fdff34fe59a2..26966d0b9abd 100644 --- a/drivers/s390/net/ctcm_dbug.h +++ b/drivers/s390/net/ctcm_dbug.h | |||
@@ -20,16 +20,17 @@ | |||
20 | #else | 20 | #else |
21 | #define do_debug 0 | 21 | #define do_debug 0 |
22 | #endif | 22 | #endif |
23 | #ifdef DEBUGDATA | ||
24 | #define do_debug_data 1 | ||
25 | #else | ||
26 | #define do_debug_data 0 | ||
27 | #endif | ||
28 | #ifdef DEBUGCCW | 23 | #ifdef DEBUGCCW |
29 | #define do_debug_ccw 1 | 24 | #define do_debug_ccw 1 |
25 | #define DEBUGDATA 1 | ||
30 | #else | 26 | #else |
31 | #define do_debug_ccw 0 | 27 | #define do_debug_ccw 0 |
32 | #endif | 28 | #endif |
29 | #ifdef DEBUGDATA | ||
30 | #define do_debug_data 1 | ||
31 | #else | ||
32 | #define do_debug_data 0 | ||
33 | #endif | ||
33 | 34 | ||
34 | /* define dbf debug levels similar to kernel msg levels */ | 35 | /* define dbf debug levels similar to kernel msg levels */ |
35 | #define CTC_DBF_ALWAYS 0 /* always print this */ | 36 | #define CTC_DBF_ALWAYS 0 /* always print this */ |
@@ -42,8 +43,6 @@ | |||
42 | #define CTC_DBF_INFO 5 /* informational */ | 43 | #define CTC_DBF_INFO 5 /* informational */ |
43 | #define CTC_DBF_DEBUG 6 /* debug-level messages */ | 44 | #define CTC_DBF_DEBUG 6 /* debug-level messages */ |
44 | 45 | ||
45 | DECLARE_PER_CPU(char[256], ctcm_dbf_txt_buf); | ||
46 | |||
47 | enum ctcm_dbf_names { | 46 | enum ctcm_dbf_names { |
48 | CTCM_DBF_SETUP, | 47 | CTCM_DBF_SETUP, |
49 | CTCM_DBF_ERROR, | 48 | CTCM_DBF_ERROR, |
@@ -67,6 +66,7 @@ extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS]; | |||
67 | 66 | ||
68 | int ctcm_register_dbf_views(void); | 67 | int ctcm_register_dbf_views(void); |
69 | void ctcm_unregister_dbf_views(void); | 68 | void ctcm_unregister_dbf_views(void); |
69 | void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...); | ||
70 | 70 | ||
71 | static inline const char *strtail(const char *s, int n) | 71 | static inline const char *strtail(const char *s, int n) |
72 | { | 72 | { |
@@ -74,12 +74,6 @@ static inline const char *strtail(const char *s, int n) | |||
74 | return (l > n) ? s + (l - n) : s; | 74 | return (l > n) ? s + (l - n) : s; |
75 | } | 75 | } |
76 | 76 | ||
77 | /* sort out levels early to avoid unnecessary sprintfs */ | ||
78 | static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | ||
79 | { | ||
80 | return (dbf_grp->level >= level); | ||
81 | } | ||
82 | |||
83 | #define CTCM_FUNTAIL strtail((char *)__func__, 16) | 77 | #define CTCM_FUNTAIL strtail((char *)__func__, 16) |
84 | 78 | ||
85 | #define CTCM_DBF_TEXT(name, level, text) \ | 79 | #define CTCM_DBF_TEXT(name, level, text) \ |
@@ -94,16 +88,7 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | |||
94 | } while (0) | 88 | } while (0) |
95 | 89 | ||
96 | #define CTCM_DBF_TEXT_(name, level, text...) \ | 90 | #define CTCM_DBF_TEXT_(name, level, text...) \ |
97 | do { \ | 91 | ctcm_dbf_longtext(CTCM_DBF_##name, level, text) |
98 | if (ctcm_dbf_passes(ctcm_dbf[CTCM_DBF_##name].id, level)) { \ | ||
99 | char *ctcm_dbf_txt_buf = \ | ||
100 | get_cpu_var(ctcm_dbf_txt_buf); \ | ||
101 | sprintf(ctcm_dbf_txt_buf, text); \ | ||
102 | debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, \ | ||
103 | level, ctcm_dbf_txt_buf); \ | ||
104 | put_cpu_var(ctcm_dbf_txt_buf); \ | ||
105 | } \ | ||
106 | } while (0) | ||
107 | 92 | ||
108 | /* | 93 | /* |
109 | * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}. | 94 | * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}. |
@@ -112,13 +97,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | |||
112 | */ | 97 | */ |
113 | #define CTCM_DBF_DEV_NAME(cat, dev, text) \ | 98 | #define CTCM_DBF_DEV_NAME(cat, dev, text) \ |
114 | do { \ | 99 | do { \ |
115 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) : %s", \ | 100 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \ |
116 | CTCM_FUNTAIL, dev->name, text); \ | 101 | CTCM_FUNTAIL, dev->name, text); \ |
117 | } while (0) | 102 | } while (0) |
118 | 103 | ||
119 | #define MPC_DBF_DEV_NAME(cat, dev, text) \ | 104 | #define MPC_DBF_DEV_NAME(cat, dev, text) \ |
120 | do { \ | 105 | do { \ |
121 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) : %s", \ | 106 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \ |
122 | CTCM_FUNTAIL, dev->name, text); \ | 107 | CTCM_FUNTAIL, dev->name, text); \ |
123 | } while (0) | 108 | } while (0) |
124 | 109 | ||
@@ -137,13 +122,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) | |||
137 | */ | 122 | */ |
138 | #define CTCM_DBF_DEV(cat, dev, text) \ | 123 | #define CTCM_DBF_DEV(cat, dev, text) \ |
139 | do { \ | 124 | do { \ |
140 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) : %s", \ | 125 | CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \ |
141 | CTCM_FUNTAIL, dev, text); \ | 126 | CTCM_FUNTAIL, dev, text); \ |
142 | } while (0) | 127 | } while (0) |
143 | 128 | ||
144 | #define MPC_DBF_DEV(cat, dev, text) \ | 129 | #define MPC_DBF_DEV(cat, dev, text) \ |
145 | do { \ | 130 | do { \ |
146 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) : %s", \ | 131 | CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \ |
147 | CTCM_FUNTAIL, dev, text); \ | 132 | CTCM_FUNTAIL, dev, text); \ |
148 | } while (0) | 133 | } while (0) |
149 | 134 | ||
diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c index 7e6bd387f4d8..0b4e6253abe4 100644 --- a/drivers/s390/net/ctcm_fsms.c +++ b/drivers/s390/net/ctcm_fsms.c | |||
@@ -190,7 +190,8 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg); | |||
190 | void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg) | 190 | void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg) |
191 | { | 191 | { |
192 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 192 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
193 | "ccw error %s (%s): %04x\n", ch->id, msg, rc); | 193 | "%s(%s): %s: %04x\n", |
194 | CTCM_FUNTAIL, ch->id, msg, rc); | ||
194 | switch (rc) { | 195 | switch (rc) { |
195 | case -EBUSY: | 196 | case -EBUSY: |
196 | ctcm_pr_warn("%s (%s): Busy !\n", ch->id, msg); | 197 | ctcm_pr_warn("%s (%s): Busy !\n", ch->id, msg); |
@@ -212,7 +213,7 @@ void ctcm_purge_skb_queue(struct sk_buff_head *q) | |||
212 | { | 213 | { |
213 | struct sk_buff *skb; | 214 | struct sk_buff *skb; |
214 | 215 | ||
215 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | 216 | CTCM_DBF_TEXT(TRACE, CTC_DBF_DEBUG, __func__); |
216 | 217 | ||
217 | while ((skb = skb_dequeue(q))) { | 218 | while ((skb = skb_dequeue(q))) { |
218 | atomic_dec(&skb->users); | 219 | atomic_dec(&skb->users); |
@@ -251,6 +252,8 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) | |||
251 | unsigned long duration; | 252 | unsigned long duration; |
252 | struct timespec done_stamp = current_kernel_time(); /* xtime */ | 253 | struct timespec done_stamp = current_kernel_time(); /* xtime */ |
253 | 254 | ||
255 | CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); | ||
256 | |||
254 | duration = | 257 | duration = |
255 | (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + | 258 | (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + |
256 | (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; | 259 | (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; |
@@ -258,8 +261,9 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) | |||
258 | ch->prof.tx_time = duration; | 261 | ch->prof.tx_time = duration; |
259 | 262 | ||
260 | if (ch->irb->scsw.cmd.count != 0) | 263 | if (ch->irb->scsw.cmd.count != 0) |
261 | ctcm_pr_debug("%s: TX not complete, remaining %d bytes\n", | 264 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
262 | dev->name, ch->irb->scsw.cmd.count); | 265 | "%s(%s): TX not complete, remaining %d bytes", |
266 | CTCM_FUNTAIL, dev->name, ch->irb->scsw.cmd.count); | ||
263 | fsm_deltimer(&ch->timer); | 267 | fsm_deltimer(&ch->timer); |
264 | while ((skb = skb_dequeue(&ch->io_queue))) { | 268 | while ((skb = skb_dequeue(&ch->io_queue))) { |
265 | priv->stats.tx_packets++; | 269 | priv->stats.tx_packets++; |
@@ -334,7 +338,8 @@ void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg) | |||
334 | struct net_device *dev = ch->netdev; | 338 | struct net_device *dev = ch->netdev; |
335 | struct ctcm_priv *priv = dev->priv; | 339 | struct ctcm_priv *priv = dev->priv; |
336 | 340 | ||
337 | CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); | 341 | CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); |
342 | |||
338 | fsm_deltimer(&ch->timer); | 343 | fsm_deltimer(&ch->timer); |
339 | fsm_newstate(fi, CTC_STATE_TXIDLE); | 344 | fsm_newstate(fi, CTC_STATE_TXIDLE); |
340 | fsm_event(priv->fsm, DEV_EVENT_TXUP, ch->netdev); | 345 | fsm_event(priv->fsm, DEV_EVENT_TXUP, ch->netdev); |
@@ -361,15 +366,17 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
361 | 366 | ||
362 | fsm_deltimer(&ch->timer); | 367 | fsm_deltimer(&ch->timer); |
363 | if (len < 8) { | 368 | if (len < 8) { |
364 | ctcm_pr_debug("%s: got packet with length %d < 8\n", | 369 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
365 | dev->name, len); | 370 | "%s(%s): got packet with length %d < 8\n", |
371 | CTCM_FUNTAIL, dev->name, len); | ||
366 | priv->stats.rx_dropped++; | 372 | priv->stats.rx_dropped++; |
367 | priv->stats.rx_length_errors++; | 373 | priv->stats.rx_length_errors++; |
368 | goto again; | 374 | goto again; |
369 | } | 375 | } |
370 | if (len > ch->max_bufsize) { | 376 | if (len > ch->max_bufsize) { |
371 | ctcm_pr_debug("%s: got packet with length %d > %d\n", | 377 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
372 | dev->name, len, ch->max_bufsize); | 378 | "%s(%s): got packet with length %d > %d\n", |
379 | CTCM_FUNTAIL, dev->name, len, ch->max_bufsize); | ||
373 | priv->stats.rx_dropped++; | 380 | priv->stats.rx_dropped++; |
374 | priv->stats.rx_length_errors++; | 381 | priv->stats.rx_length_errors++; |
375 | goto again; | 382 | goto again; |
@@ -388,8 +395,9 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
388 | break; | 395 | break; |
389 | } | 396 | } |
390 | if ((len < block_len) || (len > check_len)) { | 397 | if ((len < block_len) || (len > check_len)) { |
391 | ctcm_pr_debug("%s: got block length %d != rx length %d\n", | 398 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
392 | dev->name, block_len, len); | 399 | "%s(%s): got block length %d != rx length %d\n", |
400 | CTCM_FUNTAIL, dev->name, block_len, len); | ||
393 | if (do_debug) | 401 | if (do_debug) |
394 | ctcmpc_dump_skb(skb, 0); | 402 | ctcmpc_dump_skb(skb, 0); |
395 | 403 | ||
@@ -425,17 +433,23 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
425 | */ | 433 | */ |
426 | static void chx_firstio(fsm_instance *fi, int event, void *arg) | 434 | static void chx_firstio(fsm_instance *fi, int event, void *arg) |
427 | { | 435 | { |
428 | struct channel *ch = arg; | ||
429 | int rc; | 436 | int rc; |
437 | struct channel *ch = arg; | ||
438 | int fsmstate = fsm_getstate(fi); | ||
430 | 439 | ||
431 | CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); | 440 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
441 | "%s(%s) : %02x", | ||
442 | CTCM_FUNTAIL, ch->id, fsmstate); | ||
432 | 443 | ||
433 | if (fsm_getstate(fi) == CTC_STATE_TXIDLE) | 444 | ch->sense_rc = 0; /* reset unit check report control */ |
434 | ctcm_pr_debug("%s: remote side issued READ?, init.\n", ch->id); | 445 | if (fsmstate == CTC_STATE_TXIDLE) |
446 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, | ||
447 | "%s(%s): remote side issued READ?, init.\n", | ||
448 | CTCM_FUNTAIL, ch->id); | ||
435 | fsm_deltimer(&ch->timer); | 449 | fsm_deltimer(&ch->timer); |
436 | if (ctcm_checkalloc_buffer(ch)) | 450 | if (ctcm_checkalloc_buffer(ch)) |
437 | return; | 451 | return; |
438 | if ((fsm_getstate(fi) == CTC_STATE_SETUPWAIT) && | 452 | if ((fsmstate == CTC_STATE_SETUPWAIT) && |
439 | (ch->protocol == CTCM_PROTO_OS390)) { | 453 | (ch->protocol == CTCM_PROTO_OS390)) { |
440 | /* OS/390 resp. z/OS */ | 454 | /* OS/390 resp. z/OS */ |
441 | if (CHANNEL_DIRECTION(ch->flags) == READ) { | 455 | if (CHANNEL_DIRECTION(ch->flags) == READ) { |
@@ -451,7 +465,6 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg) | |||
451 | } | 465 | } |
452 | return; | 466 | return; |
453 | } | 467 | } |
454 | |||
455 | /* | 468 | /* |
456 | * Don't setup a timer for receiving the initial RX frame | 469 | * Don't setup a timer for receiving the initial RX frame |
457 | * if in compatibility mode, since VM TCP delays the initial | 470 | * if in compatibility mode, since VM TCP delays the initial |
@@ -505,11 +518,10 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
505 | __u16 buflen; | 518 | __u16 buflen; |
506 | int rc; | 519 | int rc; |
507 | 520 | ||
508 | CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); | ||
509 | fsm_deltimer(&ch->timer); | 521 | fsm_deltimer(&ch->timer); |
510 | buflen = *((__u16 *)ch->trans_skb->data); | 522 | buflen = *((__u16 *)ch->trans_skb->data); |
511 | if (do_debug) | 523 | CTCM_PR_DEBUG("%s: %s: Initial RX count = %d\n", |
512 | ctcm_pr_debug("%s: Initial RX count %d\n", dev->name, buflen); | 524 | __func__, dev->name, buflen); |
513 | 525 | ||
514 | if (buflen >= CTCM_INITIAL_BLOCKLEN) { | 526 | if (buflen >= CTCM_INITIAL_BLOCKLEN) { |
515 | if (ctcm_checkalloc_buffer(ch)) | 527 | if (ctcm_checkalloc_buffer(ch)) |
@@ -524,9 +536,9 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
524 | } else | 536 | } else |
525 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); | 537 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); |
526 | } else { | 538 | } else { |
527 | if (do_debug) | 539 | CTCM_PR_DEBUG("%s: %s: Initial RX count %d not %d\n", |
528 | ctcm_pr_debug("%s: Initial RX count %d not %d\n", | 540 | __func__, dev->name, |
529 | dev->name, buflen, CTCM_INITIAL_BLOCKLEN); | 541 | buflen, CTCM_INITIAL_BLOCKLEN); |
530 | chx_firstio(fi, event, arg); | 542 | chx_firstio(fi, event, arg); |
531 | } | 543 | } |
532 | } | 544 | } |
@@ -548,14 +560,12 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg) | |||
548 | fsm_deltimer(&ch->timer); | 560 | fsm_deltimer(&ch->timer); |
549 | if (IS_MPC(ch)) { | 561 | if (IS_MPC(ch)) { |
550 | timeout = 1500; | 562 | timeout = 1500; |
551 | if (do_debug) | 563 | CTCM_PR_DEBUG("enter %s: cp=%i ch=0x%p id=%s\n", |
552 | ctcm_pr_debug("ctcm enter: %s(): cp=%i ch=0x%p id=%s\n", | 564 | __func__, smp_processor_id(), ch, ch->id); |
553 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
554 | } | 565 | } |
555 | fsm_addtimer(&ch->timer, timeout, CTC_EVENT_TIMER, ch); | 566 | fsm_addtimer(&ch->timer, timeout, CTC_EVENT_TIMER, ch); |
556 | fsm_newstate(fi, CTC_STATE_SETUPWAIT); | 567 | fsm_newstate(fi, CTC_STATE_SETUPWAIT); |
557 | if (do_debug_ccw && IS_MPC(ch)) | 568 | CTCM_CCW_DUMP((char *)&ch->ccw[6], sizeof(struct ccw1) * 2); |
558 | ctcmpc_dumpit((char *)&ch->ccw[6], sizeof(struct ccw1) * 2); | ||
559 | 569 | ||
560 | if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */ | 570 | if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */ |
561 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 571 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
@@ -583,24 +593,12 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg) | |||
583 | */ | 593 | */ |
584 | static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) | 594 | static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) |
585 | { | 595 | { |
586 | struct channel *ch = arg; | 596 | struct channel *ch = arg; |
587 | int rc; | ||
588 | struct net_device *dev; | ||
589 | unsigned long saveflags; | 597 | unsigned long saveflags; |
598 | int rc; | ||
590 | 599 | ||
591 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | 600 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s): %s", |
592 | if (ch == NULL) { | 601 | CTCM_FUNTAIL, ch->id, |
593 | ctcm_pr_warn("chx_start ch=NULL\n"); | ||
594 | return; | ||
595 | } | ||
596 | if (ch->netdev == NULL) { | ||
597 | ctcm_pr_warn("chx_start dev=NULL, id=%s\n", ch->id); | ||
598 | return; | ||
599 | } | ||
600 | dev = ch->netdev; | ||
601 | |||
602 | if (do_debug) | ||
603 | ctcm_pr_debug("%s: %s channel start\n", dev->name, | ||
604 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 602 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
605 | 603 | ||
606 | if (ch->trans_skb != NULL) { | 604 | if (ch->trans_skb != NULL) { |
@@ -618,11 +616,12 @@ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) | |||
618 | ch->ccw[1].count = 0; | 616 | ch->ccw[1].count = 0; |
619 | } | 617 | } |
620 | if (ctcm_checkalloc_buffer(ch)) { | 618 | if (ctcm_checkalloc_buffer(ch)) { |
621 | ctcm_pr_notice("%s: %s trans_skb allocation delayed " | 619 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
622 | "until first transfer\n", dev->name, | 620 | "%s(%s): %s trans_skb alloc delayed " |
621 | "until first transfer", | ||
622 | CTCM_FUNTAIL, ch->id, | ||
623 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 623 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
624 | } | 624 | } |
625 | |||
626 | ch->ccw[0].cmd_code = CCW_CMD_PREPARE; | 625 | ch->ccw[0].cmd_code = CCW_CMD_PREPARE; |
627 | ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 626 | ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
628 | ch->ccw[0].count = 0; | 627 | ch->ccw[0].count = 0; |
@@ -661,7 +660,6 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg) | |||
661 | int rc; | 660 | int rc; |
662 | int oldstate; | 661 | int oldstate; |
663 | 662 | ||
664 | CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); | ||
665 | fsm_deltimer(&ch->timer); | 663 | fsm_deltimer(&ch->timer); |
666 | if (IS_MPC(ch)) | 664 | if (IS_MPC(ch)) |
667 | fsm_deltimer(&ch->sweep_timer); | 665 | fsm_deltimer(&ch->sweep_timer); |
@@ -684,7 +682,7 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg) | |||
684 | fsm_deltimer(&ch->timer); | 682 | fsm_deltimer(&ch->timer); |
685 | if (event != CTC_EVENT_STOP) { | 683 | if (event != CTC_EVENT_STOP) { |
686 | fsm_newstate(fi, oldstate); | 684 | fsm_newstate(fi, oldstate); |
687 | ctcm_ccw_check_rc(ch, rc, (char *)__FUNCTION__); | 685 | ctcm_ccw_check_rc(ch, rc, (char *)__func__); |
688 | } | 686 | } |
689 | } | 687 | } |
690 | } | 688 | } |
@@ -703,7 +701,9 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, | |||
703 | struct net_device *dev = ch->netdev; | 701 | struct net_device *dev = ch->netdev; |
704 | struct ctcm_priv *priv = dev->priv; | 702 | struct ctcm_priv *priv = dev->priv; |
705 | 703 | ||
706 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | 704 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, |
705 | "%s(%s): %s[%d]\n", | ||
706 | CTCM_FUNTAIL, dev->name, ch->id, state); | ||
707 | 707 | ||
708 | fsm_deltimer(&ch->timer); | 708 | fsm_deltimer(&ch->timer); |
709 | if (IS_MPC(ch)) | 709 | if (IS_MPC(ch)) |
@@ -743,7 +743,6 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, | |||
743 | */ | 743 | */ |
744 | static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) | 744 | static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) |
745 | { | 745 | { |
746 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | ||
747 | ctcm_chx_cleanup(fi, CTC_STATE_STOPPED, arg); | 746 | ctcm_chx_cleanup(fi, CTC_STATE_STOPPED, arg); |
748 | } | 747 | } |
749 | 748 | ||
@@ -771,7 +770,6 @@ static void ctcm_chx_stop(fsm_instance *fi, int event, void *arg) | |||
771 | */ | 770 | */ |
772 | static void ctcm_chx_fail(fsm_instance *fi, int event, void *arg) | 771 | static void ctcm_chx_fail(fsm_instance *fi, int event, void *arg) |
773 | { | 772 | { |
774 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | ||
775 | ctcm_chx_cleanup(fi, CTC_STATE_NOTOP, arg); | 773 | ctcm_chx_cleanup(fi, CTC_STATE_NOTOP, arg); |
776 | } | 774 | } |
777 | 775 | ||
@@ -809,8 +807,8 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg) | |||
809 | } | 807 | } |
810 | 808 | ||
811 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, | 809 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, |
812 | "%s : %s error during %s channel setup state=%s\n", | 810 | "%s(%s) : %s error during %s channel setup state=%s\n", |
813 | dev->name, ctc_ch_event_names[event], | 811 | CTCM_FUNTAIL, dev->name, ctc_ch_event_names[event], |
814 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX", | 812 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX", |
815 | fsm_getstate_str(fi)); | 813 | fsm_getstate_str(fi)); |
816 | 814 | ||
@@ -838,10 +836,12 @@ static void ctcm_chx_restart(fsm_instance *fi, int event, void *arg) | |||
838 | int oldstate; | 836 | int oldstate; |
839 | int rc; | 837 | int rc; |
840 | 838 | ||
841 | CTCM_DBF_TEXT(TRACE, CTC_DBF_NOTICE, __FUNCTION__); | 839 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
840 | "%s: %s[%d] of %s\n", | ||
841 | CTCM_FUNTAIL, ch->id, event, dev->name); | ||
842 | |||
842 | fsm_deltimer(&ch->timer); | 843 | fsm_deltimer(&ch->timer); |
843 | ctcm_pr_debug("%s: %s channel restart\n", dev->name, | 844 | |
844 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | ||
845 | fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); | 845 | fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); |
846 | oldstate = fsm_getstate(fi); | 846 | oldstate = fsm_getstate(fi); |
847 | fsm_newstate(fi, CTC_STATE_STARTWAIT); | 847 | fsm_newstate(fi, CTC_STATE_STARTWAIT); |
@@ -876,13 +876,10 @@ static void ctcm_chx_rxiniterr(fsm_instance *fi, int event, void *arg) | |||
876 | struct net_device *dev = ch->netdev; | 876 | struct net_device *dev = ch->netdev; |
877 | struct ctcm_priv *priv = dev->priv; | 877 | struct ctcm_priv *priv = dev->priv; |
878 | 878 | ||
879 | CTCM_DBF_TEXT(SETUP, 3, __FUNCTION__); | ||
880 | if (event == CTC_EVENT_TIMER) { | 879 | if (event == CTC_EVENT_TIMER) { |
881 | if (!IS_MPCDEV(dev)) | 880 | if (!IS_MPCDEV(dev)) |
882 | /* TODO : check if MPC deletes timer somewhere */ | 881 | /* TODO : check if MPC deletes timer somewhere */ |
883 | fsm_deltimer(&ch->timer); | 882 | fsm_deltimer(&ch->timer); |
884 | ctcm_pr_debug("%s: Timeout during RX init handshake\n", | ||
885 | dev->name); | ||
886 | if (ch->retry++ < 3) | 883 | if (ch->retry++ < 3) |
887 | ctcm_chx_restart(fi, event, arg); | 884 | ctcm_chx_restart(fi, event, arg); |
888 | else { | 885 | else { |
@@ -907,9 +904,10 @@ static void ctcm_chx_rxinitfail(fsm_instance *fi, int event, void *arg) | |||
907 | struct net_device *dev = ch->netdev; | 904 | struct net_device *dev = ch->netdev; |
908 | struct ctcm_priv *priv = dev->priv; | 905 | struct ctcm_priv *priv = dev->priv; |
909 | 906 | ||
910 | CTCM_DBF_TEXT(SETUP, 3, __FUNCTION__); | 907 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
908 | "%s(%s): RX %s busy, init. fail", | ||
909 | CTCM_FUNTAIL, dev->name, ch->id); | ||
911 | fsm_newstate(fi, CTC_STATE_RXERR); | 910 | fsm_newstate(fi, CTC_STATE_RXERR); |
912 | ctcm_pr_warn("%s: RX busy. Initialization failed\n", dev->name); | ||
913 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); | 911 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); |
914 | } | 912 | } |
915 | 913 | ||
@@ -927,11 +925,10 @@ static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg) | |||
927 | struct net_device *dev = ch->netdev; | 925 | struct net_device *dev = ch->netdev; |
928 | struct ctcm_priv *priv = dev->priv; | 926 | struct ctcm_priv *priv = dev->priv; |
929 | 927 | ||
930 | CTCM_DBF_DEV_NAME(TRACE, dev, "Got remote disconnect, re-initializing"); | 928 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
929 | "%s: %s: remote disconnect - re-init ...", | ||
930 | CTCM_FUNTAIL, dev->name); | ||
931 | fsm_deltimer(&ch->timer); | 931 | fsm_deltimer(&ch->timer); |
932 | if (do_debug) | ||
933 | ctcm_pr_debug("%s: Got remote disconnect, " | ||
934 | "re-initializing ...\n", dev->name); | ||
935 | /* | 932 | /* |
936 | * Notify device statemachine | 933 | * Notify device statemachine |
937 | */ | 934 | */ |
@@ -961,8 +958,6 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) | |||
961 | 958 | ||
962 | if (event == CTC_EVENT_TIMER) { | 959 | if (event == CTC_EVENT_TIMER) { |
963 | fsm_deltimer(&ch->timer); | 960 | fsm_deltimer(&ch->timer); |
964 | CTCM_DBF_DEV_NAME(ERROR, dev, | ||
965 | "Timeout during TX init handshake"); | ||
966 | if (ch->retry++ < 3) | 961 | if (ch->retry++ < 3) |
967 | ctcm_chx_restart(fi, event, arg); | 962 | ctcm_chx_restart(fi, event, arg); |
968 | else { | 963 | else { |
@@ -971,9 +966,8 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) | |||
971 | } | 966 | } |
972 | } else { | 967 | } else { |
973 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, | 968 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
974 | "%s : %s error during channel setup state=%s", | 969 | "%s(%s): %s in %s", CTCM_FUNTAIL, ch->id, |
975 | dev->name, ctc_ch_event_names[event], | 970 | ctc_ch_event_names[event], fsm_getstate_str(fi)); |
976 | fsm_getstate_str(fi)); | ||
977 | 971 | ||
978 | ctcm_pr_warn("%s: Error during TX init handshake\n", dev->name); | 972 | ctcm_pr_warn("%s: Error during TX init handshake\n", dev->name); |
979 | } | 973 | } |
@@ -993,15 +987,15 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
993 | struct ctcm_priv *priv = dev->priv; | 987 | struct ctcm_priv *priv = dev->priv; |
994 | struct sk_buff *skb; | 988 | struct sk_buff *skb; |
995 | 989 | ||
996 | if (do_debug) | 990 | CTCM_PR_DEBUG("Enter: %s: cp=%i ch=0x%p id=%s\n", |
997 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | 991 | __func__, smp_processor_id(), ch, ch->id); |
998 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
999 | 992 | ||
1000 | fsm_deltimer(&ch->timer); | 993 | fsm_deltimer(&ch->timer); |
1001 | if (ch->retry++ > 3) { | 994 | if (ch->retry++ > 3) { |
1002 | struct mpc_group *gptr = priv->mpcg; | 995 | struct mpc_group *gptr = priv->mpcg; |
1003 | ctcm_pr_debug("%s: TX retry failed, restarting channel\n", | 996 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, |
1004 | dev->name); | 997 | "%s: %s: retries exceeded", |
998 | CTCM_FUNTAIL, ch->id); | ||
1005 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); | 999 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); |
1006 | /* call restart if not MPC or if MPC and mpcg fsm is ready. | 1000 | /* call restart if not MPC or if MPC and mpcg fsm is ready. |
1007 | use gptr as mpc indicator */ | 1001 | use gptr as mpc indicator */ |
@@ -1010,7 +1004,9 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
1010 | goto done; | 1004 | goto done; |
1011 | } | 1005 | } |
1012 | 1006 | ||
1013 | ctcm_pr_debug("%s: TX retry %d\n", dev->name, ch->retry); | 1007 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
1008 | "%s : %s: retry %d", | ||
1009 | CTCM_FUNTAIL, ch->id, ch->retry); | ||
1014 | skb = skb_peek(&ch->io_queue); | 1010 | skb = skb_peek(&ch->io_queue); |
1015 | if (skb) { | 1011 | if (skb) { |
1016 | int rc = 0; | 1012 | int rc = 0; |
@@ -1018,8 +1014,9 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) | |||
1018 | clear_normalized_cda(&ch->ccw[4]); | 1014 | clear_normalized_cda(&ch->ccw[4]); |
1019 | ch->ccw[4].count = skb->len; | 1015 | ch->ccw[4].count = skb->len; |
1020 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { | 1016 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { |
1021 | ctcm_pr_debug("%s: IDAL alloc failed, chan restart\n", | 1017 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, |
1022 | dev->name); | 1018 | "%s: %s: IDAL alloc failed", |
1019 | CTCM_FUNTAIL, ch->id); | ||
1023 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); | 1020 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); |
1024 | ctcm_chx_restart(fi, event, arg); | 1021 | ctcm_chx_restart(fi, event, arg); |
1025 | goto done; | 1022 | goto done; |
@@ -1061,22 +1058,21 @@ static void ctcm_chx_iofatal(fsm_instance *fi, int event, void *arg) | |||
1061 | struct channel *ch = arg; | 1058 | struct channel *ch = arg; |
1062 | struct net_device *dev = ch->netdev; | 1059 | struct net_device *dev = ch->netdev; |
1063 | struct ctcm_priv *priv = dev->priv; | 1060 | struct ctcm_priv *priv = dev->priv; |
1061 | int rd = CHANNEL_DIRECTION(ch->flags); | ||
1064 | 1062 | ||
1065 | CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); | ||
1066 | fsm_deltimer(&ch->timer); | 1063 | fsm_deltimer(&ch->timer); |
1067 | ctcm_pr_warn("%s %s : unrecoverable channel error\n", | 1064 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
1068 | CTC_DRIVER_NAME, dev->name); | 1065 | "%s: %s: %s unrecoverable channel error", |
1066 | CTCM_FUNTAIL, ch->id, rd == READ ? "RX" : "TX"); | ||
1067 | |||
1069 | if (IS_MPC(ch)) { | 1068 | if (IS_MPC(ch)) { |
1070 | priv->stats.tx_dropped++; | 1069 | priv->stats.tx_dropped++; |
1071 | priv->stats.tx_errors++; | 1070 | priv->stats.tx_errors++; |
1072 | } | 1071 | } |
1073 | 1072 | if (rd == READ) { | |
1074 | if (CHANNEL_DIRECTION(ch->flags) == READ) { | ||
1075 | ctcm_pr_debug("%s: RX I/O error\n", dev->name); | ||
1076 | fsm_newstate(fi, CTC_STATE_RXERR); | 1073 | fsm_newstate(fi, CTC_STATE_RXERR); |
1077 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); | 1074 | fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); |
1078 | } else { | 1075 | } else { |
1079 | ctcm_pr_debug("%s: TX I/O error\n", dev->name); | ||
1080 | fsm_newstate(fi, CTC_STATE_TXERR); | 1076 | fsm_newstate(fi, CTC_STATE_TXERR); |
1081 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); | 1077 | fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); |
1082 | } | 1078 | } |
@@ -1216,27 +1212,27 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1216 | struct sk_buff *skb; | 1212 | struct sk_buff *skb; |
1217 | int first = 1; | 1213 | int first = 1; |
1218 | int i; | 1214 | int i; |
1219 | struct timespec done_stamp; | ||
1220 | __u32 data_space; | 1215 | __u32 data_space; |
1221 | unsigned long duration; | 1216 | unsigned long duration; |
1222 | struct sk_buff *peekskb; | 1217 | struct sk_buff *peekskb; |
1223 | int rc; | 1218 | int rc; |
1224 | struct th_header *header; | 1219 | struct th_header *header; |
1225 | struct pdu *p_header; | 1220 | struct pdu *p_header; |
1221 | struct timespec done_stamp = current_kernel_time(); /* xtime */ | ||
1226 | 1222 | ||
1227 | if (do_debug) | 1223 | CTCM_PR_DEBUG("Enter %s: %s cp:%i\n", |
1228 | ctcm_pr_debug("%s cp:%i enter: %s()\n", | 1224 | __func__, dev->name, smp_processor_id()); |
1229 | dev->name, smp_processor_id(), __FUNCTION__); | ||
1230 | 1225 | ||
1231 | done_stamp = current_kernel_time(); /* xtime */ | 1226 | duration = |
1232 | duration = (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 | 1227 | (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + |
1233 | + (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; | 1228 | (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; |
1234 | if (duration > ch->prof.tx_time) | 1229 | if (duration > ch->prof.tx_time) |
1235 | ch->prof.tx_time = duration; | 1230 | ch->prof.tx_time = duration; |
1236 | 1231 | ||
1237 | if (ch->irb->scsw.cmd.count != 0) | 1232 | if (ch->irb->scsw.cmd.count != 0) |
1238 | ctcm_pr_debug("%s: TX not complete, remaining %d bytes\n", | 1233 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
1239 | dev->name, ch->irb->scsw.cmd.count); | 1234 | "%s(%s): TX not complete, remaining %d bytes", |
1235 | CTCM_FUNTAIL, dev->name, ch->irb->scsw.cmd.count); | ||
1240 | fsm_deltimer(&ch->timer); | 1236 | fsm_deltimer(&ch->timer); |
1241 | while ((skb = skb_dequeue(&ch->io_queue))) { | 1237 | while ((skb = skb_dequeue(&ch->io_queue))) { |
1242 | priv->stats.tx_packets++; | 1238 | priv->stats.tx_packets++; |
@@ -1250,7 +1246,6 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1250 | } | 1246 | } |
1251 | spin_lock(&ch->collect_lock); | 1247 | spin_lock(&ch->collect_lock); |
1252 | clear_normalized_cda(&ch->ccw[4]); | 1248 | clear_normalized_cda(&ch->ccw[4]); |
1253 | |||
1254 | if ((ch->collect_len <= 0) || (grp->in_sweep != 0)) { | 1249 | if ((ch->collect_len <= 0) || (grp->in_sweep != 0)) { |
1255 | spin_unlock(&ch->collect_lock); | 1250 | spin_unlock(&ch->collect_lock); |
1256 | fsm_newstate(fi, CTC_STATE_TXIDLE); | 1251 | fsm_newstate(fi, CTC_STATE_TXIDLE); |
@@ -1269,17 +1264,13 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1269 | if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue)) | 1264 | if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue)) |
1270 | ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue); | 1265 | ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue); |
1271 | i = 0; | 1266 | i = 0; |
1272 | 1267 | p_header = NULL; | |
1273 | if (do_debug_data) | ||
1274 | ctcm_pr_debug("ctcmpc: %s() building " | ||
1275 | "trans_skb from collect_q \n", __FUNCTION__); | ||
1276 | |||
1277 | data_space = grp->group_max_buflen - TH_HEADER_LENGTH; | 1268 | data_space = grp->group_max_buflen - TH_HEADER_LENGTH; |
1278 | 1269 | ||
1279 | if (do_debug_data) | 1270 | CTCM_PR_DBGDATA("%s: building trans_skb from collect_q" |
1280 | ctcm_pr_debug("ctcmpc: %s() building trans_skb from collect_q" | 1271 | " data_space:%04x\n", |
1281 | " data_space:%04x\n", __FUNCTION__, data_space); | 1272 | __func__, data_space); |
1282 | p_header = NULL; | 1273 | |
1283 | while ((skb = skb_dequeue(&ch->collect_queue))) { | 1274 | while ((skb = skb_dequeue(&ch->collect_queue))) { |
1284 | memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); | 1275 | memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); |
1285 | p_header = (struct pdu *) | 1276 | p_header = (struct pdu *) |
@@ -1290,15 +1281,12 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1290 | else | 1281 | else |
1291 | p_header->pdu_flag |= 0x20; | 1282 | p_header->pdu_flag |= 0x20; |
1292 | 1283 | ||
1293 | if (do_debug_data) { | 1284 | CTCM_PR_DBGDATA("%s: trans_skb len:%04x \n", |
1294 | ctcm_pr_debug("ctcmpc: %s()trans_skb len:%04x \n", | 1285 | __func__, ch->trans_skb->len); |
1295 | __FUNCTION__, ch->trans_skb->len); | 1286 | CTCM_PR_DBGDATA("%s: pdu header and data for up" |
1296 | ctcm_pr_debug("ctcmpc: %s() pdu header and data" | 1287 | " to 32 bytes sent to vtam\n", __func__); |
1297 | " for up to 32 bytes sent to vtam\n", | 1288 | CTCM_D3_DUMP((char *)p_header, min_t(int, skb->len, 32)); |
1298 | __FUNCTION__); | 1289 | |
1299 | ctcmpc_dumpit((char *)p_header, | ||
1300 | min_t(int, skb->len, 32)); | ||
1301 | } | ||
1302 | ch->collect_len -= skb->len; | 1290 | ch->collect_len -= skb->len; |
1303 | data_space -= skb->len; | 1291 | data_space -= skb->len; |
1304 | priv->stats.tx_packets++; | 1292 | priv->stats.tx_packets++; |
@@ -1314,46 +1302,38 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1314 | if (p_header) | 1302 | if (p_header) |
1315 | p_header->pdu_flag |= PDU_LAST; /*Say it's the last one*/ | 1303 | p_header->pdu_flag |= PDU_LAST; /*Say it's the last one*/ |
1316 | header = kzalloc(TH_HEADER_LENGTH, gfp_type()); | 1304 | header = kzalloc(TH_HEADER_LENGTH, gfp_type()); |
1317 | |||
1318 | if (!header) { | 1305 | if (!header) { |
1319 | printk(KERN_WARNING "ctcmpc: OUT OF MEMORY IN %s()" | ||
1320 | ": Data Lost \n", __FUNCTION__); | ||
1321 | spin_unlock(&ch->collect_lock); | 1306 | spin_unlock(&ch->collect_lock); |
1322 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 1307 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); |
1323 | goto done; | 1308 | goto done; |
1324 | } | 1309 | } |
1325 | |||
1326 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ | 1310 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ |
1327 | ch->th_seq_num++; | 1311 | ch->th_seq_num++; |
1328 | header->th_seq_num = ch->th_seq_num; | 1312 | header->th_seq_num = ch->th_seq_num; |
1329 | 1313 | ||
1330 | if (do_debug_data) | 1314 | CTCM_PR_DBGDATA("%s: ToVTAM_th_seq= %08x\n" , |
1331 | ctcm_pr_debug("%s: ToVTAM_th_seq= %08x\n" , | 1315 | __func__, ch->th_seq_num); |
1332 | __FUNCTION__, ch->th_seq_num); | ||
1333 | 1316 | ||
1334 | memcpy(skb_push(ch->trans_skb, TH_HEADER_LENGTH), header, | 1317 | memcpy(skb_push(ch->trans_skb, TH_HEADER_LENGTH), header, |
1335 | TH_HEADER_LENGTH); /* put the TH on the packet */ | 1318 | TH_HEADER_LENGTH); /* put the TH on the packet */ |
1336 | 1319 | ||
1337 | kfree(header); | 1320 | kfree(header); |
1338 | 1321 | ||
1339 | if (do_debug_data) { | 1322 | CTCM_PR_DBGDATA("%s: trans_skb len:%04x \n", |
1340 | ctcm_pr_debug("ctcmpc: %s()trans_skb len:%04x \n", | 1323 | __func__, ch->trans_skb->len); |
1341 | __FUNCTION__, ch->trans_skb->len); | 1324 | CTCM_PR_DBGDATA("%s: up-to-50 bytes of trans_skb " |
1342 | 1325 | "data to vtam from collect_q\n", __func__); | |
1343 | ctcm_pr_debug("ctcmpc: %s() up-to-50 bytes of trans_skb " | 1326 | CTCM_D3_DUMP((char *)ch->trans_skb->data, |
1344 | "data to vtam from collect_q\n", __FUNCTION__); | ||
1345 | ctcmpc_dumpit((char *)ch->trans_skb->data, | ||
1346 | min_t(int, ch->trans_skb->len, 50)); | 1327 | min_t(int, ch->trans_skb->len, 50)); |
1347 | } | ||
1348 | 1328 | ||
1349 | spin_unlock(&ch->collect_lock); | 1329 | spin_unlock(&ch->collect_lock); |
1350 | clear_normalized_cda(&ch->ccw[1]); | 1330 | clear_normalized_cda(&ch->ccw[1]); |
1351 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { | 1331 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { |
1352 | dev_kfree_skb_any(ch->trans_skb); | 1332 | dev_kfree_skb_any(ch->trans_skb); |
1353 | ch->trans_skb = NULL; | 1333 | ch->trans_skb = NULL; |
1354 | printk(KERN_WARNING | 1334 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, |
1355 | "ctcmpc: %s()CCW failure - data lost\n", | 1335 | "%s: %s: IDAL alloc failed", |
1356 | __FUNCTION__); | 1336 | CTCM_FUNTAIL, ch->id); |
1357 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 1337 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); |
1358 | return; | 1338 | return; |
1359 | } | 1339 | } |
@@ -1373,7 +1353,6 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) | |||
1373 | } | 1353 | } |
1374 | done: | 1354 | done: |
1375 | ctcm_clear_busy(dev); | 1355 | ctcm_clear_busy(dev); |
1376 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
1377 | return; | 1356 | return; |
1378 | } | 1357 | } |
1379 | 1358 | ||
@@ -1393,26 +1372,25 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) | |||
1393 | struct mpc_group *grp = priv->mpcg; | 1372 | struct mpc_group *grp = priv->mpcg; |
1394 | struct sk_buff *skb = ch->trans_skb; | 1373 | struct sk_buff *skb = ch->trans_skb; |
1395 | struct sk_buff *new_skb; | 1374 | struct sk_buff *new_skb; |
1396 | unsigned long saveflags = 0; /* avoids compiler warning */ | 1375 | unsigned long saveflags = 0; /* avoids compiler warning */ |
1397 | int len = ch->max_bufsize - ch->irb->scsw.cmd.count; | 1376 | int len = ch->max_bufsize - ch->irb->scsw.cmd.count; |
1398 | 1377 | ||
1399 | if (do_debug_data) { | 1378 | CTCM_PR_DEBUG("%s: %s: cp:%i %s maxbuf : %04x, len: %04x\n", |
1400 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "mpc_ch_rx %s cp:%i %s\n", | 1379 | CTCM_FUNTAIL, dev->name, smp_processor_id(), |
1401 | dev->name, smp_processor_id(), ch->id); | 1380 | ch->id, ch->max_bufsize, len); |
1402 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "mpc_ch_rx: maxbuf: %04x " | ||
1403 | "len: %04x\n", ch->max_bufsize, len); | ||
1404 | } | ||
1405 | fsm_deltimer(&ch->timer); | 1381 | fsm_deltimer(&ch->timer); |
1406 | 1382 | ||
1407 | if (skb == NULL) { | 1383 | if (skb == NULL) { |
1408 | ctcm_pr_debug("ctcmpc exit: %s() TRANS_SKB = NULL \n", | 1384 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1409 | __FUNCTION__); | 1385 | "%s(%s): TRANS_SKB = NULL", |
1410 | goto again; | 1386 | CTCM_FUNTAIL, dev->name); |
1387 | goto again; | ||
1411 | } | 1388 | } |
1412 | 1389 | ||
1413 | if (len < TH_HEADER_LENGTH) { | 1390 | if (len < TH_HEADER_LENGTH) { |
1414 | ctcm_pr_info("%s: got packet with invalid length %d\n", | 1391 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1415 | dev->name, len); | 1392 | "%s(%s): packet length %d to short", |
1393 | CTCM_FUNTAIL, dev->name, len); | ||
1416 | priv->stats.rx_dropped++; | 1394 | priv->stats.rx_dropped++; |
1417 | priv->stats.rx_length_errors++; | 1395 | priv->stats.rx_length_errors++; |
1418 | } else { | 1396 | } else { |
@@ -1422,11 +1400,9 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) | |||
1422 | new_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC); | 1400 | new_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC); |
1423 | 1401 | ||
1424 | if (new_skb == NULL) { | 1402 | if (new_skb == NULL) { |
1425 | printk(KERN_INFO "ctcmpc:%s() NEW_SKB = NULL\n", | 1403 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1426 | __FUNCTION__); | 1404 | "%s(%d): skb allocation failed", |
1427 | printk(KERN_WARNING "ctcmpc: %s() MEMORY ALLOC FAILED" | 1405 | CTCM_FUNTAIL, dev->name); |
1428 | " - DATA LOST - MPC FAILED\n", | ||
1429 | __FUNCTION__); | ||
1430 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 1406 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); |
1431 | goto again; | 1407 | goto again; |
1432 | } | 1408 | } |
@@ -1479,9 +1455,8 @@ again: | |||
1479 | break; | 1455 | break; |
1480 | } | 1456 | } |
1481 | 1457 | ||
1482 | if (do_debug) | 1458 | CTCM_PR_DEBUG("Exit %s: %s, ch=0x%p, id=%s\n", |
1483 | ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", | 1459 | __func__, dev->name, ch, ch->id); |
1484 | dev->name, __FUNCTION__, ch, ch->id); | ||
1485 | 1460 | ||
1486 | } | 1461 | } |
1487 | 1462 | ||
@@ -1497,15 +1472,16 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) | |||
1497 | struct channel *ch = arg; | 1472 | struct channel *ch = arg; |
1498 | struct net_device *dev = ch->netdev; | 1473 | struct net_device *dev = ch->netdev; |
1499 | struct ctcm_priv *priv = dev->priv; | 1474 | struct ctcm_priv *priv = dev->priv; |
1475 | struct mpc_group *gptr = priv->mpcg; | ||
1476 | |||
1477 | CTCM_PR_DEBUG("Enter %s: id=%s, ch=0x%p\n", | ||
1478 | __func__, ch->id, ch); | ||
1479 | |||
1480 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_INFO, | ||
1481 | "%s: %s: chstate:%i, grpstate:%i, prot:%i\n", | ||
1482 | CTCM_FUNTAIL, ch->id, fsm_getstate(fi), | ||
1483 | fsm_getstate(gptr->fsm), ch->protocol); | ||
1500 | 1484 | ||
1501 | if (do_debug) { | ||
1502 | struct mpc_group *gptr = priv->mpcg; | ||
1503 | ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", | ||
1504 | __FUNCTION__, ch, ch->id); | ||
1505 | ctcm_pr_debug("%s() %s chstate:%i grpstate:%i chprotocol:%i\n", | ||
1506 | __FUNCTION__, ch->id, fsm_getstate(fi), | ||
1507 | fsm_getstate(gptr->fsm), ch->protocol); | ||
1508 | } | ||
1509 | if (fsm_getstate(fi) == CTC_STATE_TXIDLE) | 1485 | if (fsm_getstate(fi) == CTC_STATE_TXIDLE) |
1510 | MPC_DBF_DEV_NAME(TRACE, dev, "remote side issued READ? "); | 1486 | MPC_DBF_DEV_NAME(TRACE, dev, "remote side issued READ? "); |
1511 | 1487 | ||
@@ -1531,9 +1507,8 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) | |||
1531 | ? CTC_STATE_RXINIT : CTC_STATE_TXINIT); | 1507 | ? CTC_STATE_RXINIT : CTC_STATE_TXINIT); |
1532 | 1508 | ||
1533 | done: | 1509 | done: |
1534 | if (do_debug) | 1510 | CTCM_PR_DEBUG("Exit %s: id=%s, ch=0x%p\n", |
1535 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | 1511 | __func__, ch->id, ch); |
1536 | __FUNCTION__, ch, ch->id); | ||
1537 | return; | 1512 | return; |
1538 | } | 1513 | } |
1539 | 1514 | ||
@@ -1556,12 +1531,9 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
1556 | unsigned long saveflags = 0; /* avoids compiler warning */ | 1531 | unsigned long saveflags = 0; /* avoids compiler warning */ |
1557 | 1532 | ||
1558 | fsm_deltimer(&ch->timer); | 1533 | fsm_deltimer(&ch->timer); |
1559 | ctcm_pr_debug("%s cp:%i enter: %s()\n", | 1534 | CTCM_PR_DEBUG("%s: %s: %s: cp:%i, chstate:%i grpstate:%i\n", |
1560 | dev->name, smp_processor_id(), __FUNCTION__); | 1535 | __func__, ch->id, dev->name, smp_processor_id(), |
1561 | if (do_debug) | 1536 | fsm_getstate(fi), fsm_getstate(grp->fsm)); |
1562 | ctcm_pr_debug("%s() %s chstate:%i grpstate:%i\n", | ||
1563 | __FUNCTION__, ch->id, | ||
1564 | fsm_getstate(fi), fsm_getstate(grp->fsm)); | ||
1565 | 1537 | ||
1566 | fsm_newstate(fi, CTC_STATE_RXIDLE); | 1538 | fsm_newstate(fi, CTC_STATE_RXIDLE); |
1567 | /* XID processing complete */ | 1539 | /* XID processing complete */ |
@@ -1575,9 +1547,7 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
1575 | skb_reset_tail_pointer(ch->trans_skb); | 1547 | skb_reset_tail_pointer(ch->trans_skb); |
1576 | ch->trans_skb->len = 0; | 1548 | ch->trans_skb->len = 0; |
1577 | ch->ccw[1].count = ch->max_bufsize; | 1549 | ch->ccw[1].count = ch->max_bufsize; |
1578 | if (do_debug_ccw) | 1550 | CTCM_CCW_DUMP((char *)&ch->ccw[0], sizeof(struct ccw1) * 3); |
1579 | ctcmpc_dumpit((char *)&ch->ccw[0], | ||
1580 | sizeof(struct ccw1) * 3); | ||
1581 | if (event == CTC_EVENT_START) | 1551 | if (event == CTC_EVENT_START) |
1582 | /* see remark about conditional locking */ | 1552 | /* see remark about conditional locking */ |
1583 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 1553 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
@@ -1598,9 +1568,6 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) | |||
1598 | 1568 | ||
1599 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); | 1569 | fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); |
1600 | done: | 1570 | done: |
1601 | if (do_debug) | ||
1602 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", | ||
1603 | dev->name, __FUNCTION__); | ||
1604 | return; | 1571 | return; |
1605 | } | 1572 | } |
1606 | 1573 | ||
@@ -1616,13 +1583,9 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) | |||
1616 | struct ctcm_priv *priv = dev->priv; | 1583 | struct ctcm_priv *priv = dev->priv; |
1617 | struct mpc_group *grp = priv->mpcg; | 1584 | struct mpc_group *grp = priv->mpcg; |
1618 | 1585 | ||
1619 | if (do_debug) { | 1586 | CTCM_PR_DEBUG("%s(%s): %s(ch=0x%p), cp=%i, ChStat:%s, GrpStat:%s\n", |
1620 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s" | 1587 | __func__, dev->name, ch->id, ch, smp_processor_id(), |
1621 | "GrpState:%s ChState:%s\n", | 1588 | fsm_getstate_str(ch->fsm), fsm_getstate_str(grp->fsm)); |
1622 | __FUNCTION__, smp_processor_id(), ch, ch->id, | ||
1623 | fsm_getstate_str(grp->fsm), | ||
1624 | fsm_getstate_str(ch->fsm)); | ||
1625 | } | ||
1626 | 1589 | ||
1627 | switch (fsm_getstate(grp->fsm)) { | 1590 | switch (fsm_getstate(grp->fsm)) { |
1628 | case MPCG_STATE_XID2INITW: | 1591 | case MPCG_STATE_XID2INITW: |
@@ -1664,11 +1627,7 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) | |||
1664 | break; | 1627 | break; |
1665 | } | 1628 | } |
1666 | 1629 | ||
1667 | if (do_debug) | ||
1668 | ctcm_pr_debug("ctcmpc exit : %s(): cp=%i ch=0x%p id=%s\n", | ||
1669 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
1670 | return; | 1630 | return; |
1671 | |||
1672 | } | 1631 | } |
1673 | 1632 | ||
1674 | /* | 1633 | /* |
@@ -1683,11 +1642,9 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) | |||
1683 | struct ctcm_priv *priv = dev->priv; | 1642 | struct ctcm_priv *priv = dev->priv; |
1684 | struct mpc_group *grp = priv->mpcg; | 1643 | struct mpc_group *grp = priv->mpcg; |
1685 | 1644 | ||
1686 | ctcm_pr_debug("ctcmpc enter: %s %s() %s \nGrpState:%s ChState:%s\n", | 1645 | CTCM_PR_DEBUG("%s(%s): %s\n ChState:%s GrpState:%s\n", |
1687 | dev->name, | 1646 | __func__, dev->name, ch->id, |
1688 | __FUNCTION__, ch->id, | 1647 | fsm_getstate_str(ch->fsm), fsm_getstate_str(grp->fsm)); |
1689 | fsm_getstate_str(grp->fsm), | ||
1690 | fsm_getstate_str(ch->fsm)); | ||
1691 | 1648 | ||
1692 | fsm_deltimer(&ch->timer); | 1649 | fsm_deltimer(&ch->timer); |
1693 | 1650 | ||
@@ -1750,16 +1707,12 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) | |||
1750 | if (ch->in_mpcgroup) | 1707 | if (ch->in_mpcgroup) |
1751 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); | 1708 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); |
1752 | else | 1709 | else |
1753 | printk(KERN_WARNING "ctcmpc: %s() Not all channels have" | 1710 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1754 | " been added to group\n", __FUNCTION__); | 1711 | "%s(%s): channel %s not added to group", |
1712 | CTCM_FUNTAIL, dev->name, ch->id); | ||
1755 | 1713 | ||
1756 | done: | 1714 | done: |
1757 | if (do_debug) | ||
1758 | ctcm_pr_debug("ctcmpc exit : %s()%s ch=0x%p id=%s\n", | ||
1759 | __FUNCTION__, dev->name, ch, ch->id); | ||
1760 | |||
1761 | return; | 1715 | return; |
1762 | |||
1763 | } | 1716 | } |
1764 | 1717 | ||
1765 | /* | 1718 | /* |
@@ -1774,13 +1727,7 @@ static void ctcmpc_chx_resend(fsm_instance *fsm, int event, void *arg) | |||
1774 | struct ctcm_priv *priv = dev->priv; | 1727 | struct ctcm_priv *priv = dev->priv; |
1775 | struct mpc_group *grp = priv->mpcg; | 1728 | struct mpc_group *grp = priv->mpcg; |
1776 | 1729 | ||
1777 | ctcm_pr_debug("ctcmpc enter: %s %s() %s \nGrpState:%s ChState:%s\n", | ||
1778 | dev->name, __FUNCTION__, ch->id, | ||
1779 | fsm_getstate_str(grp->fsm), | ||
1780 | fsm_getstate_str(ch->fsm)); | ||
1781 | |||
1782 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); | 1730 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); |
1783 | |||
1784 | return; | 1731 | return; |
1785 | } | 1732 | } |
1786 | 1733 | ||
@@ -1802,19 +1749,16 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
1802 | int rc = 0; | 1749 | int rc = 0; |
1803 | unsigned long saveflags = 0; | 1750 | unsigned long saveflags = 0; |
1804 | 1751 | ||
1805 | if (do_debug) | 1752 | CTCM_PR_DEBUG("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", |
1806 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | 1753 | __func__, smp_processor_id(), ach, ach->id); |
1807 | __FUNCTION__, smp_processor_id(), ach, ach->id); | ||
1808 | 1754 | ||
1809 | if (grp->in_sweep == 0) | 1755 | if (grp->in_sweep == 0) |
1810 | goto done; | 1756 | goto done; |
1811 | 1757 | ||
1812 | if (do_debug_data) { | 1758 | CTCM_PR_DBGDATA("%s: 1: ToVTAM_th_seq= %08x\n" , |
1813 | ctcm_pr_debug("ctcmpc: %s() 1: ToVTAM_th_seq= %08x\n" , | 1759 | __func__, wch->th_seq_num); |
1814 | __FUNCTION__, wch->th_seq_num); | 1760 | CTCM_PR_DBGDATA("%s: 1: FromVTAM_th_seq= %08x\n" , |
1815 | ctcm_pr_debug("ctcmpc: %s() 1: FromVTAM_th_seq= %08x\n" , | 1761 | __func__, rch->th_seq_num); |
1816 | __FUNCTION__, rch->th_seq_num); | ||
1817 | } | ||
1818 | 1762 | ||
1819 | if (fsm_getstate(wch->fsm) != CTC_STATE_TXIDLE) { | 1763 | if (fsm_getstate(wch->fsm) != CTC_STATE_TXIDLE) { |
1820 | /* give the previous IO time to complete */ | 1764 | /* give the previous IO time to complete */ |
@@ -1853,11 +1797,9 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
1853 | 1797 | ||
1854 | header->sw.th_last_seq = wch->th_seq_num; | 1798 | header->sw.th_last_seq = wch->th_seq_num; |
1855 | 1799 | ||
1856 | if (do_debug_ccw) | 1800 | CTCM_CCW_DUMP((char *)&wch->ccw[3], sizeof(struct ccw1) * 3); |
1857 | ctcmpc_dumpit((char *)&wch->ccw[3], sizeof(struct ccw1) * 3); | 1801 | CTCM_PR_DBGDATA("%s: sweep packet\n", __func__); |
1858 | 1802 | CTCM_D3_DUMP((char *)header, TH_SWEEP_LENGTH); | |
1859 | ctcm_pr_debug("ctcmpc: %s() sweep packet\n", __FUNCTION__); | ||
1860 | ctcmpc_dumpit((char *)header, TH_SWEEP_LENGTH); | ||
1861 | 1803 | ||
1862 | fsm_addtimer(&wch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, wch); | 1804 | fsm_addtimer(&wch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, wch); |
1863 | fsm_newstate(wch->fsm, CTC_STATE_TX); | 1805 | fsm_newstate(wch->fsm, CTC_STATE_TX); |
@@ -1876,19 +1818,13 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) | |||
1876 | ctcm_clear_busy_do(dev); | 1818 | ctcm_clear_busy_do(dev); |
1877 | } | 1819 | } |
1878 | 1820 | ||
1879 | if (do_debug_data) { | 1821 | CTCM_PR_DBGDATA("%s: To-/From-VTAM_th_seq = %08x/%08x\n" , |
1880 | ctcm_pr_debug("ctcmpc: %s()2: ToVTAM_th_seq= %08x\n" , | 1822 | __func__, wch->th_seq_num, rch->th_seq_num); |
1881 | __FUNCTION__, wch->th_seq_num); | ||
1882 | ctcm_pr_debug("ctcmpc: %s()2: FromVTAM_th_seq= %08x\n" , | ||
1883 | __FUNCTION__, rch->th_seq_num); | ||
1884 | } | ||
1885 | 1823 | ||
1886 | if (rc != 0) | 1824 | if (rc != 0) |
1887 | ctcm_ccw_check_rc(wch, rc, "send sweep"); | 1825 | ctcm_ccw_check_rc(wch, rc, "send sweep"); |
1888 | 1826 | ||
1889 | done: | 1827 | done: |
1890 | if (do_debug) | ||
1891 | ctcm_pr_debug("ctcmpc exit: %s() %s\n", __FUNCTION__, ach->id); | ||
1892 | return; | 1828 | return; |
1893 | } | 1829 | } |
1894 | 1830 | ||
@@ -2149,9 +2085,8 @@ static void dev_action_stop(fsm_instance *fi, int event, void *arg) | |||
2149 | struct channel *ch = priv->channel[direction]; | 2085 | struct channel *ch = priv->channel[direction]; |
2150 | fsm_event(ch->fsm, CTC_EVENT_STOP, ch); | 2086 | fsm_event(ch->fsm, CTC_EVENT_STOP, ch); |
2151 | ch->th_seq_num = 0x00; | 2087 | ch->th_seq_num = 0x00; |
2152 | if (do_debug) | 2088 | CTCM_PR_DEBUG("%s: CH_th_seq= %08x\n", |
2153 | ctcm_pr_debug("ctcm: %s() CH_th_seq= %08x\n", | 2089 | __func__, ch->th_seq_num); |
2154 | __FUNCTION__, ch->th_seq_num); | ||
2155 | } | 2090 | } |
2156 | if (IS_MPC(priv)) | 2091 | if (IS_MPC(priv)) |
2157 | fsm_newstate(priv->mpcg->fsm, MPCG_STATE_RESET); | 2092 | fsm_newstate(priv->mpcg->fsm, MPCG_STATE_RESET); |
@@ -2199,8 +2134,11 @@ static void dev_action_chup(fsm_instance *fi, int event, void *arg) | |||
2199 | { | 2134 | { |
2200 | struct net_device *dev = arg; | 2135 | struct net_device *dev = arg; |
2201 | struct ctcm_priv *priv = dev->priv; | 2136 | struct ctcm_priv *priv = dev->priv; |
2137 | int dev_stat = fsm_getstate(fi); | ||
2202 | 2138 | ||
2203 | CTCMY_DBF_DEV_NAME(SETUP, dev, ""); | 2139 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, |
2140 | "%s(%s): priv = %p [%d,%d]\n ", CTCM_FUNTAIL, | ||
2141 | dev->name, dev->priv, dev_stat, event); | ||
2204 | 2142 | ||
2205 | switch (fsm_getstate(fi)) { | 2143 | switch (fsm_getstate(fi)) { |
2206 | case DEV_STATE_STARTWAIT_RXTX: | 2144 | case DEV_STATE_STARTWAIT_RXTX: |
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 6b13c1c1beb8..126a3ebb8ab2 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c | |||
@@ -84,20 +84,19 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
84 | skb_pull(pskb, LL_HEADER_LENGTH); | 84 | skb_pull(pskb, LL_HEADER_LENGTH); |
85 | if ((ch->protocol == CTCM_PROTO_S390) && | 85 | if ((ch->protocol == CTCM_PROTO_S390) && |
86 | (header->type != ETH_P_IP)) { | 86 | (header->type != ETH_P_IP)) { |
87 | |||
88 | if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) { | 87 | if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) { |
88 | ch->logflags |= LOG_FLAG_ILLEGALPKT; | ||
89 | /* | 89 | /* |
90 | * Check packet type only if we stick strictly | 90 | * Check packet type only if we stick strictly |
91 | * to S/390's protocol of OS390. This only | 91 | * to S/390's protocol of OS390. This only |
92 | * supports IP. Otherwise allow any packet | 92 | * supports IP. Otherwise allow any packet |
93 | * type. | 93 | * type. |
94 | */ | 94 | */ |
95 | ctcm_pr_warn("%s Illegal packet type 0x%04x " | 95 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
96 | "received, dropping\n", | 96 | "%s(%s): Illegal packet type 0x%04x" |
97 | dev->name, header->type); | 97 | " - dropping", |
98 | ch->logflags |= LOG_FLAG_ILLEGALPKT; | 98 | CTCM_FUNTAIL, dev->name, header->type); |
99 | } | 99 | } |
100 | |||
101 | priv->stats.rx_dropped++; | 100 | priv->stats.rx_dropped++; |
102 | priv->stats.rx_frame_errors++; | 101 | priv->stats.rx_frame_errors++; |
103 | return; | 102 | return; |
@@ -105,11 +104,11 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
105 | pskb->protocol = ntohs(header->type); | 104 | pskb->protocol = ntohs(header->type); |
106 | if (header->length <= LL_HEADER_LENGTH) { | 105 | if (header->length <= LL_HEADER_LENGTH) { |
107 | if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) { | 106 | if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) { |
108 | ctcm_pr_warn( | 107 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
109 | "%s Illegal packet size %d " | 108 | "%s(%s): Illegal packet size %d(%d,%d)" |
110 | "received (MTU=%d blocklen=%d), " | 109 | "- dropping", |
111 | "dropping\n", dev->name, header->length, | 110 | CTCM_FUNTAIL, dev->name, |
112 | dev->mtu, len); | 111 | header->length, dev->mtu, len); |
113 | ch->logflags |= LOG_FLAG_ILLEGALSIZE; | 112 | ch->logflags |= LOG_FLAG_ILLEGALSIZE; |
114 | } | 113 | } |
115 | 114 | ||
@@ -122,10 +121,10 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
122 | if ((header->length > skb_tailroom(pskb)) || | 121 | if ((header->length > skb_tailroom(pskb)) || |
123 | (header->length > len)) { | 122 | (header->length > len)) { |
124 | if (!(ch->logflags & LOG_FLAG_OVERRUN)) { | 123 | if (!(ch->logflags & LOG_FLAG_OVERRUN)) { |
125 | ctcm_pr_warn( | 124 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
126 | "%s Illegal packet size %d (beyond the" | 125 | "%s(%s): Packet size %d (overrun)" |
127 | " end of received data), dropping\n", | 126 | " - dropping", CTCM_FUNTAIL, |
128 | dev->name, header->length); | 127 | dev->name, header->length); |
129 | ch->logflags |= LOG_FLAG_OVERRUN; | 128 | ch->logflags |= LOG_FLAG_OVERRUN; |
130 | } | 129 | } |
131 | 130 | ||
@@ -139,9 +138,9 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
139 | skb = dev_alloc_skb(pskb->len); | 138 | skb = dev_alloc_skb(pskb->len); |
140 | if (!skb) { | 139 | if (!skb) { |
141 | if (!(ch->logflags & LOG_FLAG_NOMEM)) { | 140 | if (!(ch->logflags & LOG_FLAG_NOMEM)) { |
142 | ctcm_pr_warn( | 141 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
143 | "%s Out of memory in ctcm_unpack_skb\n", | 142 | "%s(%s): MEMORY allocation error", |
144 | dev->name); | 143 | CTCM_FUNTAIL, dev->name); |
145 | ch->logflags |= LOG_FLAG_NOMEM; | 144 | ch->logflags |= LOG_FLAG_NOMEM; |
146 | } | 145 | } |
147 | priv->stats.rx_dropped++; | 146 | priv->stats.rx_dropped++; |
@@ -184,7 +183,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
184 | */ | 183 | */ |
185 | static void channel_free(struct channel *ch) | 184 | static void channel_free(struct channel *ch) |
186 | { | 185 | { |
187 | CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); | 186 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s)", CTCM_FUNTAIL, ch->id); |
188 | ch->flags &= ~CHANNEL_FLAGS_INUSE; | 187 | ch->flags &= ~CHANNEL_FLAGS_INUSE; |
189 | fsm_newstate(ch->fsm, CTC_STATE_IDLE); | 188 | fsm_newstate(ch->fsm, CTC_STATE_IDLE); |
190 | } | 189 | } |
@@ -251,19 +250,12 @@ static struct channel *channel_get(enum channel_types type, | |||
251 | { | 250 | { |
252 | struct channel *ch = channels; | 251 | struct channel *ch = channels; |
253 | 252 | ||
254 | if (do_debug) { | ||
255 | char buf[64]; | ||
256 | sprintf(buf, "%s(%d, %s, %d)\n", | ||
257 | CTCM_FUNTAIL, type, id, direction); | ||
258 | CTCM_DBF_TEXT(TRACE, CTC_DBF_INFO, buf); | ||
259 | } | ||
260 | while (ch && (strncmp(ch->id, id, CTCM_ID_SIZE) || (ch->type != type))) | 253 | while (ch && (strncmp(ch->id, id, CTCM_ID_SIZE) || (ch->type != type))) |
261 | ch = ch->next; | 254 | ch = ch->next; |
262 | if (!ch) { | 255 | if (!ch) { |
263 | char buf[64]; | 256 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
264 | sprintf(buf, "%s(%d, %s, %d) not found in channel list\n", | 257 | "%s(%d, %s, %d) not found in channel list\n", |
265 | CTCM_FUNTAIL, type, id, direction); | 258 | CTCM_FUNTAIL, type, id, direction); |
266 | CTCM_DBF_TEXT(ERROR, CTC_DBF_ERROR, buf); | ||
267 | } else { | 259 | } else { |
268 | if (ch->flags & CHANNEL_FLAGS_INUSE) | 260 | if (ch->flags & CHANNEL_FLAGS_INUSE) |
269 | ch = NULL; | 261 | ch = NULL; |
@@ -283,8 +275,9 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb) | |||
283 | if (!IS_ERR(irb)) | 275 | if (!IS_ERR(irb)) |
284 | return 0; | 276 | return 0; |
285 | 277 | ||
286 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, "irb error %ld on device %s\n", | 278 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, |
287 | PTR_ERR(irb), cdev->dev.bus_id); | 279 | "irb error %ld on device %s\n", |
280 | PTR_ERR(irb), cdev->dev.bus_id); | ||
288 | 281 | ||
289 | switch (PTR_ERR(irb)) { | 282 | switch (PTR_ERR(irb)) { |
290 | case -EIO: | 283 | case -EIO: |
@@ -307,58 +300,85 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb) | |||
307 | * ch The channel, the sense code belongs to. | 300 | * ch The channel, the sense code belongs to. |
308 | * sense The sense code to inspect. | 301 | * sense The sense code to inspect. |
309 | */ | 302 | */ |
310 | static inline void ccw_unit_check(struct channel *ch, unsigned char sense) | 303 | static inline void ccw_unit_check(struct channel *ch, __u8 sense) |
311 | { | 304 | { |
312 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | 305 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
306 | "%s(%s): %02x", | ||
307 | CTCM_FUNTAIL, ch->id, sense); | ||
308 | |||
313 | if (sense & SNS0_INTERVENTION_REQ) { | 309 | if (sense & SNS0_INTERVENTION_REQ) { |
314 | if (sense & 0x01) { | 310 | if (sense & 0x01) { |
315 | ctcm_pr_debug("%s: Interface disc. or Sel. reset " | 311 | if (ch->sense_rc != 0x01) { |
316 | "(remote)\n", ch->id); | 312 | ctcm_pr_debug("%s: Interface disc. or Sel. " |
313 | "reset (remote)\n", ch->id); | ||
314 | ch->sense_rc = 0x01; | ||
315 | } | ||
317 | fsm_event(ch->fsm, CTC_EVENT_UC_RCRESET, ch); | 316 | fsm_event(ch->fsm, CTC_EVENT_UC_RCRESET, ch); |
318 | } else { | 317 | } else { |
319 | ctcm_pr_debug("%s: System reset (remote)\n", ch->id); | 318 | if (ch->sense_rc != SNS0_INTERVENTION_REQ) { |
319 | ctcm_pr_debug("%s: System reset (remote)\n", | ||
320 | ch->id); | ||
321 | ch->sense_rc = SNS0_INTERVENTION_REQ; | ||
322 | } | ||
320 | fsm_event(ch->fsm, CTC_EVENT_UC_RSRESET, ch); | 323 | fsm_event(ch->fsm, CTC_EVENT_UC_RSRESET, ch); |
321 | } | 324 | } |
322 | } else if (sense & SNS0_EQUIPMENT_CHECK) { | 325 | } else if (sense & SNS0_EQUIPMENT_CHECK) { |
323 | if (sense & SNS0_BUS_OUT_CHECK) { | 326 | if (sense & SNS0_BUS_OUT_CHECK) { |
324 | ctcm_pr_warn("%s: Hardware malfunction (remote)\n", | 327 | if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { |
325 | ch->id); | 328 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
329 | "%s(%s): remote HW error %02x", | ||
330 | CTCM_FUNTAIL, ch->id, sense); | ||
331 | ch->sense_rc = SNS0_BUS_OUT_CHECK; | ||
332 | } | ||
326 | fsm_event(ch->fsm, CTC_EVENT_UC_HWFAIL, ch); | 333 | fsm_event(ch->fsm, CTC_EVENT_UC_HWFAIL, ch); |
327 | } else { | 334 | } else { |
328 | ctcm_pr_warn("%s: Read-data parity error (remote)\n", | 335 | if (ch->sense_rc != SNS0_EQUIPMENT_CHECK) { |
329 | ch->id); | 336 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
337 | "%s(%s): remote read parity error %02x", | ||
338 | CTCM_FUNTAIL, ch->id, sense); | ||
339 | ch->sense_rc = SNS0_EQUIPMENT_CHECK; | ||
340 | } | ||
330 | fsm_event(ch->fsm, CTC_EVENT_UC_RXPARITY, ch); | 341 | fsm_event(ch->fsm, CTC_EVENT_UC_RXPARITY, ch); |
331 | } | 342 | } |
332 | } else if (sense & SNS0_BUS_OUT_CHECK) { | 343 | } else if (sense & SNS0_BUS_OUT_CHECK) { |
333 | if (sense & 0x04) { | 344 | if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { |
334 | ctcm_pr_warn("%s: Data-streaming timeout)\n", ch->id); | 345 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
346 | "%s(%s): BUS OUT error %02x", | ||
347 | CTCM_FUNTAIL, ch->id, sense); | ||
348 | ch->sense_rc = SNS0_BUS_OUT_CHECK; | ||
349 | } | ||
350 | if (sense & 0x04) /* data-streaming timeout */ | ||
335 | fsm_event(ch->fsm, CTC_EVENT_UC_TXTIMEOUT, ch); | 351 | fsm_event(ch->fsm, CTC_EVENT_UC_TXTIMEOUT, ch); |
336 | } else { | 352 | else /* Data-transfer parity error */ |
337 | ctcm_pr_warn("%s: Data-transfer parity error\n", | ||
338 | ch->id); | ||
339 | fsm_event(ch->fsm, CTC_EVENT_UC_TXPARITY, ch); | 353 | fsm_event(ch->fsm, CTC_EVENT_UC_TXPARITY, ch); |
340 | } | ||
341 | } else if (sense & SNS0_CMD_REJECT) { | 354 | } else if (sense & SNS0_CMD_REJECT) { |
342 | ctcm_pr_warn("%s: Command reject\n", ch->id); | 355 | if (ch->sense_rc != SNS0_CMD_REJECT) { |
356 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, | ||
357 | "%s(%s): Command rejected", | ||
358 | CTCM_FUNTAIL, ch->id); | ||
359 | ch->sense_rc = SNS0_CMD_REJECT; | ||
360 | } | ||
343 | } else if (sense == 0) { | 361 | } else if (sense == 0) { |
344 | ctcm_pr_debug("%s: Unit check ZERO\n", ch->id); | 362 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
363 | "%s(%s): Unit check ZERO", | ||
364 | CTCM_FUNTAIL, ch->id); | ||
345 | fsm_event(ch->fsm, CTC_EVENT_UC_ZERO, ch); | 365 | fsm_event(ch->fsm, CTC_EVENT_UC_ZERO, ch); |
346 | } else { | 366 | } else { |
347 | ctcm_pr_warn("%s: Unit Check with sense code: %02x\n", | 367 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, |
348 | ch->id, sense); | 368 | "%s(%s): Unit check code %02x unknown", |
369 | CTCM_FUNTAIL, ch->id, sense); | ||
349 | fsm_event(ch->fsm, CTC_EVENT_UC_UNKNOWN, ch); | 370 | fsm_event(ch->fsm, CTC_EVENT_UC_UNKNOWN, ch); |
350 | } | 371 | } |
351 | } | 372 | } |
352 | 373 | ||
353 | int ctcm_ch_alloc_buffer(struct channel *ch) | 374 | int ctcm_ch_alloc_buffer(struct channel *ch) |
354 | { | 375 | { |
355 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | ||
356 | |||
357 | clear_normalized_cda(&ch->ccw[1]); | 376 | clear_normalized_cda(&ch->ccw[1]); |
358 | ch->trans_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC | GFP_DMA); | 377 | ch->trans_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC | GFP_DMA); |
359 | if (ch->trans_skb == NULL) { | 378 | if (ch->trans_skb == NULL) { |
360 | ctcm_pr_warn("%s: Couldn't alloc %s trans_skb\n", | 379 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
361 | ch->id, | 380 | "%s(%s): %s trans_skb allocation error", |
381 | CTCM_FUNTAIL, ch->id, | ||
362 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 382 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
363 | return -ENOMEM; | 383 | return -ENOMEM; |
364 | } | 384 | } |
@@ -367,9 +387,9 @@ int ctcm_ch_alloc_buffer(struct channel *ch) | |||
367 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { | 387 | if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { |
368 | dev_kfree_skb(ch->trans_skb); | 388 | dev_kfree_skb(ch->trans_skb); |
369 | ch->trans_skb = NULL; | 389 | ch->trans_skb = NULL; |
370 | ctcm_pr_warn("%s: set_normalized_cda for %s " | 390 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
371 | "trans_skb failed, dropping packets\n", | 391 | "%s(%s): %s set norm_cda failed", |
372 | ch->id, | 392 | CTCM_FUNTAIL, ch->id, |
373 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); | 393 | (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); |
374 | return -ENOMEM; | 394 | return -ENOMEM; |
375 | } | 395 | } |
@@ -516,7 +536,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
516 | atomic_dec(&skb->users); | 536 | atomic_dec(&skb->users); |
517 | skb_pull(skb, LL_HEADER_LENGTH + 2); | 537 | skb_pull(skb, LL_HEADER_LENGTH + 2); |
518 | ctcm_clear_busy(ch->netdev); | 538 | ctcm_clear_busy(ch->netdev); |
519 | return -EBUSY; | 539 | return -ENOMEM; |
520 | } | 540 | } |
521 | 541 | ||
522 | skb_reset_tail_pointer(ch->trans_skb); | 542 | skb_reset_tail_pointer(ch->trans_skb); |
@@ -570,15 +590,12 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
570 | struct th_sweep *header; | 590 | struct th_sweep *header; |
571 | struct sk_buff *sweep_skb; | 591 | struct sk_buff *sweep_skb; |
572 | struct channel *ch; | 592 | struct channel *ch; |
573 | int rc = 0; | 593 | /* int rc = 0; */ |
574 | 594 | ||
575 | priv = dev->priv; | 595 | priv = dev->priv; |
576 | grp = priv->mpcg; | 596 | grp = priv->mpcg; |
577 | ch = priv->channel[WRITE]; | 597 | ch = priv->channel[WRITE]; |
578 | 598 | ||
579 | if (do_debug) | ||
580 | MPC_DBF_DEV_NAME(TRACE, dev, ch->id); | ||
581 | |||
582 | /* sweep processing is not complete until response and request */ | 599 | /* sweep processing is not complete until response and request */ |
583 | /* has completed for all read channels in group */ | 600 | /* has completed for all read channels in group */ |
584 | if (grp->in_sweep == 0) { | 601 | if (grp->in_sweep == 0) { |
@@ -590,17 +607,16 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
590 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); | 607 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); |
591 | 608 | ||
592 | if (sweep_skb == NULL) { | 609 | if (sweep_skb == NULL) { |
593 | printk(KERN_INFO "Couldn't alloc sweep_skb\n"); | 610 | /* rc = -ENOMEM; */ |
594 | rc = -ENOMEM; | 611 | goto nomem; |
595 | goto done; | ||
596 | } | 612 | } |
597 | 613 | ||
598 | header = kmalloc(TH_SWEEP_LENGTH, gfp_type()); | 614 | header = kmalloc(TH_SWEEP_LENGTH, gfp_type()); |
599 | 615 | ||
600 | if (!header) { | 616 | if (!header) { |
601 | dev_kfree_skb_any(sweep_skb); | 617 | dev_kfree_skb_any(sweep_skb); |
602 | rc = -ENOMEM; | 618 | /* rc = -ENOMEM; */ |
603 | goto done; | 619 | goto nomem; |
604 | } | 620 | } |
605 | 621 | ||
606 | header->th.th_seg = 0x00 ; | 622 | header->th.th_seg = 0x00 ; |
@@ -621,12 +637,10 @@ static void ctcmpc_send_sweep_req(struct channel *rch) | |||
621 | 637 | ||
622 | return; | 638 | return; |
623 | 639 | ||
624 | done: | 640 | nomem: |
625 | if (rc != 0) { | 641 | grp->in_sweep = 0; |
626 | grp->in_sweep = 0; | 642 | ctcm_clear_busy(dev); |
627 | ctcm_clear_busy(dev); | 643 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
628 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
629 | } | ||
630 | 644 | ||
631 | return; | 645 | return; |
632 | } | 646 | } |
@@ -648,11 +662,9 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
648 | unsigned long saveflags = 0; /* avoids compiler warning */ | 662 | unsigned long saveflags = 0; /* avoids compiler warning */ |
649 | __u16 block_len; | 663 | __u16 block_len; |
650 | 664 | ||
651 | if (do_debug) | 665 | CTCM_PR_DEBUG("Enter %s: %s, cp=%i ch=0x%p id=%s state=%s\n", |
652 | ctcm_pr_debug( | 666 | __func__, dev->name, smp_processor_id(), ch, |
653 | "ctcm enter: %s(): %s cp=%i ch=0x%p id=%s state=%s\n", | 667 | ch->id, fsm_getstate_str(ch->fsm)); |
654 | __FUNCTION__, dev->name, smp_processor_id(), ch, | ||
655 | ch->id, fsm_getstate_str(ch->fsm)); | ||
656 | 668 | ||
657 | if ((fsm_getstate(ch->fsm) != CTC_STATE_TXIDLE) || grp->in_sweep) { | 669 | if ((fsm_getstate(ch->fsm) != CTC_STATE_TXIDLE) || grp->in_sweep) { |
658 | spin_lock_irqsave(&ch->collect_lock, saveflags); | 670 | spin_lock_irqsave(&ch->collect_lock, saveflags); |
@@ -660,14 +672,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
660 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); | 672 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); |
661 | 673 | ||
662 | if (!p_header) { | 674 | if (!p_header) { |
663 | printk(KERN_WARNING "ctcm: OUT OF MEMORY IN %s():" | ||
664 | " Data Lost \n", __FUNCTION__); | ||
665 | |||
666 | atomic_dec(&skb->users); | ||
667 | dev_kfree_skb_any(skb); | ||
668 | spin_unlock_irqrestore(&ch->collect_lock, saveflags); | 675 | spin_unlock_irqrestore(&ch->collect_lock, saveflags); |
669 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | 676 | goto nomem_exit; |
670 | goto done; | ||
671 | } | 677 | } |
672 | 678 | ||
673 | p_header->pdu_offset = skb->len; | 679 | p_header->pdu_offset = skb->len; |
@@ -682,13 +688,10 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
682 | memcpy(skb_push(skb, PDU_HEADER_LENGTH), p_header, | 688 | memcpy(skb_push(skb, PDU_HEADER_LENGTH), p_header, |
683 | PDU_HEADER_LENGTH); | 689 | PDU_HEADER_LENGTH); |
684 | 690 | ||
685 | if (do_debug_data) { | 691 | CTCM_PR_DEBUG("%s(%s): Put on collect_q - skb len: %04x \n" |
686 | ctcm_pr_debug("ctcm: %s() Putting on collect_q" | 692 | "pdu header and data for up to 32 bytes:\n", |
687 | " - skb len: %04x \n", __FUNCTION__, skb->len); | 693 | __func__, dev->name, skb->len); |
688 | ctcm_pr_debug("ctcm: %s() pdu header and data" | 694 | CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); |
689 | " for up to 32 bytes\n", __FUNCTION__); | ||
690 | ctcmpc_dump32((char *)skb->data, skb->len); | ||
691 | } | ||
692 | 695 | ||
693 | skb_queue_tail(&ch->collect_queue, skb); | 696 | skb_queue_tail(&ch->collect_queue, skb); |
694 | ch->collect_len += skb->len; | 697 | ch->collect_len += skb->len; |
@@ -713,12 +716,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
713 | if (hi) { | 716 | if (hi) { |
714 | nskb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 717 | nskb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); |
715 | if (!nskb) { | 718 | if (!nskb) { |
716 | printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY" | 719 | goto nomem_exit; |
717 | "- Data Lost \n", __FUNCTION__); | ||
718 | atomic_dec(&skb->users); | ||
719 | dev_kfree_skb_any(skb); | ||
720 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
721 | goto done; | ||
722 | } else { | 720 | } else { |
723 | memcpy(skb_put(nskb, skb->len), skb->data, skb->len); | 721 | memcpy(skb_put(nskb, skb->len), skb->data, skb->len); |
724 | atomic_inc(&nskb->users); | 722 | atomic_inc(&nskb->users); |
@@ -730,15 +728,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
730 | 728 | ||
731 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); | 729 | p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); |
732 | 730 | ||
733 | if (!p_header) { | 731 | if (!p_header) |
734 | printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY" | 732 | goto nomem_exit; |
735 | ": Data Lost \n", __FUNCTION__); | ||
736 | |||
737 | atomic_dec(&skb->users); | ||
738 | dev_kfree_skb_any(skb); | ||
739 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
740 | goto done; | ||
741 | } | ||
742 | 733 | ||
743 | p_header->pdu_offset = skb->len; | 734 | p_header->pdu_offset = skb->len; |
744 | p_header->pdu_proto = 0x01; | 735 | p_header->pdu_proto = 0x01; |
@@ -768,15 +759,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
768 | ch->prof.txlen += skb->len - PDU_HEADER_LENGTH; | 759 | ch->prof.txlen += skb->len - PDU_HEADER_LENGTH; |
769 | 760 | ||
770 | header = kmalloc(TH_HEADER_LENGTH, gfp_type()); | 761 | header = kmalloc(TH_HEADER_LENGTH, gfp_type()); |
771 | 762 | if (!header) | |
772 | if (!header) { | 763 | goto nomem_exit; |
773 | printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY: Data Lost \n", | ||
774 | __FUNCTION__); | ||
775 | atomic_dec(&skb->users); | ||
776 | dev_kfree_skb_any(skb); | ||
777 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
778 | goto done; | ||
779 | } | ||
780 | 764 | ||
781 | header->th_seg = 0x00; | 765 | header->th_seg = 0x00; |
782 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ | 766 | header->th_ch_flag = TH_HAS_PDU; /* Normal data */ |
@@ -785,41 +769,31 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
785 | ch->th_seq_num++; | 769 | ch->th_seq_num++; |
786 | header->th_seq_num = ch->th_seq_num; | 770 | header->th_seq_num = ch->th_seq_num; |
787 | 771 | ||
788 | if (do_debug_data) | 772 | CTCM_PR_DBGDATA("%s(%s) ToVTAM_th_seq= %08x\n" , |
789 | ctcm_pr_debug("ctcm: %s() ToVTAM_th_seq= %08x\n" , | 773 | __func__, dev->name, ch->th_seq_num); |
790 | __FUNCTION__, ch->th_seq_num); | ||
791 | 774 | ||
792 | /* put the TH on the packet */ | 775 | /* put the TH on the packet */ |
793 | memcpy(skb_push(skb, TH_HEADER_LENGTH), header, TH_HEADER_LENGTH); | 776 | memcpy(skb_push(skb, TH_HEADER_LENGTH), header, TH_HEADER_LENGTH); |
794 | 777 | ||
795 | kfree(header); | 778 | kfree(header); |
796 | 779 | ||
797 | if (do_debug_data) { | 780 | CTCM_PR_DBGDATA("%s(%s): skb len: %04x\n - pdu header and data for " |
798 | ctcm_pr_debug("ctcm: %s(): skb len: %04x \n", | 781 | "up to 32 bytes sent to vtam:\n", |
799 | __FUNCTION__, skb->len); | 782 | __func__, dev->name, skb->len); |
800 | ctcm_pr_debug("ctcm: %s(): pdu header and data for up to 32 " | 783 | CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); |
801 | "bytes sent to vtam\n", __FUNCTION__); | ||
802 | ctcmpc_dump32((char *)skb->data, skb->len); | ||
803 | } | ||
804 | 784 | ||
805 | ch->ccw[4].count = skb->len; | 785 | ch->ccw[4].count = skb->len; |
806 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { | 786 | if (set_normalized_cda(&ch->ccw[4], skb->data)) { |
807 | /* | 787 | /* |
808 | * idal allocation failed, try via copying to | 788 | * idal allocation failed, try via copying to trans_skb. |
809 | * trans_skb. trans_skb usually has a pre-allocated | 789 | * trans_skb usually has a pre-allocated idal. |
810 | * idal. | ||
811 | */ | 790 | */ |
812 | if (ctcm_checkalloc_buffer(ch)) { | 791 | if (ctcm_checkalloc_buffer(ch)) { |
813 | /* | 792 | /* |
814 | * Remove our header. It gets added | 793 | * Remove our header. |
815 | * again on retransmit. | 794 | * It gets added again on retransmit. |
816 | */ | 795 | */ |
817 | atomic_dec(&skb->users); | 796 | goto nomem_exit; |
818 | dev_kfree_skb_any(skb); | ||
819 | printk(KERN_WARNING "ctcm: %s()OUT OF MEMORY:" | ||
820 | " Data Lost \n", __FUNCTION__); | ||
821 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
822 | goto done; | ||
823 | } | 797 | } |
824 | 798 | ||
825 | skb_reset_tail_pointer(ch->trans_skb); | 799 | skb_reset_tail_pointer(ch->trans_skb); |
@@ -829,14 +803,11 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
829 | atomic_dec(&skb->users); | 803 | atomic_dec(&skb->users); |
830 | dev_kfree_skb_irq(skb); | 804 | dev_kfree_skb_irq(skb); |
831 | ccw_idx = 0; | 805 | ccw_idx = 0; |
832 | if (do_debug_data) { | 806 | CTCM_PR_DBGDATA("%s(%s): trans_skb len: %04x\n" |
833 | ctcm_pr_debug("ctcm: %s() TRANS skb len: %d \n", | 807 | "up to 32 bytes sent to vtam:\n", |
834 | __FUNCTION__, ch->trans_skb->len); | 808 | __func__, dev->name, ch->trans_skb->len); |
835 | ctcm_pr_debug("ctcm: %s up to 32 bytes of data" | 809 | CTCM_D3_DUMP((char *)ch->trans_skb->data, |
836 | " sent to vtam\n", __FUNCTION__); | 810 | min_t(int, 32, ch->trans_skb->len)); |
837 | ctcmpc_dump32((char *)ch->trans_skb->data, | ||
838 | ch->trans_skb->len); | ||
839 | } | ||
840 | } else { | 811 | } else { |
841 | skb_queue_tail(&ch->io_queue, skb); | 812 | skb_queue_tail(&ch->io_queue, skb); |
842 | ccw_idx = 3; | 813 | ccw_idx = 3; |
@@ -865,13 +836,21 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) | |||
865 | priv->stats.tx_packets++; | 836 | priv->stats.tx_packets++; |
866 | priv->stats.tx_bytes += skb->len - TH_HEADER_LENGTH; | 837 | priv->stats.tx_bytes += skb->len - TH_HEADER_LENGTH; |
867 | } | 838 | } |
868 | if (ch->th_seq_num > 0xf0000000) /* Chose 4Billion at random. */ | 839 | if (ch->th_seq_num > 0xf0000000) /* Chose at random. */ |
869 | ctcmpc_send_sweep_req(ch); | 840 | ctcmpc_send_sweep_req(ch); |
870 | 841 | ||
842 | goto done; | ||
843 | nomem_exit: | ||
844 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_CRIT, | ||
845 | "%s(%s): MEMORY allocation ERROR\n", | ||
846 | CTCM_FUNTAIL, ch->id); | ||
847 | rc = -ENOMEM; | ||
848 | atomic_dec(&skb->users); | ||
849 | dev_kfree_skb_any(skb); | ||
850 | fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); | ||
871 | done: | 851 | done: |
872 | if (do_debug) | 852 | CTCM_PR_DEBUG("Exit %s(%s)\n", __func__, dev->name); |
873 | ctcm_pr_debug("ctcm exit: %s %s()\n", dev->name, __FUNCTION__); | 853 | return rc; |
874 | return 0; | ||
875 | } | 854 | } |
876 | 855 | ||
877 | /** | 856 | /** |
@@ -888,20 +867,19 @@ done: | |||
888 | /* first merge version - leaving both functions separated */ | 867 | /* first merge version - leaving both functions separated */ |
889 | static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | 868 | static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) |
890 | { | 869 | { |
891 | int rc = 0; | 870 | struct ctcm_priv *priv = dev->priv; |
892 | struct ctcm_priv *priv; | ||
893 | |||
894 | CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); | ||
895 | priv = dev->priv; | ||
896 | 871 | ||
897 | if (skb == NULL) { | 872 | if (skb == NULL) { |
898 | ctcm_pr_warn("%s: NULL sk_buff passed\n", dev->name); | 873 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
874 | "%s(%s): NULL sk_buff passed", | ||
875 | CTCM_FUNTAIL, dev->name); | ||
899 | priv->stats.tx_dropped++; | 876 | priv->stats.tx_dropped++; |
900 | return 0; | 877 | return 0; |
901 | } | 878 | } |
902 | if (skb_headroom(skb) < (LL_HEADER_LENGTH + 2)) { | 879 | if (skb_headroom(skb) < (LL_HEADER_LENGTH + 2)) { |
903 | ctcm_pr_warn("%s: Got sk_buff with head room < %ld bytes\n", | 880 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
904 | dev->name, LL_HEADER_LENGTH + 2); | 881 | "%s(%s): Got sk_buff with head room < %ld bytes", |
882 | CTCM_FUNTAIL, dev->name, LL_HEADER_LENGTH + 2); | ||
905 | dev_kfree_skb(skb); | 883 | dev_kfree_skb(skb); |
906 | priv->stats.tx_dropped++; | 884 | priv->stats.tx_dropped++; |
907 | return 0; | 885 | return 0; |
@@ -925,51 +903,43 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) | |||
925 | 903 | ||
926 | dev->trans_start = jiffies; | 904 | dev->trans_start = jiffies; |
927 | if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0) | 905 | if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0) |
928 | rc = 1; | 906 | return 1; |
929 | return rc; | 907 | return 0; |
930 | } | 908 | } |
931 | 909 | ||
932 | /* unmerged MPC variant of ctcm_tx */ | 910 | /* unmerged MPC variant of ctcm_tx */ |
933 | static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | 911 | static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) |
934 | { | 912 | { |
935 | int len = 0; | 913 | int len = 0; |
936 | struct ctcm_priv *priv = NULL; | 914 | struct ctcm_priv *priv = dev->priv; |
937 | struct mpc_group *grp = NULL; | 915 | struct mpc_group *grp = priv->mpcg; |
938 | struct sk_buff *newskb = NULL; | 916 | struct sk_buff *newskb = NULL; |
939 | 917 | ||
940 | if (do_debug) | ||
941 | ctcm_pr_debug("ctcmpc enter: %s(): skb:%0lx\n", | ||
942 | __FUNCTION__, (unsigned long)skb); | ||
943 | |||
944 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | ||
945 | "ctcmpc enter: %s(): skb:%0lx\n", | ||
946 | __FUNCTION__, (unsigned long)skb); | ||
947 | |||
948 | priv = dev->priv; | ||
949 | grp = priv->mpcg; | ||
950 | /* | 918 | /* |
951 | * Some sanity checks ... | 919 | * Some sanity checks ... |
952 | */ | 920 | */ |
953 | if (skb == NULL) { | 921 | if (skb == NULL) { |
954 | ctcm_pr_warn("ctcmpc: %s: NULL sk_buff passed\n", dev->name); | 922 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
923 | "%s(%s): NULL sk_buff passed", | ||
924 | CTCM_FUNTAIL, dev->name); | ||
955 | priv->stats.tx_dropped++; | 925 | priv->stats.tx_dropped++; |
956 | goto done; | 926 | goto done; |
957 | } | 927 | } |
958 | if (skb_headroom(skb) < (TH_HEADER_LENGTH + PDU_HEADER_LENGTH)) { | 928 | if (skb_headroom(skb) < (TH_HEADER_LENGTH + PDU_HEADER_LENGTH)) { |
959 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_WARN, | 929 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, |
960 | "%s: Got sk_buff with head room < %ld bytes\n", | 930 | "%s(%s): Got sk_buff with head room < %ld bytes", |
961 | dev->name, TH_HEADER_LENGTH + PDU_HEADER_LENGTH); | 931 | CTCM_FUNTAIL, dev->name, |
932 | TH_HEADER_LENGTH + PDU_HEADER_LENGTH); | ||
962 | 933 | ||
963 | if (do_debug_data) | 934 | CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); |
964 | ctcmpc_dump32((char *)skb->data, skb->len); | ||
965 | 935 | ||
966 | len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH; | 936 | len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH; |
967 | newskb = __dev_alloc_skb(len, gfp_type() | GFP_DMA); | 937 | newskb = __dev_alloc_skb(len, gfp_type() | GFP_DMA); |
968 | 938 | ||
969 | if (!newskb) { | 939 | if (!newskb) { |
970 | printk(KERN_WARNING "ctcmpc: %s() OUT OF MEMORY-" | 940 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, |
971 | "Data Lost\n", | 941 | "%s: %s: __dev_alloc_skb failed", |
972 | __FUNCTION__); | 942 | __func__, dev->name); |
973 | 943 | ||
974 | dev_kfree_skb_any(skb); | 944 | dev_kfree_skb_any(skb); |
975 | priv->stats.tx_dropped++; | 945 | priv->stats.tx_dropped++; |
@@ -993,9 +963,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
993 | if ((fsm_getstate(priv->fsm) != DEV_STATE_RUNNING) || | 963 | if ((fsm_getstate(priv->fsm) != DEV_STATE_RUNNING) || |
994 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { | 964 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { |
995 | dev_kfree_skb_any(skb); | 965 | dev_kfree_skb_any(skb); |
996 | printk(KERN_INFO "ctcmpc: %s() DATA RCVD - MPC GROUP " | 966 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
997 | "NOT ACTIVE - DROPPED\n", | 967 | "%s(%s): inactive MPCGROUP - dropped", |
998 | __FUNCTION__); | 968 | CTCM_FUNTAIL, dev->name); |
999 | priv->stats.tx_dropped++; | 969 | priv->stats.tx_dropped++; |
1000 | priv->stats.tx_errors++; | 970 | priv->stats.tx_errors++; |
1001 | priv->stats.tx_carrier_errors++; | 971 | priv->stats.tx_carrier_errors++; |
@@ -1003,8 +973,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
1003 | } | 973 | } |
1004 | 974 | ||
1005 | if (ctcm_test_and_set_busy(dev)) { | 975 | if (ctcm_test_and_set_busy(dev)) { |
1006 | printk(KERN_WARNING "%s:DEVICE ERR - UNRECOVERABLE DATA LOSS\n", | 976 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1007 | __FUNCTION__); | 977 | "%s(%s): device busy - dropped", |
978 | CTCM_FUNTAIL, dev->name); | ||
1008 | dev_kfree_skb_any(skb); | 979 | dev_kfree_skb_any(skb); |
1009 | priv->stats.tx_dropped++; | 980 | priv->stats.tx_dropped++; |
1010 | priv->stats.tx_errors++; | 981 | priv->stats.tx_errors++; |
@@ -1015,12 +986,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) | |||
1015 | 986 | ||
1016 | dev->trans_start = jiffies; | 987 | dev->trans_start = jiffies; |
1017 | if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) { | 988 | if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) { |
1018 | printk(KERN_WARNING "ctcmpc: %s() DEVICE ERROR" | 989 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1019 | ": Data Lost \n", | 990 | "%s(%s): device error - dropped", |
1020 | __FUNCTION__); | 991 | CTCM_FUNTAIL, dev->name); |
1021 | printk(KERN_WARNING "ctcmpc: %s() DEVICE ERROR" | ||
1022 | " - UNRECOVERABLE DATA LOSS\n", | ||
1023 | __FUNCTION__); | ||
1024 | dev_kfree_skb_any(skb); | 992 | dev_kfree_skb_any(skb); |
1025 | priv->stats.tx_dropped++; | 993 | priv->stats.tx_dropped++; |
1026 | priv->stats.tx_errors++; | 994 | priv->stats.tx_errors++; |
@@ -1054,8 +1022,6 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) | |||
1054 | struct ctcm_priv *priv; | 1022 | struct ctcm_priv *priv; |
1055 | int max_bufsize; | 1023 | int max_bufsize; |
1056 | 1024 | ||
1057 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1058 | |||
1059 | if (new_mtu < 576 || new_mtu > 65527) | 1025 | if (new_mtu < 576 || new_mtu > 65527) |
1060 | return -EINVAL; | 1026 | return -EINVAL; |
1061 | 1027 | ||
@@ -1087,30 +1053,13 @@ static struct net_device_stats *ctcm_stats(struct net_device *dev) | |||
1087 | return &((struct ctcm_priv *)dev->priv)->stats; | 1053 | return &((struct ctcm_priv *)dev->priv)->stats; |
1088 | } | 1054 | } |
1089 | 1055 | ||
1090 | |||
1091 | static void ctcm_netdev_unregister(struct net_device *dev) | ||
1092 | { | ||
1093 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1094 | if (!dev) | ||
1095 | return; | ||
1096 | unregister_netdev(dev); | ||
1097 | } | ||
1098 | |||
1099 | static int ctcm_netdev_register(struct net_device *dev) | ||
1100 | { | ||
1101 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1102 | return register_netdev(dev); | ||
1103 | } | ||
1104 | |||
1105 | static void ctcm_free_netdevice(struct net_device *dev) | 1056 | static void ctcm_free_netdevice(struct net_device *dev) |
1106 | { | 1057 | { |
1107 | struct ctcm_priv *priv; | 1058 | struct ctcm_priv *priv; |
1108 | struct mpc_group *grp; | 1059 | struct mpc_group *grp; |
1109 | 1060 | ||
1110 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | 1061 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1111 | 1062 | "%s(%s)", CTCM_FUNTAIL, dev->name); | |
1112 | if (!dev) | ||
1113 | return; | ||
1114 | priv = dev->priv; | 1063 | priv = dev->priv; |
1115 | if (priv) { | 1064 | if (priv) { |
1116 | grp = priv->mpcg; | 1065 | grp = priv->mpcg; |
@@ -1171,7 +1120,9 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) | |||
1171 | dev = alloc_netdev(0, CTC_DEVICE_GENE, ctcm_dev_setup); | 1120 | dev = alloc_netdev(0, CTC_DEVICE_GENE, ctcm_dev_setup); |
1172 | 1121 | ||
1173 | if (!dev) { | 1122 | if (!dev) { |
1174 | ctcm_pr_err("%s: Out of memory\n", __FUNCTION__); | 1123 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, |
1124 | "%s: MEMORY allocation ERROR", | ||
1125 | CTCM_FUNTAIL); | ||
1175 | return NULL; | 1126 | return NULL; |
1176 | } | 1127 | } |
1177 | dev->priv = priv; | 1128 | dev->priv = priv; |
@@ -1209,6 +1160,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) | |||
1209 | } | 1160 | } |
1210 | 1161 | ||
1211 | CTCMY_DBF_DEV(SETUP, dev, "finished"); | 1162 | CTCMY_DBF_DEV(SETUP, dev, "finished"); |
1163 | |||
1212 | return dev; | 1164 | return dev; |
1213 | } | 1165 | } |
1214 | 1166 | ||
@@ -1226,18 +1178,24 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1226 | struct net_device *dev; | 1178 | struct net_device *dev; |
1227 | struct ctcm_priv *priv; | 1179 | struct ctcm_priv *priv; |
1228 | struct ccwgroup_device *cgdev; | 1180 | struct ccwgroup_device *cgdev; |
1181 | int cstat; | ||
1182 | int dstat; | ||
1183 | |||
1184 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, | ||
1185 | "Enter %s(%s)", CTCM_FUNTAIL, &cdev->dev.bus_id); | ||
1229 | 1186 | ||
1230 | CTCM_DBF_TEXT(TRACE, CTC_DBF_DEBUG, __FUNCTION__); | ||
1231 | if (ctcm_check_irb_error(cdev, irb)) | 1187 | if (ctcm_check_irb_error(cdev, irb)) |
1232 | return; | 1188 | return; |
1233 | 1189 | ||
1234 | cgdev = dev_get_drvdata(&cdev->dev); | 1190 | cgdev = dev_get_drvdata(&cdev->dev); |
1235 | 1191 | ||
1192 | cstat = irb->scsw.cmd.cstat; | ||
1193 | dstat = irb->scsw.cmd.dstat; | ||
1194 | |||
1236 | /* Check for unsolicited interrupts. */ | 1195 | /* Check for unsolicited interrupts. */ |
1237 | if (cgdev == NULL) { | 1196 | if (cgdev == NULL) { |
1238 | ctcm_pr_warn("ctcm: Got unsolicited irq: %s c-%02x d-%02x\n", | 1197 | ctcm_pr_warn("ctcm: Got unsolicited irq: c-%02x d-%02x\n", |
1239 | cdev->dev.bus_id, irb->scsw.cmd.cstat, | 1198 | cstat, dstat); |
1240 | irb->scsw.cmd.dstat); | ||
1241 | return; | 1199 | return; |
1242 | } | 1200 | } |
1243 | 1201 | ||
@@ -1254,26 +1212,22 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1254 | return; | 1212 | return; |
1255 | } | 1213 | } |
1256 | 1214 | ||
1257 | dev = (struct net_device *)(ch->netdev); | 1215 | dev = ch->netdev; |
1258 | if (dev == NULL) { | 1216 | if (dev == NULL) { |
1259 | ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n", | 1217 | ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n", |
1260 | __FUNCTION__, cdev->dev.bus_id, ch); | 1218 | __func__, cdev->dev.bus_id, ch); |
1261 | return; | 1219 | return; |
1262 | } | 1220 | } |
1263 | 1221 | ||
1264 | if (do_debug) | 1222 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, |
1265 | ctcm_pr_debug("%s: interrupt for device: %s " | 1223 | "%s(%s): int. for %s: cstat=%02x dstat=%02x", |
1266 | "received c-%02x d-%02x\n", | 1224 | CTCM_FUNTAIL, dev->name, ch->id, cstat, dstat); |
1267 | dev->name, | ||
1268 | ch->id, | ||
1269 | irb->scsw.cmd.cstat, | ||
1270 | irb->scsw.cmd.dstat); | ||
1271 | 1225 | ||
1272 | /* Copy interruption response block. */ | 1226 | /* Copy interruption response block. */ |
1273 | memcpy(ch->irb, irb, sizeof(struct irb)); | 1227 | memcpy(ch->irb, irb, sizeof(struct irb)); |
1274 | 1228 | ||
1275 | /* Check for good subchannel return code, otherwise error message */ | ||
1276 | if (irb->scsw.cmd.cstat) { | 1229 | if (irb->scsw.cmd.cstat) { |
1230 | /* Check for good subchannel return code, otherwise error message */ | ||
1277 | fsm_event(ch->fsm, CTC_EVENT_SC_UNKNOWN, ch); | 1231 | fsm_event(ch->fsm, CTC_EVENT_SC_UNKNOWN, ch); |
1278 | ctcm_pr_warn("%s: subchannel check for dev: %s - %02x %02x\n", | 1232 | ctcm_pr_warn("%s: subchannel check for dev: %s - %02x %02x\n", |
1279 | dev->name, ch->id, irb->scsw.cmd.cstat, | 1233 | dev->name, ch->id, irb->scsw.cmd.cstat, |
@@ -1283,6 +1237,11 @@ static void ctcm_irq_handler(struct ccw_device *cdev, | |||
1283 | 1237 | ||
1284 | /* Check the reason-code of a unit check */ | 1238 | /* Check the reason-code of a unit check */ |
1285 | if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { | 1239 | if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { |
1240 | if ((irb->ecw[0] & ch->sense_rc) == 0) | ||
1241 | /* print it only once */ | ||
1242 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, | ||
1243 | "%s(%s): sense=%02x, ds=%02x", | ||
1244 | CTCM_FUNTAIL, ch->id, irb->ecw[0], dstat); | ||
1286 | ccw_unit_check(ch, irb->ecw[0]); | 1245 | ccw_unit_check(ch, irb->ecw[0]); |
1287 | return; | 1246 | return; |
1288 | } | 1247 | } |
@@ -1320,14 +1279,18 @@ static int ctcm_probe_device(struct ccwgroup_device *cgdev) | |||
1320 | struct ctcm_priv *priv; | 1279 | struct ctcm_priv *priv; |
1321 | int rc; | 1280 | int rc; |
1322 | 1281 | ||
1323 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s %p", __FUNCTION__, cgdev); | 1282 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1283 | "%s %p", | ||
1284 | __func__, cgdev); | ||
1324 | 1285 | ||
1325 | if (!get_device(&cgdev->dev)) | 1286 | if (!get_device(&cgdev->dev)) |
1326 | return -ENODEV; | 1287 | return -ENODEV; |
1327 | 1288 | ||
1328 | priv = kzalloc(sizeof(struct ctcm_priv), GFP_KERNEL); | 1289 | priv = kzalloc(sizeof(struct ctcm_priv), GFP_KERNEL); |
1329 | if (!priv) { | 1290 | if (!priv) { |
1330 | ctcm_pr_err("%s: Out of memory\n", __FUNCTION__); | 1291 | CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, |
1292 | "%s: memory allocation failure", | ||
1293 | CTCM_FUNTAIL); | ||
1331 | put_device(&cgdev->dev); | 1294 | put_device(&cgdev->dev); |
1332 | return -ENOMEM; | 1295 | return -ENOMEM; |
1333 | } | 1296 | } |
@@ -1364,10 +1327,13 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, | |||
1364 | int ccw_num; | 1327 | int ccw_num; |
1365 | int rc = 0; | 1328 | int rc = 0; |
1366 | 1329 | ||
1367 | CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); | 1330 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1331 | "%s(%s), type %d, proto %d", | ||
1332 | __func__, cdev->dev.bus_id, type, priv->protocol); | ||
1333 | |||
1368 | ch = kzalloc(sizeof(struct channel), GFP_KERNEL); | 1334 | ch = kzalloc(sizeof(struct channel), GFP_KERNEL); |
1369 | if (ch == NULL) | 1335 | if (ch == NULL) |
1370 | goto nomem_return; | 1336 | return -ENOMEM; |
1371 | 1337 | ||
1372 | ch->protocol = priv->protocol; | 1338 | ch->protocol = priv->protocol; |
1373 | if (IS_MPC(priv)) { | 1339 | if (IS_MPC(priv)) { |
@@ -1478,7 +1444,7 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, | |||
1478 | if (*c && (!strncmp((*c)->id, ch->id, CTCM_ID_SIZE))) { | 1444 | if (*c && (!strncmp((*c)->id, ch->id, CTCM_ID_SIZE))) { |
1479 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | 1445 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1480 | "%s (%s) already in list, using old entry", | 1446 | "%s (%s) already in list, using old entry", |
1481 | __FUNCTION__, (*c)->id); | 1447 | __func__, (*c)->id); |
1482 | 1448 | ||
1483 | goto free_return; | 1449 | goto free_return; |
1484 | } | 1450 | } |
@@ -1498,11 +1464,10 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, | |||
1498 | return 0; | 1464 | return 0; |
1499 | 1465 | ||
1500 | nomem_return: | 1466 | nomem_return: |
1501 | ctcm_pr_warn("ctcm: Out of memory in %s\n", __FUNCTION__); | ||
1502 | rc = -ENOMEM; | 1467 | rc = -ENOMEM; |
1503 | 1468 | ||
1504 | free_return: /* note that all channel pointers are 0 or valid */ | 1469 | free_return: /* note that all channel pointers are 0 or valid */ |
1505 | kfree(ch->ccw); /* TODO: check that again */ | 1470 | kfree(ch->ccw); |
1506 | kfree(ch->discontact_th); | 1471 | kfree(ch->discontact_th); |
1507 | kfree_fsm(ch->fsm); | 1472 | kfree_fsm(ch->fsm); |
1508 | kfree(ch->irb); | 1473 | kfree(ch->irb); |
@@ -1540,48 +1505,48 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1540 | enum channel_types type; | 1505 | enum channel_types type; |
1541 | struct ctcm_priv *priv; | 1506 | struct ctcm_priv *priv; |
1542 | struct net_device *dev; | 1507 | struct net_device *dev; |
1508 | struct ccw_device *cdev0; | ||
1509 | struct ccw_device *cdev1; | ||
1543 | int ret; | 1510 | int ret; |
1544 | 1511 | ||
1545 | CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); | ||
1546 | |||
1547 | priv = dev_get_drvdata(&cgdev->dev); | 1512 | priv = dev_get_drvdata(&cgdev->dev); |
1548 | if (!priv) | 1513 | if (!priv) |
1549 | return -ENODEV; | 1514 | return -ENODEV; |
1550 | 1515 | ||
1551 | type = get_channel_type(&cgdev->cdev[0]->id); | 1516 | cdev0 = cgdev->cdev[0]; |
1517 | cdev1 = cgdev->cdev[1]; | ||
1518 | |||
1519 | type = get_channel_type(&cdev0->id); | ||
1552 | 1520 | ||
1553 | snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); | 1521 | snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cdev0->dev.bus_id); |
1554 | snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); | 1522 | snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cdev1->dev.bus_id); |
1555 | 1523 | ||
1556 | ret = add_channel(cgdev->cdev[0], type, priv); | 1524 | ret = add_channel(cdev0, type, priv); |
1557 | if (ret) | 1525 | if (ret) |
1558 | return ret; | 1526 | return ret; |
1559 | ret = add_channel(cgdev->cdev[1], type, priv); | 1527 | ret = add_channel(cdev1, type, priv); |
1560 | if (ret) | 1528 | if (ret) |
1561 | return ret; | 1529 | return ret; |
1562 | 1530 | ||
1563 | ret = ccw_device_set_online(cgdev->cdev[0]); | 1531 | ret = ccw_device_set_online(cdev0); |
1564 | if (ret != 0) { | 1532 | if (ret != 0) { |
1565 | CTCM_DBF_TEXT(SETUP, CTC_DBF_WARN, | 1533 | /* may be ok to fail now - can be done later */ |
1566 | "ccw_device_set_online (cdev[0]) failed "); | 1534 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
1567 | ctcm_pr_warn("ccw_device_set_online (cdev[0]) failed " | 1535 | "%s(%s) set_online rc=%d", |
1568 | "with ret = %d\n", ret); | 1536 | CTCM_FUNTAIL, read_id, ret); |
1569 | } | 1537 | } |
1570 | 1538 | ||
1571 | ret = ccw_device_set_online(cgdev->cdev[1]); | 1539 | ret = ccw_device_set_online(cdev1); |
1572 | if (ret != 0) { | 1540 | if (ret != 0) { |
1573 | CTCM_DBF_TEXT(SETUP, CTC_DBF_WARN, | 1541 | /* may be ok to fail now - can be done later */ |
1574 | "ccw_device_set_online (cdev[1]) failed "); | 1542 | CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, |
1575 | ctcm_pr_warn("ccw_device_set_online (cdev[1]) failed " | 1543 | "%s(%s) set_online rc=%d", |
1576 | "with ret = %d\n", ret); | 1544 | CTCM_FUNTAIL, write_id, ret); |
1577 | } | 1545 | } |
1578 | 1546 | ||
1579 | dev = ctcm_init_netdevice(priv); | 1547 | dev = ctcm_init_netdevice(priv); |
1580 | 1548 | if (dev == NULL) | |
1581 | if (dev == NULL) { | 1549 | goto out; |
1582 | ctcm_pr_warn("ctcm_init_netdevice failed\n"); | ||
1583 | goto out; | ||
1584 | } | ||
1585 | 1550 | ||
1586 | for (direction = READ; direction <= WRITE; direction++) { | 1551 | for (direction = READ; direction <= WRITE; direction++) { |
1587 | priv->channel[direction] = | 1552 | priv->channel[direction] = |
@@ -1590,8 +1555,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1590 | if (priv->channel[direction] == NULL) { | 1555 | if (priv->channel[direction] == NULL) { |
1591 | if (direction == WRITE) | 1556 | if (direction == WRITE) |
1592 | channel_free(priv->channel[READ]); | 1557 | channel_free(priv->channel[READ]); |
1593 | ctcm_free_netdevice(dev); | 1558 | goto out_dev; |
1594 | goto out; | ||
1595 | } | 1559 | } |
1596 | priv->channel[direction]->netdev = dev; | 1560 | priv->channel[direction]->netdev = dev; |
1597 | priv->channel[direction]->protocol = priv->protocol; | 1561 | priv->channel[direction]->protocol = priv->protocol; |
@@ -1600,26 +1564,24 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) | |||
1600 | /* sysfs magic */ | 1564 | /* sysfs magic */ |
1601 | SET_NETDEV_DEV(dev, &cgdev->dev); | 1565 | SET_NETDEV_DEV(dev, &cgdev->dev); |
1602 | 1566 | ||
1603 | if (ctcm_netdev_register(dev) != 0) { | 1567 | if (register_netdev(dev)) |
1604 | ctcm_free_netdevice(dev); | 1568 | goto out_dev; |
1605 | goto out; | ||
1606 | } | ||
1607 | 1569 | ||
1608 | if (ctcm_add_attributes(&cgdev->dev)) { | 1570 | if (ctcm_add_attributes(&cgdev->dev)) { |
1609 | ctcm_netdev_unregister(dev); | 1571 | unregister_netdev(dev); |
1610 | /* dev->priv = NULL; why that ???? */ | 1572 | goto out_dev; |
1611 | ctcm_free_netdevice(dev); | ||
1612 | goto out; | ||
1613 | } | 1573 | } |
1614 | 1574 | ||
1615 | strlcpy(priv->fsm->name, dev->name, sizeof(priv->fsm->name)); | 1575 | strlcpy(priv->fsm->name, dev->name, sizeof(priv->fsm->name)); |
1616 | 1576 | ||
1617 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | 1577 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, |
1618 | "setup(%s) ok : r/w = %s / %s, proto : %d", | 1578 | "setup(%s) OK : r/w = %s/%s, protocol : %d", dev->name, |
1619 | dev->name, priv->channel[READ]->id, | 1579 | priv->channel[READ]->id, |
1620 | priv->channel[WRITE]->id, priv->protocol); | 1580 | priv->channel[WRITE]->id, priv->protocol); |
1621 | 1581 | ||
1622 | return 0; | 1582 | return 0; |
1583 | out_dev: | ||
1584 | ctcm_free_netdevice(dev); | ||
1623 | out: | 1585 | out: |
1624 | ccw_device_set_offline(cgdev->cdev[1]); | 1586 | ccw_device_set_offline(cgdev->cdev[1]); |
1625 | ccw_device_set_offline(cgdev->cdev[0]); | 1587 | ccw_device_set_offline(cgdev->cdev[0]); |
@@ -1658,8 +1620,7 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) | |||
1658 | channel_free(priv->channel[WRITE]); | 1620 | channel_free(priv->channel[WRITE]); |
1659 | 1621 | ||
1660 | if (dev) { | 1622 | if (dev) { |
1661 | ctcm_netdev_unregister(dev); | 1623 | unregister_netdev(dev); |
1662 | /* dev->priv = NULL; why that ??? */ | ||
1663 | ctcm_free_netdevice(dev); | 1624 | ctcm_free_netdevice(dev); |
1664 | } | 1625 | } |
1665 | 1626 | ||
@@ -1682,13 +1643,16 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) | |||
1682 | 1643 | ||
1683 | static void ctcm_remove_device(struct ccwgroup_device *cgdev) | 1644 | static void ctcm_remove_device(struct ccwgroup_device *cgdev) |
1684 | { | 1645 | { |
1685 | struct ctcm_priv *priv; | 1646 | struct ctcm_priv *priv = dev_get_drvdata(&cgdev->dev); |
1686 | 1647 | ||
1687 | CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, __FUNCTION__); | 1648 | BUG_ON(priv == NULL); |
1649 | |||
1650 | CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, | ||
1651 | "removing device %s, r/w = %s/%s, proto : %d", | ||
1652 | priv->channel[READ]->netdev->name, | ||
1653 | priv->channel[READ]->id, priv->channel[WRITE]->id, | ||
1654 | priv->protocol); | ||
1688 | 1655 | ||
1689 | priv = dev_get_drvdata(&cgdev->dev); | ||
1690 | if (!priv) | ||
1691 | return; | ||
1692 | if (cgdev->state == CCWGROUP_ONLINE) | 1656 | if (cgdev->state == CCWGROUP_ONLINE) |
1693 | ctcm_shutdown_device(cgdev); | 1657 | ctcm_shutdown_device(cgdev); |
1694 | ctcm_remove_files(&cgdev->dev); | 1658 | ctcm_remove_files(&cgdev->dev); |
@@ -1748,8 +1712,6 @@ static int __init ctcm_init(void) | |||
1748 | 1712 | ||
1749 | ret = ctcm_register_dbf_views(); | 1713 | ret = ctcm_register_dbf_views(); |
1750 | if (ret) { | 1714 | if (ret) { |
1751 | ctcm_pr_crit("ctcm_init failed with ctcm_register_dbf_views " | ||
1752 | "rc = %d\n", ret); | ||
1753 | return ret; | 1715 | return ret; |
1754 | } | 1716 | } |
1755 | ret = register_cu3088_discipline(&ctcm_group_driver); | 1717 | ret = register_cu3088_discipline(&ctcm_group_driver); |
diff --git a/drivers/s390/net/ctcm_main.h b/drivers/s390/net/ctcm_main.h index 95b0c0b6ebc6..a72e0feeb27f 100644 --- a/drivers/s390/net/ctcm_main.h +++ b/drivers/s390/net/ctcm_main.h | |||
@@ -22,9 +22,9 @@ | |||
22 | 22 | ||
23 | #define CTC_DRIVER_NAME "ctcm" | 23 | #define CTC_DRIVER_NAME "ctcm" |
24 | #define CTC_DEVICE_NAME "ctc" | 24 | #define CTC_DEVICE_NAME "ctc" |
25 | #define CTC_DEVICE_GENE "ctc%d" | ||
26 | #define MPC_DEVICE_NAME "mpc" | 25 | #define MPC_DEVICE_NAME "mpc" |
27 | #define MPC_DEVICE_GENE "mpc%d" | 26 | #define CTC_DEVICE_GENE CTC_DEVICE_NAME "%d" |
27 | #define MPC_DEVICE_GENE MPC_DEVICE_NAME "%d" | ||
28 | 28 | ||
29 | #define CHANNEL_FLAGS_READ 0 | 29 | #define CHANNEL_FLAGS_READ 0 |
30 | #define CHANNEL_FLAGS_WRITE 1 | 30 | #define CHANNEL_FLAGS_WRITE 1 |
@@ -48,6 +48,30 @@ | |||
48 | #define ctcm_pr_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) | 48 | #define ctcm_pr_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) |
49 | #define ctcm_pr_crit(fmt, arg...) printk(KERN_CRIT fmt, ##arg) | 49 | #define ctcm_pr_crit(fmt, arg...) printk(KERN_CRIT fmt, ##arg) |
50 | 50 | ||
51 | #define CTCM_PR_DEBUG(fmt, arg...) \ | ||
52 | do { \ | ||
53 | if (do_debug) \ | ||
54 | printk(KERN_DEBUG fmt, ##arg); \ | ||
55 | } while (0) | ||
56 | |||
57 | #define CTCM_PR_DBGDATA(fmt, arg...) \ | ||
58 | do { \ | ||
59 | if (do_debug_data) \ | ||
60 | printk(KERN_DEBUG fmt, ##arg); \ | ||
61 | } while (0) | ||
62 | |||
63 | #define CTCM_D3_DUMP(buf, len) \ | ||
64 | do { \ | ||
65 | if (do_debug_data) \ | ||
66 | ctcmpc_dumpit(buf, len); \ | ||
67 | } while (0) | ||
68 | |||
69 | #define CTCM_CCW_DUMP(buf, len) \ | ||
70 | do { \ | ||
71 | if (do_debug_ccw) \ | ||
72 | ctcmpc_dumpit(buf, len); \ | ||
73 | } while (0) | ||
74 | |||
51 | /* | 75 | /* |
52 | * CCW commands, used in this driver. | 76 | * CCW commands, used in this driver. |
53 | */ | 77 | */ |
@@ -161,8 +185,9 @@ struct channel { | |||
161 | fsm_instance *fsm; /* finite state machine of this channel */ | 185 | fsm_instance *fsm; /* finite state machine of this channel */ |
162 | struct net_device *netdev; /* corresponding net_device */ | 186 | struct net_device *netdev; /* corresponding net_device */ |
163 | struct ctcm_profile prof; | 187 | struct ctcm_profile prof; |
164 | unsigned char *trans_skb_data; | 188 | __u8 *trans_skb_data; |
165 | __u16 logflags; | 189 | __u16 logflags; |
190 | __u8 sense_rc; /* last unit check sense code report control */ | ||
166 | }; | 191 | }; |
167 | 192 | ||
168 | struct ctcm_priv { | 193 | struct ctcm_priv { |
diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index 044addee64a2..49ae1cd25caa 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c | |||
@@ -149,7 +149,7 @@ void ctcmpc_dumpit(char *buf, int len) | |||
149 | for (ct = 0; ct < len; ct++, ptr++, rptr++) { | 149 | for (ct = 0; ct < len; ct++, ptr++, rptr++) { |
150 | if (sw == 0) { | 150 | if (sw == 0) { |
151 | #if (UTS_MACHINE == s390x) | 151 | #if (UTS_MACHINE == s390x) |
152 | sprintf(addr, "%16.16lx", (unsigned long)rptr); | 152 | sprintf(addr, "%16.16lx", (__u64)rptr); |
153 | #else | 153 | #else |
154 | sprintf(addr, "%8.8X", (__u32)rptr); | 154 | sprintf(addr, "%8.8X", (__u32)rptr); |
155 | #endif | 155 | #endif |
@@ -164,7 +164,7 @@ void ctcmpc_dumpit(char *buf, int len) | |||
164 | strcat(bhex, " "); | 164 | strcat(bhex, " "); |
165 | 165 | ||
166 | #if (UTS_MACHINE == s390x) | 166 | #if (UTS_MACHINE == s390x) |
167 | sprintf(tbuf, "%2.2lX", (unsigned long)*ptr); | 167 | sprintf(tbuf, "%2.2lX", (__u64)*ptr); |
168 | #else | 168 | #else |
169 | sprintf(tbuf, "%2.2X", (__u32)*ptr); | 169 | sprintf(tbuf, "%2.2X", (__u32)*ptr); |
170 | #endif | 170 | #endif |
@@ -179,24 +179,24 @@ void ctcmpc_dumpit(char *buf, int len) | |||
179 | basc[sw+1] = '\0'; | 179 | basc[sw+1] = '\0'; |
180 | sw++; | 180 | sw++; |
181 | rm--; | 181 | rm--; |
182 | if (sw == 16) { | 182 | if (sw != 16) |
183 | if ((strcmp(duphex, bhex)) != 0) { | 183 | continue; |
184 | if (dup != 0) { | 184 | if ((strcmp(duphex, bhex)) != 0) { |
185 | sprintf(tdup, "Duplicate as above " | 185 | if (dup != 0) { |
186 | "to %s", addr); | 186 | sprintf(tdup, |
187 | printk(KERN_INFO " " | 187 | "Duplicate as above to %s", addr); |
188 | " --- %s ---\n", tdup); | 188 | ctcm_pr_debug(" --- %s ---\n", |
189 | } | 189 | tdup); |
190 | printk(KERN_INFO " %s (+%s) : %s [%s]\n", | 190 | } |
191 | ctcm_pr_debug(" %s (+%s) : %s [%s]\n", | ||
191 | addr, boff, bhex, basc); | 192 | addr, boff, bhex, basc); |
192 | dup = 0; | 193 | dup = 0; |
193 | strcpy(duphex, bhex); | 194 | strcpy(duphex, bhex); |
194 | } else | 195 | } else |
195 | dup++; | 196 | dup++; |
196 | 197 | ||
197 | sw = 0; | 198 | sw = 0; |
198 | rm = 16; | 199 | rm = 16; |
199 | } | ||
200 | } /* endfor */ | 200 | } /* endfor */ |
201 | 201 | ||
202 | if (sw != 0) { | 202 | if (sw != 0) { |
@@ -210,19 +210,17 @@ void ctcmpc_dumpit(char *buf, int len) | |||
210 | } | 210 | } |
211 | if (dup != 0) { | 211 | if (dup != 0) { |
212 | sprintf(tdup, "Duplicate as above to %s", addr); | 212 | sprintf(tdup, "Duplicate as above to %s", addr); |
213 | printk(KERN_INFO " " | 213 | ctcm_pr_debug(" --- %s ---\n", tdup); |
214 | " --- %s ---\n", tdup); | ||
215 | } | 214 | } |
216 | printk(KERN_INFO " %s (+%s) : %s [%s]\n", | 215 | ctcm_pr_debug(" %s (+%s) : %s [%s]\n", |
217 | addr, boff, bhex, basc); | 216 | addr, boff, bhex, basc); |
218 | } else { | 217 | } else { |
219 | if (dup >= 1) { | 218 | if (dup >= 1) { |
220 | sprintf(tdup, "Duplicate as above to %s", addr); | 219 | sprintf(tdup, "Duplicate as above to %s", addr); |
221 | printk(KERN_INFO " " | 220 | ctcm_pr_debug(" --- %s ---\n", tdup); |
222 | " --- %s ---\n", tdup); | ||
223 | } | 221 | } |
224 | if (dup != 0) { | 222 | if (dup != 0) { |
225 | printk(KERN_INFO " %s (+%s) : %s [%s]\n", | 223 | ctcm_pr_debug(" %s (+%s) : %s [%s]\n", |
226 | addr, boff, bhex, basc); | 224 | addr, boff, bhex, basc); |
227 | } | 225 | } |
228 | } | 226 | } |
@@ -241,7 +239,7 @@ void ctcmpc_dumpit(char *buf, int len) | |||
241 | */ | 239 | */ |
242 | void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | 240 | void ctcmpc_dump_skb(struct sk_buff *skb, int offset) |
243 | { | 241 | { |
244 | unsigned char *p = skb->data; | 242 | __u8 *p = skb->data; |
245 | struct th_header *header; | 243 | struct th_header *header; |
246 | struct pdu *pheader; | 244 | struct pdu *pheader; |
247 | int bl = skb->len; | 245 | int bl = skb->len; |
@@ -253,8 +251,8 @@ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | |||
253 | p += offset; | 251 | p += offset; |
254 | header = (struct th_header *)p; | 252 | header = (struct th_header *)p; |
255 | 253 | ||
256 | printk(KERN_INFO "dump:\n"); | 254 | ctcm_pr_debug("dump:\n"); |
257 | printk(KERN_INFO "skb len=%d \n", skb->len); | 255 | ctcm_pr_debug("skb len=%d \n", skb->len); |
258 | if (skb->len > 2) { | 256 | if (skb->len > 2) { |
259 | switch (header->th_ch_flag) { | 257 | switch (header->th_ch_flag) { |
260 | case TH_HAS_PDU: | 258 | case TH_HAS_PDU: |
@@ -273,32 +271,64 @@ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) | |||
273 | } | 271 | } |
274 | 272 | ||
275 | pheader = (struct pdu *)p; | 273 | pheader = (struct pdu *)p; |
276 | printk(KERN_INFO "pdu->offset: %d hex: %04x\n", | 274 | ctcm_pr_debug("pdu->offset: %d hex: %04x\n", |
277 | pheader->pdu_offset, pheader->pdu_offset); | 275 | pheader->pdu_offset, pheader->pdu_offset); |
278 | printk(KERN_INFO "pdu->flag : %02x\n", pheader->pdu_flag); | 276 | ctcm_pr_debug("pdu->flag : %02x\n", pheader->pdu_flag); |
279 | printk(KERN_INFO "pdu->proto : %02x\n", pheader->pdu_proto); | 277 | ctcm_pr_debug("pdu->proto : %02x\n", pheader->pdu_proto); |
280 | printk(KERN_INFO "pdu->seq : %02x\n", pheader->pdu_seq); | 278 | ctcm_pr_debug("pdu->seq : %02x\n", pheader->pdu_seq); |
281 | goto dumpdata; | 279 | goto dumpdata; |
282 | 280 | ||
283 | dumpth: | 281 | dumpth: |
284 | printk(KERN_INFO "th->seg : %02x\n", header->th_seg); | 282 | ctcm_pr_debug("th->seg : %02x\n", header->th_seg); |
285 | printk(KERN_INFO "th->ch : %02x\n", header->th_ch_flag); | 283 | ctcm_pr_debug("th->ch : %02x\n", header->th_ch_flag); |
286 | printk(KERN_INFO "th->blk_flag: %02x\n", header->th_blk_flag); | 284 | ctcm_pr_debug("th->blk_flag: %02x\n", header->th_blk_flag); |
287 | printk(KERN_INFO "th->type : %s\n", | 285 | ctcm_pr_debug("th->type : %s\n", |
288 | (header->th_is_xid) ? "DATA" : "XID"); | 286 | (header->th_is_xid) ? "DATA" : "XID"); |
289 | printk(KERN_INFO "th->seqnum : %04x\n", header->th_seq_num); | 287 | ctcm_pr_debug("th->seqnum : %04x\n", header->th_seq_num); |
290 | 288 | ||
291 | } | 289 | } |
292 | dumpdata: | 290 | dumpdata: |
293 | if (bl > 32) | 291 | if (bl > 32) |
294 | bl = 32; | 292 | bl = 32; |
295 | printk(KERN_INFO "data: "); | 293 | ctcm_pr_debug("data: "); |
296 | for (i = 0; i < bl; i++) | 294 | for (i = 0; i < bl; i++) |
297 | printk(KERN_INFO "%02x%s", *p++, (i % 16) ? " " : "\n<7>"); | 295 | ctcm_pr_debug("%02x%s", *p++, (i % 16) ? " " : "\n"); |
298 | printk(KERN_INFO "\n"); | 296 | ctcm_pr_debug("\n"); |
299 | } | 297 | } |
300 | #endif | 298 | #endif |
301 | 299 | ||
300 | static struct net_device *ctcmpc_get_dev(int port_num) | ||
301 | { | ||
302 | char device[20]; | ||
303 | struct net_device *dev; | ||
304 | struct ctcm_priv *priv; | ||
305 | |||
306 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
307 | |||
308 | dev = __dev_get_by_name(&init_net, device); | ||
309 | |||
310 | if (dev == NULL) { | ||
311 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
312 | "%s: Device not found by name: %s", | ||
313 | CTCM_FUNTAIL, device); | ||
314 | return NULL; | ||
315 | } | ||
316 | priv = dev->priv; | ||
317 | if (priv == NULL) { | ||
318 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
319 | "%s(%s): dev->priv is NULL", | ||
320 | CTCM_FUNTAIL, device); | ||
321 | return NULL; | ||
322 | } | ||
323 | if (priv->mpcg == NULL) { | ||
324 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
325 | "%s(%s): priv->mpcg is NULL", | ||
326 | CTCM_FUNTAIL, device); | ||
327 | return NULL; | ||
328 | } | ||
329 | return dev; | ||
330 | } | ||
331 | |||
302 | /* | 332 | /* |
303 | * ctc_mpc_alloc_channel | 333 | * ctc_mpc_alloc_channel |
304 | * (exported interface) | 334 | * (exported interface) |
@@ -308,34 +338,23 @@ dumpdata: | |||
308 | */ | 338 | */ |
309 | int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) | 339 | int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) |
310 | { | 340 | { |
311 | char device[20]; | ||
312 | struct net_device *dev; | 341 | struct net_device *dev; |
313 | struct mpc_group *grp; | 342 | struct mpc_group *grp; |
314 | struct ctcm_priv *priv; | 343 | struct ctcm_priv *priv; |
315 | 344 | ||
316 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 345 | dev = ctcmpc_get_dev(port_num); |
317 | 346 | if (dev == NULL) | |
318 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
319 | dev = __dev_get_by_name(&init_net, device); | ||
320 | |||
321 | if (dev == NULL) { | ||
322 | printk(KERN_INFO "ctc_mpc_alloc_channel %s dev=NULL\n", device); | ||
323 | return 1; | 347 | return 1; |
324 | } | ||
325 | |||
326 | priv = dev->priv; | 348 | priv = dev->priv; |
327 | grp = priv->mpcg; | 349 | grp = priv->mpcg; |
328 | if (!grp) | ||
329 | return 1; | ||
330 | 350 | ||
331 | grp->allochanfunc = callback; | 351 | grp->allochanfunc = callback; |
332 | grp->port_num = port_num; | 352 | grp->port_num = port_num; |
333 | grp->port_persist = 1; | 353 | grp->port_persist = 1; |
334 | 354 | ||
335 | ctcm_pr_debug("ctcmpc: %s called for device %s state=%s\n", | 355 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, |
336 | __FUNCTION__, | 356 | "%s(%s): state=%s", |
337 | dev->name, | 357 | CTCM_FUNTAIL, dev->name, fsm_getstate_str(grp->fsm)); |
338 | fsm_getstate_str(grp->fsm)); | ||
339 | 358 | ||
340 | switch (fsm_getstate(grp->fsm)) { | 359 | switch (fsm_getstate(grp->fsm)) { |
341 | case MPCG_STATE_INOP: | 360 | case MPCG_STATE_INOP: |
@@ -377,12 +396,8 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) | |||
377 | grp->allocchan_callback_retries = 0; | 396 | grp->allocchan_callback_retries = 0; |
378 | } | 397 | } |
379 | break; | 398 | break; |
380 | default: | ||
381 | return 0; | ||
382 | |||
383 | } | 399 | } |
384 | 400 | ||
385 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
386 | return 0; | 401 | return 0; |
387 | } | 402 | } |
388 | EXPORT_SYMBOL(ctc_mpc_alloc_channel); | 403 | EXPORT_SYMBOL(ctc_mpc_alloc_channel); |
@@ -394,31 +409,22 @@ EXPORT_SYMBOL(ctc_mpc_alloc_channel); | |||
394 | void ctc_mpc_establish_connectivity(int port_num, | 409 | void ctc_mpc_establish_connectivity(int port_num, |
395 | void (*callback)(int, int, int)) | 410 | void (*callback)(int, int, int)) |
396 | { | 411 | { |
397 | char device[20]; | ||
398 | struct net_device *dev; | 412 | struct net_device *dev; |
399 | struct mpc_group *grp; | 413 | struct mpc_group *grp; |
400 | struct ctcm_priv *priv; | 414 | struct ctcm_priv *priv; |
401 | struct channel *rch, *wch; | 415 | struct channel *rch, *wch; |
402 | 416 | ||
403 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 417 | dev = ctcmpc_get_dev(port_num); |
404 | 418 | if (dev == NULL) | |
405 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
406 | dev = __dev_get_by_name(&init_net, device); | ||
407 | |||
408 | if (dev == NULL) { | ||
409 | printk(KERN_INFO "ctc_mpc_establish_connectivity " | ||
410 | "%s dev=NULL\n", device); | ||
411 | return; | 419 | return; |
412 | } | ||
413 | priv = dev->priv; | 420 | priv = dev->priv; |
421 | grp = priv->mpcg; | ||
414 | rch = priv->channel[READ]; | 422 | rch = priv->channel[READ]; |
415 | wch = priv->channel[WRITE]; | 423 | wch = priv->channel[WRITE]; |
416 | 424 | ||
417 | grp = priv->mpcg; | 425 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, |
418 | 426 | "%s(%s): state=%s", | |
419 | ctcm_pr_debug("ctcmpc: %s() called for device %s state=%s\n", | 427 | CTCM_FUNTAIL, dev->name, fsm_getstate_str(grp->fsm)); |
420 | __FUNCTION__, dev->name, | ||
421 | fsm_getstate_str(grp->fsm)); | ||
422 | 428 | ||
423 | grp->estconnfunc = callback; | 429 | grp->estconnfunc = callback; |
424 | grp->port_num = port_num; | 430 | grp->port_num = port_num; |
@@ -446,8 +452,10 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
446 | case MPCG_STATE_RESET: | 452 | case MPCG_STATE_RESET: |
447 | /* MPC Group is not ready to start XID - min num of */ | 453 | /* MPC Group is not ready to start XID - min num of */ |
448 | /* 1 read and 1 write channel have not been acquired*/ | 454 | /* 1 read and 1 write channel have not been acquired*/ |
449 | printk(KERN_WARNING "ctcmpc: %s() REJECTED ACTIVE XID Req" | 455 | |
450 | "uest - Channel Pair is not Active\n", __FUNCTION__); | 456 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
457 | "%s(%s): REJECTED - inactive channels", | ||
458 | CTCM_FUNTAIL, dev->name); | ||
451 | if (grp->estconnfunc) { | 459 | if (grp->estconnfunc) { |
452 | grp->estconnfunc(grp->port_num, -1, 0); | 460 | grp->estconnfunc(grp->port_num, -1, 0); |
453 | grp->estconnfunc = NULL; | 461 | grp->estconnfunc = NULL; |
@@ -457,11 +465,12 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
457 | /* alloc channel was called but no XID exchange */ | 465 | /* alloc channel was called but no XID exchange */ |
458 | /* has occurred. initiate xside XID exchange */ | 466 | /* has occurred. initiate xside XID exchange */ |
459 | /* make sure yside XID0 processing has not started */ | 467 | /* make sure yside XID0 processing has not started */ |
468 | |||
460 | if ((fsm_getstate(rch->fsm) > CH_XID0_PENDING) || | 469 | if ((fsm_getstate(rch->fsm) > CH_XID0_PENDING) || |
461 | (fsm_getstate(wch->fsm) > CH_XID0_PENDING)) { | 470 | (fsm_getstate(wch->fsm) > CH_XID0_PENDING)) { |
462 | printk(KERN_WARNING "mpc: %s() ABORT ACTIVE XID" | 471 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
463 | " Request- PASSIVE XID in process\n" | 472 | "%s(%s): ABORT - PASSIVE XID", |
464 | , __FUNCTION__); | 473 | CTCM_FUNTAIL, dev->name); |
465 | break; | 474 | break; |
466 | } | 475 | } |
467 | grp->send_qllc_disc = 1; | 476 | grp->send_qllc_disc = 1; |
@@ -476,9 +485,9 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
476 | (fsm_getstate(rch->fsm) == CH_XID0_PENDING)) | 485 | (fsm_getstate(rch->fsm) == CH_XID0_PENDING)) |
477 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, rch); | 486 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, rch); |
478 | else { | 487 | else { |
479 | printk(KERN_WARNING "mpc: %s() Unable to start" | 488 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
480 | " ACTIVE XID0 on read channel\n", | 489 | "%s(%s): RX-%s not ready for ACTIVE XID0", |
481 | __FUNCTION__); | 490 | CTCM_FUNTAIL, dev->name, rch->id); |
482 | if (grp->estconnfunc) { | 491 | if (grp->estconnfunc) { |
483 | grp->estconnfunc(grp->port_num, -1, 0); | 492 | grp->estconnfunc(grp->port_num, -1, 0); |
484 | grp->estconnfunc = NULL; | 493 | grp->estconnfunc = NULL; |
@@ -490,9 +499,9 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
490 | (fsm_getstate(wch->fsm) == CH_XID0_PENDING)) | 499 | (fsm_getstate(wch->fsm) == CH_XID0_PENDING)) |
491 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, wch); | 500 | fsm_event(grp->fsm, MPCG_EVENT_XID0DO, wch); |
492 | else { | 501 | else { |
493 | printk(KERN_WARNING "mpc: %s() Unable to start" | 502 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
494 | " ACTIVE XID0 on write channel\n", | 503 | "%s(%s): WX-%s not ready for ACTIVE XID0", |
495 | __FUNCTION__); | 504 | CTCM_FUNTAIL, dev->name, wch->id); |
496 | if (grp->estconnfunc) { | 505 | if (grp->estconnfunc) { |
497 | grp->estconnfunc(grp->port_num, -1, 0); | 506 | grp->estconnfunc(grp->port_num, -1, 0); |
498 | grp->estconnfunc = NULL; | 507 | grp->estconnfunc = NULL; |
@@ -508,7 +517,7 @@ void ctc_mpc_establish_connectivity(int port_num, | |||
508 | } | 517 | } |
509 | 518 | ||
510 | done: | 519 | done: |
511 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | 520 | CTCM_PR_DEBUG("Exit %s()\n", __func__); |
512 | return; | 521 | return; |
513 | } | 522 | } |
514 | EXPORT_SYMBOL(ctc_mpc_establish_connectivity); | 523 | EXPORT_SYMBOL(ctc_mpc_establish_connectivity); |
@@ -520,40 +529,22 @@ EXPORT_SYMBOL(ctc_mpc_establish_connectivity); | |||
520 | void ctc_mpc_dealloc_ch(int port_num) | 529 | void ctc_mpc_dealloc_ch(int port_num) |
521 | { | 530 | { |
522 | struct net_device *dev; | 531 | struct net_device *dev; |
523 | char device[20]; | ||
524 | struct ctcm_priv *priv; | 532 | struct ctcm_priv *priv; |
525 | struct mpc_group *grp; | 533 | struct mpc_group *grp; |
526 | 534 | ||
527 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 535 | dev = ctcmpc_get_dev(port_num); |
528 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | 536 | if (dev == NULL) |
529 | dev = __dev_get_by_name(&init_net, device); | 537 | return; |
530 | 538 | priv = dev->priv; | |
531 | if (dev == NULL) { | 539 | grp = priv->mpcg; |
532 | printk(KERN_INFO "%s() %s dev=NULL\n", __FUNCTION__, device); | ||
533 | goto done; | ||
534 | } | ||
535 | 540 | ||
536 | ctcm_pr_debug("ctcmpc:%s %s() called for device %s refcount=%d\n", | 541 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_DEBUG, |
537 | dev->name, __FUNCTION__, | 542 | "%s: %s: refcount = %d\n", |
538 | dev->name, atomic_read(&dev->refcnt)); | 543 | CTCM_FUNTAIL, dev->name, atomic_read(&dev->refcnt)); |
539 | 544 | ||
540 | priv = dev->priv; | ||
541 | if (priv == NULL) { | ||
542 | printk(KERN_INFO "%s() %s priv=NULL\n", | ||
543 | __FUNCTION__, device); | ||
544 | goto done; | ||
545 | } | ||
546 | fsm_deltimer(&priv->restart_timer); | 545 | fsm_deltimer(&priv->restart_timer); |
547 | |||
548 | grp = priv->mpcg; | ||
549 | if (grp == NULL) { | ||
550 | printk(KERN_INFO "%s() %s dev=NULL\n", __FUNCTION__, device); | ||
551 | goto done; | ||
552 | } | ||
553 | grp->channels_terminating = 0; | 546 | grp->channels_terminating = 0; |
554 | |||
555 | fsm_deltimer(&grp->timer); | 547 | fsm_deltimer(&grp->timer); |
556 | |||
557 | grp->allochanfunc = NULL; | 548 | grp->allochanfunc = NULL; |
558 | grp->estconnfunc = NULL; | 549 | grp->estconnfunc = NULL; |
559 | grp->port_persist = 0; | 550 | grp->port_persist = 0; |
@@ -561,8 +552,6 @@ void ctc_mpc_dealloc_ch(int port_num) | |||
561 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 552 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
562 | 553 | ||
563 | ctcm_close(dev); | 554 | ctcm_close(dev); |
564 | done: | ||
565 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
566 | return; | 555 | return; |
567 | } | 556 | } |
568 | EXPORT_SYMBOL(ctc_mpc_dealloc_ch); | 557 | EXPORT_SYMBOL(ctc_mpc_dealloc_ch); |
@@ -573,32 +562,22 @@ EXPORT_SYMBOL(ctc_mpc_dealloc_ch); | |||
573 | */ | 562 | */ |
574 | void ctc_mpc_flow_control(int port_num, int flowc) | 563 | void ctc_mpc_flow_control(int port_num, int flowc) |
575 | { | 564 | { |
576 | char device[20]; | ||
577 | struct ctcm_priv *priv; | 565 | struct ctcm_priv *priv; |
578 | struct mpc_group *grp; | 566 | struct mpc_group *grp; |
579 | struct net_device *dev; | 567 | struct net_device *dev; |
580 | struct channel *rch; | 568 | struct channel *rch; |
581 | int mpcg_state; | 569 | int mpcg_state; |
582 | 570 | ||
583 | ctcm_pr_debug("ctcmpc enter: %s() %i\n", __FUNCTION__, flowc); | 571 | dev = ctcmpc_get_dev(port_num); |
584 | 572 | if (dev == NULL) | |
585 | sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); | ||
586 | dev = __dev_get_by_name(&init_net, device); | ||
587 | |||
588 | if (dev == NULL) { | ||
589 | printk(KERN_INFO "ctc_mpc_flow_control %s dev=NULL\n", device); | ||
590 | return; | 573 | return; |
591 | } | 574 | priv = dev->priv; |
575 | grp = priv->mpcg; | ||
592 | 576 | ||
593 | ctcm_pr_debug("ctcmpc: %s %s called \n", dev->name, __FUNCTION__); | 577 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
578 | "%s: %s: flowc = %d", | ||
579 | CTCM_FUNTAIL, dev->name, flowc); | ||
594 | 580 | ||
595 | priv = dev->priv; | ||
596 | if (priv == NULL) { | ||
597 | printk(KERN_INFO "ctcmpc:%s() %s priv=NULL\n", | ||
598 | __FUNCTION__, device); | ||
599 | return; | ||
600 | } | ||
601 | grp = priv->mpcg; | ||
602 | rch = priv->channel[READ]; | 581 | rch = priv->channel[READ]; |
603 | 582 | ||
604 | mpcg_state = fsm_getstate(grp->fsm); | 583 | mpcg_state = fsm_getstate(grp->fsm); |
@@ -629,7 +608,6 @@ void ctc_mpc_flow_control(int port_num, int flowc) | |||
629 | break; | 608 | break; |
630 | } | 609 | } |
631 | 610 | ||
632 | ctcm_pr_debug("ctcmpc exit: %s() %i\n", __FUNCTION__, flowc); | ||
633 | } | 611 | } |
634 | EXPORT_SYMBOL(ctc_mpc_flow_control); | 612 | EXPORT_SYMBOL(ctc_mpc_flow_control); |
635 | 613 | ||
@@ -646,12 +624,8 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) | |||
646 | struct mpc_group *grp = priv->mpcg; | 624 | struct mpc_group *grp = priv->mpcg; |
647 | struct channel *ch = priv->channel[WRITE]; | 625 | struct channel *ch = priv->channel[WRITE]; |
648 | 626 | ||
649 | if (do_debug) | 627 | CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, ch, ch->id); |
650 | ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", | 628 | CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); |
651 | __FUNCTION__, ch, ch->id); | ||
652 | |||
653 | if (do_debug_data) | ||
654 | ctcmpc_dumpit((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); | ||
655 | 629 | ||
656 | grp->sweep_rsp_pend_num--; | 630 | grp->sweep_rsp_pend_num--; |
657 | 631 | ||
@@ -684,14 +658,13 @@ static void ctcmpc_send_sweep_resp(struct channel *rch) | |||
684 | struct sk_buff *sweep_skb; | 658 | struct sk_buff *sweep_skb; |
685 | struct channel *ch = priv->channel[WRITE]; | 659 | struct channel *ch = priv->channel[WRITE]; |
686 | 660 | ||
687 | if (do_debug) | 661 | CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, rch, rch->id); |
688 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | ||
689 | __FUNCTION__, rch, rch->id); | ||
690 | 662 | ||
691 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, | 663 | sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); |
692 | GFP_ATOMIC|GFP_DMA); | ||
693 | if (sweep_skb == NULL) { | 664 | if (sweep_skb == NULL) { |
694 | printk(KERN_INFO "Couldn't alloc sweep_skb\n"); | 665 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
666 | "%s(%s): sweep_skb allocation ERROR\n", | ||
667 | CTCM_FUNTAIL, rch->id); | ||
695 | rc = -ENOMEM; | 668 | rc = -ENOMEM; |
696 | goto done; | 669 | goto done; |
697 | } | 670 | } |
@@ -746,7 +719,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) | |||
746 | 719 | ||
747 | if (do_debug) | 720 | if (do_debug) |
748 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | 721 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
749 | " %s(): ch=0x%p id=%s\n", __FUNCTION__, ch, ch->id); | 722 | " %s(): ch=0x%p id=%s\n", __func__, ch, ch->id); |
750 | 723 | ||
751 | if (grp->in_sweep == 0) { | 724 | if (grp->in_sweep == 0) { |
752 | grp->in_sweep = 1; | 725 | grp->in_sweep = 1; |
@@ -755,8 +728,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) | |||
755 | grp->sweep_rsp_pend_num = grp->active_channels[READ]; | 728 | grp->sweep_rsp_pend_num = grp->active_channels[READ]; |
756 | } | 729 | } |
757 | 730 | ||
758 | if (do_debug_data) | 731 | CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); |
759 | ctcmpc_dumpit((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); | ||
760 | 732 | ||
761 | grp->sweep_req_pend_num--; | 733 | grp->sweep_req_pend_num--; |
762 | ctcmpc_send_sweep_resp(ch); | 734 | ctcmpc_send_sweep_resp(ch); |
@@ -875,25 +847,13 @@ static int mpcg_fsm_len = ARRAY_SIZE(mpcg_fsm); | |||
875 | static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | 847 | static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) |
876 | { | 848 | { |
877 | struct net_device *dev = arg; | 849 | struct net_device *dev = arg; |
878 | struct ctcm_priv *priv = NULL; | 850 | struct ctcm_priv *priv = dev->priv; |
879 | struct mpc_group *grp = NULL; | 851 | struct mpc_group *grp = priv->mpcg; |
880 | |||
881 | if (dev == NULL) { | ||
882 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | ||
883 | return; | ||
884 | } | ||
885 | |||
886 | ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); | ||
887 | |||
888 | priv = dev->priv; | ||
889 | if (priv == NULL) { | ||
890 | printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); | ||
891 | return; | ||
892 | } | ||
893 | 852 | ||
894 | grp = priv->mpcg; | ||
895 | if (grp == NULL) { | 853 | if (grp == NULL) { |
896 | printk(KERN_INFO "%s() grp=NULL\n", __FUNCTION__); | 854 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
855 | "%s(%s): No MPC group", | ||
856 | CTCM_FUNTAIL, dev->name); | ||
897 | return; | 857 | return; |
898 | } | 858 | } |
899 | 859 | ||
@@ -907,7 +867,12 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | |||
907 | grp->estconnfunc = NULL; | 867 | grp->estconnfunc = NULL; |
908 | } else if (grp->allochanfunc) | 868 | } else if (grp->allochanfunc) |
909 | grp->send_qllc_disc = 1; | 869 | grp->send_qllc_disc = 1; |
910 | goto done; | 870 | |
871 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
872 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
873 | "%s(%s): fails", | ||
874 | CTCM_FUNTAIL, dev->name); | ||
875 | return; | ||
911 | } | 876 | } |
912 | 877 | ||
913 | grp->port_persist = 1; | 878 | grp->port_persist = 1; |
@@ -916,14 +881,7 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) | |||
916 | 881 | ||
917 | tasklet_hi_schedule(&grp->mpc_tasklet2); | 882 | tasklet_hi_schedule(&grp->mpc_tasklet2); |
918 | 883 | ||
919 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
920 | return; | 884 | return; |
921 | |||
922 | done: | ||
923 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
924 | |||
925 | |||
926 | ctcm_pr_info("ctcmpc: %s()failure occurred\n", __FUNCTION__); | ||
927 | } | 885 | } |
928 | 886 | ||
929 | /* | 887 | /* |
@@ -933,42 +891,28 @@ done: | |||
933 | void mpc_group_ready(unsigned long adev) | 891 | void mpc_group_ready(unsigned long adev) |
934 | { | 892 | { |
935 | struct net_device *dev = (struct net_device *)adev; | 893 | struct net_device *dev = (struct net_device *)adev; |
936 | struct ctcm_priv *priv = NULL; | 894 | struct ctcm_priv *priv = dev->priv; |
937 | struct mpc_group *grp = NULL; | 895 | struct mpc_group *grp = priv->mpcg; |
938 | struct channel *ch = NULL; | 896 | struct channel *ch = NULL; |
939 | 897 | ||
940 | |||
941 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | ||
942 | |||
943 | if (dev == NULL) { | ||
944 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | ||
945 | return; | ||
946 | } | ||
947 | |||
948 | priv = dev->priv; | ||
949 | if (priv == NULL) { | ||
950 | printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); | ||
951 | return; | ||
952 | } | ||
953 | |||
954 | grp = priv->mpcg; | ||
955 | if (grp == NULL) { | 898 | if (grp == NULL) { |
956 | printk(KERN_INFO "ctcmpc:%s() grp=NULL\n", __FUNCTION__); | 899 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
900 | "%s(%s): No MPC group", | ||
901 | CTCM_FUNTAIL, dev->name); | ||
957 | return; | 902 | return; |
958 | } | 903 | } |
959 | 904 | ||
960 | printk(KERN_NOTICE "ctcmpc: %s GROUP TRANSITIONED TO READY" | 905 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_NOTICE, |
961 | " maxbuf:%d\n", | 906 | "%s: %s: GROUP TRANSITIONED TO READY, maxbuf = %d\n", |
962 | dev->name, grp->group_max_buflen); | 907 | CTCM_FUNTAIL, dev->name, grp->group_max_buflen); |
963 | 908 | ||
964 | fsm_newstate(grp->fsm, MPCG_STATE_READY); | 909 | fsm_newstate(grp->fsm, MPCG_STATE_READY); |
965 | 910 | ||
966 | /* Put up a read on the channel */ | 911 | /* Put up a read on the channel */ |
967 | ch = priv->channel[READ]; | 912 | ch = priv->channel[READ]; |
968 | ch->pdu_seq = 0; | 913 | ch->pdu_seq = 0; |
969 | if (do_debug_data) | 914 | CTCM_PR_DBGDATA("ctcmpc: %s() ToDCM_pdu_seq= %08x\n" , |
970 | ctcm_pr_debug("ctcmpc: %s() ToDCM_pdu_seq= %08x\n" , | 915 | __func__, ch->pdu_seq); |
971 | __FUNCTION__, ch->pdu_seq); | ||
972 | 916 | ||
973 | ctcmpc_chx_rxidle(ch->fsm, CTC_EVENT_START, ch); | 917 | ctcmpc_chx_rxidle(ch->fsm, CTC_EVENT_START, ch); |
974 | /* Put the write channel in idle state */ | 918 | /* Put the write channel in idle state */ |
@@ -980,22 +924,18 @@ void mpc_group_ready(unsigned long adev) | |||
980 | spin_unlock(&ch->collect_lock); | 924 | spin_unlock(&ch->collect_lock); |
981 | } | 925 | } |
982 | ctcm_chx_txidle(ch->fsm, CTC_EVENT_START, ch); | 926 | ctcm_chx_txidle(ch->fsm, CTC_EVENT_START, ch); |
983 | |||
984 | ctcm_clear_busy(dev); | 927 | ctcm_clear_busy(dev); |
985 | 928 | ||
986 | if (grp->estconnfunc) { | 929 | if (grp->estconnfunc) { |
987 | grp->estconnfunc(grp->port_num, 0, | 930 | grp->estconnfunc(grp->port_num, 0, |
988 | grp->group_max_buflen); | 931 | grp->group_max_buflen); |
989 | grp->estconnfunc = NULL; | 932 | grp->estconnfunc = NULL; |
990 | } else | 933 | } else if (grp->allochanfunc) |
991 | if (grp->allochanfunc) | 934 | grp->allochanfunc(grp->port_num, grp->group_max_buflen); |
992 | grp->allochanfunc(grp->port_num, | ||
993 | grp->group_max_buflen); | ||
994 | 935 | ||
995 | grp->send_qllc_disc = 1; | 936 | grp->send_qllc_disc = 1; |
996 | grp->changed_side = 0; | 937 | grp->changed_side = 0; |
997 | 938 | ||
998 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
999 | return; | 939 | return; |
1000 | 940 | ||
1001 | } | 941 | } |
@@ -1004,51 +944,26 @@ void mpc_group_ready(unsigned long adev) | |||
1004 | * Increment the MPC Group Active Channel Counts | 944 | * Increment the MPC Group Active Channel Counts |
1005 | * helper of dev_action (called from channel fsm) | 945 | * helper of dev_action (called from channel fsm) |
1006 | */ | 946 | */ |
1007 | int mpc_channel_action(struct channel *ch, int direction, int action) | 947 | void mpc_channel_action(struct channel *ch, int direction, int action) |
1008 | { | 948 | { |
1009 | struct net_device *dev = ch->netdev; | 949 | struct net_device *dev = ch->netdev; |
1010 | struct ctcm_priv *priv; | 950 | struct ctcm_priv *priv = dev->priv; |
1011 | struct mpc_group *grp = NULL; | 951 | struct mpc_group *grp = priv->mpcg; |
1012 | int rc = 0; | ||
1013 | |||
1014 | if (do_debug) | ||
1015 | ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", | ||
1016 | __FUNCTION__, ch, ch->id); | ||
1017 | |||
1018 | if (dev == NULL) { | ||
1019 | printk(KERN_INFO "ctcmpc_channel_action %i dev=NULL\n", | ||
1020 | action); | ||
1021 | rc = 1; | ||
1022 | goto done; | ||
1023 | } | ||
1024 | |||
1025 | priv = dev->priv; | ||
1026 | if (priv == NULL) { | ||
1027 | printk(KERN_INFO | ||
1028 | "ctcmpc_channel_action%i priv=NULL, dev=%s\n", | ||
1029 | action, dev->name); | ||
1030 | rc = 2; | ||
1031 | goto done; | ||
1032 | } | ||
1033 | |||
1034 | grp = priv->mpcg; | ||
1035 | 952 | ||
1036 | if (grp == NULL) { | 953 | if (grp == NULL) { |
1037 | printk(KERN_INFO "ctcmpc: %s()%i mpcgroup=NULL, dev=%s\n", | 954 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1038 | __FUNCTION__, action, dev->name); | 955 | "%s(%s): No MPC group", |
1039 | rc = 3; | 956 | CTCM_FUNTAIL, dev->name); |
1040 | goto done; | 957 | return; |
1041 | } | 958 | } |
1042 | 959 | ||
1043 | ctcm_pr_info( | 960 | CTCM_PR_DEBUG("enter %s: ch=0x%p id=%s\n", __func__, ch, ch->id); |
1044 | "ctcmpc: %s() %i(): Grp:%s total_channel_paths=%i " | 961 | |
1045 | "active_channels read=%i, write=%i\n", | 962 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1046 | __FUNCTION__, | 963 | "%s: %i / Grp:%s total_channels=%i, active_channels: " |
1047 | action, | 964 | "read=%i, write=%i\n", __func__, action, |
1048 | fsm_getstate_str(grp->fsm), | 965 | fsm_getstate_str(grp->fsm), grp->num_channel_paths, |
1049 | grp->num_channel_paths, | 966 | grp->active_channels[READ], grp->active_channels[WRITE]); |
1050 | grp->active_channels[READ], | ||
1051 | grp->active_channels[WRITE]); | ||
1052 | 967 | ||
1053 | if ((action == MPC_CHANNEL_ADD) && (ch->in_mpcgroup == 0)) { | 968 | if ((action == MPC_CHANNEL_ADD) && (ch->in_mpcgroup == 0)) { |
1054 | grp->num_channel_paths++; | 969 | grp->num_channel_paths++; |
@@ -1062,10 +977,11 @@ int mpc_channel_action(struct channel *ch, int direction, int action) | |||
1062 | ch->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, | 977 | ch->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, |
1063 | GFP_ATOMIC | GFP_DMA); | 978 | GFP_ATOMIC | GFP_DMA); |
1064 | if (ch->xid_skb == NULL) { | 979 | if (ch->xid_skb == NULL) { |
1065 | printk(KERN_INFO "ctcmpc: %s()" | 980 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1066 | "Couldn't alloc ch xid_skb\n", __FUNCTION__); | 981 | "%s(%s): Couldn't alloc ch xid_skb\n", |
982 | CTCM_FUNTAIL, dev->name); | ||
1067 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 983 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1068 | return 1; | 984 | return; |
1069 | } | 985 | } |
1070 | ch->xid_skb_data = ch->xid_skb->data; | 986 | ch->xid_skb_data = ch->xid_skb->data; |
1071 | ch->xid_th = (struct th_header *)ch->xid_skb->data; | 987 | ch->xid_th = (struct th_header *)ch->xid_skb->data; |
@@ -1097,8 +1013,9 @@ int mpc_channel_action(struct channel *ch, int direction, int action) | |||
1097 | (grp->active_channels[WRITE] > 0) && | 1013 | (grp->active_channels[WRITE] > 0) && |
1098 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { | 1014 | (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { |
1099 | fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW); | 1015 | fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW); |
1100 | printk(KERN_NOTICE "ctcmpc: %s MPC GROUP " | 1016 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_NOTICE, |
1101 | "CHANNELS ACTIVE\n", dev->name); | 1017 | "%s: %s: MPC GROUP CHANNELS ACTIVE\n", |
1018 | __func__, dev->name); | ||
1102 | } | 1019 | } |
1103 | } else if ((action == MPC_CHANNEL_REMOVE) && | 1020 | } else if ((action == MPC_CHANNEL_REMOVE) && |
1104 | (ch->in_mpcgroup == 1)) { | 1021 | (ch->in_mpcgroup == 1)) { |
@@ -1119,25 +1036,14 @@ int mpc_channel_action(struct channel *ch, int direction, int action) | |||
1119 | (grp->active_channels[READ] > 0))) | 1036 | (grp->active_channels[READ] > 0))) |
1120 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 1037 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1121 | } | 1038 | } |
1122 | |||
1123 | done: | 1039 | done: |
1040 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, | ||
1041 | "exit %s: %i / Grp:%s total_channels=%i, active_channels: " | ||
1042 | "read=%i, write=%i\n", __func__, action, | ||
1043 | fsm_getstate_str(grp->fsm), grp->num_channel_paths, | ||
1044 | grp->active_channels[READ], grp->active_channels[WRITE]); | ||
1124 | 1045 | ||
1125 | if (do_debug) { | 1046 | CTCM_PR_DEBUG("exit %s: ch=0x%p id=%s\n", __func__, ch, ch->id); |
1126 | ctcm_pr_debug( | ||
1127 | "ctcmpc: %s() %i Grp:%s ttl_chan_paths=%i " | ||
1128 | "active_chans read=%i, write=%i\n", | ||
1129 | __FUNCTION__, | ||
1130 | action, | ||
1131 | fsm_getstate_str(grp->fsm), | ||
1132 | grp->num_channel_paths, | ||
1133 | grp->active_channels[READ], | ||
1134 | grp->active_channels[WRITE]); | ||
1135 | |||
1136 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | ||
1137 | __FUNCTION__, ch, ch->id); | ||
1138 | } | ||
1139 | return rc; | ||
1140 | |||
1141 | } | 1047 | } |
1142 | 1048 | ||
1143 | /** | 1049 | /** |
@@ -1163,9 +1069,8 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1163 | int skblen; | 1069 | int skblen; |
1164 | int sendrc = 0; | 1070 | int sendrc = 0; |
1165 | 1071 | ||
1166 | if (do_debug) | 1072 | CTCM_PR_DEBUG("ctcmpc enter: %s() %s cp:%i ch:%s\n", |
1167 | ctcm_pr_debug("ctcmpc enter: %s() %s cp:%i ch:%s\n", | 1073 | __func__, dev->name, smp_processor_id(), ch->id); |
1168 | __FUNCTION__, dev->name, smp_processor_id(), ch->id); | ||
1169 | 1074 | ||
1170 | header = (struct th_header *)pskb->data; | 1075 | header = (struct th_header *)pskb->data; |
1171 | if ((header->th_seg == 0) && | 1076 | if ((header->th_seg == 0) && |
@@ -1174,21 +1079,16 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1174 | (header->th_seq_num == 0)) | 1079 | (header->th_seq_num == 0)) |
1175 | /* nothing for us */ goto done; | 1080 | /* nothing for us */ goto done; |
1176 | 1081 | ||
1177 | if (do_debug_data) { | 1082 | CTCM_PR_DBGDATA("%s: th_header\n", __func__); |
1178 | ctcm_pr_debug("ctcmpc: %s() th_header\n", __FUNCTION__); | 1083 | CTCM_D3_DUMP((char *)header, TH_HEADER_LENGTH); |
1179 | ctcmpc_dumpit((char *)header, TH_HEADER_LENGTH); | 1084 | CTCM_PR_DBGDATA("%s: pskb len: %04x \n", __func__, pskb->len); |
1180 | ctcm_pr_debug("ctcmpc: %s() pskb len: %04x \n", | ||
1181 | __FUNCTION__, pskb->len); | ||
1182 | } | ||
1183 | 1085 | ||
1184 | pskb->dev = dev; | 1086 | pskb->dev = dev; |
1185 | pskb->ip_summed = CHECKSUM_UNNECESSARY; | 1087 | pskb->ip_summed = CHECKSUM_UNNECESSARY; |
1186 | skb_pull(pskb, TH_HEADER_LENGTH); | 1088 | skb_pull(pskb, TH_HEADER_LENGTH); |
1187 | 1089 | ||
1188 | if (likely(header->th_ch_flag == TH_HAS_PDU)) { | 1090 | if (likely(header->th_ch_flag == TH_HAS_PDU)) { |
1189 | if (do_debug_data) | 1091 | CTCM_PR_DBGDATA("%s: came into th_has_pdu\n", __func__); |
1190 | ctcm_pr_debug("ctcmpc: %s() came into th_has_pdu\n", | ||
1191 | __FUNCTION__); | ||
1192 | if ((fsm_getstate(grp->fsm) == MPCG_STATE_FLOWC) || | 1092 | if ((fsm_getstate(grp->fsm) == MPCG_STATE_FLOWC) || |
1193 | ((fsm_getstate(grp->fsm) == MPCG_STATE_READY) && | 1093 | ((fsm_getstate(grp->fsm) == MPCG_STATE_READY) && |
1194 | (header->th_seq_num != ch->th_seq_num + 1) && | 1094 | (header->th_seq_num != ch->th_seq_num + 1) && |
@@ -1202,33 +1102,29 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1202 | grp->out_of_sequence += 1; | 1102 | grp->out_of_sequence += 1; |
1203 | __skb_push(pskb, TH_HEADER_LENGTH); | 1103 | __skb_push(pskb, TH_HEADER_LENGTH); |
1204 | skb_queue_tail(&ch->io_queue, pskb); | 1104 | skb_queue_tail(&ch->io_queue, pskb); |
1205 | if (do_debug_data) | 1105 | CTCM_PR_DBGDATA("%s: th_seq_num expect:%08x " |
1206 | ctcm_pr_debug("ctcmpc: %s() th_seq_num " | 1106 | "got:%08x\n", __func__, |
1207 | "expect:%08x got:%08x\n", __FUNCTION__, | 1107 | ch->th_seq_num + 1, header->th_seq_num); |
1208 | ch->th_seq_num + 1, header->th_seq_num); | ||
1209 | 1108 | ||
1210 | return; | 1109 | return; |
1211 | } | 1110 | } |
1212 | grp->out_of_sequence = 0; | 1111 | grp->out_of_sequence = 0; |
1213 | ch->th_seq_num = header->th_seq_num; | 1112 | ch->th_seq_num = header->th_seq_num; |
1214 | 1113 | ||
1215 | if (do_debug_data) | 1114 | CTCM_PR_DBGDATA("ctcmpc: %s() FromVTAM_th_seq=%08x\n", |
1216 | ctcm_pr_debug("ctcmpc: %s() FromVTAM_th_seq=%08x\n", | 1115 | __func__, ch->th_seq_num); |
1217 | __FUNCTION__, ch->th_seq_num); | ||
1218 | 1116 | ||
1219 | if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) | 1117 | if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) |
1220 | goto done; | 1118 | goto done; |
1221 | pdu_last_seen = 0; | 1119 | pdu_last_seen = 0; |
1222 | while ((pskb->len > 0) && !pdu_last_seen) { | 1120 | while ((pskb->len > 0) && !pdu_last_seen) { |
1223 | curr_pdu = (struct pdu *)pskb->data; | 1121 | curr_pdu = (struct pdu *)pskb->data; |
1224 | if (do_debug_data) { | 1122 | |
1225 | ctcm_pr_debug("ctcm: %s() pdu_header\n", | 1123 | CTCM_PR_DBGDATA("%s: pdu_header\n", __func__); |
1226 | __FUNCTION__); | 1124 | CTCM_D3_DUMP((char *)pskb->data, PDU_HEADER_LENGTH); |
1227 | ctcmpc_dumpit((char *)pskb->data, | 1125 | CTCM_PR_DBGDATA("%s: pskb len: %04x \n", |
1228 | PDU_HEADER_LENGTH); | 1126 | __func__, pskb->len); |
1229 | ctcm_pr_debug("ctcm: %s() pskb len: %04x \n", | 1127 | |
1230 | __FUNCTION__, pskb->len); | ||
1231 | } | ||
1232 | skb_pull(pskb, PDU_HEADER_LENGTH); | 1128 | skb_pull(pskb, PDU_HEADER_LENGTH); |
1233 | 1129 | ||
1234 | if (curr_pdu->pdu_flag & PDU_LAST) | 1130 | if (curr_pdu->pdu_flag & PDU_LAST) |
@@ -1239,46 +1135,39 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1239 | pskb->protocol = htons(ETH_P_SNA_DIX); | 1135 | pskb->protocol = htons(ETH_P_SNA_DIX); |
1240 | 1136 | ||
1241 | if ((pskb->len <= 0) || (pskb->len > ch->max_bufsize)) { | 1137 | if ((pskb->len <= 0) || (pskb->len > ch->max_bufsize)) { |
1242 | printk(KERN_INFO | 1138 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1243 | "%s Illegal packet size %d " | 1139 | "%s(%s): Dropping packet with " |
1244 | "received " | 1140 | "illegal siize %d", |
1245 | "dropping\n", dev->name, | 1141 | CTCM_FUNTAIL, dev->name, pskb->len); |
1246 | pskb->len); | 1142 | |
1247 | priv->stats.rx_dropped++; | 1143 | priv->stats.rx_dropped++; |
1248 | priv->stats.rx_length_errors++; | 1144 | priv->stats.rx_length_errors++; |
1249 | goto done; | 1145 | goto done; |
1250 | } | 1146 | } |
1251 | skb_reset_mac_header(pskb); | 1147 | skb_reset_mac_header(pskb); |
1252 | new_len = curr_pdu->pdu_offset; | 1148 | new_len = curr_pdu->pdu_offset; |
1253 | if (do_debug_data) | 1149 | CTCM_PR_DBGDATA("%s: new_len: %04x \n", |
1254 | ctcm_pr_debug("ctcmpc: %s() new_len: %04x \n", | 1150 | __func__, new_len); |
1255 | __FUNCTION__, new_len); | ||
1256 | if ((new_len == 0) || (new_len > pskb->len)) { | 1151 | if ((new_len == 0) || (new_len > pskb->len)) { |
1257 | /* should never happen */ | 1152 | /* should never happen */ |
1258 | /* pskb len must be hosed...bail out */ | 1153 | /* pskb len must be hosed...bail out */ |
1259 | printk(KERN_INFO | 1154 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1260 | "ctcmpc: %s(): invalid pdu" | 1155 | "%s(%s): non valid pdu_offset: %04x", |
1261 | " offset of %04x - data may be" | 1156 | /* "data may be lost", */ |
1262 | "lost\n", __FUNCTION__, new_len); | 1157 | CTCM_FUNTAIL, dev->name, new_len); |
1263 | goto done; | 1158 | goto done; |
1264 | } | 1159 | } |
1265 | skb = __dev_alloc_skb(new_len+4, GFP_ATOMIC); | 1160 | skb = __dev_alloc_skb(new_len+4, GFP_ATOMIC); |
1266 | 1161 | ||
1267 | if (!skb) { | 1162 | if (!skb) { |
1268 | printk(KERN_INFO | 1163 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1269 | "ctcm: %s Out of memory in " | 1164 | "%s(%s): MEMORY allocation error", |
1270 | "%s()- request-len:%04x \n", | 1165 | CTCM_FUNTAIL, dev->name); |
1271 | dev->name, | ||
1272 | __FUNCTION__, | ||
1273 | new_len+4); | ||
1274 | priv->stats.rx_dropped++; | 1166 | priv->stats.rx_dropped++; |
1275 | fsm_event(grp->fsm, | 1167 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1276 | MPCG_EVENT_INOP, dev); | ||
1277 | goto done; | 1168 | goto done; |
1278 | } | 1169 | } |
1279 | 1170 | memcpy(skb_put(skb, new_len), pskb->data, new_len); | |
1280 | memcpy(skb_put(skb, new_len), | ||
1281 | pskb->data, new_len); | ||
1282 | 1171 | ||
1283 | skb_reset_mac_header(skb); | 1172 | skb_reset_mac_header(skb); |
1284 | skb->dev = pskb->dev; | 1173 | skb->dev = pskb->dev; |
@@ -1287,17 +1176,14 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1287 | *((__u32 *) skb_push(skb, 4)) = ch->pdu_seq; | 1176 | *((__u32 *) skb_push(skb, 4)) = ch->pdu_seq; |
1288 | ch->pdu_seq++; | 1177 | ch->pdu_seq++; |
1289 | 1178 | ||
1290 | if (do_debug_data) | ||
1291 | ctcm_pr_debug("%s: ToDCM_pdu_seq= %08x\n", | ||
1292 | __FUNCTION__, ch->pdu_seq); | ||
1293 | |||
1294 | ctcm_pr_debug("ctcm: %s() skb:%0lx " | ||
1295 | "skb len: %d \n", __FUNCTION__, | ||
1296 | (unsigned long)skb, skb->len); | ||
1297 | if (do_debug_data) { | 1179 | if (do_debug_data) { |
1298 | ctcm_pr_debug("ctcmpc: %s() up to 32 bytes" | 1180 | ctcm_pr_debug("%s: ToDCM_pdu_seq= %08x\n", |
1299 | " of pdu_data sent\n", | 1181 | __func__, ch->pdu_seq); |
1300 | __FUNCTION__); | 1182 | ctcm_pr_debug("%s: skb:%0lx " |
1183 | "skb len: %d \n", __func__, | ||
1184 | (unsigned long)skb, skb->len); | ||
1185 | ctcm_pr_debug("%s: up to 32 bytes " | ||
1186 | "of pdu_data sent\n", __func__); | ||
1301 | ctcmpc_dump32((char *)skb->data, skb->len); | 1187 | ctcmpc_dump32((char *)skb->data, skb->len); |
1302 | } | 1188 | } |
1303 | 1189 | ||
@@ -1316,8 +1202,8 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1316 | mpcginfo->ch = ch; | 1202 | mpcginfo->ch = ch; |
1317 | mpcginfo->th = header; | 1203 | mpcginfo->th = header; |
1318 | mpcginfo->skb = pskb; | 1204 | mpcginfo->skb = pskb; |
1319 | ctcm_pr_debug("ctcmpc: %s() Not PDU - may be control pkt\n", | 1205 | CTCM_PR_DEBUG("%s: Not PDU - may be control pkt\n", |
1320 | __FUNCTION__); | 1206 | __func__); |
1321 | /* it's a sweep? */ | 1207 | /* it's a sweep? */ |
1322 | sweep = (struct th_sweep *)pskb->data; | 1208 | sweep = (struct th_sweep *)pskb->data; |
1323 | mpcginfo->sweep = sweep; | 1209 | mpcginfo->sweep = sweep; |
@@ -1333,8 +1219,9 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) | |||
1333 | } else if (header->th_blk_flag == TH_DISCONTACT) | 1219 | } else if (header->th_blk_flag == TH_DISCONTACT) |
1334 | fsm_event(grp->fsm, MPCG_EVENT_DISCONC, mpcginfo); | 1220 | fsm_event(grp->fsm, MPCG_EVENT_DISCONC, mpcginfo); |
1335 | else if (header->th_seq_num != 0) { | 1221 | else if (header->th_seq_num != 0) { |
1336 | printk(KERN_INFO "%s unexpected packet" | 1222 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1337 | " expected control pkt\n", dev->name); | 1223 | "%s(%s): control pkt expected\n", |
1224 | CTCM_FUNTAIL, dev->name); | ||
1338 | priv->stats.rx_dropped++; | 1225 | priv->stats.rx_dropped++; |
1339 | /* mpcginfo only used for non-data transfers */ | 1226 | /* mpcginfo only used for non-data transfers */ |
1340 | kfree(mpcginfo); | 1227 | kfree(mpcginfo); |
@@ -1347,13 +1234,12 @@ done: | |||
1347 | dev_kfree_skb_any(pskb); | 1234 | dev_kfree_skb_any(pskb); |
1348 | if (sendrc == NET_RX_DROP) { | 1235 | if (sendrc == NET_RX_DROP) { |
1349 | printk(KERN_WARNING "%s %s() NETWORK BACKLOG EXCEEDED" | 1236 | printk(KERN_WARNING "%s %s() NETWORK BACKLOG EXCEEDED" |
1350 | " - PACKET DROPPED\n", dev->name, __FUNCTION__); | 1237 | " - PACKET DROPPED\n", dev->name, __func__); |
1351 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 1238 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1352 | } | 1239 | } |
1353 | 1240 | ||
1354 | if (do_debug) | 1241 | CTCM_PR_DEBUG("exit %s: %s: ch=0x%p id=%s\n", |
1355 | ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", | 1242 | __func__, dev->name, ch, ch->id); |
1356 | dev->name, __FUNCTION__, ch, ch->id); | ||
1357 | } | 1243 | } |
1358 | 1244 | ||
1359 | /** | 1245 | /** |
@@ -1366,15 +1252,14 @@ done: | |||
1366 | */ | 1252 | */ |
1367 | void ctcmpc_bh(unsigned long thischan) | 1253 | void ctcmpc_bh(unsigned long thischan) |
1368 | { | 1254 | { |
1369 | struct channel *ch = (struct channel *)thischan; | 1255 | struct channel *ch = (struct channel *)thischan; |
1370 | struct sk_buff *skb; | 1256 | struct sk_buff *skb; |
1371 | struct net_device *dev = ch->netdev; | 1257 | struct net_device *dev = ch->netdev; |
1372 | struct ctcm_priv *priv = dev->priv; | 1258 | struct ctcm_priv *priv = dev->priv; |
1373 | struct mpc_group *grp = priv->mpcg; | 1259 | struct mpc_group *grp = priv->mpcg; |
1374 | 1260 | ||
1375 | if (do_debug) | 1261 | CTCM_PR_DEBUG("%s cp:%i enter: %s() %s\n", |
1376 | ctcm_pr_debug("%s cp:%i enter: %s() %s\n", | 1262 | dev->name, smp_processor_id(), __func__, ch->id); |
1377 | dev->name, smp_processor_id(), __FUNCTION__, ch->id); | ||
1378 | /* caller has requested driver to throttle back */ | 1263 | /* caller has requested driver to throttle back */ |
1379 | while ((fsm_getstate(grp->fsm) != MPCG_STATE_FLOWC) && | 1264 | while ((fsm_getstate(grp->fsm) != MPCG_STATE_FLOWC) && |
1380 | (skb = skb_dequeue(&ch->io_queue))) { | 1265 | (skb = skb_dequeue(&ch->io_queue))) { |
@@ -1390,9 +1275,8 @@ void ctcmpc_bh(unsigned long thischan) | |||
1390 | if (skb == skb_peek(&ch->io_queue)) | 1275 | if (skb == skb_peek(&ch->io_queue)) |
1391 | break; | 1276 | break; |
1392 | } | 1277 | } |
1393 | if (do_debug) | 1278 | CTCM_PR_DEBUG("exit %s: %s: ch=0x%p id=%s\n", |
1394 | ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", | 1279 | __func__, dev->name, ch, ch->id); |
1395 | dev->name, __FUNCTION__, ch, ch->id); | ||
1396 | return; | 1280 | return; |
1397 | } | 1281 | } |
1398 | 1282 | ||
@@ -1403,16 +1287,16 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1403 | { | 1287 | { |
1404 | struct mpc_group *grp; | 1288 | struct mpc_group *grp; |
1405 | 1289 | ||
1406 | CTCM_DBF_TEXT(MPC_SETUP, 3, __FUNCTION__); | 1290 | CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, |
1291 | "Enter %s(%p)", CTCM_FUNTAIL, priv); | ||
1407 | 1292 | ||
1408 | grp = kzalloc(sizeof(struct mpc_group), GFP_KERNEL); | 1293 | grp = kzalloc(sizeof(struct mpc_group), GFP_KERNEL); |
1409 | if (grp == NULL) | 1294 | if (grp == NULL) |
1410 | return NULL; | 1295 | return NULL; |
1411 | 1296 | ||
1412 | grp->fsm = | 1297 | grp->fsm = init_fsm("mpcg", mpcg_state_names, mpcg_event_names, |
1413 | init_fsm("mpcg", mpcg_state_names, mpcg_event_names, | 1298 | MPCG_NR_STATES, MPCG_NR_EVENTS, mpcg_fsm, |
1414 | MPCG_NR_STATES, MPCG_NR_EVENTS, mpcg_fsm, | 1299 | mpcg_fsm_len, GFP_KERNEL); |
1415 | mpcg_fsm_len, GFP_KERNEL); | ||
1416 | if (grp->fsm == NULL) { | 1300 | if (grp->fsm == NULL) { |
1417 | kfree(grp); | 1301 | kfree(grp); |
1418 | return NULL; | 1302 | return NULL; |
@@ -1424,7 +1308,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1424 | grp->xid_skb = | 1308 | grp->xid_skb = |
1425 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); | 1309 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); |
1426 | if (grp->xid_skb == NULL) { | 1310 | if (grp->xid_skb == NULL) { |
1427 | printk(KERN_INFO "Couldn't alloc MPCgroup xid_skb\n"); | ||
1428 | kfree_fsm(grp->fsm); | 1311 | kfree_fsm(grp->fsm); |
1429 | kfree(grp); | 1312 | kfree(grp); |
1430 | return NULL; | 1313 | return NULL; |
@@ -1435,7 +1318,7 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1435 | memcpy(skb_put(grp->xid_skb, TH_HEADER_LENGTH), | 1318 | memcpy(skb_put(grp->xid_skb, TH_HEADER_LENGTH), |
1436 | &thnorm, TH_HEADER_LENGTH); | 1319 | &thnorm, TH_HEADER_LENGTH); |
1437 | 1320 | ||
1438 | grp->xid = (struct xid2 *) skb_tail_pointer(grp->xid_skb); | 1321 | grp->xid = (struct xid2 *)skb_tail_pointer(grp->xid_skb); |
1439 | memcpy(skb_put(grp->xid_skb, XID2_LENGTH), &init_xid, XID2_LENGTH); | 1322 | memcpy(skb_put(grp->xid_skb, XID2_LENGTH), &init_xid, XID2_LENGTH); |
1440 | grp->xid->xid2_adj_id = jiffies | 0xfff00000; | 1323 | grp->xid->xid2_adj_id = jiffies | 0xfff00000; |
1441 | grp->xid->xid2_sender_id = jiffies; | 1324 | grp->xid->xid2_sender_id = jiffies; |
@@ -1446,7 +1329,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) | |||
1446 | grp->rcvd_xid_skb = | 1329 | grp->rcvd_xid_skb = |
1447 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); | 1330 | __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); |
1448 | if (grp->rcvd_xid_skb == NULL) { | 1331 | if (grp->rcvd_xid_skb == NULL) { |
1449 | printk(KERN_INFO "Couldn't alloc MPCgroup rcvd_xid_skb\n"); | ||
1450 | kfree_fsm(grp->fsm); | 1332 | kfree_fsm(grp->fsm); |
1451 | dev_kfree_skb(grp->xid_skb); | 1333 | dev_kfree_skb(grp->xid_skb); |
1452 | kfree(grp); | 1334 | kfree(grp); |
@@ -1492,32 +1374,27 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) | |||
1492 | int rc = 0; | 1374 | int rc = 0; |
1493 | struct channel *wch, *rch; | 1375 | struct channel *wch, *rch; |
1494 | 1376 | ||
1495 | if (dev == NULL) { | 1377 | BUG_ON(dev == NULL); |
1496 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | 1378 | CTCM_PR_DEBUG("Enter %s: %s\n", __func__, dev->name); |
1497 | return; | ||
1498 | } | ||
1499 | |||
1500 | ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); | ||
1501 | 1379 | ||
1502 | priv = dev->priv; | 1380 | priv = dev->priv; |
1503 | grp = priv->mpcg; | 1381 | grp = priv->mpcg; |
1504 | grp->flow_off_called = 0; | 1382 | grp->flow_off_called = 0; |
1505 | |||
1506 | fsm_deltimer(&grp->timer); | 1383 | fsm_deltimer(&grp->timer); |
1507 | |||
1508 | if (grp->channels_terminating) | 1384 | if (grp->channels_terminating) |
1509 | goto done; | 1385 | return; |
1510 | 1386 | ||
1511 | grp->channels_terminating = 1; | 1387 | grp->channels_terminating = 1; |
1512 | |||
1513 | grp->saved_state = fsm_getstate(grp->fsm); | 1388 | grp->saved_state = fsm_getstate(grp->fsm); |
1514 | fsm_newstate(grp->fsm, MPCG_STATE_INOP); | 1389 | fsm_newstate(grp->fsm, MPCG_STATE_INOP); |
1515 | if (grp->saved_state > MPCG_STATE_XID7INITF) | 1390 | if (grp->saved_state > MPCG_STATE_XID7INITF) |
1516 | printk(KERN_NOTICE "%s:MPC GROUP INOPERATIVE\n", dev->name); | 1391 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1392 | "%s(%s): MPC GROUP INOPERATIVE", | ||
1393 | CTCM_FUNTAIL, dev->name); | ||
1517 | if ((grp->saved_state != MPCG_STATE_RESET) || | 1394 | if ((grp->saved_state != MPCG_STATE_RESET) || |
1518 | /* dealloc_channel has been called */ | 1395 | /* dealloc_channel has been called */ |
1519 | ((grp->saved_state == MPCG_STATE_RESET) && | 1396 | ((grp->saved_state == MPCG_STATE_RESET) && |
1520 | (grp->port_persist == 0))) | 1397 | (grp->port_persist == 0))) |
1521 | fsm_deltimer(&priv->restart_timer); | 1398 | fsm_deltimer(&priv->restart_timer); |
1522 | 1399 | ||
1523 | wch = priv->channel[WRITE]; | 1400 | wch = priv->channel[WRITE]; |
@@ -1567,29 +1444,24 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) | |||
1567 | /* This can result in INOP of VTAM PU due to halting of */ | 1444 | /* This can result in INOP of VTAM PU due to halting of */ |
1568 | /* outstanding IO which causes a sense to be returned */ | 1445 | /* outstanding IO which causes a sense to be returned */ |
1569 | /* Only about 3 senses are allowed and then IOS/VTAM will*/ | 1446 | /* Only about 3 senses are allowed and then IOS/VTAM will*/ |
1570 | /* ebcome unreachable without manual intervention */ | 1447 | /* become unreachable without manual intervention */ |
1571 | if ((grp->port_persist == 1) || (grp->alloc_called)) { | 1448 | if ((grp->port_persist == 1) || (grp->alloc_called)) { |
1572 | grp->alloc_called = 0; | 1449 | grp->alloc_called = 0; |
1573 | fsm_deltimer(&priv->restart_timer); | 1450 | fsm_deltimer(&priv->restart_timer); |
1574 | fsm_addtimer(&priv->restart_timer, | 1451 | fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_RESTART, dev); |
1575 | 500, | ||
1576 | DEV_EVENT_RESTART, | ||
1577 | dev); | ||
1578 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); | 1452 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); |
1579 | if (grp->saved_state > MPCG_STATE_XID7INITF) | 1453 | if (grp->saved_state > MPCG_STATE_XID7INITF) |
1580 | printk(KERN_NOTICE "%s:MPC GROUP RECOVERY SCHEDULED\n", | 1454 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ALWAYS, |
1581 | dev->name); | 1455 | "%s(%s): MPC GROUP RECOVERY SCHEDULED", |
1456 | CTCM_FUNTAIL, dev->name); | ||
1582 | } else { | 1457 | } else { |
1583 | fsm_deltimer(&priv->restart_timer); | 1458 | fsm_deltimer(&priv->restart_timer); |
1584 | fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_STOP, dev); | 1459 | fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_STOP, dev); |
1585 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); | 1460 | fsm_newstate(grp->fsm, MPCG_STATE_RESET); |
1586 | printk(KERN_NOTICE "%s:MPC GROUP RECOVERY NOT ATTEMPTED\n", | 1461 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ALWAYS, |
1587 | dev->name); | 1462 | "%s(%s): NO MPC GROUP RECOVERY ATTEMPTED", |
1463 | CTCM_FUNTAIL, dev->name); | ||
1588 | } | 1464 | } |
1589 | |||
1590 | done: | ||
1591 | ctcm_pr_debug("ctcmpc exit:%s %s()\n", dev->name, __FUNCTION__); | ||
1592 | return; | ||
1593 | } | 1465 | } |
1594 | 1466 | ||
1595 | /** | 1467 | /** |
@@ -1609,12 +1481,7 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) | |||
1609 | struct channel *wch; | 1481 | struct channel *wch; |
1610 | struct channel *rch; | 1482 | struct channel *rch; |
1611 | 1483 | ||
1612 | CTCM_DBF_TEXT(MPC_TRACE, 6, __FUNCTION__); | 1484 | BUG_ON(dev == NULL); |
1613 | |||
1614 | if (dev == NULL) { | ||
1615 | CTCM_DBF_TEXT_(MPC_ERROR, 4, "%s: dev=NULL\n", __FUNCTION__); | ||
1616 | return; | ||
1617 | } | ||
1618 | 1485 | ||
1619 | priv = dev->priv; | 1486 | priv = dev->priv; |
1620 | grp = priv->mpcg; | 1487 | grp = priv->mpcg; |
@@ -1633,8 +1500,9 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) | |||
1633 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | 1500 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
1634 | } | 1501 | } |
1635 | 1502 | ||
1636 | CTCM_DBF_TEXT_(MPC_TRACE, 6, "%s: dev=%s exit", | 1503 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, |
1637 | __FUNCTION__, dev->name); | 1504 | "%s: dev=%s exit", |
1505 | CTCM_FUNTAIL, dev->name); | ||
1638 | return; | 1506 | return; |
1639 | } | 1507 | } |
1640 | 1508 | ||
@@ -1646,25 +1514,25 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) | |||
1646 | { | 1514 | { |
1647 | struct mpcg_info *mpcginfo = arg; | 1515 | struct mpcg_info *mpcginfo = arg; |
1648 | struct channel *ch = mpcginfo->ch; | 1516 | struct channel *ch = mpcginfo->ch; |
1649 | struct net_device *dev = ch->netdev; | 1517 | struct net_device *dev; |
1650 | struct ctcm_priv *priv = dev->priv; | 1518 | struct ctcm_priv *priv; |
1651 | struct mpc_group *grp = priv->mpcg; | 1519 | struct mpc_group *grp; |
1652 | 1520 | ||
1653 | if (ch == NULL) { | 1521 | if (ch) { |
1654 | printk(KERN_INFO "%s() ch=NULL\n", __FUNCTION__); | 1522 | dev = ch->netdev; |
1655 | return; | 1523 | if (dev) { |
1656 | } | 1524 | priv = dev->priv; |
1657 | if (ch->netdev == NULL) { | 1525 | if (priv) { |
1658 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | 1526 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1659 | return; | 1527 | "%s: %s: %s\n", |
1528 | CTCM_FUNTAIL, dev->name, ch->id); | ||
1529 | grp = priv->mpcg; | ||
1530 | grp->send_qllc_disc = 1; | ||
1531 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
1532 | } | ||
1533 | } | ||
1660 | } | 1534 | } |
1661 | 1535 | ||
1662 | ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); | ||
1663 | |||
1664 | grp->send_qllc_disc = 1; | ||
1665 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
1666 | |||
1667 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
1668 | return; | 1536 | return; |
1669 | } | 1537 | } |
1670 | 1538 | ||
@@ -1675,26 +1543,9 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) | |||
1675 | */ | 1543 | */ |
1676 | void mpc_action_send_discontact(unsigned long thischan) | 1544 | void mpc_action_send_discontact(unsigned long thischan) |
1677 | { | 1545 | { |
1678 | struct channel *ch; | 1546 | int rc; |
1679 | struct net_device *dev; | 1547 | struct channel *ch = (struct channel *)thischan; |
1680 | struct ctcm_priv *priv; | 1548 | unsigned long saveflags = 0; |
1681 | struct mpc_group *grp; | ||
1682 | int rc = 0; | ||
1683 | unsigned long saveflags; | ||
1684 | |||
1685 | ch = (struct channel *)thischan; | ||
1686 | dev = ch->netdev; | ||
1687 | priv = dev->priv; | ||
1688 | grp = priv->mpcg; | ||
1689 | |||
1690 | ctcm_pr_info("ctcmpc: %s cp:%i enter: %s() GrpState:%s ChState:%s\n", | ||
1691 | dev->name, | ||
1692 | smp_processor_id(), | ||
1693 | __FUNCTION__, | ||
1694 | fsm_getstate_str(grp->fsm), | ||
1695 | fsm_getstate_str(ch->fsm)); | ||
1696 | saveflags = 0; /* avoids compiler warning with | ||
1697 | spin_unlock_irqrestore */ | ||
1698 | 1549 | ||
1699 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); | 1550 | spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); |
1700 | rc = ccw_device_start(ch->cdev, &ch->ccw[15], | 1551 | rc = ccw_device_start(ch->cdev, &ch->ccw[15], |
@@ -1702,16 +1553,9 @@ void mpc_action_send_discontact(unsigned long thischan) | |||
1702 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); | 1553 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); |
1703 | 1554 | ||
1704 | if (rc != 0) { | 1555 | if (rc != 0) { |
1705 | ctcm_pr_info("ctcmpc: %s() ch:%s IO failed \n", | 1556 | ctcm_ccw_check_rc(ch, rc, (char *)__func__); |
1706 | __FUNCTION__, | ||
1707 | ch->id); | ||
1708 | ctcm_ccw_check_rc(ch, rc, "send discontact"); | ||
1709 | /* Not checking return code value here */ | ||
1710 | /* Making best effort to notify partner*/ | ||
1711 | /* that MPC Group is going down */ | ||
1712 | } | 1557 | } |
1713 | 1558 | ||
1714 | ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); | ||
1715 | return; | 1559 | return; |
1716 | } | 1560 | } |
1717 | 1561 | ||
@@ -1723,49 +1567,50 @@ void mpc_action_send_discontact(unsigned long thischan) | |||
1723 | */ | 1567 | */ |
1724 | static int mpc_validate_xid(struct mpcg_info *mpcginfo) | 1568 | static int mpc_validate_xid(struct mpcg_info *mpcginfo) |
1725 | { | 1569 | { |
1726 | struct channel *ch = mpcginfo->ch; | 1570 | struct channel *ch = mpcginfo->ch; |
1727 | struct net_device *dev = ch->netdev; | 1571 | struct net_device *dev = ch->netdev; |
1728 | struct ctcm_priv *priv = dev->priv; | 1572 | struct ctcm_priv *priv = dev->priv; |
1729 | struct mpc_group *grp = priv->mpcg; | 1573 | struct mpc_group *grp = priv->mpcg; |
1730 | struct xid2 *xid = mpcginfo->xid; | 1574 | struct xid2 *xid = mpcginfo->xid; |
1731 | int failed = 0; | 1575 | int rc = 0; |
1732 | int rc = 0; | 1576 | __u64 our_id = 0; |
1733 | __u64 our_id, their_id = 0; | 1577 | __u64 their_id = 0; |
1734 | int len; | 1578 | int len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; |
1735 | |||
1736 | len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; | ||
1737 | 1579 | ||
1738 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | 1580 | CTCM_PR_DEBUG("Enter %s: xid=%p\n", __func__, xid); |
1739 | 1581 | ||
1740 | if (mpcginfo->xid == NULL) { | 1582 | if (xid == NULL) { |
1741 | printk(KERN_INFO "%s() xid=NULL\n", __FUNCTION__); | ||
1742 | rc = 1; | 1583 | rc = 1; |
1743 | goto done; | 1584 | /* XID REJECTED: xid == NULL */ |
1585 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, | ||
1586 | "%s(%s): xid = NULL", | ||
1587 | CTCM_FUNTAIL, ch->id); | ||
1588 | goto done; | ||
1744 | } | 1589 | } |
1745 | 1590 | ||
1746 | ctcm_pr_debug("ctcmpc : %s xid received()\n", __FUNCTION__); | 1591 | CTCM_D3_DUMP((char *)xid, XID2_LENGTH); |
1747 | ctcmpc_dumpit((char *)mpcginfo->xid, XID2_LENGTH); | ||
1748 | 1592 | ||
1749 | /*the received direction should be the opposite of ours */ | 1593 | /*the received direction should be the opposite of ours */ |
1750 | if (((CHANNEL_DIRECTION(ch->flags) == READ) ? XID2_WRITE_SIDE : | 1594 | if (((CHANNEL_DIRECTION(ch->flags) == READ) ? XID2_WRITE_SIDE : |
1751 | XID2_READ_SIDE) != xid->xid2_dlc_type) { | 1595 | XID2_READ_SIDE) != xid->xid2_dlc_type) { |
1752 | failed = 1; | 1596 | rc = 2; |
1753 | printk(KERN_INFO "ctcmpc:%s() XID REJECTED - READ-WRITE CH " | 1597 | /* XID REJECTED: r/w channel pairing mismatch */ |
1754 | "Pairing Invalid \n", __FUNCTION__); | 1598 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1599 | "%s(%s): r/w channel pairing mismatch", | ||
1600 | CTCM_FUNTAIL, ch->id); | ||
1601 | goto done; | ||
1755 | } | 1602 | } |
1756 | 1603 | ||
1757 | if (xid->xid2_dlc_type == XID2_READ_SIDE) { | 1604 | if (xid->xid2_dlc_type == XID2_READ_SIDE) { |
1758 | ctcm_pr_debug("ctcmpc: %s(): grpmaxbuf:%d xid2buflen:%d\n", | 1605 | CTCM_PR_DEBUG("%s: grpmaxbuf:%d xid2buflen:%d\n", __func__, |
1759 | __FUNCTION__, grp->group_max_buflen, | 1606 | grp->group_max_buflen, xid->xid2_buf_len); |
1760 | xid->xid2_buf_len); | ||
1761 | 1607 | ||
1762 | if (grp->group_max_buflen == 0 || | 1608 | if (grp->group_max_buflen == 0 || grp->group_max_buflen > |
1763 | grp->group_max_buflen > xid->xid2_buf_len - len) | 1609 | xid->xid2_buf_len - len) |
1764 | grp->group_max_buflen = xid->xid2_buf_len - len; | 1610 | grp->group_max_buflen = xid->xid2_buf_len - len; |
1765 | } | 1611 | } |
1766 | 1612 | ||
1767 | 1613 | if (grp->saved_xid2 == NULL) { | |
1768 | if (grp->saved_xid2 == NULL) { | ||
1769 | grp->saved_xid2 = | 1614 | grp->saved_xid2 = |
1770 | (struct xid2 *)skb_tail_pointer(grp->rcvd_xid_skb); | 1615 | (struct xid2 *)skb_tail_pointer(grp->rcvd_xid_skb); |
1771 | 1616 | ||
@@ -1786,49 +1631,54 @@ static int mpc_validate_xid(struct mpcg_info *mpcginfo) | |||
1786 | /* lower id assume the xside role */ | 1631 | /* lower id assume the xside role */ |
1787 | if (our_id < their_id) { | 1632 | if (our_id < their_id) { |
1788 | grp->roll = XSIDE; | 1633 | grp->roll = XSIDE; |
1789 | ctcm_pr_debug("ctcmpc :%s() WE HAVE LOW ID-" | 1634 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1790 | "TAKE XSIDE\n", __FUNCTION__); | 1635 | "%s(%s): WE HAVE LOW ID - TAKE XSIDE", |
1636 | CTCM_FUNTAIL, ch->id); | ||
1791 | } else { | 1637 | } else { |
1792 | grp->roll = YSIDE; | 1638 | grp->roll = YSIDE; |
1793 | ctcm_pr_debug("ctcmpc :%s() WE HAVE HIGH ID-" | 1639 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, |
1794 | "TAKE YSIDE\n", __FUNCTION__); | 1640 | "%s(%s): WE HAVE HIGH ID - TAKE YSIDE", |
1641 | CTCM_FUNTAIL, ch->id); | ||
1795 | } | 1642 | } |
1796 | 1643 | ||
1797 | } else { | 1644 | } else { |
1798 | if (xid->xid2_flag4 != grp->saved_xid2->xid2_flag4) { | 1645 | if (xid->xid2_flag4 != grp->saved_xid2->xid2_flag4) { |
1799 | failed = 1; | 1646 | rc = 3; |
1800 | printk(KERN_INFO "%s XID REJECTED - XID Flag Byte4\n", | 1647 | /* XID REJECTED: xid flag byte4 mismatch */ |
1801 | __FUNCTION__); | 1648 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1649 | "%s(%s): xid flag byte4 mismatch", | ||
1650 | CTCM_FUNTAIL, ch->id); | ||
1802 | } | 1651 | } |
1803 | if (xid->xid2_flag2 == 0x40) { | 1652 | if (xid->xid2_flag2 == 0x40) { |
1804 | failed = 1; | 1653 | rc = 4; |
1805 | printk(KERN_INFO "%s XID REJECTED - XID NOGOOD\n", | 1654 | /* XID REJECTED - xid NOGOOD */ |
1806 | __FUNCTION__); | 1655 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1656 | "%s(%s): xid NOGOOD", | ||
1657 | CTCM_FUNTAIL, ch->id); | ||
1807 | } | 1658 | } |
1808 | if (xid->xid2_adj_id != grp->saved_xid2->xid2_adj_id) { | 1659 | if (xid->xid2_adj_id != grp->saved_xid2->xid2_adj_id) { |
1809 | failed = 1; | 1660 | rc = 5; |
1810 | printk(KERN_INFO "%s XID REJECTED - " | 1661 | /* XID REJECTED - Adjacent Station ID Mismatch */ |
1811 | "Adjacent Station ID Mismatch\n", | 1662 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1812 | __FUNCTION__); | 1663 | "%s(%s): Adjacent Station ID Mismatch", |
1664 | CTCM_FUNTAIL, ch->id); | ||
1813 | } | 1665 | } |
1814 | if (xid->xid2_sender_id != grp->saved_xid2->xid2_sender_id) { | 1666 | if (xid->xid2_sender_id != grp->saved_xid2->xid2_sender_id) { |
1815 | failed = 1; | 1667 | rc = 6; |
1816 | printk(KERN_INFO "%s XID REJECTED - " | 1668 | /* XID REJECTED - Sender Address Mismatch */ |
1817 | "Sender Address Mismatch\n", __FUNCTION__); | 1669 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
1818 | 1670 | "%s(%s): Sender Address Mismatch", | |
1671 | CTCM_FUNTAIL, ch->id); | ||
1819 | } | 1672 | } |
1820 | } | 1673 | } |
1821 | 1674 | ||
1822 | if (failed) { | 1675 | done: |
1676 | if (rc) { | ||
1823 | ctcm_pr_info("ctcmpc : %s() failed\n", __FUNCTION__); | 1677 | ctcm_pr_info("ctcmpc : %s() failed\n", __FUNCTION__); |
1824 | priv->xid->xid2_flag2 = 0x40; | 1678 | priv->xid->xid2_flag2 = 0x40; |
1825 | grp->saved_xid2->xid2_flag2 = 0x40; | 1679 | grp->saved_xid2->xid2_flag2 = 0x40; |
1826 | rc = 1; | ||
1827 | } | 1680 | } |
1828 | 1681 | ||
1829 | done: | ||
1830 | |||
1831 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
1832 | return rc; | 1682 | return rc; |
1833 | } | 1683 | } |
1834 | 1684 | ||
@@ -1839,46 +1689,20 @@ done: | |||
1839 | static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | 1689 | static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) |
1840 | { | 1690 | { |
1841 | struct channel *ch = arg; | 1691 | struct channel *ch = arg; |
1842 | struct ctcm_priv *priv; | ||
1843 | struct mpc_group *grp = NULL; | ||
1844 | struct net_device *dev = NULL; | ||
1845 | int rc = 0; | 1692 | int rc = 0; |
1846 | int gotlock = 0; | 1693 | int gotlock = 0; |
1847 | unsigned long saveflags = 0; /* avoids compiler warning with | 1694 | unsigned long saveflags = 0; /* avoids compiler warning with |
1848 | spin_unlock_irqrestore */ | 1695 | spin_unlock_irqrestore */ |
1849 | |||
1850 | if (ch == NULL) { | ||
1851 | printk(KERN_INFO "%s ch=NULL\n", __FUNCTION__); | ||
1852 | goto done; | ||
1853 | } | ||
1854 | |||
1855 | if (do_debug) | ||
1856 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | ||
1857 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
1858 | |||
1859 | dev = ch->netdev; | ||
1860 | if (dev == NULL) { | ||
1861 | printk(KERN_INFO "%s dev=NULL\n", __FUNCTION__); | ||
1862 | goto done; | ||
1863 | } | ||
1864 | |||
1865 | priv = dev->priv; | ||
1866 | if (priv == NULL) { | ||
1867 | printk(KERN_INFO "%s priv=NULL\n", __FUNCTION__); | ||
1868 | goto done; | ||
1869 | } | ||
1870 | 1696 | ||
1871 | grp = priv->mpcg; | 1697 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
1872 | if (grp == NULL) { | 1698 | __func__, smp_processor_id(), ch, ch->id); |
1873 | printk(KERN_INFO "%s grp=NULL\n", __FUNCTION__); | ||
1874 | goto done; | ||
1875 | } | ||
1876 | 1699 | ||
1877 | if (ctcm_checkalloc_buffer(ch)) | 1700 | if (ctcm_checkalloc_buffer(ch)) |
1878 | goto done; | 1701 | goto done; |
1879 | 1702 | ||
1880 | /* skb data-buffer referencing: */ | 1703 | /* |
1881 | 1704 | * skb data-buffer referencing: | |
1705 | */ | ||
1882 | ch->trans_skb->data = ch->trans_skb_data; | 1706 | ch->trans_skb->data = ch->trans_skb_data; |
1883 | skb_reset_tail_pointer(ch->trans_skb); | 1707 | skb_reset_tail_pointer(ch->trans_skb); |
1884 | ch->trans_skb->len = 0; | 1708 | ch->trans_skb->len = 0; |
@@ -1911,22 +1735,22 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
1911 | ch->ccw[8].count = 0; | 1735 | ch->ccw[8].count = 0; |
1912 | ch->ccw[8].cda = 0x00; | 1736 | ch->ccw[8].cda = 0x00; |
1913 | 1737 | ||
1738 | if (!(ch->xid_th && ch->xid && ch->xid_id)) | ||
1739 | CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_INFO, | ||
1740 | "%s(%s): xid_th=%p, xid=%p, xid_id=%p", | ||
1741 | CTCM_FUNTAIL, ch->id, ch->xid_th, ch->xid, ch->xid_id); | ||
1742 | |||
1914 | if (side == XSIDE) { | 1743 | if (side == XSIDE) { |
1915 | /* mpc_action_xside_xid */ | 1744 | /* mpc_action_xside_xid */ |
1916 | if (ch->xid_th == NULL) { | 1745 | if (ch->xid_th == NULL) |
1917 | printk(KERN_INFO "%s ch->xid_th=NULL\n", __FUNCTION__); | 1746 | goto done; |
1918 | goto done; | ||
1919 | } | ||
1920 | ch->ccw[9].cmd_code = CCW_CMD_WRITE; | 1747 | ch->ccw[9].cmd_code = CCW_CMD_WRITE; |
1921 | ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1748 | ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1922 | ch->ccw[9].count = TH_HEADER_LENGTH; | 1749 | ch->ccw[9].count = TH_HEADER_LENGTH; |
1923 | ch->ccw[9].cda = virt_to_phys(ch->xid_th); | 1750 | ch->ccw[9].cda = virt_to_phys(ch->xid_th); |
1924 | 1751 | ||
1925 | if (ch->xid == NULL) { | 1752 | if (ch->xid == NULL) |
1926 | printk(KERN_INFO "%s ch->xid=NULL\n", __FUNCTION__); | 1753 | goto done; |
1927 | goto done; | ||
1928 | } | ||
1929 | |||
1930 | ch->ccw[10].cmd_code = CCW_CMD_WRITE; | 1754 | ch->ccw[10].cmd_code = CCW_CMD_WRITE; |
1931 | ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1755 | ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1932 | ch->ccw[10].count = XID2_LENGTH; | 1756 | ch->ccw[10].count = XID2_LENGTH; |
@@ -1956,28 +1780,22 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
1956 | ch->ccw[10].count = XID2_LENGTH; | 1780 | ch->ccw[10].count = XID2_LENGTH; |
1957 | ch->ccw[10].cda = virt_to_phys(ch->rcvd_xid); | 1781 | ch->ccw[10].cda = virt_to_phys(ch->rcvd_xid); |
1958 | 1782 | ||
1959 | if (ch->xid_th == NULL) { | 1783 | if (ch->xid_th == NULL) |
1960 | printk(KERN_INFO "%s ch->xid_th=NULL\n", __FUNCTION__); | 1784 | goto done; |
1961 | goto done; | ||
1962 | } | ||
1963 | ch->ccw[11].cmd_code = CCW_CMD_WRITE; | 1785 | ch->ccw[11].cmd_code = CCW_CMD_WRITE; |
1964 | ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1786 | ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1965 | ch->ccw[11].count = TH_HEADER_LENGTH; | 1787 | ch->ccw[11].count = TH_HEADER_LENGTH; |
1966 | ch->ccw[11].cda = virt_to_phys(ch->xid_th); | 1788 | ch->ccw[11].cda = virt_to_phys(ch->xid_th); |
1967 | 1789 | ||
1968 | if (ch->xid == NULL) { | 1790 | if (ch->xid == NULL) |
1969 | printk(KERN_INFO "%s ch->xid=NULL\n", __FUNCTION__); | 1791 | goto done; |
1970 | goto done; | ||
1971 | } | ||
1972 | ch->ccw[12].cmd_code = CCW_CMD_WRITE; | 1792 | ch->ccw[12].cmd_code = CCW_CMD_WRITE; |
1973 | ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 1793 | ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
1974 | ch->ccw[12].count = XID2_LENGTH; | 1794 | ch->ccw[12].count = XID2_LENGTH; |
1975 | ch->ccw[12].cda = virt_to_phys(ch->xid); | 1795 | ch->ccw[12].cda = virt_to_phys(ch->xid); |
1976 | 1796 | ||
1977 | if (ch->xid_id == NULL) { | 1797 | if (ch->xid_id == NULL) |
1978 | printk(KERN_INFO "%s ch->xid_id=NULL\n", __FUNCTION__); | 1798 | goto done; |
1979 | goto done; | ||
1980 | } | ||
1981 | ch->ccw[13].cmd_code = CCW_CMD_WRITE; | 1799 | ch->ccw[13].cmd_code = CCW_CMD_WRITE; |
1982 | ch->ccw[13].cda = virt_to_phys(ch->xid_id); | 1800 | ch->ccw[13].cda = virt_to_phys(ch->xid_id); |
1983 | 1801 | ||
@@ -1990,12 +1808,11 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
1990 | ch->ccw[14].count = 0; | 1808 | ch->ccw[14].count = 0; |
1991 | ch->ccw[14].cda = 0; | 1809 | ch->ccw[14].cda = 0; |
1992 | 1810 | ||
1993 | if (do_debug_ccw) | 1811 | CTCM_CCW_DUMP((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); |
1994 | ctcmpc_dumpit((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); | 1812 | CTCM_D3_DUMP((char *)ch->xid_th, TH_HEADER_LENGTH); |
1813 | CTCM_D3_DUMP((char *)ch->xid, XID2_LENGTH); | ||
1814 | CTCM_D3_DUMP((char *)ch->xid_id, 4); | ||
1995 | 1815 | ||
1996 | ctcmpc_dumpit((char *)ch->xid_th, TH_HEADER_LENGTH); | ||
1997 | ctcmpc_dumpit((char *)ch->xid, XID2_LENGTH); | ||
1998 | ctcmpc_dumpit((char *)ch->xid_id, 4); | ||
1999 | if (!in_irq()) { | 1816 | if (!in_irq()) { |
2000 | /* Such conditional locking is a known problem for | 1817 | /* Such conditional locking is a known problem for |
2001 | * sparse because its static undeterministic. | 1818 | * sparse because its static undeterministic. |
@@ -2012,16 +1829,13 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) | |||
2012 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); | 1829 | spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); |
2013 | 1830 | ||
2014 | if (rc != 0) { | 1831 | if (rc != 0) { |
2015 | ctcm_pr_info("ctcmpc: %s() ch:%s IO failed \n", | ||
2016 | __FUNCTION__, ch->id); | ||
2017 | ctcm_ccw_check_rc(ch, rc, | 1832 | ctcm_ccw_check_rc(ch, rc, |
2018 | (side == XSIDE) ? "x-side XID" : "y-side XID"); | 1833 | (side == XSIDE) ? "x-side XID" : "y-side XID"); |
2019 | } | 1834 | } |
2020 | 1835 | ||
2021 | done: | 1836 | done: |
2022 | if (do_debug) | 1837 | CTCM_PR_DEBUG("Exit %s: ch=0x%p id=%s\n", |
2023 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | 1838 | __func__, ch, ch->id); |
2024 | __FUNCTION__, ch, ch->id); | ||
2025 | return; | 1839 | return; |
2026 | 1840 | ||
2027 | } | 1841 | } |
@@ -2050,41 +1864,19 @@ static void mpc_action_yside_xid(fsm_instance *fsm, int event, void *arg) | |||
2050 | */ | 1864 | */ |
2051 | static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) | 1865 | static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) |
2052 | { | 1866 | { |
2053 | struct channel *ch = arg; | 1867 | struct channel *ch = arg; |
2054 | struct ctcm_priv *priv; | 1868 | struct net_device *dev = ch->netdev; |
2055 | struct mpc_group *grp = NULL; | 1869 | struct ctcm_priv *priv = dev->priv; |
2056 | struct net_device *dev = NULL; | 1870 | struct mpc_group *grp = priv->mpcg; |
2057 | |||
2058 | if (do_debug) | ||
2059 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | ||
2060 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
2061 | |||
2062 | if (ch == NULL) { | ||
2063 | printk(KERN_WARNING "%s ch=NULL\n", __FUNCTION__); | ||
2064 | goto done; | ||
2065 | } | ||
2066 | |||
2067 | dev = ch->netdev; | ||
2068 | if (dev == NULL) { | ||
2069 | printk(KERN_WARNING "%s dev=NULL\n", __FUNCTION__); | ||
2070 | goto done; | ||
2071 | } | ||
2072 | |||
2073 | priv = dev->priv; | ||
2074 | if (priv == NULL) { | ||
2075 | printk(KERN_WARNING "%s priv=NULL\n", __FUNCTION__); | ||
2076 | goto done; | ||
2077 | } | ||
2078 | 1871 | ||
2079 | grp = priv->mpcg; | 1872 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
2080 | if (grp == NULL) { | 1873 | __func__, smp_processor_id(), ch, ch->id); |
2081 | printk(KERN_WARNING "%s grp=NULL\n", __FUNCTION__); | ||
2082 | goto done; | ||
2083 | } | ||
2084 | 1874 | ||
2085 | if (ch->xid == NULL) { | 1875 | if (ch->xid == NULL) { |
2086 | printk(KERN_WARNING "%s ch-xid=NULL\n", __FUNCTION__); | 1876 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2087 | goto done; | 1877 | "%s(%s): ch->xid == NULL", |
1878 | CTCM_FUNTAIL, dev->name); | ||
1879 | return; | ||
2088 | } | 1880 | } |
2089 | 1881 | ||
2090 | fsm_newstate(ch->fsm, CH_XID0_INPROGRESS); | 1882 | fsm_newstate(ch->fsm, CH_XID0_INPROGRESS); |
@@ -2104,12 +1896,7 @@ static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) | |||
2104 | 1896 | ||
2105 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); | 1897 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); |
2106 | 1898 | ||
2107 | done: | ||
2108 | if (do_debug) | ||
2109 | ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", | ||
2110 | __FUNCTION__, ch, ch->id); | ||
2111 | return; | 1899 | return; |
2112 | |||
2113 | } | 1900 | } |
2114 | 1901 | ||
2115 | /* | 1902 | /* |
@@ -2119,32 +1906,16 @@ done: | |||
2119 | static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) | 1906 | static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) |
2120 | { | 1907 | { |
2121 | struct net_device *dev = arg; | 1908 | struct net_device *dev = arg; |
2122 | struct ctcm_priv *priv = NULL; | 1909 | struct ctcm_priv *priv = dev->priv; |
2123 | struct mpc_group *grp = NULL; | 1910 | struct mpc_group *grp = NULL; |
2124 | int direction; | 1911 | int direction; |
2125 | int rc = 0; | ||
2126 | int send = 0; | 1912 | int send = 0; |
2127 | 1913 | ||
2128 | ctcm_pr_debug("ctcmpc enter: %s() \n", __FUNCTION__); | 1914 | if (priv) |
2129 | 1915 | grp = priv->mpcg; | |
2130 | if (dev == NULL) { | ||
2131 | printk(KERN_INFO "%s dev=NULL \n", __FUNCTION__); | ||
2132 | rc = 1; | ||
2133 | goto done; | ||
2134 | } | ||
2135 | |||
2136 | priv = dev->priv; | ||
2137 | if (priv == NULL) { | ||
2138 | printk(KERN_INFO "%s priv=NULL \n", __FUNCTION__); | ||
2139 | rc = 1; | ||
2140 | goto done; | ||
2141 | } | ||
2142 | |||
2143 | grp = priv->mpcg; | ||
2144 | if (grp == NULL) { | 1916 | if (grp == NULL) { |
2145 | printk(KERN_INFO "%s grp=NULL \n", __FUNCTION__); | 1917 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); |
2146 | rc = 1; | 1918 | return; |
2147 | goto done; | ||
2148 | } | 1919 | } |
2149 | 1920 | ||
2150 | for (direction = READ; direction <= WRITE; direction++) { | 1921 | for (direction = READ; direction <= WRITE; direction++) { |
@@ -2199,11 +1970,6 @@ static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) | |||
2199 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); | 1970 | fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); |
2200 | } | 1971 | } |
2201 | 1972 | ||
2202 | done: | ||
2203 | |||
2204 | if (rc != 0) | ||
2205 | fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); | ||
2206 | |||
2207 | return; | 1973 | return; |
2208 | } | 1974 | } |
2209 | 1975 | ||
@@ -2214,24 +1980,15 @@ done: | |||
2214 | static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) | 1980 | static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) |
2215 | { | 1981 | { |
2216 | 1982 | ||
2217 | struct mpcg_info *mpcginfo = arg; | 1983 | struct mpcg_info *mpcginfo = arg; |
2218 | struct channel *ch = mpcginfo->ch; | 1984 | struct channel *ch = mpcginfo->ch; |
2219 | struct net_device *dev = ch->netdev; | 1985 | struct net_device *dev = ch->netdev; |
2220 | struct ctcm_priv *priv; | 1986 | struct ctcm_priv *priv = dev->priv; |
2221 | struct mpc_group *grp; | 1987 | struct mpc_group *grp = priv->mpcg; |
2222 | |||
2223 | if (do_debug) | ||
2224 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | ||
2225 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
2226 | |||
2227 | priv = dev->priv; | ||
2228 | grp = priv->mpcg; | ||
2229 | 1988 | ||
2230 | ctcm_pr_debug("ctcmpc in:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", | 1989 | CTCM_PR_DEBUG("%s: ch-id:%s xid2:%i xid7:%i xidt_p2:%i \n", |
2231 | __FUNCTION__, ch->id, | 1990 | __func__, ch->id, grp->outstanding_xid2, |
2232 | grp->outstanding_xid2, | 1991 | grp->outstanding_xid7, grp->outstanding_xid7_p2); |
2233 | grp->outstanding_xid7, | ||
2234 | grp->outstanding_xid7_p2); | ||
2235 | 1992 | ||
2236 | if (fsm_getstate(ch->fsm) < CH_XID7_PENDING) | 1993 | if (fsm_getstate(ch->fsm) < CH_XID7_PENDING) |
2237 | fsm_newstate(ch->fsm, CH_XID7_PENDING); | 1994 | fsm_newstate(ch->fsm, CH_XID7_PENDING); |
@@ -2268,17 +2025,12 @@ static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) | |||
2268 | } | 2025 | } |
2269 | kfree(mpcginfo); | 2026 | kfree(mpcginfo); |
2270 | 2027 | ||
2271 | if (do_debug) { | 2028 | CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", |
2272 | ctcm_pr_debug("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", | 2029 | __func__, ch->id, grp->outstanding_xid2, |
2273 | __FUNCTION__, ch->id, | 2030 | grp->outstanding_xid7, grp->outstanding_xid7_p2); |
2274 | grp->outstanding_xid2, | 2031 | CTCM_PR_DEBUG("ctcmpc:%s() %s grpstate: %s chanstate: %s \n", |
2275 | grp->outstanding_xid7, | 2032 | __func__, ch->id, |
2276 | grp->outstanding_xid7_p2); | 2033 | fsm_getstate_str(grp->fsm), fsm_getstate_str(ch->fsm)); |
2277 | ctcm_pr_debug("ctcmpc:%s() %s grpstate: %s chanstate: %s \n", | ||
2278 | __FUNCTION__, ch->id, | ||
2279 | fsm_getstate_str(grp->fsm), | ||
2280 | fsm_getstate_str(ch->fsm)); | ||
2281 | } | ||
2282 | return; | 2034 | return; |
2283 | 2035 | ||
2284 | } | 2036 | } |
@@ -2296,15 +2048,10 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
2296 | struct ctcm_priv *priv = dev->priv; | 2048 | struct ctcm_priv *priv = dev->priv; |
2297 | struct mpc_group *grp = priv->mpcg; | 2049 | struct mpc_group *grp = priv->mpcg; |
2298 | 2050 | ||
2299 | if (do_debug) { | 2051 | CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", |
2300 | ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", | 2052 | __func__, smp_processor_id(), ch, ch->id); |
2301 | __FUNCTION__, smp_processor_id(), ch, ch->id); | 2053 | CTCM_PR_DEBUG("%s: outstanding_xid7: %i, outstanding_xid7_p2: %i\n", |
2302 | 2054 | __func__, grp->outstanding_xid7, grp->outstanding_xid7_p2); | |
2303 | ctcm_pr_debug("ctcmpc: outstanding_xid7: %i, " | ||
2304 | " outstanding_xid7_p2: %i\n", | ||
2305 | grp->outstanding_xid7, | ||
2306 | grp->outstanding_xid7_p2); | ||
2307 | } | ||
2308 | 2055 | ||
2309 | grp->outstanding_xid7--; | 2056 | grp->outstanding_xid7--; |
2310 | ch->xid_skb->data = ch->xid_skb_data; | 2057 | ch->xid_skb->data = ch->xid_skb_data; |
@@ -2337,14 +2084,8 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
2337 | mpc_validate_xid(mpcginfo); | 2084 | mpc_validate_xid(mpcginfo); |
2338 | break; | 2085 | break; |
2339 | } | 2086 | } |
2340 | |||
2341 | kfree(mpcginfo); | 2087 | kfree(mpcginfo); |
2342 | |||
2343 | if (do_debug) | ||
2344 | ctcm_pr_debug("ctcmpc exit: %s(): cp=%i ch=0x%p id=%s\n", | ||
2345 | __FUNCTION__, smp_processor_id(), ch, ch->id); | ||
2346 | return; | 2088 | return; |
2347 | |||
2348 | } | 2089 | } |
2349 | 2090 | ||
2350 | /* | 2091 | /* |
@@ -2353,36 +2094,14 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) | |||
2353 | */ | 2094 | */ |
2354 | static int mpc_send_qllc_discontact(struct net_device *dev) | 2095 | static int mpc_send_qllc_discontact(struct net_device *dev) |
2355 | { | 2096 | { |
2356 | int rc = 0; | ||
2357 | __u32 new_len = 0; | 2097 | __u32 new_len = 0; |
2358 | struct sk_buff *skb; | 2098 | struct sk_buff *skb; |
2359 | struct qllc *qllcptr; | 2099 | struct qllc *qllcptr; |
2360 | struct ctcm_priv *priv; | 2100 | struct ctcm_priv *priv = dev->priv; |
2361 | struct mpc_group *grp; | 2101 | struct mpc_group *grp = priv->mpcg; |
2362 | |||
2363 | ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); | ||
2364 | |||
2365 | if (dev == NULL) { | ||
2366 | printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); | ||
2367 | rc = 1; | ||
2368 | goto done; | ||
2369 | } | ||
2370 | |||
2371 | priv = dev->priv; | ||
2372 | if (priv == NULL) { | ||
2373 | printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); | ||
2374 | rc = 1; | ||
2375 | goto done; | ||
2376 | } | ||
2377 | 2102 | ||
2378 | grp = priv->mpcg; | 2103 | CTCM_PR_DEBUG("%s: GROUP STATE: %s\n", |
2379 | if (grp == NULL) { | 2104 | __func__, mpcg_state_names[grp->saved_state]); |
2380 | printk(KERN_INFO "%s() grp=NULL\n", __FUNCTION__); | ||
2381 | rc = 1; | ||
2382 | goto done; | ||
2383 | } | ||
2384 | ctcm_pr_info("ctcmpc: %s() GROUP STATE: %s\n", __FUNCTION__, | ||
2385 | mpcg_state_names[grp->saved_state]); | ||
2386 | 2105 | ||
2387 | switch (grp->saved_state) { | 2106 | switch (grp->saved_state) { |
2388 | /* | 2107 | /* |
@@ -2408,11 +2127,10 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2408 | new_len = sizeof(struct qllc); | 2127 | new_len = sizeof(struct qllc); |
2409 | qllcptr = kzalloc(new_len, gfp_type() | GFP_DMA); | 2128 | qllcptr = kzalloc(new_len, gfp_type() | GFP_DMA); |
2410 | if (qllcptr == NULL) { | 2129 | if (qllcptr == NULL) { |
2411 | printk(KERN_INFO | 2130 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2412 | "ctcmpc: Out of memory in %s()\n", | 2131 | "%s(%s): qllcptr allocation error", |
2413 | dev->name); | 2132 | CTCM_FUNTAIL, dev->name); |
2414 | rc = 1; | 2133 | return -ENOMEM; |
2415 | goto done; | ||
2416 | } | 2134 | } |
2417 | 2135 | ||
2418 | qllcptr->qllc_address = 0xcc; | 2136 | qllcptr->qllc_address = 0xcc; |
@@ -2421,31 +2139,29 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2421 | skb = __dev_alloc_skb(new_len, GFP_ATOMIC); | 2139 | skb = __dev_alloc_skb(new_len, GFP_ATOMIC); |
2422 | 2140 | ||
2423 | if (skb == NULL) { | 2141 | if (skb == NULL) { |
2424 | printk(KERN_INFO "%s Out of memory in mpc_send_qllc\n", | 2142 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2425 | dev->name); | 2143 | "%s(%s): skb allocation error", |
2144 | CTCM_FUNTAIL, dev->name); | ||
2426 | priv->stats.rx_dropped++; | 2145 | priv->stats.rx_dropped++; |
2427 | rc = 1; | ||
2428 | kfree(qllcptr); | 2146 | kfree(qllcptr); |
2429 | goto done; | 2147 | return -ENOMEM; |
2430 | } | 2148 | } |
2431 | 2149 | ||
2432 | memcpy(skb_put(skb, new_len), qllcptr, new_len); | 2150 | memcpy(skb_put(skb, new_len), qllcptr, new_len); |
2433 | kfree(qllcptr); | 2151 | kfree(qllcptr); |
2434 | 2152 | ||
2435 | if (skb_headroom(skb) < 4) { | 2153 | if (skb_headroom(skb) < 4) { |
2436 | printk(KERN_INFO "ctcmpc: %s() Unable to" | 2154 | CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, |
2437 | " build discontact for %s\n", | 2155 | "%s(%s): skb_headroom error", |
2438 | __FUNCTION__, dev->name); | 2156 | CTCM_FUNTAIL, dev->name); |
2439 | rc = 1; | ||
2440 | dev_kfree_skb_any(skb); | 2157 | dev_kfree_skb_any(skb); |
2441 | goto done; | 2158 | return -ENOMEM; |
2442 | } | 2159 | } |
2443 | 2160 | ||
2444 | *((__u32 *)skb_push(skb, 4)) = priv->channel[READ]->pdu_seq; | 2161 | *((__u32 *)skb_push(skb, 4)) = priv->channel[READ]->pdu_seq; |
2445 | priv->channel[READ]->pdu_seq++; | 2162 | priv->channel[READ]->pdu_seq++; |
2446 | if (do_debug_data) | 2163 | CTCM_PR_DBGDATA("ctcmpc: %s ToDCM_pdu_seq= %08x\n", |
2447 | ctcm_pr_debug("ctcmpc: %s ToDCM_pdu_seq= %08x\n", | 2164 | __func__, priv->channel[READ]->pdu_seq); |
2448 | __FUNCTION__, priv->channel[READ]->pdu_seq); | ||
2449 | 2165 | ||
2450 | /* receipt of CC03 resets anticipated sequence number on | 2166 | /* receipt of CC03 resets anticipated sequence number on |
2451 | receiving side */ | 2167 | receiving side */ |
@@ -2455,7 +2171,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2455 | skb->protocol = htons(ETH_P_SNAP); | 2171 | skb->protocol = htons(ETH_P_SNAP); |
2456 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 2172 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
2457 | 2173 | ||
2458 | ctcmpc_dumpit((char *)skb->data, (sizeof(struct qllc) + 4)); | 2174 | CTCM_D3_DUMP(skb->data, (sizeof(struct qllc) + 4)); |
2459 | 2175 | ||
2460 | netif_rx(skb); | 2176 | netif_rx(skb); |
2461 | break; | 2177 | break; |
@@ -2464,9 +2180,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) | |||
2464 | 2180 | ||
2465 | } | 2181 | } |
2466 | 2182 | ||
2467 | done: | 2183 | return 0; |
2468 | ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); | ||
2469 | return rc; | ||
2470 | } | 2184 | } |
2471 | /* --- This is the END my friend --- */ | 2185 | /* --- This is the END my friend --- */ |
2472 | 2186 | ||
diff --git a/drivers/s390/net/ctcm_mpc.h b/drivers/s390/net/ctcm_mpc.h index f99686069a91..5336120cddf1 100644 --- a/drivers/s390/net/ctcm_mpc.h +++ b/drivers/s390/net/ctcm_mpc.h | |||
@@ -231,7 +231,7 @@ static inline void ctcmpc_dump32(char *buf, int len) | |||
231 | int ctcmpc_open(struct net_device *); | 231 | int ctcmpc_open(struct net_device *); |
232 | void ctcm_ccw_check_rc(struct channel *, int, char *); | 232 | void ctcm_ccw_check_rc(struct channel *, int, char *); |
233 | void mpc_group_ready(unsigned long adev); | 233 | void mpc_group_ready(unsigned long adev); |
234 | int mpc_channel_action(struct channel *ch, int direction, int action); | 234 | void mpc_channel_action(struct channel *ch, int direction, int action); |
235 | void mpc_action_send_discontact(unsigned long thischan); | 235 | void mpc_action_send_discontact(unsigned long thischan); |
236 | void mpc_action_discontact(fsm_instance *fi, int event, void *arg); | 236 | void mpc_action_discontact(fsm_instance *fi, int event, void *arg); |
237 | void ctcmpc_bh(unsigned long thischan); | 237 | void ctcmpc_bh(unsigned long thischan); |