aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bcast.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/bcast.h')
-rw-r--r--net/tipc/bcast.h52
1 files changed, 2 insertions, 50 deletions
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index cd779816383f..e8c2b81658c7 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -87,56 +87,8 @@ static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_m
87void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b, 87void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
88 struct tipc_node_map *nm_diff); 88 struct tipc_node_map *nm_diff);
89 89
90/** 90void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
91 * tipc_port_list_add - add a port to a port list, ensuring no duplicates 91void tipc_port_list_free(struct port_list *pl_ptr);
92 */
93
94static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
95{
96 struct port_list *item = pl_ptr;
97 int i;
98 int item_sz = PLSIZE;
99 int cnt = pl_ptr->count;
100
101 for (; ; cnt -= item_sz, item = item->next) {
102 if (cnt < PLSIZE)
103 item_sz = cnt;
104 for (i = 0; i < item_sz; i++)
105 if (item->ports[i] == port)
106 return;
107 if (i < PLSIZE) {
108 item->ports[i] = port;
109 pl_ptr->count++;
110 return;
111 }
112 if (!item->next) {
113 item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
114 if (!item->next) {
115 warn("Incomplete multicast delivery, no memory\n");
116 return;
117 }
118 item->next->next = NULL;
119 }
120 }
121}
122
123/**
124 * tipc_port_list_free - free dynamically created entries in port_list chain
125 *
126 * Note: First item is on stack, so it doesn't need to be released
127 */
128
129static inline void tipc_port_list_free(struct port_list *pl_ptr)
130{
131 struct port_list *item;
132 struct port_list *next;
133
134 for (item = pl_ptr->next; item; item = next) {
135 next = item->next;
136 kfree(item);
137 }
138}
139
140 92
141int tipc_bclink_init(void); 93int tipc_bclink_init(void);
142void tipc_bclink_stop(void); 94void tipc_bclink_stop(void);