aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/bearer.h')
-rw-r--r--net/tipc/bearer.h73
1 files changed, 32 insertions, 41 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 85f451d5aacf..31d6172b20fd 100644
--- a/net/tipc/bearer.h
+++ b/net/tipc/bearer.h
@@ -2,7 +2,7 @@
2 * net/tipc/bearer.h: Include file for TIPC bearer code 2 * net/tipc/bearer.h: Include file for TIPC bearer code
3 * 3 *
4 * Copyright (c) 1996-2006, Ericsson AB 4 * Copyright (c) 1996-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -61,26 +61,7 @@ struct tipc_media_addr {
61 } dev_addr; 61 } dev_addr;
62}; 62};
63 63
64/** 64struct tipc_bearer;
65 * struct tipc_bearer - TIPC bearer info available to media code
66 * @usr_handle: pointer to additional media-specific information about bearer
67 * @mtu: max packet size bearer can support
68 * @blocked: non-zero if bearer is blocked
69 * @lock: spinlock for controlling access to bearer
70 * @addr: media-specific address associated with bearer
71 * @name: bearer name (format = media:interface)
72 *
73 * Note: TIPC initializes "name" and "lock" fields; media code is responsible
74 * for initialization all other fields when a bearer is enabled.
75 */
76struct tipc_bearer {
77 void *usr_handle;
78 u32 mtu;
79 int blocked;
80 spinlock_t lock;
81 struct tipc_media_addr addr;
82 char name[TIPC_MAX_BEARER_NAME];
83};
84 65
85/** 66/**
86 * struct media - TIPC media information available to internal users 67 * struct media - TIPC media information available to internal users
@@ -89,7 +70,6 @@ struct tipc_bearer {
89 * @disable_bearer: routine which disables a bearer 70 * @disable_bearer: routine which disables a bearer
90 * @addr2str: routine which converts bearer's address to string form 71 * @addr2str: routine which converts bearer's address to string form
91 * @bcast_addr: media address used in broadcasting 72 * @bcast_addr: media address used in broadcasting
92 * @bcast: non-zero if media supports broadcasting [currently mandatory]
93 * @priority: default link (and bearer) priority 73 * @priority: default link (and bearer) priority
94 * @tolerance: default time (in ms) before declaring link failure 74 * @tolerance: default time (in ms) before declaring link failure
95 * @window: default window (in packets) before declaring link congestion 75 * @window: default window (in packets) before declaring link congestion
@@ -106,7 +86,6 @@ struct media {
106 char *(*addr2str)(struct tipc_media_addr *a, 86 char *(*addr2str)(struct tipc_media_addr *a,
107 char *str_buf, int str_size); 87 char *str_buf, int str_size);
108 struct tipc_media_addr bcast_addr; 88 struct tipc_media_addr bcast_addr;
109 int bcast;
110 u32 priority; 89 u32 priority;
111 u32 tolerance; 90 u32 tolerance;
112 u32 window; 91 u32 window;
@@ -115,11 +94,15 @@ struct media {
115}; 94};
116 95
117/** 96/**
118 * struct bearer - TIPC bearer information available to internal users 97 * struct tipc_bearer - TIPC bearer structure
119 * @publ: bearer information available to privileged users 98 * @usr_handle: pointer to additional media-specific information about bearer
99 * @mtu: max packet size bearer can support
100 * @blocked: non-zero if bearer is blocked
101 * @lock: spinlock for controlling access to bearer
102 * @addr: media-specific address associated with bearer
103 * @name: bearer name (format = media:interface)
120 * @media: ptr to media structure associated with bearer 104 * @media: ptr to media structure associated with bearer
121 * @priority: default link priority for bearer 105 * @priority: default link priority for bearer
122 * @detect_scope: network address mask used during automatic link creation
123 * @identity: array index of this bearer within TIPC bearer array 106 * @identity: array index of this bearer within TIPC bearer array
124 * @link_req: ptr to (optional) structure making periodic link setup requests 107 * @link_req: ptr to (optional) structure making periodic link setup requests
125 * @links: list of non-congested links associated with bearer 108 * @links: list of non-congested links associated with bearer
@@ -128,13 +111,20 @@ struct media {
128 * @active: non-zero if bearer structure is represents a bearer 111 * @active: non-zero if bearer structure is represents a bearer
129 * @net_plane: network plane ('A' through 'H') currently associated with bearer 112 * @net_plane: network plane ('A' through 'H') currently associated with bearer
130 * @nodes: indicates which nodes in cluster can be reached through bearer 113 * @nodes: indicates which nodes in cluster can be reached through bearer
114 *
115 * Note: media-specific code is responsible for initialization of the fields
116 * indicated below when a bearer is enabled; TIPC's generic bearer code takes
117 * care of initializing all other fields.
131 */ 118 */
132 119struct tipc_bearer {
133struct bearer { 120 void *usr_handle; /* initalized by media */
134 struct tipc_bearer publ; 121 u32 mtu; /* initalized by media */
122 int blocked; /* initalized by media */
123 struct tipc_media_addr addr; /* initalized by media */
124 char name[TIPC_MAX_BEARER_NAME];
125 spinlock_t lock;
135 struct media *media; 126 struct media *media;
136 u32 priority; 127 u32 priority;
137 u32 detect_scope;
138 u32 identity; 128 u32 identity;
139 struct link_req *link_req; 129 struct link_req *link_req;
140 struct list_head links; 130 struct list_head links;
@@ -152,7 +142,7 @@ struct bearer_name {
152 142
153struct link; 143struct link;
154 144
155extern struct bearer tipc_bearers[]; 145extern struct tipc_bearer tipc_bearers[];
156 146
157/* 147/*
158 * TIPC routines available to supported media types 148 * TIPC routines available to supported media types
@@ -173,7 +163,7 @@ void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr);
173int tipc_block_bearer(const char *name); 163int tipc_block_bearer(const char *name);
174void tipc_continue(struct tipc_bearer *tb_ptr); 164void tipc_continue(struct tipc_bearer *tb_ptr);
175 165
176int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority); 166int tipc_enable_bearer(const char *bearer_name, u32 disc_domain, u32 priority);
177int tipc_disable_bearer(const char *name); 167int tipc_disable_bearer(const char *name);
178 168
179/* 169/*
@@ -186,14 +176,14 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
186struct sk_buff *tipc_media_get_names(void); 176struct sk_buff *tipc_media_get_names(void);
187 177
188struct sk_buff *tipc_bearer_get_names(void); 178struct sk_buff *tipc_bearer_get_names(void);
189void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest); 179void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest);
190void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest); 180void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest);
191void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); 181void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct link *l_ptr);
192struct bearer *tipc_bearer_find_interface(const char *if_name); 182struct tipc_bearer *tipc_bearer_find_interface(const char *if_name);
193int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); 183int tipc_bearer_resolve_congestion(struct tipc_bearer *b_ptr, struct link *l_ptr);
194int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr); 184int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr);
195void tipc_bearer_stop(void); 185void tipc_bearer_stop(void);
196void tipc_bearer_lock_push(struct bearer *b_ptr); 186void tipc_bearer_lock_push(struct tipc_bearer *b_ptr);
197 187
198 188
199/** 189/**
@@ -214,10 +204,11 @@ void tipc_bearer_lock_push(struct bearer *b_ptr);
214 * and let TIPC's link code deal with the undelivered message. 204 * and let TIPC's link code deal with the undelivered message.
215 */ 205 */
216 206
217static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, 207static inline int tipc_bearer_send(struct tipc_bearer *b_ptr,
208 struct sk_buff *buf,
218 struct tipc_media_addr *dest) 209 struct tipc_media_addr *dest)
219{ 210{
220 return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); 211 return !b_ptr->media->send_msg(buf, b_ptr, dest);
221} 212}
222 213
223#endif /* _TIPC_BEARER_H */ 214#endif /* _TIPC_BEARER_H */