aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/ctcm_fsms.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net/ctcm_fsms.c')
-rw-r--r--drivers/s390/net/ctcm_fsms.c402
1 files changed, 170 insertions, 232 deletions
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);
190void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg) 190void 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 */
426static void chx_firstio(fsm_instance *fi, int event, void *arg) 434static 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 */
584static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) 594static 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 */
744static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) 744static 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 */
772static void ctcm_chx_fail(fsm_instance *fi, int event, void *arg) 771static 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 }
1374done: 1354done:
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
1533done: 1509done:
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);
1600done: 1570done:
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
1756done: 1714done:
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
1889done: 1827done:
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: