Lines Matching +full:hi +full:- +full:fi
1 // SPDX-License-Identifier: GPL-2.0+
199 * Representation of event-data for the
229 #define NETIUCV_MTU_MAX (NETIUCV_BUFSIZE_MAX - NETIUCV_HDRLEN)
241 clear_bit(0, &priv->tbusy); in netiucv_clear_busy()
249 return test_and_set_bit(0, &priv->tbusy); in netiucv_test_and_set_busy()
276 while (*p && ((p - tmp) < len) && (!isspace(*p))) in netiucv_printname()
288 if (memcmp(conn->userdata, iucvMagic_ebcdic, 16)) { in netiucv_printuser()
291 memcpy(tmp_uid, netiucv_printname(conn->userid, 8), 8); in netiucv_printuser()
292 memcpy(tmp_udat, conn->userdata, 16); in netiucv_printuser()
298 return netiucv_printname(conn->userid, 8); in netiucv_printuser()
496 return -ENOMEM; in iucv_register_dbf_views()
511 * Callback-wrappers, called from lowlevel iucv layer.
517 struct iucv_connection *conn = path->private; in netiucv_callback_rx()
522 fsm_event(conn->fsm, CONN_EVENT_RX, &ev); in netiucv_callback_rx()
528 struct iucv_connection *conn = path->private; in netiucv_callback_txdone()
533 fsm_event(conn->fsm, CONN_EVENT_TXDONE, &ev); in netiucv_callback_txdone()
538 struct iucv_connection *conn = path->private; in netiucv_callback_connack()
540 fsm_event(conn->fsm, CONN_EVENT_CONN_ACK, conn); in netiucv_callback_connack()
546 struct iucv_connection *conn = path->private; in netiucv_callback_connreq()
552 rc = -EINVAL; in netiucv_callback_connreq()
558 if (strncmp(ipvmid, conn->userid, 8) || in netiucv_callback_connreq()
559 strncmp(ipuser, conn->userdata, 16)) in netiucv_callback_connreq()
562 conn->path = path; in netiucv_callback_connreq()
565 fsm_event(conn->fsm, CONN_EVENT_CONN_REQ, &ev); in netiucv_callback_connreq()
576 struct iucv_connection *conn = path->private; in netiucv_callback_connrej()
578 fsm_event(conn->fsm, CONN_EVENT_CONN_REJ, conn); in netiucv_callback_connrej()
583 struct iucv_connection *conn = path->private; in netiucv_callback_connsusp()
585 fsm_event(conn->fsm, CONN_EVENT_CONN_SUS, conn); in netiucv_callback_connsusp()
590 struct iucv_connection *conn = path->private; in netiucv_callback_connres()
592 fsm_event(conn->fsm, CONN_EVENT_CONN_RES, conn); in netiucv_callback_connres()
598 static void netiucv_action_nop(fsm_instance *fi, int event, void *arg) in netiucv_action_nop() argument
617 struct net_device *dev = conn->netdev; in netiucv_unpack_skb()
622 pskb->dev = dev; in netiucv_unpack_skb()
623 pskb->ip_summed = CHECKSUM_NONE; in netiucv_unpack_skb()
624 pskb->protocol = cpu_to_be16(ETH_P_IP); in netiucv_unpack_skb()
628 struct ll_header *header = (struct ll_header *) pskb->data; in netiucv_unpack_skb()
630 if (!header->next) in netiucv_unpack_skb()
634 header->next -= offset; in netiucv_unpack_skb()
635 offset += header->next; in netiucv_unpack_skb()
636 header->next -= NETIUCV_HDRLEN; in netiucv_unpack_skb()
637 if (skb_tailroom(pskb) < header->next) { in netiucv_unpack_skb()
639 header->next, skb_tailroom(pskb)); in netiucv_unpack_skb()
642 skb_put(pskb, header->next); in netiucv_unpack_skb()
644 skb = dev_alloc_skb(pskb->len); in netiucv_unpack_skb()
648 privptr->stats.rx_dropped++; in netiucv_unpack_skb()
651 skb_copy_from_linear_data(pskb, skb_put(skb, pskb->len), in netiucv_unpack_skb()
652 pskb->len); in netiucv_unpack_skb()
654 skb->dev = pskb->dev; in netiucv_unpack_skb()
655 skb->protocol = pskb->protocol; in netiucv_unpack_skb()
656 pskb->ip_summed = CHECKSUM_UNNECESSARY; in netiucv_unpack_skb()
657 privptr->stats.rx_packets++; in netiucv_unpack_skb()
658 privptr->stats.rx_bytes += skb->len; in netiucv_unpack_skb()
664 skb_pull(pskb, header->next); in netiucv_unpack_skb()
669 static void conn_action_rx(fsm_instance *fi, int event, void *arg) in conn_action_rx() argument
672 struct iucv_connection *conn = ev->conn; in conn_action_rx()
673 struct iucv_message *msg = ev->data; in conn_action_rx()
674 struct netiucv_priv *privptr = netdev_priv(conn->netdev); in conn_action_rx()
679 if (!conn->netdev) { in conn_action_rx()
680 iucv_message_reject(conn->path, msg); in conn_action_rx()
685 if (msg->length > conn->max_buffsize) { in conn_action_rx()
686 iucv_message_reject(conn->path, msg); in conn_action_rx()
687 privptr->stats.rx_dropped++; in conn_action_rx()
689 msg->length, conn->max_buffsize); in conn_action_rx()
692 conn->rx_buff->data = conn->rx_buff->head; in conn_action_rx()
693 skb_reset_tail_pointer(conn->rx_buff); in conn_action_rx()
694 conn->rx_buff->len = 0; in conn_action_rx()
695 rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, in conn_action_rx()
696 msg->length, NULL); in conn_action_rx()
697 if (rc || msg->length < 5) { in conn_action_rx()
698 privptr->stats.rx_errors++; in conn_action_rx()
702 netiucv_unpack_skb(conn, conn->rx_buff); in conn_action_rx()
705 static void conn_action_txdone(fsm_instance *fi, int event, void *arg) in conn_action_txdone() argument
708 struct iucv_connection *conn = ev->conn; in conn_action_txdone()
709 struct iucv_message *msg = ev->data; in conn_action_txdone()
712 u32 single_flag = msg->tag; in conn_action_txdone()
723 if (!conn || !conn->netdev) { in conn_action_txdone()
728 privptr = netdev_priv(conn->netdev); in conn_action_txdone()
729 conn->prof.tx_pending--; in conn_action_txdone()
731 if ((skb = skb_dequeue(&conn->commit_queue))) { in conn_action_txdone()
732 refcount_dec(&skb->users); in conn_action_txdone()
734 privptr->stats.tx_packets++; in conn_action_txdone()
735 privptr->stats.tx_bytes += in conn_action_txdone()
736 (skb->len - NETIUCV_HDRLEN in conn_action_txdone()
737 - NETIUCV_HDRLEN); in conn_action_txdone()
742 conn->tx_buff->data = conn->tx_buff->head; in conn_action_txdone()
743 skb_reset_tail_pointer(conn->tx_buff); in conn_action_txdone()
744 conn->tx_buff->len = 0; in conn_action_txdone()
745 spin_lock_irqsave(&conn->collect_lock, saveflags); in conn_action_txdone()
746 while ((skb = skb_dequeue(&conn->collect_queue))) { in conn_action_txdone()
747 header.next = conn->tx_buff->len + skb->len + NETIUCV_HDRLEN; in conn_action_txdone()
748 skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); in conn_action_txdone()
750 skb_put(conn->tx_buff, skb->len), in conn_action_txdone()
751 skb->len); in conn_action_txdone()
752 txbytes += skb->len; in conn_action_txdone()
755 refcount_dec(&skb->users); in conn_action_txdone()
758 if (conn->collect_len > conn->prof.maxmulti) in conn_action_txdone()
759 conn->prof.maxmulti = conn->collect_len; in conn_action_txdone()
760 conn->collect_len = 0; in conn_action_txdone()
761 spin_unlock_irqrestore(&conn->collect_lock, saveflags); in conn_action_txdone()
762 if (conn->tx_buff->len == 0) { in conn_action_txdone()
763 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_txdone()
768 skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); in conn_action_txdone()
769 conn->prof.send_stamp = jiffies; in conn_action_txdone()
772 rc = iucv_message_send(conn->path, &txmsg, 0, 0, in conn_action_txdone()
773 conn->tx_buff->data, conn->tx_buff->len); in conn_action_txdone()
774 conn->prof.doios_multi++; in conn_action_txdone()
775 conn->prof.txlen += conn->tx_buff->len; in conn_action_txdone()
776 conn->prof.tx_pending++; in conn_action_txdone()
777 if (conn->prof.tx_pending > conn->prof.tx_max_pending) in conn_action_txdone()
778 conn->prof.tx_max_pending = conn->prof.tx_pending; in conn_action_txdone()
780 conn->prof.tx_pending--; in conn_action_txdone()
781 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_txdone()
783 privptr->stats.tx_errors += txpackets; in conn_action_txdone()
787 privptr->stats.tx_packets += txpackets; in conn_action_txdone()
788 privptr->stats.tx_bytes += txbytes; in conn_action_txdone()
790 if (stat_maxcq > conn->prof.maxcqueue) in conn_action_txdone()
791 conn->prof.maxcqueue = stat_maxcq; in conn_action_txdone()
795 static void conn_action_connaccept(fsm_instance *fi, int event, void *arg) in conn_action_connaccept() argument
798 struct iucv_connection *conn = ev->conn; in conn_action_connaccept()
799 struct iucv_path *path = ev->data; in conn_action_connaccept()
800 struct net_device *netdev = conn->netdev; in conn_action_connaccept()
806 conn->path = path; in conn_action_connaccept()
807 path->msglim = NETIUCV_QUEUELEN_DEFAULT; in conn_action_connaccept()
808 path->flags = 0; in conn_action_connaccept()
809 rc = iucv_path_accept(path, &netiucv_handler, conn->userdata , conn); in conn_action_connaccept()
814 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_connaccept()
815 netdev->tx_queue_len = conn->path->msglim; in conn_action_connaccept()
816 fsm_event(privptr->fsm, DEV_EVENT_CONUP, netdev); in conn_action_connaccept()
819 static void conn_action_connreject(fsm_instance *fi, int event, void *arg) in conn_action_connreject() argument
822 struct iucv_path *path = ev->data; in conn_action_connreject()
828 static void conn_action_connack(fsm_instance *fi, int event, void *arg) in conn_action_connack() argument
831 struct net_device *netdev = conn->netdev; in conn_action_connack()
835 fsm_deltimer(&conn->timer); in conn_action_connack()
836 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_connack()
837 netdev->tx_queue_len = conn->path->msglim; in conn_action_connack()
838 fsm_event(privptr->fsm, DEV_EVENT_CONUP, netdev); in conn_action_connack()
841 static void conn_action_conntimsev(fsm_instance *fi, int event, void *arg) in conn_action_conntimsev() argument
846 fsm_deltimer(&conn->timer); in conn_action_conntimsev()
847 iucv_path_sever(conn->path, conn->userdata); in conn_action_conntimsev()
848 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_conntimsev()
851 static void conn_action_connsever(fsm_instance *fi, int event, void *arg) in conn_action_connsever() argument
854 struct net_device *netdev = conn->netdev; in conn_action_connsever()
859 fsm_deltimer(&conn->timer); in conn_action_connsever()
860 iucv_path_sever(conn->path, conn->userdata); in conn_action_connsever()
861 dev_info(privptr->dev, "The peer z/VM guest %s has closed the " in conn_action_connsever()
865 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_connsever()
866 fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev); in conn_action_connsever()
869 static void conn_action_start(fsm_instance *fi, int event, void *arg) in conn_action_start() argument
872 struct net_device *netdev = conn->netdev; in conn_action_start()
878 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
886 fsm_newstate(fi, CONN_STATE_SETUPWAIT); in conn_action_start()
887 conn->path = iucv_path_alloc(NETIUCV_QUEUELEN_DEFAULT, 0, GFP_KERNEL); in conn_action_start()
889 netdev->name, netiucv_printuser(conn)); in conn_action_start()
891 rc = iucv_path_connect(conn->path, &netiucv_handler, conn->userid, in conn_action_start()
892 NULL, conn->userdata, conn); in conn_action_start()
895 netdev->tx_queue_len = conn->path->msglim; in conn_action_start()
896 fsm_addtimer(&conn->timer, NETIUCV_TIMEOUT_5SEC, in conn_action_start()
900 dev_warn(privptr->dev, in conn_action_start()
902 netiucv_printname(conn->userid, 8)); in conn_action_start()
903 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
906 dev_warn(privptr->dev, in conn_action_start()
908 " guest %s\n", netiucv_printname(conn->userid, 8)); in conn_action_start()
909 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
912 dev_err(privptr->dev, in conn_action_start()
915 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
918 dev_err(privptr->dev, in conn_action_start()
921 netiucv_printname(conn->userid, 8)); in conn_action_start()
922 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
925 dev_err(privptr->dev, in conn_action_start()
928 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
931 dev_err(privptr->dev, in conn_action_start()
934 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
938 kfree(conn->path); in conn_action_start()
939 conn->path = NULL; in conn_action_start()
947 refcount_dec(&skb->users); in netiucv_purge_skb_queue()
952 static void conn_action_stop(fsm_instance *fi, int event, void *arg) in conn_action_stop() argument
955 struct iucv_connection *conn = ev->conn; in conn_action_stop()
956 struct net_device *netdev = conn->netdev; in conn_action_stop()
961 fsm_deltimer(&conn->timer); in conn_action_stop()
962 fsm_newstate(fi, CONN_STATE_STOPPED); in conn_action_stop()
963 netiucv_purge_skb_queue(&conn->collect_queue); in conn_action_stop()
964 if (conn->path) { in conn_action_stop()
966 iucv_path_sever(conn->path, conn->userdata); in conn_action_stop()
967 kfree(conn->path); in conn_action_stop()
968 conn->path = NULL; in conn_action_stop()
970 netiucv_purge_skb_queue(&conn->commit_queue); in conn_action_stop()
971 fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev); in conn_action_stop()
974 static void conn_action_inval(fsm_instance *fi, int event, void *arg) in conn_action_inval() argument
977 struct net_device *netdev = conn->netdev; in conn_action_inval()
980 netdev->name, conn->userid); in conn_action_inval()
1019 * Actions for interface - statemachine.
1024 * @fi: An instance of an interface statemachine.
1030 static void dev_action_start(fsm_instance *fi, int event, void *arg) in dev_action_start() argument
1037 fsm_newstate(fi, DEV_STATE_STARTWAIT); in dev_action_start()
1038 fsm_event(privptr->conn->fsm, CONN_EVENT_START, privptr->conn); in dev_action_start()
1044 * @param fi An instance of an interface statemachine.
1049 dev_action_stop(fsm_instance *fi, int event, void *arg) in dev_action_stop() argument
1057 ev.conn = privptr->conn; in dev_action_stop()
1059 fsm_newstate(fi, DEV_STATE_STOPWAIT); in dev_action_stop()
1060 fsm_event(privptr->conn->fsm, CONN_EVENT_STOP, &ev); in dev_action_stop()
1067 * @param fi An instance of an interface statemachine.
1072 dev_action_connup(fsm_instance *fi, int event, void *arg) in dev_action_connup() argument
1079 switch (fsm_getstate(fi)) { in dev_action_connup()
1081 fsm_newstate(fi, DEV_STATE_RUNNING); in dev_action_connup()
1082 dev_info(privptr->dev, in dev_action_connup()
1085 netiucv_printuser(privptr->conn)); in dev_action_connup()
1100 * @param fi An instance of an interface statemachine.
1105 dev_action_conndown(fsm_instance *fi, int event, void *arg) in dev_action_conndown() argument
1109 switch (fsm_getstate(fi)) { in dev_action_conndown()
1111 fsm_newstate(fi, DEV_STATE_STARTWAIT); in dev_action_conndown()
1114 fsm_newstate(fi, DEV_STATE_STOPPED); in dev_action_conndown()
1145 * @return 0 on success, -ERRNO on failure. (Never fails.)
1155 if (fsm_getstate(conn->fsm) != CONN_STATE_IDLE) { in netiucv_transmit_skb()
1156 int l = skb->len + NETIUCV_HDRLEN; in netiucv_transmit_skb()
1158 spin_lock_irqsave(&conn->collect_lock, saveflags); in netiucv_transmit_skb()
1159 if (conn->collect_len + l > in netiucv_transmit_skb()
1160 (conn->max_buffsize - NETIUCV_HDRLEN)) { in netiucv_transmit_skb()
1161 rc = -EBUSY; in netiucv_transmit_skb()
1165 refcount_inc(&skb->users); in netiucv_transmit_skb()
1166 skb_queue_tail(&conn->collect_queue, skb); in netiucv_transmit_skb()
1167 conn->collect_len += l; in netiucv_transmit_skb()
1170 spin_unlock_irqrestore(&conn->collect_lock, saveflags); in netiucv_transmit_skb()
1177 unsigned long hi = ((unsigned long)(skb_tail_pointer(skb) + in netiucv_transmit_skb() local
1180 if (hi || (skb_tailroom(skb) < 2)) { in netiucv_transmit_skb()
1181 nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + in netiucv_transmit_skb()
1185 rc = -ENOMEM; in netiucv_transmit_skb()
1189 skb_put_data(nskb, skb->data, skb->len); in netiucv_transmit_skb()
1196 header.next = nskb->len + NETIUCV_HDRLEN; in netiucv_transmit_skb()
1201 fsm_newstate(conn->fsm, CONN_STATE_TX); in netiucv_transmit_skb()
1202 conn->prof.send_stamp = jiffies; in netiucv_transmit_skb()
1206 rc = iucv_message_send(conn->path, &msg, 0, 0, in netiucv_transmit_skb()
1207 nskb->data, nskb->len); in netiucv_transmit_skb()
1208 conn->prof.doios_single++; in netiucv_transmit_skb()
1209 conn->prof.txlen += skb->len; in netiucv_transmit_skb()
1210 conn->prof.tx_pending++; in netiucv_transmit_skb()
1211 if (conn->prof.tx_pending > conn->prof.tx_max_pending) in netiucv_transmit_skb()
1212 conn->prof.tx_max_pending = conn->prof.tx_pending; in netiucv_transmit_skb()
1215 fsm_newstate(conn->fsm, CONN_STATE_IDLE); in netiucv_transmit_skb()
1216 conn->prof.tx_pending--; in netiucv_transmit_skb()
1217 privptr = netdev_priv(conn->netdev); in netiucv_transmit_skb()
1219 privptr->stats.tx_errors++; in netiucv_transmit_skb()
1228 skb_trim(skb, skb->len - NETIUCV_HDRLEN); in netiucv_transmit_skb()
1234 refcount_inc(&nskb->users); in netiucv_transmit_skb()
1235 skb_queue_tail(&conn->commit_queue, nskb); in netiucv_transmit_skb()
1252 * @return 0 on success, -ERRNO on failure. (Never fails.)
1258 fsm_event(priv->fsm, DEV_EVENT_START, dev); in netiucv_open()
1268 * @return 0 on success, -ERRNO on failure. (Never fails.)
1274 fsm_event(priv->fsm, DEV_EVENT_STOP, dev); in netiucv_close()
1291 * netiucv_pm_freeze() - Freeze PM callback
1303 if (priv && priv->conn) in netiucv_pm_freeze()
1304 ndev = priv->conn->netdev; in netiucv_pm_freeze()
1308 priv->pm_state = fsm_getstate(priv->fsm); in netiucv_pm_freeze()
1315 * netiucv_pm_restore_thaw() - Thaw and restore PM callback
1318 * re-open netiucv interfaces closed during freeze
1327 if (priv && priv->conn) in netiucv_pm_restore_thaw()
1328 ndev = priv->conn->netdev; in netiucv_pm_restore_thaw()
1331 switch (priv->pm_state) { in netiucv_pm_restore_thaw()
1366 privptr->stats.tx_dropped++; in netiucv_tx()
1373 privptr->stats.tx_dropped++; in netiucv_tx()
1381 if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { in netiucv_tx()
1383 privptr->stats.tx_dropped++; in netiucv_tx()
1384 privptr->stats.tx_errors++; in netiucv_tx()
1385 privptr->stats.tx_carrier_errors++; in netiucv_tx()
1394 rc = netiucv_transmit_skb(privptr->conn, skb); in netiucv_tx()
1412 return &priv->stats; in netiucv_stats()
1425 return sprintf(buf, "%s\n", netiucv_printuser(priv->conn)); in user_show()
1436 ((p - buf) > 8) || in netiucv_check_user()
1437 (buf + count - p > 18))) || in netiucv_check_user()
1440 return -EINVAL; in netiucv_check_user()
1453 return -EINVAL; in netiucv_check_user()
1480 struct net_device *ndev = priv->conn->netdev; in user_write()
1491 if (memcmp(username, priv->conn->userid, 9) && in user_write()
1492 (ndev->flags & (IFF_UP | IFF_RUNNING))) { in user_write()
1495 return -EPERM; in user_write()
1499 if (!strncmp(username, cp->userid, 9) && in user_write()
1500 !strncmp(userdata, cp->userdata, 17) && cp->netdev != ndev) { in user_write()
1504 return -EEXIST; in user_write()
1508 memcpy(priv->conn->userid, username, 9); in user_write()
1509 memcpy(priv->conn->userdata, userdata, 17); in user_write()
1521 return sprintf(buf, "%d\n", priv->conn->max_buffsize); in buffer_show()
1528 struct net_device *ndev = priv->conn->netdev; in buffer_write()
1534 return -EINVAL; in buffer_write()
1538 if (rc == -EINVAL) { in buffer_write()
1541 return -EINVAL; in buffer_write()
1543 if ((rc == -ERANGE) || (bs1 > NETIUCV_BUFSIZE_MAX)) { in buffer_write()
1547 return -EINVAL; in buffer_write()
1549 if ((ndev->flags & IFF_RUNNING) && in buffer_write()
1550 (bs1 < (ndev->mtu + NETIUCV_HDRLEN + 2))) { in buffer_write()
1554 return -EINVAL; in buffer_write()
1560 return -EINVAL; in buffer_write()
1563 priv->conn->max_buffsize = bs1; in buffer_write()
1564 if (!(ndev->flags & IFF_RUNNING)) in buffer_write()
1565 ndev->mtu = bs1 - NETIUCV_HDRLEN - NETIUCV_HDRLEN; in buffer_write()
1579 return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm)); in dev_fsm_show()
1590 return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm)); in conn_fsm_show()
1601 return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti); in maxmulti_show()
1611 priv->conn->prof.maxmulti = 0; in maxmulti_write()
1623 return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue); in maxcq_show()
1632 priv->conn->prof.maxcqueue = 0; in maxcq_write()
1644 return sprintf(buf, "%ld\n", priv->conn->prof.doios_single); in sdoio_show()
1653 priv->conn->prof.doios_single = 0; in sdoio_write()
1665 return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi); in mdoio_show()
1674 priv->conn->prof.doios_multi = 0; in mdoio_write()
1686 return sprintf(buf, "%ld\n", priv->conn->prof.txlen); in txlen_show()
1695 priv->conn->prof.txlen = 0; in txlen_write()
1707 return sprintf(buf, "%ld\n", priv->conn->prof.tx_time); in txtime_show()
1716 priv->conn->prof.tx_time = 0; in txtime_write()
1728 return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending); in txpend_show()
1737 priv->conn->prof.tx_pending = 0; in txpend_write()
1749 return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending); in txmpnd_show()
1758 priv->conn->prof.tx_max_pending = 0; in txmpnd_write()
1808 dev_set_name(dev, "net%s", ndev->name); in netiucv_register_device()
1809 dev->bus = &iucv_bus; in netiucv_register_device()
1810 dev->parent = iucv_root; in netiucv_register_device()
1811 dev->groups = netiucv_attr_groups; in netiucv_register_device()
1819 dev->release = (void (*)(struct device *))kfree; in netiucv_register_device()
1820 dev->driver = &netiucv_driver; in netiucv_register_device()
1822 return -ENOMEM; in netiucv_register_device()
1829 priv->dev = dev; in netiucv_register_device()
1853 skb_queue_head_init(&conn->collect_queue); in netiucv_new_connection()
1854 skb_queue_head_init(&conn->commit_queue); in netiucv_new_connection()
1855 spin_lock_init(&conn->collect_lock); in netiucv_new_connection()
1856 conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; in netiucv_new_connection()
1857 conn->netdev = dev; in netiucv_new_connection()
1859 conn->rx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1860 if (!conn->rx_buff) in netiucv_new_connection()
1862 conn->tx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1863 if (!conn->tx_buff) in netiucv_new_connection()
1865 conn->fsm = init_fsm("netiucvconn", conn_state_names, in netiucv_new_connection()
1869 if (!conn->fsm) in netiucv_new_connection()
1872 fsm_settimer(conn->fsm, &conn->timer); in netiucv_new_connection()
1873 fsm_newstate(conn->fsm, CONN_STATE_INVALID); in netiucv_new_connection()
1876 memcpy(conn->userdata, userdata, 17); in netiucv_new_connection()
1878 memcpy(conn->userid, username, 9); in netiucv_new_connection()
1879 fsm_newstate(conn->fsm, CONN_STATE_STOPPED); in netiucv_new_connection()
1883 list_add_tail(&conn->list, &iucv_connection_list); in netiucv_new_connection()
1888 kfree_skb(conn->tx_buff); in netiucv_new_connection()
1890 kfree_skb(conn->rx_buff); in netiucv_new_connection()
1906 list_del_init(&conn->list); in netiucv_remove_connection()
1908 fsm_deltimer(&conn->timer); in netiucv_remove_connection()
1909 netiucv_purge_skb_queue(&conn->collect_queue); in netiucv_remove_connection()
1910 if (conn->path) { in netiucv_remove_connection()
1911 iucv_path_sever(conn->path, conn->userdata); in netiucv_remove_connection()
1912 kfree(conn->path); in netiucv_remove_connection()
1913 conn->path = NULL; in netiucv_remove_connection()
1915 netiucv_purge_skb_queue(&conn->commit_queue); in netiucv_remove_connection()
1916 kfree_fsm(conn->fsm); in netiucv_remove_connection()
1917 kfree_skb(conn->rx_buff); in netiucv_remove_connection()
1918 kfree_skb(conn->tx_buff); in netiucv_remove_connection()
1934 if (privptr->conn) in netiucv_free_netdevice()
1935 netiucv_remove_connection(privptr->conn); in netiucv_free_netdevice()
1936 if (privptr->fsm) in netiucv_free_netdevice()
1937 kfree_fsm(privptr->fsm); in netiucv_free_netdevice()
1938 privptr->conn = NULL; privptr->fsm = NULL; in netiucv_free_netdevice()
1955 dev->mtu = NETIUCV_MTU_DEFAULT; in netiucv_setup_netdevice()
1956 dev->min_mtu = 576; in netiucv_setup_netdevice()
1957 dev->max_mtu = NETIUCV_MTU_MAX; in netiucv_setup_netdevice()
1958 dev->needs_free_netdev = true; in netiucv_setup_netdevice()
1959 dev->priv_destructor = netiucv_free_netdevice; in netiucv_setup_netdevice()
1960 dev->hard_header_len = NETIUCV_HDRLEN; in netiucv_setup_netdevice()
1961 dev->addr_len = 0; in netiucv_setup_netdevice()
1962 dev->type = ARPHRD_SLIP; in netiucv_setup_netdevice()
1963 dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT; in netiucv_setup_netdevice()
1964 dev->flags = IFF_POINTOPOINT | IFF_NOARP; in netiucv_setup_netdevice()
1965 dev->netdev_ops = &netiucv_netdev_ops; in netiucv_setup_netdevice()
1981 if (dev_alloc_name(dev, dev->name) < 0) in netiucv_init_netdevice()
1985 privptr->fsm = init_fsm("netiucvdev", dev_state_names, in netiucv_init_netdevice()
1988 if (!privptr->fsm) in netiucv_init_netdevice()
1991 privptr->conn = netiucv_new_connection(dev, username, userdata); in netiucv_init_netdevice()
1992 if (!privptr->conn) { in netiucv_init_netdevice()
1996 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); in netiucv_init_netdevice()
2000 kfree_fsm(privptr->fsm); in netiucv_init_netdevice()
2024 if (!strncmp(username, cp->userid, 9) && in connection_store()
2025 !strncmp(userdata, cp->userdata, 17)) { in connection_store()
2029 return -EEXIST; in connection_store()
2037 return -ENODEV; in connection_store()
2050 SET_NETDEV_DEV(dev, priv->dev); in connection_store()
2057 dev_info(priv->dev, "The IUCV interface to %s has been established " in connection_store()
2059 netiucv_printuser(priv->conn)); in connection_store()
2064 netiucv_unregister_device(priv->dev); in connection_store()
2085 count = IFNAMSIZ - 1; in remove_store()
2097 ndev = cp->netdev; in remove_store()
2099 dev = priv->dev; in remove_store()
2100 if (strncmp(name, ndev->name, count)) in remove_store()
2103 if (ndev->flags & (IFF_UP | IFF_RUNNING)) { in remove_store()
2106 priv->conn->userid); in remove_store()
2108 return -EPERM; in remove_store()
2116 return -EINVAL; in remove_store()
2151 ndev = cp->netdev; in netiucv_exit()
2153 dev = priv->dev; in netiucv_exit()
2188 rc = -ENOMEM; in netiucv_init()
2192 netiucv_dev->bus = &iucv_bus; in netiucv_init()
2193 netiucv_dev->parent = iucv_root; in netiucv_init()
2194 netiucv_dev->release = (void (*)(struct device *))kfree; in netiucv_init()
2195 netiucv_dev->driver = &netiucv_driver; in netiucv_init()