Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3008ba5f authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'tipc-obsolete-zone-concept'



Jon Maloy says:

====================
tipc: obsolete zone concept

Functionality related to the 'zone' concept was never implemented in
TIPC. In this series we eliminate the remaining traces of it in the
code, and can hence take a first step in reducing the footprint and
complexity of the binding table.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4f1aec01 e50e73e1
Loading
Loading
Loading
Loading
+54 −48
Original line number Diff line number Diff line
@@ -61,50 +61,6 @@ struct tipc_name_seq {
	__u32 upper;
};

/* TIPC Address Size, Offset, Mask specification for Z.C.N
 */
#define TIPC_NODE_BITS          12
#define TIPC_CLUSTER_BITS       12
#define TIPC_ZONE_BITS          8

#define TIPC_NODE_OFFSET        0
#define TIPC_CLUSTER_OFFSET     TIPC_NODE_BITS
#define TIPC_ZONE_OFFSET        (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)

#define TIPC_NODE_SIZE          ((1UL << TIPC_NODE_BITS) - 1)
#define TIPC_CLUSTER_SIZE       ((1UL << TIPC_CLUSTER_BITS) - 1)
#define TIPC_ZONE_SIZE          ((1UL << TIPC_ZONE_BITS) - 1)

#define TIPC_NODE_MASK		(TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
#define TIPC_CLUSTER_MASK	(TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
#define TIPC_ZONE_MASK		(TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)

#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)

static inline __u32 tipc_addr(unsigned int zone,
			      unsigned int cluster,
			      unsigned int node)
{
	return (zone << TIPC_ZONE_OFFSET) |
		(cluster << TIPC_CLUSTER_OFFSET) |
		node;
}

static inline unsigned int tipc_zone(__u32 addr)
{
	return addr >> TIPC_ZONE_OFFSET;
}

static inline unsigned int tipc_cluster(__u32 addr)
{
	return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
}

static inline unsigned int tipc_node(__u32 addr)
{
	return addr & TIPC_NODE_MASK;
}

/*
 * Application-accessible port name types
 */
@@ -117,9 +73,10 @@ static inline unsigned int tipc_node(__u32 addr)
/*
 * Publication scopes when binding port names and port name sequences
 */
#define TIPC_ZONE_SCOPE         1
#define TIPC_CLUSTER_SCOPE      2
#define TIPC_NODE_SCOPE         3
enum tipc_scope {
	TIPC_CLUSTER_SCOPE = 2, /* 0 can also be used */
	TIPC_NODE_SCOPE    = 3
};

/*
 * Limiting values for messages
@@ -243,7 +200,7 @@ struct sockaddr_tipc {
struct tipc_group_req {
	__u32 type;      /* group id */
	__u32 instance;  /* member id */
	__u32 scope;     /* zone/cluster/node */
	__u32 scope;     /* cluster/node */
	__u32 flags;
};

@@ -268,4 +225,53 @@ struct tipc_sioc_ln_req {
	__u32 bearer_id;
	char linkname[TIPC_MAX_LINK_NAME];
};


/* The macros and functions below are deprecated:
 */

#define TIPC_ZONE_SCOPE         1

#define TIPC_NODE_BITS          12
#define TIPC_CLUSTER_BITS       12
#define TIPC_ZONE_BITS          8

#define TIPC_NODE_OFFSET        0
#define TIPC_CLUSTER_OFFSET     TIPC_NODE_BITS
#define TIPC_ZONE_OFFSET        (TIPC_CLUSTER_OFFSET + TIPC_CLUSTER_BITS)

#define TIPC_NODE_SIZE          ((1UL << TIPC_NODE_BITS) - 1)
#define TIPC_CLUSTER_SIZE       ((1UL << TIPC_CLUSTER_BITS) - 1)
#define TIPC_ZONE_SIZE          ((1UL << TIPC_ZONE_BITS) - 1)

#define TIPC_NODE_MASK		(TIPC_NODE_SIZE << TIPC_NODE_OFFSET)
#define TIPC_CLUSTER_MASK	(TIPC_CLUSTER_SIZE << TIPC_CLUSTER_OFFSET)
#define TIPC_ZONE_MASK		(TIPC_ZONE_SIZE << TIPC_ZONE_OFFSET)

