Lines Matching refs:ch
769 static __inline__ void ctc_unpack_skb(channel *ch, struct sk_buff *pskb) in ctc_unpack_skb() argument
771 net_device *dev = ch->netdev; in ctc_unpack_skb()
784 if ((ch->protocol == CTC_PROTO_S390) && in ctc_unpack_skb()
787 if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) { in ctc_unpack_skb()
800 ch->logflags |= LOG_FLAG_ILLEGALPKT; in ctc_unpack_skb()
815 if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) { in ctc_unpack_skb()
823 ch->logflags |= LOG_FLAG_ILLEGALSIZE; in ctc_unpack_skb()
839 if (!(ch->logflags & LOG_FLAG_OVERRUN)) { in ctc_unpack_skb()
846 ch->logflags |= LOG_FLAG_OVERRUN; in ctc_unpack_skb()
863 if (!(ch->logflags & LOG_FLAG_NOMEM)) { in ctc_unpack_skb()
869 ch->logflags |= LOG_FLAG_NOMEM; in ctc_unpack_skb()
881 if (ch->protocol == CTC_PROTO_LINUX_TTY) in ctc_unpack_skb()
888 ch->logflags = 0; in ctc_unpack_skb()
895 if (!(ch->logflags & LOG_FLAG_OVERRUN)) { in ctc_unpack_skb()
901 ch->logflags |= LOG_FLAG_OVERRUN; in ctc_unpack_skb()
917 static void ctc_bh(channel *ch) in ctc_bh() argument
921 while ((skb = skb_dequeue(&ch->io_queue))) in ctc_bh()
922 ctc_unpack_skb(ch, skb); in ctc_bh()
931 static void inline ccw_check_return_code (channel *ch, int return_code) in ccw_check_return_code() argument
935 fsm_event(ch->fsm, CH_EVENT_IO_SUCCESS, ch); in ccw_check_return_code()
939 printk(KERN_WARNING "ch-%04x: Busy !\n", ch->devno); in ccw_check_return_code()
940 fsm_event(ch->fsm, CH_EVENT_IO_EBUSY, ch); in ccw_check_return_code()
946 ch->devno); in ccw_check_return_code()
947 fsm_event(ch->fsm, CH_EVENT_IO_ENODEV, ch); in ccw_check_return_code()
952 "ch-%04x: Status pending... \n", ch->devno); in ccw_check_return_code()
953 fsm_event(ch->fsm, CH_EVENT_IO_EIO, ch); in ccw_check_return_code()
959 ch->devno, return_code); in ccw_check_return_code()
960 fsm_event(ch->fsm, CH_EVENT_IO_UNKNOWN, ch); in ccw_check_return_code()
970 static void inline ccw_unit_check (channel *ch, unsigned char sense) { in ccw_unit_check() argument
973 if (ch->protocol != CTC_PROTO_LINUX_TTY) in ccw_unit_check()
977 "(remote)\n", ch->devno); in ccw_unit_check()
978 fsm_event(ch->fsm, CH_EVENT_UC_RCRESET, ch); in ccw_unit_check()
982 ch->devno); in ccw_unit_check()
983 fsm_event(ch->fsm, CH_EVENT_UC_RSRESET, ch); in ccw_unit_check()
990 ch->devno); in ccw_unit_check()
991 fsm_event(ch->fsm, CH_EVENT_UC_HWFAIL, ch); in ccw_unit_check()
996 ch->devno); in ccw_unit_check()
997 fsm_event(ch->fsm, CH_EVENT_UC_RXPARITY, ch); in ccw_unit_check()
1004 ch->devno); in ccw_unit_check()
1005 fsm_event(ch->fsm, CH_EVENT_UC_TXTIMEOUT, ch); in ccw_unit_check()
1010 ch->devno); in ccw_unit_check()
1011 fsm_event(ch->fsm, CH_EVENT_UC_TXPARITY, ch); in ccw_unit_check()
1016 ch->devno); in ccw_unit_check()
1019 printk(KERN_DEBUG "ch-%04x: Unit check ZERO\n", ch->devno); in ccw_unit_check()
1020 fsm_event(ch->fsm, CH_EVENT_UC_ZERO, ch); in ccw_unit_check()
1025 ch->devno, sense); in ccw_unit_check()
1026 fsm_event(ch->fsm, CH_EVENT_UC_UNKNOWN, ch); in ccw_unit_check()
1040 static __inline__ int ctc_checkalloc_buffer(channel *ch, int warn) { in ctc_checkalloc_buffer() argument
1041 if ((ch->trans_skb == NULL) || in ctc_checkalloc_buffer()
1042 (ch->flags & CHANNEL_FLAGS_BUFSIZE_CHANGED)) { in ctc_checkalloc_buffer()
1043 if (ch->trans_skb != NULL) in ctc_checkalloc_buffer()
1044 dev_kfree_skb(ch->trans_skb); in ctc_checkalloc_buffer()
1045 clear_normalized_cda(&ch->ccw[1]); in ctc_checkalloc_buffer()
1046 ch->trans_skb = __dev_alloc_skb(ch->max_bufsize, in ctc_checkalloc_buffer()
1048 if (ch->trans_skb == NULL) { in ctc_checkalloc_buffer()
1052 ch->devno, in ctc_checkalloc_buffer()
1053 (CHANNEL_DIRECTION(ch->flags) == READ) ? in ctc_checkalloc_buffer()
1057 ch->ccw[1].count = ch->max_bufsize; in ctc_checkalloc_buffer()
1058 if (set_normalized_cda(&ch->ccw[1], in ctc_checkalloc_buffer()
1059 virt_to_phys(ch->trans_skb->data))) { in ctc_checkalloc_buffer()
1060 dev_kfree_skb(ch->trans_skb); in ctc_checkalloc_buffer()
1061 ch->trans_skb = NULL; in ctc_checkalloc_buffer()
1066 ch->devno, in ctc_checkalloc_buffer()
1067 (CHANNEL_DIRECTION(ch->flags) == READ) ? in ctc_checkalloc_buffer()
1071 ch->ccw[1].count = 0; in ctc_checkalloc_buffer()
1072 ch->trans_skb_data = ch->trans_skb->data; in ctc_checkalloc_buffer()
1073 ch->flags &= ~CHANNEL_FLAGS_BUFSIZE_CHANGED; in ctc_checkalloc_buffer()
1100 channel *ch = (channel *)arg; in ch_action_txdone() local
1101 net_device *dev = ch->netdev; in ch_action_txdone()
1109 (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + in ch_action_txdone()
1110 done_stamp.tv_usec - ch->prof.send_stamp.tv_usec; in ch_action_txdone()
1111 if (duration > ch->prof.tx_time) in ch_action_txdone()
1112 ch->prof.tx_time = duration; in ch_action_txdone()
1114 if ((ch->devstat->rescnt != 0) && (loglevel & CTC_LOGLEVEL_DEBUG)) in ch_action_txdone()
1116 dev->name, ch->devstat->rescnt); in ch_action_txdone()
1118 fsm_deltimer(&ch->timer); in ch_action_txdone()
1119 while ((skb = skb_dequeue(&ch->io_queue))) { in ch_action_txdone()
1129 spin_lock(&ch->collect_lock); in ch_action_txdone()
1130 clear_normalized_cda(&ch->ccw[4]); in ch_action_txdone()
1131 if (ch->collect_len > 0) { in ch_action_txdone()
1134 if (ctc_checkalloc_buffer(ch, 1)) { in ch_action_txdone()
1135 spin_unlock(&ch->collect_lock); in ch_action_txdone()
1138 ch->trans_skb->tail = ch->trans_skb->data = ch->trans_skb_data; in ch_action_txdone()
1139 ch->trans_skb->len = 0; in ch_action_txdone()
1140 if (ch->prof.maxmulti < (ch->collect_len + 2)) in ch_action_txdone()
1141 ch->prof.maxmulti = ch->collect_len + 2; in ch_action_txdone()
1142 if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue)) in ch_action_txdone()
1143 ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue); in ch_action_txdone()
1144 *((__u16 *)skb_put(ch->trans_skb, 2)) = ch->collect_len + 2; in ch_action_txdone()
1146 while ((skb = skb_dequeue(&ch->collect_queue))) { in ch_action_txdone()
1147 memcpy(skb_put(ch->trans_skb, skb->len), skb->data, in ch_action_txdone()
1155 ch->collect_len = 0; in ch_action_txdone()
1156 spin_unlock(&ch->collect_lock); in ch_action_txdone()
1157 ch->ccw[1].count = ch->trans_skb->len; in ch_action_txdone()
1158 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); in ch_action_txdone()
1159 ch->prof.send_stamp = xtime; in ch_action_txdone()
1160 rc = do_IO(ch->irq, &ch->ccw[0], (intparm_t)ch, 0xff, 0); in ch_action_txdone()
1161 ch->prof.doios_multi++; in ch_action_txdone()
1165 fsm_deltimer(&ch->timer); in ch_action_txdone()
1166 ccw_check_return_code(ch, rc); in ch_action_txdone()
1169 spin_unlock(&ch->collect_lock); in ch_action_txdone()
1186 channel *ch = (channel *)arg; in ch_action_txidle() local
1188 fsm_deltimer(&ch->timer); in ch_action_txidle()
1190 fsm_event(((ctc_priv *)ch->netdev->priv)->fsm, DEV_EVENT_TXUP, in ch_action_txidle()
1191 ch->netdev); in ch_action_txidle()
1204 channel *ch = (channel *)arg; in ch_action_rx() local
1205 net_device *dev = ch->netdev; in ch_action_rx()
1207 int len = ch->max_bufsize - ch->devstat->rescnt; in ch_action_rx()
1208 struct sk_buff *skb = ch->trans_skb; in ch_action_rx()
1213 fsm_deltimer(&ch->timer); in ch_action_rx()
1222 if (len > ch->max_bufsize) { in ch_action_rx()
1225 dev->name, len, ch->max_bufsize); in ch_action_rx()
1234 switch (ch->protocol) { in ch_action_rx()
1258 ctc_unpack_skb(ch, skb); in ch_action_rx()
1261 skb->data = skb->tail = ch->trans_skb_data; in ch_action_rx()
1263 if (ctc_checkalloc_buffer(ch, 1)) in ch_action_rx()
1265 ch->ccw[1].count = ch->max_bufsize; in ch_action_rx()
1266 rc = do_IO(ch->irq, &ch->ccw[0], (intparm_t)ch, 0xff, 0); in ch_action_rx()
1268 ccw_check_return_code(ch, rc); in ch_action_rx()
1282 channel *ch = (channel *)arg; in ch_action_firstio() local
1288 "init ...\n", ch->devno); in ch_action_firstio()
1290 fsm_deltimer(&ch->timer); in ch_action_firstio()
1291 if (ctc_checkalloc_buffer(ch, 1)) in ch_action_firstio()
1294 (ch->protocol == CTC_PROTO_OS390)) { in ch_action_firstio()
1296 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_firstio()
1297 *((__u16 *)ch->trans_skb->data) = CTC_INITIAL_BLOCKLEN; in ch_action_firstio()
1298 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, in ch_action_firstio()
1299 CH_EVENT_TIMER, ch); in ch_action_firstio()
1302 net_device *dev = ch->netdev; in ch_action_firstio()
1315 if ((CHANNEL_DIRECTION(ch->flags) == WRITE) || in ch_action_firstio()
1316 (ch->protocol != CTC_PROTO_S390)) in ch_action_firstio()
1317 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); in ch_action_firstio()
1319 *((__u16 *)ch->trans_skb->data) = CTC_INITIAL_BLOCKLEN; in ch_action_firstio()
1320 ch->ccw[1].count = 2; /* Transfer only length */ in ch_action_firstio()
1322 fsm_newstate(fi, (CHANNEL_DIRECTION(ch->flags) == READ) in ch_action_firstio()
1324 rc = do_IO(ch->irq, &ch->ccw[0], (intparm_t)ch, 0xff, 0); in ch_action_firstio()
1326 fsm_deltimer(&ch->timer); in ch_action_firstio()
1328 ccw_check_return_code(ch, rc); in ch_action_firstio()
1337 if ((CHANNEL_DIRECTION(ch->flags) == READ) && in ch_action_firstio()
1338 (ch->protocol == CTC_PROTO_S390)) { in ch_action_firstio()
1339 net_device *dev = ch->netdev; in ch_action_firstio()
1355 channel *ch = (channel *)arg; in ch_action_rxidle() local
1356 net_device *dev = ch->netdev; in ch_action_rxidle()
1360 fsm_deltimer(&ch->timer); in ch_action_rxidle()
1361 buflen = *((__u16 *)ch->trans_skb->data); in ch_action_rxidle()
1367 if (ctc_checkalloc_buffer(ch, 1)) in ch_action_rxidle()
1369 ch->ccw[1].count = ch->max_bufsize; in ch_action_rxidle()
1371 rc = do_IO(ch->irq, &ch->ccw[0], (intparm_t)ch, 0xff, 0); in ch_action_rxidle()
1374 ccw_check_return_code(ch, rc); in ch_action_rxidle()
1395 channel *ch = (channel *)arg; in ch_action_setmode() local
1399 fsm_deltimer(&ch->timer); in ch_action_setmode()
1400 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); in ch_action_setmode()
1403 s390irq_spin_lock_irqsave(ch->irq, saveflags); in ch_action_setmode()
1404 rc = do_IO(ch->irq, &ch->ccw[6], (intparm_t)ch, 0xff, 0); in ch_action_setmode()
1406 s390irq_spin_unlock_irqrestore(ch->irq, saveflags); in ch_action_setmode()
1408 fsm_deltimer(&ch->timer); in ch_action_setmode()
1410 ccw_check_return_code(ch, rc); in ch_action_setmode()
1412 ch->retry = 0; in ch_action_setmode()
1424 channel *ch = (channel *)arg; in ch_action_start() local
1429 if (ch == NULL) { in ch_action_start()
1434 if (ch->netdev == NULL) { in ch_action_start()
1437 ch->irq); in ch_action_start()
1440 dev = ch->netdev; in ch_action_start()
1445 (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); in ch_action_start()
1448 if (ch->trans_skb != NULL) { in ch_action_start()
1449 clear_normalized_cda(&ch->ccw[1]); in ch_action_start()
1450 dev_kfree_skb(ch->trans_skb); in ch_action_start()
1451 ch->trans_skb = NULL; in ch_action_start()
1453 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_start()
1454 ch->ccw[1].cmd_code = CCW_CMD_READ; in ch_action_start()
1455 ch->ccw[1].flags = CCW_FLAG_SLI; in ch_action_start()
1456 ch->ccw[1].count = 0; in ch_action_start()
1458 ch->ccw[1].cmd_code = CCW_CMD_WRITE; in ch_action_start()
1459 ch->ccw[1].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in ch_action_start()
1460 ch->ccw[1].count = 0; in ch_action_start()
1462 if (ctc_checkalloc_buffer(ch, 0)) { in ch_action_start()
1468 (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); in ch_action_start()
1472 INIT_LIST_HEAD(&ch->tq.list); in ch_action_start()
1474 ch->tq.next = NULL; in ch_action_start()
1476 ch->tq.sync = 0; in ch_action_start()
1477 ch->tq.routine = (void *)(void *)ctc_bh; in ch_action_start()
1478 ch->tq.data = ch; in ch_action_start()
1480 ch->ccw[0].cmd_code = CCW_CMD_PREPARE; in ch_action_start()
1481 ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in ch_action_start()
1482 ch->ccw[0].count = 0; in ch_action_start()
1483 ch->ccw[0].cda = 0; in ch_action_start()
1484 ch->ccw[2].cmd_code = CCW_CMD_NOOP; /* jointed CE + DE */ in ch_action_start()
1485 ch->ccw[2].flags = CCW_FLAG_SLI; in ch_action_start()
1486 ch->ccw[2].count = 0; in ch_action_start()
1487 ch->ccw[2].cda = 0; in ch_action_start()
1488 memcpy(&ch->ccw[3], &ch->ccw[0], sizeof(ccw1_t) * 3); in ch_action_start()
1489 ch->ccw[4].cda = 0; in ch_action_start()
1490 ch->ccw[4].flags &= ~CCW_FLAG_IDA; in ch_action_start()
1493 fsm_addtimer(&ch->timer, 1000, CH_EVENT_TIMER, ch); in ch_action_start()
1494 s390irq_spin_lock_irqsave(ch->irq, saveflags); in ch_action_start()
1495 rc = halt_IO(ch->irq, (intparm_t)ch, 0); in ch_action_start()
1496 s390irq_spin_unlock_irqrestore(ch->irq, saveflags); in ch_action_start()
1498 fsm_deltimer(&ch->timer); in ch_action_start()
1499 ccw_check_return_code(ch, rc); in ch_action_start()
1516 channel *ch = (channel *)arg; in ch_action_haltio() local
1521 fsm_deltimer(&ch->timer); in ch_action_haltio()
1522 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); in ch_action_haltio()
1524 s390irq_spin_lock_irqsave(ch->irq, saveflags); in ch_action_haltio()
1527 rc = halt_IO (ch->irq, (intparm_t)ch, 0); in ch_action_haltio()
1529 s390irq_spin_unlock_irqrestore(ch->irq, saveflags); in ch_action_haltio()
1531 fsm_deltimer(&ch->timer); in ch_action_haltio()
1533 ccw_check_return_code(ch, rc); in ch_action_haltio()
1547 channel *ch = (channel *)arg; in ch_action_stopped() local
1548 net_device *dev = ch->netdev; in ch_action_stopped()
1550 fsm_deltimer(&ch->timer); in ch_action_stopped()
1552 if (ch->trans_skb != NULL) { in ch_action_stopped()
1553 clear_normalized_cda(&ch->ccw[1]); in ch_action_stopped()
1554 dev_kfree_skb(ch->trans_skb); in ch_action_stopped()
1555 ch->trans_skb = NULL; in ch_action_stopped()
1557 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_stopped()
1558 skb_queue_purge(&ch->io_queue); in ch_action_stopped()
1561 ctc_purge_skb_queue(&ch->io_queue); in ch_action_stopped()
1562 spin_lock(&ch->collect_lock); in ch_action_stopped()
1563 ctc_purge_skb_queue(&ch->collect_queue); in ch_action_stopped()
1564 ch->collect_len = 0; in ch_action_stopped()
1565 spin_unlock(&ch->collect_lock); in ch_action_stopped()
1594 channel *ch = (channel *)arg; in ch_action_fail() local
1595 net_device *dev = ch->netdev; in ch_action_fail()
1597 fsm_deltimer(&ch->timer); in ch_action_fail()
1599 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_fail()
1600 skb_queue_purge(&ch->io_queue); in ch_action_fail()
1603 ctc_purge_skb_queue(&ch->io_queue); in ch_action_fail()
1604 spin_lock(&ch->collect_lock); in ch_action_fail()
1605 ctc_purge_skb_queue(&ch->collect_queue); in ch_action_fail()
1606 ch->collect_len = 0; in ch_action_fail()
1607 spin_unlock(&ch->collect_lock); in ch_action_fail()
1621 channel *ch = (channel *)arg; in ch_action_setuperr() local
1622 net_device *dev = ch->netdev; in ch_action_setuperr()
1633 fsm_deltimer(&ch->timer); in ch_action_setuperr()
1634 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); in ch_action_setuperr()
1635 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_setuperr()
1636 int rc = halt_IO (ch->irq, (intparm_t)ch, 0); in ch_action_setuperr()
1638 ccw_check_return_code(ch, rc); in ch_action_setuperr()
1646 (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX", in ch_action_setuperr()
1648 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_setuperr()
1670 channel *ch = (channel *)arg; in ch_action_restart() local
1671 net_device *dev = ch->netdev; in ch_action_restart()
1673 fsm_deltimer(&ch->timer); in ch_action_restart()
1676 (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); in ch_action_restart()
1677 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch); in ch_action_restart()
1681 s390irq_spin_lock_irqsave(ch->irq, saveflags); in ch_action_restart()
1682 rc = halt_IO (ch->irq, (intparm_t)ch, 0); in ch_action_restart()
1684 s390irq_spin_unlock_irqrestore(ch->irq, saveflags); in ch_action_restart()
1686 fsm_deltimer(&ch->timer); in ch_action_restart()
1688 ccw_check_return_code(ch, rc); in ch_action_restart()
1702 channel *ch = (channel *)arg; in ch_action_rxiniterr() local
1703 net_device *dev = ch->netdev; in ch_action_rxiniterr()
1706 fsm_deltimer(&ch->timer); in ch_action_rxiniterr()
1710 if (ch->retry++ < 3) in ch_action_rxiniterr()
1733 channel *ch = (channel *)arg; in ch_action_rxinitfail() local
1734 net_device *dev = ch->netdev; in ch_action_rxinitfail()
1753 channel *ch = (channel *)arg; in ch_action_rxdisc() local
1755 net_device *dev = ch->netdev; in ch_action_rxdisc()
1757 fsm_deltimer(&ch->timer); in ch_action_rxdisc()
1772 halt_IO(ch->irq, (intparm_t)ch, 0); in ch_action_rxdisc()
1785 channel *ch = (channel *)arg; in ch_action_txiniterr() local
1786 net_device *dev = ch->netdev; in ch_action_txiniterr()
1789 fsm_deltimer(&ch->timer); in ch_action_txiniterr()
1793 if (ch->retry++ < 3) in ch_action_txiniterr()
1815 channel *ch = (channel *)arg; in ch_action_txretry() local
1816 net_device *dev = ch->netdev; in ch_action_txretry()
1819 fsm_deltimer(&ch->timer); in ch_action_txretry()
1820 if (ch->retry++ > 3) { in ch_action_txretry()
1830 printk(KERN_DEBUG "%s: TX retry %d\n", dev->name, ch->retry); in ch_action_txretry()
1831 if ((skb = skb_peek(&ch->io_queue))) { in ch_action_txretry()
1834 clear_normalized_cda(&ch->ccw[4]); in ch_action_txretry()
1835 ch->ccw[4].count = skb->len; in ch_action_txretry()
1836 if (set_normalized_cda(&ch->ccw[4], in ch_action_txretry()
1846 fsm_addtimer(&ch->timer, 1000, CH_EVENT_TIMER, ch); in ch_action_txretry()
1848 s390irq_spin_lock_irqsave(ch->irq, saveflags); in ch_action_txretry()
1849 rc = do_IO(ch->irq, &ch->ccw[3], (intparm_t)ch, 0xff, 0); in ch_action_txretry()
1851 s390irq_spin_unlock_irqrestore(ch->irq, in ch_action_txretry()
1854 fsm_deltimer(&ch->timer); in ch_action_txretry()
1855 ccw_check_return_code(ch, rc); in ch_action_txretry()
1856 ctc_purge_skb_queue(&ch->io_queue); in ch_action_txretry()
1872 channel *ch = (channel *)arg; in ch_action_iofatal() local
1873 net_device *dev = ch->netdev; in ch_action_iofatal()
1875 fsm_deltimer(&ch->timer); in ch_action_iofatal()
1876 if (CHANNEL_DIRECTION(ch->flags) == READ) { in ch_action_iofatal()
1891 channel *ch = (channel *)arg; in ch_action_reinit() local
1892 net_device *dev = ch->netdev; in ch_action_reinit()
2027 channel *ch; in add_channel() local
2030 if ((ch = (channel *)kmalloc(sizeof(channel), GFP_KERNEL)) == NULL) { in add_channel()
2035 memset(ch, 0, sizeof(channel)); in add_channel()
2036 if ((ch->ccw = (ccw1_t *)kmalloc(sizeof(ccw1_t) * 8, in add_channel()
2038 kfree(ch); in add_channel()
2063 ch->ccw[6].cmd_code = CCW_CMD_SET_EXTENDED; in add_channel()
2064 ch->ccw[6].flags = CCW_FLAG_SLI; in add_channel()
2065 ch->ccw[6].count = 0; in add_channel()
2066 ch->ccw[6].cda = 0; in add_channel()
2068 ch->ccw[7].cmd_code = CCW_CMD_NOOP; in add_channel()
2069 ch->ccw[7].flags = CCW_FLAG_SLI; in add_channel()
2070 ch->ccw[7].count = 0; in add_channel()
2071 ch->ccw[7].cda = 0; in add_channel()
2073 ch->irq = irq; in add_channel()
2074 ch->devno = devno; in add_channel()
2075 ch->type = type; in add_channel()
2078 ch->fsm = init_fsm(name, ch_state_names, in add_channel()
2081 if (ch->fsm == NULL) { in add_channel()
2085 kfree(ch); in add_channel()
2088 fsm_newstate(ch->fsm, CH_STATE_IDLE); in add_channel()
2089 if ((ch->devstat = (devstat_t*)kmalloc(sizeof(devstat_t), GFP_KERNEL)) in add_channel()
2093 kfree_fsm(ch->fsm); in add_channel()
2094 kfree(ch); in add_channel()
2097 memset(ch->devstat, 0, sizeof(devstat_t)); in add_channel()
2105 kfree(ch->devstat); in add_channel()
2106 kfree_fsm(ch->fsm); in add_channel()
2107 kfree(ch); in add_channel()
2110 fsm_settimer(ch->fsm, &ch->timer); in add_channel()
2111 skb_queue_head_init(&ch->io_queue); in add_channel()
2112 skb_queue_head_init(&ch->collect_queue); in add_channel()
2113 ch->next = *c; in add_channel()
2114 *c = ch; in add_channel()
2174 static void channel_free(channel *ch) in channel_free() argument
2176 ch->flags &= ~CHANNEL_FLAGS_INUSE; in channel_free()
2177 fsm_newstate(ch->fsm, CH_STATE_IDLE); in channel_free()
2185 static void channel_remove(channel *ch) in channel_remove() argument
2189 if (ch == NULL) in channel_remove()
2193 if (ch->flags & CHANNEL_FLAGS_INUSE) in channel_remove()
2194 FREE_IRQ(ch->irq, ch->devstat); in channel_remove()
2196 channel_free(ch); in channel_remove()
2198 if (*c == ch) { in channel_remove()
2199 *c = ch->next; in channel_remove()
2200 fsm_deltimer(&ch->timer); in channel_remove()
2201 kfree_fsm(ch->fsm); in channel_remove()
2202 clear_normalized_cda(&ch->ccw[4]); in channel_remove()
2203 if (ch->trans_skb != NULL) { in channel_remove()
2204 clear_normalized_cda(&ch->ccw[1]); in channel_remove()
2205 dev_kfree_skb(ch->trans_skb); in channel_remove()
2207 kfree(ch->ccw); in channel_remove()
2226 channel *ch = channels; in channel_get() local
2235 while (ch && ((ch->devno != devno) || (ch->type != type))) { in channel_get()
2240 __FUNCTION__, ch, ch->devno, ch->type); in channel_get()
2242 ch = ch->next; in channel_get()
2248 __FUNCTION__, ch, ch->devno, ch->type); in channel_get()
2250 if (!ch) { in channel_get()
2257 if (ch->flags & CHANNEL_FLAGS_INUSE) in channel_get()
2258 ch = NULL; in channel_get()
2260 ch->flags |= CHANNEL_FLAGS_INUSE; in channel_get()
2261 ch->flags &= ~CHANNEL_FLAGS_RWMASK; in channel_get()
2262 ch->flags |= (direction == WRITE) in channel_get()
2264 fsm_newstate(ch->fsm, CH_STATE_STOPPED); in channel_get()
2267 return ch; in channel_get()
2281 channel *ch = channels; in channel_get_next() local
2283 while (ch && (ch->type != type || (ch->flags & CHANNEL_FLAGS_INUSE))) in channel_get_next()
2284 ch = ch->next; in channel_get_next()
2285 if (ch) { in channel_get_next()
2286 ch->flags |= CHANNEL_FLAGS_INUSE; in channel_get_next()
2287 ch->flags &= ~CHANNEL_FLAGS_RWMASK; in channel_get_next()
2288 ch->flags |= (direction == WRITE) in channel_get_next()
2290 fsm_newstate(ch->fsm, CH_STATE_STOPPED); in channel_get_next()
2292 return ch; in channel_get_next()
2325 channel *ch = channels; in find_channel_by_irq() local
2326 while (ch && (ch->irq != irq)) in find_channel_by_irq()
2327 ch = ch->next; in find_channel_by_irq()
2328 return ch; in find_channel_by_irq()
2341 channel *ch = (channel *)devstat->intparm; in ctc_irq_handler() local
2349 if (ch == NULL) { in ctc_irq_handler()
2350 if ((ch = find_channel_by_irq(irq)) == NULL) { in ctc_irq_handler()
2360 dev = (net_device *)(ch->netdev); in ctc_irq_handler()
2365 irq, ch); in ctc_irq_handler()
2370 dev->name, ch->devno, irq); in ctc_irq_handler()
2382 fsm_event(ch->fsm, CH_EVENT_SC_UNKNOWN, ch); in ctc_irq_handler()
2386 "%02x\n", dev->name, ch->devno, devstat->cstat, in ctc_irq_handler()
2393 ccw_unit_check(ch, devstat->ii.sense.data[0]); in ctc_irq_handler()
2398 fsm_event(ch->fsm, CH_EVENT_ATTNBUSY, ch); in ctc_irq_handler()
2400 fsm_event(ch->fsm, CH_EVENT_BUSY, ch); in ctc_irq_handler()
2404 fsm_event(ch->fsm, CH_EVENT_ATTN, ch); in ctc_irq_handler()
2408 fsm_event(ch->fsm, CH_EVENT_FINSTAT, ch); in ctc_irq_handler()
2410 fsm_event(ch->fsm, CH_EVENT_IRQ, ch); in ctc_irq_handler()
2435 channel *ch = privptr->channel[direction]; in dev_action_start() local
2436 fsm_event(ch->fsm, CH_EVENT_START, ch); in dev_action_start()
2455 channel *ch = privptr->channel[direction]; in dev_action_stop() local
2456 fsm_event(ch->fsm, CH_EVENT_STOP, ch); in dev_action_stop()
2635 static int transmit_skb(channel *ch, struct sk_buff *skb) { in transmit_skb() argument
2640 if (fsm_getstate(ch->fsm) != CH_STATE_TXIDLE) { in transmit_skb()
2643 spin_lock_irqsave(&ch->collect_lock, saveflags); in transmit_skb()
2644 if (ch->collect_len + l > ch->max_bufsize - 2) in transmit_skb()
2653 skb_queue_tail(&ch->collect_queue, skb); in transmit_skb()
2654 ch->collect_len += l; in transmit_skb()
2656 spin_unlock_irqrestore(&ch->collect_lock, saveflags); in transmit_skb()
2668 ch->prof.txlen += skb->len; in transmit_skb()
2698 ch->ccw[4].count = block_len; in transmit_skb()
2699 if (set_normalized_cda(&ch->ccw[4], virt_to_phys(skb->data))) { in transmit_skb()
2705 if (ctc_checkalloc_buffer(ch, 1)) { in transmit_skb()
2715 ch->trans_skb->tail = ch->trans_skb->data; in transmit_skb()
2716 ch->trans_skb->len = 0; in transmit_skb()
2717 ch->ccw[1].count = skb->len; in transmit_skb()
2718 memcpy(skb_put(ch->trans_skb, skb->len), skb->data, in transmit_skb()
2724 skb_queue_tail(&ch->io_queue, skb); in transmit_skb()
2727 ch->retry = 0; in transmit_skb()
2728 fsm_newstate(ch->fsm, CH_STATE_TX); in transmit_skb()
2729 fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, in transmit_skb()
2730 CH_EVENT_TIMER, ch); in transmit_skb()
2731 s390irq_spin_lock_irqsave(ch->irq, saveflags); in transmit_skb()
2732 ch->prof.send_stamp = xtime; in transmit_skb()
2733 rc = do_IO(ch->irq, &ch->ccw[ccw_idx], (intparm_t)ch, 0xff, 0); in transmit_skb()
2734 s390irq_spin_unlock_irqrestore(ch->irq, saveflags); in transmit_skb()
2736 ch->prof.doios_single++; in transmit_skb()
2738 fsm_deltimer(&ch->timer); in transmit_skb()
2739 ccw_check_return_code(ch, rc); in transmit_skb()
2741 skb_dequeue_tail(&ch->io_queue); in transmit_skb()
2749 net_device *dev = ch->netdev; in transmit_skb()
2897 channel *ch = channels; in find_netdev_by_ino() local
2901 while (ch) { in find_netdev_by_ino()
2902 if (ch->netdev != dev) { in find_netdev_by_ino()
2903 dev = ch->netdev; in find_netdev_by_ino()
2911 ch = ch->next; in find_netdev_by_ino()
3862 channel *ch = privptr->channel[direction]; in ctc_chandev_msck_notify() local
3863 if(ch->irq == msck_irq) { in ctc_chandev_msck_notify()
3866 if (get_dev_info_by_irq(ch->irq, &devinfo)) in ctc_chandev_msck_notify()
3867 ch->devno = devinfo.devno; in ctc_chandev_msck_notify()
3873 "irq %d\n", ch->irq); in ctc_chandev_msck_notify()
3881 channel *ch = privptr->channel[direction]; in ctc_chandev_msck_notify() local
3882 ch->flags |= CHANNEL_FLAGS_FAILED; in ctc_chandev_msck_notify()
3883 fsm_event(ch->fsm, CH_EVENT_MC_FAIL, ch); in ctc_chandev_msck_notify()
3891 channel *ch = privptr->channel[direction]; in ctc_chandev_msck_notify() local
3892 if (!(ch->flags & CHANNEL_FLAGS_FAILED)) in ctc_chandev_msck_notify()
3893 fsm_event(ch->fsm, CH_EVENT_MC_FAIL, ch); in ctc_chandev_msck_notify()
3896 channel *ch = privptr->channel[direction]; in ctc_chandev_msck_notify() local
3897 ch->flags &= ~CHANNEL_FLAGS_FAILED; in ctc_chandev_msck_notify()
3898 fsm_event(ch->fsm, CH_EVENT_MC_GOOD, ch); in ctc_chandev_msck_notify()