aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.h
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2011-01-07 13:00:11 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-02-23 18:05:05 -0500
commit2d627b92fd1e39d83c3ee0b9d410403f98cb3981 (patch)
tree38fc08bfe87ed28785c7dd464577e947397dfa7c /net/tipc/bearer.h
parent23dd4cce387124ec3ea06ca30d17854ae4d9b772 (diff)
tipc: Combine bearer structure with tipc_bearer structure
Combines two distinct structures containing information about a TIPC bearer into a single structure. The structures were previously kept separate so that public information about a bearer could be made available to plug-in media types using TIPC's native API, while the remaining information was kept private for use by TIPC itself. However, now that the native API has been removed there is no longer any need for this arrangement. Since one of the structures was already embedded within the other, the change largely involves replacing instances of "publ.foo" with "foo". The changes do not otherwise alter the operation of TIPC bearers. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
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 */