These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / net / tipc / core.h
index 3dc68c7..18e95a8 100644 (file)
 #include <net/netns/generic.h>
 #include <linux/rhashtable.h>
 
-#include "node.h"
-#include "bearer.h"
-#include "bcast.h"
-#include "netlink.h"
-#include "link.h"
-#include "node.h"
-#include "msg.h"
+struct tipc_node;
+struct tipc_bearer;
+struct tipc_bc_base;
+struct tipc_link;
+struct tipc_name_table;
+struct tipc_server;
 
 #define TIPC_MOD_VER "2.0.0"
 
+#define NODE_HTABLE_SIZE   512
+#define MAX_BEARERS       3
+
 extern int tipc_net_id __read_mostly;
 extern int sysctl_tipc_rmem[3] __read_mostly;
 extern int sysctl_tipc_named_timeout __read_mostly;
@@ -90,8 +92,8 @@ struct tipc_net {
        struct tipc_bearer __rcu *bearer_list[MAX_BEARERS + 1];
 
        /* Broadcast link */
-       struct tipc_bcbearer *bcbearer;
-       struct tipc_bclink *bclink;
+       spinlock_t bclock;
+       struct tipc_bc_base *bcbase;
        struct tipc_link *bcl;
 
        /* Socket hash table */
@@ -106,6 +108,41 @@ struct tipc_net {
        atomic_t subscription_count;
 };
 
+static inline struct tipc_net *tipc_net(struct net *net)
+{
+       return net_generic(net, tipc_net_id);
+}
+
+static inline int tipc_netid(struct net *net)
+{
+       return tipc_net(net)->net_id;
+}
+
+static inline u16 mod(u16 x)
+{
+       return x & 0xffffu;
+}
+
+static inline int less_eq(u16 left, u16 right)
+{
+       return mod(right - left) < 32768u;
+}
+
+static inline int more(u16 left, u16 right)
+{
+       return !less_eq(left, right);
+}
+
+static inline int less(u16 left, u16 right)
+{
+       return less_eq(left, right) && (mod(right) != mod(left));
+}
+
+static inline int in_range(u16 val, u16 min, u16 max)
+{
+       return !less(val, min) && !more(val, max);
+}
+
 #ifdef CONFIG_SYSCTL
 int tipc_register_sysctl(void);
 void tipc_unregister_sysctl(void);