diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-01-09 02:27:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-12 16:24:33 -0500 |
commit | 1da465683a93142488a54a9038155f23d6349441 (patch) | |
tree | 95ccbeb4302d4b18fe0e12bfbb2b6b819ad84614 /net/tipc/bcast.h | |
parent | 7f9f95d9d9bcdf253c4149a157b096958013eceb (diff) |
tipc: make tipc broadcast link support net namespace
TIPC broadcast link is statically established and its relevant states
are maintained with the global variables: "bcbearer", "bclink" and
"bcl". Allowing different namespace to own different broadcast link
instances, these variables must be moved to tipc_net structure and
broadcast link instances would be allocated and initialized when
namespace is created.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Tested-by: Tero Aho <Tero.Aho@coriant.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/bcast.h')
-rw-r--r-- | net/tipc/bcast.h | 97 |
1 files changed, 71 insertions, 26 deletions
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index 692efb662253..a4583a109486 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h | |||
@@ -37,23 +37,13 @@ | |||
37 | #ifndef _TIPC_BCAST_H | 37 | #ifndef _TIPC_BCAST_H |
38 | #define _TIPC_BCAST_H | 38 | #define _TIPC_BCAST_H |
39 | 39 | ||
40 | #include "netlink.h" | 40 | #include <linux/tipc_config.h> |
41 | #include "link.h" | ||
42 | #include "node.h" | ||
41 | 43 | ||
42 | #define MAX_NODES 4096 | 44 | #define TIPC_BCLINK_RESET 1 |
43 | #define WSIZE 32 | 45 | #define PLSIZE 32 |
44 | #define TIPC_BCLINK_RESET 1 | 46 | #define BCBEARER MAX_BEARERS |
45 | |||
46 | /** | ||
47 | * struct tipc_node_map - set of node identifiers | ||
48 | * @count: # of nodes in set | ||
49 | * @map: bitmap of node identifiers that are in the set | ||
50 | */ | ||
51 | struct tipc_node_map { | ||
52 | u32 count; | ||
53 | u32 map[MAX_NODES / WSIZE]; | ||
54 | }; | ||
55 | |||
56 | #define PLSIZE 32 | ||
57 | 47 | ||
58 | /** | 48 | /** |
59 | * struct tipc_port_list - set of node local destination ports | 49 | * struct tipc_port_list - set of node local destination ports |
@@ -67,9 +57,64 @@ struct tipc_port_list { | |||
67 | u32 ports[PLSIZE]; | 57 | u32 ports[PLSIZE]; |
68 | }; | 58 | }; |
69 | 59 | ||
60 | /** | ||
61 | * struct tipc_bcbearer_pair - a pair of bearers used by broadcast link | ||
62 | * @primary: pointer to primary bearer | ||
63 | * @secondary: pointer to secondary bearer | ||
64 | * | ||
65 | * Bearers must have same priority and same set of reachable destinations | ||
66 | * to be paired. | ||
67 | */ | ||
70 | 68 | ||
71 | struct tipc_node; | 69 | struct tipc_bcbearer_pair { |
70 | struct tipc_bearer *primary; | ||
71 | struct tipc_bearer *secondary; | ||
72 | }; | ||
72 | 73 | ||
74 | /** | ||
75 | * struct tipc_bcbearer - bearer used by broadcast link | ||
76 | * @bearer: (non-standard) broadcast bearer structure | ||
77 | * @media: (non-standard) broadcast media structure | ||
78 | * @bpairs: array of bearer pairs | ||
79 | * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort() | ||
80 | * @remains: temporary node map used by tipc_bcbearer_send() | ||
81 | * @remains_new: temporary node map used tipc_bcbearer_send() | ||
82 | * | ||
83 | * Note: The fields labelled "temporary" are incorporated into the bearer | ||
84 | * to avoid consuming potentially limited stack space through the use of | ||
85 | * large local variables within multicast routines. Concurrent access is | ||
86 | * prevented through use of the spinlock "bclink_lock". | ||
87 | */ | ||
88 | struct tipc_bcbearer { | ||
89 | struct tipc_bearer bearer; | ||
90 | struct tipc_media media; | ||
91 | struct tipc_bcbearer_pair bpairs[MAX_BEARERS]; | ||
92 | struct tipc_bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; | ||
93 | struct tipc_node_map remains; | ||
94 | struct tipc_node_map remains_new; | ||
95 | }; | ||
96 | |||
97 | /** | ||
98 | * struct tipc_bclink - link used for broadcast messages | ||
99 | * @lock: spinlock governing access to structure | ||
100 | * @link: (non-standard) broadcast link structure | ||
101 | * @node: (non-standard) node structure representing b'cast link's peer node | ||
102 | * @flags: represent bclink states | ||
103 | * @bcast_nodes: map of broadcast-capable nodes | ||
104 | * @retransmit_to: node that most recently requested a retransmit | ||
105 | * | ||
106 | * Handles sequence numbering, fragmentation, bundling, etc. | ||
107 | */ | ||
108 | struct tipc_bclink { | ||
109 | spinlock_t lock; | ||
110 | struct tipc_link link; | ||
111 | struct tipc_node node; | ||
112 | unsigned int flags; | ||
113 | struct tipc_node_map bcast_nodes; | ||
114 | struct tipc_node *retransmit_to; | ||
115 | }; | ||
116 | |||
117 | struct tipc_node; | ||
73 | extern const char tipc_bclink_name[]; | 118 | extern const char tipc_bclink_name[]; |
74 | 119 | ||
75 | /** | 120 | /** |
@@ -86,24 +131,24 @@ void tipc_port_list_free(struct tipc_port_list *pl_ptr); | |||
86 | 131 | ||
87 | int tipc_bclink_init(struct net *net); | 132 | int tipc_bclink_init(struct net *net); |
88 | void tipc_bclink_stop(struct net *net); | 133 | void tipc_bclink_stop(struct net *net); |
89 | void tipc_bclink_set_flags(unsigned int flags); | 134 | void tipc_bclink_set_flags(struct net *tn, unsigned int flags); |
90 | void tipc_bclink_add_node(u32 addr); | 135 | void tipc_bclink_add_node(struct net *net, u32 addr); |
91 | void tipc_bclink_remove_node(u32 addr); | 136 | void tipc_bclink_remove_node(struct net *net, u32 addr); |
92 | struct tipc_node *tipc_bclink_retransmit_to(void); | 137 | struct tipc_node *tipc_bclink_retransmit_to(struct net *tn); |
93 | void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); | 138 | void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); |
94 | void tipc_bclink_rcv(struct net *net, struct sk_buff *buf); | 139 | void tipc_bclink_rcv(struct net *net, struct sk_buff *buf); |
95 | u32 tipc_bclink_get_last_sent(void); | 140 | u32 tipc_bclink_get_last_sent(struct net *net); |
96 | u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr); | 141 | u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr); |
97 | void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr, | 142 | void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr, |
98 | u32 last_sent); | 143 | u32 last_sent); |
99 | int tipc_bclink_stats(char *stats_buf, const u32 buf_size); | 144 | int tipc_bclink_stats(struct net *net, char *stats_buf, const u32 buf_size); |
100 | int tipc_bclink_reset_stats(void); | 145 | int tipc_bclink_reset_stats(struct net *net); |
101 | int tipc_bclink_set_queue_limits(u32 limit); | 146 | int tipc_bclink_set_queue_limits(struct net *net, u32 limit); |
102 | void tipc_bcbearer_sort(struct net *net, struct tipc_node_map *nm_ptr, | 147 | void tipc_bcbearer_sort(struct net *net, struct tipc_node_map *nm_ptr, |
103 | u32 node, bool action); | 148 | u32 node, bool action); |
104 | uint tipc_bclink_get_mtu(void); | 149 | uint tipc_bclink_get_mtu(void); |
105 | int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list); | 150 | int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list); |
106 | void tipc_bclink_wakeup_users(struct net *net); | 151 | void tipc_bclink_wakeup_users(struct net *net); |
107 | int tipc_nl_add_bc_link(struct tipc_nl_msg *msg); | 152 | int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg); |
108 | 153 | ||
109 | #endif | 154 | #endif |