aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/port.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/port.h')
-rw-r--r--net/tipc/port.h130
1 files changed, 83 insertions, 47 deletions
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 34f12bd4074e..a00397393bd1 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/port.h: Include file for TIPC port code 2 * net/tipc/port.h: Include file for TIPC port code
3 * 3 *
4 * Copyright (c) 1994-2007, Ericsson AB 4 * Copyright (c) 1994-2007, 2014, Ericsson AB
5 * Copyright (c) 2004-2007, 2010-2013, Wind River Systems 5 * Copyright (c) 2004-2007, 2010-2013, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -48,7 +48,6 @@
48 48
49/** 49/**
50 * struct tipc_port - TIPC port structure 50 * struct tipc_port - TIPC port structure
51 * @sk: pointer to socket handle
52 * @lock: pointer to spinlock for controlling access to port 51 * @lock: pointer to spinlock for controlling access to port
53 * @connected: non-zero if port is currently connected to a peer port 52 * @connected: non-zero if port is currently connected to a peer port
54 * @conn_type: TIPC type used when connection was established 53 * @conn_type: TIPC type used when connection was established
@@ -60,8 +59,6 @@
60 * @ref: unique reference to port in TIPC object registry 59 * @ref: unique reference to port in TIPC object registry
61 * @phdr: preformatted message header used when sending messages 60 * @phdr: preformatted message header used when sending messages
62 * @port_list: adjacent ports in TIPC's global list of ports 61 * @port_list: adjacent ports in TIPC's global list of ports
63 * @dispatcher: ptr to routine which handles received messages
64 * @wakeup: ptr to routine to call when port is no longer congested
65 * @wait_list: adjacent ports in list of ports waiting on link congestion 62 * @wait_list: adjacent ports in list of ports waiting on link congestion
66 * @waiting_pkts: 63 * @waiting_pkts:
67 * @sent: # of non-empty messages sent by port 64 * @sent: # of non-empty messages sent by port
@@ -74,7 +71,6 @@
74 * @subscription: "node down" subscription used to terminate failed connections 71 * @subscription: "node down" subscription used to terminate failed connections
75 */ 72 */
76struct tipc_port { 73struct tipc_port {
77 struct sock *sk;
78 spinlock_t *lock; 74 spinlock_t *lock;
79 int connected; 75 int connected;
80 u32 conn_type; 76 u32 conn_type;
@@ -86,8 +82,6 @@ struct tipc_port {
86 u32 ref; 82 u32 ref;
87 struct tipc_msg phdr; 83 struct tipc_msg phdr;
88 struct list_head port_list; 84 struct list_head port_list;
89 u32 (*dispatcher)(struct tipc_port *, struct sk_buff *);
90 void (*wakeup)(struct tipc_port *);
91 struct list_head wait_list; 85 struct list_head wait_list;
92 u32 waiting_pkts; 86 u32 waiting_pkts;
93 u32 sent; 87 u32 sent;
@@ -106,68 +100,71 @@ struct tipc_port_list;
106/* 100/*
107 * TIPC port manipulation routines 101 * TIPC port manipulation routines
108 */ 102 */
109struct tipc_port *tipc_createport(struct sock *sk, 103u32 tipc_port_init(struct tipc_port *p_ptr,
110 u32 (*dispatcher)(struct tipc_port *, 104 const unsigned int importance);
111 struct sk_buff *),
112 void (*wakeup)(struct tipc_port *),
113 const u32 importance);
114 105
115int tipc_reject_msg(struct sk_buff *buf, u32 err); 106int tipc_reject_msg(struct sk_buff *buf, u32 err);
116 107
117void tipc_acknowledge(u32 port_ref, u32 ack); 108void tipc_acknowledge(u32 port_ref, u32 ack);
118 109
119int tipc_deleteport(struct tipc_port *p_ptr); 110void tipc_port_destroy(struct tipc_port *p_ptr);
120
121int tipc_portimportance(u32 portref, unsigned int *importance);
122int tipc_set_portimportance(u32 portref, unsigned int importance);
123
124int tipc_portunreliable(u32 portref, unsigned int *isunreliable);
125int tipc_set_portunreliable(u32 portref, unsigned int isunreliable);
126
127int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
128int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
129 111
130int tipc_publish(struct tipc_port *p_ptr, unsigned int scope, 112int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
131 struct tipc_name_seq const *name_seq); 113 struct tipc_name_seq const *name_seq);
114
132int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope, 115int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope,
133 struct tipc_name_seq const *name_seq); 116 struct tipc_name_seq const *name_seq);
134 117
135int tipc_connect(u32 portref, struct tipc_portid const *port); 118int tipc_port_connect(u32 portref, struct tipc_portid const *port);
136 119
137int tipc_disconnect(u32 portref); 120int tipc_port_disconnect(u32 portref);
138 121
139int tipc_shutdown(u32 ref); 122int tipc_port_shutdown(u32 ref);
140 123
124void tipc_port_wakeup(struct tipc_port *port);
141 125
142/* 126/*
143 * The following routines require that the port be locked on entry 127 * The following routines require that the port be locked on entry
144 */ 128 */
145int __tipc_disconnect(struct tipc_port *tp_ptr); 129int __tipc_port_disconnect(struct tipc_port *tp_ptr);
146int __tipc_connect(u32 ref, struct tipc_port *p_ptr, 130int __tipc_port_connect(u32 ref, struct tipc_port *p_ptr,
147 struct tipc_portid const *peer); 131 struct tipc_portid const *peer);
148int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg); 132int tipc_port_peer_msg(struct tipc_port *p_ptr, struct tipc_msg *msg);
149 133
150/* 134/*
151 * TIPC messaging routines 135 * TIPC messaging routines
152 */ 136 */
153int tipc_port_recv_msg(struct sk_buff *buf); 137int tipc_port_rcv(struct sk_buff *buf);
154int tipc_send(u32 portref, struct iovec const *msg_sect, unsigned int len); 138
155 139int tipc_send(struct tipc_port *port,
156int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain, 140 struct iovec const *msg_sect,
157 struct iovec const *msg_sect, unsigned int len); 141 unsigned int len);
142
143int tipc_send2name(struct tipc_port *port,
144 struct tipc_name const *name,
145 u32 domain,
146 struct iovec const *msg_sect,
147 unsigned int len);
148
149int tipc_send2port(struct tipc_port *port,
150 struct tipc_portid const *dest,
151 struct iovec const *msg_sect,
152 unsigned int len);
153
154int tipc_port_mcast_xmit(struct tipc_port *port,
155 struct tipc_name_seq const *seq,
156 struct iovec const *msg,
157 unsigned int len);
158
159int tipc_port_iovec_reject(struct tipc_port *p_ptr,
160 struct tipc_msg *hdr,
161 struct iovec const *msg_sect,
162 unsigned int len,
163 int err);
158 164
159int tipc_send2port(u32 portref, struct tipc_portid const *dest,
160 struct iovec const *msg_sect, unsigned int len);
161
162int tipc_multicast(u32 portref, struct tipc_name_seq const *seq,
163 struct iovec const *msg, unsigned int len);
164
165int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
166 struct iovec const *msg_sect, unsigned int len,
167 int err);
168struct sk_buff *tipc_port_get_ports(void); 165struct sk_buff *tipc_port_get_ports(void);
169void tipc_port_recv_proto_msg(struct sk_buff *buf); 166void tipc_port_proto_rcv(struct sk_buff *buf);
170void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp); 167void tipc_port_mcast_rcv(struct sk_buff *buf, struct tipc_port_list *dp);
171void tipc_port_reinit(void); 168void tipc_port_reinit(void);
172 169
173/** 170/**
@@ -188,14 +185,53 @@ static inline void tipc_port_unlock(struct tipc_port *p_ptr)
188 spin_unlock_bh(p_ptr->lock); 185 spin_unlock_bh(p_ptr->lock);
189} 186}
190 187
191static inline struct tipc_port *tipc_port_deref(u32 ref) 188static inline int tipc_port_congested(struct tipc_port *p_ptr)
192{ 189{
193 return (struct tipc_port *)tipc_ref_deref(ref); 190 return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2);
194} 191}
195 192
196static inline int tipc_port_congested(struct tipc_port *p_ptr) 193
194static inline u32 tipc_port_peernode(struct tipc_port *p_ptr)
197{ 195{
198 return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2); 196 return msg_destnode(&p_ptr->phdr);
197}
198
199static inline u32 tipc_port_peerport(struct tipc_port *p_ptr)
200{
201 return msg_destport(&p_ptr->phdr);
202}
203
204static inline bool tipc_port_unreliable(struct tipc_port *port)
205{
206 return msg_src_droppable(&port->phdr) != 0;
207}
208
209static inline void tipc_port_set_unreliable(struct tipc_port *port,
210 bool unreliable)
211{
212 msg_set_src_droppable(&port->phdr, unreliable ? 1 : 0);
213}
214
215static inline bool tipc_port_unreturnable(struct tipc_port *port)
216{
217 return msg_dest_droppable(&port->phdr) != 0;
218}
219
220static inline void tipc_port_set_unreturnable(struct tipc_port *port,
221 bool unreturnable)
222{
223 msg_set_dest_droppable(&port->phdr, unreturnable ? 1 : 0);
224}
225
226
227static inline int tipc_port_importance(struct tipc_port *port)
228{
229 return msg_importance(&port->phdr);
230}
231
232static inline void tipc_port_set_importance(struct tipc_port *port, int imp)
233{
234 msg_set_importance(&port->phdr, (u32)imp);
199} 235}
200 236
201#endif 237#endif