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()
1270 privptr->stats.tx_dropped++; in netiucv_tx()
1277 privptr->stats.tx_dropped++; in netiucv_tx()
1285 if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { in netiucv_tx()
1287 privptr->stats.tx_dropped++; in netiucv_tx()
1288 privptr->stats.tx_errors++; in netiucv_tx()
1289 privptr->stats.tx_carrier_errors++; in netiucv_tx()
1298 rc = netiucv_transmit_skb(privptr->conn, skb); in netiucv_tx()
1316 return &priv->stats; in netiucv_stats()
1329 return sprintf(buf, "%s\n", netiucv_printuser(priv->conn)); in user_show()
1340 ((p - buf) > 8) || in netiucv_check_user()
1341 (buf + count - p > 18))) || in netiucv_check_user()
1344 return -EINVAL; in netiucv_check_user()
1357 return -EINVAL; in netiucv_check_user()
1384 struct net_device *ndev = priv->conn->netdev; in user_write()
1395 if (memcmp(username, priv->conn->userid, 9) && in user_write()
1396 (ndev->flags & (IFF_UP | IFF_RUNNING))) { in user_write()
1399 return -EPERM; in user_write()
1403 if (!strncmp(username, cp->userid, 9) && in user_write()
1404 !strncmp(userdata, cp->userdata, 17) && cp->netdev != ndev) { in user_write()
1408 return -EEXIST; in user_write()
1412 memcpy(priv->conn->userid, username, 9); in user_write()
1413 memcpy(priv->conn->userdata, userdata, 17); in user_write()
1425 return sprintf(buf, "%d\n", priv->conn->max_buffsize); in buffer_show()
1432 struct net_device *ndev = priv->conn->netdev; in buffer_write()
1438 return -EINVAL; in buffer_write()
1442 if (rc == -EINVAL) { in buffer_write()
1445 return -EINVAL; in buffer_write()
1447 if ((rc == -ERANGE) || (bs1 > NETIUCV_BUFSIZE_MAX)) { in buffer_write()
1451 return -EINVAL; in buffer_write()
1453 if ((ndev->flags & IFF_RUNNING) && in buffer_write()
1454 (bs1 < (ndev->mtu + NETIUCV_HDRLEN + 2))) { in buffer_write()
1458 return -EINVAL; in buffer_write()
1464 return -EINVAL; in buffer_write()
1467 priv->conn->max_buffsize = bs1; in buffer_write()
1468 if (!(ndev->flags & IFF_RUNNING)) in buffer_write()
1469 ndev->mtu = bs1 - NETIUCV_HDRLEN - NETIUCV_HDRLEN; in buffer_write()
1483 return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm)); in dev_fsm_show()
1494 return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm)); in conn_fsm_show()
1505 return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti); in maxmulti_show()
1515 priv->conn->prof.maxmulti = 0; in maxmulti_write()
1527 return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue); in maxcq_show()
1536 priv->conn->prof.maxcqueue = 0; in maxcq_write()
1548 return sprintf(buf, "%ld\n", priv->conn->prof.doios_single); in sdoio_show()
1557 priv->conn->prof.doios_single = 0; in sdoio_write()
1569 return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi); in mdoio_show()
1578 priv->conn->prof.doios_multi = 0; in mdoio_write()
1590 return sprintf(buf, "%ld\n", priv->conn->prof.txlen); in txlen_show()
1599 priv->conn->prof.txlen = 0; in txlen_write()
1611 return sprintf(buf, "%ld\n", priv->conn->prof.tx_time); in txtime_show()
1620 priv->conn->prof.tx_time = 0; in txtime_write()
1632 return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending); in txpend_show()
1641 priv->conn->prof.tx_pending = 0; in txpend_write()
1653 return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending); in txmpnd_show()
1662 priv->conn->prof.tx_max_pending = 0; in txmpnd_write()
1712 dev_set_name(dev, "net%s", ndev->name); in netiucv_register_device()
1713 dev->bus = &iucv_bus; in netiucv_register_device()
1714 dev->parent = iucv_root; in netiucv_register_device()
1715 dev->groups = netiucv_attr_groups; in netiucv_register_device()
1723 dev->release = (void (*)(struct device *))kfree; in netiucv_register_device()
1724 dev->driver = &netiucv_driver; in netiucv_register_device()
1726 return -ENOMEM; in netiucv_register_device()
1733 priv->dev = dev; in netiucv_register_device()
1757 skb_queue_head_init(&conn->collect_queue); in netiucv_new_connection()
1758 skb_queue_head_init(&conn->commit_queue); in netiucv_new_connection()
1759 spin_lock_init(&conn->collect_lock); in netiucv_new_connection()
1760 conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; in netiucv_new_connection()
1761 conn->netdev = dev; in netiucv_new_connection()
1763 conn->rx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1764 if (!conn->rx_buff) in netiucv_new_connection()
1766 conn->tx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1767 if (!conn->tx_buff) in netiucv_new_connection()
1769 conn->fsm = init_fsm("netiucvconn", conn_state_names, in netiucv_new_connection()
1773 if (!conn->fsm) in netiucv_new_connection()
1776 fsm_settimer(conn->fsm, &conn->timer); in netiucv_new_connection()
1777 fsm_newstate(conn->fsm, CONN_STATE_INVALID); in netiucv_new_connection()
1780 memcpy(conn->userdata, userdata, 17); in netiucv_new_connection()
1782 memcpy(conn->userid, username, 9); in netiucv_new_connection()
1783 fsm_newstate(conn->fsm, CONN_STATE_STOPPED); in netiucv_new_connection()
1787 list_add_tail(&conn->list, &iucv_connection_list); in netiucv_new_connection()
1792 kfree_skb(conn->tx_buff); in netiucv_new_connection()
1794 kfree_skb(conn->rx_buff); in netiucv_new_connection()
1810 list_del_init(&conn->list); in netiucv_remove_connection()
1812 fsm_deltimer(&conn->timer); in netiucv_remove_connection()
1813 netiucv_purge_skb_queue(&conn->collect_queue); in netiucv_remove_connection()
1814 if (conn->path) { in netiucv_remove_connection()
1815 iucv_path_sever(conn->path, conn->userdata); in netiucv_remove_connection()
1816 kfree(conn->path); in netiucv_remove_connection()
1817 conn->path = NULL; in netiucv_remove_connection()
1819 netiucv_purge_skb_queue(&conn->commit_queue); in netiucv_remove_connection()
1820 kfree_fsm(conn->fsm); in netiucv_remove_connection()
1821 kfree_skb(conn->rx_buff); in netiucv_remove_connection()
1822 kfree_skb(conn->tx_buff); in netiucv_remove_connection()
1838 if (privptr->conn) in netiucv_free_netdevice()
1839 netiucv_remove_connection(privptr->conn); in netiucv_free_netdevice()
1840 if (privptr->fsm) in netiucv_free_netdevice()
1841 kfree_fsm(privptr->fsm); in netiucv_free_netdevice()
1842 privptr->conn = NULL; privptr->fsm = NULL; in netiucv_free_netdevice()
1859 dev->mtu = NETIUCV_MTU_DEFAULT; in netiucv_setup_netdevice()
1860 dev->min_mtu = 576; in netiucv_setup_netdevice()
1861 dev->max_mtu = NETIUCV_MTU_MAX; in netiucv_setup_netdevice()
1862 dev->needs_free_netdev = true; in netiucv_setup_netdevice()
1863 dev->priv_destructor = netiucv_free_netdevice; in netiucv_setup_netdevice()
1864 dev->hard_header_len = NETIUCV_HDRLEN; in netiucv_setup_netdevice()
1865 dev->addr_len = 0; in netiucv_setup_netdevice()
1866 dev->type = ARPHRD_SLIP; in netiucv_setup_netdevice()
1867 dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT; in netiucv_setup_netdevice()
1868 dev->flags = IFF_POINTOPOINT | IFF_NOARP; in netiucv_setup_netdevice()
1869 dev->netdev_ops = &netiucv_netdev_ops; in netiucv_setup_netdevice()
1885 if (dev_alloc_name(dev, dev->name) < 0) in netiucv_init_netdevice()
1889 privptr->fsm = init_fsm("netiucvdev", dev_state_names, in netiucv_init_netdevice()
1892 if (!privptr->fsm) in netiucv_init_netdevice()
1895 privptr->conn = netiucv_new_connection(dev, username, userdata); in netiucv_init_netdevice()
1896 if (!privptr->conn) { in netiucv_init_netdevice()
1900 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); in netiucv_init_netdevice()
1904 kfree_fsm(privptr->fsm); in netiucv_init_netdevice()
1928 if (!strncmp(username, cp->userid, 9) && in connection_store()
1929 !strncmp(userdata, cp->userdata, 17)) { in connection_store()
1933 return -EEXIST; in connection_store()
1941 return -ENODEV; in connection_store()
1954 SET_NETDEV_DEV(dev, priv->dev); in connection_store()
1961 dev_info(priv->dev, "The IUCV interface to %s has been established " in connection_store()
1963 netiucv_printuser(priv->conn)); in connection_store()
1968 netiucv_unregister_device(priv->dev); in connection_store()
1989 count = IFNAMSIZ - 1; in remove_store()
2001 ndev = cp->netdev; in remove_store()
2003 dev = priv->dev; in remove_store()
2004 if (strncmp(name, ndev->name, count)) in remove_store()
2007 if (ndev->flags & (IFF_UP | IFF_RUNNING)) { in remove_store()
2010 priv->conn->userid); in remove_store()
2012 return -EPERM; in remove_store()
2020 return -EINVAL; in remove_store()
2055 ndev = cp->netdev; in netiucv_exit()
2057 dev = priv->dev; in netiucv_exit()