aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bcast.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/bcast.c')
-rw-r--r--net/tipc/bcast.c49
1 files changed, 1 insertions, 48 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 2dfaf272928a..3eaa931e2e8c 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/bcast.c: TIPC broadcast code 2 * net/tipc/bcast.c: TIPC broadcast code
3 * 3 *
4 * Copyright (c) 2004-2006, 2014, Ericsson AB 4 * Copyright (c) 2004-2006, 2014-2015, Ericsson AB
5 * Copyright (c) 2004, Intel Corporation. 5 * Copyright (c) 2004, Intel Corporation.
6 * Copyright (c) 2005, 2010-2011, Wind River Systems 6 * Copyright (c) 2005, 2010-2011, Wind River Systems
7 * All rights reserved. 7 * All rights reserved.
@@ -1037,50 +1037,3 @@ static void tipc_nmap_diff(struct tipc_node_map *nm_a,
1037 } 1037 }
1038 } 1038 }
1039} 1039}
1040
1041/**
1042 * tipc_port_list_add - add a port to a port list, ensuring no duplicates
1043 */
1044void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port)
1045{
1046 struct tipc_port_list *item = pl_ptr;
1047 int i;
1048 int item_sz = PLSIZE;
1049 int cnt = pl_ptr->count;
1050
1051 for (; ; cnt -= item_sz, item = item->next) {
1052 if (cnt < PLSIZE)
1053 item_sz = cnt;
1054 for (i = 0; i < item_sz; i++)
1055 if (item->ports[i] == port)
1056 return;
1057 if (i < PLSIZE) {
1058 item->ports[i] = port;
1059 pl_ptr->count++;
1060 return;
1061 }
1062 if (!item->next) {
1063 item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
1064 if (!item->next) {
1065 pr_warn("Incomplete multicast delivery, no memory\n");
1066 return;
1067 }
1068 item->next->next = NULL;
1069 }
1070 }
1071}
1072
1073/**
1074 * tipc_port_list_free - free dynamically created entries in port_list chain
1075 *
1076 */
1077void tipc_port_list_free(struct tipc_port_list *pl_ptr)
1078{
1079 struct tipc_port_list *item;
1080 struct tipc_port_list *next;
1081
1082 for (item = pl_ptr->next; item; item = next) {
1083 next = item->next;
1084 kfree(item);
1085 }
1086}