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.h67
1 files changed, 31 insertions, 36 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index 85f451d5aacf..255dea64f7bd 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
@@ -115,8 +96,13 @@ struct media {
115}; 96};
116 97
117/** 98/**
118 * struct bearer - TIPC bearer information available to internal users 99 * struct tipc_bearer - TIPC bearer structure
119 * @publ: bearer information available to privileged users 100 * @usr_handle: pointer to additional media-specific information about bearer
101 * @mtu: max packet size bearer can support
102 * @blocked: non-zero if bearer is blocked
103 * @lock: spinlock for controlling access to bearer
104 * @addr: media-specific address associated with bearer
105 * @name: bearer name (format = media:interface)
120 * @media: ptr to media structure associated with bearer 106 * @media: ptr to media structure associated with bearer
121 * @priority: default link priority for bearer 107 * @priority: default link priority for bearer
122 * @detect_scope: network address mask used during automatic link creation 108 * @detect_scope: network address mask used during automatic link creation
@@ -128,10 +114,18 @@ struct media {
128 * @active: non-zero if bearer structure is represents a bearer 114 * @active: non-zero if bearer structure is represents a bearer
129 * @net_plane: network plane ('A' through 'H') currently associated with bearer 115 * @net_plane: network plane ('A' through 'H') currently associated with bearer
130 * @nodes: indicates which nodes in cluster can be reached through bearer 116 * @nodes: indicates which nodes in cluster can be reached through bearer
117 *
118 * Note: media-specific code is responsible for initialization of the fields
119 * indicated below when a bearer is enabled; TIPC's generic bearer code takes
120 * care of initializing all other fields.
131 */ 121 */
132 122struct tipc_bearer {
133struct bearer { 123 void *usr_handle; /* initalized by media */
134 struct tipc_bearer publ; 124 u32 mtu; /* initalized by media */
125 int blocked; /* initalized by media */
126 struct tipc_media_addr addr; /* initalized by media */
127 char name[TIPC_MAX_BEARER_NAME];
128 spinlock_t lock;
135 struct media *media; 129 struct media *media;
136 u32 priority; 130 u32 priority;
137 u32 detect_scope; 131 u32 detect_scope;
@@ -152,7 +146,7 @@ struct bearer_name {
152 146
153struct link; 147struct link;
154 148
155extern struct bearer tipc_bearers[]; 149extern struct tipc_bearer tipc_bearers[];
156 150
157/* 151/*
158 * TIPC routines available to supported media types 152 * TIPC routines available to supported media types
@@ -186,14 +180,14 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
186struct sk_buff *tipc_media_get_names(void); 180struct sk_buff *tipc_media_get_names(void);
187 181
188struct sk_buff *tipc_bearer_get_names(void); 182struct sk_buff *tipc_bearer_get_names(void);
189void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest); 183void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest);
190void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest); 184void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest);
191void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); 185void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct link *l_ptr);
192struct bearer *tipc_bearer_find_interface(const char *if_name); 186struct tipc_bearer *tipc_bearer_find_interface(const char *if_name);
193int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); 187int 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); 188int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr);
195void tipc_bearer_stop(void); 189void tipc_bearer_stop(void);
196void tipc_bearer_lock_push(struct bearer *b_ptr); 190void tipc_bearer_lock_push(struct tipc_bearer *b_ptr);
197 191
198 192
199/** 193/**
@@ -214,10 +208,11 @@ void tipc_bearer_lock_push(struct bearer *b_ptr);
214 * and let TIPC's link code deal with the undelivered message. 208 * and let TIPC's link code deal with the undelivered message.
215 */ 209 */
216 210
217static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, 211static inline int tipc_bearer_send(struct tipc_bearer *b_ptr,
212 struct sk_buff *buf,
218 struct tipc_media_addr *dest) 213 struct tipc_media_addr *dest)
219{ 214{
220 return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); 215 return !b_ptr->media->send_msg(buf, b_ptr, dest);
221} 216}
222 217
223#endif /* _TIPC_BEARER_H */ 218#endif /* _TIPC_BEARER_H */