Lines Matching +full:hi +full:- +full:fi
1 // SPDX-License-Identifier: GPL-2.0+
182 * Representation of event-data for the
211 #define NETIUCV_MTU_MAX (NETIUCV_BUFSIZE_MAX - NETIUCV_HDRLEN)
223 clear_bit(0, &priv->tbusy); in netiucv_clear_busy()
231 return test_and_set_bit(0, &priv->tbusy); in netiucv_test_and_set_busy()
258 while (*p && ((p - tmp) < len) && (!isspace(*p))) in netiucv_printname()
270 if (memcmp(conn->userdata, iucvMagic_ebcdic, 16)) { in netiucv_printuser()
273 memcpy(tmp_uid, netiucv_printname(conn->userid, 8), 8); in netiucv_printuser()
274 memcpy(tmp_udat, conn->userdata, 16); in netiucv_printuser()
280 return netiucv_printname(conn->userid, 8); in netiucv_printuser()
478 return -ENOMEM; in iucv_register_dbf_views()
493 * Callback-wrappers, called from lowlevel iucv layer.
499 struct iucv_connection *conn = path->private; in netiucv_callback_rx()
504 fsm_event(conn->fsm, CONN_EVENT_RX, &ev); in netiucv_callback_rx()
510 struct iucv_connection *conn = path->private; in netiucv_callback_txdone()
515 fsm_event(conn->fsm, CONN_EVENT_TXDONE, &ev); in netiucv_callback_txdone()
520 struct iucv_connection *conn = path->private; in netiucv_callback_connack()
522 fsm_event(conn->fsm, CONN_EVENT_CONN_ACK, conn); in netiucv_callback_connack()
528 struct iucv_connection *conn = path->private; in netiucv_callback_connreq()
534 rc = -EINVAL; in netiucv_callback_connreq()
540 if (strncmp(ipvmid, conn->userid, 8) || in netiucv_callback_connreq()
541 strncmp(ipuser, conn->userdata, 16)) in netiucv_callback_connreq()
544 conn->path = path; in netiucv_callback_connreq()
547 fsm_event(conn->fsm, CONN_EVENT_CONN_REQ, &ev); in netiucv_callback_connreq()
558 struct iucv_connection *conn = path->private; in netiucv_callback_connrej()
560 fsm_event(conn->fsm, CONN_EVENT_CONN_REJ, conn); in netiucv_callback_connrej()
565 struct iucv_connection *conn = path->private; in netiucv_callback_connsusp()
567 fsm_event(conn->fsm, CONN_EVENT_CONN_SUS, conn); in netiucv_callback_connsusp()
572 struct iucv_connection *conn = path->private; in netiucv_callback_connres()
574 fsm_event(conn->fsm, CONN_EVENT_CONN_RES, conn); in netiucv_callback_connres()
580 static void netiucv_action_nop(fsm_instance *fi, int event, void *arg) in netiucv_action_nop() argument
599 struct net_device *dev = conn->netdev; in netiucv_unpack_skb()
604 pskb->dev = dev; in netiucv_unpack_skb()
605 pskb->ip_summed = CHECKSUM_NONE; in netiucv_unpack_skb()
606 pskb->protocol = cpu_to_be16(ETH_P_IP); in netiucv_unpack_skb()
610 struct ll_header *header = (struct ll_header *) pskb->data; in netiucv_unpack_skb()
612 if (!header->next) in netiucv_unpack_skb()
616 header->next -= offset; in netiucv_unpack_skb()
617 offset += header->next; in netiucv_unpack_skb()
618 header->next -= NETIUCV_HDRLEN; in netiucv_unpack_skb()
619 if (skb_tailroom(pskb) < header->next) { in netiucv_unpack_skb()
621 header->next, skb_tailroom(pskb)); in netiucv_unpack_skb()
624 skb_put(pskb, header->next); in netiucv_unpack_skb()
626 skb = dev_alloc_skb(pskb->len); in netiucv_unpack_skb()
630 privptr->stats.rx_dropped++; in netiucv_unpack_skb()
633 skb_copy_from_linear_data(pskb, skb_put(skb, pskb->len), in netiucv_unpack_skb()
634 pskb->len); in netiucv_unpack_skb()
636 skb->dev = pskb->dev; in netiucv_unpack_skb()
637 skb->protocol = pskb->protocol; in netiucv_unpack_skb()
638 pskb->ip_summed = CHECKSUM_UNNECESSARY; in netiucv_unpack_skb()
639 privptr->stats.rx_packets++; in netiucv_unpack_skb()
640 privptr->stats.rx_bytes += skb->len; in netiucv_unpack_skb()
646 skb_pull(pskb, header->next); in netiucv_unpack_skb()
651 static void conn_action_rx(fsm_instance *fi, int event, void *arg) in conn_action_rx() argument
654 struct iucv_connection *conn = ev->conn; in conn_action_rx()
655 struct iucv_message *msg = ev->data; in conn_action_rx()
656 struct netiucv_priv *privptr = netdev_priv(conn->netdev); in conn_action_rx()
661 if (!conn->netdev) { in conn_action_rx()
662 iucv_message_reject(conn->path, msg); in conn_action_rx()
667 if (msg->length > conn->max_buffsize) { in conn_action_rx()
668 iucv_message_reject(conn->path, msg); in conn_action_rx()
669 privptr->stats.rx_dropped++; in conn_action_rx()
671 msg->length, conn->max_buffsize); in conn_action_rx()
674 conn->rx_buff->data = conn->rx_buff->head; in conn_action_rx()
675 skb_reset_tail_pointer(conn->rx_buff); in conn_action_rx()
676 conn->rx_buff->len = 0; in conn_action_rx()
677 rc = iucv_message_receive(conn->path, msg, 0, conn->rx_buff->data, in conn_action_rx()
678 msg->length, NULL); in conn_action_rx()
679 if (rc || msg->length < 5) { in conn_action_rx()
680 privptr->stats.rx_errors++; in conn_action_rx()
684 netiucv_unpack_skb(conn, conn->rx_buff); in conn_action_rx()
687 static void conn_action_txdone(fsm_instance *fi, int event, void *arg) in conn_action_txdone() argument
690 struct iucv_connection *conn = ev->conn; in conn_action_txdone()
691 struct iucv_message *msg = ev->data; in conn_action_txdone()
694 u32 single_flag = msg->tag; in conn_action_txdone()
705 if (!conn || !conn->netdev) { in conn_action_txdone()
710 privptr = netdev_priv(conn->netdev); in conn_action_txdone()
711 conn->prof.tx_pending--; in conn_action_txdone()
713 if ((skb = skb_dequeue(&conn->commit_queue))) { in conn_action_txdone()
714 refcount_dec(&skb->users); in conn_action_txdone()
716 privptr->stats.tx_packets++; in conn_action_txdone()
717 privptr->stats.tx_bytes += in conn_action_txdone()
718 (skb->len - NETIUCV_HDRLEN in conn_action_txdone()
719 - NETIUCV_HDRLEN); in conn_action_txdone()
724 conn->tx_buff->data = conn->tx_buff->head; in conn_action_txdone()
725 skb_reset_tail_pointer(conn->tx_buff); in conn_action_txdone()
726 conn->tx_buff->len = 0; in conn_action_txdone()
727 spin_lock_irqsave(&conn->collect_lock, saveflags); in conn_action_txdone()
728 while ((skb = skb_dequeue(&conn->collect_queue))) { in conn_action_txdone()
729 header.next = conn->tx_buff->len + skb->len + NETIUCV_HDRLEN; in conn_action_txdone()
730 skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); in conn_action_txdone()
732 skb_put(conn->tx_buff, skb->len), in conn_action_txdone()
733 skb->len); in conn_action_txdone()
734 txbytes += skb->len; in conn_action_txdone()
737 refcount_dec(&skb->users); in conn_action_txdone()
740 if (conn->collect_len > conn->prof.maxmulti) in conn_action_txdone()
741 conn->prof.maxmulti = conn->collect_len; in conn_action_txdone()
742 conn->collect_len = 0; in conn_action_txdone()
743 spin_unlock_irqrestore(&conn->collect_lock, saveflags); in conn_action_txdone()
744 if (conn->tx_buff->len == 0) { in conn_action_txdone()
745 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_txdone()
750 skb_put_data(conn->tx_buff, &header, NETIUCV_HDRLEN); in conn_action_txdone()
751 conn->prof.send_stamp = jiffies; in conn_action_txdone()
754 rc = iucv_message_send(conn->path, &txmsg, 0, 0, in conn_action_txdone()
755 conn->tx_buff->data, conn->tx_buff->len); in conn_action_txdone()
756 conn->prof.doios_multi++; in conn_action_txdone()
757 conn->prof.txlen += conn->tx_buff->len; in conn_action_txdone()
758 conn->prof.tx_pending++; in conn_action_txdone()
759 if (conn->prof.tx_pending > conn->prof.tx_max_pending) in conn_action_txdone()
760 conn->prof.tx_max_pending = conn->prof.tx_pending; in conn_action_txdone()
762 conn->prof.tx_pending--; in conn_action_txdone()
763 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_txdone()
765 privptr->stats.tx_errors += txpackets; in conn_action_txdone()
769 privptr->stats.tx_packets += txpackets; in conn_action_txdone()
770 privptr->stats.tx_bytes += txbytes; in conn_action_txdone()
772 if (stat_maxcq > conn->prof.maxcqueue) in conn_action_txdone()
773 conn->prof.maxcqueue = stat_maxcq; in conn_action_txdone()
777 static void conn_action_connaccept(fsm_instance *fi, int event, void *arg) in conn_action_connaccept() argument
780 struct iucv_connection *conn = ev->conn; in conn_action_connaccept()
781 struct iucv_path *path = ev->data; in conn_action_connaccept()
782 struct net_device *netdev = conn->netdev; in conn_action_connaccept()
788 conn->path = path; in conn_action_connaccept()
789 path->msglim = NETIUCV_QUEUELEN_DEFAULT; in conn_action_connaccept()
790 path->flags = 0; in conn_action_connaccept()
791 rc = iucv_path_accept(path, &netiucv_handler, conn->userdata , conn); in conn_action_connaccept()
796 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_connaccept()
797 netdev->tx_queue_len = conn->path->msglim; in conn_action_connaccept()
798 fsm_event(privptr->fsm, DEV_EVENT_CONUP, netdev); in conn_action_connaccept()
801 static void conn_action_connreject(fsm_instance *fi, int event, void *arg) in conn_action_connreject() argument
804 struct iucv_path *path = ev->data; in conn_action_connreject()
810 static void conn_action_connack(fsm_instance *fi, int event, void *arg) in conn_action_connack() argument
813 struct net_device *netdev = conn->netdev; in conn_action_connack()
817 fsm_deltimer(&conn->timer); in conn_action_connack()
818 fsm_newstate(fi, CONN_STATE_IDLE); in conn_action_connack()
819 netdev->tx_queue_len = conn->path->msglim; in conn_action_connack()
820 fsm_event(privptr->fsm, DEV_EVENT_CONUP, netdev); in conn_action_connack()
823 static void conn_action_conntimsev(fsm_instance *fi, int event, void *arg) in conn_action_conntimsev() argument
828 fsm_deltimer(&conn->timer); in conn_action_conntimsev()
829 iucv_path_sever(conn->path, conn->userdata); in conn_action_conntimsev()
830 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_conntimsev()
833 static void conn_action_connsever(fsm_instance *fi, int event, void *arg) in conn_action_connsever() argument
836 struct net_device *netdev = conn->netdev; in conn_action_connsever()
841 fsm_deltimer(&conn->timer); in conn_action_connsever()
842 iucv_path_sever(conn->path, conn->userdata); in conn_action_connsever()
843 dev_info(privptr->dev, "The peer z/VM guest %s has closed the " in conn_action_connsever()
847 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_connsever()
848 fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev); in conn_action_connsever()
851 static void conn_action_start(fsm_instance *fi, int event, void *arg) in conn_action_start() argument
854 struct net_device *netdev = conn->netdev; in conn_action_start()
860 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
868 fsm_newstate(fi, CONN_STATE_SETUPWAIT); in conn_action_start()
869 conn->path = iucv_path_alloc(NETIUCV_QUEUELEN_DEFAULT, 0, GFP_KERNEL); in conn_action_start()
871 netdev->name, netiucv_printuser(conn)); in conn_action_start()
873 rc = iucv_path_connect(conn->path, &netiucv_handler, conn->userid, in conn_action_start()
874 NULL, conn->userdata, conn); in conn_action_start()
877 netdev->tx_queue_len = conn->path->msglim; in conn_action_start()
878 fsm_addtimer(&conn->timer, NETIUCV_TIMEOUT_5SEC, in conn_action_start()
882 dev_warn(privptr->dev, in conn_action_start()
884 netiucv_printname(conn->userid, 8)); in conn_action_start()
885 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
888 dev_warn(privptr->dev, in conn_action_start()
890 " guest %s\n", netiucv_printname(conn->userid, 8)); in conn_action_start()
891 fsm_newstate(fi, CONN_STATE_STARTWAIT); in conn_action_start()
894 dev_err(privptr->dev, in conn_action_start()
897 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
900 dev_err(privptr->dev, in conn_action_start()
903 netiucv_printname(conn->userid, 8)); in conn_action_start()
904 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
907 dev_err(privptr->dev, in conn_action_start()
910 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
913 dev_err(privptr->dev, in conn_action_start()
916 fsm_newstate(fi, CONN_STATE_CONNERR); in conn_action_start()
920 kfree(conn->path); in conn_action_start()
921 conn->path = NULL; in conn_action_start()
929 refcount_dec(&skb->users); in netiucv_purge_skb_queue()
934 static void conn_action_stop(fsm_instance *fi, int event, void *arg) in conn_action_stop() argument
937 struct iucv_connection *conn = ev->conn; in conn_action_stop()
938 struct net_device *netdev = conn->netdev; in conn_action_stop()
943 fsm_deltimer(&conn->timer); in conn_action_stop()
944 fsm_newstate(fi, CONN_STATE_STOPPED); in conn_action_stop()
945 netiucv_purge_skb_queue(&conn->collect_queue); in conn_action_stop()
946 if (conn->path) { in conn_action_stop()
948 iucv_path_sever(conn->path, conn->userdata); in conn_action_stop()
949 kfree(conn->path); in conn_action_stop()
950 conn->path = NULL; in conn_action_stop()
952 netiucv_purge_skb_queue(&conn->commit_queue); in conn_action_stop()
953 fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev); in conn_action_stop()
956 static void conn_action_inval(fsm_instance *fi, int event, void *arg) in conn_action_inval() argument
959 struct net_device *netdev = conn->netdev; in conn_action_inval()
962 netdev->name, conn->userid); in conn_action_inval()
1001 * Actions for interface - statemachine.
1006 * @fi: An instance of an interface statemachine.
1012 static void dev_action_start(fsm_instance *fi, int event, void *arg) in dev_action_start() argument
1019 fsm_newstate(fi, DEV_STATE_STARTWAIT); in dev_action_start()
1020 fsm_event(privptr->conn->fsm, CONN_EVENT_START, privptr->conn); in dev_action_start()
1026 * @param fi An instance of an interface statemachine.
1031 dev_action_stop(fsm_instance *fi, int event, void *arg) in dev_action_stop() argument
1039 ev.conn = privptr->conn; in dev_action_stop()
1041 fsm_newstate(fi, DEV_STATE_STOPWAIT); in dev_action_stop()
1042 fsm_event(privptr->conn->fsm, CONN_EVENT_STOP, &ev); in dev_action_stop()
1049 * @param fi An instance of an interface statemachine.
1054 dev_action_connup(fsm_instance *fi, int event, void *arg) in dev_action_connup() argument
1061 switch (fsm_getstate(fi)) { in dev_action_connup()
1063 fsm_newstate(fi, DEV_STATE_RUNNING); in dev_action_connup()
1064 dev_info(privptr->dev, in dev_action_connup()
1067 netiucv_printuser(privptr->conn)); in dev_action_connup()
1082 * @param fi An instance of an interface statemachine.
1087 dev_action_conndown(fsm_instance *fi, int event, void *arg) in dev_action_conndown() argument
1091 switch (fsm_getstate(fi)) { in dev_action_conndown()
1093 fsm_newstate(fi, DEV_STATE_STARTWAIT); in dev_action_conndown()
1096 fsm_newstate(fi, DEV_STATE_STOPPED); in dev_action_conndown()
1127 * @return 0 on success, -ERRNO on failure. (Never fails.)
1137 if (fsm_getstate(conn->fsm) != CONN_STATE_IDLE) { in netiucv_transmit_skb()
1138 int l = skb->len + NETIUCV_HDRLEN; in netiucv_transmit_skb()
1140 spin_lock_irqsave(&conn->collect_lock, saveflags); in netiucv_transmit_skb()
1141 if (conn->collect_len + l > in netiucv_transmit_skb()
1142 (conn->max_buffsize - NETIUCV_HDRLEN)) { in netiucv_transmit_skb()
1143 rc = -EBUSY; in netiucv_transmit_skb()
1147 refcount_inc(&skb->users); in netiucv_transmit_skb()
1148 skb_queue_tail(&conn->collect_queue, skb); in netiucv_transmit_skb()
1149 conn->collect_len += l; in netiucv_transmit_skb()
1152 spin_unlock_irqrestore(&conn->collect_lock, saveflags); in netiucv_transmit_skb()
1159 unsigned long hi = ((unsigned long)(skb_tail_pointer(skb) + in netiucv_transmit_skb() local
1162 if (hi || (skb_tailroom(skb) < 2)) { in netiucv_transmit_skb()
1163 nskb = alloc_skb(skb->len + NETIUCV_HDRLEN + in netiucv_transmit_skb()
1167 rc = -ENOMEM; in netiucv_transmit_skb()
1171 skb_put_data(nskb, skb->data, skb->len); in netiucv_transmit_skb()
1178 header.next = nskb->len + NETIUCV_HDRLEN; in netiucv_transmit_skb()
1183 fsm_newstate(conn->fsm, CONN_STATE_TX); in netiucv_transmit_skb()
1184 conn->prof.send_stamp = jiffies; in netiucv_transmit_skb()
1188 rc = iucv_message_send(conn->path, &msg, 0, 0, in netiucv_transmit_skb()
1189 nskb->data, nskb->len); in netiucv_transmit_skb()
1190 conn->prof.doios_single++; in netiucv_transmit_skb()
1191 conn->prof.txlen += skb->len; in netiucv_transmit_skb()
1192 conn->prof.tx_pending++; in netiucv_transmit_skb()
1193 if (conn->prof.tx_pending > conn->prof.tx_max_pending) in netiucv_transmit_skb()
1194 conn->prof.tx_max_pending = conn->prof.tx_pending; in netiucv_transmit_skb()
1197 fsm_newstate(conn->fsm, CONN_STATE_IDLE); in netiucv_transmit_skb()
1198 conn->prof.tx_pending--; in netiucv_transmit_skb()
1199 privptr = netdev_priv(conn->netdev); in netiucv_transmit_skb()
1201 privptr->stats.tx_errors++; in netiucv_transmit_skb()
1210 skb_trim(skb, skb->len - NETIUCV_HDRLEN); in netiucv_transmit_skb()
1216 refcount_inc(&nskb->users); in netiucv_transmit_skb()
1217 skb_queue_tail(&conn->commit_queue, nskb); in netiucv_transmit_skb()
1234 * @return 0 on success, -ERRNO on failure. (Never fails.)
1240 fsm_event(priv->fsm, DEV_EVENT_START, dev); in netiucv_open()
1250 * @return 0 on success, -ERRNO on failure. (Never fails.)
1256 fsm_event(priv->fsm, DEV_EVENT_STOP, dev); in netiucv_close()
1282 privptr->stats.tx_dropped++; in netiucv_tx()
1289 privptr->stats.tx_dropped++; in netiucv_tx()
1297 if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) { in netiucv_tx()
1299 privptr->stats.tx_dropped++; in netiucv_tx()
1300 privptr->stats.tx_errors++; in netiucv_tx()
1301 privptr->stats.tx_carrier_errors++; in netiucv_tx()
1310 rc = netiucv_transmit_skb(privptr->conn, skb); in netiucv_tx()
1328 return &priv->stats; in netiucv_stats()
1341 return sprintf(buf, "%s\n", netiucv_printuser(priv->conn)); in user_show()
1352 ((p - buf) > 8) || in netiucv_check_user()
1353 (buf + count - p > 18))) || in netiucv_check_user()
1356 return -EINVAL; in netiucv_check_user()
1369 return -EINVAL; in netiucv_check_user()
1396 struct net_device *ndev = priv->conn->netdev; in user_write()
1407 if (memcmp(username, priv->conn->userid, 9) && in user_write()
1408 (ndev->flags & (IFF_UP | IFF_RUNNING))) { in user_write()
1411 return -EPERM; in user_write()
1415 if (!strncmp(username, cp->userid, 9) && in user_write()
1416 !strncmp(userdata, cp->userdata, 17) && cp->netdev != ndev) { in user_write()
1420 return -EEXIST; in user_write()
1424 memcpy(priv->conn->userid, username, 9); in user_write()
1425 memcpy(priv->conn->userdata, userdata, 17); in user_write()
1437 return sprintf(buf, "%d\n", priv->conn->max_buffsize); in buffer_show()
1444 struct net_device *ndev = priv->conn->netdev; in buffer_write()
1450 return -EINVAL; in buffer_write()
1454 if (rc == -EINVAL) { in buffer_write()
1457 return -EINVAL; in buffer_write()
1459 if ((rc == -ERANGE) || (bs1 > NETIUCV_BUFSIZE_MAX)) { in buffer_write()
1463 return -EINVAL; in buffer_write()
1465 if ((ndev->flags & IFF_RUNNING) && in buffer_write()
1466 (bs1 < (ndev->mtu + NETIUCV_HDRLEN + 2))) { in buffer_write()
1470 return -EINVAL; in buffer_write()
1476 return -EINVAL; in buffer_write()
1479 priv->conn->max_buffsize = bs1; in buffer_write()
1480 if (!(ndev->flags & IFF_RUNNING)) in buffer_write()
1481 ndev->mtu = bs1 - NETIUCV_HDRLEN - NETIUCV_HDRLEN; in buffer_write()
1495 return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm)); in dev_fsm_show()
1506 return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm)); in conn_fsm_show()
1517 return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti); in maxmulti_show()
1527 priv->conn->prof.maxmulti = 0; in maxmulti_write()
1539 return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue); in maxcq_show()
1548 priv->conn->prof.maxcqueue = 0; in maxcq_write()
1560 return sprintf(buf, "%ld\n", priv->conn->prof.doios_single); in sdoio_show()
1569 priv->conn->prof.doios_single = 0; in sdoio_write()
1581 return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi); in mdoio_show()
1590 priv->conn->prof.doios_multi = 0; in mdoio_write()
1602 return sprintf(buf, "%ld\n", priv->conn->prof.txlen); in txlen_show()
1611 priv->conn->prof.txlen = 0; in txlen_write()
1623 return sprintf(buf, "%ld\n", priv->conn->prof.tx_time); in txtime_show()
1632 priv->conn->prof.tx_time = 0; in txtime_write()
1644 return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending); in txpend_show()
1653 priv->conn->prof.tx_pending = 0; in txpend_write()
1665 return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending); in txmpnd_show()
1674 priv->conn->prof.tx_max_pending = 0; in txmpnd_write()
1724 dev_set_name(dev, "net%s", ndev->name); in netiucv_register_device()
1725 dev->bus = &iucv_bus; in netiucv_register_device()
1726 dev->parent = iucv_root; in netiucv_register_device()
1727 dev->groups = netiucv_attr_groups; in netiucv_register_device()
1735 dev->release = (void (*)(struct device *))kfree; in netiucv_register_device()
1736 dev->driver = &netiucv_driver; in netiucv_register_device()
1738 return -ENOMEM; in netiucv_register_device()
1745 priv->dev = dev; in netiucv_register_device()
1769 skb_queue_head_init(&conn->collect_queue); in netiucv_new_connection()
1770 skb_queue_head_init(&conn->commit_queue); in netiucv_new_connection()
1771 spin_lock_init(&conn->collect_lock); in netiucv_new_connection()
1772 conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; in netiucv_new_connection()
1773 conn->netdev = dev; in netiucv_new_connection()
1775 conn->rx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1776 if (!conn->rx_buff) in netiucv_new_connection()
1778 conn->tx_buff = alloc_skb(conn->max_buffsize, GFP_KERNEL | GFP_DMA); in netiucv_new_connection()
1779 if (!conn->tx_buff) in netiucv_new_connection()
1781 conn->fsm = init_fsm("netiucvconn", conn_state_names, in netiucv_new_connection()
1785 if (!conn->fsm) in netiucv_new_connection()
1788 fsm_settimer(conn->fsm, &conn->timer); in netiucv_new_connection()
1789 fsm_newstate(conn->fsm, CONN_STATE_INVALID); in netiucv_new_connection()
1792 memcpy(conn->userdata, userdata, 17); in netiucv_new_connection()
1794 memcpy(conn->userid, username, 9); in netiucv_new_connection()
1795 fsm_newstate(conn->fsm, CONN_STATE_STOPPED); in netiucv_new_connection()
1799 list_add_tail(&conn->list, &iucv_connection_list); in netiucv_new_connection()
1804 kfree_skb(conn->tx_buff); in netiucv_new_connection()
1806 kfree_skb(conn->rx_buff); in netiucv_new_connection()
1822 list_del_init(&conn->list); in netiucv_remove_connection()
1824 fsm_deltimer(&conn->timer); in netiucv_remove_connection()
1825 netiucv_purge_skb_queue(&conn->collect_queue); in netiucv_remove_connection()
1826 if (conn->path) { in netiucv_remove_connection()
1827 iucv_path_sever(conn->path, conn->userdata); in netiucv_remove_connection()
1828 kfree(conn->path); in netiucv_remove_connection()
1829 conn->path = NULL; in netiucv_remove_connection()
1831 netiucv_purge_skb_queue(&conn->commit_queue); in netiucv_remove_connection()
1832 kfree_fsm(conn->fsm); in netiucv_remove_connection()
1833 kfree_skb(conn->rx_buff); in netiucv_remove_connection()
1834 kfree_skb(conn->tx_buff); in netiucv_remove_connection()
1850 if (privptr->conn) in netiucv_free_netdevice()
1851 netiucv_remove_connection(privptr->conn); in netiucv_free_netdevice()
1852 if (privptr->fsm) in netiucv_free_netdevice()
1853 kfree_fsm(privptr->fsm); in netiucv_free_netdevice()
1854 privptr->conn = NULL; privptr->fsm = NULL; in netiucv_free_netdevice()
1871 dev->mtu = NETIUCV_MTU_DEFAULT; in netiucv_setup_netdevice()
1872 dev->min_mtu = 576; in netiucv_setup_netdevice()
1873 dev->max_mtu = NETIUCV_MTU_MAX; in netiucv_setup_netdevice()
1874 dev->needs_free_netdev = true; in netiucv_setup_netdevice()
1875 dev->priv_destructor = netiucv_free_netdevice; in netiucv_setup_netdevice()
1876 dev->hard_header_len = NETIUCV_HDRLEN; in netiucv_setup_netdevice()
1877 dev->addr_len = 0; in netiucv_setup_netdevice()
1878 dev->type = ARPHRD_SLIP; in netiucv_setup_netdevice()
1879 dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT; in netiucv_setup_netdevice()
1880 dev->flags = IFF_POINTOPOINT | IFF_NOARP; in netiucv_setup_netdevice()
1881 dev->netdev_ops = &netiucv_netdev_ops; in netiucv_setup_netdevice()
1897 if (dev_alloc_name(dev, dev->name) < 0) in netiucv_init_netdevice()
1901 privptr->fsm = init_fsm("netiucvdev", dev_state_names, in netiucv_init_netdevice()
1904 if (!privptr->fsm) in netiucv_init_netdevice()
1907 privptr->conn = netiucv_new_connection(dev, username, userdata); in netiucv_init_netdevice()
1908 if (!privptr->conn) { in netiucv_init_netdevice()
1912 fsm_newstate(privptr->fsm, DEV_STATE_STOPPED); in netiucv_init_netdevice()
1916 kfree_fsm(privptr->fsm); in netiucv_init_netdevice()
1940 if (!strncmp(username, cp->userid, 9) && in connection_store()
1941 !strncmp(userdata, cp->userdata, 17)) { in connection_store()
1945 return -EEXIST; in connection_store()
1953 return -ENODEV; in connection_store()
1966 SET_NETDEV_DEV(dev, priv->dev); in connection_store()
1973 dev_info(priv->dev, "The IUCV interface to %s has been established " in connection_store()
1975 netiucv_printuser(priv->conn)); in connection_store()
1980 netiucv_unregister_device(priv->dev); in connection_store()
2001 count = IFNAMSIZ - 1; in remove_store()
2013 ndev = cp->netdev; in remove_store()
2015 dev = priv->dev; in remove_store()
2016 if (strncmp(name, ndev->name, count)) in remove_store()
2019 if (ndev->flags & (IFF_UP | IFF_RUNNING)) { in remove_store()
2022 priv->conn->userid); in remove_store()
2024 return -EPERM; in remove_store()
2032 return -EINVAL; in remove_store()
2067 ndev = cp->netdev; in netiucv_exit()
2069 dev = priv->dev; in netiucv_exit()