aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /net/tipc/bearer.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'net/tipc/bearer.h')
-rw-r--r--net/tipc/bearer.h102
1 files changed, 79 insertions, 23 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h
index a850b389663e..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
@@ -37,12 +37,31 @@
37#ifndef _TIPC_BEARER_H 37#ifndef _TIPC_BEARER_H
38#define _TIPC_BEARER_H 38#define _TIPC_BEARER_H
39 39
40#include "core.h"
41#include "bcast.h" 40#include "bcast.h"
42 41
43#define MAX_BEARERS 8 42#define MAX_BEARERS 8
44#define MAX_MEDIA 4 43#define MAX_MEDIA 4
45 44
45/*
46 * Identifiers of supported TIPC media types
47 */
48#define TIPC_MEDIA_TYPE_ETH 1
49
50/*
51 * Destination address structure used by TIPC bearers when sending messages
52 *
53 * IMPORTANT: The fields of this structure MUST be stored using the specified
54 * byte order indicated below, as the structure is exchanged between nodes
55 * as part of a link setup process.
56 */
57struct tipc_media_addr {
58 __be32 type; /* bearer type (network byte order) */
59 union {
60 __u8 eth_addr[6]; /* 48 bit Ethernet addr (byte array) */
61 } dev_addr;
62};
63
64struct tipc_bearer;
46 65
47/** 66/**
48 * struct media - TIPC media information available to internal users 67 * struct media - TIPC media information available to internal users
@@ -51,11 +70,10 @@
51 * @disable_bearer: routine which disables a bearer 70 * @disable_bearer: routine which disables a bearer
52 * @addr2str: routine which converts bearer's address to string form 71 * @addr2str: routine which converts bearer's address to string form
53 * @bcast_addr: media address used in broadcasting 72 * @bcast_addr: media address used in broadcasting
54 * @bcast: non-zero if media supports broadcasting [currently mandatory]
55 * @priority: default link (and bearer) priority 73 * @priority: default link (and bearer) priority
56 * @tolerance: default time (in ms) before declaring link failure 74 * @tolerance: default time (in ms) before declaring link failure
57 * @window: default window (in packets) before declaring link congestion 75 * @window: default window (in packets) before declaring link congestion
58 * @type_id: TIPC media identifier [defined in tipc_bearer.h] 76 * @type_id: TIPC media identifier
59 * @name: media name 77 * @name: media name
60 */ 78 */
61 79
@@ -68,7 +86,6 @@ struct media {
68 char *(*addr2str)(struct tipc_media_addr *a, 86 char *(*addr2str)(struct tipc_media_addr *a,
69 char *str_buf, int str_size); 87 char *str_buf, int str_size);
70 struct tipc_media_addr bcast_addr; 88 struct tipc_media_addr bcast_addr;
71 int bcast;
72 u32 priority; 89 u32 priority;
73 u32 tolerance; 90 u32 tolerance;
74 u32 window; 91 u32 window;
@@ -77,11 +94,15 @@ struct media {
77}; 94};
78 95
79/** 96/**
80 * struct bearer - TIPC bearer information available to internal users 97 * struct tipc_bearer - TIPC bearer structure
81 * @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)
82 * @media: ptr to media structure associated with bearer 104 * @media: ptr to media structure associated with bearer
83 * @priority: default link priority for bearer 105 * @priority: default link priority for bearer
84 * @detect_scope: network address mask used during automatic link creation
85 * @identity: array index of this bearer within TIPC bearer array 106 * @identity: array index of this bearer within TIPC bearer array
86 * @link_req: ptr to (optional) structure making periodic link setup requests 107 * @link_req: ptr to (optional) structure making periodic link setup requests
87 * @links: list of non-congested links associated with bearer 108 * @links: list of non-congested links associated with bearer
@@ -90,13 +111,20 @@ struct media {
90 * @active: non-zero if bearer structure is represents a bearer 111 * @active: non-zero if bearer structure is represents a bearer
91 * @net_plane: network plane ('A' through 'H') currently associated with bearer 112 * @net_plane: network plane ('A' through 'H') currently associated with bearer
92 * @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.
93 */ 118 */
94 119struct tipc_bearer {
95struct bearer { 120 void *usr_handle; /* initalized by media */
96 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;
97 struct media *media; 126 struct media *media;
98 u32 priority; 127 u32 priority;
99 u32 detect_scope;
100 u32 identity; 128 u32 identity;
101 struct link_req *link_req; 129 struct link_req *link_req;
102 struct list_head links; 130 struct list_head links;
@@ -114,21 +142,48 @@ struct bearer_name {
114 142
115struct link; 143struct link;
116 144
117extern struct bearer tipc_bearers[]; 145extern struct tipc_bearer tipc_bearers[];
146
147/*
148 * TIPC routines available to supported media types
149 */
150int tipc_register_media(u32 media_type,
151 char *media_name, int (*enable)(struct tipc_bearer *),
152 void (*disable)(struct tipc_bearer *),
153 int (*send_msg)(struct sk_buff *,
154 struct tipc_bearer *, struct tipc_media_addr *),
155 char *(*addr2str)(struct tipc_media_addr *a,
156 char *str_buf, int str_size),
157 struct tipc_media_addr *bcast_addr, const u32 bearer_priority,
158 const u32 link_tolerance, /* [ms] */
159 const u32 send_window_limit);
160
161void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr);
162
163int tipc_block_bearer(const char *name);
164void tipc_continue(struct tipc_bearer *tb_ptr);
165
166int tipc_enable_bearer(const char *bearer_name, u32 disc_domain, u32 priority);
167int tipc_disable_bearer(const char *name);
168
169/*
170 * Routines made available to TIPC by supported media types
171 */
172int tipc_eth_media_start(void);
173void tipc_eth_media_stop(void);
118 174
119void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); 175void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
120struct sk_buff *tipc_media_get_names(void); 176struct sk_buff *tipc_media_get_names(void);
121 177
122struct sk_buff *tipc_bearer_get_names(void); 178struct sk_buff *tipc_bearer_get_names(void);
123void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest); 179void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest);
124void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest); 180void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest);
125void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); 181void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct link *l_ptr);
126struct bearer *tipc_bearer_find_interface(const char *if_name); 182struct tipc_bearer *tipc_bearer_find_interface(const char *if_name);
127int 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);
128int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr); 184int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr);
129int tipc_bearer_init(void);
130void tipc_bearer_stop(void); 185void tipc_bearer_stop(void);
131void tipc_bearer_lock_push(struct bearer *b_ptr); 186void tipc_bearer_lock_push(struct tipc_bearer *b_ptr);
132 187
133 188
134/** 189/**
@@ -149,10 +204,11 @@ void tipc_bearer_lock_push(struct bearer *b_ptr);
149 * and let TIPC's link code deal with the undelivered message. 204 * and let TIPC's link code deal with the undelivered message.
150 */ 205 */
151 206
152static 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,
153 struct tipc_media_addr *dest) 209 struct tipc_media_addr *dest)
154{ 210{
155 return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); 211 return !b_ptr->media->send_msg(buf, b_ptr, dest);
156} 212}
157 213
158#endif /* _TIPC_BEARER_H */ 214#endif /* _TIPC_BEARER_H */