Skip to content

Commit 3881ac4

Browse files
braunudavem330
authored andcommitted
af_iucv: add HiperSockets transport
The current transport mechanism for af_iucv is the z/VM offered communications facility IUCV. To provide equivalent support when running Linux in an LPAR, HiperSockets transport is added to the AF_IUCV address family. It requires explicit binding of an AF_IUCV socket to a HiperSockets device. A new packet_type ETH_P_AF_IUCV is announced. An af_iucv specific transport header is defined preceding the skb data. A small protocol is implemented for connecting and for flow control/congestion management. Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: Frank Blaschka <[email protected]> Reviewed-by: Hendrik Brueckner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4dc83df commit 3881ac4

File tree

2 files changed

+729
-72
lines changed

2 files changed

+729
-72
lines changed

include/net/iucv/af_iucv.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/list.h>
1515
#include <linux/poll.h>
1616
#include <linux/socket.h>
17+
#include <net/iucv/iucv.h>
1718

1819
#ifndef AF_IUCV
1920
#define AF_IUCV 32
@@ -33,6 +34,7 @@ enum {
3334
};
3435

3536
#define IUCV_QUEUELEN_DEFAULT 65535
37+
#define IUCV_HIPER_MSGLIM_DEFAULT 128
3638
#define IUCV_CONN_TIMEOUT (HZ * 40)
3739
#define IUCV_DISCONN_TIMEOUT (HZ * 2)
3840
#define IUCV_CONN_IDLE_TIMEOUT (HZ * 60)
@@ -57,8 +59,51 @@ struct sock_msg_q {
5759
spinlock_t lock;
5860
};
5961

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+
67+
struct af_iucv_trans_hdr {
68+
u16 magic;
69+
u8 version;
70+
u8 flags;
71+
u16 window;
72+
char destNodeID[8];
73+
char destUserID[8];
74+
char destAppName[16];
75+
char srcNodeID[8];
76+
char srcUserID[8];
77+
char srcAppName[16]; /* => 70 bytes */
78+
struct iucv_message iucv_hdr; /* => 33 bytes */
79+
u8 pad; /* total 104 bytes */
80+
} __packed;
81+
82+
enum iucv_tx_notify {
83+
/* transmission of skb is completed and was successful */
84+
TX_NOTIFY_OK = 0,
85+
/* target is unreachable */
86+
TX_NOTIFY_UNREACHABLE = 1,
87+
/* transfer pending queue full */
88+
TX_NOTIFY_TPQFULL = 2,
89+
/* general error */
90+
TX_NOTIFY_GENERALERROR = 3,
91+
/* transmission of skb is pending - may interleave
92+
* with TX_NOTIFY_DELAYED_* */
93+
TX_NOTIFY_PENDING = 4,
94+
/* transmission of skb was done successfully (delayed) */
95+
TX_NOTIFY_DELAYED_OK = 5,
96+
/* target unreachable (detected delayed) */
97+
TX_NOTIFY_DELAYED_UNREACHABLE = 6,
98+
/* general error (detected delayed) */
99+
TX_NOTIFY_DELAYED_GENERALERROR = 7,
100+
};
101+
60102
#define iucv_sk(__sk) ((struct iucv_sock *) __sk)
61103

104+
#define AF_IUCV_TRANS_IUCV 0
105+
#define AF_IUCV_TRANS_HIPER 1
106+
62107
struct iucv_sock {
63108
struct sock sk;
64109
char src_user_id[8];
@@ -75,6 +120,13 @@ struct iucv_sock {
75120
unsigned int send_tag;
76121
u8 flags;
77122
u16 msglimit;
123+
u16 msglimit_peer;
124+
atomic_t msg_sent;
125+
atomic_t msg_recv;
126+
atomic_t pendings;
127+
int transport;
128+
void (*sk_txnotify)(struct sk_buff *skb,
129+
enum iucv_tx_notify n);
78130
};
79131

80132
/* iucv socket options (SOL_IUCV) */

0 commit comments

Comments
 (0)