aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/addr.c
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/addr.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'net/tipc/addr.c')
-rw-r--r--net/tipc/addr.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index c048543ffbeb..a6fdab33877e 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -2,7 +2,7 @@
2 * net/tipc/addr.c: TIPC address utility routines 2 * net/tipc/addr.c: TIPC address utility routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2004-2005, Wind River Systems 5 * Copyright (c) 2004-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
@@ -35,22 +35,13 @@
35 */ 35 */
36 36
37#include "core.h" 37#include "core.h"
38#include "dbg.h"
39#include "addr.h" 38#include "addr.h"
40#include "zone.h"
41#include "cluster.h"
42#include "net.h"
43
44u32 tipc_get_addr(void)
45{
46 return tipc_own_addr;
47}
48 39
49/** 40/**
50 * tipc_addr_domain_valid - validates a network domain address 41 * tipc_addr_domain_valid - validates a network domain address
51 * 42 *
52 * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, 43 * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
53 * where Z, C, and N are non-zero and do not exceed the configured limits. 44 * where Z, C, and N are non-zero.
54 * 45 *
55 * Returns 1 if domain address is valid, otherwise 0 46 * Returns 1 if domain address is valid, otherwise 0
56 */ 47 */
@@ -60,16 +51,6 @@ int tipc_addr_domain_valid(u32 addr)
60 u32 n = tipc_node(addr); 51 u32 n = tipc_node(addr);
61 u32 c = tipc_cluster(addr); 52 u32 c = tipc_cluster(addr);
62 u32 z = tipc_zone(addr); 53 u32 z = tipc_zone(addr);
63 u32 max_nodes = tipc_max_nodes;
64
65 if (is_slave(addr))
66 max_nodes = LOWEST_SLAVE + tipc_max_slaves;
67 if (n > max_nodes)
68 return 0;
69 if (c > tipc_max_clusters)
70 return 0;
71 if (z > tipc_max_zones)
72 return 0;
73 54
74 if (n && (!z || !c)) 55 if (n && (!z || !c))
75 return 0; 56 return 0;
@@ -81,24 +62,23 @@ int tipc_addr_domain_valid(u32 addr)
81/** 62/**
82 * tipc_addr_node_valid - validates a proposed network address for this node 63 * tipc_addr_node_valid - validates a proposed network address for this node
83 * 64 *
84 * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed 65 * Accepts <Z.C.N>, where Z, C, and N are non-zero.
85 * the configured limits.
86 * 66 *
87 * Returns 1 if address can be used, otherwise 0 67 * Returns 1 if address can be used, otherwise 0
88 */ 68 */
89 69
90int tipc_addr_node_valid(u32 addr) 70int tipc_addr_node_valid(u32 addr)
91{ 71{
92 return (tipc_addr_domain_valid(addr) && tipc_node(addr)); 72 return tipc_addr_domain_valid(addr) && tipc_node(addr);
93} 73}
94 74
95int tipc_in_scope(u32 domain, u32 addr) 75int tipc_in_scope(u32 domain, u32 addr)
96{ 76{
97 if (!domain || (domain == addr)) 77 if (!domain || (domain == addr))
98 return 1; 78 return 1;
99 if (domain == (addr & 0xfffff000u)) /* domain <Z.C.0> */ 79 if (domain == tipc_cluster_mask(addr)) /* domain <Z.C.0> */
100 return 1; 80 return 1;
101 if (domain == (addr & 0xff000000u)) /* domain <Z.0.0> */ 81 if (domain == tipc_zone_mask(addr)) /* domain <Z.0.0> */
102 return 1; 82 return 1;
103 return 0; 83 return 0;
104} 84}