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

Commit a8f48af5 authored by Ying Xue's avatar Ying Xue Committed by David S. Miller
Browse files

tipc: remove node subscription infrastructure



The node subscribe infrastructure represents a virtual base class, so
its users, such as struct tipc_port and struct publication, can derive
its implemented functionalities. However, after the removal of struct
tipc_port, struct publication is left as its only single user now. So
defining an abstract infrastructure for one user becomes no longer
reasonable. If corresponding new functions associated with the
infrastructure are moved to name_table.c file, the node subscription
infrastructure can be removed as well.

Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 73cf0e92
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@ obj-$(CONFIG_TIPC) := tipc.o
tipc-y	+= addr.o bcast.o bearer.o config.o \
	   core.o link.o discover.o msg.o  \
	   name_distr.o  subscr.o name_table.o net.o  \
	   netlink.o node.o node_subscr.o \
	   socket.o log.o eth_media.o server.o
	   netlink.o node.o socket.o log.o eth_media.o \
	   server.o

tipc-$(CONFIG_TIPC_MEDIA_IB)	+= ib_media.o
tipc-$(CONFIG_SYSCTL)		+= sysctl.o
+45 −7
Original line number Diff line number Diff line
@@ -250,13 +250,45 @@ void tipc_named_node_up(u32 dnode)
	tipc_link_xmit(buf_chain, dnode, dnode);
}

static void tipc_publ_subscribe(struct publication *publ, u32 addr)
{
	struct tipc_node *node;

	if (in_own_node(addr))
		return;

	node = tipc_node_find(addr);
	if (!node) {
		pr_warn("Node subscription rejected, unknown node 0x%x\n",
			addr);
		return;
	}

	tipc_node_lock(node);
	list_add_tail(&publ->nodesub_list, &node->publ_list);
	tipc_node_unlock(node);
}

static void tipc_publ_unsubscribe(struct publication *publ, u32 addr)
{
	struct tipc_node *node;

	node = tipc_node_find(addr);
	if (!node)
		return;

	tipc_node_lock(node);
	list_del_init(&publ->nodesub_list);
	tipc_node_unlock(node);
}

/**
 * named_purge_publ - remove publication associated with a failed node
 * tipc_publ_purge - remove publication associated with a failed node
 *
 * Invoked for each publication issued by a newly failed node.
 * Removes publication structure from name table & deletes it.
 */
static void named_purge_publ(struct publication *publ)
static void tipc_publ_purge(struct publication *publ, u32 addr)
{
	struct publication *p;

@@ -264,7 +296,7 @@ static void named_purge_publ(struct publication *publ)
	p = tipc_nametbl_remove_publ(publ->type, publ->lower,
				     publ->node, publ->ref, publ->key);
	if (p)
		tipc_nodesub_unsubscribe(&p->subscr);
		tipc_publ_unsubscribe(p, addr);
	write_unlock_bh(&tipc_nametbl_lock);

	if (p != publ) {
@@ -277,6 +309,14 @@ static void named_purge_publ(struct publication *publ)
	kfree(p);
}

void tipc_publ_notify(struct list_head *nsub_list, u32 addr)
{
	struct publication *publ, *tmp;

	list_for_each_entry_safe(publ, tmp, nsub_list, nodesub_list)
		tipc_publ_purge(publ, addr);
}

/**
 * tipc_update_nametbl - try to process a nametable update and notify
 *			 subscribers
@@ -294,9 +334,7 @@ static bool tipc_update_nametbl(struct distr_item *i, u32 node, u32 dtype)
						TIPC_CLUSTER_SCOPE, node,
						ntohl(i->ref), ntohl(i->key));
		if (publ) {
			tipc_nodesub_subscribe(&publ->subscr, node, publ,
					       (net_ev_handler)
					       named_purge_publ);
			tipc_publ_subscribe(publ, node);
			return true;
		}
	} else if (dtype == WITHDRAWAL) {
@@ -304,7 +342,7 @@ static bool tipc_update_nametbl(struct distr_item *i, u32 node, u32 dtype)
						node, ntohl(i->ref),
						ntohl(i->key));
		if (publ) {
			tipc_nodesub_unsubscribe(&publ->subscr);
			tipc_publ_unsubscribe(publ, node);
			kfree(publ);
			return true;
		}
+1 −0
Original line number Diff line number Diff line
@@ -74,5 +74,6 @@ void tipc_named_node_up(u32 dnode);
void tipc_named_rcv(struct sk_buff *buf);
void tipc_named_reinit(void);
void tipc_named_process_backlog(void);
void tipc_publ_notify(struct list_head *nsub_list, u32 addr);

#endif
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
	publ->key = key;
	INIT_LIST_HEAD(&publ->local_list);
	INIT_LIST_HEAD(&publ->pport_list);
	INIT_LIST_HEAD(&publ->subscr.nodesub_list);
	INIT_LIST_HEAD(&publ->nodesub_list);
	return publ;
}

+2 −4
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@
#ifndef _TIPC_NAME_TABLE_H
#define _TIPC_NAME_TABLE_H

#include "node_subscr.h"

struct tipc_subscription;
struct tipc_port_list;

@@ -56,7 +54,7 @@ struct tipc_port_list;
 * @node: network address of publishing port's node
 * @ref: publishing port
 * @key: publication key
 * @subscr: subscription to "node down" event (for off-node publications only)
 * @nodesub_list: subscription to "node down" event (off-node publication only)
 * @local_list: adjacent entries in list of publications made by this node
 * @pport_list: adjacent entries in list of publications made by this port
 * @node_list: adjacent matching name seq publications with >= node scope
@@ -73,7 +71,7 @@ struct publication {
	u32 node;
	u32 ref;
	u32 key;
	struct tipc_node_subscr subscr;
	struct list_head nodesub_list;
	struct list_head local_list;
	struct list_head pport_list;
	struct list_head node_list;
Loading