diff options
Diffstat (limited to 'net/tipc/socket.h')
| -rw-r--r-- | net/tipc/socket.h | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/net/tipc/socket.h b/net/tipc/socket.h index 43b75b3ceced..baa43d03901e 100644 --- a/net/tipc/socket.h +++ b/net/tipc/socket.h | |||
| @@ -35,56 +35,17 @@ | |||
| 35 | #ifndef _TIPC_SOCK_H | 35 | #ifndef _TIPC_SOCK_H |
| 36 | #define _TIPC_SOCK_H | 36 | #define _TIPC_SOCK_H |
| 37 | 37 | ||
| 38 | #include "port.h" | ||
| 39 | #include <net/sock.h> | 38 | #include <net/sock.h> |
| 40 | 39 | ||
| 41 | #define TIPC_CONN_OK 0 | 40 | #define TIPC_CONNACK_INTV 256 |
| 42 | #define TIPC_CONN_PROBING 1 | 41 | #define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2) |
| 43 | 42 | #define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \ | |
| 44 | /** | 43 | SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) |
| 45 | * struct tipc_sock - TIPC socket structure | ||
| 46 | * @sk: socket - interacts with 'port' and with user via the socket API | ||
| 47 | * @port: port - interacts with 'sk' and with the rest of the TIPC stack | ||
| 48 | * @peer_name: the peer of the connection, if any | ||
| 49 | * @conn_timeout: the time we can wait for an unresponded setup request | ||
| 50 | * @dupl_rcvcnt: number of bytes counted twice, in both backlog and rcv queue | ||
| 51 | * @link_cong: non-zero if owner must sleep because of link congestion | ||
| 52 | * @sent_unacked: # messages sent by socket, and not yet acked by peer | ||
| 53 | * @rcv_unacked: # messages read by user, but not yet acked back to peer | ||
| 54 | */ | ||
| 55 | |||
| 56 | struct tipc_sock { | ||
| 57 | struct sock sk; | ||
| 58 | struct tipc_port port; | ||
| 59 | unsigned int conn_timeout; | ||
| 60 | atomic_t dupl_rcvcnt; | ||
| 61 | int link_cong; | ||
| 62 | uint sent_unacked; | ||
| 63 | uint rcv_unacked; | ||
| 64 | }; | ||
| 65 | |||
| 66 | static inline struct tipc_sock *tipc_sk(const struct sock *sk) | ||
| 67 | { | ||
| 68 | return container_of(sk, struct tipc_sock, sk); | ||
| 69 | } | ||
| 70 | |||
| 71 | static inline struct tipc_sock *tipc_port_to_sock(const struct tipc_port *port) | ||
| 72 | { | ||
| 73 | return container_of(port, struct tipc_sock, port); | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline void tipc_sock_wakeup(struct tipc_sock *tsk) | ||
| 77 | { | ||
| 78 | tsk->sk.sk_write_space(&tsk->sk); | ||
| 79 | } | ||
| 80 | |||
| 81 | static inline int tipc_sk_conn_cong(struct tipc_sock *tsk) | ||
| 82 | { | ||
| 83 | return tsk->sent_unacked >= TIPC_FLOWCTRL_WIN; | ||
| 84 | } | ||
| 85 | |||
| 86 | int tipc_sk_rcv(struct sk_buff *buf); | 44 | int tipc_sk_rcv(struct sk_buff *buf); |
| 87 | 45 | struct sk_buff *tipc_sk_socks_show(void); | |
| 88 | void tipc_sk_mcast_rcv(struct sk_buff *buf); | 46 | void tipc_sk_mcast_rcv(struct sk_buff *buf); |
| 47 | void tipc_sk_reinit(void); | ||
| 48 | int tipc_sk_ref_table_init(u32 requested_size, u32 start); | ||
| 49 | void tipc_sk_ref_table_stop(void); | ||
| 89 | 50 | ||
| 90 | #endif | 51 | #endif |
