aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bcast.h
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:07 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:33 -0500
commit1da465683a93142488a54a9038155f23d6349441 (patch)
tree95ccbeb4302d4b18fe0e12bfbb2b6b819ad84614 /net/tipc/bcast.h
parent7f9f95d9d9bcdf253c4149a157b096958013eceb (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.h97
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 */
51struct 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
71struct tipc_node; 69struct 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 */
88struct 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 */
108struct 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
117struct tipc_node;
73extern const char tipc_bclink_name[]; 118extern 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
87int tipc_bclink_init(struct net *net); 132int tipc_bclink_init(struct net *net);
88void tipc_bclink_stop(struct net *net); 133void tipc_bclink_stop(struct net *net);
89void tipc_bclink_set_flags(unsigned int flags); 134void tipc_bclink_set_flags(struct net *tn, unsigned int flags);
90void tipc_bclink_add_node(u32 addr); 135void tipc_bclink_add_node(struct net *net, u32 addr);
91void tipc_bclink_remove_node(u32 addr); 136void tipc_bclink_remove_node(struct net *net, u32 addr);
92struct tipc_node *tipc_bclink_retransmit_to(void); 137struct tipc_node *tipc_bclink_retransmit_to(struct net *tn);
93void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); 138void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked);
94void tipc_bclink_rcv(struct net *net, struct sk_buff *buf); 139void tipc_bclink_rcv(struct net *net, struct sk_buff *buf);
95u32 tipc_bclink_get_last_sent(void); 140u32 tipc_bclink_get_last_sent(struct net *net);
96u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr); 141u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr);
97void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr, 142void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr,
98 u32 last_sent); 143 u32 last_sent);
99int tipc_bclink_stats(char *stats_buf, const u32 buf_size); 144int tipc_bclink_stats(struct net *net, char *stats_buf, const u32 buf_size);
100int tipc_bclink_reset_stats(void); 145int tipc_bclink_reset_stats(struct net *net);
101int tipc_bclink_set_queue_limits(u32 limit); 146int tipc_bclink_set_queue_limits(struct net *net, u32 limit);
102void tipc_bcbearer_sort(struct net *net, struct tipc_node_map *nm_ptr, 147void tipc_bcbearer_sort(struct net *net, struct tipc_node_map *nm_ptr,
103 u32 node, bool action); 148 u32 node, bool action);
104uint tipc_bclink_get_mtu(void); 149uint tipc_bclink_get_mtu(void);
105int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list); 150int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list);
106void tipc_bclink_wakeup_users(struct net *net); 151void tipc_bclink_wakeup_users(struct net *net);
107int tipc_nl_add_bc_link(struct tipc_nl_msg *msg); 152int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg);
108 153
109#endif 154#endif