Lines Matching refs:ch

107 static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb);
611 struct channel *rch = mpcginfo->ch; in mpc_rcvd_sweep_resp()
615 struct channel *ch = priv->channel[CTCM_WRITE]; in mpc_rcvd_sweep_resp() local
617 CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, ch, ch->id); in mpc_rcvd_sweep_resp()
624 fsm_deltimer(&ch->sweep_timer); in mpc_rcvd_sweep_resp()
627 ch->th_seq_num = 0x00; in mpc_rcvd_sweep_resp()
646 struct channel *ch = priv->channel[CTCM_WRITE]; in ctcmpc_send_sweep_resp() local
660 header->sw.th_last_seq = ch->th_seq_num; in ctcmpc_send_sweep_resp()
663 skb_queue_tail(&ch->sweep_queue, sweep_skb); in ctcmpc_send_sweep_resp()
665 fsm_addtimer(&ch->sweep_timer, 100, CTC_EVENT_RSWEEP_TIMER, ch); in ctcmpc_send_sweep_resp()
682 struct channel *rch = mpcginfo->ch; in mpc_rcvd_sweep_req()
686 struct channel *ch = priv->channel[CTCM_WRITE]; in mpc_rcvd_sweep_req() local
690 " %s(): ch=0x%p id=%s\n", __func__, ch, ch->id); in mpc_rcvd_sweep_req()
702 ctcmpc_send_sweep_resp(ch); in mpc_rcvd_sweep_req()
864 struct channel *ch = NULL; in mpc_group_ready() local
880 ch = priv->channel[CTCM_READ]; in mpc_group_ready()
881 ch->pdu_seq = 0; in mpc_group_ready()
883 __func__, ch->pdu_seq); in mpc_group_ready()
885 ctcmpc_chx_rxidle(ch->fsm, CTC_EVENT_START, ch); in mpc_group_ready()
887 ch = priv->channel[CTCM_WRITE]; in mpc_group_ready()
888 if (ch->collect_len > 0) { in mpc_group_ready()
889 spin_lock(&ch->collect_lock); in mpc_group_ready()
890 ctcm_purge_skb_queue(&ch->collect_queue); in mpc_group_ready()
891 ch->collect_len = 0; in mpc_group_ready()
892 spin_unlock(&ch->collect_lock); in mpc_group_ready()
894 ctcm_chx_txidle(ch->fsm, CTC_EVENT_START, ch); in mpc_group_ready()
916 void mpc_channel_action(struct channel *ch, int direction, int action) in mpc_channel_action() argument
918 struct net_device *dev = ch->netdev; in mpc_channel_action()
929 CTCM_PR_DEBUG("enter %s: ch=0x%p id=%s\n", __func__, ch, ch->id); in mpc_channel_action()
938 if ((action == MPC_CHANNEL_ADD) && (ch->in_mpcgroup == 0)) { in mpc_channel_action()
942 ch->in_mpcgroup = 1; in mpc_channel_action()
944 if (ch->xid_skb != NULL) in mpc_channel_action()
945 dev_kfree_skb_any(ch->xid_skb); in mpc_channel_action()
947 ch->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, in mpc_channel_action()
949 if (ch->xid_skb == NULL) { in mpc_channel_action()
956 ch->xid_skb_data = ch->xid_skb->data; in mpc_channel_action()
957 ch->xid_th = (struct th_header *)ch->xid_skb->data; in mpc_channel_action()
958 skb_put(ch->xid_skb, TH_HEADER_LENGTH); in mpc_channel_action()
959 ch->xid = (struct xid2 *)skb_tail_pointer(ch->xid_skb); in mpc_channel_action()
960 skb_put(ch->xid_skb, XID2_LENGTH); in mpc_channel_action()
961 ch->xid_id = skb_tail_pointer(ch->xid_skb); in mpc_channel_action()
962 ch->xid_skb->data = ch->xid_skb_data; in mpc_channel_action()
963 skb_reset_tail_pointer(ch->xid_skb); in mpc_channel_action()
964 ch->xid_skb->len = 0; in mpc_channel_action()
966 skb_put_data(ch->xid_skb, grp->xid_skb->data, in mpc_channel_action()
969 ch->xid->xid2_dlc_type = in mpc_channel_action()
970 ((CHANNEL_DIRECTION(ch->flags) == CTCM_READ) in mpc_channel_action()
973 if (CHANNEL_DIRECTION(ch->flags) == CTCM_WRITE) in mpc_channel_action()
974 ch->xid->xid2_buf_len = 0x00; in mpc_channel_action()
976 ch->xid_skb->data = ch->xid_skb_data; in mpc_channel_action()
977 skb_reset_tail_pointer(ch->xid_skb); in mpc_channel_action()
978 ch->xid_skb->len = 0; in mpc_channel_action()
980 fsm_newstate(ch->fsm, CH_XID0_PENDING); in mpc_channel_action()
991 (ch->in_mpcgroup == 1)) { in mpc_channel_action()
992 ch->in_mpcgroup = 0; in mpc_channel_action()
996 if (ch->xid_skb != NULL) in mpc_channel_action()
997 dev_kfree_skb_any(ch->xid_skb); in mpc_channel_action()
998 ch->xid_skb = NULL; in mpc_channel_action()
1017 CTCM_PR_DEBUG("exit %s: ch=0x%p id=%s\n", __func__, ch, ch->id); in mpc_channel_action()
1028 static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) in ctcmpc_unpack_skb() argument
1030 struct net_device *dev = ch->netdev; in ctcmpc_unpack_skb()
1044 __func__, dev->name, smp_processor_id(), ch->id); in ctcmpc_unpack_skb()
1065 (header->th_seq_num != ch->th_seq_num + 1) && in ctcmpc_unpack_skb()
1066 (ch->th_seq_num != 0))) { in ctcmpc_unpack_skb()
1075 skb_queue_tail(&ch->io_queue, pskb); in ctcmpc_unpack_skb()
1078 ch->th_seq_num + 1, header->th_seq_num); in ctcmpc_unpack_skb()
1083 ch->th_seq_num = header->th_seq_num; in ctcmpc_unpack_skb()
1086 __func__, ch->th_seq_num); in ctcmpc_unpack_skb()
1107 if ((pskb->len <= 0) || (pskb->len > ch->max_bufsize)) { in ctcmpc_unpack_skb()
1146 *((__u32 *) skb_push(skb, 4)) = ch->pdu_seq; in ctcmpc_unpack_skb()
1147 ch->pdu_seq++; in ctcmpc_unpack_skb()
1151 __func__, ch->pdu_seq); in ctcmpc_unpack_skb()
1171 mpcginfo->ch = ch; in ctcmpc_unpack_skb()
1212 __func__, dev->name, ch, ch->id); in ctcmpc_unpack_skb()
1225 struct channel *ch = (struct channel *)thischan; in ctcmpc_bh() local
1227 struct net_device *dev = ch->netdev; in ctcmpc_bh()
1232 dev->name, smp_processor_id(), __func__, ch->id); in ctcmpc_bh()
1235 (skb = skb_dequeue(&ch->io_queue))) { in ctcmpc_bh()
1236 ctcmpc_unpack_skb(ch, skb); in ctcmpc_bh()
1245 if (skb == skb_peek(&ch->io_queue)) in ctcmpc_bh()
1249 __func__, dev->name, ch, ch->id); in ctcmpc_bh()
1478 struct channel *ch = mpcginfo->ch; in mpc_action_discontact() local
1483 if (ch) { in mpc_action_discontact()
1484 dev = ch->netdev; in mpc_action_discontact()
1490 CTCM_FUNTAIL, dev->name, ch->id); in mpc_action_discontact()
1509 struct channel *ch = (struct channel *)thischan; in mpc_action_send_discontact() local
1512 spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); in mpc_action_send_discontact()
1513 rc = ccw_device_start(ch->cdev, &ch->ccw[15], 0, 0xff, 0); in mpc_action_send_discontact()
1514 spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); in mpc_action_send_discontact()
1517 ctcm_ccw_check_rc(ch, rc, (char *)__func__); in mpc_action_send_discontact()
1531 struct channel *ch = mpcginfo->ch; in mpc_validate_xid() local
1532 struct net_device *dev = ch->netdev; in mpc_validate_xid()
1548 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1555 if (((CHANNEL_DIRECTION(ch->flags) == CTCM_READ) ? XID2_WRITE_SIDE : in mpc_validate_xid()
1561 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1596 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1601 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1610 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1617 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1624 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1631 CTCM_FUNTAIL, ch->id); in mpc_validate_xid()
1652 struct channel *ch = arg; in mpc_action_side_xid() local
1659 __func__, smp_processor_id(), ch, ch->id); in mpc_action_side_xid()
1661 if (ctcm_checkalloc_buffer(ch)) in mpc_action_side_xid()
1667 ch->trans_skb->data = ch->trans_skb_data; in mpc_action_side_xid()
1668 skb_reset_tail_pointer(ch->trans_skb); in mpc_action_side_xid()
1669 ch->trans_skb->len = 0; in mpc_action_side_xid()
1674 memset(ch->trans_skb->data, 0, 16); in mpc_action_side_xid()
1675 ch->rcvd_xid_th = (struct th_header *)ch->trans_skb_data; in mpc_action_side_xid()
1677 skb_put(ch->trans_skb, TH_HEADER_LENGTH); in mpc_action_side_xid()
1678 ch->rcvd_xid = (struct xid2 *)skb_tail_pointer(ch->trans_skb); in mpc_action_side_xid()
1680 skb_put(ch->trans_skb, XID2_LENGTH); in mpc_action_side_xid()
1681 ch->rcvd_xid_id = skb_tail_pointer(ch->trans_skb); in mpc_action_side_xid()
1683 ch->trans_skb->data = ch->trans_skb_data; in mpc_action_side_xid()
1684 skb_reset_tail_pointer(ch->trans_skb); in mpc_action_side_xid()
1685 ch->trans_skb->len = 0; in mpc_action_side_xid()
1695 ch->ccw[8].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1696 ch->ccw[8].count = 0; in mpc_action_side_xid()
1697 ch->ccw[8].cda = 0x00; in mpc_action_side_xid()
1699 if (!(ch->xid_th && ch->xid && ch->xid_id)) in mpc_action_side_xid()
1702 CTCM_FUNTAIL, ch->id, ch->xid_th, ch->xid, ch->xid_id); in mpc_action_side_xid()
1706 if (ch->xid_th == NULL) in mpc_action_side_xid()
1708 ch->ccw[9].cmd_code = CCW_CMD_WRITE; in mpc_action_side_xid()
1709 ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1710 ch->ccw[9].count = TH_HEADER_LENGTH; in mpc_action_side_xid()
1711 ch->ccw[9].cda = virt_to_phys(ch->xid_th); in mpc_action_side_xid()
1713 if (ch->xid == NULL) in mpc_action_side_xid()
1715 ch->ccw[10].cmd_code = CCW_CMD_WRITE; in mpc_action_side_xid()
1716 ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1717 ch->ccw[10].count = XID2_LENGTH; in mpc_action_side_xid()
1718 ch->ccw[10].cda = virt_to_phys(ch->xid); in mpc_action_side_xid()
1720 ch->ccw[11].cmd_code = CCW_CMD_READ; in mpc_action_side_xid()
1721 ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1722 ch->ccw[11].count = TH_HEADER_LENGTH; in mpc_action_side_xid()
1723 ch->ccw[11].cda = virt_to_phys(ch->rcvd_xid_th); in mpc_action_side_xid()
1725 ch->ccw[12].cmd_code = CCW_CMD_READ; in mpc_action_side_xid()
1726 ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1727 ch->ccw[12].count = XID2_LENGTH; in mpc_action_side_xid()
1728 ch->ccw[12].cda = virt_to_phys(ch->rcvd_xid); in mpc_action_side_xid()
1730 ch->ccw[13].cmd_code = CCW_CMD_READ; in mpc_action_side_xid()
1731 ch->ccw[13].cda = virt_to_phys(ch->rcvd_xid_id); in mpc_action_side_xid()
1734 ch->ccw[9].cmd_code = CCW_CMD_READ; in mpc_action_side_xid()
1735 ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1736 ch->ccw[9].count = TH_HEADER_LENGTH; in mpc_action_side_xid()
1737 ch->ccw[9].cda = virt_to_phys(ch->rcvd_xid_th); in mpc_action_side_xid()
1739 ch->ccw[10].cmd_code = CCW_CMD_READ; in mpc_action_side_xid()
1740 ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1741 ch->ccw[10].count = XID2_LENGTH; in mpc_action_side_xid()
1742 ch->ccw[10].cda = virt_to_phys(ch->rcvd_xid); in mpc_action_side_xid()
1744 if (ch->xid_th == NULL) in mpc_action_side_xid()
1746 ch->ccw[11].cmd_code = CCW_CMD_WRITE; in mpc_action_side_xid()
1747 ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1748 ch->ccw[11].count = TH_HEADER_LENGTH; in mpc_action_side_xid()
1749 ch->ccw[11].cda = virt_to_phys(ch->xid_th); in mpc_action_side_xid()
1751 if (ch->xid == NULL) in mpc_action_side_xid()
1753 ch->ccw[12].cmd_code = CCW_CMD_WRITE; in mpc_action_side_xid()
1754 ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1755 ch->ccw[12].count = XID2_LENGTH; in mpc_action_side_xid()
1756 ch->ccw[12].cda = virt_to_phys(ch->xid); in mpc_action_side_xid()
1758 if (ch->xid_id == NULL) in mpc_action_side_xid()
1760 ch->ccw[13].cmd_code = CCW_CMD_WRITE; in mpc_action_side_xid()
1761 ch->ccw[13].cda = virt_to_phys(ch->xid_id); in mpc_action_side_xid()
1764 ch->ccw[13].flags = CCW_FLAG_SLI | CCW_FLAG_CC; in mpc_action_side_xid()
1765 ch->ccw[13].count = 4; in mpc_action_side_xid()
1767 ch->ccw[14].cmd_code = CCW_CMD_NOOP; in mpc_action_side_xid()
1768 ch->ccw[14].flags = CCW_FLAG_SLI; in mpc_action_side_xid()
1769 ch->ccw[14].count = 0; in mpc_action_side_xid()
1770 ch->ccw[14].cda = 0; in mpc_action_side_xid()
1772 CTCM_CCW_DUMP((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); in mpc_action_side_xid()
1773 CTCM_D3_DUMP((char *)ch->xid_th, TH_HEADER_LENGTH); in mpc_action_side_xid()
1774 CTCM_D3_DUMP((char *)ch->xid, XID2_LENGTH); in mpc_action_side_xid()
1775 CTCM_D3_DUMP((char *)ch->xid_id, 4); in mpc_action_side_xid()
1781 spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); in mpc_action_side_xid()
1785 fsm_addtimer(&ch->timer, 5000 , CTC_EVENT_TIMER, ch); in mpc_action_side_xid()
1786 rc = ccw_device_start(ch->cdev, &ch->ccw[8], 0, 0xff, 0); in mpc_action_side_xid()
1789 spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); in mpc_action_side_xid()
1792 ctcm_ccw_check_rc(ch, rc, in mpc_action_side_xid()
1798 __func__, ch, ch->id); in mpc_action_side_xid()
1827 struct channel *ch = arg; in mpc_action_doxid0() local
1828 struct net_device *dev = ch->netdev; in mpc_action_doxid0()
1833 __func__, smp_processor_id(), ch, ch->id); in mpc_action_doxid0()
1835 if (ch->xid == NULL) { in mpc_action_doxid0()
1842 fsm_newstate(ch->fsm, CH_XID0_INPROGRESS); in mpc_action_doxid0()
1844 ch->xid->xid2_option = XID2_0; in mpc_action_doxid0()
1849 ch->ccw[8].cmd_code = CCW_CMD_SENSE_CMD; in mpc_action_doxid0()
1853 ch->ccw[8].cmd_code = CCW_CMD_WRITE_CTL; in mpc_action_doxid0()
1857 fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); in mpc_action_doxid0()
1880 struct channel *ch = priv->channel[direction]; in mpc_action_doxid7() local
1881 struct xid2 *thisxid = ch->xid; in mpc_action_doxid7()
1882 ch->xid_skb->data = ch->xid_skb_data; in mpc_action_doxid7()
1883 skb_reset_tail_pointer(ch->xid_skb); in mpc_action_doxid7()
1884 ch->xid_skb->len = 0; in mpc_action_doxid7()
1891 if (fsm_getstate(ch->fsm) == CH_XID7_PENDING1) { in mpc_action_doxid7()
1892 fsm_newstate(ch->fsm, CH_XID7_PENDING2); in mpc_action_doxid7()
1893 ch->ccw[8].cmd_code = CCW_CMD_SENSE_CMD; in mpc_action_doxid7()
1894 skb_put_data(ch->xid_skb, &thdummy, in mpc_action_doxid7()
1898 } else if (fsm_getstate(ch->fsm) < CH_XID7_PENDING2) { in mpc_action_doxid7()
1899 fsm_newstate(ch->fsm, CH_XID7_PENDING2); in mpc_action_doxid7()
1900 ch->ccw[8].cmd_code = CCW_CMD_WRITE_CTL; in mpc_action_doxid7()
1901 skb_put_data(ch->xid_skb, &thnorm, in mpc_action_doxid7()
1908 if (fsm_getstate(ch->fsm) < CH_XID7_PENDING4) { in mpc_action_doxid7()
1909 fsm_newstate(ch->fsm, CH_XID7_PENDING4); in mpc_action_doxid7()
1910 skb_put_data(ch->xid_skb, &thnorm, in mpc_action_doxid7()
1912 ch->ccw[8].cmd_code = CCW_CMD_WRITE_CTL; in mpc_action_doxid7()
1915 } else if (fsm_getstate(ch->fsm) == CH_XID7_PENDING3) { in mpc_action_doxid7()
1916 fsm_newstate(ch->fsm, CH_XID7_PENDING4); in mpc_action_doxid7()
1917 ch->ccw[8].cmd_code = CCW_CMD_SENSE_CMD; in mpc_action_doxid7()
1918 skb_put_data(ch->xid_skb, &thdummy, in mpc_action_doxid7()
1925 fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); in mpc_action_doxid7()
1939 struct channel *ch = mpcginfo->ch; in mpc_action_rcvd_xid0() local
1940 struct net_device *dev = ch->netdev; in mpc_action_rcvd_xid0()
1945 __func__, ch->id, grp->outstanding_xid2, in mpc_action_rcvd_xid0()
1948 if (fsm_getstate(ch->fsm) < CH_XID7_PENDING) in mpc_action_rcvd_xid0()
1949 fsm_newstate(ch->fsm, CH_XID7_PENDING); in mpc_action_rcvd_xid0()
1983 __func__, ch->id, grp->outstanding_xid2, in mpc_action_rcvd_xid0()
1986 __func__, ch->id, in mpc_action_rcvd_xid0()
1987 fsm_getstate_str(grp->fsm), fsm_getstate_str(ch->fsm)); in mpc_action_rcvd_xid0()
2000 struct channel *ch = mpcginfo->ch; in mpc_action_rcvd_xid7() local
2001 struct net_device *dev = ch->netdev; in mpc_action_rcvd_xid7()
2006 __func__, smp_processor_id(), ch, ch->id); in mpc_action_rcvd_xid7()
2011 ch->xid_skb->data = ch->xid_skb_data; in mpc_action_rcvd_xid7()
2012 skb_reset_tail_pointer(ch->xid_skb); in mpc_action_rcvd_xid7()
2013 ch->xid_skb->len = 0; in mpc_action_rcvd_xid7()