#define TIPC_ZONE_CLUSTER_MASK (TIPC_ZONE_MASK | TIPC_CLUSTER_MASK)

static inline __u32 tipc_addr(unsigned int zone,
			      unsigned int cluster,
			      unsigned int node)
{
	return (zone << TIPC_ZONE_OFFSET) |
		(cluster << TIPC_CLUSTER_OFFSET) |
		node;
}

static inline unsigned int tipc_zone(__u32 addr)
{
	return addr >> TIPC_ZONE_OFFSET;
}

static inline unsigned int tipc_cluster(__u32 addr)
{
	return (addr & TIPC_CLUSTER_MASK) >> TIPC_CLUSTER_OFFSET;
}

static inline unsigned int tipc_node(__u32 addr)
{
	return addr & TIPC_NODE_MASK;
}

#endif
+0 −31
Original line number Diff line number Diff line
@@ -63,23 +63,6 @@ int in_own_node(struct net *net, u32 addr)
	return (addr == tn->own_addr) || !addr;
}

/**
 * addr_domain - convert 2-bit scope value to equivalent message lookup domain
 *
 * Needed when address of a named message must be looked up a second time
 * after a network hop.
 */
u32 addr_domain(struct net *net, u32 sc)
{
	struct tipc_net *tn = net_generic(net, tipc_net_id);

	if (likely(sc == TIPC_NODE_SCOPE))
		return tn->own_addr;
	if (sc == TIPC_CLUSTER_SCOPE)
		return tipc_cluster_mask(tn->own_addr);
	return tipc_zone_mask(tn->own_addr);
}

/**
 * tipc_addr_domain_valid - validates a network domain address
 *
@@ -124,20 +107,6 @@ int tipc_in_scope(u32 domain, u32 addr)
	return 0;
}

/**
 * tipc_addr_scope - convert message lookup domain to a 2-bit scope value
 */
int tipc_addr_scope(u32 domain)
{
	if (likely(!domain))
		return TIPC_ZONE_SCOPE;
	if (tipc_node(domain))
		return TIPC_NODE_SCOPE;
	if (tipc_cluster(domain))
		return TIPC_CLUSTER_SCOPE;
	return TIPC_ZONE_SCOPE;
}

char *tipc_addr_string_fill(char *string, u32 addr)
{
	snprintf(string, 16, "<%u.%u.%u>",
+10 −0
Original line number Diff line number Diff line
@@ -60,6 +60,16 @@ static inline u32 tipc_cluster_mask(u32 addr)
	return addr & TIPC_ZONE_CLUSTER_MASK;
}

static inline int tipc_node2scope(u32 node)
{
	return node ? TIPC_NODE_SCOPE : TIPC_CLUSTER_SCOPE;
}

static inline int tipc_scope2node(struct net *net, int sc)
{
	return sc != TIPC_NODE_SCOPE ? 0 : tipc_own_addr(net);
}

u32 tipc_own_addr(struct net *net);
int in_own_cluster(struct net *net, u32 addr);
int in_own_cluster_exact(struct net *net, u32 addr);
+5 −0
Original line number Diff line number Diff line
@@ -131,6 +131,11 @@ static inline struct list_head *tipc_nodes(struct net *net)
	return &tipc_net(net)->node_list;
}

static inline struct name_table *tipc_name_table(struct net *net)
{
	return tipc_net(net)->nametbl;
}

static inline struct tipc_topsrv *tipc_topsrv(struct net *net)
{
	return tipc_net(net)->topsrv;
+1 −1
Original line number Diff line number Diff line
@@ -580,7 +580,7 @@ bool tipc_msg_lookup_dest(struct net *net, struct sk_buff *skb, int *err)
	msg = buf_msg(skb);
	if (msg_reroute_cnt(msg))
		return false;
	dnode = addr_domain(net, msg_lookup_scope(msg));
	dnode = tipc_scope2node(net, msg_lookup_scope(msg));
	dport = tipc_nametbl_translate(net, msg_nametype(msg),
				       msg_nameinst(msg), &dnode);
	if (!dport)
Loading