aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.h
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2014-08-22 18:09:20 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-23 14:18:35 -0400
commit301bae56f21295a4ba71367818d80735687f11ac (patch)
treedd7368248aaf26d2476a54a345ede9f0db44eeb9 /net/tipc/socket.h
parent808d90f9c55943c2965d33b7156e559c59dd2db9 (diff)
tipc: merge struct tipc_port into struct tipc_sock
We complete the merging of the port and socket layer by aggregating the fields of struct tipc_port directly into struct tipc_sock, and moving the combined structure into socket.c. We also move all functions and macros that are not any longer exposed to the rest of the stack into socket.c, and rename them accordingly. Despite the size of this commit, there are no functional changes. We have only made such changes that are necessary due of the removal of struct tipc_port. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.h')
-rw-r--r--net/tipc/socket.h74
1 files changed, 0 insertions, 74 deletions
diff --git a/net/tipc/socket.h b/net/tipc/socket.h
index 48772169bc77..baa43d03901e 100644
--- a/net/tipc/socket.h
+++ b/net/tipc/socket.h
@@ -36,85 +36,11 @@
36#define _TIPC_SOCK_H 36#define _TIPC_SOCK_H
37 37
38#include <net/sock.h> 38#include <net/sock.h>
39#include "msg.h"
40 39
41#define TIPC_CONN_OK 0
42#define TIPC_CONN_PROBING 1
43#define TIPC_CONNACK_INTV 256 40#define TIPC_CONNACK_INTV 256
44#define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2) 41#define TIPC_FLOWCTRL_WIN (TIPC_CONNACK_INTV * 2)
45#define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \ 42#define TIPC_CONN_OVERLOAD_LIMIT ((TIPC_FLOWCTRL_WIN * 2 + 1) * \
46 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE)) 43 SKB_TRUESIZE(TIPC_MAX_USER_MSG_SIZE))
47
48/**
49 * struct tipc_port - TIPC port structure
50 * @lock: pointer to spinlock for controlling access to port
51 * @connected: non-zero if port is currently connected to a peer port
52 * @conn_type: TIPC type used when connection was established
53 * @conn_instance: TIPC instance used when connection was established
54 * @published: non-zero if port has one or more associated names
55 * @max_pkt: maximum packet size "hint" used when building messages sent by port
56 * @ref: unique reference to port in TIPC object registry
57 * @phdr: preformatted message header used when sending messages
58 * @port_list: adjacent ports in TIPC's global list of ports
59 * @publications: list of publications for port
60 * @pub_count: total # of publications port has made during its lifetime
61 * @probing_state:
62 * @probing_interval:
63 * @timer_ref:
64 */
65struct tipc_port {
66 int connected;
67 u32 conn_type;
68 u32 conn_instance;
69 int published;
70 u32 max_pkt;
71 u32 ref;
72 struct tipc_msg phdr;
73 struct list_head port_list;
74 struct list_head publications;
75 u32 pub_count;
76 u32 probing_state;
77 u32 probing_interval;
78 struct timer_list timer;
79};
80
81/**
82 * struct tipc_sock - TIPC socket structure
83 * @sk: socket - interacts with 'port' and with user via the socket API
84 * @port: port - interacts with 'sk' and with the rest of the TIPC stack
85 * @peer_name: the peer of the connection, if any
86 * @conn_timeout: the time we can wait for an unresponded setup request
87 * @dupl_rcvcnt: number of bytes counted twice, in both backlog and rcv queue
88 * @link_cong: non-zero if owner must sleep because of link congestion
89 * @sent_unacked: # messages sent by socket, and not yet acked by peer
90 * @rcv_unacked: # messages read by user, but not yet acked back to peer
91 */
92
93struct tipc_sock {
94 struct sock sk;
95 struct tipc_port port;
96 unsigned int conn_timeout;
97 atomic_t dupl_rcvcnt;
98 bool link_cong;
99 uint sent_unacked;
100 uint rcv_unacked;
101};
102
103static inline struct tipc_sock *tipc_sk(const struct sock *sk)
104{
105 return container_of(sk, struct tipc_sock, sk);
106}
107
108static inline struct tipc_sock *tipc_port_to_sock(const struct tipc_port *port)
109{
110 return container_of(port, struct tipc_sock, port);
111}
112
113static inline int tipc_sk_conn_cong(struct tipc_sock *tsk)
114{
115 return tsk->sent_unacked >= TIPC_FLOWCTRL_WIN;
116}
117
118int tipc_sk_rcv(struct sk_buff *buf); 44int tipc_sk_rcv(struct sk_buff *buf);
119struct sk_buff *tipc_sk_socks_show(void); 45struct sk_buff *tipc_sk_socks_show(void);
120void tipc_sk_mcast_rcv(struct sk_buff *buf); 46void tipc_sk_mcast_rcv(struct sk_buff *buf);