1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright 2006 IBM Corporation
4 * IUCV protocol stack for Linux on zSeries
6 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
13 #include <asm/types.h>
14 #include <asm/byteorder.h>
15 #include <linux/list.h>
16 #include <linux/poll.h>
17 #include <linux/socket.h>
18 #include <net/iucv/iucv.h>
22 #define PF_IUCV AF_IUCV
25 /* Connection and socket states */
36 #define IUCV_QUEUELEN_DEFAULT 65535
37 #define IUCV_HIPER_MSGLIM_DEFAULT 128
38 #define IUCV_CONN_TIMEOUT (HZ * 40)
39 #define IUCV_DISCONN_TIMEOUT (HZ * 2)
40 #define IUCV_CONN_IDLE_TIMEOUT (HZ * 60)
41 #define IUCV_BUFSIZE_DEFAULT 32768
43 /* IUCV socket address */
44 struct sockaddr_iucv {
45 sa_family_t siucv_family;
46 unsigned short siucv_port; /* Reserved */
47 unsigned int siucv_addr; /* Reserved */
48 char siucv_nodeid[8]; /* Reserved */
49 char siucv_user_id[8]; /* Guest User Id */
50 char siucv_name[8]; /* Application Name */
54 /* Common socket structures and functions */
56 struct iucv_path *path;
57 struct iucv_message msg;
58 struct list_head list;
62 #define AF_IUCV_FLAG_ACK 0x1
63 #define AF_IUCV_FLAG_SYN 0x2
64 #define AF_IUCV_FLAG_FIN 0x4
65 #define AF_IUCV_FLAG_WIN 0x8
66 #define AF_IUCV_FLAG_SHT 0x10
68 struct af_iucv_trans_hdr {
78 char srcAppName[16]; /* => 70 bytes */
79 struct iucv_message iucv_hdr; /* => 33 bytes */
80 u8 pad; /* total 104 bytes */
83 static inline struct af_iucv_trans_hdr *iucv_trans_hdr(struct sk_buff *skb)
85 return (struct af_iucv_trans_hdr *)skb_network_header(skb);
89 /* transmission of skb is completed and was successful */
91 /* target is unreachable */
92 TX_NOTIFY_UNREACHABLE = 1,
93 /* transfer pending queue full */
94 TX_NOTIFY_TPQFULL = 2,
96 TX_NOTIFY_GENERALERROR = 3,
97 /* transmission of skb is pending - may interleave
98 * with TX_NOTIFY_DELAYED_* */
99 TX_NOTIFY_PENDING = 4,
100 /* transmission of skb was done successfully (delayed) */
101 TX_NOTIFY_DELAYED_OK = 5,
102 /* target unreachable (detected delayed) */
103 TX_NOTIFY_DELAYED_UNREACHABLE = 6,
104 /* general error (detected delayed) */
105 TX_NOTIFY_DELAYED_GENERALERROR = 7,
108 #define iucv_sk(__sk) ((struct iucv_sock *) __sk)
110 #define AF_IUCV_TRANS_IUCV 0
111 #define AF_IUCV_TRANS_HIPER 1
121 struct list_head accept_q;
122 spinlock_t accept_q_lock;
124 struct iucv_path *path;
125 struct net_device *hs_dev;
126 struct sk_buff_head send_skb_q;
127 struct sk_buff_head backlog_skb_q;
128 struct sock_msg_q message_q;
129 unsigned int send_tag;
133 atomic_t skbs_in_xmit;
138 void (*sk_txnotify)(struct sock *sk,
139 enum iucv_tx_notify n);
143 u32 class; /* target class of message */
144 u32 tag; /* tag associated with message */
145 u32 offset; /* offset for skb receival */
148 #define IUCV_SKB_CB(__skb) ((struct iucv_skb_cb *)&((__skb)->cb[0]))
150 /* iucv socket options (SOL_IUCV) */
151 #define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
152 #define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
153 #define SO_MSGSIZE 0x0800 /* get maximum msgsize */
155 /* iucv related control messages (scm) */
156 #define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
158 struct iucv_sock_list {
159 struct hlist_head head;
161 atomic_t autobind_name;
164 #endif /* __IUCV_H */