Lines Matching +full:hi +full:- +full:fi

1 // SPDX-License-Identifier: GPL-2.0+
164 * Representation of event-data for the
193 #define NETIUCV_MTU_MAX (NETIUCV_BUFSIZE_MAX - NETIUCV_HDRLEN)
205 clear_bit(0, &priv->tbusy); in netiucv_clear_busy()
213 return test_and_set_bit(0, &priv->tbusy); in netiucv_test_and_set_busy()
240 while (*p && ((p - tmp) < len) && (!isspace(*p))) in netiucv_printname()
252 if (memcmp(conn->userdata, iucvMagic_ebcdic, 16)) { in netiucv_printuser()
255 memcpy(tmp_uid, netiucv_printname(conn->userid, 8), 8); in netiucv_printuser()
256 memcpy(tmp_udat, conn->userdata, 16); in netiucv_printuser()
262 return netiucv_printname(conn->userid, 8); in netiucv_printuser()
460 return -ENOMEM; in iucv_register_dbf_views()
475 * Callback-wrappers, called from lowlevel iucv layer.
481 struct iucv_connection *conn = path->private; in netiucv_callback_rx()
486 fsm_event(conn->fsm, CONN_EVENT_RX, &ev); in netiucv_callback_rx()
492 struct iucv_connection *conn = path->private; in netiucv_callback_txdone()
497 fsm_event(conn->fsm, CONN_EVENT_TXDONE, &ev); in netiucv_callback_txdone()
502 struct iucv_connection *conn = path->private; in netiucv_callback_connack()
504 fsm_event(conn->fsm, CONN_EVENT_CONN_ACK, conn); in netiucv_callback_connack()
510 struct iucv_connection *conn = path->private; in netiucv_callback_connreq()
516 rc = -EINVAL; in netiucv_callback_connreq()
522 if (strncmp(ipvmid, conn->userid, 8) || in netiucv_callback_connreq()
523 strncmp(ipuser, conn->userdata, 16)) in netiucv_callback_connreq()
526 conn->path = path; in netiucv_callback_connreq()
529 fsm_event(conn->fsm, CONN_EVENT_CONN_REQ, &ev); in netiucv_callback_connreq()
540 struct iucv_connection *conn = path->private; in netiucv_callback_connrej()
542 fsm_event(conn->fsm, CONN_EVENT_CONN_REJ, conn); in netiucv_callback_connrej()
547 struct iucv_connection *conn = path->private; in netiucv_callback_connsusp()
549 fsm_event(conn->fsm, CONN_EVENT_CONN_SUS, conn); in netiucv_callback_connsusp()
554 struct iucv_connection *conn = path->private; in netiucv_callback_connres()
556 fsm_event(conn->fsm, CONN_EVENT_CONN_RES, conn); in netiucv_callback_connres()
562 static void netiucv_action_nop(fsm_instance *fi, int event, void *arg) in netiucv_action_nop() argument
581 struct net_device *dev = conn->netdev; in netiucv_unpack_skb()
586 pskb->dev = dev; in netiucv_unpack_skb()
587 pskb->ip_summed = CHECKSUM_NONE; in netiucv_unpack_skb()
588 pskb->protocol = cpu_to_be16(ETH_P_IP); in netiucv_unpack_skb()
592 struct ll_header *header = (struct ll_header *) pskb->data; in netiucv_unpack_skb()
594 if (!header->next) in netiucv_unpack_skb()
598 header->next -= offset; in netiucv_unpack_skb()
599 offset += header->next; in netiucv_unpack_skb()
600 header->next -= NETIUCV_HDRLEN; in netiucv_unpack_skb()
601 if (skb_tailroom(pskb) < header->next) { in netiucv_unpack_skb()
603 header->next, skb_tailroom(pskb)); in netiucv_unpack_skb()
606 skb_put(pskb, header->next); in netiucv_unpack_skb()
608 skb = dev_alloc_skb(pskb->len); in netiucv_unpack_skb()
612 privptr->stats.rx_dropped++; in netiucv_unpack_skb()
615 skb_copy_from_linear_data(pskb, skb_put(skb, pskb->len), in netiucv_unpack_skb()
616 pskb->len); in netiucv_unpack_skb()
618 skb->dev = pskb->dev; in netiucv_unpack_skb()
619 skb->protocol = pskb->protocol; in netiucv_unpack_skb()
620 pskb->ip_summed = CHECKSUM_UNNECESSARY; in netiucv_unpack_skb()
621 privptr->stats.rx_packets++; in netiucv_unpack_skb()
622 privptr->stats.rx_bytes += skb->len; in netiucv_unpack_skb()
624 skb_pull(pskb, header->next); in netiucv_unpack_skb()
629 static void conn_action_rx(fsm_instance *fi, int event, void *arg) in conn_action_rx() argument
632 struct iucv_connection *conn = ev->conn; in conn_action_rx()
633 struct iucv_message *msg = ev->data; in conn_action_rx()
634 struct netiucv_priv *privptr = netdev_priv(conn->netdev); in conn_action_rx()
639 if (!conn->netdev) { in conn_action_rx()
640 iucv_message_reject(conn->path, msg); in conn_action_rx()
645 if (msg->length > conn->max_buffsize) { in conn_action_rx()
646 iucv_message_reject(conn->path, msg); in conn_action_rx()
647 privptr->stats.rx_dropped++; in conn_action_rx()
649 msg->length, conn->max_buffsize); in conn_action_rx()
652 conn->rx_buff->data = conn->rx_buff->head; in conn_action_rx()
653 skb_reset_tail_pointer(conn->rx_buff); in conn_action_rx()
654 conn->rx_buff->len = 0; in conn_action_rx()
655 rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, in conn_action_rx()
656 msg->length, NULL); in conn_action_rx()
657 if (rc || msg->length < 5) { in conn_action_rx()
658 privptr->stats.rx_errors++; in conn_action_rx()
662 netiucv_unpack_skb(conn, conn->rx_buff); in conn_action_rx()
665 static void conn_action_txdone(fsm_instance *fi, int event, void *arg) in conn_action_txdone() argument
668 struct iucv_connection *conn = ev->conn; in conn_action_txdone()
669 struct iucv_message *msg = ev->data; in conn_action_txdone()
672 u32 single_flag = msg->tag; in conn_action_txdone()
683 if (!conn || !conn->netdev) { in conn_action_txdone()
688 privptr = netdev_priv(conn->netdev); in conn_action_txdone()
689 conn->prof.tx_pending--; in conn_action_txdone()
691 if ((skb = skb_dequeue(&conn->commit_queue))) { in conn_action_txdone()
692 refcount_dec(&skb->users); in conn_action_txdone()
694 privptr->stats.tx_packets++; in conn_action_txdone()
695 privptr->stats.tx_bytes += in conn_action_txdone()
696 (skb->len - NETIUCV_HDRLEN in conn_action_txdone()
697 - NETIUCV_HDRLEN); in conn_action_txdone()
702 conn->tx_buff->data = conn->tx_buff->head; in conn_action_txdone()
703 skb_reset_tail_pointer(conn->tx_buff); in conn_action_txdone()
704 conn->tx_buff->len = 0; in conn_action_txdone()
705 spin_lock_irqsave(&conn->collect_lock, saveflags); in conn_action_txdone()
706 while ((skb = skb_dequeue(&conn->collect_queue))) { in conn_action_txdone()
707 header.next = conn->tx_buff->len + skb->len + NETIUCV_HDRLEN; in conn_action_txdone()
708 skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); in conn_action_txdone()
710 skb_put(conn->tx_buff, skb->len), in conn_action_txdone()
711 skb->len); in conn_action_txdone()
712 txbytes += skb->len; in conn_action_txdone()
715 refcount_dec(&skb->users); in conn_action_txdone()
718 if (conn->collect_len > conn->prof.maxmulti) in conn_action_txdone()
719 conn->prof.maxmulti = conn->collect_len; in conn_action_txdone()
720 conn->collect_len = 0; in conn_action_txdone()
721 spin_unlock_irqrestore(&conn->collect_lock, saveflags); in conn_action_txdone()
722 if (conn->tx_buff->len == 0) { in conn_action_txdone()
723 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_txdone()
728 skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); in conn_action_txdone()
729 conn->prof.send_stamp = jiffies; in conn_action_txdone()
732 rc = iucv_message_send(conn->path, &txmsg, 0, 0, in conn_action_txdone()
733 conn->tx_buff->data, conn->tx_buff->len); in conn_action_txdone()
734 conn->prof.doios_multi++; in conn_action_txdone()
735 conn->prof.txlen += conn->tx_buff->len; in conn_action_txdone()
736 conn->prof.tx_pending++; in conn_action_txdone()
737 if (conn->prof.tx_pending > conn->prof.tx_max_pending) in conn_action_txdone()
738 conn->prof.tx_max_pending = conn->prof.tx_pending; in conn_action_txdone()
740 conn->prof.tx_pending--; in conn_action_txdone()
741 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_txdone()
743 privptr->stats.tx_errors += txpackets; in conn_action_txdone()
747 privptr->stats.tx_packets += txpackets; in conn_action_txdone()
748 privptr->stats.tx_bytes += txbytes; in conn_action_txdone()
750 if (stat_maxcq > conn->prof.maxcqueue) in conn_action_txdone()
751 conn->prof.maxcqueue = stat_maxcq; in conn_action_txdone()
765 static void conn_action_connaccept(fsm_instance *fi, int event, void *arg) in conn_action_connaccept() argument
768 struct iucv_connection *conn = ev->conn; in conn_action_connaccept()
769 struct iucv_path *path = ev->data; in conn_action_connaccept()
770 struct net_device *netdev = conn->netdev; in conn_action_connaccept()
776 conn->path = path; in conn_action_connaccept()
777 path->msglim = NETIUCV_QUEUELEN_DEFAULT; in conn_action_connaccept()
778 path->flags = 0; in conn_action_connaccept()
779 rc = iucv_path_accept(path, &netiucv_handler, conn->userdata , conn); in conn_action_connaccept()
784 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_connaccept()
785 netdev->tx_queue_len = conn->path->msglim; in conn_action_connaccept()
786 fsm_event(privptr->fsm, DEV_EVENT_CONUP, netdev); in conn_action_connaccept()
789 static void conn_action_connreject(fsm_instance *fi, int event, void *arg) in conn_action_connreject() argument
792 struct iucv_path *path = ev->data; in conn_action_connreject()
798 static void conn_action_connack(fsm_instance *fi, int event, void *arg) in conn_action_connack() argument
801 struct net_device *netdev = conn->netdev; in conn_action_connack()
805 fsm_deltimer(&conn->timer); in conn_action_connack()
806 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_connack()
807 netdev->tx_queue_len = conn->path->msglim; in conn_action_connack()
808 fsm_event(privptr->fsm, DEV_EVENT_CONUP, netdev); in conn_action_connack()
811 static void conn_action_conntimsev(fsm_instance *fi, int event, void *arg) in conn_action_conntimsev() argument
816 fsm_deltimer(&conn->timer); in conn_action_conntimsev()
817 iucv_path_sever(conn->path, conn->userdata); in conn_action_conntimsev()
818 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_conntimsev()
821 static void conn_action_connsever(fsm_instance *fi, int event, void *arg) in conn_action_connsever() argument
824 struct net_device *netdev = conn->netdev; in conn_action_connsever()
829 fsm_deltimer(&conn->timer); in conn_action_connsever()
830 iucv_path_sever(conn->path, conn->userdata); in conn_action_connsever()
831 dev_info(privptr->dev, "The peer z/VM guest %s has closed the " in conn_action_connsever()
835 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_connsever()
836 fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev); in conn_action_connsever()
839 static void conn_action_start(fsm_instance *fi, int event, void *arg) in conn_action_start() argument
842 struct net_device *netdev = conn->netdev; in conn_action_start()
848 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
856 fsm_newstate(fi, CONN_STATE_SETUPWAIT); in conn_action_start()
857 conn->path = iucv_path_alloc(NETIUCV_QUEUELEN_DEFAULT, 0, GFP_KERNEL); in conn_action_start()
859 netdev->name, netiucv_printuser(conn)); in conn_action_start()
861 rc = iucv_path_connect(conn->path, &netiucv_handler, conn->userid, in conn_action_start()
862 NULL, conn->userdata, conn); in conn_action_start()
865 netdev->tx_queue_len = conn->path->msglim; in conn_action_start()
866 fsm_addtimer(&conn->timer, NETIUCV_TIMEOUT_5SEC, in conn_action_start()
870 dev_warn(privptr->dev, in conn_action_start()
872 netiucv_printname(conn->userid, 8)); in conn_action_start()
873 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
876 dev_warn(privptr->dev, in conn_action_start()
878 " guest %s\n", netiucv_printname(conn->userid, 8)); in conn_action_start()
879 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
882 dev_err(privptr->dev, in conn_action_start()
885 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
888 dev_err(privptr->dev, in conn_action_start()
891 netiucv_printname(conn->userid, 8)); in conn_action_start()
892 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
895 dev_err(privptr->dev, in conn_action_start()
898 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
901 dev_err(privptr->dev, in conn_action_start()
904 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
908 kfree(conn->path); in conn_action_start()
909 conn->path = NULL; in conn_action_start()
917 refcount_dec(&skb->users); in netiucv_purge_skb_queue()
922 static void conn_action_stop(fsm_instance *fi, int event, void *arg) in conn_action_stop() argument
925 struct iucv_connection *conn = ev->conn; in conn_action_stop()
926 struct net_device *netdev = conn->netdev; in conn_action_stop()
931 fsm_deltimer(&conn->timer); in conn_action_stop()
932 fsm_newstate(fi, CONN_STATE_STOPPED); in conn_action_stop()
933 netiucv_purge_skb_queue(&conn->collect_queue); in conn_action_stop()
934 if (conn->path) { in conn_action_stop()
936 iucv_path_sever(conn->path, conn->userdata); in conn_action_stop()
937 kfree(conn->path); in conn_action_stop()
938 conn->path = NULL; in conn_action_stop()
940 netiucv_purge_skb_queue(&conn->commit_queue); in conn_action_stop()
941 fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev); in conn_action_stop()
944 static void conn_action_inval(fsm_instance *fi, int event, void *arg) in conn_action_inval() argument
947 struct net_device *netdev = conn->netdev; in conn_action_inval()
950 netdev->name, conn->userid); in conn_action_inval()
989 * Actions for interface - statemachine.
994 * @fi: An instance of an interface statemachine.
1000 static void dev_action_start(fsm_instance *fi, int event, void *arg) in dev_action_start() argument
1007 fsm_newstate(fi, DEV_STATE_STARTWAIT); in dev_action_start()
1008 fsm_event(privptr->conn->fsm, CONN_EVENT_START, privptr->conn); in dev_action_start()
1014 * @param fi An instance of an interface statemachine.
1019 dev_action_stop(fsm_instance *fi, int event, void *arg) in dev_action_stop() argument
1027 ev.conn = privptr->conn; in dev_action_stop()
1029 fsm_newstate(fi, DEV_STATE_STOPWAIT); in dev_action_stop()
1030 fsm_event(privptr->conn->fsm, CONN_EVENT_STOP, &ev); in dev_action_stop()
1037 * @param fi An instance of an interface statemachine.
1042 dev_action_connup(fsm_instance *fi, int event, void *arg) in dev_action_connup() argument
1049 switch (fsm_getstate(fi)) { in dev_action_connup()
1051 fsm_newstate(fi, DEV_STATE_RUNNING); in dev_action_connup()
1052 dev_info(privptr->dev, in dev_action_connup()
1055 netiucv_printuser(privptr->conn)); in dev_action_connup()
1070 * @param fi An instance of an interface statemachine.
1075 dev_action_conndown(fsm_instance *fi, int event, void *arg) in dev_action_conndown() argument
1079 switch (fsm_getstate(fi)) { in dev_action_conndown()
1081 fsm_newstate(fi, DEV_STATE_STARTWAIT); in dev_action_conndown()
1084 fsm_newstate(fi, DEV_STATE_STOPPED); in dev_action_conndown()
1115 * @return 0 on success, -ERRNO on failure. (Never fails.)
1125 if (fsm_getstate(conn->fsm) != CONN_STATE_IDLE) { in netiucv_transmit_skb()
1126 int l = skb->len + NETIUCV_HDRLEN; in netiucv_transmit_skb()
1128 spin_lock_irqsave(&conn->collect_lock, saveflags); in netiucv_transmit_skb()
1129 if (conn->collect_len + l > in netiucv_transmit_skb()
1130 (conn->max_buffsize - NETIUCV_HDRLEN)) { in netiucv_transmit_skb()
1131 rc = -EBUSY; in netiucv_transmit_skb()
1135 refcount_inc(&skb->users); in netiucv_transmit_skb()
1136 skb_queue_tail(&conn->collect_queue, skb); in netiucv_transmit_skb()
1137 conn->collect_len += l; in netiucv_transmit_skb()
1140 spin_unlock_irqrestore(&conn->collect_lock, saveflags); in netiucv_transmit_skb()
1147 unsigned long hi = ((unsigned long)(skb_tail_pointer(skb) + in netiucv_transmit_skb() local
1150 if (hi || (skb_tailroom(skb) < 2)) { in netiucv_transmit_skb()
1151 nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + in netiucv_transmit_skb()
1155 rc = -ENOMEM; in netiucv_transmit_skb()
1159 skb_put_data(nskb, skb->data, skb->len); in netiucv_transmit_skb()
1166 header.next = nskb->len + NETIUCV_HDRLEN; in netiucv_transmit_skb()
1171 fsm_newstate(conn->fsm, CONN_STATE_TX); in netiucv_transmit_skb()
1172 conn->prof.send_stamp = jiffies; in netiucv_transmit_skb()
1176 rc = iucv_message_send(conn->path, &msg, 0, 0, in netiucv_transmit_skb()
1177 nskb->data, nskb->len); in netiucv_transmit_skb()
1178 conn->prof.doios_single++; in netiucv_transmit_skb()
1179 conn->prof.txlen += skb->len; in netiucv_transmit_skb()
1180 conn->prof.tx_pending++; in netiucv_transmit_skb()
1181 if (conn->prof.tx_pending > conn->prof.tx_max_pending) in netiucv_transmit_skb()
1182 conn->prof.tx_max_pending = conn->prof.tx_pending; in netiucv_transmit_skb()
1185 fsm_newstate(conn->fsm, CONN_STATE_IDLE); in netiucv_transmit_skb()
1186 conn->prof.tx_pending--; in netiucv_transmit_skb()
1187 privptr = netdev_priv(conn->netdev); in netiucv_transmit_skb()
1189 privptr->stats.tx_errors++; in netiucv_transmit_skb()
1198 skb_trim(skb, skb->len - NETIUCV_HDRLEN); in netiucv_transmit_skb()
1204 refcount_inc(&nskb->users); in netiucv_transmit_skb()
1205 skb_queue_tail(&conn->commit_queue, nskb); in netiucv_transmit_skb()
1222 * @return 0 on success, -ERRNO on failure. (Never fails.)
1228 fsm_event(priv->fsm, DEV_EVENT_START, dev); in netiucv_open()
1238 * @return 0 on success, -ERRNO on failure. (Never fails.)
1244 fsm_event(priv->fsm, DEV_EVENT_STOP, dev); in netiucv_close()
1263 privptr->stats.tx_dropped++; in netiucv_tx()
1270 privptr->stats.tx_dropped++; in netiucv_tx()
1278 if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { in netiucv_tx()
1280 privptr->stats.tx_dropped++; in netiucv_tx()
1281 privptr->stats.tx_errors++; in netiucv_tx()
1282 privptr->stats.tx_carrier_errors++; in netiucv_tx()
1291 rc = netiucv_transmit_skb(privptr->conn, skb); in netiucv_tx()
1309 return &priv->stats; in netiucv_stats()
1322 return sprintf(buf, "%s\n", netiucv_printuser(priv->conn)); in user_show()
1333 ((p - buf) > 8) || in netiucv_check_user()
1334 (buf + count - p > 18))) || in netiucv_check_user()
1337 return -EINVAL; in netiucv_check_user()
1350 return -EINVAL; in netiucv_check_user()
1377 struct net_device *ndev = priv->conn->netdev; in user_write()
1388 if (memcmp(username, priv->conn->userid, 9) && in user_write()
1389 (ndev->flags & (IFF_UP | IFF_RUNNING))) { in user_write()
1392 return -EPERM; in user_write()
1396 if (!strncmp(username, cp->userid, 9) && in user_write()
1397 !strncmp(userdata, cp->userdata, 17) && cp->netdev != ndev) { in user_write()
1401 return -EEXIST; in user_write()
1405 memcpy(priv->conn->userid, username, 9); in user_write()
1406 memcpy(priv->conn->userdata, userdata, 17); in user_write()
1418 return sprintf(buf, "%d\n", priv->conn->max_buffsize); in buffer_show()
1425 struct net_device *ndev = priv->conn->netdev; in buffer_write()
1431 return -EINVAL; in buffer_write()
1435 if (rc == -EINVAL) { in buffer_write()
1438 return -EINVAL; in buffer_write()
1440 if ((rc == -ERANGE) || (bs1 > NETIUCV_BUFSIZE_MAX)) { in buffer_write()
1444 return -EINVAL; in buffer_write()
1446 if ((ndev->flags & IFF_RUNNING) && in buffer_write()
1447 (bs1 < (ndev->mtu + NETIUCV_HDRLEN + 2))) { in buffer_write()
1451 return -EINVAL; in buffer_write()
1457 return -EINVAL; in buffer_write()
1460 priv->conn->max_buffsize = bs1; in buffer_write()
1461 if (!(ndev->flags & IFF_RUNNING)) in buffer_write()
1462 ndev->mtu = bs1 - NETIUCV_HDRLEN - NETIUCV_HDRLEN; in buffer_write()
1476 return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm)); in dev_fsm_show()
1487 return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm)); in conn_fsm_show()
1498 return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti); in maxmulti_show()
1508 priv->conn->prof.maxmulti = 0; in maxmulti_write()
1520 return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue); in maxcq_show()
1529 priv->conn->prof.maxcqueue = 0; in maxcq_write()
1541 return sprintf(buf, "%ld\n", priv->conn->prof.doios_single); in sdoio_show()
1550 priv->conn->prof.doios_single = 0; in sdoio_write()
1562 return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi); in mdoio_show()
1571 priv->conn->prof.doios_multi = 0; in mdoio_write()
1583 return sprintf(buf, "%ld\n", priv->conn->prof.txlen); in txlen_show()
1592 priv->conn->prof.txlen = 0; in txlen_write()
1604 return sprintf(buf, "%ld\n", priv->conn->prof.tx_time); in txtime_show()
1613 priv->conn->prof.tx_time = 0; in txtime_write()
1625 return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending); in txpend_show()
1634 priv->conn->prof.tx_pending = 0; in txpend_write()
1646 return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending); in txmpnd_show()
1655 priv->conn->prof.tx_max_pending = 0; in txmpnd_write()
1705 "net%s", ndev->name); in netiucv_register_device()
1707 return -ENOMEM; in netiucv_register_device()
1714 priv->dev = dev; in netiucv_register_device()
1738 skb_queue_head_init(&conn->collect_queue); in netiucv_new_connection()
1739 skb_queue_head_init(&conn->commit_queue); in netiucv_new_connection()
1740 spin_lock_init(&conn->collect_lock); in netiucv_new_connection()
1741 conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; in netiucv_new_connection()
1742 conn->netdev = dev; in netiucv_new_connection()
1744 conn->rx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1745 if (!conn->rx_buff) in netiucv_new_connection()
1747 conn->tx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1748 if (!conn->tx_buff) in netiucv_new_connection()
1750 conn->fsm = init_fsm("netiucvconn", conn_state_names, in netiucv_new_connection()
1754 if (!conn->fsm) in netiucv_new_connection()
1757 fsm_settimer(conn->fsm, &conn->timer); in netiucv_new_connection()
1758 fsm_newstate(conn->fsm, CONN_STATE_INVALID); in netiucv_new_connection()
1761 memcpy(conn->userdata, userdata, 17); in netiucv_new_connection()
1763 memcpy(conn->userid, username, 9); in netiucv_new_connection()
1764 fsm_newstate(conn->fsm, CONN_STATE_STOPPED); in netiucv_new_connection()
1768 list_add_tail(&conn->list, &iucv_connection_list); in netiucv_new_connection()
1773 kfree_skb(conn->tx_buff); in netiucv_new_connection()
1775 kfree_skb(conn->rx_buff); in netiucv_new_connection()
1791 list_del_init(&conn->list); in netiucv_remove_connection()
1793 fsm_deltimer(&conn->timer); in netiucv_remove_connection()
1794 netiucv_purge_skb_queue(&conn->collect_queue); in netiucv_remove_connection()
1795 if (conn->path) { in netiucv_remove_connection()
1796 iucv_path_sever(conn->path, conn->userdata); in netiucv_remove_connection()
1797 kfree(conn->path); in netiucv_remove_connection()
1798 conn->path = NULL; in netiucv_remove_connection()
1800 netiucv_purge_skb_queue(&conn->commit_queue); in netiucv_remove_connection()
1801 kfree_fsm(conn->fsm); in netiucv_remove_connection()
1802 kfree_skb(conn->rx_buff); in netiucv_remove_connection()
1803 kfree_skb(conn->tx_buff); in netiucv_remove_connection()
1819 if (privptr->conn) in netiucv_free_netdevice()
1820 netiucv_remove_connection(privptr->conn); in netiucv_free_netdevice()
1821 if (privptr->fsm) in netiucv_free_netdevice()
1822 kfree_fsm(privptr->fsm); in netiucv_free_netdevice()
1823 privptr->conn = NULL; privptr->fsm = NULL; in netiucv_free_netdevice()
1840 dev->mtu = NETIUCV_MTU_DEFAULT; in netiucv_setup_netdevice()
1841 dev->min_mtu = 576; in netiucv_setup_netdevice()
1842 dev->max_mtu = NETIUCV_MTU_MAX; in netiucv_setup_netdevice()
1843 dev->needs_free_netdev = true; in netiucv_setup_netdevice()
1844 dev->priv_destructor = netiucv_free_netdevice; in netiucv_setup_netdevice()
1845 dev->hard_header_len = NETIUCV_HDRLEN; in netiucv_setup_netdevice()
1846 dev->addr_len = 0; in netiucv_setup_netdevice()
1847 dev->type = ARPHRD_SLIP; in netiucv_setup_netdevice()
1848 dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT; in netiucv_setup_netdevice()
1849 dev->flags = IFF_POINTOPOINT | IFF_NOARP; in netiucv_setup_netdevice()
1850 dev->netdev_ops = &netiucv_netdev_ops; in netiucv_setup_netdevice()
1866 if (dev_alloc_name(dev, dev->name) < 0) in netiucv_init_netdevice()
1870 privptr->fsm = init_fsm("netiucvdev", dev_state_names, in netiucv_init_netdevice()
1873 if (!privptr->fsm) in netiucv_init_netdevice()
1876 privptr->conn = netiucv_new_connection(dev, username, userdata); in netiucv_init_netdevice()
1877 if (!privptr->conn) { in netiucv_init_netdevice()
1881 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); in netiucv_init_netdevice()
1885 kfree_fsm(privptr->fsm); in netiucv_init_netdevice()
1909 if (!strncmp(username, cp->userid, 9) && in connection_store()
1910 !strncmp(userdata, cp->userdata, 17)) { in connection_store()
1914 return -EEXIST; in connection_store()
1922 return -ENODEV; in connection_store()
1935 SET_NETDEV_DEV(dev, priv->dev); in connection_store()
1942 dev_info(priv->dev, "The IUCV interface to %s has been established " in connection_store()
1944 netiucv_printuser(priv->conn)); in connection_store()
1949 netiucv_unregister_device(priv->dev); in connection_store()
1970 count = IFNAMSIZ - 1; in remove_store()
1982 ndev = cp->netdev; in remove_store()
1984 dev = priv->dev; in remove_store()
1985 if (strncmp(name, ndev->name, count)) in remove_store()
1988 if (ndev->flags & (IFF_UP | IFF_RUNNING)) { in remove_store()
1991 priv->conn->userid); in remove_store()
1993 return -EPERM; in remove_store()
2001 return -EINVAL; in remove_store()
2036 ndev = cp->netdev; in netiucv_exit()
2038 dev = priv->dev; in netiucv_exit()