Commit 4323add6 authored by Per Liden's avatar Per Liden

[TIPC] Avoid polluting the global namespace

This patch adds a tipc_ prefix to all externally visible symbols.
Signed-off-by: default avatarPer Liden <per.liden@ericsson.com>
parent 1e63e681
...@@ -47,7 +47,7 @@ u32 tipc_get_addr(void) ...@@ -47,7 +47,7 @@ u32 tipc_get_addr(void)
} }
/** /**
* addr_domain_valid - validates a network domain address * tipc_addr_domain_valid - validates a network domain address
* *
* Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>,
* where Z, C, and N are non-zero and do not exceed the configured limits. * where Z, C, and N are non-zero and do not exceed the configured limits.
...@@ -55,7 +55,7 @@ u32 tipc_get_addr(void) ...@@ -55,7 +55,7 @@ u32 tipc_get_addr(void)
* Returns 1 if domain address is valid, otherwise 0 * Returns 1 if domain address is valid, otherwise 0
*/ */
int addr_domain_valid(u32 addr) int tipc_addr_domain_valid(u32 addr)
{ {
u32 n = tipc_node(addr); u32 n = tipc_node(addr);
u32 c = tipc_cluster(addr); u32 c = tipc_cluster(addr);
...@@ -79,7 +79,7 @@ int addr_domain_valid(u32 addr) ...@@ -79,7 +79,7 @@ int addr_domain_valid(u32 addr)
} }
/** /**
* addr_node_valid - validates a proposed network address for this node * tipc_addr_node_valid - validates a proposed network address for this node
* *
* Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed * Accepts <Z.C.N>, where Z, C, and N are non-zero and do not exceed
* the configured limits. * the configured limits.
...@@ -87,8 +87,8 @@ int addr_domain_valid(u32 addr) ...@@ -87,8 +87,8 @@ int addr_domain_valid(u32 addr)
* Returns 1 if address can be used, otherwise 0 * Returns 1 if address can be used, otherwise 0
*/ */
int addr_node_valid(u32 addr) int tipc_addr_node_valid(u32 addr)
{ {
return (addr_domain_valid(addr) && tipc_node(addr)); return (tipc_addr_domain_valid(addr) && tipc_node(addr));
} }
...@@ -122,7 +122,7 @@ static inline char *addr_string_fill(char *string, u32 addr) ...@@ -122,7 +122,7 @@ static inline char *addr_string_fill(char *string, u32 addr)
return string; return string;
} }
int addr_domain_valid(u32); int tipc_addr_domain_valid(u32);
int addr_node_valid(u32 addr); int tipc_addr_node_valid(u32 addr);
#endif #endif
...@@ -104,7 +104,7 @@ static struct bclink *bclink = NULL; ...@@ -104,7 +104,7 @@ static struct bclink *bclink = NULL;
static struct link *bcl = NULL; static struct link *bcl = NULL;
static spinlock_t bc_lock = SPIN_LOCK_UNLOCKED; static spinlock_t bc_lock = SPIN_LOCK_UNLOCKED;
char bc_link_name[] = "multicast-link"; char tipc_bclink_name[] = "multicast-link";
static inline u32 buf_seqno(struct sk_buff *buf) static inline u32 buf_seqno(struct sk_buff *buf)
...@@ -178,19 +178,19 @@ static void bclink_retransmit_pkt(u32 after, u32 to) ...@@ -178,19 +178,19 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
buf = buf->next; buf = buf->next;
} }
if (buf != NULL) if (buf != NULL)
link_retransmit(bcl, buf, mod(to - after)); tipc_link_retransmit(bcl, buf, mod(to - after));
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
} }
/** /**
* bclink_acknowledge - handle acknowledgement of broadcast packets * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets
* @n_ptr: node that sent acknowledgement info * @n_ptr: node that sent acknowledgement info
* @acked: broadcast sequence # that has been acknowledged * @acked: broadcast sequence # that has been acknowledged
* *
* Node is locked, bc_lock unlocked. * Node is locked, bc_lock unlocked.
*/ */
void bclink_acknowledge(struct node *n_ptr, u32 acked) void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked)
{ {
struct sk_buff *crs; struct sk_buff *crs;
struct sk_buff *next; struct sk_buff *next;
...@@ -226,16 +226,16 @@ void bclink_acknowledge(struct node *n_ptr, u32 acked) ...@@ -226,16 +226,16 @@ void bclink_acknowledge(struct node *n_ptr, u32 acked)
/* Try resolving broadcast link congestion, if necessary */ /* Try resolving broadcast link congestion, if necessary */
if (unlikely(bcl->next_out)) if (unlikely(bcl->next_out))
link_push_queue(bcl); tipc_link_push_queue(bcl);
if (unlikely(released && !list_empty(&bcl->waiting_ports))) if (unlikely(released && !list_empty(&bcl->waiting_ports)))
link_wakeup_ports(bcl, 0); tipc_link_wakeup_ports(bcl, 0);
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
} }
/** /**
* bclink_send_ack - unicast an ACK msg * bclink_send_ack - unicast an ACK msg
* *
* net_lock and node lock set * tipc_net_lock and node lock set
*/ */
static void bclink_send_ack(struct node *n_ptr) static void bclink_send_ack(struct node *n_ptr)
...@@ -243,13 +243,13 @@ static void bclink_send_ack(struct node *n_ptr) ...@@ -243,13 +243,13 @@ static void bclink_send_ack(struct node *n_ptr)
struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1]; struct link *l_ptr = n_ptr->active_links[n_ptr->addr & 1];
if (l_ptr != NULL) if (l_ptr != NULL)
link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
} }
/** /**
* bclink_send_nack- broadcast a NACK msg * bclink_send_nack- broadcast a NACK msg
* *
* net_lock and node lock set * tipc_net_lock and node lock set
*/ */
static void bclink_send_nack(struct node *n_ptr) static void bclink_send_nack(struct node *n_ptr)
...@@ -271,11 +271,11 @@ static void bclink_send_nack(struct node *n_ptr) ...@@ -271,11 +271,11 @@ static void bclink_send_nack(struct node *n_ptr)
msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); msg_set_bcgap_to(msg, n_ptr->bclink.gap_to);
msg_set_bcast_tag(msg, tipc_own_tag); msg_set_bcast_tag(msg, tipc_own_tag);
if (bearer_send(&bcbearer->bearer, buf, 0)) { if (tipc_bearer_send(&bcbearer->bearer, buf, 0)) {
bcl->stats.sent_nacks++; bcl->stats.sent_nacks++;
buf_discard(buf); buf_discard(buf);
} else { } else {
bearer_schedule(bcl->b_ptr, bcl); tipc_bearer_schedule(bcl->b_ptr, bcl);
bcl->proto_msg_queue = buf; bcl->proto_msg_queue = buf;
bcl->stats.bearer_congs++; bcl->stats.bearer_congs++;
} }
...@@ -291,12 +291,12 @@ static void bclink_send_nack(struct node *n_ptr) ...@@ -291,12 +291,12 @@ static void bclink_send_nack(struct node *n_ptr)
} }
/** /**
* bclink_check_gap - send a NACK if a sequence gap exists * tipc_bclink_check_gap - send a NACK if a sequence gap exists
* *
* net_lock and node lock set * tipc_net_lock and node lock set
*/ */
void bclink_check_gap(struct node *n_ptr, u32 last_sent) void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent)
{ {
if (!n_ptr->bclink.supported || if (!n_ptr->bclink.supported ||
less_eq(last_sent, mod(n_ptr->bclink.last_in))) less_eq(last_sent, mod(n_ptr->bclink.last_in)))
...@@ -309,19 +309,19 @@ void bclink_check_gap(struct node *n_ptr, u32 last_sent) ...@@ -309,19 +309,19 @@ void bclink_check_gap(struct node *n_ptr, u32 last_sent)
} }
/** /**
* bclink_peek_nack - process a NACK msg meant for another node * tipc_bclink_peek_nack - process a NACK msg meant for another node
* *
* Only net_lock set. * Only tipc_net_lock set.
*/ */
void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to)
{ {
struct node *n_ptr = node_find(dest); struct node *n_ptr = tipc_node_find(dest);
u32 my_after, my_to; u32 my_after, my_to;
if (unlikely(!n_ptr || !node_is_up(n_ptr))) if (unlikely(!n_ptr || !tipc_node_is_up(n_ptr)))
return; return;
node_lock(n_ptr); tipc_node_lock(n_ptr);
/* /*
* Modify gap to suppress unnecessary NACKs from this node * Modify gap to suppress unnecessary NACKs from this node
*/ */
...@@ -364,20 +364,20 @@ void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to) ...@@ -364,20 +364,20 @@ void bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 gap_to)
bclink_set_gap(n_ptr); bclink_set_gap(n_ptr);
} }
} }
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
} }
/** /**
* bclink_send_msg - broadcast a packet to all nodes in cluster * tipc_bclink_send_msg - broadcast a packet to all nodes in cluster
*/ */
int bclink_send_msg(struct sk_buff *buf) int tipc_bclink_send_msg(struct sk_buff *buf)
{ {
int res; int res;
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
res = link_send_buf(bcl, buf); res = tipc_link_send_buf(bcl, buf);
if (unlikely(res == -ELINKCONG)) if (unlikely(res == -ELINKCONG))
buf_discard(buf); buf_discard(buf);
else else
...@@ -393,22 +393,22 @@ int bclink_send_msg(struct sk_buff *buf) ...@@ -393,22 +393,22 @@ int bclink_send_msg(struct sk_buff *buf)
} }
/** /**
* bclink_recv_pkt - receive a broadcast packet, and deliver upwards * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards
* *
* net_lock is read_locked, no other locks set * tipc_net_lock is read_locked, no other locks set
*/ */
void bclink_recv_pkt(struct sk_buff *buf) void tipc_bclink_recv_pkt(struct sk_buff *buf)
{ {
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
struct node* node = node_find(msg_prevnode(msg)); struct node* node = tipc_node_find(msg_prevnode(msg));
u32 next_in; u32 next_in;
u32 seqno; u32 seqno;
struct sk_buff *deferred; struct sk_buff *deferred;
msg_dbg(msg, "<BC<<<"); msg_dbg(msg, "<BC<<<");
if (unlikely(!node || !node_is_up(node) || !node->bclink.supported || if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported ||
(msg_mc_netid(msg) != tipc_net_id))) { (msg_mc_netid(msg) != tipc_net_id))) {
buf_discard(buf); buf_discard(buf);
return; return;
...@@ -417,14 +417,14 @@ void bclink_recv_pkt(struct sk_buff *buf) ...@@ -417,14 +417,14 @@ void bclink_recv_pkt(struct sk_buff *buf)
if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) {
msg_dbg(msg, "<BCNACK<<<"); msg_dbg(msg, "<BCNACK<<<");
if (msg_destnode(msg) == tipc_own_addr) { if (msg_destnode(msg) == tipc_own_addr) {
node_lock(node); tipc_node_lock(node);
bclink_acknowledge(node, msg_bcast_ack(msg)); tipc_bclink_acknowledge(node, msg_bcast_ack(msg));
node_unlock(node); tipc_node_unlock(node);
bcl->stats.recv_nacks++; bcl->stats.recv_nacks++;
bclink_retransmit_pkt(msg_bcgap_after(msg), bclink_retransmit_pkt(msg_bcgap_after(msg),
msg_bcgap_to(msg)); msg_bcgap_to(msg));
} else { } else {
bclink_peek_nack(msg_destnode(msg), tipc_bclink_peek_nack(msg_destnode(msg),
msg_bcast_tag(msg), msg_bcast_tag(msg),
msg_bcgap_after(msg), msg_bcgap_after(msg),
msg_bcgap_to(msg)); msg_bcgap_to(msg));
...@@ -433,7 +433,7 @@ void bclink_recv_pkt(struct sk_buff *buf) ...@@ -433,7 +433,7 @@ void bclink_recv_pkt(struct sk_buff *buf)
return; return;
} }
node_lock(node); tipc_node_lock(node);
receive: receive:
deferred = node->bclink.deferred_head; deferred = node->bclink.deferred_head;
next_in = mod(node->bclink.last_in + 1); next_in = mod(node->bclink.last_in + 1);
...@@ -448,26 +448,26 @@ void bclink_recv_pkt(struct sk_buff *buf) ...@@ -448,26 +448,26 @@ void bclink_recv_pkt(struct sk_buff *buf)
bcl->stats.sent_acks++; bcl->stats.sent_acks++;
} }
if (likely(msg_isdata(msg))) { if (likely(msg_isdata(msg))) {
node_unlock(node); tipc_node_unlock(node);
port_recv_mcast(buf, NULL); tipc_port_recv_mcast(buf, NULL);
} else if (msg_user(msg) == MSG_BUNDLER) { } else if (msg_user(msg) == MSG_BUNDLER) {
bcl->stats.recv_bundles++; bcl->stats.recv_bundles++;
bcl->stats.recv_bundled += msg_msgcnt(msg); bcl->stats.recv_bundled += msg_msgcnt(msg);
node_unlock(node); tipc_node_unlock(node);
link_recv_bundle(buf); tipc_link_recv_bundle(buf);
} else if (msg_user(msg) == MSG_FRAGMENTER) { } else if (msg_user(msg) == MSG_FRAGMENTER) {
bcl->stats.recv_fragments++; bcl->stats.recv_fragments++;
if (link_recv_fragment(&node->bclink.defragm, if (tipc_link_recv_fragment(&node->bclink.defragm,
&buf, &msg)) &buf, &msg))
bcl->stats.recv_fragmented++; bcl->stats.recv_fragmented++;
node_unlock(node); tipc_node_unlock(node);
net_route_msg(buf); tipc_net_route_msg(buf);
} else { } else {
node_unlock(node); tipc_node_unlock(node);
net_route_msg(buf); tipc_net_route_msg(buf);
} }
if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) { if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) {
node_lock(node); tipc_node_lock(node);
buf = deferred; buf = deferred;
msg = buf_msg(buf); msg = buf_msg(buf);
node->bclink.deferred_head = deferred->next; node->bclink.deferred_head = deferred->next;
...@@ -478,9 +478,9 @@ void bclink_recv_pkt(struct sk_buff *buf) ...@@ -478,9 +478,9 @@ void bclink_recv_pkt(struct sk_buff *buf)
u32 gap_after = node->bclink.gap_after; u32 gap_after = node->bclink.gap_after;
u32 gap_to = node->bclink.gap_to; u32 gap_to = node->bclink.gap_to;
if (link_defer_pkt(&node->bclink.deferred_head, if (tipc_link_defer_pkt(&node->bclink.deferred_head,
&node->bclink.deferred_tail, &node->bclink.deferred_tail,
buf)) { buf)) {
node->bclink.nack_sync++; node->bclink.nack_sync++;
bcl->stats.deferred_recv++; bcl->stats.deferred_recv++;
if (seqno == mod(gap_after + 1)) if (seqno == mod(gap_after + 1))
...@@ -497,10 +497,10 @@ void bclink_recv_pkt(struct sk_buff *buf) ...@@ -497,10 +497,10 @@ void bclink_recv_pkt(struct sk_buff *buf)
bcl->stats.duplicates++; bcl->stats.duplicates++;
buf_discard(buf); buf_discard(buf);
} }
node_unlock(node); tipc_node_unlock(node);
} }
u32 bclink_get_last_sent(void) u32 tipc_bclink_get_last_sent(void)
{ {
u32 last_sent = mod(bcl->next_out_no - 1); u32 last_sent = mod(bcl->next_out_no - 1);
...@@ -509,15 +509,15 @@ u32 bclink_get_last_sent(void) ...@@ -509,15 +509,15 @@ u32 bclink_get_last_sent(void)
return last_sent; return last_sent;
} }
u32 bclink_acks_missing(struct node *n_ptr) u32 tipc_bclink_acks_missing(struct node *n_ptr)
{ {
return (n_ptr->bclink.supported && return (n_ptr->bclink.supported &&
(bclink_get_last_sent() != n_ptr->bclink.acked)); (tipc_bclink_get_last_sent() != n_ptr->bclink.acked));
} }
/** /**
* bcbearer_send - send a packet through the broadcast pseudo-bearer * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer
* *
* Send through as many bearers as necessary to reach all nodes * Send through as many bearers as necessary to reach all nodes
* that support TIPC multicasting. * that support TIPC multicasting.
...@@ -525,9 +525,9 @@ u32 bclink_acks_missing(struct node *n_ptr) ...@@ -525,9 +525,9 @@ u32 bclink_acks_missing(struct node *n_ptr)
* Returns 0 if packet sent successfully, non-zero if not * Returns 0 if packet sent successfully, non-zero if not
*/ */
int bcbearer_send(struct sk_buff *buf, int tipc_bcbearer_send(struct sk_buff *buf,
struct tipc_bearer *unused1, struct tipc_bearer *unused1,
struct tipc_media_addr *unused2) struct tipc_media_addr *unused2)
{ {
static int send_count = 0; static int send_count = 0;
...@@ -541,8 +541,8 @@ int bcbearer_send(struct sk_buff *buf, ...@@ -541,8 +541,8 @@ int bcbearer_send(struct sk_buff *buf,
if (likely(!msg_non_seq(buf_msg(buf)))) { if (likely(!msg_non_seq(buf_msg(buf)))) {
struct tipc_msg *msg; struct tipc_msg *msg;
assert(cluster_bcast_nodes.count != 0); assert(tipc_cltr_bcast_nodes.count != 0);
bcbuf_set_acks(buf, cluster_bcast_nodes.count); bcbuf_set_acks(buf, tipc_cltr_bcast_nodes.count);
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_non_seq(msg); msg_set_non_seq(msg);
msg_set_mc_netid(msg, tipc_net_id); msg_set_mc_netid(msg, tipc_net_id);
...@@ -555,7 +555,7 @@ int bcbearer_send(struct sk_buff *buf, ...@@ -555,7 +555,7 @@ int bcbearer_send(struct sk_buff *buf,
/* Send buffer over bearers until all targets reached */ /* Send buffer over bearers until all targets reached */
remains = cluster_bcast_nodes; remains = tipc_cltr_bcast_nodes;
for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
struct bearer *p = bcbearer->bpairs[bp_index].primary; struct bearer *p = bcbearer->bpairs[bp_index].primary;
...@@ -564,7 +564,7 @@ int bcbearer_send(struct sk_buff *buf, ...@@ -564,7 +564,7 @@ int bcbearer_send(struct sk_buff *buf,
if (!p) if (!p)
break; /* no more bearers to try */ break; /* no more bearers to try */
nmap_diff(&remains, &p->nodes, &remains_new); tipc_nmap_diff(&remains, &p->nodes, &remains_new);
if (remains_new.count == remains.count) if (remains_new.count == remains.count)
continue; /* bearer pair doesn't add anything */ continue; /* bearer pair doesn't add anything */
...@@ -597,10 +597,10 @@ int bcbearer_send(struct sk_buff *buf, ...@@ -597,10 +597,10 @@ int bcbearer_send(struct sk_buff *buf,
} }
/** /**
* bcbearer_sort - create sets of bearer pairs used by broadcast bearer * tipc_bcbearer_sort - create sets of bearer pairs used by broadcast bearer
*/ */
void bcbearer_sort(void) void tipc_bcbearer_sort(void)
{ {
struct bcbearer_pair *bp_temp = bcbearer->bpairs_temp; struct bcbearer_pair *bp_temp = bcbearer->bpairs_temp;
struct bcbearer_pair *bp_curr; struct bcbearer_pair *bp_curr;
...@@ -614,7 +614,7 @@ void bcbearer_sort(void) ...@@ -614,7 +614,7 @@ void bcbearer_sort(void)
memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp));
for (b_index = 0; b_index < MAX_BEARERS; b_index++) { for (b_index = 0; b_index < MAX_BEARERS; b_index++) {
struct bearer *b = &bearers[b_index]; struct bearer *b = &tipc_bearers[b_index];
if (!b->active || !b->nodes.count) if (!b->active || !b->nodes.count)
continue; continue;
...@@ -638,8 +638,8 @@ void bcbearer_sort(void) ...@@ -638,8 +638,8 @@ void bcbearer_sort(void)
bp_curr->primary = bp_temp[pri].primary; bp_curr->primary = bp_temp[pri].primary;
if (bp_temp[pri].secondary) { if (bp_temp[pri].secondary) {
if (nmap_equal(&bp_temp[pri].primary->nodes, if (tipc_nmap_equal(&bp_temp[pri].primary->nodes,
&bp_temp[pri].secondary->nodes)) { &bp_temp[pri].secondary->nodes)) {
bp_curr->secondary = bp_temp[pri].secondary; bp_curr->secondary = bp_temp[pri].secondary;
} else { } else {
bp_curr++; bp_curr++;
...@@ -654,14 +654,14 @@ void bcbearer_sort(void) ...@@ -654,14 +654,14 @@ void bcbearer_sort(void)
} }
/** /**
* bcbearer_push - resolve bearer congestion * tipc_bcbearer_push - resolve bearer congestion
* *
* Forces bclink to push out any unsent packets, until all packets are gone * Forces bclink to push out any unsent packets, until all packets are gone
* or congestion reoccurs. * or congestion reoccurs.
* No locks set when function called * No locks set when function called
*/ */
void bcbearer_push(void) void tipc_bcbearer_push(void)
{ {
struct bearer *b_ptr; struct bearer *b_ptr;
...@@ -669,20 +669,20 @@ void bcbearer_push(void) ...@@ -669,20 +669,20 @@ void bcbearer_push(void)
b_ptr = &bcbearer->bearer; b_ptr = &bcbearer->bearer;
if (b_ptr->publ.blocked) { if (b_ptr->publ.blocked) {
b_ptr->publ.blocked = 0; b_ptr->publ.blocked = 0;
bearer_lock_push(b_ptr); tipc_bearer_lock_push(b_ptr);
} }
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
} }
int bclink_stats(char *buf, const u32 buf_size) int tipc_bclink_stats(char *buf, const u32 buf_size)
{ {
struct print_buf pb; struct print_buf pb;
if (!bcl) if (!bcl)
return 0; return 0;
printbuf_init(&pb, buf, buf_size); tipc_printbuf_init(&pb, buf, buf_size);
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
...@@ -718,10 +718,10 @@ int bclink_stats(char *buf, const u32 buf_size) ...@@ -718,10 +718,10 @@ int bclink_stats(char *buf, const u32 buf_size)
: 0); : 0);
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
return printbuf_validate(&pb); return tipc_printbuf_validate(&pb);
} }
int bclink_reset_stats(void) int tipc_bclink_reset_stats(void)
{ {
if (!bcl) if (!bcl)
return -ENOPROTOOPT; return -ENOPROTOOPT;
...@@ -732,7 +732,7 @@ int bclink_reset_stats(void) ...@@ -732,7 +732,7 @@ int bclink_reset_stats(void)
return TIPC_OK; return TIPC_OK;
} }
int bclink_set_queue_limits(u32 limit) int tipc_bclink_set_queue_limits(u32 limit)
{ {
if (!bcl) if (!bcl)
return -ENOPROTOOPT; return -ENOPROTOOPT;
...@@ -740,12 +740,12 @@ int bclink_set_queue_limits(u32 limit) ...@@ -740,12 +740,12 @@ int bclink_set_queue_limits(u32 limit)
return -EINVAL; return -EINVAL;
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
link_set_queue_limits(bcl, limit); tipc_link_set_queue_limits(bcl, limit);
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
return TIPC_OK; return TIPC_OK;
} }
int bclink_init(void) int tipc_bclink_init(void)
{ {
bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC); bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC);
bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC);
...@@ -762,7 +762,7 @@ int bclink_init(void) ...@@ -762,7 +762,7 @@ int bclink_init(void)
memset(bcbearer, 0, sizeof(struct bcbearer)); memset(bcbearer, 0, sizeof(struct bcbearer));
INIT_LIST_HEAD(&bcbearer->bearer.cong_links); INIT_LIST_HEAD(&bcbearer->bearer.cong_links);
bcbearer->bearer.media = &bcbearer->media; bcbearer->bearer.media = &bcbearer->media;
bcbearer->media.send_msg = bcbearer_send; bcbearer->media.send_msg = tipc_bcbearer_send;
sprintf(bcbearer->media.name, "tipc-multicast"); sprintf(bcbearer->media.name, "tipc-multicast");
bcl = &bclink->link; bcl = &bclink->link;
...@@ -772,27 +772,27 @@ int bclink_init(void) ...@@ -772,27 +772,27 @@ int bclink_init(void)
bclink->node.lock = SPIN_LOCK_UNLOCKED; bclink->node.lock = SPIN_LOCK_UNLOCKED;
bcl->owner = &bclink->node; bcl->owner = &bclink->node;
bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
bcl->b_ptr = &bcbearer->bearer; bcl->b_ptr = &bcbearer->bearer;
bcl->state = WORKING_WORKING; bcl->state = WORKING_WORKING;
sprintf(bcl->name, bc_link_name); sprintf(bcl->name, tipc_bclink_name);
if (BCLINK_LOG_BUF_SIZE) { if (BCLINK_LOG_BUF_SIZE) {
char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC); char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC);
if (!pb) if (!pb)
goto nomem; goto nomem;
printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE); tipc_printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE);
} }
return TIPC_OK; return TIPC_OK;
} }
void bclink_stop(void) void tipc_bclink_stop(void)
{ {
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
if (bcbearer) { if (bcbearer) {
link_stop(bcl); tipc_link_stop(bcl);
if (BCLINK_LOG_BUF_SIZE) if (BCLINK_LOG_BUF_SIZE)
kfree(bcl->print_buf.buf); kfree(bcl->print_buf.buf);
bcl = NULL; bcl = NULL;
......
...@@ -70,14 +70,14 @@ struct port_list { ...@@ -70,14 +70,14 @@ struct port_list {
struct node; struct node;
extern char bc_link_name[]; extern char tipc_bclink_name[];
/** /**
* nmap_get - determine if node exists in a node map * nmap_get - determine if node exists in a node map
*/ */
static inline int nmap_get(struct node_map *nm_ptr, u32 node) static inline int tipc_nmap_get(struct node_map *nm_ptr, u32 node)
{ {
int n = tipc_node(node); int n = tipc_node(node);
int w = n / WSIZE; int w = n / WSIZE;
...@@ -90,7 +90,7 @@ static inline int nmap_get(struct node_map *nm_ptr, u32 node) ...@@ -90,7 +90,7 @@ static inline int nmap_get(struct node_map *nm_ptr, u32 node)
* nmap_add - add a node to a node map * nmap_add - add a node to a node map
*/ */
static inline void nmap_add(struct node_map *nm_ptr, u32 node) static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node)
{ {
int n = tipc_node(node); int n = tipc_node(node);
int w = n / WSIZE; int w = n / WSIZE;
...@@ -106,7 +106,7 @@ static inline void nmap_add(struct node_map *nm_ptr, u32 node) ...@@ -106,7 +106,7 @@ static inline void nmap_add(struct node_map *nm_ptr, u32 node)
* nmap_remove - remove a node from a node map * nmap_remove - remove a node from a node map
*/ */
static inline void nmap_remove(struct node_map *nm_ptr, u32 node) static inline void tipc_nmap_remove(struct node_map *nm_ptr, u32 node)
{ {
int n = tipc_node(node); int n = tipc_node(node);
int w = n / WSIZE; int w = n / WSIZE;
...@@ -122,7 +122,7 @@ static inline void nmap_remove(struct node_map *nm_ptr, u32 node) ...@@ -122,7 +122,7 @@ static inline void nmap_remove(struct node_map *nm_ptr, u32 node)
* nmap_equal - test for equality of node maps * nmap_equal - test for equality of node maps
*/ */
static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) static inline int tipc_nmap_equal(struct node_map *nm_a, struct node_map *nm_b)
{ {
return !memcmp(nm_a, nm_b, sizeof(*nm_a)); return !memcmp(nm_a, nm_b, sizeof(*nm_a));
} }
...@@ -134,8 +134,8 @@ static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b) ...@@ -134,8 +134,8 @@ static inline int nmap_equal(struct node_map *nm_a, struct node_map *nm_b)
* @nm_diff: output node map A-B (i.e. nodes of A that are not in B) * @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
*/ */
static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, static inline void tipc_nmap_diff(struct node_map *nm_a, struct node_map *nm_b,
struct node_map *nm_diff) struct node_map *nm_diff)
{ {
int stop = sizeof(nm_a->map) / sizeof(u32); int stop = sizeof(nm_a->map) / sizeof(u32);
int w; int w;
...@@ -159,7 +159,7 @@ static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b, ...@@ -159,7 +159,7 @@ static inline void nmap_diff(struct node_map *nm_a, struct node_map *nm_b,
* port_list_add - add a port to a port list, ensuring no duplicates * port_list_add - add a port to a port list, ensuring no duplicates
*/ */
static inline void port_list_add(struct port_list *pl_ptr, u32 port) static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
{ {
struct port_list *item = pl_ptr; struct port_list *item = pl_ptr;
int i; int i;
...@@ -194,7 +194,7 @@ static inline void port_list_add(struct port_list *pl_ptr, u32 port) ...@@ -194,7 +194,7 @@ static inline void port_list_add(struct port_list *pl_ptr, u32 port)
* Note: First item is on stack, so it doesn't need to be released * Note: First item is on stack, so it doesn't need to be released
*/ */
static inline void port_list_free(struct port_list *pl_ptr) static inline void tipc_port_list_free(struct port_list *pl_ptr)
{ {
struct port_list *item; struct port_list *item;
struct port_list *next; struct port_list *next;
...@@ -206,18 +206,18 @@ static inline void port_list_free(struct port_list *pl_ptr) ...@@ -206,18 +206,18 @@ static inline void port_list_free(struct port_list *pl_ptr)
} }
int bclink_init(void); int tipc_bclink_init(void);
void bclink_stop(void); void tipc_bclink_stop(void);
void bclink_acknowledge(struct node *n_ptr, u32 acked); void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked);
int bclink_send_msg(struct sk_buff *buf); int tipc_bclink_send_msg(struct sk_buff *buf);
void bclink_recv_pkt(struct sk_buff *buf); void tipc_bclink_recv_pkt(struct sk_buff *buf);
u32 bclink_get_last_sent(void); u32 tipc_bclink_get_last_sent(void);
u32 bclink_acks_missing(struct node *n_ptr); u32 tipc_bclink_acks_missing(struct node *n_ptr);
void bclink_check_gap(struct node *n_ptr, u32 seqno); void tipc_bclink_check_gap(struct node *n_ptr, u32 seqno);
int bclink_stats(char *stats_buf, const u32 buf_size); int tipc_bclink_stats(char *stats_buf, const u32 buf_size);
int bclink_reset_stats(void); int tipc_bclink_reset_stats(void);
int bclink_set_queue_limits(u32 limit); int tipc_bclink_set_queue_limits(u32 limit);
void bcbearer_sort(void); void tipc_bcbearer_sort(void);
void bcbearer_push(void); void tipc_bcbearer_push(void);
#endif #endif
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
static struct media *media_list = 0; static struct media *media_list = 0;
static u32 media_count = 0; static u32 media_count = 0;
struct bearer *bearers = 0; struct bearer *tipc_bearers = 0;
/** /**
* media_name_valid - validate media name * media_name_valid - validate media name
...@@ -107,7 +107,7 @@ int tipc_register_media(u32 media_type, ...@@ -107,7 +107,7 @@ int tipc_register_media(u32 media_type,
u32 i; u32 i;
int res = -EINVAL; int res = -EINVAL;
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
if (!media_list) if (!media_list)
goto exit; goto exit;
...@@ -165,15 +165,15 @@ int tipc_register_media(u32 media_type, ...@@ -165,15 +165,15 @@ int tipc_register_media(u32 media_type,
dbg("Media <%s> registered\n", name); dbg("Media <%s> registered\n", name);
res = 0; res = 0;
exit: exit:
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
return res; return res;
} }
/** /**
* media_addr_printf - record media address in print buffer * tipc_media_addr_printf - record media address in print buffer
*/ */
void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
{ {
struct media *m_ptr; struct media *m_ptr;
u32 media_type; u32 media_type;
...@@ -201,25 +201,25 @@ void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a) ...@@ -201,25 +201,25 @@ void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a)
} }
/** /**
* media_get_names - record names of registered media in buffer * tipc_media_get_names - record names of registered media in buffer
*/ */
struct sk_buff *media_get_names(void) struct sk_buff *tipc_media_get_names(void)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct media *m_ptr; struct media *m_ptr;
int i; int i;
buf = cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME)); buf = tipc_cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME));
if (!buf) if (!buf)
return NULL; return NULL;
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name,
strlen(m_ptr->name) + 1); strlen(m_ptr->name) + 1);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return buf; return buf;
} }
...@@ -283,7 +283,7 @@ static struct bearer *bearer_find(const char *name) ...@@ -283,7 +283,7 @@ static struct bearer *bearer_find(const char *name)
struct bearer *b_ptr; struct bearer *b_ptr;
u32 i; u32 i;
for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
return b_ptr; return b_ptr;
} }
...@@ -291,16 +291,16 @@ static struct bearer *bearer_find(const char *name) ...@@ -291,16 +291,16 @@ static struct bearer *bearer_find(const char *name)
} }
/** /**
* bearer_find - locates bearer object with matching interface name * tipc_bearer_find_interface - locates bearer object with matching interface name
*/ */
struct bearer *bearer_find_interface(const char *if_name) struct bearer *tipc_bearer_find_interface(const char *if_name)
{ {
struct bearer *b_ptr; struct bearer *b_ptr;
char *b_if_name; char *b_if_name;
u32 i; u32 i;
for (i = 0, b_ptr = bearers; i < MAX_BEARERS; i++, b_ptr++) { for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (!b_ptr->active) if (!b_ptr->active)
continue; continue;
b_if_name = strchr(b_ptr->publ.name, ':') + 1; b_if_name = strchr(b_ptr->publ.name, ':') + 1;
...@@ -311,54 +311,54 @@ struct bearer *bearer_find_interface(const char *if_name) ...@@ -311,54 +311,54 @@ struct bearer *bearer_find_interface(const char *if_name)
} }
/** /**
* bearer_get_names - record names of bearers in buffer * tipc_bearer_get_names - record names of bearers in buffer
*/ */
struct sk_buff *bearer_get_names(void) struct sk_buff *tipc_bearer_get_names(void)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct media *m_ptr; struct media *m_ptr;
struct bearer *b_ptr; struct bearer *b_ptr;
int i, j; int i, j;
buf = cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME));
if (!buf) if (!buf)
return NULL; return NULL;
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) {
for (j = 0; j < MAX_BEARERS; j++) { for (j = 0; j < MAX_BEARERS; j++) {
b_ptr = &bearers[j]; b_ptr = &tipc_bearers[j];
if (b_ptr->active && (b_ptr->media == m_ptr)) { if (b_ptr->active && (b_ptr->media == m_ptr)) {
cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
b_ptr->publ.name, b_ptr->publ.name,
strlen(b_ptr->publ.name) + 1); strlen(b_ptr->publ.name) + 1);
} }
} }
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return buf; return buf;
} }
void bearer_add_dest(struct bearer *b_ptr, u32 dest) void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest)
{ {
nmap_add(&b_ptr->nodes, dest); tipc_nmap_add(&b_ptr->nodes, dest);
disc_update_link_req(b_ptr->link_req); tipc_disc_update_link_req(b_ptr->link_req);
bcbearer_sort(); tipc_bcbearer_sort();
} }
void bearer_remove_dest(struct bearer *b_ptr, u32 dest) void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest)
{ {
nmap_remove(&b_ptr->nodes, dest); tipc_nmap_remove(&b_ptr->nodes, dest);
disc_update_link_req(b_ptr->link_req); tipc_disc_update_link_req(b_ptr->link_req);
bcbearer_sort(); tipc_bcbearer_sort();
} }
/* /*
* bearer_push(): Resolve bearer congestion. Force the waiting * bearer_push(): Resolve bearer congestion. Force the waiting
* links to push out their unsent packets, one packet per link * links to push out their unsent packets, one packet per link
* per iteration, until all packets are gone or congestion reoccurs. * per iteration, until all packets are gone or congestion reoccurs.
* 'net_lock' is read_locked when this function is called * 'tipc_net_lock' is read_locked when this function is called
* bearer.lock must be taken before calling * bearer.lock must be taken before calling
* Returns binary true(1) ore false(0) * Returns binary true(1) ore false(0)
*/ */
...@@ -372,7 +372,7 @@ static int bearer_push(struct bearer *b_ptr) ...@@ -372,7 +372,7 @@ static int bearer_push(struct bearer *b_ptr)
while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) {
list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) { list_for_each_entry_safe(ln, tln, &b_ptr->cong_links, link_list) {
res = link_push_packet(ln); res = tipc_link_push_packet(ln);
if (res == PUSH_FAILED) if (res == PUSH_FAILED)
break; break;
if (res == PUSH_FINISHED) if (res == PUSH_FINISHED)
...@@ -382,7 +382,7 @@ static int bearer_push(struct bearer *b_ptr) ...@@ -382,7 +382,7 @@ static int bearer_push(struct bearer *b_ptr)
return list_empty(&b_ptr->cong_links); return list_empty(&b_ptr->cong_links);
} }
void bearer_lock_push(struct bearer *b_ptr) void tipc_bearer_lock_push(struct bearer *b_ptr)
{ {
int res; int res;
...@@ -390,7 +390,7 @@ void bearer_lock_push(struct bearer *b_ptr) ...@@ -390,7 +390,7 @@ void bearer_lock_push(struct bearer *b_ptr)
res = bearer_push(b_ptr); res = bearer_push(b_ptr);
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
if (res) if (res)
bcbearer_push(); tipc_bcbearer_push();
} }
...@@ -405,7 +405,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr) ...@@ -405,7 +405,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
b_ptr->continue_count++; b_ptr->continue_count++;
if (!list_empty(&b_ptr->cong_links)) if (!list_empty(&b_ptr->cong_links))
k_signal((Handler)bearer_lock_push, (unsigned long)b_ptr); tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr);
b_ptr->publ.blocked = 0; b_ptr->publ.blocked = 0;
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
} }
...@@ -414,11 +414,11 @@ void tipc_continue(struct tipc_bearer *tb_ptr) ...@@ -414,11 +414,11 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
* Schedule link for sending of messages after the bearer * Schedule link for sending of messages after the bearer
* has been deblocked by 'continue()'. This method is called * has been deblocked by 'continue()'. This method is called
* when somebody tries to send a message via this link while * when somebody tries to send a message via this link while
* the bearer is congested. 'net_lock' is in read_lock here * the bearer is congested. 'tipc_net_lock' is in read_lock here
* bearer.lock is busy * bearer.lock is busy
*/ */
static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr)
{ {
list_move_tail(&l_ptr->link_list, &b_ptr->cong_links); list_move_tail(&l_ptr->link_list, &b_ptr->cong_links);
} }
...@@ -427,24 +427,24 @@ static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) ...@@ -427,24 +427,24 @@ static void bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr)
* Schedule link for sending of messages after the bearer * Schedule link for sending of messages after the bearer
* has been deblocked by 'continue()'. This method is called * has been deblocked by 'continue()'. This method is called
* when somebody tries to send a message via this link while * when somebody tries to send a message via this link while
* the bearer is congested. 'net_lock' is in read_lock here, * the bearer is congested. 'tipc_net_lock' is in read_lock here,
* bearer.lock is free * bearer.lock is free
*/ */
void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr)
{ {
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
bearer_schedule_unlocked(b_ptr, l_ptr); tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
} }
/* /*
* bearer_resolve_congestion(): Check if there is bearer congestion, * tipc_bearer_resolve_congestion(): Check if there is bearer congestion,
* and if there is, try to resolve it before returning. * and if there is, try to resolve it before returning.
* 'net_lock' is read_locked when this function is called * 'tipc_net_lock' is read_locked when this function is called
*/ */
int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
{ {
int res = 1; int res = 1;
...@@ -452,7 +452,7 @@ int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) ...@@ -452,7 +452,7 @@ int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr)
return 1; return 1;
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
if (!bearer_push(b_ptr)) { if (!bearer_push(b_ptr)) {
bearer_schedule_unlocked(b_ptr, l_ptr); tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
res = 0; res = 0;
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
...@@ -479,7 +479,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -479,7 +479,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
return -ENOPROTOOPT; return -ENOPROTOOPT;
if (!bearer_name_validate(name, &b_name) || if (!bearer_name_validate(name, &b_name) ||
!addr_domain_valid(bcast_scope) || !tipc_addr_domain_valid(bcast_scope) ||
!in_scope(bcast_scope, tipc_own_addr)) !in_scope(bcast_scope, tipc_own_addr))
return -EINVAL; return -EINVAL;
...@@ -488,8 +488,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -488,8 +488,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
(priority != TIPC_MEDIA_LINK_PRI)) (priority != TIPC_MEDIA_LINK_PRI))
return -EINVAL; return -EINVAL;
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
if (!bearers) if (!tipc_bearers)
goto failed; goto failed;
m_ptr = media_find(b_name.media_name); m_ptr = media_find(b_name.media_name);
...@@ -505,15 +505,15 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -505,15 +505,15 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
bearer_id = MAX_BEARERS; bearer_id = MAX_BEARERS;
with_this_prio = 1; with_this_prio = 1;
for (i = MAX_BEARERS; i-- != 0; ) { for (i = MAX_BEARERS; i-- != 0; ) {
if (!bearers[i].active) { if (!tipc_bearers[i].active) {
bearer_id = i; bearer_id = i;
continue; continue;
} }
if (!strcmp(name, bearers[i].publ.name)) { if (!strcmp(name, tipc_bearers[i].publ.name)) {
warn("Bearer <%s> already enabled\n", name); warn("Bearer <%s> already enabled\n", name);
goto failed; goto failed;
} }
if ((bearers[i].priority == priority) && if ((tipc_bearers[i].priority == priority) &&
(++with_this_prio > 2)) { (++with_this_prio > 2)) {
if (priority-- == 0) { if (priority-- == 0) {
warn("Third bearer <%s> with priority %u, unable to lower to %u\n", warn("Third bearer <%s> with priority %u, unable to lower to %u\n",
...@@ -530,7 +530,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -530,7 +530,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
goto failed; goto failed;
} }
b_ptr = &bearers[bearer_id]; b_ptr = &tipc_bearers[bearer_id];
memset(b_ptr, 0, sizeof(struct bearer)); memset(b_ptr, 0, sizeof(struct bearer));
strcpy(b_ptr->publ.name, name); strcpy(b_ptr->publ.name, name);
...@@ -549,16 +549,16 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -549,16 +549,16 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
INIT_LIST_HEAD(&b_ptr->cong_links); INIT_LIST_HEAD(&b_ptr->cong_links);
INIT_LIST_HEAD(&b_ptr->links); INIT_LIST_HEAD(&b_ptr->links);
if (m_ptr->bcast) { if (m_ptr->bcast) {
b_ptr->link_req = disc_init_link_req(b_ptr, &m_ptr->bcast_addr, b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr,
bcast_scope, 2); bcast_scope, 2);
} }
b_ptr->publ.lock = SPIN_LOCK_UNLOCKED; b_ptr->publ.lock = SPIN_LOCK_UNLOCKED;
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
info("Enabled bearer <%s>, discovery domain %s, priority %u\n", info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
name, addr_string_fill(addr_string, bcast_scope), priority); name, addr_string_fill(addr_string, bcast_scope), priority);
return 0; return 0;
failed: failed:
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
return res; return res;
} }
...@@ -576,11 +576,11 @@ int tipc_block_bearer(const char *name) ...@@ -576,11 +576,11 @@ int tipc_block_bearer(const char *name)
if (tipc_mode != TIPC_NET_MODE) if (tipc_mode != TIPC_NET_MODE)
return -ENOPROTOOPT; return -ENOPROTOOPT;
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
b_ptr = bearer_find(name); b_ptr = bearer_find(name);
if (!b_ptr) { if (!b_ptr) {
warn("Attempt to block unknown bearer <%s>\n", name); warn("Attempt to block unknown bearer <%s>\n", name);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return -EINVAL; return -EINVAL;
} }
...@@ -590,11 +590,11 @@ int tipc_block_bearer(const char *name) ...@@ -590,11 +590,11 @@ int tipc_block_bearer(const char *name)
struct node *n_ptr = l_ptr->owner; struct node *n_ptr = l_ptr->owner;
spin_lock_bh(&n_ptr->lock); spin_lock_bh(&n_ptr->lock);
link_reset(l_ptr); tipc_link_reset(l_ptr);
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
info("Blocked bearer <%s>\n", name); info("Blocked bearer <%s>\n", name);
return TIPC_OK; return TIPC_OK;
} }
...@@ -602,7 +602,7 @@ int tipc_block_bearer(const char *name) ...@@ -602,7 +602,7 @@ int tipc_block_bearer(const char *name)
/** /**
* bearer_disable - * bearer_disable -
* *
* Note: This routine assumes caller holds net_lock. * Note: This routine assumes caller holds tipc_net_lock.
*/ */
static int bearer_disable(const char *name) static int bearer_disable(const char *name)
...@@ -620,19 +620,19 @@ static int bearer_disable(const char *name) ...@@ -620,19 +620,19 @@ static int bearer_disable(const char *name)
return -EINVAL; return -EINVAL;
} }
disc_stop_link_req(b_ptr->link_req); tipc_disc_stop_link_req(b_ptr->link_req);
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
b_ptr->link_req = NULL; b_ptr->link_req = NULL;
b_ptr->publ.blocked = 1; b_ptr->publ.blocked = 1;
if (b_ptr->media->disable_bearer) { if (b_ptr->media->disable_bearer) {
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
b_ptr->media->disable_bearer(&b_ptr->publ); b_ptr->media->disable_bearer(&b_ptr->publ);
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
} }
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
link_delete(l_ptr); tipc_link_delete(l_ptr);
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
info("Disabled bearer <%s>\n", name); info("Disabled bearer <%s>\n", name);
...@@ -644,54 +644,54 @@ int tipc_disable_bearer(const char *name) ...@@ -644,54 +644,54 @@ int tipc_disable_bearer(const char *name)
{ {
int res; int res;
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
res = bearer_disable(name); res = bearer_disable(name);
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
return res; return res;
} }
int bearer_init(void) int tipc_bearer_init(void)
{ {
int res; int res;
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC); tipc_bearers = kmalloc(MAX_BEARERS * sizeof(struct bearer), GFP_ATOMIC);
media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC); media_list = kmalloc(MAX_MEDIA * sizeof(struct media), GFP_ATOMIC);
if (bearers && media_list) { if (tipc_bearers && media_list) {
memset(bearers, 0, MAX_BEARERS * sizeof(struct bearer)); memset(tipc_bearers, 0, MAX_BEARERS * sizeof(struct bearer));
memset(media_list, 0, MAX_MEDIA * sizeof(struct media)); memset(media_list, 0, MAX_MEDIA * sizeof(struct media));
res = TIPC_OK; res = TIPC_OK;
} else { } else {
kfree(bearers); kfree(tipc_bearers);
kfree(media_list); kfree(media_list);
bearers = 0; tipc_bearers = 0;
media_list = 0; media_list = 0;
res = -ENOMEM; res = -ENOMEM;
} }
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
return res; return res;
} }
void bearer_stop(void) void tipc_bearer_stop(void)
{ {
u32 i; u32 i;
if (!bearers) if (!tipc_bearers)
return; return;
for (i = 0; i < MAX_BEARERS; i++) { for (i = 0; i < MAX_BEARERS; i++) {
if (bearers[i].active) if (tipc_bearers[i].active)
bearers[i].publ.blocked = 1; tipc_bearers[i].publ.blocked = 1;
} }
for (i = 0; i < MAX_BEARERS; i++) { for (i = 0; i < MAX_BEARERS; i++) {
if (bearers[i].active) if (tipc_bearers[i].active)
bearer_disable(bearers[i].publ.name); bearer_disable(tipc_bearers[i].publ.name);
} }
kfree(bearers); kfree(tipc_bearers);
kfree(media_list); kfree(media_list);
bearers = 0; tipc_bearers = 0;
media_list = 0; media_list = 0;
media_count = 0; media_count = 0;
} }
......
...@@ -114,26 +114,24 @@ struct bearer_name { ...@@ -114,26 +114,24 @@ struct bearer_name {
struct link; struct link;
extern struct bearer *bearers; extern struct bearer *tipc_bearers;
void media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
struct sk_buff *media_get_names(void); struct sk_buff *tipc_media_get_names(void);
struct sk_buff *bearer_get_names(void); struct sk_buff *tipc_bearer_get_names(void);
void bearer_add_dest(struct bearer *b_ptr, u32 dest); void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest);
void bearer_remove_dest(struct bearer *b_ptr, u32 dest); void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest);
void bearer_schedule(struct bearer *b_ptr, struct link *l_ptr); void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr);
struct bearer *bearer_find_interface(const char *if_name); struct bearer *tipc_bearer_find_interface(const char *if_name);
int bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr); int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr);
int bearer_init(void); int tipc_bearer_init(void);
void bearer_stop(void); void tipc_bearer_stop(void);
int bearer_broadcast(struct sk_buff *buf, struct tipc_bearer *b_ptr, void tipc_bearer_lock_push(struct bearer *b_ptr);
struct tipc_media_addr *dest);
void bearer_lock_push(struct bearer *b_ptr);
/** /**
* bearer_send- sends buffer to destination over bearer * tipc_bearer_send- sends buffer to destination over bearer
* *
* Returns true (1) if successful, or false (0) if unable to send * Returns true (1) if successful, or false (0) if unable to send
* *
...@@ -150,23 +148,23 @@ void bearer_lock_push(struct bearer *b_ptr); ...@@ -150,23 +148,23 @@ void bearer_lock_push(struct bearer *b_ptr);
* and let TIPC's link code deal with the undelivered message. * and let TIPC's link code deal with the undelivered message.
*/ */
static inline int bearer_send(struct bearer *b_ptr, struct sk_buff *buf, static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf,
struct tipc_media_addr *dest) struct tipc_media_addr *dest)
{ {
return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest);
} }
/** /**
* bearer_congested - determines if bearer is currently congested * tipc_bearer_congested - determines if bearer is currently congested
*/ */
static inline int bearer_congested(struct bearer *b_ptr, struct link *l_ptr) static inline int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr)
{ {
if (unlikely(b_ptr->publ.blocked)) if (unlikely(b_ptr->publ.blocked))
return 1; return 1;
if (likely(list_empty(&b_ptr->cong_links))) if (likely(list_empty(&b_ptr->cong_links)))
return 0; return 0;
return !bearer_resolve_congestion(b_ptr, l_ptr); return !tipc_bearer_resolve_congestion(b_ptr, l_ptr);
} }
#endif #endif
...@@ -44,15 +44,15 @@ ...@@ -44,15 +44,15 @@
#include "msg.h" #include "msg.h"
#include "bearer.h" #include "bearer.h"
void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
u32 lower, u32 upper); u32 lower, u32 upper);
struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest); struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest);
struct node **local_nodes = 0; struct node **tipc_local_nodes = 0;
struct node_map cluster_bcast_nodes = {0,{0,}}; struct node_map tipc_cltr_bcast_nodes = {0,{0,}};
u32 highest_allowed_slave = 0; u32 tipc_highest_allowed_slave = 0;
struct cluster *cluster_create(u32 addr) struct cluster *tipc_cltr_create(u32 addr)
{ {
struct _zone *z_ptr; struct _zone *z_ptr;
struct cluster *c_ptr; struct cluster *c_ptr;
...@@ -77,16 +77,16 @@ struct cluster *cluster_create(u32 addr) ...@@ -77,16 +77,16 @@ struct cluster *cluster_create(u32 addr)
} }
memset(c_ptr->nodes, 0, alloc); memset(c_ptr->nodes, 0, alloc);
if (in_own_cluster(addr)) if (in_own_cluster(addr))
local_nodes = c_ptr->nodes; tipc_local_nodes = c_ptr->nodes;
c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_slave = LOWEST_SLAVE - 1;
c_ptr->highest_node = 0; c_ptr->highest_node = 0;
z_ptr = zone_find(tipc_zone(addr)); z_ptr = tipc_zone_find(tipc_zone(addr));
if (z_ptr == NULL) { if (z_ptr == NULL) {
z_ptr = zone_create(addr); z_ptr = tipc_zone_create(addr);
} }
if (z_ptr != NULL) { if (z_ptr != NULL) {
zone_attach_cluster(z_ptr, c_ptr); tipc_zone_attach_cluster(z_ptr, c_ptr);
c_ptr->owner = z_ptr; c_ptr->owner = z_ptr;
} }
else { else {
...@@ -97,23 +97,23 @@ struct cluster *cluster_create(u32 addr) ...@@ -97,23 +97,23 @@ struct cluster *cluster_create(u32 addr)
return c_ptr; return c_ptr;
} }
void cluster_delete(struct cluster *c_ptr) void tipc_cltr_delete(struct cluster *c_ptr)
{ {
u32 n_num; u32 n_num;
if (!c_ptr) if (!c_ptr)
return; return;
for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) { for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) {
node_delete(c_ptr->nodes[n_num]); tipc_node_delete(c_ptr->nodes[n_num]);
} }
for (n_num = LOWEST_SLAVE; n_num <= c_ptr->highest_slave; n_num++) { for (n_num = LOWEST_SLAVE; n_num <= c_ptr->highest_slave; n_num++) {
node_delete(c_ptr->nodes[n_num]); tipc_node_delete(c_ptr->nodes[n_num]);
} }
kfree(c_ptr->nodes); kfree(c_ptr->nodes);
kfree(c_ptr); kfree(c_ptr);
} }
u32 cluster_next_node(struct cluster *c_ptr, u32 addr) u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
{ {
struct node *n_ptr; struct node *n_ptr;
u32 n_num = tipc_node(addr) + 1; u32 n_num = tipc_node(addr) + 1;
...@@ -122,24 +122,24 @@ u32 cluster_next_node(struct cluster *c_ptr, u32 addr) ...@@ -122,24 +122,24 @@ u32 cluster_next_node(struct cluster *c_ptr, u32 addr)
return addr; return addr;
for (; n_num <= c_ptr->highest_node; n_num++) { for (; n_num <= c_ptr->highest_node; n_num++) {
n_ptr = c_ptr->nodes[n_num]; n_ptr = c_ptr->nodes[n_num];
if (n_ptr && node_has_active_links(n_ptr)) if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr->addr; return n_ptr->addr;
} }
for (n_num = 1; n_num < tipc_node(addr); n_num++) { for (n_num = 1; n_num < tipc_node(addr); n_num++) {
n_ptr = c_ptr->nodes[n_num]; n_ptr = c_ptr->nodes[n_num];
if (n_ptr && node_has_active_links(n_ptr)) if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr->addr; return n_ptr->addr;
} }
return 0; return 0;
} }
void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr) void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr)
{ {
u32 n_num = tipc_node(n_ptr->addr); u32 n_num = tipc_node(n_ptr->addr);
u32 max_n_num = tipc_max_nodes; u32 max_n_num = tipc_max_nodes;
if (in_own_cluster(n_ptr->addr)) if (in_own_cluster(n_ptr->addr))
max_n_num = highest_allowed_slave; max_n_num = tipc_highest_allowed_slave;
assert(n_num > 0); assert(n_num > 0);
assert(n_num <= max_n_num); assert(n_num <= max_n_num);
assert(c_ptr->nodes[n_num] == 0); assert(c_ptr->nodes[n_num] == 0);
...@@ -149,12 +149,12 @@ void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr) ...@@ -149,12 +149,12 @@ void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr)
} }
/** /**
* cluster_select_router - select router to a cluster * tipc_cltr_select_router - select router to a cluster
* *
* Uses deterministic and fair algorithm. * Uses deterministic and fair algorithm.
*/ */
u32 cluster_select_router(struct cluster *c_ptr, u32 ref) u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref)
{ {
u32 n_num; u32 n_num;
u32 ulim = c_ptr->highest_node; u32 ulim = c_ptr->highest_node;
...@@ -174,29 +174,29 @@ u32 cluster_select_router(struct cluster *c_ptr, u32 ref) ...@@ -174,29 +174,29 @@ u32 cluster_select_router(struct cluster *c_ptr, u32 ref)
/* Lookup upwards with wrap-around */ /* Lookup upwards with wrap-around */
do { do {
if (node_is_up(c_ptr->nodes[n_num])) if (tipc_node_is_up(c_ptr->nodes[n_num]))
break; break;
} while (++n_num <= ulim); } while (++n_num <= ulim);
if (n_num > ulim) { if (n_num > ulim) {
n_num = 1; n_num = 1;
do { do {
if (node_is_up(c_ptr->nodes[n_num])) if (tipc_node_is_up(c_ptr->nodes[n_num]))
break; break;
} while (++n_num < tstart); } while (++n_num < tstart);
if (n_num == tstart) if (n_num == tstart)
return 0; return 0;
} }
assert(n_num <= ulim); assert(n_num <= ulim);
return node_select_router(c_ptr->nodes[n_num], ref); return tipc_node_select_router(c_ptr->nodes[n_num], ref);
} }
/** /**
* cluster_select_node - select destination node within a remote cluster * tipc_cltr_select_node - select destination node within a remote cluster
* *
* Uses deterministic and fair algorithm. * Uses deterministic and fair algorithm.
*/ */
struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
{ {
u32 n_num; u32 n_num;
u32 mask = tipc_max_nodes; u32 mask = tipc_max_nodes;
...@@ -215,11 +215,11 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) ...@@ -215,11 +215,11 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
/* Lookup upwards with wrap-around */ /* Lookup upwards with wrap-around */
for (n_num = start_entry; n_num <= c_ptr->highest_node; n_num++) { for (n_num = start_entry; n_num <= c_ptr->highest_node; n_num++) {
if (node_has_active_links(c_ptr->nodes[n_num])) if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
return c_ptr->nodes[n_num]; return c_ptr->nodes[n_num];
} }
for (n_num = 1; n_num < start_entry; n_num++) { for (n_num = 1; n_num < start_entry; n_num++) {
if (node_has_active_links(c_ptr->nodes[n_num])) if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
return c_ptr->nodes[n_num]; return c_ptr->nodes[n_num];
} }
return 0; return 0;
...@@ -229,7 +229,7 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector) ...@@ -229,7 +229,7 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
* Routing table management: See description in node.c * Routing table management: See description in node.c
*/ */
struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest) struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
{ {
u32 size = INT_H_SIZE + data_size; u32 size = INT_H_SIZE + data_size;
struct sk_buff *buf = buf_acquire(size); struct sk_buff *buf = buf_acquire(size);
...@@ -243,39 +243,39 @@ struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest) ...@@ -243,39 +243,39 @@ struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest)
return buf; return buf;
} }
void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest,
u32 lower, u32 upper) u32 lower, u32 upper)
{ {
struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr); struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr);
struct tipc_msg *msg; struct tipc_msg *msg;
if (buf) { if (buf) {
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_remote_node(msg, dest); msg_set_remote_node(msg, dest);
msg_set_type(msg, ROUTE_ADDITION); msg_set_type(msg, ROUTE_ADDITION);
cluster_multicast(c_ptr, buf, lower, upper); tipc_cltr_multicast(c_ptr, buf, lower, upper);
} else { } else {
warn("Memory squeeze: broadcast of new route failed\n"); warn("Memory squeeze: broadcast of new route failed\n");
} }
} }
void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest,
u32 lower, u32 upper) u32 lower, u32 upper)
{ {
struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr); struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr);
struct tipc_msg *msg; struct tipc_msg *msg;
if (buf) { if (buf) {
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_remote_node(msg, dest); msg_set_remote_node(msg, dest);
msg_set_type(msg, ROUTE_REMOVAL); msg_set_type(msg, ROUTE_REMOVAL);
cluster_multicast(c_ptr, buf, lower, upper); tipc_cltr_multicast(c_ptr, buf, lower, upper);
} else { } else {
warn("Memory squeeze: broadcast of lost route failed\n"); warn("Memory squeeze: broadcast of lost route failed\n");
} }
} }
void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -288,21 +288,21 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) ...@@ -288,21 +288,21 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
assert(in_own_cluster(c_ptr->addr)); assert(in_own_cluster(c_ptr->addr));
if (highest <= LOWEST_SLAVE) if (highest <= LOWEST_SLAVE)
return; return;
buf = cluster_prepare_routing_msg(highest - LOWEST_SLAVE + 1, buf = tipc_cltr_prepare_routing_msg(highest - LOWEST_SLAVE + 1,
c_ptr->addr); c_ptr->addr);
if (buf) { if (buf) {
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_remote_node(msg, c_ptr->addr); msg_set_remote_node(msg, c_ptr->addr);
msg_set_type(msg, SLAVE_ROUTING_TABLE); msg_set_type(msg, SLAVE_ROUTING_TABLE);
for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) { for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) {
if (c_ptr->nodes[n_num] && if (c_ptr->nodes[n_num] &&
node_has_active_links(c_ptr->nodes[n_num])) { tipc_node_has_active_links(c_ptr->nodes[n_num])) {
send = 1; send = 1;
msg_set_dataoctet(msg, n_num); msg_set_dataoctet(msg, n_num);
} }
} }
if (send) if (send)
link_send(buf, dest, dest); tipc_link_send(buf, dest, dest);
else else
buf_discard(buf); buf_discard(buf);
} else { } else {
...@@ -310,7 +310,7 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest) ...@@ -310,7 +310,7 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
} }
} }
void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -323,20 +323,20 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) ...@@ -323,20 +323,20 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
assert(!is_slave(dest)); assert(!is_slave(dest));
assert(in_own_cluster(dest)); assert(in_own_cluster(dest));
highest = c_ptr->highest_node; highest = c_ptr->highest_node;
buf = cluster_prepare_routing_msg(highest + 1, c_ptr->addr); buf = tipc_cltr_prepare_routing_msg(highest + 1, c_ptr->addr);
if (buf) { if (buf) {
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_remote_node(msg, c_ptr->addr); msg_set_remote_node(msg, c_ptr->addr);
msg_set_type(msg, EXT_ROUTING_TABLE); msg_set_type(msg, EXT_ROUTING_TABLE);
for (n_num = 1; n_num <= highest; n_num++) { for (n_num = 1; n_num <= highest; n_num++) {
if (c_ptr->nodes[n_num] && if (c_ptr->nodes[n_num] &&
node_has_active_links(c_ptr->nodes[n_num])) { tipc_node_has_active_links(c_ptr->nodes[n_num])) {
send = 1; send = 1;
msg_set_dataoctet(msg, n_num); msg_set_dataoctet(msg, n_num);
} }
} }
if (send) if (send)
link_send(buf, dest, dest); tipc_link_send(buf, dest, dest);
else else
buf_discard(buf); buf_discard(buf);
} else { } else {
...@@ -344,7 +344,7 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest) ...@@ -344,7 +344,7 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
} }
} }
void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -354,20 +354,20 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) ...@@ -354,20 +354,20 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
assert(is_slave(dest)); assert(is_slave(dest));
assert(in_own_cluster(c_ptr->addr)); assert(in_own_cluster(c_ptr->addr));
buf = cluster_prepare_routing_msg(highest, c_ptr->addr); buf = tipc_cltr_prepare_routing_msg(highest, c_ptr->addr);
if (buf) { if (buf) {
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_remote_node(msg, c_ptr->addr); msg_set_remote_node(msg, c_ptr->addr);
msg_set_type(msg, LOCAL_ROUTING_TABLE); msg_set_type(msg, LOCAL_ROUTING_TABLE);
for (n_num = 1; n_num <= highest; n_num++) { for (n_num = 1; n_num <= highest; n_num++) {
if (c_ptr->nodes[n_num] && if (c_ptr->nodes[n_num] &&
node_has_active_links(c_ptr->nodes[n_num])) { tipc_node_has_active_links(c_ptr->nodes[n_num])) {
send = 1; send = 1;
msg_set_dataoctet(msg, n_num); msg_set_dataoctet(msg, n_num);
} }
} }
if (send) if (send)
link_send(buf, dest, dest); tipc_link_send(buf, dest, dest);
else else
buf_discard(buf); buf_discard(buf);
} else { } else {
...@@ -375,7 +375,7 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest) ...@@ -375,7 +375,7 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
} }
} }
void cluster_recv_routing_table(struct sk_buff *buf) void tipc_cltr_recv_routing_table(struct sk_buff *buf)
{ {
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
struct cluster *c_ptr; struct cluster *c_ptr;
...@@ -388,9 +388,9 @@ void cluster_recv_routing_table(struct sk_buff *buf) ...@@ -388,9 +388,9 @@ void cluster_recv_routing_table(struct sk_buff *buf)
u32 c_num; u32 c_num;
u32 n_num; u32 n_num;
c_ptr = cluster_find(rem_node); c_ptr = tipc_cltr_find(rem_node);
if (!c_ptr) { if (!c_ptr) {
c_ptr = cluster_create(rem_node); c_ptr = tipc_cltr_create(rem_node);
if (!c_ptr) { if (!c_ptr) {
buf_discard(buf); buf_discard(buf);
return; return;
...@@ -412,10 +412,10 @@ void cluster_recv_routing_table(struct sk_buff *buf) ...@@ -412,10 +412,10 @@ void cluster_recv_routing_table(struct sk_buff *buf)
u32 addr = tipc_addr(z_num, c_num, n_num); u32 addr = tipc_addr(z_num, c_num, n_num);
n_ptr = c_ptr->nodes[n_num]; n_ptr = c_ptr->nodes[n_num];
if (!n_ptr) { if (!n_ptr) {
n_ptr = node_create(addr); n_ptr = tipc_node_create(addr);
} }
if (n_ptr) if (n_ptr)
node_add_router(n_ptr, router); tipc_node_add_router(n_ptr, router);
} }
} }
break; break;
...@@ -428,10 +428,10 @@ void cluster_recv_routing_table(struct sk_buff *buf) ...@@ -428,10 +428,10 @@ void cluster_recv_routing_table(struct sk_buff *buf)
u32 addr = tipc_addr(z_num, c_num, slave_num); u32 addr = tipc_addr(z_num, c_num, slave_num);
n_ptr = c_ptr->nodes[slave_num]; n_ptr = c_ptr->nodes[slave_num];
if (!n_ptr) { if (!n_ptr) {
n_ptr = node_create(addr); n_ptr = tipc_node_create(addr);
} }
if (n_ptr) if (n_ptr)
node_add_router(n_ptr, router); tipc_node_add_router(n_ptr, router);
} }
} }
break; break;
...@@ -445,9 +445,9 @@ void cluster_recv_routing_table(struct sk_buff *buf) ...@@ -445,9 +445,9 @@ void cluster_recv_routing_table(struct sk_buff *buf)
} }
n_ptr = c_ptr->nodes[tipc_node(rem_node)]; n_ptr = c_ptr->nodes[tipc_node(rem_node)];
if (!n_ptr) if (!n_ptr)
n_ptr = node_create(rem_node); n_ptr = tipc_node_create(rem_node);
if (n_ptr) if (n_ptr)
node_add_router(n_ptr, router); tipc_node_add_router(n_ptr, router);
break; break;
case ROUTE_REMOVAL: case ROUTE_REMOVAL:
if (!is_slave(tipc_own_addr)) { if (!is_slave(tipc_own_addr)) {
...@@ -459,7 +459,7 @@ void cluster_recv_routing_table(struct sk_buff *buf) ...@@ -459,7 +459,7 @@ void cluster_recv_routing_table(struct sk_buff *buf)
} }
n_ptr = c_ptr->nodes[tipc_node(rem_node)]; n_ptr = c_ptr->nodes[tipc_node(rem_node)];
if (n_ptr) if (n_ptr)
node_remove_router(n_ptr, router); tipc_node_remove_router(n_ptr, router);
break; break;
default: default:
assert(!"Illegal routing manager message received\n"); assert(!"Illegal routing manager message received\n");
...@@ -467,7 +467,7 @@ void cluster_recv_routing_table(struct sk_buff *buf) ...@@ -467,7 +467,7 @@ void cluster_recv_routing_table(struct sk_buff *buf)
buf_discard(buf); buf_discard(buf);
} }
void cluster_remove_as_router(struct cluster *c_ptr, u32 router) void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router)
{ {
u32 start_entry; u32 start_entry;
u32 tstop; u32 tstop;
...@@ -486,17 +486,17 @@ void cluster_remove_as_router(struct cluster *c_ptr, u32 router) ...@@ -486,17 +486,17 @@ void cluster_remove_as_router(struct cluster *c_ptr, u32 router)
for (n_num = start_entry; n_num <= tstop; n_num++) { for (n_num = start_entry; n_num <= tstop; n_num++) {
if (c_ptr->nodes[n_num]) { if (c_ptr->nodes[n_num]) {
node_remove_router(c_ptr->nodes[n_num], router); tipc_node_remove_router(c_ptr->nodes[n_num], router);
} }
} }
} }
/** /**
* cluster_multicast - multicast message to local nodes * tipc_cltr_multicast - multicast message to local nodes
*/ */
void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
u32 lower, u32 upper) u32 lower, u32 upper)
{ {
struct sk_buff *buf_copy; struct sk_buff *buf_copy;
struct node *n_ptr; struct node *n_ptr;
...@@ -505,9 +505,9 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, ...@@ -505,9 +505,9 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
assert(lower <= upper); assert(lower <= upper);
assert(((lower >= 1) && (lower <= tipc_max_nodes)) || assert(((lower >= 1) && (lower <= tipc_max_nodes)) ||
((lower >= LOWEST_SLAVE) && (lower <= highest_allowed_slave))); ((lower >= LOWEST_SLAVE) && (lower <= tipc_highest_allowed_slave)));
assert(((upper >= 1) && (upper <= tipc_max_nodes)) || assert(((upper >= 1) && (upper <= tipc_max_nodes)) ||
((upper >= LOWEST_SLAVE) && (upper <= highest_allowed_slave))); ((upper >= LOWEST_SLAVE) && (upper <= tipc_highest_allowed_slave)));
assert(in_own_cluster(c_ptr->addr)); assert(in_own_cluster(c_ptr->addr));
tstop = is_slave(upper) ? c_ptr->highest_slave : c_ptr->highest_node; tstop = is_slave(upper) ? c_ptr->highest_slave : c_ptr->highest_node;
...@@ -515,22 +515,22 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf, ...@@ -515,22 +515,22 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
tstop = upper; tstop = upper;
for (n_num = lower; n_num <= tstop; n_num++) { for (n_num = lower; n_num <= tstop; n_num++) {
n_ptr = c_ptr->nodes[n_num]; n_ptr = c_ptr->nodes[n_num];
if (n_ptr && node_has_active_links(n_ptr)) { if (n_ptr && tipc_node_has_active_links(n_ptr)) {
buf_copy = skb_copy(buf, GFP_ATOMIC); buf_copy = skb_copy(buf, GFP_ATOMIC);
if (buf_copy == NULL) if (buf_copy == NULL)
break; break;
msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
link_send(buf_copy, n_ptr->addr, n_ptr->addr); tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr);
} }
} }
buf_discard(buf); buf_discard(buf);
} }
/** /**
* cluster_broadcast - broadcast message to all nodes within cluster * tipc_cltr_broadcast - broadcast message to all nodes within cluster
*/ */
void cluster_broadcast(struct sk_buff *buf) void tipc_cltr_broadcast(struct sk_buff *buf)
{ {
struct sk_buff *buf_copy; struct sk_buff *buf_copy;
struct cluster *c_ptr; struct cluster *c_ptr;
...@@ -541,7 +541,7 @@ void cluster_broadcast(struct sk_buff *buf) ...@@ -541,7 +541,7 @@ void cluster_broadcast(struct sk_buff *buf)
u32 node_type; u32 node_type;
if (tipc_mode == TIPC_NET_MODE) { if (tipc_mode == TIPC_NET_MODE) {
c_ptr = cluster_find(tipc_own_addr); c_ptr = tipc_cltr_find(tipc_own_addr);
assert(in_own_cluster(c_ptr->addr)); /* For now */ assert(in_own_cluster(c_ptr->addr)); /* For now */
/* Send to standard nodes, then repeat loop sending to slaves */ /* Send to standard nodes, then repeat loop sending to slaves */
...@@ -550,14 +550,14 @@ void cluster_broadcast(struct sk_buff *buf) ...@@ -550,14 +550,14 @@ void cluster_broadcast(struct sk_buff *buf)
for (node_type = 1; node_type <= 2; node_type++) { for (node_type = 1; node_type <= 2; node_type++) {
for (n_num = tstart; n_num <= tstop; n_num++) { for (n_num = tstart; n_num <= tstop; n_num++) {
n_ptr = c_ptr->nodes[n_num]; n_ptr = c_ptr->nodes[n_num];
if (n_ptr && node_has_active_links(n_ptr)) { if (n_ptr && tipc_node_has_active_links(n_ptr)) {
buf_copy = skb_copy(buf, GFP_ATOMIC); buf_copy = skb_copy(buf, GFP_ATOMIC);
if (buf_copy == NULL) if (buf_copy == NULL)
goto exit; goto exit;
msg_set_destnode(buf_msg(buf_copy), msg_set_destnode(buf_msg(buf_copy),
n_ptr->addr); n_ptr->addr);
link_send(buf_copy, n_ptr->addr, tipc_link_send(buf_copy, n_ptr->addr,
n_ptr->addr); n_ptr->addr);
} }
} }
tstart = LOWEST_SLAVE; tstart = LOWEST_SLAVE;
...@@ -568,9 +568,9 @@ void cluster_broadcast(struct sk_buff *buf) ...@@ -568,9 +568,9 @@ void cluster_broadcast(struct sk_buff *buf)
buf_discard(buf); buf_discard(buf);
} }
int cluster_init(void) int tipc_cltr_init(void)
{ {
highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves; tipc_highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves;
return cluster_create(tipc_own_addr) ? TIPC_OK : -ENOMEM; return tipc_cltr_create(tipc_own_addr) ? TIPC_OK : -ENOMEM;
} }
...@@ -60,29 +60,29 @@ struct cluster { ...@@ -60,29 +60,29 @@ struct cluster {
}; };
extern struct node **local_nodes; extern struct node **tipc_local_nodes;
extern u32 highest_allowed_slave; extern u32 tipc_highest_allowed_slave;
extern struct node_map cluster_bcast_nodes; extern struct node_map tipc_cltr_bcast_nodes;
void cluster_remove_as_router(struct cluster *c_ptr, u32 router); void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router);
void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest); void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest);
struct node *cluster_select_node(struct cluster *c_ptr, u32 selector); struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector);
u32 cluster_select_router(struct cluster *c_ptr, u32 ref); u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref);
void cluster_recv_routing_table(struct sk_buff *buf); void tipc_cltr_recv_routing_table(struct sk_buff *buf);
struct cluster *cluster_create(u32 addr); struct cluster *tipc_cltr_create(u32 addr);
void cluster_delete(struct cluster *c_ptr); void tipc_cltr_delete(struct cluster *c_ptr);
void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr); void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr);
void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest); void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
void cluster_broadcast(struct sk_buff *buf); void tipc_cltr_broadcast(struct sk_buff *buf);
int cluster_init(void); int tipc_cltr_init(void);
u32 cluster_next_node(struct cluster *c_ptr, u32 addr); u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
void cluster_send_local_routes(struct cluster *c_ptr, u32 dest); void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi); void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
static inline struct cluster *cluster_find(u32 addr) static inline struct cluster *tipc_cltr_find(u32 addr)
{ {
struct _zone *z_ptr = zone_find(addr); struct _zone *z_ptr = tipc_zone_find(addr);
if (z_ptr) if (z_ptr)
return z_ptr->clusters[1]; return z_ptr->clusters[1];
......
...@@ -70,13 +70,13 @@ static int req_tlv_space; /* request message TLV area size */ ...@@ -70,13 +70,13 @@ static int req_tlv_space; /* request message TLV area size */
static int rep_headroom; /* reply message headroom to use */ static int rep_headroom; /* reply message headroom to use */
void cfg_link_event(u32 addr, char *name, int up) void tipc_cfg_link_event(u32 addr, char *name, int up)
{ {
/* TIPC DOESN'T HANDLE LINK EVENT SUBSCRIPTIONS AT THE MOMENT */ /* TIPC DOESN'T HANDLE LINK EVENT SUBSCRIPTIONS AT THE MOMENT */
} }
struct sk_buff *cfg_reply_alloc(int payload_size) struct sk_buff *tipc_cfg_reply_alloc(int payload_size)
{ {
struct sk_buff *buf; struct sk_buff *buf;
...@@ -86,14 +86,14 @@ struct sk_buff *cfg_reply_alloc(int payload_size) ...@@ -86,14 +86,14 @@ struct sk_buff *cfg_reply_alloc(int payload_size)
return buf; return buf;
} }
int cfg_append_tlv(struct sk_buff *buf, int tlv_type, int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
void *tlv_data, int tlv_data_size) void *tlv_data, int tlv_data_size)
{ {
struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; struct tlv_desc *tlv = (struct tlv_desc *)buf->tail;
int new_tlv_space = TLV_SPACE(tlv_data_size); int new_tlv_space = TLV_SPACE(tlv_data_size);
if (skb_tailroom(buf) < new_tlv_space) { if (skb_tailroom(buf) < new_tlv_space) {
dbg("cfg_append_tlv unable to append TLV\n"); dbg("tipc_cfg_append_tlv unable to append TLV\n");
return 0; return 0;
} }
skb_put(buf, new_tlv_space); skb_put(buf, new_tlv_space);
...@@ -104,28 +104,28 @@ int cfg_append_tlv(struct sk_buff *buf, int tlv_type, ...@@ -104,28 +104,28 @@ int cfg_append_tlv(struct sk_buff *buf, int tlv_type,
return 1; return 1;
} }
struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value) struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
{ {
struct sk_buff *buf; struct sk_buff *buf;
u32 value_net; u32 value_net;
buf = cfg_reply_alloc(TLV_SPACE(sizeof(value))); buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value)));
if (buf) { if (buf) {
value_net = htonl(value); value_net = htonl(value);
cfg_append_tlv(buf, tlv_type, &value_net, tipc_cfg_append_tlv(buf, tlv_type, &value_net,
sizeof(value_net)); sizeof(value_net));
} }
return buf; return buf;
} }
struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string) struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
{ {
struct sk_buff *buf; struct sk_buff *buf;
int string_len = strlen(string) + 1; int string_len = strlen(string) + 1;
buf = cfg_reply_alloc(TLV_SPACE(string_len)); buf = tipc_cfg_reply_alloc(TLV_SPACE(string_len));
if (buf) if (buf)
cfg_append_tlv(buf, tlv_type, string, string_len); tipc_cfg_append_tlv(buf, tlv_type, string, string_len);
return buf; return buf;
} }
...@@ -246,7 +246,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg, ...@@ -246,7 +246,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg,
exit: exit:
rmsg.result_len = htonl(msg_sect[1].iov_len); rmsg.result_len = htonl(msg_sect[1].iov_len);
rmsg.retval = htonl(rv); rmsg.retval = htonl(rv);
cfg_respond(msg_sect, 2u, orig); tipc_cfg_respond(msg_sect, 2u, orig);
} }
#endif #endif
...@@ -255,26 +255,26 @@ static struct sk_buff *cfg_enable_bearer(void) ...@@ -255,26 +255,26 @@ static struct sk_buff *cfg_enable_bearer(void)
struct tipc_bearer_config *args; struct tipc_bearer_config *args;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_CONFIG)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_CONFIG))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
args = (struct tipc_bearer_config *)TLV_DATA(req_tlv_area); args = (struct tipc_bearer_config *)TLV_DATA(req_tlv_area);
if (tipc_enable_bearer(args->name, if (tipc_enable_bearer(args->name,
ntohl(args->detect_scope), ntohl(args->detect_scope),
ntohl(args->priority))) ntohl(args->priority)))
return cfg_reply_error_string("unable to enable bearer"); return tipc_cfg_reply_error_string("unable to enable bearer");
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_disable_bearer(void) static struct sk_buff *cfg_disable_bearer(void)
{ {
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_BEARER_NAME))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
if (tipc_disable_bearer((char *)TLV_DATA(req_tlv_area))) if (tipc_disable_bearer((char *)TLV_DATA(req_tlv_area)))
return cfg_reply_error_string("unable to disable bearer"); return tipc_cfg_reply_error_string("unable to disable bearer");
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_own_addr(void) static struct sk_buff *cfg_set_own_addr(void)
...@@ -282,25 +282,25 @@ static struct sk_buff *cfg_set_own_addr(void) ...@@ -282,25 +282,25 @@ static struct sk_buff *cfg_set_own_addr(void)
u32 addr; u32 addr;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
addr = *(u32 *)TLV_DATA(req_tlv_area); addr = *(u32 *)TLV_DATA(req_tlv_area);
addr = ntohl(addr); addr = ntohl(addr);
if (addr == tipc_own_addr) if (addr == tipc_own_addr)
return cfg_reply_none(); return tipc_cfg_reply_none();
if (!addr_node_valid(addr)) if (!tipc_addr_node_valid(addr))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (node address)"); " (node address)");
if (tipc_own_addr) if (tipc_own_addr)
return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change node address once assigned)"); " (cannot change node address once assigned)");
spin_unlock_bh(&config_lock); spin_unlock_bh(&config_lock);
stop_net(); tipc_core_stop_net();
tipc_own_addr = addr; tipc_own_addr = addr;
start_net(); tipc_core_start_net();
spin_lock_bh(&config_lock); spin_lock_bh(&config_lock);
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_remote_mng(void) static struct sk_buff *cfg_set_remote_mng(void)
...@@ -308,12 +308,12 @@ static struct sk_buff *cfg_set_remote_mng(void) ...@@ -308,12 +308,12 @@ static struct sk_buff *cfg_set_remote_mng(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
tipc_remote_management = (value != 0); tipc_remote_management = (value != 0);
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_max_publications(void) static struct sk_buff *cfg_set_max_publications(void)
...@@ -321,15 +321,15 @@ static struct sk_buff *cfg_set_max_publications(void) ...@@ -321,15 +321,15 @@ static struct sk_buff *cfg_set_max_publications(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 1, 65535)) if (value != delimit(value, 1, 65535))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max publications must be 1-65535)"); " (max publications must be 1-65535)");
tipc_max_publications = value; tipc_max_publications = value;
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_max_subscriptions(void) static struct sk_buff *cfg_set_max_subscriptions(void)
...@@ -337,15 +337,15 @@ static struct sk_buff *cfg_set_max_subscriptions(void) ...@@ -337,15 +337,15 @@ static struct sk_buff *cfg_set_max_subscriptions(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 1, 65535)) if (value != delimit(value, 1, 65535))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max subscriptions must be 1-65535"); " (max subscriptions must be 1-65535");
tipc_max_subscriptions = value; tipc_max_subscriptions = value;
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_max_ports(void) static struct sk_buff *cfg_set_max_ports(void)
...@@ -354,31 +354,31 @@ static struct sk_buff *cfg_set_max_ports(void) ...@@ -354,31 +354,31 @@ static struct sk_buff *cfg_set_max_ports(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 127, 65535)) if (value != delimit(value, 127, 65535))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max ports must be 127-65535)"); " (max ports must be 127-65535)");
if (value == tipc_max_ports) if (value == tipc_max_ports)
return cfg_reply_none(); return tipc_cfg_reply_none();
if (atomic_read(&tipc_user_count) > 2) if (atomic_read(&tipc_user_count) > 2)
return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change max ports while TIPC users exist)"); " (cannot change max ports while TIPC users exist)");
spin_unlock_bh(&config_lock); spin_unlock_bh(&config_lock);
orig_mode = tipc_get_mode(); orig_mode = tipc_get_mode();
if (orig_mode == TIPC_NET_MODE) if (orig_mode == TIPC_NET_MODE)
stop_net(); tipc_core_stop_net();
stop_core(); tipc_core_stop();
tipc_max_ports = value; tipc_max_ports = value;
start_core(); tipc_core_start();
if (orig_mode == TIPC_NET_MODE) if (orig_mode == TIPC_NET_MODE)
start_net(); tipc_core_start_net();
spin_lock_bh(&config_lock); spin_lock_bh(&config_lock);
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *set_net_max(int value, int *parameter) static struct sk_buff *set_net_max(int value, int *parameter)
...@@ -388,13 +388,13 @@ static struct sk_buff *set_net_max(int value, int *parameter) ...@@ -388,13 +388,13 @@ static struct sk_buff *set_net_max(int value, int *parameter)
if (value != *parameter) { if (value != *parameter) {
orig_mode = tipc_get_mode(); orig_mode = tipc_get_mode();
if (orig_mode == TIPC_NET_MODE) if (orig_mode == TIPC_NET_MODE)
stop_net(); tipc_core_stop_net();
*parameter = value; *parameter = value;
if (orig_mode == TIPC_NET_MODE) if (orig_mode == TIPC_NET_MODE)
start_net(); tipc_core_start_net();
} }
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_max_zones(void) static struct sk_buff *cfg_set_max_zones(void)
...@@ -402,12 +402,12 @@ static struct sk_buff *cfg_set_max_zones(void) ...@@ -402,12 +402,12 @@ static struct sk_buff *cfg_set_max_zones(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 1, 255)) if (value != delimit(value, 1, 255))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max zones must be 1-255)"); " (max zones must be 1-255)");
return set_net_max(value, &tipc_max_zones); return set_net_max(value, &tipc_max_zones);
} }
...@@ -416,13 +416,13 @@ static struct sk_buff *cfg_set_max_clusters(void) ...@@ -416,13 +416,13 @@ static struct sk_buff *cfg_set_max_clusters(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != 1) if (value != 1)
return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (max clusters fixed at 1)"); " (max clusters fixed at 1)");
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_max_nodes(void) static struct sk_buff *cfg_set_max_nodes(void)
...@@ -430,12 +430,12 @@ static struct sk_buff *cfg_set_max_nodes(void) ...@@ -430,12 +430,12 @@ static struct sk_buff *cfg_set_max_nodes(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 8, 2047)) if (value != delimit(value, 8, 2047))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (max nodes must be 8-2047)"); " (max nodes must be 8-2047)");
return set_net_max(value, &tipc_max_nodes); return set_net_max(value, &tipc_max_nodes);
} }
...@@ -444,13 +444,13 @@ static struct sk_buff *cfg_set_max_slaves(void) ...@@ -444,13 +444,13 @@ static struct sk_buff *cfg_set_max_slaves(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != 0) if (value != 0)
return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (max secondary nodes fixed at 0)"); " (max secondary nodes fixed at 0)");
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
static struct sk_buff *cfg_set_netid(void) static struct sk_buff *cfg_set_netid(void)
...@@ -458,22 +458,22 @@ static struct sk_buff *cfg_set_netid(void) ...@@ -458,22 +458,22 @@ static struct sk_buff *cfg_set_netid(void)
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 1, 9999)) if (value != delimit(value, 1, 9999))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (network id must be 1-9999)"); " (network id must be 1-9999)");
if (tipc_own_addr) if (tipc_own_addr)
return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change network id once part of network)"); " (cannot change network id once part of network)");
return set_net_max(value, &tipc_net_id); return set_net_max(value, &tipc_net_id);
} }
struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
int request_space, int reply_headroom) int request_space, int reply_headroom)
{ {
struct sk_buff *rep_tlv_buf; struct sk_buff *rep_tlv_buf;
...@@ -490,19 +490,19 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, ...@@ -490,19 +490,19 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
if (likely(orig_node == tipc_own_addr)) { if (likely(orig_node == tipc_own_addr)) {
/* command is permitted */ /* command is permitted */
} else if (cmd >= 0x8000) { } else if (cmd >= 0x8000) {
rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot be done remotely)"); " (cannot be done remotely)");
goto exit; goto exit;
} else if (!tipc_remote_management) { } else if (!tipc_remote_management) {
rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NO_REMOTE); rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NO_REMOTE);
goto exit; goto exit;
} }
else if (cmd >= 0x4000) { else if (cmd >= 0x4000) {
u32 domain = 0; u32 domain = 0;
if ((nametbl_translate(TIPC_ZM_SRV, 0, &domain) == 0) || if ((tipc_nametbl_translate(TIPC_ZM_SRV, 0, &domain) == 0) ||
(domain != orig_node)) { (domain != orig_node)) {
rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_ZONE_MSTR); rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_ZONE_MSTR);
goto exit; goto exit;
} }
} }
...@@ -511,50 +511,50 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, ...@@ -511,50 +511,50 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
switch (cmd) { switch (cmd) {
case TIPC_CMD_NOOP: case TIPC_CMD_NOOP:
rep_tlv_buf = cfg_reply_none(); rep_tlv_buf = tipc_cfg_reply_none();
break; break;
case TIPC_CMD_GET_NODES: case TIPC_CMD_GET_NODES:
rep_tlv_buf = node_get_nodes(req_tlv_area, req_tlv_space); rep_tlv_buf = tipc_node_get_nodes(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_GET_LINKS: case TIPC_CMD_GET_LINKS:
rep_tlv_buf = node_get_links(req_tlv_area, req_tlv_space); rep_tlv_buf = tipc_node_get_links(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_SHOW_LINK_STATS: case TIPC_CMD_SHOW_LINK_STATS:
rep_tlv_buf = link_cmd_show_stats(req_tlv_area, req_tlv_space); rep_tlv_buf = tipc_link_cmd_show_stats(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_RESET_LINK_STATS: case TIPC_CMD_RESET_LINK_STATS:
rep_tlv_buf = link_cmd_reset_stats(req_tlv_area, req_tlv_space); rep_tlv_buf = tipc_link_cmd_reset_stats(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_SHOW_NAME_TABLE: case TIPC_CMD_SHOW_NAME_TABLE:
rep_tlv_buf = nametbl_get(req_tlv_area, req_tlv_space); rep_tlv_buf = tipc_nametbl_get(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_GET_BEARER_NAMES: case TIPC_CMD_GET_BEARER_NAMES:
rep_tlv_buf = bearer_get_names(); rep_tlv_buf = tipc_bearer_get_names();
break; break;
case TIPC_CMD_GET_MEDIA_NAMES: case TIPC_CMD_GET_MEDIA_NAMES:
rep_tlv_buf = media_get_names(); rep_tlv_buf = tipc_media_get_names();
break; break;
case TIPC_CMD_SHOW_PORTS: case TIPC_CMD_SHOW_PORTS:
rep_tlv_buf = port_get_ports(); rep_tlv_buf = tipc_port_get_ports();
break; break;
#if 0 #if 0
case TIPC_CMD_SHOW_PORT_STATS: case TIPC_CMD_SHOW_PORT_STATS:
rep_tlv_buf = port_show_stats(req_tlv_area, req_tlv_space); rep_tlv_buf = port_show_stats(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_RESET_PORT_STATS: case TIPC_CMD_RESET_PORT_STATS:
rep_tlv_buf = cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED); rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED);
break; break;
#endif #endif
case TIPC_CMD_SET_LOG_SIZE: case TIPC_CMD_SET_LOG_SIZE:
rep_tlv_buf = log_resize(req_tlv_area, req_tlv_space); rep_tlv_buf = tipc_log_resize(req_tlv_area, req_tlv_space);
break; break;
case TIPC_CMD_DUMP_LOG: case TIPC_CMD_DUMP_LOG:
rep_tlv_buf = log_dump(); rep_tlv_buf = tipc_log_dump();
break; break;
case TIPC_CMD_SET_LINK_TOL: case TIPC_CMD_SET_LINK_TOL:
case TIPC_CMD_SET_LINK_PRI: case TIPC_CMD_SET_LINK_PRI:
case TIPC_CMD_SET_LINK_WINDOW: case TIPC_CMD_SET_LINK_WINDOW:
rep_tlv_buf = link_cmd_config(req_tlv_area, req_tlv_space, cmd); rep_tlv_buf = tipc_link_cmd_config(req_tlv_area, req_tlv_space, cmd);
break; break;
case TIPC_CMD_ENABLE_BEARER: case TIPC_CMD_ENABLE_BEARER:
rep_tlv_buf = cfg_enable_bearer(); rep_tlv_buf = cfg_enable_bearer();
...@@ -593,31 +593,31 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area, ...@@ -593,31 +593,31 @@ struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area,
rep_tlv_buf = cfg_set_netid(); rep_tlv_buf = cfg_set_netid();
break; break;
case TIPC_CMD_GET_REMOTE_MNG: case TIPC_CMD_GET_REMOTE_MNG:
rep_tlv_buf = cfg_reply_unsigned(tipc_remote_management); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_remote_management);
break; break;
case TIPC_CMD_GET_MAX_PORTS: case TIPC_CMD_GET_MAX_PORTS:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_ports); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_ports);
break; break;
case TIPC_CMD_GET_MAX_PUBL: case TIPC_CMD_GET_MAX_PUBL:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_publications); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_publications);
break; break;
case TIPC_CMD_GET_MAX_SUBSCR: case TIPC_CMD_GET_MAX_SUBSCR:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_subscriptions); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_subscriptions);
break; break;
case TIPC_CMD_GET_MAX_ZONES: case TIPC_CMD_GET_MAX_ZONES:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_zones); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_zones);
break; break;
case TIPC_CMD_GET_MAX_CLUSTERS: case TIPC_CMD_GET_MAX_CLUSTERS:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_clusters); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_clusters);
break; break;
case TIPC_CMD_GET_MAX_NODES: case TIPC_CMD_GET_MAX_NODES:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_nodes); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_nodes);
break; break;
case TIPC_CMD_GET_MAX_SLAVES: case TIPC_CMD_GET_MAX_SLAVES:
rep_tlv_buf = cfg_reply_unsigned(tipc_max_slaves); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_max_slaves);
break; break;
case TIPC_CMD_GET_NETID: case TIPC_CMD_GET_NETID:
rep_tlv_buf = cfg_reply_unsigned(tipc_net_id); rep_tlv_buf = tipc_cfg_reply_unsigned(tipc_net_id);
break; break;
default: default:
rep_tlv_buf = NULL; rep_tlv_buf = NULL;
...@@ -655,11 +655,11 @@ static void cfg_named_msg_event(void *userdata, ...@@ -655,11 +655,11 @@ static void cfg_named_msg_event(void *userdata,
/* Generate reply for request (if can't, return request) */ /* Generate reply for request (if can't, return request) */
rep_buf = cfg_do_cmd(orig->node, rep_buf = tipc_cfg_do_cmd(orig->node,
ntohs(req_hdr->tcm_type), ntohs(req_hdr->tcm_type),
msg + sizeof(*req_hdr), msg + sizeof(*req_hdr),
size - sizeof(*req_hdr), size - sizeof(*req_hdr),
BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr));
if (rep_buf) { if (rep_buf) {
skb_push(rep_buf, sizeof(*rep_hdr)); skb_push(rep_buf, sizeof(*rep_hdr));
rep_hdr = (struct tipc_cfg_msg_hdr *)rep_buf->data; rep_hdr = (struct tipc_cfg_msg_hdr *)rep_buf->data;
...@@ -675,7 +675,7 @@ static void cfg_named_msg_event(void *userdata, ...@@ -675,7 +675,7 @@ static void cfg_named_msg_event(void *userdata,
tipc_send_buf2port(port_ref, orig, rep_buf, rep_buf->len); tipc_send_buf2port(port_ref, orig, rep_buf, rep_buf->len);
} }
int cfg_init(void) int tipc_cfg_init(void)
{ {
struct tipc_name_seq seq; struct tipc_name_seq seq;
int res; int res;
...@@ -696,7 +696,7 @@ int cfg_init(void) ...@@ -696,7 +696,7 @@ int cfg_init(void)
seq.type = TIPC_CFG_SRV; seq.type = TIPC_CFG_SRV;
seq.lower = seq.upper = tipc_own_addr; seq.lower = seq.upper = tipc_own_addr;
res = nametbl_publish_rsv(mng.port_ref, TIPC_ZONE_SCOPE, &seq); res = tipc_nametbl_publish_rsv(mng.port_ref, TIPC_ZONE_SCOPE, &seq);
if (res) if (res)
goto failed; goto failed;
...@@ -709,7 +709,7 @@ int cfg_init(void) ...@@ -709,7 +709,7 @@ int cfg_init(void)
return res; return res;
} }
void cfg_stop(void) void tipc_cfg_stop(void)
{ {
if (mng.user_ref) { if (mng.user_ref) {
tipc_detach(mng.user_ref); tipc_detach(mng.user_ref);
......
...@@ -42,38 +42,38 @@ ...@@ -42,38 +42,38 @@
#include "core.h" #include "core.h"
#include "link.h" #include "link.h"
struct sk_buff *cfg_reply_alloc(int payload_size); struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
int cfg_append_tlv(struct sk_buff *buf, int tlv_type, int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
void *tlv_data, int tlv_data_size); void *tlv_data, int tlv_data_size);
struct sk_buff *cfg_reply_unsigned_type(u16 tlv_type, u32 value); struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
struct sk_buff *cfg_reply_string_type(u16 tlv_type, char *string); struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
static inline struct sk_buff *cfg_reply_none(void) static inline struct sk_buff *tipc_cfg_reply_none(void)
{ {
return cfg_reply_alloc(0); return tipc_cfg_reply_alloc(0);
} }
static inline struct sk_buff *cfg_reply_unsigned(u32 value) static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
{ {
return cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value); return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
} }
static inline struct sk_buff *cfg_reply_error_string(char *string) static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
{ {
return cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string); return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
} }
static inline struct sk_buff *cfg_reply_ultra_string(char *string) static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string)
{ {
return cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string);
} }
struct sk_buff *cfg_do_cmd(u32 orig_node, u16 cmd, struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd,
const void *req_tlv_area, int req_tlv_space, const void *req_tlv_area, int req_tlv_space,
int headroom); int headroom);
void cfg_link_event(u32 addr, char *name, int up); void tipc_cfg_link_event(u32 addr, char *name, int up);
int cfg_init(void); int tipc_cfg_init(void);
void cfg_stop(void); void tipc_cfg_stop(void);
#endif #endif
...@@ -48,14 +48,14 @@ ...@@ -48,14 +48,14 @@
#include "subscr.h" #include "subscr.h"
#include "config.h" #include "config.h"
int eth_media_start(void); int tipc_eth_media_start(void);
void eth_media_stop(void); void tipc_eth_media_stop(void);
int handler_start(void); int tipc_handler_start(void);
void handler_stop(void); void tipc_handler_stop(void);
int socket_init(void); int tipc_socket_init(void);
void socket_stop(void); void tipc_socket_stop(void);
int netlink_start(void); int tipc_netlink_start(void);
void netlink_stop(void); void tipc_netlink_stop(void);
#define MOD_NAME "tipc_start: " #define MOD_NAME "tipc_start: "
...@@ -112,56 +112,56 @@ int tipc_get_mode(void) ...@@ -112,56 +112,56 @@ int tipc_get_mode(void)
} }
/** /**
* stop_net - shut down TIPC networking sub-systems * tipc_core_stop_net - shut down TIPC networking sub-systems
*/ */
void stop_net(void) void tipc_core_stop_net(void)
{ {
eth_media_stop(); tipc_eth_media_stop();
tipc_stop_net(); tipc_net_stop();
} }
/** /**
* start_net - start TIPC networking sub-systems * start_net - start TIPC networking sub-systems
*/ */
int start_net(void) int tipc_core_start_net(void)
{ {
int res; int res;
if ((res = tipc_start_net()) || if ((res = tipc_net_start()) ||
(res = eth_media_start())) { (res = tipc_eth_media_start())) {
stop_net(); tipc_core_stop_net();
} }
return res; return res;
} }
/** /**
* stop_core - switch TIPC from SINGLE NODE to NOT RUNNING mode * tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
*/ */
void stop_core(void) void tipc_core_stop(void)
{ {
if (tipc_mode != TIPC_NODE_MODE) if (tipc_mode != TIPC_NODE_MODE)
return; return;
tipc_mode = TIPC_NOT_RUNNING; tipc_mode = TIPC_NOT_RUNNING;
netlink_stop(); tipc_netlink_stop();
handler_stop(); tipc_handler_stop();
cfg_stop(); tipc_cfg_stop();
subscr_stop(); tipc_subscr_stop();
reg_stop(); tipc_reg_stop();
nametbl_stop(); tipc_nametbl_stop();
ref_table_stop(); tipc_ref_table_stop();
socket_stop(); tipc_socket_stop();
} }
/** /**
* start_core - switch TIPC from NOT RUNNING to SINGLE NODE mode * tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
*/ */
int start_core(void) int tipc_core_start(void)
{ {
int res; int res;
...@@ -171,16 +171,16 @@ int start_core(void) ...@@ -171,16 +171,16 @@ int start_core(void)
get_random_bytes(&tipc_random, sizeof(tipc_random)); get_random_bytes(&tipc_random, sizeof(tipc_random));
tipc_mode = TIPC_NODE_MODE; tipc_mode = TIPC_NODE_MODE;
if ((res = handler_start()) || if ((res = tipc_handler_start()) ||
(res = ref_table_init(tipc_max_ports + tipc_max_subscriptions, (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions,
tipc_random)) || tipc_random)) ||
(res = reg_start()) || (res = tipc_reg_start()) ||
(res = nametbl_init()) || (res = tipc_nametbl_init()) ||
(res = k_signal((Handler)subscr_start, 0)) || (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
(res = k_signal((Handler)cfg_init, 0)) || (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) ||
(res = netlink_start()) || (res = tipc_netlink_start()) ||
(res = socket_init())) { (res = tipc_socket_init())) {
stop_core(); tipc_core_stop();
} }
return res; return res;
} }
...@@ -190,7 +190,7 @@ static int __init tipc_init(void) ...@@ -190,7 +190,7 @@ static int __init tipc_init(void)
{ {
int res; int res;
log_reinit(CONFIG_TIPC_LOG); tipc_log_reinit(CONFIG_TIPC_LOG);
info("Activated (compiled " __DATE__ " " __TIME__ ")\n"); info("Activated (compiled " __DATE__ " " __TIME__ ")\n");
tipc_own_addr = 0; tipc_own_addr = 0;
...@@ -204,7 +204,7 @@ static int __init tipc_init(void) ...@@ -204,7 +204,7 @@ static int __init tipc_init(void)
tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047); tipc_max_slaves = delimit(CONFIG_TIPC_SLAVE_NODES, 0, 2047);
tipc_net_id = 4711; tipc_net_id = 4711;
if ((res = start_core())) if ((res = tipc_core_start()))
err("Unable to start in single node mode\n"); err("Unable to start in single node mode\n");
else else
info("Started in single node mode\n"); info("Started in single node mode\n");
...@@ -213,10 +213,10 @@ static int __init tipc_init(void) ...@@ -213,10 +213,10 @@ static int __init tipc_init(void)
static void __exit tipc_exit(void) static void __exit tipc_exit(void)
{ {
stop_net(); tipc_core_stop_net();
stop_core(); tipc_core_stop();
info("Deactivated\n"); info("Deactivated\n");
log_stop(); tipc_log_stop();
} }
module_init(tipc_init); module_init(tipc_init);
......
...@@ -65,9 +65,9 @@ ...@@ -65,9 +65,9 @@
#define assert(i) BUG_ON(!(i)) #define assert(i) BUG_ON(!(i))
struct tipc_msg; struct tipc_msg;
extern struct print_buf *CONS, *LOG; extern struct print_buf *TIPC_CONS, *TIPC_LOG;
extern struct print_buf *TEE(struct print_buf *, struct print_buf *); extern struct print_buf *TIPC_TEE(struct print_buf *, struct print_buf *);
void msg_print(struct print_buf*,struct tipc_msg *,const char*); void tipc_msg_print(struct print_buf*,struct tipc_msg *,const char*);
void tipc_printf(struct print_buf *, const char *fmt, ...); void tipc_printf(struct print_buf *, const char *fmt, ...);
void tipc_dump(struct print_buf*,const char *fmt, ...); void tipc_dump(struct print_buf*,const char *fmt, ...);
...@@ -84,7 +84,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); ...@@ -84,7 +84,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg) #define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, KERN_NOTICE "TIPC: " fmt, ## arg)
#define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0) #define dbg(fmt, arg...) do {if (DBG_OUTPUT) tipc_printf(DBG_OUTPUT, fmt, ## arg);} while(0)
#define msg_dbg(msg, txt) do {if (DBG_OUTPUT) msg_print(DBG_OUTPUT, msg, txt);} while(0) #define msg_dbg(msg, txt) do {if (DBG_OUTPUT) tipc_msg_print(DBG_OUTPUT, msg, txt);} while(0)
#define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) #define dump(fmt, arg...) do {if (DBG_OUTPUT) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0)
...@@ -94,15 +94,15 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); ...@@ -94,15 +94,15 @@ void tipc_dump(struct print_buf*,const char *fmt, ...);
* here, or on a per .c file basis, by redefining these symbols. The following * here, or on a per .c file basis, by redefining these symbols. The following
* print buffer options are available: * print buffer options are available:
* *
* NULL : Output to null print buffer (i.e. print nowhere) * NULL : Output to null print buffer (i.e. print nowhere)
* CONS : Output to system console * TIPC_CONS : Output to system console
* LOG : Output to TIPC log buffer * TIPC_LOG : Output to TIPC log buffer
* &buf : Output to user-defined buffer (struct print_buf *) * &buf : Output to user-defined buffer (struct print_buf *)
* TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TEE(CONS,LOG) ) * TIPC_TEE(&buf_a,&buf_b) : Output to two print buffers (eg. TIPC_TEE(TIPC_CONS,TIPC_LOG) )
*/ */
#ifndef TIPC_OUTPUT #ifndef TIPC_OUTPUT
#define TIPC_OUTPUT TEE(CONS,LOG) #define TIPC_OUTPUT TIPC_TEE(TIPC_CONS,TIPC_LOG)
#endif #endif
#ifndef DBG_OUTPUT #ifndef DBG_OUTPUT
...@@ -167,10 +167,10 @@ extern atomic_t tipc_user_count; ...@@ -167,10 +167,10 @@ extern atomic_t tipc_user_count;
* Routines available to privileged subsystems * Routines available to privileged subsystems
*/ */
extern int start_core(void); extern int tipc_core_start(void);
extern void stop_core(void); extern void tipc_core_stop(void);
extern int start_net(void); extern int tipc_core_start_net(void);
extern void stop_net(void); extern void tipc_core_stop_net(void);
static inline int delimit(int val, int min, int max) static inline int delimit(int val, int min, int max)
{ {
...@@ -188,7 +188,7 @@ static inline int delimit(int val, int min, int max) ...@@ -188,7 +188,7 @@ static inline int delimit(int val, int min, int max)
typedef void (*Handler) (unsigned long); typedef void (*Handler) (unsigned long);
u32 k_signal(Handler routine, unsigned long argument); u32 tipc_k_signal(Handler routine, unsigned long argument);
/** /**
* k_init_timer - initialize a timer * k_init_timer - initialize a timer
......
...@@ -44,10 +44,10 @@ static char print_string[MAX_STRING]; ...@@ -44,10 +44,10 @@ static char print_string[MAX_STRING];
static spinlock_t print_lock = SPIN_LOCK_UNLOCKED; static spinlock_t print_lock = SPIN_LOCK_UNLOCKED;
static struct print_buf cons_buf = { NULL, 0, NULL, NULL }; static struct print_buf cons_buf = { NULL, 0, NULL, NULL };
struct print_buf *CONS = &cons_buf; struct print_buf *TIPC_CONS = &cons_buf;
static struct print_buf log_buf = { NULL, 0, NULL, NULL }; static struct print_buf log_buf = { NULL, 0, NULL, NULL };
struct print_buf *LOG = &log_buf; struct print_buf *TIPC_LOG = &log_buf;
#define FORMAT(PTR,LEN,FMT) \ #define FORMAT(PTR,LEN,FMT) \
...@@ -66,15 +66,15 @@ struct print_buf *LOG = &log_buf; ...@@ -66,15 +66,15 @@ struct print_buf *LOG = &log_buf;
* simultaneous use of the print buffer(s) being manipulated. * simultaneous use of the print buffer(s) being manipulated.
* 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of * 2) tipc_printf() uses 'print_lock' to prevent simultaneous use of
* 'print_string' and to protect its print buffer(s). * 'print_string' and to protect its print buffer(s).
* 3) TEE() uses 'print_lock' to protect its print buffer(s). * 3) TIPC_TEE() uses 'print_lock' to protect its print buffer(s).
* 4) Routines of the form log_XXX() uses 'print_lock' to protect LOG. * 4) Routines of the form log_XXX() uses 'print_lock' to protect TIPC_LOG.
*/ */
/** /**
* printbuf_init - initialize print buffer to empty * tipc_printbuf_init - initialize print buffer to empty
*/ */
void printbuf_init(struct print_buf *pb, char *raw, u32 sz) void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 sz)
{ {
if (!pb || !raw || (sz < (MAX_STRING + 1))) if (!pb || !raw || (sz < (MAX_STRING + 1)))
return; return;
...@@ -87,26 +87,26 @@ void printbuf_init(struct print_buf *pb, char *raw, u32 sz) ...@@ -87,26 +87,26 @@ void printbuf_init(struct print_buf *pb, char *raw, u32 sz)
} }
/** /**
* printbuf_reset - reinitialize print buffer to empty state * tipc_printbuf_reset - reinitialize print buffer to empty state
*/ */
void printbuf_reset(struct print_buf *pb) void tipc_printbuf_reset(struct print_buf *pb)
{ {
if (pb && pb->buf) if (pb && pb->buf)
printbuf_init(pb, pb->buf, pb->size); tipc_printbuf_init(pb, pb->buf, pb->size);
} }
/** /**
* printbuf_empty - test if print buffer is in empty state * tipc_printbuf_empty - test if print buffer is in empty state
*/ */
int printbuf_empty(struct print_buf *pb) int tipc_printbuf_empty(struct print_buf *pb)
{ {
return (!pb || !pb->buf || (pb->crs == pb->buf)); return (!pb || !pb->buf || (pb->crs == pb->buf));
} }
/** /**
* printbuf_validate - check for print buffer overflow * tipc_printbuf_validate - check for print buffer overflow
* *
* Verifies that a print buffer has captured all data written to it. * Verifies that a print buffer has captured all data written to it.
* If data has been lost, linearize buffer and prepend an error message * If data has been lost, linearize buffer and prepend an error message
...@@ -114,7 +114,7 @@ int printbuf_empty(struct print_buf *pb) ...@@ -114,7 +114,7 @@ int printbuf_empty(struct print_buf *pb)
* Returns length of print buffer data string (including trailing NULL) * Returns length of print buffer data string (including trailing NULL)
*/ */
int printbuf_validate(struct print_buf *pb) int tipc_printbuf_validate(struct print_buf *pb)
{ {
char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n"; char *err = " *** PRINT BUFFER WRAPPED AROUND ***\n";
char *cp_buf; char *cp_buf;
...@@ -126,13 +126,13 @@ int printbuf_validate(struct print_buf *pb) ...@@ -126,13 +126,13 @@ int printbuf_validate(struct print_buf *pb)
if (pb->buf[pb->size - 1] == '\0') { if (pb->buf[pb->size - 1] == '\0') {
cp_buf = kmalloc(pb->size, GFP_ATOMIC); cp_buf = kmalloc(pb->size, GFP_ATOMIC);
if (cp_buf != NULL){ if (cp_buf != NULL){
printbuf_init(&cb, cp_buf, pb->size); tipc_printbuf_init(&cb, cp_buf, pb->size);
printbuf_move(&cb, pb); tipc_printbuf_move(&cb, pb);
printbuf_move(pb, &cb); tipc_printbuf_move(pb, &cb);
kfree(cp_buf); kfree(cp_buf);
memcpy(pb->buf, err, strlen(err)); memcpy(pb->buf, err, strlen(err));
} else { } else {
printbuf_reset(pb); tipc_printbuf_reset(pb);
tipc_printf(pb, err); tipc_printf(pb, err);
} }
} }
...@@ -140,13 +140,13 @@ int printbuf_validate(struct print_buf *pb) ...@@ -140,13 +140,13 @@ int printbuf_validate(struct print_buf *pb)
} }
/** /**
* printbuf_move - move print buffer contents to another print buffer * tipc_printbuf_move - move print buffer contents to another print buffer
* *
* Current contents of destination print buffer (if any) are discarded. * Current contents of destination print buffer (if any) are discarded.
* Source print buffer becomes empty if a successful move occurs. * Source print buffer becomes empty if a successful move occurs.
*/ */
void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
{ {
int len; int len;
...@@ -156,12 +156,12 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) ...@@ -156,12 +156,12 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
return; return;
if (!pb_from || !pb_from->buf) { if (!pb_from || !pb_from->buf) {
printbuf_reset(pb_to); tipc_printbuf_reset(pb_to);
return; return;
} }
if (pb_to->size < pb_from->size) { if (pb_to->size < pb_from->size) {
printbuf_reset(pb_to); tipc_printbuf_reset(pb_to);
tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***"); tipc_printf(pb_to, "*** PRINT BUFFER OVERFLOW ***");
return; return;
} }
...@@ -179,7 +179,7 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from) ...@@ -179,7 +179,7 @@ void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
strcpy(pb_to->crs, pb_from->buf); strcpy(pb_to->crs, pb_from->buf);
pb_to->crs += len; pb_to->crs += len;
printbuf_reset(pb_from); tipc_printbuf_reset(pb_from);
} }
/** /**
...@@ -199,7 +199,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) ...@@ -199,7 +199,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
strcpy(print_string, "*** STRING TOO LONG ***"); strcpy(print_string, "*** STRING TOO LONG ***");
while (pb) { while (pb) {
if (pb == CONS) if (pb == TIPC_CONS)
printk(print_string); printk(print_string);
else if (pb->buf) { else if (pb->buf) {
chars_left = pb->buf + pb->size - pb->crs - 1; chars_left = pb->buf + pb->size - pb->crs - 1;
...@@ -223,10 +223,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) ...@@ -223,10 +223,10 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
} }
/** /**
* TEE - perform next output operation on both print buffers * TIPC_TEE - perform next output operation on both print buffers
*/ */
struct print_buf *TEE(struct print_buf *b0, struct print_buf *b1) struct print_buf *TIPC_TEE(struct print_buf *b0, struct print_buf *b1)
{ {
struct print_buf *pb = b0; struct print_buf *pb = b0;
...@@ -294,96 +294,96 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) ...@@ -294,96 +294,96 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...)
int len; int len;
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
FORMAT(CONS->buf, len, fmt); FORMAT(TIPC_CONS->buf, len, fmt);
printk(CONS->buf); printk(TIPC_CONS->buf);
for (; pb; pb = pb->next) { for (; pb; pb = pb->next) {
if (pb == CONS) if (pb == TIPC_CONS)
continue; continue;
printk("\n---- Start of dump,%s log ----\n\n", printk("\n---- Start of dump,%s log ----\n\n",
(pb == LOG) ? "global" : "local"); (pb == TIPC_LOG) ? "global" : "local");
printbuf_dump(pb); printbuf_dump(pb);
printbuf_reset(pb); tipc_printbuf_reset(pb);
printk("\n-------- End of dump --------\n"); printk("\n-------- End of dump --------\n");
} }
spin_unlock_bh(&print_lock); spin_unlock_bh(&print_lock);
} }
/** /**
* log_stop - free up TIPC log print buffer * tipc_log_stop - free up TIPC log print buffer
*/ */
void log_stop(void) void tipc_log_stop(void)
{ {
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
if (LOG->buf) { if (TIPC_LOG->buf) {
kfree(LOG->buf); kfree(TIPC_LOG->buf);
LOG->buf = NULL; TIPC_LOG->buf = NULL;
} }
spin_unlock_bh(&print_lock); spin_unlock_bh(&print_lock);
} }
/** /**
* log_reinit - set TIPC log print buffer to specified size * tipc_log_reinit - set TIPC log print buffer to specified size
*/ */
void log_reinit(int log_size) void tipc_log_reinit(int log_size)
{ {
log_stop(); tipc_log_stop();
if (log_size) { if (log_size) {
if (log_size <= MAX_STRING) if (log_size <= MAX_STRING)
log_size = MAX_STRING + 1; log_size = MAX_STRING + 1;
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
printbuf_init(LOG, kmalloc(log_size, GFP_ATOMIC), log_size); tipc_printbuf_init(TIPC_LOG, kmalloc(log_size, GFP_ATOMIC), log_size);
spin_unlock_bh(&print_lock); spin_unlock_bh(&print_lock);
} }
} }
/** /**
* log_resize - reconfigure size of TIPC log buffer * tipc_log_resize - reconfigure size of TIPC log buffer
*/ */
struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space)
{ {
u32 value; u32 value;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
value = *(u32 *)TLV_DATA(req_tlv_area); value = *(u32 *)TLV_DATA(req_tlv_area);
value = ntohl(value); value = ntohl(value);
if (value != delimit(value, 0, 32768)) if (value != delimit(value, 0, 32768))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (log size must be 0-32768)"); " (log size must be 0-32768)");
log_reinit(value); tipc_log_reinit(value);
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
/** /**
* log_dump - capture TIPC log buffer contents in configuration message * tipc_log_dump - capture TIPC log buffer contents in configuration message
*/ */
struct sk_buff *log_dump(void) struct sk_buff *tipc_log_dump(void)
{ {
struct sk_buff *reply; struct sk_buff *reply;
spin_lock_bh(&print_lock); spin_lock_bh(&print_lock);
if (!LOG->buf) if (!TIPC_LOG->buf)
reply = cfg_reply_ultra_string("log not activated\n"); reply = tipc_cfg_reply_ultra_string("log not activated\n");
else if (printbuf_empty(LOG)) else if (tipc_printbuf_empty(TIPC_LOG))
reply = cfg_reply_ultra_string("log is empty\n"); reply = tipc_cfg_reply_ultra_string("log is empty\n");
else { else {
struct tlv_desc *rep_tlv; struct tlv_desc *rep_tlv;
struct print_buf pb; struct print_buf pb;
int str_len; int str_len;
str_len = min(LOG->size, 32768u); str_len = min(TIPC_LOG->size, 32768u);
reply = cfg_reply_alloc(TLV_SPACE(str_len)); reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len));
if (reply) { if (reply) {
rep_tlv = (struct tlv_desc *)reply->data; rep_tlv = (struct tlv_desc *)reply->data;
printbuf_init(&pb, TLV_DATA(rep_tlv), str_len); tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len);
printbuf_move(&pb, LOG); tipc_printbuf_move(&pb, TIPC_LOG);
str_len = strlen(TLV_DATA(rep_tlv)) + 1; str_len = strlen(TLV_DATA(rep_tlv)) + 1;
skb_put(reply, TLV_SPACE(str_len)); skb_put(reply, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
......
...@@ -44,16 +44,16 @@ struct print_buf { ...@@ -44,16 +44,16 @@ struct print_buf {
struct print_buf *next; struct print_buf *next;
}; };
void printbuf_init(struct print_buf *pb, char *buf, u32 sz); void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 sz);
void printbuf_reset(struct print_buf *pb); void tipc_printbuf_reset(struct print_buf *pb);
int printbuf_empty(struct print_buf *pb); int tipc_printbuf_empty(struct print_buf *pb);
int printbuf_validate(struct print_buf *pb); int tipc_printbuf_validate(struct print_buf *pb);
void printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from); void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
void log_reinit(int log_size); void tipc_log_reinit(int log_size);
void log_stop(void); void tipc_log_stop(void);
struct sk_buff *log_resize(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_log_resize(const void *req_tlv_area, int req_tlv_space);
struct sk_buff *log_dump(void); struct sk_buff *tipc_log_dump(void);
#endif #endif
...@@ -93,7 +93,7 @@ int disc_create_link(const struct tipc_link_create *argv) ...@@ -93,7 +93,7 @@ int disc_create_link(const struct tipc_link_create *argv)
* disc_lost_link(): A link has lost contact * disc_lost_link(): A link has lost contact
*/ */
void disc_link_event(u32 addr, char *name, int up) void tipc_disc_link_event(u32 addr, char *name, int up)
{ {
if (in_own_cluster(addr)) if (in_own_cluster(addr))
return; return;
...@@ -103,17 +103,17 @@ void disc_link_event(u32 addr, char *name, int up) ...@@ -103,17 +103,17 @@ void disc_link_event(u32 addr, char *name, int up)
} }
/** /**
* disc_init_msg - initialize a link setup message * tipc_disc_init_msg - initialize a link setup message
* @type: message type (request or response) * @type: message type (request or response)
* @req_links: number of links associated with message * @req_links: number of links associated with message
* @dest_domain: network domain of node(s) which should respond to message * @dest_domain: network domain of node(s) which should respond to message
* @b_ptr: ptr to bearer issuing message * @b_ptr: ptr to bearer issuing message
*/ */
struct sk_buff *disc_init_msg(u32 type, struct sk_buff *tipc_disc_init_msg(u32 type,
u32 req_links, u32 req_links,
u32 dest_domain, u32 dest_domain,
struct bearer *b_ptr) struct bearer *b_ptr)
{ {
struct sk_buff *buf = buf_acquire(DSC_H_SIZE); struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -132,11 +132,11 @@ struct sk_buff *disc_init_msg(u32 type, ...@@ -132,11 +132,11 @@ struct sk_buff *disc_init_msg(u32 type,
} }
/** /**
* disc_recv_msg - handle incoming link setup message (request or response) * tipc_disc_recv_msg - handle incoming link setup message (request or response)
* @buf: buffer containing message * @buf: buffer containing message
*/ */
void disc_recv_msg(struct sk_buff *buf) void tipc_disc_recv_msg(struct sk_buff *buf)
{ {
struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle; struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle;
struct link *link; struct link *link;
...@@ -153,9 +153,9 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -153,9 +153,9 @@ void disc_recv_msg(struct sk_buff *buf)
if (net_id != tipc_net_id) if (net_id != tipc_net_id)
return; return;
if (!addr_domain_valid(dest)) if (!tipc_addr_domain_valid(dest))
return; return;
if (!addr_node_valid(orig)) if (!tipc_addr_node_valid(orig))
return; return;
if (orig == tipc_own_addr) if (orig == tipc_own_addr)
return; return;
...@@ -169,11 +169,11 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -169,11 +169,11 @@ void disc_recv_msg(struct sk_buff *buf)
/* Always accept link here */ /* Always accept link here */
struct sk_buff *rbuf; struct sk_buff *rbuf;
struct tipc_media_addr *addr; struct tipc_media_addr *addr;
struct node *n_ptr = node_find(orig); struct node *n_ptr = tipc_node_find(orig);
int link_up; int link_up;
dbg(" in own cluster\n"); dbg(" in own cluster\n");
if (n_ptr == NULL) { if (n_ptr == NULL) {
n_ptr = node_create(orig); n_ptr = tipc_node_create(orig);
} }
if (n_ptr == NULL) { if (n_ptr == NULL) {
warn("Memory squeeze; Failed to create node\n"); warn("Memory squeeze; Failed to create node\n");
...@@ -183,7 +183,7 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -183,7 +183,7 @@ void disc_recv_msg(struct sk_buff *buf)
link = n_ptr->links[b_ptr->identity]; link = n_ptr->links[b_ptr->identity];
if (!link) { if (!link) {
dbg("creating link\n"); dbg("creating link\n");
link = link_create(b_ptr, orig, &media_addr); link = tipc_link_create(b_ptr, orig, &media_addr);
if (!link) { if (!link) {
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
return; return;
...@@ -196,13 +196,13 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -196,13 +196,13 @@ void disc_recv_msg(struct sk_buff *buf)
warn("New bearer address for %s\n", warn("New bearer address for %s\n",
addr_string_fill(addr_string, orig)); addr_string_fill(addr_string, orig));
memcpy(addr, &media_addr, sizeof(*addr)); memcpy(addr, &media_addr, sizeof(*addr));
link_reset(link); tipc_link_reset(link);
} }
link_up = link_is_up(link); link_up = tipc_link_is_up(link);
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
if ((type == DSC_RESP_MSG) || link_up) if ((type == DSC_RESP_MSG) || link_up)
return; return;
rbuf = disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr);
if (rbuf != NULL) { if (rbuf != NULL) {
msg_dbg(buf_msg(rbuf),"SEND:"); msg_dbg(buf_msg(rbuf),"SEND:");
b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr); b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr);
...@@ -212,11 +212,11 @@ void disc_recv_msg(struct sk_buff *buf) ...@@ -212,11 +212,11 @@ void disc_recv_msg(struct sk_buff *buf)
} }
/** /**
* disc_stop_link_req - stop sending periodic link setup requests * tipc_disc_stop_link_req - stop sending periodic link setup requests
* @req: ptr to link request structure * @req: ptr to link request structure
*/ */
void disc_stop_link_req(struct link_req *req) void tipc_disc_stop_link_req(struct link_req *req)
{ {
if (!req) if (!req)
return; return;
...@@ -228,11 +228,11 @@ void disc_stop_link_req(struct link_req *req) ...@@ -228,11 +228,11 @@ void disc_stop_link_req(struct link_req *req)
} }
/** /**
* disc_update_link_req - update frequency of periodic link setup requests * tipc_disc_update_link_req - update frequency of periodic link setup requests
* @req: ptr to link request structure * @req: ptr to link request structure
*/ */
void disc_update_link_req(struct link_req *req) void tipc_disc_update_link_req(struct link_req *req)
{ {
if (!req) if (!req)
return; return;
...@@ -282,7 +282,7 @@ static void disc_timeout(struct link_req *req) ...@@ -282,7 +282,7 @@ static void disc_timeout(struct link_req *req)
} }
/** /**
* disc_init_link_req - start sending periodic link setup requests * tipc_disc_init_link_req - start sending periodic link setup requests
* @b_ptr: ptr to bearer issuing requests * @b_ptr: ptr to bearer issuing requests
* @dest: destination address for request messages * @dest: destination address for request messages
* @dest_domain: network domain of node(s) which should respond to message * @dest_domain: network domain of node(s) which should respond to message
...@@ -291,10 +291,10 @@ static void disc_timeout(struct link_req *req) ...@@ -291,10 +291,10 @@ static void disc_timeout(struct link_req *req)
* Returns pointer to link request structure, or NULL if unable to create. * Returns pointer to link request structure, or NULL if unable to create.
*/ */
struct link_req *disc_init_link_req(struct bearer *b_ptr, struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
const struct tipc_media_addr *dest, const struct tipc_media_addr *dest,
u32 dest_domain, u32 dest_domain,
u32 req_links) u32 req_links)
{ {
struct link_req *req; struct link_req *req;
...@@ -302,7 +302,7 @@ struct link_req *disc_init_link_req(struct bearer *b_ptr, ...@@ -302,7 +302,7 @@ struct link_req *disc_init_link_req(struct bearer *b_ptr,
if (!req) if (!req)
return NULL; return NULL;
req->buf = disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr); req->buf = tipc_disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr);
if (!req->buf) { if (!req->buf) {
kfree(req); kfree(req);
return NULL; return NULL;
......
...@@ -41,16 +41,16 @@ ...@@ -41,16 +41,16 @@
struct link_req; struct link_req;
struct link_req *disc_init_link_req(struct bearer *b_ptr, struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
const struct tipc_media_addr *dest, const struct tipc_media_addr *dest,
u32 dest_domain, u32 dest_domain,
u32 req_links); u32 req_links);
void disc_update_link_req(struct link_req *req); void tipc_disc_update_link_req(struct link_req *req);
void disc_stop_link_req(struct link_req *req); void tipc_disc_stop_link_req(struct link_req *req);
void disc_recv_msg(struct sk_buff *buf); void tipc_disc_recv_msg(struct sk_buff *buf);
void disc_link_event(u32 addr, char *name, int up); void tipc_disc_link_event(u32 addr, char *name, int up);
#if 0 #if 0
int disc_create_link(const struct tipc_link_create *argv); int disc_create_link(const struct tipc_link_create *argv);
#endif #endif
......
...@@ -238,13 +238,13 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size ...@@ -238,13 +238,13 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size
} }
/** /**
* eth_media_start - activate Ethernet bearer support * tipc_eth_media_start - activate Ethernet bearer support
* *
* Register Ethernet media type with TIPC bearer code. Also register * Register Ethernet media type with TIPC bearer code. Also register
* with OS for notifications about device state changes. * with OS for notifications about device state changes.
*/ */
int eth_media_start(void) int tipc_eth_media_start(void)
{ {
struct tipc_media_addr bcast_addr; struct tipc_media_addr bcast_addr;
int res; int res;
...@@ -271,10 +271,10 @@ int eth_media_start(void) ...@@ -271,10 +271,10 @@ int eth_media_start(void)
} }
/** /**
* eth_media_stop - deactivate Ethernet bearer support * tipc_eth_media_stop - deactivate Ethernet bearer support
*/ */
void eth_media_stop(void) void tipc_eth_media_stop(void)
{ {
int i; int i;
......
...@@ -52,7 +52,7 @@ static void process_signal_queue(unsigned long dummy); ...@@ -52,7 +52,7 @@ static void process_signal_queue(unsigned long dummy);
static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0); static DECLARE_TASKLET_DISABLED(tipc_tasklet, process_signal_queue, 0);
unsigned int k_signal(Handler routine, unsigned long argument) unsigned int tipc_k_signal(Handler routine, unsigned long argument)
{ {
struct queue_item *item; struct queue_item *item;
...@@ -93,7 +93,7 @@ static void process_signal_queue(unsigned long dummy) ...@@ -93,7 +93,7 @@ static void process_signal_queue(unsigned long dummy)
spin_unlock_bh(&qitem_lock); spin_unlock_bh(&qitem_lock);
} }
int handler_start(void) int tipc_handler_start(void)
{ {
tipc_queue_item_cache = tipc_queue_item_cache =
kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), kmem_cache_create("tipc_queue_items", sizeof(struct queue_item),
...@@ -107,7 +107,7 @@ int handler_start(void) ...@@ -107,7 +107,7 @@ int handler_start(void)
return 0; return 0;
} }
void handler_stop(void) void tipc_handler_stop(void)
{ {
struct list_head *l, *n; struct list_head *l, *n;
struct queue_item *item; struct queue_item *item;
......
...@@ -148,12 +148,12 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, ...@@ -148,12 +148,12 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
#define LINK_LOG_BUF_SIZE 0 #define LINK_LOG_BUF_SIZE 0
#define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0) #define dbg_link(fmt, arg...) do {if (LINK_LOG_BUF_SIZE) tipc_printf(&l_ptr->print_buf, fmt, ## arg); } while(0)
#define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) msg_print(&l_ptr->print_buf, msg, txt); } while(0) #define dbg_link_msg(msg, txt) do {if (LINK_LOG_BUF_SIZE) tipc_msg_print(&l_ptr->print_buf, msg, txt); } while(0)
#define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0) #define dbg_link_state(txt) do {if (LINK_LOG_BUF_SIZE) link_print(l_ptr, &l_ptr->print_buf, txt); } while(0)
#define dbg_link_dump() do { \ #define dbg_link_dump() do { \
if (LINK_LOG_BUF_SIZE) { \ if (LINK_LOG_BUF_SIZE) { \
tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \ tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \
printbuf_move(LOG, &l_ptr->print_buf); \ tipc_printbuf_move(LOG, &l_ptr->print_buf); \
} \ } \
} while (0) } while (0)
...@@ -252,14 +252,14 @@ static inline u32 link_last_sent(struct link *l_ptr) ...@@ -252,14 +252,14 @@ static inline u32 link_last_sent(struct link *l_ptr)
* Simple non-inlined link routines (i.e. referenced outside this file) * Simple non-inlined link routines (i.e. referenced outside this file)
*/ */
int link_is_up(struct link *l_ptr) int tipc_link_is_up(struct link *l_ptr)
{ {
if (!l_ptr) if (!l_ptr)
return 0; return 0;
return (link_working_working(l_ptr) || link_working_unknown(l_ptr)); return (link_working_working(l_ptr) || link_working_unknown(l_ptr));
} }
int link_is_active(struct link *l_ptr) int tipc_link_is_active(struct link *l_ptr)
{ {
return ((l_ptr->owner->active_links[0] == l_ptr) || return ((l_ptr->owner->active_links[0] == l_ptr) ||
(l_ptr->owner->active_links[1] == l_ptr)); (l_ptr->owner->active_links[1] == l_ptr));
...@@ -338,15 +338,15 @@ static int link_name_validate(const char *name, struct link_name *name_parts) ...@@ -338,15 +338,15 @@ static int link_name_validate(const char *name, struct link_name *name_parts)
* link_timeout - handle expiration of link timer * link_timeout - handle expiration of link timer
* @l_ptr: pointer to link * @l_ptr: pointer to link
* *
* This routine must not grab "net_lock" to avoid a potential deadlock conflict * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict
* with link_delete(). (There is no risk that the node will be deleted by * with tipc_link_delete(). (There is no risk that the node will be deleted by
* another thread because link_delete() always cancels the link timer before * another thread because tipc_link_delete() always cancels the link timer before
* node_delete() is called.) * tipc_node_delete() is called.)
*/ */
static void link_timeout(struct link *l_ptr) static void link_timeout(struct link *l_ptr)
{ {
node_lock(l_ptr->owner); tipc_node_lock(l_ptr->owner);
/* update counters used in statistical profiling of send traffic */ /* update counters used in statistical profiling of send traffic */
...@@ -391,9 +391,9 @@ static void link_timeout(struct link *l_ptr) ...@@ -391,9 +391,9 @@ static void link_timeout(struct link *l_ptr)
link_state_event(l_ptr, TIMEOUT_EVT); link_state_event(l_ptr, TIMEOUT_EVT);
if (l_ptr->next_out) if (l_ptr->next_out)
link_push_queue(l_ptr); tipc_link_push_queue(l_ptr);
node_unlock(l_ptr->owner); tipc_node_unlock(l_ptr->owner);
} }
static inline void link_set_timer(struct link *l_ptr, u32 time) static inline void link_set_timer(struct link *l_ptr, u32 time)
...@@ -402,7 +402,7 @@ static inline void link_set_timer(struct link *l_ptr, u32 time) ...@@ -402,7 +402,7 @@ static inline void link_set_timer(struct link *l_ptr, u32 time)
} }
/** /**
* link_create - create a new link * tipc_link_create - create a new link
* @b_ptr: pointer to associated bearer * @b_ptr: pointer to associated bearer
* @peer: network address of node at other end of link * @peer: network address of node at other end of link
* @media_addr: media address to use when sending messages over link * @media_addr: media address to use when sending messages over link
...@@ -410,8 +410,8 @@ static inline void link_set_timer(struct link *l_ptr, u32 time) ...@@ -410,8 +410,8 @@ static inline void link_set_timer(struct link *l_ptr, u32 time)
* Returns pointer to link. * Returns pointer to link.
*/ */
struct link *link_create(struct bearer *b_ptr, const u32 peer, struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
const struct tipc_media_addr *media_addr) const struct tipc_media_addr *media_addr)
{ {
struct link *l_ptr; struct link *l_ptr;
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -449,7 +449,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer, ...@@ -449,7 +449,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
strcpy((char *)msg_data(msg), if_name); strcpy((char *)msg_data(msg), if_name);
l_ptr->priority = b_ptr->priority; l_ptr->priority = b_ptr->priority;
link_set_queue_limits(l_ptr, b_ptr->media->window); tipc_link_set_queue_limits(l_ptr, b_ptr->media->window);
link_init_max_pkt(l_ptr); link_init_max_pkt(l_ptr);
...@@ -458,7 +458,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer, ...@@ -458,7 +458,7 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
link_reset_statistics(l_ptr); link_reset_statistics(l_ptr);
l_ptr->owner = node_attach_link(l_ptr); l_ptr->owner = tipc_node_attach_link(l_ptr);
if (!l_ptr->owner) { if (!l_ptr->owner) {
kfree(l_ptr); kfree(l_ptr);
return NULL; return NULL;
...@@ -472,52 +472,52 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer, ...@@ -472,52 +472,52 @@ struct link *link_create(struct bearer *b_ptr, const u32 peer,
warn("Memory squeeze; Failed to create link\n"); warn("Memory squeeze; Failed to create link\n");
return NULL; return NULL;
} }
printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
} }
k_signal((Handler)link_start, (unsigned long)l_ptr); tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
dbg("link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
return l_ptr; return l_ptr;
} }
/** /**
* link_delete - delete a link * tipc_link_delete - delete a link
* @l_ptr: pointer to link * @l_ptr: pointer to link
* *
* Note: 'net_lock' is write_locked, bearer is locked. * Note: 'tipc_net_lock' is write_locked, bearer is locked.
* This routine must not grab the node lock until after link timer cancellation * This routine must not grab the node lock until after link timer cancellation
* to avoid a potential deadlock situation. * to avoid a potential deadlock situation.
*/ */
void link_delete(struct link *l_ptr) void tipc_link_delete(struct link *l_ptr)
{ {
if (!l_ptr) { if (!l_ptr) {
err("Attempt to delete non-existent link\n"); err("Attempt to delete non-existent link\n");
return; return;
} }
dbg("link_delete()\n"); dbg("tipc_link_delete()\n");
k_cancel_timer(&l_ptr->timer); k_cancel_timer(&l_ptr->timer);
node_lock(l_ptr->owner); tipc_node_lock(l_ptr->owner);
link_reset(l_ptr); tipc_link_reset(l_ptr);
node_detach_link(l_ptr->owner, l_ptr); tipc_node_detach_link(l_ptr->owner, l_ptr);
link_stop(l_ptr); tipc_link_stop(l_ptr);
list_del_init(&l_ptr->link_list); list_del_init(&l_ptr->link_list);
if (LINK_LOG_BUF_SIZE) if (LINK_LOG_BUF_SIZE)
kfree(l_ptr->print_buf.buf); kfree(l_ptr->print_buf.buf);
node_unlock(l_ptr->owner); tipc_node_unlock(l_ptr->owner);
k_term_timer(&l_ptr->timer); k_term_timer(&l_ptr->timer);
kfree(l_ptr); kfree(l_ptr);
} }
void link_start(struct link *l_ptr) void tipc_link_start(struct link *l_ptr)
{ {
dbg("link_start %x\n", l_ptr); dbg("tipc_link_start %x\n", l_ptr);
link_state_event(l_ptr, STARTING_EVT); link_state_event(l_ptr, STARTING_EVT);
} }
...@@ -535,8 +535,8 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) ...@@ -535,8 +535,8 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
{ {
struct port *p_ptr; struct port *p_ptr;
spin_lock_bh(&port_list_lock); spin_lock_bh(&tipc_port_list_lock);
p_ptr = port_lock(origport); p_ptr = tipc_port_lock(origport);
if (p_ptr) { if (p_ptr) {
if (!p_ptr->wakeup) if (!p_ptr->wakeup)
goto exit; goto exit;
...@@ -548,13 +548,13 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) ...@@ -548,13 +548,13 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz)
list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports);
l_ptr->stats.link_congs++; l_ptr->stats.link_congs++;
exit: exit:
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
} }
spin_unlock_bh(&port_list_lock); spin_unlock_bh(&tipc_port_list_lock);
return -ELINKCONG; return -ELINKCONG;
} }
void link_wakeup_ports(struct link *l_ptr, int all) void tipc_link_wakeup_ports(struct link *l_ptr, int all)
{ {
struct port *p_ptr; struct port *p_ptr;
struct port *temp_p_ptr; struct port *temp_p_ptr;
...@@ -564,7 +564,7 @@ void link_wakeup_ports(struct link *l_ptr, int all) ...@@ -564,7 +564,7 @@ void link_wakeup_ports(struct link *l_ptr, int all)
win = 100000; win = 100000;
if (win <= 0) if (win <= 0)
return; return;
if (!spin_trylock_bh(&port_list_lock)) if (!spin_trylock_bh(&tipc_port_list_lock))
return; return;
if (link_congested(l_ptr)) if (link_congested(l_ptr))
goto exit; goto exit;
...@@ -583,7 +583,7 @@ void link_wakeup_ports(struct link *l_ptr, int all) ...@@ -583,7 +583,7 @@ void link_wakeup_ports(struct link *l_ptr, int all)
} }
exit: exit:
spin_unlock_bh(&port_list_lock); spin_unlock_bh(&tipc_port_list_lock);
} }
/** /**
...@@ -606,11 +606,11 @@ static void link_release_outqueue(struct link *l_ptr) ...@@ -606,11 +606,11 @@ static void link_release_outqueue(struct link *l_ptr)
} }
/** /**
* link_reset_fragments - purge link's inbound message fragments queue * tipc_link_reset_fragments - purge link's inbound message fragments queue
* @l_ptr: pointer to link * @l_ptr: pointer to link
*/ */
void link_reset_fragments(struct link *l_ptr) void tipc_link_reset_fragments(struct link *l_ptr)
{ {
struct sk_buff *buf = l_ptr->defragm_buf; struct sk_buff *buf = l_ptr->defragm_buf;
struct sk_buff *next; struct sk_buff *next;
...@@ -624,11 +624,11 @@ void link_reset_fragments(struct link *l_ptr) ...@@ -624,11 +624,11 @@ void link_reset_fragments(struct link *l_ptr)
} }
/** /**
* link_stop - purge all inbound and outbound messages associated with link * tipc_link_stop - purge all inbound and outbound messages associated with link
* @l_ptr: pointer to link * @l_ptr: pointer to link
*/ */
void link_stop(struct link *l_ptr) void tipc_link_stop(struct link *l_ptr)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct sk_buff *next; struct sk_buff *next;
...@@ -647,7 +647,7 @@ void link_stop(struct link *l_ptr) ...@@ -647,7 +647,7 @@ void link_stop(struct link *l_ptr)
buf = next; buf = next;
} }
link_reset_fragments(l_ptr); tipc_link_reset_fragments(l_ptr);
buf_discard(l_ptr->proto_msg_queue); buf_discard(l_ptr->proto_msg_queue);
l_ptr->proto_msg_queue = NULL; l_ptr->proto_msg_queue = NULL;
...@@ -677,7 +677,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up), ...@@ -677,7 +677,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
ev->up = up; ev->up = up;
ev->fcn = fcn; ev->fcn = fcn;
memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME); memcpy(ev->name, l_ptr->name, TIPC_MAX_LINK_NAME);
k_signal((Handler)link_recv_event, (unsigned long)ev); tipc_k_signal((Handler)link_recv_event, (unsigned long)ev);
} }
#else #else
...@@ -686,7 +686,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up), ...@@ -686,7 +686,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up),
#endif #endif
void link_reset(struct link *l_ptr) void tipc_link_reset(struct link *l_ptr)
{ {
struct sk_buff *buf; struct sk_buff *buf;
u32 prev_state = l_ptr->state; u32 prev_state = l_ptr->state;
...@@ -706,13 +706,13 @@ void link_reset(struct link *l_ptr) ...@@ -706,13 +706,13 @@ void link_reset(struct link *l_ptr)
if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET)) if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET))
return; return;
node_link_down(l_ptr->owner, l_ptr); tipc_node_link_down(l_ptr->owner, l_ptr);
bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr);
#if 0 #if 0
tipc_printf(CONS, "\nReset link <%s>\n", l_ptr->name); tipc_printf(TIPC_CONS, "\nReset link <%s>\n", l_ptr->name);
dbg_link_dump(); dbg_link_dump();
#endif #endif
if (node_has_active_links(l_ptr->owner) && if (tipc_node_has_active_links(l_ptr->owner) &&
l_ptr->owner->permit_changeover) { l_ptr->owner->permit_changeover) {
l_ptr->reset_checkpoint = checkpoint; l_ptr->reset_checkpoint = checkpoint;
l_ptr->exp_msg_count = START_CHANGEOVER; l_ptr->exp_msg_count = START_CHANGEOVER;
...@@ -730,7 +730,7 @@ void link_reset(struct link *l_ptr) ...@@ -730,7 +730,7 @@ void link_reset(struct link *l_ptr)
buf = next; buf = next;
} }
if (!list_empty(&l_ptr->waiting_ports)) if (!list_empty(&l_ptr->waiting_ports))
link_wakeup_ports(l_ptr, 1); tipc_link_wakeup_ports(l_ptr, 1);
l_ptr->retransm_queue_head = 0; l_ptr->retransm_queue_head = 0;
l_ptr->retransm_queue_size = 0; l_ptr->retransm_queue_size = 0;
...@@ -747,20 +747,20 @@ void link_reset(struct link *l_ptr) ...@@ -747,20 +747,20 @@ void link_reset(struct link *l_ptr)
l_ptr->stale_count = 0; l_ptr->stale_count = 0;
link_reset_statistics(l_ptr); link_reset_statistics(l_ptr);
link_send_event(cfg_link_event, l_ptr, 0); link_send_event(tipc_cfg_link_event, l_ptr, 0);
if (!in_own_cluster(l_ptr->addr)) if (!in_own_cluster(l_ptr->addr))
link_send_event(disc_link_event, l_ptr, 0); link_send_event(tipc_disc_link_event, l_ptr, 0);
} }
static void link_activate(struct link *l_ptr) static void link_activate(struct link *l_ptr)
{ {
l_ptr->next_in_no = 1; l_ptr->next_in_no = 1;
node_link_up(l_ptr->owner, l_ptr); tipc_node_link_up(l_ptr->owner, l_ptr);
bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr);
link_send_event(cfg_link_event, l_ptr, 1); link_send_event(tipc_cfg_link_event, l_ptr, 1);
if (!in_own_cluster(l_ptr->addr)) if (!in_own_cluster(l_ptr->addr))
link_send_event(disc_link_event, l_ptr, 1); link_send_event(tipc_disc_link_event, l_ptr, 1);
} }
/** /**
...@@ -799,13 +799,13 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -799,13 +799,13 @@ static void link_state_event(struct link *l_ptr, unsigned event)
dbg_link("TIM "); dbg_link("TIM ");
if (l_ptr->next_in_no != l_ptr->checkpoint) { if (l_ptr->next_in_no != l_ptr->checkpoint) {
l_ptr->checkpoint = l_ptr->next_in_no; l_ptr->checkpoint = l_ptr->next_in_no;
if (bclink_acks_missing(l_ptr->owner)) { if (tipc_bclink_acks_missing(l_ptr->owner)) {
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
} else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) {
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
1, 0, 0, 0, 0); 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
} }
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
...@@ -814,16 +814,16 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -814,16 +814,16 @@ static void link_state_event(struct link *l_ptr, unsigned event)
dbg_link(" -> WU\n"); dbg_link(" -> WU\n");
l_ptr->state = WORKING_UNKNOWN; l_ptr->state = WORKING_UNKNOWN;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv / 4); link_set_timer(l_ptr, cont_intv / 4);
break; break;
case RESET_MSG: case RESET_MSG:
dbg_link("RES -> RR\n"); dbg_link("RES -> RR\n");
link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET; l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
break; break;
...@@ -844,10 +844,10 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -844,10 +844,10 @@ static void link_state_event(struct link *l_ptr, unsigned event)
break; break;
case RESET_MSG: case RESET_MSG:
dbg_link("RES -> RR\n"); dbg_link("RES -> RR\n");
link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET; l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
break; break;
...@@ -858,9 +858,9 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -858,9 +858,9 @@ static void link_state_event(struct link *l_ptr, unsigned event)
l_ptr->state = WORKING_WORKING; l_ptr->state = WORKING_WORKING;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
l_ptr->checkpoint = l_ptr->next_in_no; l_ptr->checkpoint = l_ptr->next_in_no;
if (bclink_acks_missing(l_ptr->owner)) { if (tipc_bclink_acks_missing(l_ptr->owner)) {
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
} }
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
...@@ -868,18 +868,18 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -868,18 +868,18 @@ static void link_state_event(struct link *l_ptr, unsigned event)
dbg_link("Probing %u/%u,timer = %u ms)\n", dbg_link("Probing %u/%u,timer = %u ms)\n",
l_ptr->fsm_msg_cnt, l_ptr->abort_limit, l_ptr->fsm_msg_cnt, l_ptr->abort_limit,
cont_intv / 4); cont_intv / 4);
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
1, 0, 0, 0, 0); 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv / 4); link_set_timer(l_ptr, cont_intv / 4);
} else { /* Link has failed */ } else { /* Link has failed */
dbg_link("-> RU (%u probes unanswered)\n", dbg_link("-> RU (%u probes unanswered)\n",
l_ptr->fsm_msg_cnt); l_ptr->fsm_msg_cnt);
link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->state = RESET_UNKNOWN; l_ptr->state = RESET_UNKNOWN;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_send_proto_msg(l_ptr, RESET_MSG, tipc_link_send_proto_msg(l_ptr, RESET_MSG,
0, 0, 0, 0, 0); 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
} }
...@@ -904,7 +904,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -904,7 +904,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
l_ptr->state = WORKING_WORKING; l_ptr->state = WORKING_WORKING;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_activate(l_ptr); link_activate(l_ptr);
link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
break; break;
...@@ -913,7 +913,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -913,7 +913,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
dbg_link(" -> RR\n"); dbg_link(" -> RR\n");
l_ptr->state = RESET_RESET; l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
break; break;
...@@ -923,7 +923,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -923,7 +923,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
/* fall through */ /* fall through */
case TIMEOUT_EVT: case TIMEOUT_EVT:
dbg_link("TIM \n"); dbg_link("TIM \n");
link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
break; break;
...@@ -947,7 +947,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -947,7 +947,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
l_ptr->state = WORKING_WORKING; l_ptr->state = WORKING_WORKING;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
link_activate(l_ptr); link_activate(l_ptr);
link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
break; break;
...@@ -956,7 +956,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -956,7 +956,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
break; break;
case TIMEOUT_EVT: case TIMEOUT_EVT:
dbg_link("TIM\n"); dbg_link("TIM\n");
link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
l_ptr->fsm_msg_cnt++; l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv); link_set_timer(l_ptr, cont_intv);
dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt); dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt);
...@@ -1023,12 +1023,12 @@ static inline void link_add_to_outqueue(struct link *l_ptr, ...@@ -1023,12 +1023,12 @@ static inline void link_add_to_outqueue(struct link *l_ptr,
} }
/* /*
* link_send_buf() is the 'full path' for messages, called from * tipc_link_send_buf() is the 'full path' for messages, called from
* inside TIPC when the 'fast path' in tipc_send_buf * inside TIPC when the 'fast path' in tipc_send_buf
* has failed, and from link_send() * has failed, and from link_send()
*/ */
int link_send_buf(struct link *l_ptr, struct sk_buff *buf) int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
{ {
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
u32 size = msg_size(msg); u32 size = msg_size(msg);
...@@ -1051,7 +1051,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -1051,7 +1051,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
buf_discard(buf); buf_discard(buf);
if (imp > CONN_MANAGER) { if (imp > CONN_MANAGER) {
warn("Resetting <%s>, send queue full", l_ptr->name); warn("Resetting <%s>, send queue full", l_ptr->name);
link_reset(l_ptr); tipc_link_reset(l_ptr);
} }
return dsz; return dsz;
} }
...@@ -1059,21 +1059,21 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -1059,21 +1059,21 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
/* Fragmentation needed ? */ /* Fragmentation needed ? */
if (size > max_packet) if (size > max_packet)
return link_send_long_buf(l_ptr, buf); return tipc_link_send_long_buf(l_ptr, buf);
/* Packet can be queued or sent: */ /* Packet can be queued or sent: */
if (queue_size > l_ptr->stats.max_queue_sz) if (queue_size > l_ptr->stats.max_queue_sz)
l_ptr->stats.max_queue_sz = queue_size; l_ptr->stats.max_queue_sz = queue_size;
if (likely(!bearer_congested(l_ptr->b_ptr, l_ptr) && if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) &&
!link_congested(l_ptr))) { !link_congested(l_ptr))) {
link_add_to_outqueue(l_ptr, buf, msg); link_add_to_outqueue(l_ptr, buf, msg);
if (likely(bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) { if (likely(tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr))) {
l_ptr->unacked_window = 0; l_ptr->unacked_window = 0;
} else { } else {
bearer_schedule(l_ptr->b_ptr, l_ptr); tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->stats.bearer_congs++; l_ptr->stats.bearer_congs++;
l_ptr->next_out = buf; l_ptr->next_out = buf;
} }
...@@ -1088,7 +1088,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -1088,7 +1088,7 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
if (l_ptr->next_out && if (l_ptr->next_out &&
link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { link_bundle_buf(l_ptr, l_ptr->last_out, buf)) {
bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
return dsz; return dsz;
} }
...@@ -1114,38 +1114,38 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -1114,38 +1114,38 @@ int link_send_buf(struct link *l_ptr, struct sk_buff *buf)
if (!l_ptr->next_out) if (!l_ptr->next_out)
l_ptr->next_out = buf; l_ptr->next_out = buf;
link_add_to_outqueue(l_ptr, buf, msg); link_add_to_outqueue(l_ptr, buf, msg);
bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr);
return dsz; return dsz;
} }
/* /*
* link_send(): same as link_send_buf(), but the link to use has * tipc_link_send(): same as tipc_link_send_buf(), but the link to use has
* not been selected yet, and the the owner node is not locked * not been selected yet, and the the owner node is not locked
* Called by TIPC internal users, e.g. the name distributor * Called by TIPC internal users, e.g. the name distributor
*/ */
int link_send(struct sk_buff *buf, u32 dest, u32 selector) int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector)
{ {
struct link *l_ptr; struct link *l_ptr;
struct node *n_ptr; struct node *n_ptr;
int res = -ELINKCONG; int res = -ELINKCONG;
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
n_ptr = node_select(dest, selector); n_ptr = tipc_node_select(dest, selector);
if (n_ptr) { if (n_ptr) {
node_lock(n_ptr); tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector & 1]; l_ptr = n_ptr->active_links[selector & 1];
dbg("link_send: found link %x for dest %x\n", l_ptr, dest); dbg("tipc_link_send: found link %x for dest %x\n", l_ptr, dest);
if (l_ptr) { if (l_ptr) {
res = link_send_buf(l_ptr, buf); res = tipc_link_send_buf(l_ptr, buf);
} }
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
} else { } else {
dbg("Attempt to send msg to unknown node:\n"); dbg("Attempt to send msg to unknown node:\n");
msg_dbg(buf_msg(buf),">>>"); msg_dbg(buf_msg(buf),">>>");
buf_discard(buf); buf_discard(buf);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return res; return res;
} }
...@@ -1166,14 +1166,14 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, ...@@ -1166,14 +1166,14 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) { if (likely(msg_size(msg) <= link_max_pkt(l_ptr))) {
if (likely(list_empty(&l_ptr->b_ptr->cong_links))) { if (likely(list_empty(&l_ptr->b_ptr->cong_links))) {
link_add_to_outqueue(l_ptr, buf, msg); link_add_to_outqueue(l_ptr, buf, msg);
if (likely(bearer_send(l_ptr->b_ptr, buf, if (likely(tipc_bearer_send(l_ptr->b_ptr, buf,
&l_ptr->media_addr))) { &l_ptr->media_addr))) {
l_ptr->unacked_window = 0; l_ptr->unacked_window = 0;
msg_dbg(msg,"SENT_FAST:"); msg_dbg(msg,"SENT_FAST:");
return res; return res;
} }
dbg("failed sent fast...\n"); dbg("failed sent fast...\n");
bearer_schedule(l_ptr->b_ptr, l_ptr); tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->stats.bearer_congs++; l_ptr->stats.bearer_congs++;
l_ptr->next_out = buf; l_ptr->next_out = buf;
return res; return res;
...@@ -1182,7 +1182,7 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, ...@@ -1182,7 +1182,7 @@ static inline int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf,
else else
*used_max_pkt = link_max_pkt(l_ptr); *used_max_pkt = link_max_pkt(l_ptr);
} }
return link_send_buf(l_ptr, buf); /* All other cases */ return tipc_link_send_buf(l_ptr, buf); /* All other cases */
} }
/* /*
...@@ -1200,24 +1200,24 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) ...@@ -1200,24 +1200,24 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
u32 dummy; u32 dummy;
if (destnode == tipc_own_addr) if (destnode == tipc_own_addr)
return port_recv_msg(buf); return tipc_port_recv_msg(buf);
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
n_ptr = node_select(destnode, selector); n_ptr = tipc_node_select(destnode, selector);
if (likely(n_ptr)) { if (likely(n_ptr)) {
node_lock(n_ptr); tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector]; l_ptr = n_ptr->active_links[selector];
dbg("send_fast: buf %x selected %x, destnode = %x\n", dbg("send_fast: buf %x selected %x, destnode = %x\n",
buf, l_ptr, destnode); buf, l_ptr, destnode);
if (likely(l_ptr)) { if (likely(l_ptr)) {
res = link_send_buf_fast(l_ptr, buf, &dummy); res = link_send_buf_fast(l_ptr, buf, &dummy);
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return res; return res;
} }
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
res = msg_data_sz(buf_msg(buf)); res = msg_data_sz(buf_msg(buf));
tipc_reject_msg(buf, TIPC_ERR_NO_NODE); tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
return res; return res;
...@@ -1225,15 +1225,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) ...@@ -1225,15 +1225,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
/* /*
* link_send_sections_fast: Entry for messages where the * tipc_link_send_sections_fast: Entry for messages where the
* destination processor is known and the header is complete, * destination processor is known and the header is complete,
* except for total message length. * except for total message length.
* Returns user data length or errno. * Returns user data length or errno.
*/ */
int link_send_sections_fast(struct port *sender, int tipc_link_send_sections_fast(struct port *sender,
struct iovec const *msg_sect, struct iovec const *msg_sect,
const u32 num_sect, const u32 num_sect,
u32 destaddr) u32 destaddr)
{ {
struct tipc_msg *hdr = &sender->publ.phdr; struct tipc_msg *hdr = &sender->publ.phdr;
struct link *l_ptr; struct link *l_ptr;
...@@ -1253,10 +1253,10 @@ int link_send_sections_fast(struct port *sender, ...@@ -1253,10 +1253,10 @@ int link_send_sections_fast(struct port *sender,
res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt, res = msg_build(hdr, msg_sect, num_sect, sender->max_pkt,
!sender->user_port, &buf); !sender->user_port, &buf);
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
node = node_select(destaddr, selector); node = tipc_node_select(destaddr, selector);
if (likely(node)) { if (likely(node)) {
node_lock(node); tipc_node_lock(node);
l_ptr = node->active_links[selector]; l_ptr = node->active_links[selector];
if (likely(l_ptr)) { if (likely(l_ptr)) {
if (likely(buf)) { if (likely(buf)) {
...@@ -1265,8 +1265,8 @@ int link_send_sections_fast(struct port *sender, ...@@ -1265,8 +1265,8 @@ int link_send_sections_fast(struct port *sender,
if (unlikely(res < 0)) if (unlikely(res < 0))
buf_discard(buf); buf_discard(buf);
exit: exit:
node_unlock(node); tipc_node_unlock(node);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return res; return res;
} }
...@@ -1290,8 +1290,8 @@ int link_send_sections_fast(struct port *sender, ...@@ -1290,8 +1290,8 @@ int link_send_sections_fast(struct port *sender,
*/ */
sender->max_pkt = link_max_pkt(l_ptr); sender->max_pkt = link_max_pkt(l_ptr);
node_unlock(node); tipc_node_unlock(node);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt)
...@@ -1300,17 +1300,17 @@ int link_send_sections_fast(struct port *sender, ...@@ -1300,17 +1300,17 @@ int link_send_sections_fast(struct port *sender,
return link_send_sections_long(sender, msg_sect, return link_send_sections_long(sender, msg_sect,
num_sect, destaddr); num_sect, destaddr);
} }
node_unlock(node); tipc_node_unlock(node);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
/* Couldn't find a link to the destination node */ /* Couldn't find a link to the destination node */
if (buf) if (buf)
return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
if (res >= 0) if (res >= 0)
return port_reject_sections(sender, hdr, msg_sect, num_sect, return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
TIPC_ERR_NO_NODE); TIPC_ERR_NO_NODE);
return res; return res;
} }
...@@ -1444,17 +1444,17 @@ static int link_send_sections_long(struct port *sender, ...@@ -1444,17 +1444,17 @@ static int link_send_sections_long(struct port *sender,
* Now we have a buffer chain. Select a link and check * Now we have a buffer chain. Select a link and check
* that packet size is still OK * that packet size is still OK
*/ */
node = node_select(destaddr, sender->publ.ref & 1); node = tipc_node_select(destaddr, sender->publ.ref & 1);
if (likely(node)) { if (likely(node)) {
node_lock(node); tipc_node_lock(node);
l_ptr = node->active_links[sender->publ.ref & 1]; l_ptr = node->active_links[sender->publ.ref & 1];
if (!l_ptr) { if (!l_ptr) {
node_unlock(node); tipc_node_unlock(node);
goto reject; goto reject;
} }
if (link_max_pkt(l_ptr) < max_pkt) { if (link_max_pkt(l_ptr) < max_pkt) {
sender->max_pkt = link_max_pkt(l_ptr); sender->max_pkt = link_max_pkt(l_ptr);
node_unlock(node); tipc_node_unlock(node);
for (; buf_chain; buf_chain = buf) { for (; buf_chain; buf_chain = buf) {
buf = buf_chain->next; buf = buf_chain->next;
buf_discard(buf_chain); buf_discard(buf_chain);
...@@ -1467,8 +1467,8 @@ static int link_send_sections_long(struct port *sender, ...@@ -1467,8 +1467,8 @@ static int link_send_sections_long(struct port *sender,
buf = buf_chain->next; buf = buf_chain->next;
buf_discard(buf_chain); buf_discard(buf_chain);
} }
return port_reject_sections(sender, hdr, msg_sect, num_sect, return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
TIPC_ERR_NO_NODE); TIPC_ERR_NO_NODE);
} }
/* Append whole chain to send queue: */ /* Append whole chain to send queue: */
...@@ -1491,15 +1491,15 @@ static int link_send_sections_long(struct port *sender, ...@@ -1491,15 +1491,15 @@ static int link_send_sections_long(struct port *sender,
/* Send it, if possible: */ /* Send it, if possible: */
link_push_queue(l_ptr); tipc_link_push_queue(l_ptr);
node_unlock(node); tipc_node_unlock(node);
return dsz; return dsz;
} }
/* /*
* link_push_packet: Push one unsent packet to the media * tipc_link_push_packet: Push one unsent packet to the media
*/ */
u32 link_push_packet(struct link *l_ptr) u32 tipc_link_push_packet(struct link *l_ptr)
{ {
struct sk_buff *buf = l_ptr->first_out; struct sk_buff *buf = l_ptr->first_out;
u32 r_q_size = l_ptr->retransm_queue_size; u32 r_q_size = l_ptr->retransm_queue_size;
...@@ -1526,7 +1526,7 @@ u32 link_push_packet(struct link *l_ptr) ...@@ -1526,7 +1526,7 @@ u32 link_push_packet(struct link *l_ptr)
if (r_q_size && buf && !skb_cloned(buf)) { if (r_q_size && buf && !skb_cloned(buf)) {
msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in);
if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
msg_dbg(buf_msg(buf), ">DEF-RETR>"); msg_dbg(buf_msg(buf), ">DEF-RETR>");
l_ptr->retransm_queue_head = mod(++r_q_head); l_ptr->retransm_queue_head = mod(++r_q_head);
l_ptr->retransm_queue_size = --r_q_size; l_ptr->retransm_queue_size = --r_q_size;
...@@ -1545,7 +1545,7 @@ u32 link_push_packet(struct link *l_ptr) ...@@ -1545,7 +1545,7 @@ u32 link_push_packet(struct link *l_ptr)
if (buf) { if (buf) {
msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in); msg_set_bcast_ack(buf_msg(buf),l_ptr->owner->bclink.last_in);
if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
msg_dbg(buf_msg(buf), ">DEF-PROT>"); msg_dbg(buf_msg(buf), ">DEF-PROT>");
l_ptr->unacked_window = 0; l_ptr->unacked_window = 0;
buf_discard(buf); buf_discard(buf);
...@@ -1569,7 +1569,7 @@ u32 link_push_packet(struct link *l_ptr) ...@@ -1569,7 +1569,7 @@ u32 link_push_packet(struct link *l_ptr)
if (mod(next - first) < l_ptr->queue_limit[0]) { if (mod(next - first) < l_ptr->queue_limit[0]) {
msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
if (msg_user(msg) == MSG_BUNDLER) if (msg_user(msg) == MSG_BUNDLER)
msg_set_type(msg, CLOSED_MSG); msg_set_type(msg, CLOSED_MSG);
msg_dbg(msg, ">PUSH-DATA>"); msg_dbg(msg, ">PUSH-DATA>");
...@@ -1589,29 +1589,29 @@ u32 link_push_packet(struct link *l_ptr) ...@@ -1589,29 +1589,29 @@ u32 link_push_packet(struct link *l_ptr)
* push_queue(): push out the unsent messages of a link where * push_queue(): push out the unsent messages of a link where
* congestion has abated. Node is locked * congestion has abated. Node is locked
*/ */
void link_push_queue(struct link *l_ptr) void tipc_link_push_queue(struct link *l_ptr)
{ {
u32 res; u32 res;
if (bearer_congested(l_ptr->b_ptr, l_ptr)) if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr))
return; return;
do { do {
res = link_push_packet(l_ptr); res = tipc_link_push_packet(l_ptr);
} }
while (res == TIPC_OK); while (res == TIPC_OK);
if (res == PUSH_FAILED) if (res == PUSH_FAILED)
bearer_schedule(l_ptr->b_ptr, l_ptr); tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
} }
void link_retransmit(struct link *l_ptr, struct sk_buff *buf, void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
u32 retransmits) u32 retransmits)
{ {
struct tipc_msg *msg; struct tipc_msg *msg;
dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); dbg("Retransmitting %u in link %x\n", retransmits, l_ptr);
if (bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) { if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && buf && !skb_cloned(buf)) {
msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>"); msg_dbg(buf_msg(buf), ">NO_RETR->BCONG>");
dbg_print_link(l_ptr, " "); dbg_print_link(l_ptr, " ");
l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
...@@ -1622,15 +1622,15 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf, ...@@ -1622,15 +1622,15 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
msg = buf_msg(buf); msg = buf_msg(buf);
msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
/* Catch if retransmissions fail repeatedly: */ /* Catch if retransmissions fail repeatedly: */
if (l_ptr->last_retransmitted == msg_seqno(msg)) { if (l_ptr->last_retransmitted == msg_seqno(msg)) {
if (++l_ptr->stale_count > 100) { if (++l_ptr->stale_count > 100) {
msg_print(CONS, buf_msg(buf), ">RETR>"); tipc_msg_print(TIPC_CONS, buf_msg(buf), ">RETR>");
info("...Retransmitted %u times\n", info("...Retransmitted %u times\n",
l_ptr->stale_count); l_ptr->stale_count);
link_print(l_ptr, CONS, "Resetting Link\n");; link_print(l_ptr, TIPC_CONS, "Resetting Link\n");;
link_reset(l_ptr); tipc_link_reset(l_ptr);
break; break;
} }
} else { } else {
...@@ -1643,7 +1643,7 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf, ...@@ -1643,7 +1643,7 @@ void link_retransmit(struct link *l_ptr, struct sk_buff *buf,
retransmits--; retransmits--;
l_ptr->stats.retransmitted++; l_ptr->stats.retransmitted++;
} else { } else {
bearer_schedule(l_ptr->b_ptr, l_ptr); tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->stats.bearer_congs++; l_ptr->stats.bearer_congs++;
l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf));
l_ptr->retransm_queue_size = retransmits; l_ptr->retransm_queue_size = retransmits;
...@@ -1663,9 +1663,9 @@ static void link_recv_non_seq(struct sk_buff *buf) ...@@ -1663,9 +1663,9 @@ static void link_recv_non_seq(struct sk_buff *buf)
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
if (msg_user(msg) == LINK_CONFIG) if (msg_user(msg) == LINK_CONFIG)
disc_recv_msg(buf); tipc_disc_recv_msg(buf);
else else
bclink_recv_pkt(buf); tipc_bclink_recv_pkt(buf);
} }
/** /**
...@@ -1692,7 +1692,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, ...@@ -1692,7 +1692,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr,
void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
{ {
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
while (head) { while (head) {
struct bearer *b_ptr; struct bearer *b_ptr;
struct node *n_ptr; struct node *n_ptr;
...@@ -1720,22 +1720,22 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1720,22 +1720,22 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
link_recv_non_seq(buf); link_recv_non_seq(buf);
continue; continue;
} }
n_ptr = node_find(msg_prevnode(msg)); n_ptr = tipc_node_find(msg_prevnode(msg));
if (unlikely(!n_ptr)) if (unlikely(!n_ptr))
goto cont; goto cont;
node_lock(n_ptr); tipc_node_lock(n_ptr);
l_ptr = n_ptr->links[b_ptr->identity]; l_ptr = n_ptr->links[b_ptr->identity];
if (unlikely(!l_ptr)) { if (unlikely(!l_ptr)) {
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
goto cont; goto cont;
} }
/* /*
* Release acked messages * Release acked messages
*/ */
if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) {
if (node_is_up(n_ptr) && n_ptr->bclink.supported) if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported)
bclink_acknowledge(n_ptr, msg_bcast_ack(msg)); tipc_bclink_acknowledge(n_ptr, msg_bcast_ack(msg));
} }
crs = l_ptr->first_out; crs = l_ptr->first_out;
...@@ -1752,12 +1752,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1752,12 +1752,12 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
l_ptr->out_queue_size -= released; l_ptr->out_queue_size -= released;
} }
if (unlikely(l_ptr->next_out)) if (unlikely(l_ptr->next_out))
link_push_queue(l_ptr); tipc_link_push_queue(l_ptr);
if (unlikely(!list_empty(&l_ptr->waiting_ports))) if (unlikely(!list_empty(&l_ptr->waiting_ports)))
link_wakeup_ports(l_ptr, 0); tipc_link_wakeup_ports(l_ptr, 0);
if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) { if (unlikely(++l_ptr->unacked_window >= TIPC_MIN_LINK_WIN)) {
l_ptr->stats.sent_acks++; l_ptr->stats.sent_acks++;
link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
} }
protocol_check: protocol_check:
...@@ -1770,8 +1770,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1770,8 +1770,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
if (likely(msg_is_dest(msg, tipc_own_addr))) { if (likely(msg_is_dest(msg, tipc_own_addr))) {
deliver: deliver:
if (likely(msg_isdata(msg))) { if (likely(msg_isdata(msg))) {
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
port_recv_msg(buf); tipc_port_recv_msg(buf);
continue; continue;
} }
switch (msg_user(msg)) { switch (msg_user(msg)) {
...@@ -1779,34 +1779,32 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1779,34 +1779,32 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
l_ptr->stats.recv_bundles++; l_ptr->stats.recv_bundles++;
l_ptr->stats.recv_bundled += l_ptr->stats.recv_bundled +=
msg_msgcnt(msg); msg_msgcnt(msg);
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
link_recv_bundle(buf); tipc_link_recv_bundle(buf);
continue; continue;
case ROUTE_DISTRIBUTOR: case ROUTE_DISTRIBUTOR:
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
cluster_recv_routing_table(buf); tipc_cltr_recv_routing_table(buf);
continue; continue;
case NAME_DISTRIBUTOR: case NAME_DISTRIBUTOR:
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
named_recv(buf); tipc_named_recv(buf);
continue; continue;
case CONN_MANAGER: case CONN_MANAGER:
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
port_recv_proto_msg(buf); tipc_port_recv_proto_msg(buf);
continue; continue;
case MSG_FRAGMENTER: case MSG_FRAGMENTER:
l_ptr->stats.recv_fragments++; l_ptr->stats.recv_fragments++;
if (link_recv_fragment( if (tipc_link_recv_fragment(&l_ptr->defragm_buf,
&l_ptr->defragm_buf, &buf, &msg)) {
&buf, &msg)) {
l_ptr->stats.recv_fragmented++; l_ptr->stats.recv_fragmented++;
goto deliver; goto deliver;
} }
break; break;
case CHANGEOVER_PROTOCOL: case CHANGEOVER_PROTOCOL:
type = msg_type(msg); type = msg_type(msg);
if (link_recv_changeover_msg( if (link_recv_changeover_msg(&l_ptr, &buf)) {
&l_ptr, &buf)) {
msg = buf_msg(buf); msg = buf_msg(buf);
seq_no = msg_seqno(msg); seq_no = msg_seqno(msg);
TIPC_SKB_CB(buf)->handle TIPC_SKB_CB(buf)->handle
...@@ -1818,20 +1816,20 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1818,20 +1816,20 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
break; break;
} }
} }
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
net_route_msg(buf); tipc_net_route_msg(buf);
continue; continue;
} }
link_handle_out_of_seq_msg(l_ptr, buf); link_handle_out_of_seq_msg(l_ptr, buf);
head = link_insert_deferred_queue(l_ptr, head); head = link_insert_deferred_queue(l_ptr, head);
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
continue; continue;
} }
if (msg_user(msg) == LINK_PROTOCOL) { if (msg_user(msg) == LINK_PROTOCOL) {
link_recv_proto_msg(l_ptr, buf); link_recv_proto_msg(l_ptr, buf);
head = link_insert_deferred_queue(l_ptr, head); head = link_insert_deferred_queue(l_ptr, head);
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
continue; continue;
} }
msg_dbg(msg,"NSEQ<REC<"); msg_dbg(msg,"NSEQ<REC<");
...@@ -1842,14 +1840,14 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1842,14 +1840,14 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
msg_dbg(msg,"RECV-REINS:"); msg_dbg(msg,"RECV-REINS:");
buf->next = head; buf->next = head;
head = buf; head = buf;
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
continue; continue;
} }
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
cont: cont:
buf_discard(buf); buf_discard(buf);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
} }
/* /*
...@@ -1858,9 +1856,9 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) ...@@ -1858,9 +1856,9 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
* Returns the increase of the queue length,i.e. 0 or 1 * Returns the increase of the queue length,i.e. 0 or 1
*/ */
u32 link_defer_pkt(struct sk_buff **head, u32 tipc_link_defer_pkt(struct sk_buff **head,
struct sk_buff **tail, struct sk_buff **tail,
struct sk_buff *buf) struct sk_buff *buf)
{ {
struct sk_buff *prev = 0; struct sk_buff *prev = 0;
struct sk_buff *crs = *head; struct sk_buff *crs = *head;
...@@ -1939,12 +1937,12 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, ...@@ -1939,12 +1937,12 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
return; return;
} }
if (link_defer_pkt(&l_ptr->oldest_deferred_in, if (tipc_link_defer_pkt(&l_ptr->oldest_deferred_in,
&l_ptr->newest_deferred_in, buf)) { &l_ptr->newest_deferred_in, buf)) {
l_ptr->deferred_inqueue_sz++; l_ptr->deferred_inqueue_sz++;
l_ptr->stats.deferred_recv++; l_ptr->stats.deferred_recv++;
if ((l_ptr->deferred_inqueue_sz % 16) == 1) if ((l_ptr->deferred_inqueue_sz % 16) == 1)
link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);
} else } else
l_ptr->stats.duplicates++; l_ptr->stats.duplicates++;
} }
...@@ -1952,8 +1950,8 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, ...@@ -1952,8 +1950,8 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr,
/* /*
* Send protocol message to the other endpoint. * Send protocol message to the other endpoint.
*/ */
void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
u32 gap, u32 tolerance, u32 priority, u32 ack_mtu) u32 gap, u32 tolerance, u32 priority, u32 ack_mtu)
{ {
struct sk_buff *buf = 0; struct sk_buff *buf = 0;
struct tipc_msg *msg = l_ptr->pmsg; struct tipc_msg *msg = l_ptr->pmsg;
...@@ -1964,12 +1962,12 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, ...@@ -1964,12 +1962,12 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
msg_set_type(msg, msg_typ); msg_set_type(msg, msg_typ);
msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); msg_set_net_plane(msg, l_ptr->b_ptr->net_plane);
msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in)); msg_set_bcast_ack(msg, mod(l_ptr->owner->bclink.last_in));
msg_set_last_bcast(msg, bclink_get_last_sent()); msg_set_last_bcast(msg, tipc_bclink_get_last_sent());
if (msg_typ == STATE_MSG) { if (msg_typ == STATE_MSG) {
u32 next_sent = mod(l_ptr->next_out_no); u32 next_sent = mod(l_ptr->next_out_no);
if (!link_is_up(l_ptr)) if (!tipc_link_is_up(l_ptr))
return; return;
if (l_ptr->next_out) if (l_ptr->next_out)
next_sent = msg_seqno(buf_msg(l_ptr->next_out)); next_sent = msg_seqno(buf_msg(l_ptr->next_out));
...@@ -2013,7 +2011,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, ...@@ -2013,7 +2011,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
msg_set_max_pkt(msg, l_ptr->max_pkt_target); msg_set_max_pkt(msg, l_ptr->max_pkt_target);
} }
if (node_has_redundant_links(l_ptr->owner)) { if (tipc_node_has_redundant_links(l_ptr->owner)) {
msg_set_redundant_link(msg); msg_set_redundant_link(msg);
} else { } else {
msg_clear_redundant_link(msg); msg_clear_redundant_link(msg);
...@@ -2026,7 +2024,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, ...@@ -2026,7 +2024,7 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
/* Congestion? */ /* Congestion? */
if (bearer_congested(l_ptr->b_ptr, l_ptr)) { if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
if (!l_ptr->proto_msg_queue) { if (!l_ptr->proto_msg_queue) {
l_ptr->proto_msg_queue = l_ptr->proto_msg_queue =
buf_acquire(sizeof(l_ptr->proto_msg)); buf_acquire(sizeof(l_ptr->proto_msg));
...@@ -2050,14 +2048,14 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, ...@@ -2050,14 +2048,14 @@ void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg)); memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg));
msg_set_size(buf_msg(buf), msg_size); msg_set_size(buf_msg(buf), msg_size);
if (bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
l_ptr->unacked_window = 0; l_ptr->unacked_window = 0;
buf_discard(buf); buf_discard(buf);
return; return;
} }
/* New congestion */ /* New congestion */
bearer_schedule(l_ptr->b_ptr, l_ptr); tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
l_ptr->proto_msg_queue = buf; l_ptr->proto_msg_queue = buf;
l_ptr->stats.bearer_congs++; l_ptr->stats.bearer_congs++;
} }
...@@ -2131,7 +2129,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) ...@@ -2131,7 +2129,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
l_ptr->peer_bearer_id = msg_bearer_id(msg); l_ptr->peer_bearer_id = msg_bearer_id(msg);
/* Synchronize broadcast sequence numbers */ /* Synchronize broadcast sequence numbers */
if (!node_has_redundant_links(l_ptr->owner)) { if (!tipc_node_has_redundant_links(l_ptr->owner)) {
l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg)); l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg));
} }
break; break;
...@@ -2145,7 +2143,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) ...@@ -2145,7 +2143,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
warn("Changing prio <%s>: %u->%u\n", warn("Changing prio <%s>: %u->%u\n",
l_ptr->name, l_ptr->priority, msg_linkprio(msg)); l_ptr->name, l_ptr->priority, msg_linkprio(msg));
l_ptr->priority = msg_linkprio(msg); l_ptr->priority = msg_linkprio(msg);
link_reset(l_ptr); /* Enforce change to take effect */ tipc_link_reset(l_ptr); /* Enforce change to take effect */
break; break;
} }
link_state_event(l_ptr, TRAFFIC_MSG_EVT); link_state_event(l_ptr, TRAFFIC_MSG_EVT);
...@@ -2176,17 +2174,17 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) ...@@ -2176,17 +2174,17 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
/* Protocol message before retransmits, reduce loss risk */ /* Protocol message before retransmits, reduce loss risk */
bclink_check_gap(l_ptr->owner, msg_last_bcast(msg)); tipc_bclink_check_gap(l_ptr->owner, msg_last_bcast(msg));
if (rec_gap || (msg_probe(msg))) { if (rec_gap || (msg_probe(msg))) {
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
0, rec_gap, 0, 0, max_pkt_ack); 0, rec_gap, 0, 0, max_pkt_ack);
} }
if (msg_seq_gap(msg)) { if (msg_seq_gap(msg)) {
msg_dbg(msg, "With Gap:"); msg_dbg(msg, "With Gap:");
l_ptr->stats.recv_nacks++; l_ptr->stats.recv_nacks++;
link_retransmit(l_ptr, l_ptr->first_out, tipc_link_retransmit(l_ptr, l_ptr->first_out,
msg_seq_gap(msg)); msg_seq_gap(msg));
} }
break; break;
default: default:
...@@ -2198,20 +2196,20 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) ...@@ -2198,20 +2196,20 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
/* /*
* link_tunnel(): Send one message via a link belonging to * tipc_link_tunnel(): Send one message via a link belonging to
* another bearer. Owner node is locked. * another bearer. Owner node is locked.
*/ */
void link_tunnel(struct link *l_ptr, void tipc_link_tunnel(struct link *l_ptr,
struct tipc_msg *tunnel_hdr, struct tipc_msg *tunnel_hdr,
struct tipc_msg *msg, struct tipc_msg *msg,
u32 selector) u32 selector)
{ {
struct link *tunnel; struct link *tunnel;
struct sk_buff *buf; struct sk_buff *buf;
u32 length = msg_size(msg); u32 length = msg_size(msg);
tunnel = l_ptr->owner->active_links[selector & 1]; tunnel = l_ptr->owner->active_links[selector & 1];
if (!link_is_up(tunnel)) if (!tipc_link_is_up(tunnel))
return; return;
msg_set_size(tunnel_hdr, length + INT_H_SIZE); msg_set_size(tunnel_hdr, length + INT_H_SIZE);
buf = buf_acquire(length + INT_H_SIZE); buf = buf_acquire(length + INT_H_SIZE);
...@@ -2222,7 +2220,7 @@ void link_tunnel(struct link *l_ptr, ...@@ -2222,7 +2220,7 @@ void link_tunnel(struct link *l_ptr,
dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane); dbg("%c->%c:", l_ptr->b_ptr->net_plane, tunnel->b_ptr->net_plane);
msg_dbg(buf_msg(buf), ">SEND>"); msg_dbg(buf_msg(buf), ">SEND>");
assert(tunnel); assert(tunnel);
link_send_buf(tunnel, buf); tipc_link_send_buf(tunnel, buf);
} }
...@@ -2232,12 +2230,12 @@ void link_tunnel(struct link *l_ptr, ...@@ -2232,12 +2230,12 @@ void link_tunnel(struct link *l_ptr,
* Owner node is locked. * Owner node is locked.
*/ */
void link_changeover(struct link *l_ptr) void tipc_link_changeover(struct link *l_ptr)
{ {
u32 msgcount = l_ptr->out_queue_size; u32 msgcount = l_ptr->out_queue_size;
struct sk_buff *crs = l_ptr->first_out; struct sk_buff *crs = l_ptr->first_out;
struct link *tunnel = l_ptr->owner->active_links[0]; struct link *tunnel = l_ptr->owner->active_links[0];
int split_bundles = node_has_redundant_links(l_ptr->owner); int split_bundles = tipc_node_has_redundant_links(l_ptr->owner);
struct tipc_msg tunnel_hdr; struct tipc_msg tunnel_hdr;
if (!tunnel) if (!tunnel)
...@@ -2261,7 +2259,7 @@ void link_changeover(struct link *l_ptr) ...@@ -2261,7 +2259,7 @@ void link_changeover(struct link *l_ptr)
dbg("%c->%c:", l_ptr->b_ptr->net_plane, dbg("%c->%c:", l_ptr->b_ptr->net_plane,
tunnel->b_ptr->net_plane); tunnel->b_ptr->net_plane);
msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); msg_dbg(&tunnel_hdr, "EMPTY>SEND>");
link_send_buf(tunnel, buf); tipc_link_send_buf(tunnel, buf);
} else { } else {
warn("Memory squeeze; link changeover failed\n"); warn("Memory squeeze; link changeover failed\n");
} }
...@@ -2277,20 +2275,20 @@ void link_changeover(struct link *l_ptr) ...@@ -2277,20 +2275,20 @@ void link_changeover(struct link *l_ptr)
while (msgcount--) { while (msgcount--) {
msg_set_seqno(m,msg_seqno(msg)); msg_set_seqno(m,msg_seqno(msg));
link_tunnel(l_ptr, &tunnel_hdr, m, tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
msg_link_selector(m)); msg_link_selector(m));
pos += align(msg_size(m)); pos += align(msg_size(m));
m = (struct tipc_msg *)pos; m = (struct tipc_msg *)pos;
} }
} else { } else {
link_tunnel(l_ptr, &tunnel_hdr, msg, tipc_link_tunnel(l_ptr, &tunnel_hdr, msg,
msg_link_selector(msg)); msg_link_selector(msg));
} }
crs = crs->next; crs = crs->next;
} }
} }
void link_send_duplicate(struct link *l_ptr, struct link *tunnel) void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
{ {
struct sk_buff *iter; struct sk_buff *iter;
struct tipc_msg tunnel_hdr; struct tipc_msg tunnel_hdr;
...@@ -2320,8 +2318,8 @@ void link_send_duplicate(struct link *l_ptr, struct link *tunnel) ...@@ -2320,8 +2318,8 @@ void link_send_duplicate(struct link *l_ptr, struct link *tunnel)
dbg("%c->%c:", l_ptr->b_ptr->net_plane, dbg("%c->%c:", l_ptr->b_ptr->net_plane,
tunnel->b_ptr->net_plane); tunnel->b_ptr->net_plane);
msg_dbg(buf_msg(outbuf), ">SEND>"); msg_dbg(buf_msg(outbuf), ">SEND>");
link_send_buf(tunnel, outbuf); tipc_link_send_buf(tunnel, outbuf);
if (!link_is_up(l_ptr)) if (!tipc_link_is_up(l_ptr))
return; return;
iter = iter->next; iter = iter->next;
} }
...@@ -2393,9 +2391,9 @@ static int link_recv_changeover_msg(struct link **l_ptr, ...@@ -2393,9 +2391,9 @@ static int link_recv_changeover_msg(struct link **l_ptr,
/* First original message ?: */ /* First original message ?: */
if (link_is_up(dest_link)) { if (tipc_link_is_up(dest_link)) {
msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); msg_dbg(tunnel_msg, "UP/FIRST/<REC<");
link_reset(dest_link); tipc_link_reset(dest_link);
dest_link->exp_msg_count = msg_count; dest_link->exp_msg_count = msg_count;
if (!msg_count) if (!msg_count)
goto exit; goto exit;
...@@ -2436,7 +2434,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, ...@@ -2436,7 +2434,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
/* /*
* Bundler functionality: * Bundler functionality:
*/ */
void link_recv_bundle(struct sk_buff *buf) void tipc_link_recv_bundle(struct sk_buff *buf)
{ {
u32 msgcount = msg_msgcnt(buf_msg(buf)); u32 msgcount = msg_msgcnt(buf_msg(buf));
u32 pos = INT_H_SIZE; u32 pos = INT_H_SIZE;
...@@ -2456,7 +2454,7 @@ void link_recv_bundle(struct sk_buff *buf) ...@@ -2456,7 +2454,7 @@ void link_recv_bundle(struct sk_buff *buf)
}; };
pos += align(msg_size(buf_msg(obuf))); pos += align(msg_size(buf_msg(obuf)));
msg_dbg(buf_msg(obuf), " /"); msg_dbg(buf_msg(obuf), " /");
net_route_msg(obuf); tipc_net_route_msg(obuf);
} }
buf_discard(buf); buf_discard(buf);
} }
...@@ -2467,11 +2465,11 @@ void link_recv_bundle(struct sk_buff *buf) ...@@ -2467,11 +2465,11 @@ void link_recv_bundle(struct sk_buff *buf)
/* /*
* link_send_long_buf: Entry for buffers needing fragmentation. * tipc_link_send_long_buf: Entry for buffers needing fragmentation.
* The buffer is complete, inclusive total message length. * The buffer is complete, inclusive total message length.
* Returns user data length. * Returns user data length.
*/ */
int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
{ {
struct tipc_msg *inmsg = buf_msg(buf); struct tipc_msg *inmsg = buf_msg(buf);
struct tipc_msg fragm_hdr; struct tipc_msg fragm_hdr;
...@@ -2521,8 +2519,8 @@ int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -2521,8 +2519,8 @@ int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
/* Send queued messages first, if any: */ /* Send queued messages first, if any: */
l_ptr->stats.sent_fragments++; l_ptr->stats.sent_fragments++;
link_send_buf(l_ptr, fragm); tipc_link_send_buf(l_ptr, fragm);
if (!link_is_up(l_ptr)) if (!tipc_link_is_up(l_ptr))
return dsz; return dsz;
msg_set_fragm_no(&fragm_hdr, ++fragm_no); msg_set_fragm_no(&fragm_hdr, ++fragm_no);
rest -= fragm_sz; rest -= fragm_sz;
...@@ -2582,11 +2580,11 @@ static inline void incr_timer_cnt(struct sk_buff *buf) ...@@ -2582,11 +2580,11 @@ static inline void incr_timer_cnt(struct sk_buff *buf)
} }
/* /*
* link_recv_fragment(): Called with node lock on. Returns * tipc_link_recv_fragment(): Called with node lock on. Returns
* the reassembled buffer if message is complete. * the reassembled buffer if message is complete.
*/ */
int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
struct tipc_msg **m) struct tipc_msg **m)
{ {
struct sk_buff *prev = 0; struct sk_buff *prev = 0;
struct sk_buff *fbuf = *fb; struct sk_buff *fbuf = *fb;
...@@ -2714,7 +2712,7 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance) ...@@ -2714,7 +2712,7 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance)
} }
void link_set_queue_limits(struct link *l_ptr, u32 window) void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
{ {
/* Data messages from this node, inclusive FIRST_FRAGM */ /* Data messages from this node, inclusive FIRST_FRAGM */
l_ptr->queue_limit[DATA_LOW] = window; l_ptr->queue_limit[DATA_LOW] = window;
...@@ -2739,7 +2737,7 @@ void link_set_queue_limits(struct link *l_ptr, u32 window) ...@@ -2739,7 +2737,7 @@ void link_set_queue_limits(struct link *l_ptr, u32 window)
* @name - ptr to link name string * @name - ptr to link name string
* @node - ptr to area to be filled with ptr to associated node * @node - ptr to area to be filled with ptr to associated node
* *
* Caller must hold 'net_lock' to ensure node and bearer are not deleted; * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted;
* this also prevents link deletion. * this also prevents link deletion.
* *
* Returns pointer to link (or 0 if invalid link name). * Returns pointer to link (or 0 if invalid link name).
...@@ -2754,11 +2752,11 @@ static struct link *link_find_link(const char *name, struct node **node) ...@@ -2754,11 +2752,11 @@ static struct link *link_find_link(const char *name, struct node **node)
if (!link_name_validate(name, &link_name_parts)) if (!link_name_validate(name, &link_name_parts))
return 0; return 0;
b_ptr = bearer_find_interface(link_name_parts.if_local); b_ptr = tipc_bearer_find_interface(link_name_parts.if_local);
if (!b_ptr) if (!b_ptr)
return 0; return 0;
*node = node_find(link_name_parts.addr_peer); *node = tipc_node_find(link_name_parts.addr_peer);
if (!*node) if (!*node)
return 0; return 0;
...@@ -2769,8 +2767,8 @@ static struct link *link_find_link(const char *name, struct node **node) ...@@ -2769,8 +2767,8 @@ static struct link *link_find_link(const char *name, struct node **node)
return l_ptr; return l_ptr;
} }
struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space,
u16 cmd) u16 cmd)
{ {
struct tipc_link_config *args; struct tipc_link_config *args;
u32 new_value; u32 new_value;
...@@ -2779,35 +2777,35 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, ...@@ -2779,35 +2777,35 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space,
int res; int res;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
args = (struct tipc_link_config *)TLV_DATA(req_tlv_area); args = (struct tipc_link_config *)TLV_DATA(req_tlv_area);
new_value = ntohl(args->value); new_value = ntohl(args->value);
if (!strcmp(args->name, bc_link_name)) { if (!strcmp(args->name, tipc_bclink_name)) {
if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && if ((cmd == TIPC_CMD_SET_LINK_WINDOW) &&
(bclink_set_queue_limits(new_value) == 0)) (tipc_bclink_set_queue_limits(new_value) == 0))
return cfg_reply_none(); return tipc_cfg_reply_none();
return cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
" (cannot change setting on broadcast link)"); " (cannot change setting on broadcast link)");
} }
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
l_ptr = link_find_link(args->name, &node); l_ptr = link_find_link(args->name, &node);
if (!l_ptr) { if (!l_ptr) {
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return cfg_reply_error_string("link not found"); return tipc_cfg_reply_error_string("link not found");
} }
node_lock(node); tipc_node_lock(node);
res = -EINVAL; res = -EINVAL;
switch (cmd) { switch (cmd) {
case TIPC_CMD_SET_LINK_TOL: case TIPC_CMD_SET_LINK_TOL:
if ((new_value >= TIPC_MIN_LINK_TOL) && if ((new_value >= TIPC_MIN_LINK_TOL) &&
(new_value <= TIPC_MAX_LINK_TOL)) { (new_value <= TIPC_MAX_LINK_TOL)) {
link_set_supervision_props(l_ptr, new_value); link_set_supervision_props(l_ptr, new_value);
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
0, 0, new_value, 0, 0); 0, 0, new_value, 0, 0);
res = TIPC_OK; res = TIPC_OK;
} }
break; break;
...@@ -2815,26 +2813,26 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, ...@@ -2815,26 +2813,26 @@ struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space,
if ((new_value >= TIPC_MIN_LINK_PRI) && if ((new_value >= TIPC_MIN_LINK_PRI) &&
(new_value <= TIPC_MAX_LINK_PRI)) { (new_value <= TIPC_MAX_LINK_PRI)) {
l_ptr->priority = new_value; l_ptr->priority = new_value;
link_send_proto_msg(l_ptr, STATE_MSG, tipc_link_send_proto_msg(l_ptr, STATE_MSG,
0, 0, 0, new_value, 0); 0, 0, 0, new_value, 0);
res = TIPC_OK; res = TIPC_OK;
} }
break; break;
case TIPC_CMD_SET_LINK_WINDOW: case TIPC_CMD_SET_LINK_WINDOW:
if ((new_value >= TIPC_MIN_LINK_WIN) && if ((new_value >= TIPC_MIN_LINK_WIN) &&
(new_value <= TIPC_MAX_LINK_WIN)) { (new_value <= TIPC_MAX_LINK_WIN)) {
link_set_queue_limits(l_ptr, new_value); tipc_link_set_queue_limits(l_ptr, new_value);
res = TIPC_OK; res = TIPC_OK;
} }
break; break;
} }
node_unlock(node); tipc_node_unlock(node);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
if (res) if (res)
return cfg_reply_error_string("cannot change link setting"); return tipc_cfg_reply_error_string("cannot change link setting");
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
/** /**
...@@ -2849,34 +2847,34 @@ static void link_reset_statistics(struct link *l_ptr) ...@@ -2849,34 +2847,34 @@ static void link_reset_statistics(struct link *l_ptr)
l_ptr->stats.recv_info = l_ptr->next_in_no; l_ptr->stats.recv_info = l_ptr->next_in_no;
} }
struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space)
{ {
char *link_name; char *link_name;
struct link *l_ptr; struct link *l_ptr;
struct node *node; struct node *node;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
link_name = (char *)TLV_DATA(req_tlv_area); link_name = (char *)TLV_DATA(req_tlv_area);
if (!strcmp(link_name, bc_link_name)) { if (!strcmp(link_name, tipc_bclink_name)) {
if (bclink_reset_stats()) if (tipc_bclink_reset_stats())
return cfg_reply_error_string("link not found"); return tipc_cfg_reply_error_string("link not found");
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
l_ptr = link_find_link(link_name, &node); l_ptr = link_find_link(link_name, &node);
if (!l_ptr) { if (!l_ptr) {
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return cfg_reply_error_string("link not found"); return tipc_cfg_reply_error_string("link not found");
} }
node_lock(node); tipc_node_lock(node);
link_reset_statistics(l_ptr); link_reset_statistics(l_ptr);
node_unlock(node); tipc_node_unlock(node);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return cfg_reply_none(); return tipc_cfg_reply_none();
} }
/** /**
...@@ -2889,7 +2887,7 @@ static u32 percent(u32 count, u32 total) ...@@ -2889,7 +2887,7 @@ static u32 percent(u32 count, u32 total)
} }
/** /**
* link_stats - print link statistics * tipc_link_stats - print link statistics
* @name: link name * @name: link name
* @buf: print buffer area * @buf: print buffer area
* @buf_size: size of print buffer area * @buf_size: size of print buffer area
...@@ -2897,7 +2895,7 @@ static u32 percent(u32 count, u32 total) ...@@ -2897,7 +2895,7 @@ static u32 percent(u32 count, u32 total)
* Returns length of print buffer data string (or 0 if error) * Returns length of print buffer data string (or 0 if error)
*/ */
static int link_stats(const char *name, char *buf, const u32 buf_size) static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
{ {
struct print_buf pb; struct print_buf pb;
struct link *l_ptr; struct link *l_ptr;
...@@ -2905,22 +2903,22 @@ static int link_stats(const char *name, char *buf, const u32 buf_size) ...@@ -2905,22 +2903,22 @@ static int link_stats(const char *name, char *buf, const u32 buf_size)
char *status; char *status;
u32 profile_total = 0; u32 profile_total = 0;
if (!strcmp(name, bc_link_name)) if (!strcmp(name, tipc_bclink_name))
return bclink_stats(buf, buf_size); return tipc_bclink_stats(buf, buf_size);
printbuf_init(&pb, buf, buf_size); tipc_printbuf_init(&pb, buf, buf_size);
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
l_ptr = link_find_link(name, &node); l_ptr = link_find_link(name, &node);
if (!l_ptr) { if (!l_ptr) {
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return 0; return 0;
} }
node_lock(node); tipc_node_lock(node);
if (link_is_active(l_ptr)) if (tipc_link_is_active(l_ptr))
status = "ACTIVE"; status = "ACTIVE";
else if (link_is_up(l_ptr)) else if (tipc_link_is_up(l_ptr))
status = "STANDBY"; status = "STANDBY";
else else
status = "DEFUNCT"; status = "DEFUNCT";
...@@ -2976,33 +2974,33 @@ static int link_stats(const char *name, char *buf, const u32 buf_size) ...@@ -2976,33 +2974,33 @@ static int link_stats(const char *name, char *buf, const u32 buf_size)
? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts)
: 0); : 0);
node_unlock(node); tipc_node_unlock(node);
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return printbuf_validate(&pb); return tipc_printbuf_validate(&pb);
} }
#define MAX_LINK_STATS_INFO 2000 #define MAX_LINK_STATS_INFO 2000
struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct tlv_desc *rep_tlv; struct tlv_desc *rep_tlv;
int str_len; int str_len;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
buf = cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO)); buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_LINK_STATS_INFO));
if (!buf) if (!buf)
return NULL; return NULL;
rep_tlv = (struct tlv_desc *)buf->data; rep_tlv = (struct tlv_desc *)buf->data;
str_len = link_stats((char *)TLV_DATA(req_tlv_area), str_len = tipc_link_stats((char *)TLV_DATA(req_tlv_area),
(char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
if (!str_len) { if (!str_len) {
buf_discard(buf); buf_discard(buf);
return cfg_reply_error_string("link not found"); return tipc_cfg_reply_error_string("link not found");
} }
skb_put(buf, TLV_SPACE(str_len)); skb_put(buf, TLV_SPACE(str_len));
...@@ -3021,20 +3019,20 @@ int link_control(const char *name, u32 op, u32 val) ...@@ -3021,20 +3019,20 @@ int link_control(const char *name, u32 op, u32 val)
u32 a; u32 a;
a = link_name2addr(name, &bearer_id); a = link_name2addr(name, &bearer_id);
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
node = node_find(a); node = tipc_node_find(a);
if (node) { if (node) {
node_lock(node); tipc_node_lock(node);
l_ptr = node->links[bearer_id]; l_ptr = node->links[bearer_id];
if (l_ptr) { if (l_ptr) {
if (op == TIPC_REMOVE_LINK) { if (op == TIPC_REMOVE_LINK) {
struct bearer *b_ptr = l_ptr->b_ptr; struct bearer *b_ptr = l_ptr->b_ptr;
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
link_delete(l_ptr); tipc_link_delete(l_ptr);
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
} }
if (op == TIPC_CMD_BLOCK_LINK) { if (op == TIPC_CMD_BLOCK_LINK) {
link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->blocked = 1; l_ptr->blocked = 1;
} }
if (op == TIPC_CMD_UNBLOCK_LINK) { if (op == TIPC_CMD_UNBLOCK_LINK) {
...@@ -3042,22 +3040,22 @@ int link_control(const char *name, u32 op, u32 val) ...@@ -3042,22 +3040,22 @@ int link_control(const char *name, u32 op, u32 val)
} }
res = TIPC_OK; res = TIPC_OK;
} }
node_unlock(node); tipc_node_unlock(node);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return res; return res;
} }
#endif #endif
/** /**
* link_get_max_pkt - get maximum packet size to use when sending to destination * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination
* @dest: network address of destination node * @dest: network address of destination node
* @selector: used to select from set of active links * @selector: used to select from set of active links
* *
* If no active link can be found, uses default maximum packet size. * If no active link can be found, uses default maximum packet size.
*/ */
u32 link_get_max_pkt(u32 dest, u32 selector) u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
{ {
struct node *n_ptr; struct node *n_ptr;
struct link *l_ptr; struct link *l_ptr;
...@@ -3066,16 +3064,16 @@ u32 link_get_max_pkt(u32 dest, u32 selector) ...@@ -3066,16 +3064,16 @@ u32 link_get_max_pkt(u32 dest, u32 selector)
if (dest == tipc_own_addr) if (dest == tipc_own_addr)
return MAX_MSG_SIZE; return MAX_MSG_SIZE;
read_lock_bh(&net_lock); read_lock_bh(&tipc_net_lock);
n_ptr = node_select(dest, selector); n_ptr = tipc_node_select(dest, selector);
if (n_ptr) { if (n_ptr) {
node_lock(n_ptr); tipc_node_lock(n_ptr);
l_ptr = n_ptr->active_links[selector & 1]; l_ptr = n_ptr->active_links[selector & 1];
if (l_ptr) if (l_ptr)
res = link_max_pkt(l_ptr); res = link_max_pkt(l_ptr);
node_unlock(n_ptr); tipc_node_unlock(n_ptr);
} }
read_unlock_bh(&net_lock); read_unlock_bh(&tipc_net_lock);
return res; return res;
} }
......
...@@ -221,44 +221,43 @@ struct link { ...@@ -221,44 +221,43 @@ struct link {
struct port; struct port;
struct link *link_create(struct bearer *b_ptr, const u32 peer, struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
const struct tipc_media_addr *media_addr); const struct tipc_media_addr *media_addr);
void link_delete(struct link *l_ptr); void tipc_link_delete(struct link *l_ptr);
void link_changeover(struct link *l_ptr); void tipc_link_changeover(struct link *l_ptr);
void link_send_duplicate(struct link *l_ptr, struct link *dest); void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest);
void link_reset_fragments(struct link *l_ptr); void tipc_link_reset_fragments(struct link *l_ptr);
int link_is_up(struct link *l_ptr); int tipc_link_is_up(struct link *l_ptr);
int link_is_active(struct link *l_ptr); int tipc_link_is_active(struct link *l_ptr);
void link_start(struct link *l_ptr); void tipc_link_start(struct link *l_ptr);
u32 link_push_packet(struct link *l_ptr); u32 tipc_link_push_packet(struct link *l_ptr);
void link_stop(struct link *l_ptr); void tipc_link_stop(struct link *l_ptr);
struct sk_buff *link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd); struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
struct sk_buff *link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_space);
struct sk_buff *link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space);
void link_reset(struct link *l_ptr); void tipc_link_reset(struct link *l_ptr);
int link_send(struct sk_buff *buf, u32 dest, u32 selector); int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector);
int link_send_buf(struct link *l_ptr, struct sk_buff *buf); int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf);
u32 link_get_max_pkt(u32 dest,u32 selector); u32 tipc_link_get_max_pkt(u32 dest,u32 selector);
int link_send_sections_fast(struct port* sender, int tipc_link_send_sections_fast(struct port* sender,
struct iovec const *msg_sect, struct iovec const *msg_sect,
const u32 num_sect, const u32 num_sect,
u32 destnode); u32 destnode);
int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
void link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr, struct tipc_msg *msg, u32 selector);
struct tipc_msg *msg, u32 selector); void tipc_link_recv_bundle(struct sk_buff *buf);
void link_recv_bundle(struct sk_buff *buf); int tipc_link_recv_fragment(struct sk_buff **pending,
int link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
struct sk_buff **fb, struct tipc_msg **msg);
struct tipc_msg **msg); void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap,
void link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, u32 tolerance, u32 priority, u32 acked_mtu);
u32 tolerance, u32 priority, u32 acked_mtu); void tipc_link_push_queue(struct link *l_ptr);
void link_push_queue(struct link *l_ptr); u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
u32 link_defer_pkt(struct sk_buff **head, struct sk_buff **tail,
struct sk_buff *buf); struct sk_buff *buf);
void link_wakeup_ports(struct link *l_ptr, int all); void tipc_link_wakeup_ports(struct link *l_ptr, int all);
void link_set_queue_limits(struct link *l_ptr, u32 window); void tipc_link_set_queue_limits(struct link *l_ptr, u32 window);
void link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits); void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retransmits);
/* /*
* Link sequence number manipulation routines (uses modulo 2**16 arithmetic) * Link sequence number manipulation routines (uses modulo 2**16 arithmetic)
......
...@@ -41,18 +41,7 @@ ...@@ -41,18 +41,7 @@
#include "bearer.h" #include "bearer.h"
void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
{
memcpy(&((int *)m)[5], a, sizeof(*a));
}
void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
memcpy(a, &((int*)m)[5], sizeof(*a));
}
void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
{ {
u32 usr = msg_user(msg); u32 usr = msg_user(msg);
tipc_printf(buf, str); tipc_printf(buf, str);
...@@ -318,7 +307,7 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) ...@@ -318,7 +307,7 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
tipc_printf(buf, ":REQL(%u):", msg_req_links(msg)); tipc_printf(buf, ":REQL(%u):", msg_req_links(msg));
tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg)); tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg));
tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg)); tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg));
media_addr_printf(buf, orig); tipc_media_addr_printf(buf, orig);
} }
if (msg_user(msg) == BCAST_PROTOCOL) { if (msg_user(msg) == BCAST_PROTOCOL) {
tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg)); tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg));
...@@ -326,9 +315,9 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str) ...@@ -326,9 +315,9 @@ void msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str)
} }
tipc_printf(buf, "\n"); tipc_printf(buf, "\n");
if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) { if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg))) {
msg_print(buf,msg_get_wrapped(msg)," /"); tipc_msg_print(buf,msg_get_wrapped(msg)," /");
} }
if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) { if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT)) {
msg_print(buf,msg_get_wrapped(msg)," /"); tipc_msg_print(buf,msg_get_wrapped(msg)," /");
} }
} }
...@@ -805,14 +805,14 @@ static inline int msg_build(struct tipc_msg *hdr, ...@@ -805,14 +805,14 @@ static inline int msg_build(struct tipc_msg *hdr,
return -EFAULT; return -EFAULT;
} }
static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
memcpy(&((int *)m)[5], a, sizeof(*a));
}
struct tipc_media_addr; static inline void msg_get_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
{
extern void msg_set_media_addr(struct tipc_msg *m, memcpy(a, &((int*)m)[5], sizeof(*a));
struct tipc_media_addr *a); }
extern void msg_get_media_addr(struct tipc_msg *m,
struct tipc_media_addr *a);
#endif #endif
...@@ -114,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) ...@@ -114,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
} }
/** /**
* named_publish - tell other nodes about a new publication by this node * tipc_named_publish - tell other nodes about a new publication by this node
*/ */
void named_publish(struct publication *publ) void tipc_named_publish(struct publication *publ)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct distr_item *item; struct distr_item *item;
...@@ -133,15 +133,15 @@ void named_publish(struct publication *publ) ...@@ -133,15 +133,15 @@ void named_publish(struct publication *publ)
item = (struct distr_item *)msg_data(buf_msg(buf)); item = (struct distr_item *)msg_data(buf_msg(buf));
publ_to_item(item, publ); publ_to_item(item, publ);
dbg("named_withdraw: broadcasting publish msg\n"); dbg("tipc_named_withdraw: broadcasting publish msg\n");
cluster_broadcast(buf); tipc_cltr_broadcast(buf);
} }
/** /**
* named_withdraw - tell other nodes about a withdrawn publication by this node * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
*/ */
void named_withdraw(struct publication *publ) void tipc_named_withdraw(struct publication *publ)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct distr_item *item; struct distr_item *item;
...@@ -157,15 +157,15 @@ void named_withdraw(struct publication *publ) ...@@ -157,15 +157,15 @@ void named_withdraw(struct publication *publ)
item = (struct distr_item *)msg_data(buf_msg(buf)); item = (struct distr_item *)msg_data(buf_msg(buf));
publ_to_item(item, publ); publ_to_item(item, publ);
dbg("named_withdraw: broadcasting withdraw msg\n"); dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
cluster_broadcast(buf); tipc_cltr_broadcast(buf);
} }
/** /**
* named_node_up - tell specified node about all publications by this node * tipc_named_node_up - tell specified node about all publications by this node
*/ */
void named_node_up(unsigned long node) void tipc_named_node_up(unsigned long node)
{ {
struct publication *publ; struct publication *publ;
struct distr_item *item = 0; struct distr_item *item = 0;
...@@ -175,7 +175,7 @@ void named_node_up(unsigned long node) ...@@ -175,7 +175,7 @@ void named_node_up(unsigned long node)
u32 max_item_buf; u32 max_item_buf;
assert(in_own_cluster(node)); assert(in_own_cluster(node));
read_lock_bh(&nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
max_item_buf *= ITEM_SIZE; max_item_buf *= ITEM_SIZE;
rest = publ_cnt * ITEM_SIZE; rest = publ_cnt * ITEM_SIZE;
...@@ -196,15 +196,15 @@ void named_node_up(unsigned long node) ...@@ -196,15 +196,15 @@ void named_node_up(unsigned long node)
left -= ITEM_SIZE; left -= ITEM_SIZE;
if (!left) { if (!left) {
msg_set_link_selector(buf_msg(buf), node); msg_set_link_selector(buf_msg(buf), node);
dbg("named_node_up: sending publish msg to " dbg("tipc_named_node_up: sending publish msg to "
"<%u.%u.%u>\n", tipc_zone(node), "<%u.%u.%u>\n", tipc_zone(node),
tipc_cluster(node), tipc_node(node)); tipc_cluster(node), tipc_node(node));
link_send(buf, node, node); tipc_link_send(buf, node, node);
buf = 0; buf = 0;
} }
} }
exit: exit:
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
} }
/** /**
...@@ -221,73 +221,73 @@ void named_node_up(unsigned long node) ...@@ -221,73 +221,73 @@ void named_node_up(unsigned long node)
static void node_is_down(struct publication *publ) static void node_is_down(struct publication *publ)
{ {
struct publication *p; struct publication *p;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
dbg("node_is_down: withdrawing %u, %u, %u\n", dbg("node_is_down: withdrawing %u, %u, %u\n",
publ->type, publ->lower, publ->upper); publ->type, publ->lower, publ->upper);
publ->key += 1222345; publ->key += 1222345;
p = nametbl_remove_publ(publ->type, publ->lower, p = tipc_nametbl_remove_publ(publ->type, publ->lower,
publ->node, publ->ref, publ->key); publ->node, publ->ref, publ->key);
assert(p == publ); assert(p == publ);
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
if (publ) if (publ)
kfree(publ); kfree(publ);
} }
/** /**
* named_recv - process name table update message sent by another node * tipc_named_recv - process name table update message sent by another node
*/ */
void named_recv(struct sk_buff *buf) void tipc_named_recv(struct sk_buff *buf)
{ {
struct publication *publ; struct publication *publ;
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
struct distr_item *item = (struct distr_item *)msg_data(msg); struct distr_item *item = (struct distr_item *)msg_data(msg);
u32 count = msg_data_sz(msg) / ITEM_SIZE; u32 count = msg_data_sz(msg) / ITEM_SIZE;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
while (count--) { while (count--) {
if (msg_type(msg) == PUBLICATION) { if (msg_type(msg) == PUBLICATION) {
dbg("named_recv: got publication for %u, %u, %u\n", dbg("tipc_named_recv: got publication for %u, %u, %u\n",
ntohl(item->type), ntohl(item->lower), ntohl(item->type), ntohl(item->lower),
ntohl(item->upper)); ntohl(item->upper));
publ = nametbl_insert_publ(ntohl(item->type), publ = tipc_nametbl_insert_publ(ntohl(item->type),
ntohl(item->lower), ntohl(item->lower),
ntohl(item->upper), ntohl(item->upper),
TIPC_CLUSTER_SCOPE, TIPC_CLUSTER_SCOPE,
msg_orignode(msg), msg_orignode(msg),
ntohl(item->ref), ntohl(item->ref),
ntohl(item->key)); ntohl(item->key));
if (publ) { if (publ) {
nodesub_subscribe(&publ->subscr, tipc_nodesub_subscribe(&publ->subscr,
msg_orignode(msg), msg_orignode(msg),
publ, publ,
(net_ev_handler)node_is_down); (net_ev_handler)node_is_down);
} }
} else if (msg_type(msg) == WITHDRAWAL) { } else if (msg_type(msg) == WITHDRAWAL) {
dbg("named_recv: got withdrawl for %u, %u, %u\n", dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n",
ntohl(item->type), ntohl(item->lower), ntohl(item->type), ntohl(item->lower),
ntohl(item->upper)); ntohl(item->upper));
publ = nametbl_remove_publ(ntohl(item->type), publ = tipc_nametbl_remove_publ(ntohl(item->type),
ntohl(item->lower), ntohl(item->lower),
msg_orignode(msg), msg_orignode(msg),
ntohl(item->ref), ntohl(item->ref),
ntohl(item->key)); ntohl(item->key));
if (publ) { if (publ) {
nodesub_unsubscribe(&publ->subscr); tipc_nodesub_unsubscribe(&publ->subscr);
kfree(publ); kfree(publ);
} }
} else { } else {
warn("named_recv: unknown msg\n"); warn("tipc_named_recv: unknown msg\n");
} }
item++; item++;
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
buf_discard(buf); buf_discard(buf);
} }
/** /**
* named_reinit - re-initialize local publication list * tipc_named_reinit - re-initialize local publication list
* *
* This routine is called whenever TIPC networking is (re)enabled. * This routine is called whenever TIPC networking is (re)enabled.
* All existing publications by this node that have "cluster" or "zone" scope * All existing publications by this node that have "cluster" or "zone" scope
...@@ -295,15 +295,15 @@ void named_recv(struct sk_buff *buf) ...@@ -295,15 +295,15 @@ void named_recv(struct sk_buff *buf)
* (If the node's address is unchanged, the update loop terminates immediately.) * (If the node's address is unchanged, the update loop terminates immediately.)
*/ */
void named_reinit(void) void tipc_named_reinit(void)
{ {
struct publication *publ; struct publication *publ;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
list_for_each_entry(publ, &publ_root, local_list) { list_for_each_entry(publ, &publ_root, local_list) {
if (publ->node == tipc_own_addr) if (publ->node == tipc_own_addr)
break; break;
publ->node = tipc_own_addr; publ->node = tipc_own_addr;
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
} }
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
#include "name_table.h" #include "name_table.h"
void named_publish(struct publication *publ); void tipc_named_publish(struct publication *publ);
void named_withdraw(struct publication *publ); void tipc_named_withdraw(struct publication *publ);
void named_node_up(unsigned long node); void tipc_named_node_up(unsigned long node);
void named_recv(struct sk_buff *buf); void tipc_named_recv(struct sk_buff *buf);
void named_reinit(void); void tipc_named_reinit(void);
#endif #endif
...@@ -99,9 +99,9 @@ struct name_table { ...@@ -99,9 +99,9 @@ struct name_table {
u32 local_publ_count; u32 local_publ_count;
}; };
struct name_table table = { NULL } ; static struct name_table table = { NULL } ;
static atomic_t rsv_publ_ok = ATOMIC_INIT(0); static atomic_t rsv_publ_ok = ATOMIC_INIT(0);
rwlock_t nametbl_lock = RW_LOCK_UNLOCKED; rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED;
static inline int hash(int x) static inline int hash(int x)
...@@ -139,10 +139,10 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, ...@@ -139,10 +139,10 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
} }
/** /**
* subseq_alloc - allocate a specified number of sub-sequence structures * tipc_subseq_alloc - allocate a specified number of sub-sequence structures
*/ */
struct sub_seq *subseq_alloc(u32 cnt) struct sub_seq *tipc_subseq_alloc(u32 cnt)
{ {
u32 sz = cnt * sizeof(struct sub_seq); u32 sz = cnt * sizeof(struct sub_seq);
struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC); struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC);
...@@ -153,16 +153,16 @@ struct sub_seq *subseq_alloc(u32 cnt) ...@@ -153,16 +153,16 @@ struct sub_seq *subseq_alloc(u32 cnt)
} }
/** /**
* nameseq_create - create a name sequence structure for the specified 'type' * tipc_nameseq_create - create a name sequence structure for the specified 'type'
* *
* Allocates a single sub-sequence structure and sets it to all 0's. * Allocates a single sub-sequence structure and sets it to all 0's.
*/ */
struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head) struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
{ {
struct name_seq *nseq = struct name_seq *nseq =
(struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC); (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC);
struct sub_seq *sseq = subseq_alloc(1); struct sub_seq *sseq = tipc_subseq_alloc(1);
if (!nseq || !sseq) { if (!nseq || !sseq) {
warn("Memory squeeze; failed to create name sequence\n"); warn("Memory squeeze; failed to create name sequence\n");
...@@ -175,7 +175,7 @@ struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head) ...@@ -175,7 +175,7 @@ struct name_seq *nameseq_create(u32 type, struct hlist_head *seq_head)
nseq->lock = SPIN_LOCK_UNLOCKED; nseq->lock = SPIN_LOCK_UNLOCKED;
nseq->type = type; nseq->type = type;
nseq->sseqs = sseq; nseq->sseqs = sseq;
dbg("nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n", dbg("tipc_nameseq_create() nseq = %x type %u, ssseqs %x, ff: %u\n",
nseq, type, nseq->sseqs, nseq->first_free); nseq, type, nseq->sseqs, nseq->first_free);
nseq->alloc = 1; nseq->alloc = 1;
INIT_HLIST_NODE(&nseq->ns_list); INIT_HLIST_NODE(&nseq->ns_list);
...@@ -240,10 +240,10 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) ...@@ -240,10 +240,10 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
} }
/** /**
* nameseq_insert_publ - * tipc_nameseq_insert_publ -
*/ */
struct publication *nameseq_insert_publ(struct name_seq *nseq, struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
u32 type, u32 lower, u32 upper, u32 type, u32 lower, u32 upper,
u32 scope, u32 node, u32 port, u32 key) u32 scope, u32 node, u32 port, u32 key)
{ {
...@@ -285,7 +285,7 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq, ...@@ -285,7 +285,7 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq,
if (nseq->first_free == nseq->alloc) { if (nseq->first_free == nseq->alloc) {
struct sub_seq *sseqs = nseq->sseqs; struct sub_seq *sseqs = nseq->sseqs;
nseq->sseqs = subseq_alloc(nseq->alloc * 2); nseq->sseqs = tipc_subseq_alloc(nseq->alloc * 2);
if (nseq->sseqs != NULL) { if (nseq->sseqs != NULL) {
memcpy(nseq->sseqs, sseqs, memcpy(nseq->sseqs, sseqs,
nseq->alloc * sizeof (struct sub_seq)); nseq->alloc * sizeof (struct sub_seq));
...@@ -354,23 +354,23 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq, ...@@ -354,23 +354,23 @@ struct publication *nameseq_insert_publ(struct name_seq *nseq,
*/ */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
dbg("calling report_overlap()\n"); dbg("calling report_overlap()\n");
subscr_report_overlap(s, tipc_subscr_report_overlap(s,
publ->lower, publ->lower,
publ->upper, publ->upper,
TIPC_PUBLISHED, TIPC_PUBLISHED,
publ->ref, publ->ref,
publ->node, publ->node,
created_subseq); created_subseq);
} }
return publ; return publ;
} }
/** /**
* nameseq_remove_publ - * tipc_nameseq_remove_publ -
*/ */
struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
u32 node, u32 ref, u32 key) u32 node, u32 ref, u32 key)
{ {
struct publication *publ; struct publication *publ;
struct publication *prev; struct publication *prev;
...@@ -470,24 +470,24 @@ struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst, ...@@ -470,24 +470,24 @@ struct publication *nameseq_remove_publ(struct name_seq *nseq, u32 inst,
* Any subscriptions waiting ? * Any subscriptions waiting ?
*/ */
list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) {
subscr_report_overlap(s, tipc_subscr_report_overlap(s,
publ->lower, publ->lower,
publ->upper, publ->upper,
TIPC_WITHDRAWN, TIPC_WITHDRAWN,
publ->ref, publ->ref,
publ->node, publ->node,
removed_subseq); removed_subseq);
} }
return publ; return publ;
} }
/** /**
* nameseq_subscribe: attach a subscription, and issue * tipc_nameseq_subscribe: attach a subscription, and issue
* the prescribed number of events if there is any sub- * the prescribed number of events if there is any sub-
* sequence overlapping with the requested sequence * sequence overlapping with the requested sequence
*/ */
void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
{ {
struct sub_seq *sseq = nseq->sseqs; struct sub_seq *sseq = nseq->sseqs;
...@@ -498,18 +498,18 @@ void nameseq_subscribe(struct name_seq *nseq, struct subscription *s) ...@@ -498,18 +498,18 @@ void nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
while (sseq != &nseq->sseqs[nseq->first_free]) { while (sseq != &nseq->sseqs[nseq->first_free]) {
struct publication *zl = sseq->zone_list; struct publication *zl = sseq->zone_list;
if (zl && subscr_overlap(s,sseq->lower,sseq->upper)) { if (zl && tipc_subscr_overlap(s,sseq->lower,sseq->upper)) {
struct publication *crs = zl; struct publication *crs = zl;
int must_report = 1; int must_report = 1;
do { do {
subscr_report_overlap(s, tipc_subscr_report_overlap(s,
sseq->lower, sseq->lower,
sseq->upper, sseq->upper,
TIPC_PUBLISHED, TIPC_PUBLISHED,
crs->ref, crs->ref,
crs->node, crs->node,
must_report); must_report);
must_report = 0; must_report = 0;
crs = crs->zone_list_next; crs = crs->zone_list_next;
} while (crs != zl); } while (crs != zl);
...@@ -538,8 +538,8 @@ static struct name_seq *nametbl_find_seq(u32 type) ...@@ -538,8 +538,8 @@ static struct name_seq *nametbl_find_seq(u32 type)
return 0; return 0;
}; };
struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
u32 scope, u32 node, u32 port, u32 key) u32 scope, u32 node, u32 port, u32 key)
{ {
struct name_seq *seq = nametbl_find_seq(type); struct name_seq *seq = nametbl_find_seq(type);
...@@ -552,19 +552,19 @@ struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, ...@@ -552,19 +552,19 @@ struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper,
dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node);
if (!seq) { if (!seq) {
seq = nameseq_create(type, &table.types[hash(type)]); seq = tipc_nameseq_create(type, &table.types[hash(type)]);
dbg("nametbl_insert_publ: created %x\n", seq); dbg("tipc_nametbl_insert_publ: created %x\n", seq);
} }
if (!seq) if (!seq)
return 0; return 0;
assert(seq->type == type); assert(seq->type == type);
return nameseq_insert_publ(seq, type, lower, upper, return tipc_nameseq_insert_publ(seq, type, lower, upper,
scope, node, port, key); scope, node, port, key);
} }
struct publication *nametbl_remove_publ(u32 type, u32 lower, struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
u32 node, u32 ref, u32 key) u32 node, u32 ref, u32 key)
{ {
struct publication *publ; struct publication *publ;
struct name_seq *seq = nametbl_find_seq(type); struct name_seq *seq = nametbl_find_seq(type);
...@@ -573,7 +573,7 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower, ...@@ -573,7 +573,7 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower,
return 0; return 0;
dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); dbg("Withdrawing <%u,%u> from %x\n", type, lower, node);
publ = nameseq_remove_publ(seq, lower, node, ref, key); publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key);
if (!seq->first_free && list_empty(&seq->subscriptions)) { if (!seq->first_free && list_empty(&seq->subscriptions)) {
hlist_del_init(&seq->ns_list); hlist_del_init(&seq->ns_list);
...@@ -584,14 +584,14 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower, ...@@ -584,14 +584,14 @@ struct publication *nametbl_remove_publ(u32 type, u32 lower,
} }
/* /*
* nametbl_translate(): Translate tipc_name -> tipc_portid. * tipc_nametbl_translate(): Translate tipc_name -> tipc_portid.
* Very time-critical. * Very time-critical.
* *
* Note: on entry 'destnode' is the search domain used during translation; * Note: on entry 'destnode' is the search domain used during translation;
* on exit it passes back the node address of the matching port (if any) * on exit it passes back the node address of the matching port (if any)
*/ */
u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
{ {
struct sub_seq *sseq; struct sub_seq *sseq;
struct publication *publ = 0; struct publication *publ = 0;
...@@ -601,7 +601,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) ...@@ -601,7 +601,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode)
if (!in_scope(*destnode, tipc_own_addr)) if (!in_scope(*destnode, tipc_own_addr))
return 0; return 0;
read_lock_bh(&nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
seq = nametbl_find_seq(type); seq = nametbl_find_seq(type);
if (unlikely(!seq)) if (unlikely(!seq))
goto not_found; goto not_found;
...@@ -619,7 +619,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) ...@@ -619,7 +619,7 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode)
ref = publ->ref; ref = publ->ref;
*destnode = publ->node; *destnode = publ->node;
spin_unlock_bh(&seq->lock); spin_unlock_bh(&seq->lock);
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
return ref; return ref;
} }
publ = sseq->cluster_list; publ = sseq->cluster_list;
...@@ -657,12 +657,12 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) ...@@ -657,12 +657,12 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode)
spin_unlock_bh(&seq->lock); spin_unlock_bh(&seq->lock);
not_found: not_found:
*destnode = 0; *destnode = 0;
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
return 0; return 0;
} }
/** /**
* nametbl_mc_translate - find multicast destinations * tipc_nametbl_mc_translate - find multicast destinations
* *
* Creates list of all local ports that overlap the given multicast address; * Creates list of all local ports that overlap the given multicast address;
* also determines if any off-node ports overlap. * also determines if any off-node ports overlap.
...@@ -674,15 +674,15 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode) ...@@ -674,15 +674,15 @@ u32 nametbl_translate(u32 type, u32 instance, u32 *destnode)
* Returns non-zero if any off-node ports overlap * Returns non-zero if any off-node ports overlap
*/ */
int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
struct port_list *dports) struct port_list *dports)
{ {
struct name_seq *seq; struct name_seq *seq;
struct sub_seq *sseq; struct sub_seq *sseq;
struct sub_seq *sseq_stop; struct sub_seq *sseq_stop;
int res = 0; int res = 0;
read_lock_bh(&nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
seq = nametbl_find_seq(type); seq = nametbl_find_seq(type);
if (!seq) if (!seq)
goto exit; goto exit;
...@@ -700,7 +700,7 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, ...@@ -700,7 +700,7 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
if (publ && (publ->scope <= limit)) if (publ && (publ->scope <= limit))
do { do {
if (publ->node == tipc_own_addr) if (publ->node == tipc_own_addr)
port_list_add(dports, publ->ref); tipc_port_list_add(dports, publ->ref);
else else
res = 1; res = 1;
publ = publ->cluster_list_next; publ = publ->cluster_list_next;
...@@ -709,15 +709,15 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, ...@@ -709,15 +709,15 @@ int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
spin_unlock_bh(&seq->lock); spin_unlock_bh(&seq->lock);
exit: exit:
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
return res; return res;
} }
/** /**
* nametbl_publish_rsv - publish port name using a reserved name type * tipc_nametbl_publish_rsv - publish port name using a reserved name type
*/ */
int nametbl_publish_rsv(u32 ref, unsigned int scope, int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
struct tipc_name_seq const *seq) struct tipc_name_seq const *seq)
{ {
int res; int res;
...@@ -729,10 +729,10 @@ int nametbl_publish_rsv(u32 ref, unsigned int scope, ...@@ -729,10 +729,10 @@ int nametbl_publish_rsv(u32 ref, unsigned int scope,
} }
/** /**
* nametbl_publish - add name publication to network name tables * tipc_nametbl_publish - add name publication to network name tables
*/ */
struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
u32 scope, u32 port_ref, u32 key) u32 scope, u32 port_ref, u32 key)
{ {
struct publication *publ; struct publication *publ;
...@@ -748,77 +748,77 @@ struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, ...@@ -748,77 +748,77 @@ struct publication *nametbl_publish(u32 type, u32 lower, u32 upper,
return 0; return 0;
} }
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
table.local_publ_count++; table.local_publ_count++;
publ = nametbl_insert_publ(type, lower, upper, scope, publ = tipc_nametbl_insert_publ(type, lower, upper, scope,
tipc_own_addr, port_ref, key); tipc_own_addr, port_ref, key);
if (publ && (scope != TIPC_NODE_SCOPE)) { if (publ && (scope != TIPC_NODE_SCOPE)) {
named_publish(publ); tipc_named_publish(publ);
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
return publ; return publ;
} }
/** /**
* nametbl_withdraw - withdraw name publication from network name tables * tipc_nametbl_withdraw - withdraw name publication from network name tables
*/ */
int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key) int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
{ {
struct publication *publ; struct publication *publ;
dbg("nametbl_withdraw:<%d,%d,%d>\n", type, lower, key); dbg("tipc_nametbl_withdraw:<%d,%d,%d>\n", type, lower, key);
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
publ = nametbl_remove_publ(type, lower, tipc_own_addr, ref, key); publ = tipc_nametbl_remove_publ(type, lower, tipc_own_addr, ref, key);
if (publ) { if (publ) {
table.local_publ_count--; table.local_publ_count--;
if (publ->scope != TIPC_NODE_SCOPE) if (publ->scope != TIPC_NODE_SCOPE)
named_withdraw(publ); tipc_named_withdraw(publ);
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
list_del_init(&publ->pport_list); list_del_init(&publ->pport_list);
kfree(publ); kfree(publ);
return 1; return 1;
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
return 0; return 0;
} }
/** /**
* nametbl_subscribe - add a subscription object to the name table * tipc_nametbl_subscribe - add a subscription object to the name table
*/ */
void void
nametbl_subscribe(struct subscription *s) tipc_nametbl_subscribe(struct subscription *s)
{ {
u32 type = s->seq.type; u32 type = s->seq.type;
struct name_seq *seq; struct name_seq *seq;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
seq = nametbl_find_seq(type); seq = nametbl_find_seq(type);
if (!seq) { if (!seq) {
seq = nameseq_create(type, &table.types[hash(type)]); seq = tipc_nameseq_create(type, &table.types[hash(type)]);
} }
if (seq){ if (seq){
spin_lock_bh(&seq->lock); spin_lock_bh(&seq->lock);
dbg("nametbl_subscribe:found %x for <%u,%u,%u>\n", dbg("tipc_nametbl_subscribe:found %x for <%u,%u,%u>\n",
seq, type, s->seq.lower, s->seq.upper); seq, type, s->seq.lower, s->seq.upper);
assert(seq->type == type); assert(seq->type == type);
nameseq_subscribe(seq, s); tipc_nameseq_subscribe(seq, s);
spin_unlock_bh(&seq->lock); spin_unlock_bh(&seq->lock);
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
} }
/** /**
* nametbl_unsubscribe - remove a subscription object from name table * tipc_nametbl_unsubscribe - remove a subscription object from name table
*/ */
void void
nametbl_unsubscribe(struct subscription *s) tipc_nametbl_unsubscribe(struct subscription *s)
{ {
struct name_seq *seq; struct name_seq *seq;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
seq = nametbl_find_seq(s->seq.type); seq = nametbl_find_seq(s->seq.type);
if (seq != NULL){ if (seq != NULL){
spin_lock_bh(&seq->lock); spin_lock_bh(&seq->lock);
...@@ -830,7 +830,7 @@ nametbl_unsubscribe(struct subscription *s) ...@@ -830,7 +830,7 @@ nametbl_unsubscribe(struct subscription *s)
kfree(seq); kfree(seq);
} }
} }
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
} }
...@@ -983,17 +983,17 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, ...@@ -983,17 +983,17 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
} }
} }
void nametbl_print(struct print_buf *buf, const char *str) void tipc_nametbl_print(struct print_buf *buf, const char *str)
{ {
tipc_printf(buf, str); tipc_printf(buf, str);
read_lock_bh(&nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
nametbl_list(buf, 0, 0, 0, 0); nametbl_list(buf, 0, 0, 0, 0);
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
} }
#define MAX_NAME_TBL_QUERY 32768 #define MAX_NAME_TBL_QUERY 32768
struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct tipc_name_table_query *argv; struct tipc_name_table_query *argv;
...@@ -1002,20 +1002,20 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) ...@@ -1002,20 +1002,20 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space)
int str_len; int str_len;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NAME_TBL_QUERY))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
buf = cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY)); buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_NAME_TBL_QUERY));
if (!buf) if (!buf)
return NULL; return NULL;
rep_tlv = (struct tlv_desc *)buf->data; rep_tlv = (struct tlv_desc *)buf->data;
printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY);
argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area);
read_lock_bh(&nametbl_lock); read_lock_bh(&tipc_nametbl_lock);
nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type), nametbl_list(&b, ntohl(argv->depth), ntohl(argv->type),
ntohl(argv->lowbound), ntohl(argv->upbound)); ntohl(argv->lowbound), ntohl(argv->upbound));
read_unlock_bh(&nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
str_len = printbuf_validate(&b); str_len = tipc_printbuf_validate(&b);
skb_put(buf, TLV_SPACE(str_len)); skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
...@@ -1023,12 +1023,12 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space) ...@@ -1023,12 +1023,12 @@ struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space)
return buf; return buf;
} }
void nametbl_dump(void) void tipc_nametbl_dump(void)
{ {
nametbl_list(CONS, 0, 0, 0, 0); nametbl_list(TIPC_CONS, 0, 0, 0, 0);
} }
int nametbl_init(void) int tipc_nametbl_init(void)
{ {
int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;
...@@ -1036,14 +1036,14 @@ int nametbl_init(void) ...@@ -1036,14 +1036,14 @@ int nametbl_init(void)
if (!table.types) if (!table.types)
return -ENOMEM; return -ENOMEM;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
memset(table.types, 0, array_size); memset(table.types, 0, array_size);
table.local_publ_count = 0; table.local_publ_count = 0;
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
return 0; return 0;
} }
void nametbl_stop(void) void tipc_nametbl_stop(void)
{ {
struct hlist_head *seq_head; struct hlist_head *seq_head;
struct hlist_node *seq_node; struct hlist_node *seq_node;
...@@ -1054,7 +1054,7 @@ void nametbl_stop(void) ...@@ -1054,7 +1054,7 @@ void nametbl_stop(void)
if (!table.types) if (!table.types)
return; return;
write_lock_bh(&nametbl_lock); write_lock_bh(&tipc_nametbl_lock);
for (i = 0; i < tipc_nametbl_size; i++) { for (i = 0; i < tipc_nametbl_size; i++) {
seq_head = &table.types[i]; seq_head = &table.types[i];
hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) { hlist_for_each_entry_safe(seq, seq_node, tmp, seq_head, ns_list) {
...@@ -1075,5 +1075,5 @@ void nametbl_stop(void) ...@@ -1075,5 +1075,5 @@ void nametbl_stop(void)
} }
kfree(table.types); kfree(table.types);
table.types = NULL; table.types = NULL;
write_unlock_bh(&nametbl_lock); write_unlock_bh(&tipc_nametbl_lock);
} }
...@@ -85,24 +85,24 @@ struct publication { ...@@ -85,24 +85,24 @@ struct publication {
}; };
extern rwlock_t nametbl_lock; extern rwlock_t tipc_nametbl_lock;
struct sk_buff *nametbl_get(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space);
u32 nametbl_translate(u32 type, u32 instance, u32 *node); u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node);
int nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit, int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
struct port_list *dports); struct port_list *dports);
int nametbl_publish_rsv(u32 ref, unsigned int scope, int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope,
struct tipc_name_seq const *seq); struct tipc_name_seq const *seq);
struct publication *nametbl_publish(u32 type, u32 lower, u32 upper, struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
u32 scope, u32 port_ref, u32 key); u32 scope, u32 port_ref, u32 key);
int nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key);
struct publication *nametbl_insert_publ(u32 type, u32 lower, u32 upper, struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
u32 scope, u32 node, u32 ref, u32 key); u32 scope, u32 node, u32 ref, u32 key);
struct publication *nametbl_remove_publ(u32 type, u32 lower, struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
u32 node, u32 ref, u32 key); u32 node, u32 ref, u32 key);
void nametbl_subscribe(struct subscription *s); void tipc_nametbl_subscribe(struct subscription *s);
void nametbl_unsubscribe(struct subscription *s); void tipc_nametbl_unsubscribe(struct subscription *s);
int nametbl_init(void); int tipc_nametbl_init(void);
void nametbl_stop(void); void tipc_nametbl_stop(void);
#endif #endif
...@@ -58,25 +58,25 @@ ...@@ -58,25 +58,25 @@
* 1: The routing hierarchy. * 1: The routing hierarchy.
* Comprises the structures 'zone', 'cluster', 'node', 'link' * Comprises the structures 'zone', 'cluster', 'node', 'link'
* and 'bearer'. The whole hierarchy is protected by a big * and 'bearer'. The whole hierarchy is protected by a big
* read/write lock, net_lock, to enssure that nothing is added * read/write lock, tipc_net_lock, to enssure that nothing is added
* or removed while code is accessing any of these structures. * or removed while code is accessing any of these structures.
* This layer must not be called from the two others while they * This layer must not be called from the two others while they
* hold any of their own locks. * hold any of their own locks.
* Neither must it itself do any upcalls to the other two before * Neither must it itself do any upcalls to the other two before
* it has released net_lock and other protective locks. * it has released tipc_net_lock and other protective locks.
* *
* Within the net_lock domain there are two sub-domains;'node' and * Within the tipc_net_lock domain there are two sub-domains;'node' and
* 'bearer', where local write operations are permitted, * 'bearer', where local write operations are permitted,
* provided that those are protected by individual spin_locks * provided that those are protected by individual spin_locks
* per instance. Code holding net_lock(read) and a node spin_lock * per instance. Code holding tipc_net_lock(read) and a node spin_lock
* is permitted to poke around in both the node itself and its * is permitted to poke around in both the node itself and its
* subordinate links. I.e, it can update link counters and queues, * subordinate links. I.e, it can update link counters and queues,
* change link state, send protocol messages, and alter the * change link state, send protocol messages, and alter the
* "active_links" array in the node; but it can _not_ remove a link * "active_links" array in the node; but it can _not_ remove a link
* or a node from the overall structure. * or a node from the overall structure.
* Correspondingly, individual bearers may change status within a * Correspondingly, individual bearers may change status within a
* net_lock(read), protected by an individual spin_lock ber bearer * tipc_net_lock(read), protected by an individual spin_lock ber bearer
* instance, but it needs net_lock(write) to remove/add any bearers. * instance, but it needs tipc_net_lock(write) to remove/add any bearers.
* *
* *
* 2: The transport level of the protocol. * 2: The transport level of the protocol.
...@@ -97,91 +97,91 @@ ...@@ -97,91 +97,91 @@
* (Nobody is using read-only access to this, so it can just as * (Nobody is using read-only access to this, so it can just as
* well be changed to a spin_lock) * well be changed to a spin_lock)
* - A spin lock to protect the registry of kernel/driver users (reg.c) * - A spin lock to protect the registry of kernel/driver users (reg.c)
* - A global spin_lock (port_lock), which only task is to ensure * - A global spin_lock (tipc_port_lock), which only task is to ensure
* consistency where more than one port is involved in an operation, * consistency where more than one port is involved in an operation,
* i.e., whe a port is part of a linked list of ports. * i.e., whe a port is part of a linked list of ports.
* There are two such lists; 'port_list', which is used for management, * There are two such lists; 'port_list', which is used for management,
* and 'wait_list', which is used to queue ports during congestion. * and 'wait_list', which is used to queue ports during congestion.
* *
* 3: The name table (name_table.c, name_distr.c, subscription.c) * 3: The name table (name_table.c, name_distr.c, subscription.c)
* - There is one big read/write-lock (nametbl_lock) protecting the * - There is one big read/write-lock (tipc_nametbl_lock) protecting the
* overall name table structure. Nothing must be added/removed to * overall name table structure. Nothing must be added/removed to
* this structure without holding write access to it. * this structure without holding write access to it.
* - There is one local spin_lock per sub_sequence, which can be seen * - There is one local spin_lock per sub_sequence, which can be seen
* as a sub-domain to the nametbl_lock domain. It is used only * as a sub-domain to the tipc_nametbl_lock domain. It is used only
* for translation operations, and is needed because a translation * for translation operations, and is needed because a translation
* steps the root of the 'publication' linked list between each lookup. * steps the root of the 'publication' linked list between each lookup.
* This is always used within the scope of a nametbl_lock(read). * This is always used within the scope of a tipc_nametbl_lock(read).
* - A local spin_lock protecting the queue of subscriber events. * - A local spin_lock protecting the queue of subscriber events.
*/ */
rwlock_t net_lock = RW_LOCK_UNLOCKED; rwlock_t tipc_net_lock = RW_LOCK_UNLOCKED;
struct network net = { 0 }; struct network tipc_net = { 0 };
struct node *net_select_remote_node(u32 addr, u32 ref) struct node *tipc_net_select_remote_node(u32 addr, u32 ref)
{ {
return zone_select_remote_node(net.zones[tipc_zone(addr)], addr, ref); return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref);
} }
u32 net_select_router(u32 addr, u32 ref) u32 tipc_net_select_router(u32 addr, u32 ref)
{ {
return zone_select_router(net.zones[tipc_zone(addr)], addr, ref); return tipc_zone_select_router(tipc_net.zones[tipc_zone(addr)], addr, ref);
} }
u32 net_next_node(u32 a) u32 tipc_net_next_node(u32 a)
{ {
if (net.zones[tipc_zone(a)]) if (tipc_net.zones[tipc_zone(a)])
return zone_next_node(a); return tipc_zone_next_node(a);
return 0; return 0;
} }
void net_remove_as_router(u32 router) void tipc_net_remove_as_router(u32 router)
{ {
u32 z_num; u32 z_num;
for (z_num = 1; z_num <= tipc_max_zones; z_num++) { for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
if (!net.zones[z_num]) if (!tipc_net.zones[z_num])
continue; continue;
zone_remove_as_router(net.zones[z_num], router); tipc_zone_remove_as_router(tipc_net.zones[z_num], router);
} }
} }
void net_send_external_routes(u32 dest) void tipc_net_send_external_routes(u32 dest)
{ {
u32 z_num; u32 z_num;
for (z_num = 1; z_num <= tipc_max_zones; z_num++) { for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
if (net.zones[z_num]) if (tipc_net.zones[z_num])
zone_send_external_routes(net.zones[z_num], dest); tipc_zone_send_external_routes(tipc_net.zones[z_num], dest);
} }
} }
int net_init(void) static int net_init(void)
{ {
u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1); u32 sz = sizeof(struct _zone *) * (tipc_max_zones + 1);
memset(&net, 0, sizeof(net)); memset(&tipc_net, 0, sizeof(tipc_net));
net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC); tipc_net.zones = (struct _zone **)kmalloc(sz, GFP_ATOMIC);
if (!net.zones) { if (!tipc_net.zones) {
return -ENOMEM; return -ENOMEM;
} }
memset(net.zones, 0, sz); memset(tipc_net.zones, 0, sz);
return TIPC_OK; return TIPC_OK;
} }
void net_stop(void) static void net_stop(void)
{ {
u32 z_num; u32 z_num;
if (!net.zones) if (!tipc_net.zones)
return; return;
for (z_num = 1; z_num <= tipc_max_zones; z_num++) { for (z_num = 1; z_num <= tipc_max_zones; z_num++) {
zone_delete(net.zones[z_num]); tipc_zone_delete(tipc_net.zones[z_num]);
} }
kfree(net.zones); kfree(tipc_net.zones);
net.zones = 0; tipc_net.zones = 0;
} }
static void net_route_named_msg(struct sk_buff *buf) static void net_route_named_msg(struct sk_buff *buf)
...@@ -191,26 +191,26 @@ static void net_route_named_msg(struct sk_buff *buf) ...@@ -191,26 +191,26 @@ static void net_route_named_msg(struct sk_buff *buf)
u32 dport; u32 dport;
if (!msg_named(msg)) { if (!msg_named(msg)) {
msg_dbg(msg, "net->drop_nam:"); msg_dbg(msg, "tipc_net->drop_nam:");
buf_discard(buf); buf_discard(buf);
return; return;
} }
dnode = addr_domain(msg_lookup_scope(msg)); dnode = addr_domain(msg_lookup_scope(msg));
dport = nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode); dport = tipc_nametbl_translate(msg_nametype(msg), msg_nameinst(msg), &dnode);
dbg("net->lookup<%u,%u>-><%u,%x>\n", dbg("tipc_net->lookup<%u,%u>-><%u,%x>\n",
msg_nametype(msg), msg_nameinst(msg), dport, dnode); msg_nametype(msg), msg_nameinst(msg), dport, dnode);
if (dport) { if (dport) {
msg_set_destnode(msg, dnode); msg_set_destnode(msg, dnode);
msg_set_destport(msg, dport); msg_set_destport(msg, dport);
net_route_msg(buf); tipc_net_route_msg(buf);
return; return;
} }
msg_dbg(msg, "net->rej:NO NAME: "); msg_dbg(msg, "tipc_net->rej:NO NAME: ");
tipc_reject_msg(buf, TIPC_ERR_NO_NAME); tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
} }
void net_route_msg(struct sk_buff *buf) void tipc_net_route_msg(struct sk_buff *buf)
{ {
struct tipc_msg *msg; struct tipc_msg *msg;
u32 dnode; u32 dnode;
...@@ -232,29 +232,29 @@ void net_route_msg(struct sk_buff *buf) ...@@ -232,29 +232,29 @@ void net_route_msg(struct sk_buff *buf)
return; return;
} }
msg_dbg(msg, "net->rout: "); msg_dbg(msg, "tipc_net->rout: ");
/* Handle message for this node */ /* Handle message for this node */
dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg);
if (in_scope(dnode, tipc_own_addr)) { if (in_scope(dnode, tipc_own_addr)) {
if (msg_isdata(msg)) { if (msg_isdata(msg)) {
if (msg_mcast(msg)) if (msg_mcast(msg))
port_recv_mcast(buf, NULL); tipc_port_recv_mcast(buf, NULL);
else if (msg_destport(msg)) else if (msg_destport(msg))
port_recv_msg(buf); tipc_port_recv_msg(buf);
else else
net_route_named_msg(buf); net_route_named_msg(buf);
return; return;
} }
switch (msg_user(msg)) { switch (msg_user(msg)) {
case ROUTE_DISTRIBUTOR: case ROUTE_DISTRIBUTOR:
cluster_recv_routing_table(buf); tipc_cltr_recv_routing_table(buf);
break; break;
case NAME_DISTRIBUTOR: case NAME_DISTRIBUTOR:
named_recv(buf); tipc_named_recv(buf);
break; break;
case CONN_MANAGER: case CONN_MANAGER:
port_recv_proto_msg(buf); tipc_port_recv_proto_msg(buf);
break; break;
default: default:
msg_dbg(msg,"DROP/NET/<REC<"); msg_dbg(msg,"DROP/NET/<REC<");
...@@ -265,10 +265,10 @@ void net_route_msg(struct sk_buff *buf) ...@@ -265,10 +265,10 @@ void net_route_msg(struct sk_buff *buf)
/* Handle message for another node */ /* Handle message for another node */
msg_dbg(msg, "NET>SEND>: "); msg_dbg(msg, "NET>SEND>: ");
link_send(buf, dnode, msg_link_selector(msg)); tipc_link_send(buf, dnode, msg_link_selector(msg));
} }
int tipc_start_net(void) int tipc_net_start(void)
{ {
char addr_string[16]; char addr_string[16];
int res; int res;
...@@ -277,35 +277,35 @@ int tipc_start_net(void) ...@@ -277,35 +277,35 @@ int tipc_start_net(void)
return -ENOPROTOOPT; return -ENOPROTOOPT;
tipc_mode = TIPC_NET_MODE; tipc_mode = TIPC_NET_MODE;
named_reinit(); tipc_named_reinit();
port_reinit(); tipc_port_reinit();
if ((res = bearer_init()) || if ((res = tipc_bearer_init()) ||
(res = net_init()) || (res = net_init()) ||
(res = cluster_init()) || (res = tipc_cltr_init()) ||
(res = bclink_init())) { (res = tipc_bclink_init())) {
return res; return res;
} }
subscr_stop(); tipc_subscr_stop();
cfg_stop(); tipc_cfg_stop();
k_signal((Handler)subscr_start, 0); tipc_k_signal((Handler)tipc_subscr_start, 0);
k_signal((Handler)cfg_init, 0); tipc_k_signal((Handler)tipc_cfg_init, 0);
info("Started in network mode\n"); info("Started in network mode\n");
info("Own node address %s, network identity %u\n", info("Own node address %s, network identity %u\n",
addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
return TIPC_OK; return TIPC_OK;
} }
void tipc_stop_net(void) void tipc_net_stop(void)
{ {
if (tipc_mode != TIPC_NET_MODE) if (tipc_mode != TIPC_NET_MODE)
return; return;
write_lock_bh(&net_lock); write_lock_bh(&tipc_net_lock);
bearer_stop(); tipc_bearer_stop();
tipc_mode = TIPC_NODE_MODE; tipc_mode = TIPC_NODE_MODE;
bclink_stop(); tipc_bclink_stop();
net_stop(); net_stop();
write_unlock_bh(&net_lock); write_unlock_bh(&tipc_net_lock);
info("Left network mode \n"); info("Left network mode \n");
} }
...@@ -49,18 +49,16 @@ struct network { ...@@ -49,18 +49,16 @@ struct network {
}; };
extern struct network net; extern struct network tipc_net;
extern rwlock_t net_lock; extern rwlock_t tipc_net_lock;
int net_init(void); void tipc_net_remove_as_router(u32 router);
void net_stop(void); void tipc_net_send_external_routes(u32 dest);
void net_remove_as_router(u32 router); void tipc_net_route_msg(struct sk_buff *buf);
void net_send_external_routes(u32 dest); struct node *tipc_net_select_remote_node(u32 addr, u32 ref);
void net_route_msg(struct sk_buff *buf); u32 tipc_net_select_router(u32 addr, u32 ref);
struct node *net_select_remote_node(u32 addr, u32 ref);
u32 net_select_router(u32 addr, u32 ref);
int tipc_start_net(void); int tipc_net_start(void);
void tipc_stop_net(void); void tipc_net_stop(void);
#endif #endif
...@@ -47,13 +47,13 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) ...@@ -47,13 +47,13 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN); int hdr_space = NLMSG_SPACE(GENL_HDRLEN + TIPC_GENL_HDRLEN);
if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN))) if ((req_userhdr->cmd & 0xC000) && (!capable(CAP_NET_ADMIN)))
rep_buf = cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN); rep_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_NET_ADMIN);
else else
rep_buf = cfg_do_cmd(req_userhdr->dest, rep_buf = tipc_cfg_do_cmd(req_userhdr->dest,
req_userhdr->cmd, req_userhdr->cmd,
NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN, NLMSG_DATA(req_nlh) + GENL_HDRLEN + TIPC_GENL_HDRLEN,
NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN), NLMSG_PAYLOAD(req_nlh, GENL_HDRLEN + TIPC_GENL_HDRLEN),
hdr_space); hdr_space);
if (rep_buf) { if (rep_buf) {
skb_push(rep_buf, hdr_space); skb_push(rep_buf, hdr_space);
...@@ -81,7 +81,7 @@ static struct genl_ops ops = { ...@@ -81,7 +81,7 @@ static struct genl_ops ops = {
static int family_registered = 0; static int family_registered = 0;
int netlink_start(void) int tipc_netlink_start(void)
{ {
...@@ -103,7 +103,7 @@ int netlink_start(void) ...@@ -103,7 +103,7 @@ int netlink_start(void)
return -EFAULT; return -EFAULT;
} }
void netlink_stop(void) void tipc_netlink_stop(void)
{ {
if (family_registered) { if (family_registered) {
genl_unregister_family(&family); genl_unregister_family(&family);
......
...@@ -45,17 +45,16 @@ ...@@ -45,17 +45,16 @@
#include "port.h" #include "port.h"
#include "bearer.h" #include "bearer.h"
#include "name_distr.h" #include "name_distr.h"
#include "net.h"
void node_print(struct print_buf *buf, struct node *n_ptr, char *str); void node_print(struct print_buf *buf, struct node *n_ptr, char *str);
static void node_lost_contact(struct node *n_ptr); static void node_lost_contact(struct node *n_ptr);
static void node_established_contact(struct node *n_ptr); static void node_established_contact(struct node *n_ptr);
struct node *nodes = NULL; /* sorted list of nodes within cluster */ struct node *tipc_nodes = NULL; /* sorted list of nodes within cluster */
u32 tipc_own_tag = 0; u32 tipc_own_tag = 0;
struct node *node_create(u32 addr) struct node *tipc_node_create(u32 addr)
{ {
struct cluster *c_ptr; struct cluster *c_ptr;
struct node *n_ptr; struct node *n_ptr;
...@@ -68,16 +67,16 @@ struct node *node_create(u32 addr) ...@@ -68,16 +67,16 @@ struct node *node_create(u32 addr)
n_ptr->lock = SPIN_LOCK_UNLOCKED; n_ptr->lock = SPIN_LOCK_UNLOCKED;
INIT_LIST_HEAD(&n_ptr->nsub); INIT_LIST_HEAD(&n_ptr->nsub);
c_ptr = cluster_find(addr); c_ptr = tipc_cltr_find(addr);
if (c_ptr == NULL) if (c_ptr == NULL)
c_ptr = cluster_create(addr); c_ptr = tipc_cltr_create(addr);
if (c_ptr != NULL) { if (c_ptr != NULL) {
n_ptr->owner = c_ptr; n_ptr->owner = c_ptr;
cluster_attach_node(c_ptr, n_ptr); tipc_cltr_attach_node(c_ptr, n_ptr);
n_ptr->last_router = -1; n_ptr->last_router = -1;
/* Insert node into ordered list */ /* Insert node into ordered list */
for (curr_node = &nodes; *curr_node; for (curr_node = &tipc_nodes; *curr_node;
curr_node = &(*curr_node)->next) { curr_node = &(*curr_node)->next) {
if (addr < (*curr_node)->addr) { if (addr < (*curr_node)->addr) {
n_ptr->next = *curr_node; n_ptr->next = *curr_node;
...@@ -93,13 +92,13 @@ struct node *node_create(u32 addr) ...@@ -93,13 +92,13 @@ struct node *node_create(u32 addr)
return n_ptr; return n_ptr;
} }
void node_delete(struct node *n_ptr) void tipc_node_delete(struct node *n_ptr)
{ {
if (!n_ptr) if (!n_ptr)
return; return;
#if 0 #if 0
/* Not needed because links are already deleted via bearer_stop() */ /* Not needed because links are already deleted via tipc_bearer_stop() */
u32 l_num; u32 l_num;
...@@ -114,12 +113,12 @@ void node_delete(struct node *n_ptr) ...@@ -114,12 +113,12 @@ void node_delete(struct node *n_ptr)
/** /**
* node_link_up - handle addition of link * tipc_node_link_up - handle addition of link
* *
* Link becomes active (alone or shared) or standby, depending on its priority. * Link becomes active (alone or shared) or standby, depending on its priority.
*/ */
void node_link_up(struct node *n_ptr, struct link *l_ptr) void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
{ {
struct link **active = &n_ptr->active_links[0]; struct link **active = &n_ptr->active_links[0];
...@@ -136,7 +135,7 @@ void node_link_up(struct node *n_ptr, struct link *l_ptr) ...@@ -136,7 +135,7 @@ void node_link_up(struct node *n_ptr, struct link *l_ptr)
info("Link is standby\n"); info("Link is standby\n");
return; return;
} }
link_send_duplicate(active[0], l_ptr); tipc_link_send_duplicate(active[0], l_ptr);
if (l_ptr->priority == active[0]->priority) { if (l_ptr->priority == active[0]->priority) {
active[0] = l_ptr; active[0] = l_ptr;
return; return;
...@@ -161,7 +160,7 @@ static void node_select_active_links(struct node *n_ptr) ...@@ -161,7 +160,7 @@ static void node_select_active_links(struct node *n_ptr)
for (i = 0; i < MAX_BEARERS; i++) { for (i = 0; i < MAX_BEARERS; i++) {
struct link *l_ptr = n_ptr->links[i]; struct link *l_ptr = n_ptr->links[i];
if (!l_ptr || !link_is_up(l_ptr) || if (!l_ptr || !tipc_link_is_up(l_ptr) ||
(l_ptr->priority < highest_prio)) (l_ptr->priority < highest_prio))
continue; continue;
...@@ -175,14 +174,14 @@ static void node_select_active_links(struct node *n_ptr) ...@@ -175,14 +174,14 @@ static void node_select_active_links(struct node *n_ptr)
} }
/** /**
* node_link_down - handle loss of link * tipc_node_link_down - handle loss of link
*/ */
void node_link_down(struct node *n_ptr, struct link *l_ptr) void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr)
{ {
struct link **active; struct link **active;
if (!link_is_active(l_ptr)) { if (!tipc_link_is_active(l_ptr)) {
info("Lost standby link <%s> on network plane %c\n", info("Lost standby link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane); l_ptr->name, l_ptr->b_ptr->net_plane);
return; return;
...@@ -197,40 +196,40 @@ void node_link_down(struct node *n_ptr, struct link *l_ptr) ...@@ -197,40 +196,40 @@ void node_link_down(struct node *n_ptr, struct link *l_ptr)
active[1] = active[0]; active[1] = active[0];
if (active[0] == l_ptr) if (active[0] == l_ptr)
node_select_active_links(n_ptr); node_select_active_links(n_ptr);
if (node_is_up(n_ptr)) if (tipc_node_is_up(n_ptr))
link_changeover(l_ptr); tipc_link_changeover(l_ptr);
else else
node_lost_contact(n_ptr); node_lost_contact(n_ptr);
} }
int node_has_active_links(struct node *n_ptr) int tipc_node_has_active_links(struct node *n_ptr)
{ {
return (n_ptr && return (n_ptr &&
((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); ((n_ptr->active_links[0]) || (n_ptr->active_links[1])));
} }
int node_has_redundant_links(struct node *n_ptr) int tipc_node_has_redundant_links(struct node *n_ptr)
{ {
return (node_has_active_links(n_ptr) && return (tipc_node_has_active_links(n_ptr) &&
(n_ptr->active_links[0] != n_ptr->active_links[1])); (n_ptr->active_links[0] != n_ptr->active_links[1]));
} }
int node_has_active_routes(struct node *n_ptr) int tipc_node_has_active_routes(struct node *n_ptr)
{ {
return (n_ptr && (n_ptr->last_router >= 0)); return (n_ptr && (n_ptr->last_router >= 0));
} }
int node_is_up(struct node *n_ptr) int tipc_node_is_up(struct node *n_ptr)
{ {
return (node_has_active_links(n_ptr) || node_has_active_routes(n_ptr)); return (tipc_node_has_active_links(n_ptr) || tipc_node_has_active_routes(n_ptr));
} }
struct node *node_attach_link(struct link *l_ptr) struct node *tipc_node_attach_link(struct link *l_ptr)
{ {
struct node *n_ptr = node_find(l_ptr->addr); struct node *n_ptr = tipc_node_find(l_ptr->addr);
if (!n_ptr) if (!n_ptr)
n_ptr = node_create(l_ptr->addr); n_ptr = tipc_node_create(l_ptr->addr);
if (n_ptr) { if (n_ptr) {
u32 bearer_id = l_ptr->b_ptr->identity; u32 bearer_id = l_ptr->b_ptr->identity;
char addr_string[16]; char addr_string[16];
...@@ -246,7 +245,7 @@ struct node *node_attach_link(struct link *l_ptr) ...@@ -246,7 +245,7 @@ struct node *node_attach_link(struct link *l_ptr)
if (!n_ptr->links[bearer_id]) { if (!n_ptr->links[bearer_id]) {
n_ptr->links[bearer_id] = l_ptr; n_ptr->links[bearer_id] = l_ptr;
net.zones[tipc_zone(l_ptr->addr)]->links++; tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
n_ptr->link_cnt++; n_ptr->link_cnt++;
return n_ptr; return n_ptr;
} }
...@@ -257,10 +256,10 @@ struct node *node_attach_link(struct link *l_ptr) ...@@ -257,10 +256,10 @@ struct node *node_attach_link(struct link *l_ptr)
return 0; return 0;
} }
void node_detach_link(struct node *n_ptr, struct link *l_ptr) void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
{ {
n_ptr->links[l_ptr->b_ptr->identity] = 0; n_ptr->links[l_ptr->b_ptr->identity] = 0;
net.zones[tipc_zone(l_ptr->addr)]->links--; tipc_net.zones[tipc_zone(l_ptr->addr)]->links--;
n_ptr->link_cnt--; n_ptr->link_cnt--;
} }
...@@ -315,45 +314,45 @@ static void node_established_contact(struct node *n_ptr) ...@@ -315,45 +314,45 @@ static void node_established_contact(struct node *n_ptr)
struct cluster *c_ptr; struct cluster *c_ptr;
dbg("node_established_contact:-> %x\n", n_ptr->addr); dbg("node_established_contact:-> %x\n", n_ptr->addr);
if (!node_has_active_routes(n_ptr)) { if (!tipc_node_has_active_routes(n_ptr)) {
k_signal((Handler)named_node_up, n_ptr->addr); tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr);
} }
/* Syncronize broadcast acks */ /* Syncronize broadcast acks */
n_ptr->bclink.acked = bclink_get_last_sent(); n_ptr->bclink.acked = tipc_bclink_get_last_sent();
if (is_slave(tipc_own_addr)) if (is_slave(tipc_own_addr))
return; return;
if (!in_own_cluster(n_ptr->addr)) { if (!in_own_cluster(n_ptr->addr)) {
/* Usage case 1 (see above) */ /* Usage case 1 (see above) */
c_ptr = cluster_find(tipc_own_addr); c_ptr = tipc_cltr_find(tipc_own_addr);
if (!c_ptr) if (!c_ptr)
c_ptr = cluster_create(tipc_own_addr); c_ptr = tipc_cltr_create(tipc_own_addr);
if (c_ptr) if (c_ptr)
cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
tipc_max_nodes); tipc_max_nodes);
return; return;
} }
c_ptr = n_ptr->owner; c_ptr = n_ptr->owner;
if (is_slave(n_ptr->addr)) { if (is_slave(n_ptr->addr)) {
/* Usage case 2 (see above) */ /* Usage case 2 (see above) */
cluster_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes);
cluster_send_local_routes(c_ptr, n_ptr->addr); tipc_cltr_send_local_routes(c_ptr, n_ptr->addr);
return; return;
} }
if (n_ptr->bclink.supported) { if (n_ptr->bclink.supported) {
nmap_add(&cluster_bcast_nodes, n_ptr->addr); tipc_nmap_add(&tipc_cltr_bcast_nodes, n_ptr->addr);
if (n_ptr->addr < tipc_own_addr) if (n_ptr->addr < tipc_own_addr)
tipc_own_tag++; tipc_own_tag++;
} }
/* Case 3 (see above) */ /* Case 3 (see above) */
net_send_external_routes(n_ptr->addr); tipc_net_send_external_routes(n_ptr->addr);
cluster_send_slave_routes(c_ptr, n_ptr->addr); tipc_cltr_send_slave_routes(c_ptr, n_ptr->addr);
cluster_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE, tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, LOWEST_SLAVE,
highest_allowed_slave); tipc_highest_allowed_slave);
} }
static void node_lost_contact(struct node *n_ptr) static void node_lost_contact(struct node *n_ptr)
...@@ -375,39 +374,39 @@ static void node_lost_contact(struct node *n_ptr) ...@@ -375,39 +374,39 @@ static void node_lost_contact(struct node *n_ptr)
n_ptr->bclink.defragm = NULL; n_ptr->bclink.defragm = NULL;
} }
if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
} }
/* Update routing tables */ /* Update routing tables */
if (is_slave(tipc_own_addr)) { if (is_slave(tipc_own_addr)) {
net_remove_as_router(n_ptr->addr); tipc_net_remove_as_router(n_ptr->addr);
} else { } else {
if (!in_own_cluster(n_ptr->addr)) { if (!in_own_cluster(n_ptr->addr)) {
/* Case 4 (see above) */ /* Case 4 (see above) */
c_ptr = cluster_find(tipc_own_addr); c_ptr = tipc_cltr_find(tipc_own_addr);
cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
tipc_max_nodes); tipc_max_nodes);
} else { } else {
/* Case 5 (see above) */ /* Case 5 (see above) */
c_ptr = cluster_find(n_ptr->addr); c_ptr = tipc_cltr_find(n_ptr->addr);
if (is_slave(n_ptr->addr)) { if (is_slave(n_ptr->addr)) {
cluster_bcast_lost_route(c_ptr, n_ptr->addr, 1, tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
tipc_max_nodes); tipc_max_nodes);
} else { } else {
if (n_ptr->bclink.supported) { if (n_ptr->bclink.supported) {
nmap_remove(&cluster_bcast_nodes, tipc_nmap_remove(&tipc_cltr_bcast_nodes,
n_ptr->addr); n_ptr->addr);
if (n_ptr->addr < tipc_own_addr) if (n_ptr->addr < tipc_own_addr)
tipc_own_tag--; tipc_own_tag--;
} }
net_remove_as_router(n_ptr->addr); tipc_net_remove_as_router(n_ptr->addr);
cluster_bcast_lost_route(c_ptr, n_ptr->addr, tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr,
LOWEST_SLAVE, LOWEST_SLAVE,
highest_allowed_slave); tipc_highest_allowed_slave);
} }
} }
} }
if (node_has_active_routes(n_ptr)) if (tipc_node_has_active_routes(n_ptr))
return; return;
info("Lost contact with %s\n", info("Lost contact with %s\n",
...@@ -420,35 +419,35 @@ static void node_lost_contact(struct node *n_ptr) ...@@ -420,35 +419,35 @@ static void node_lost_contact(struct node *n_ptr)
continue; continue;
l_ptr->reset_checkpoint = l_ptr->next_in_no; l_ptr->reset_checkpoint = l_ptr->next_in_no;
l_ptr->exp_msg_count = 0; l_ptr->exp_msg_count = 0;
link_reset_fragments(l_ptr); tipc_link_reset_fragments(l_ptr);
} }
/* Notify subscribers */ /* Notify subscribers */
list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
ns->node = 0; ns->node = 0;
list_del_init(&ns->nodesub_list); list_del_init(&ns->nodesub_list);
k_signal((Handler)ns->handle_node_down, tipc_k_signal((Handler)ns->handle_node_down,
(unsigned long)ns->usr_handle); (unsigned long)ns->usr_handle);
} }
} }
/** /**
* node_select_next_hop - find the next-hop node for a message * tipc_node_select_next_hop - find the next-hop node for a message
* *
* Called by when cluster local lookup has failed. * Called by when cluster local lookup has failed.
*/ */
struct node *node_select_next_hop(u32 addr, u32 selector) struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
{ {
struct node *n_ptr; struct node *n_ptr;
u32 router_addr; u32 router_addr;
if (!addr_domain_valid(addr)) if (!tipc_addr_domain_valid(addr))
return 0; return 0;
/* Look for direct link to destination processsor */ /* Look for direct link to destination processsor */
n_ptr = node_find(addr); n_ptr = tipc_node_find(addr);
if (n_ptr && node_has_active_links(n_ptr)) if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr; return n_ptr;
/* Cluster local system nodes *must* have direct links */ /* Cluster local system nodes *must* have direct links */
...@@ -456,9 +455,9 @@ struct node *node_select_next_hop(u32 addr, u32 selector) ...@@ -456,9 +455,9 @@ struct node *node_select_next_hop(u32 addr, u32 selector)
return 0; return 0;
/* Look for cluster local router with direct link to node */ /* Look for cluster local router with direct link to node */
router_addr = node_select_router(n_ptr, selector); router_addr = tipc_node_select_router(n_ptr, selector);
if (router_addr) if (router_addr)
return node_select(router_addr, selector); return tipc_node_select(router_addr, selector);
/* Slave nodes can only be accessed within own cluster via a /* Slave nodes can only be accessed within own cluster via a
known router with direct link -- if no router was found,give up */ known router with direct link -- if no router was found,give up */
...@@ -467,25 +466,25 @@ struct node *node_select_next_hop(u32 addr, u32 selector) ...@@ -467,25 +466,25 @@ struct node *node_select_next_hop(u32 addr, u32 selector)
/* Inter zone/cluster -- find any direct link to remote cluster */ /* Inter zone/cluster -- find any direct link to remote cluster */
addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
n_ptr = net_select_remote_node(addr, selector); n_ptr = tipc_net_select_remote_node(addr, selector);
if (n_ptr && node_has_active_links(n_ptr)) if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr; return n_ptr;
/* Last resort -- look for any router to anywhere in remote zone */ /* Last resort -- look for any router to anywhere in remote zone */
router_addr = net_select_router(addr, selector); router_addr = tipc_net_select_router(addr, selector);
if (router_addr) if (router_addr)
return node_select(router_addr, selector); return tipc_node_select(router_addr, selector);
return 0; return 0;
} }
/** /**
* node_select_router - select router to reach specified node * tipc_node_select_router - select router to reach specified node
* *
* Uses a deterministic and fair algorithm for selecting router node. * Uses a deterministic and fair algorithm for selecting router node.
*/ */
u32 node_select_router(struct node *n_ptr, u32 ref) u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
{ {
u32 ulim; u32 ulim;
u32 mask; u32 mask;
...@@ -523,7 +522,7 @@ u32 node_select_router(struct node *n_ptr, u32 ref) ...@@ -523,7 +522,7 @@ u32 node_select_router(struct node *n_ptr, u32 ref)
return tipc_addr(own_zone(), own_cluster(), r); return tipc_addr(own_zone(), own_cluster(), r);
} }
void node_add_router(struct node *n_ptr, u32 router) void tipc_node_add_router(struct node *n_ptr, u32 router)
{ {
u32 r_num = tipc_node(router); u32 r_num = tipc_node(router);
...@@ -534,7 +533,7 @@ void node_add_router(struct node *n_ptr, u32 router) ...@@ -534,7 +533,7 @@ void node_add_router(struct node *n_ptr, u32 router)
!n_ptr->routers[n_ptr->last_router]); !n_ptr->routers[n_ptr->last_router]);
} }
void node_remove_router(struct node *n_ptr, u32 router) void tipc_node_remove_router(struct node *n_ptr, u32 router)
{ {
u32 r_num = tipc_node(router); u32 r_num = tipc_node(router);
...@@ -547,7 +546,7 @@ void node_remove_router(struct node *n_ptr, u32 router) ...@@ -547,7 +546,7 @@ void node_remove_router(struct node *n_ptr, u32 router)
while ((--n_ptr->last_router >= 0) && while ((--n_ptr->last_router >= 0) &&
!n_ptr->routers[n_ptr->last_router]); !n_ptr->routers[n_ptr->last_router]);
if (!node_is_up(n_ptr)) if (!tipc_node_is_up(n_ptr))
node_lost_contact(n_ptr); node_lost_contact(n_ptr);
} }
...@@ -572,16 +571,16 @@ u32 tipc_available_nodes(const u32 domain) ...@@ -572,16 +571,16 @@ u32 tipc_available_nodes(const u32 domain)
struct node *n_ptr; struct node *n_ptr;
u32 cnt = 0; u32 cnt = 0;
for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
if (!in_scope(domain, n_ptr->addr)) if (!in_scope(domain, n_ptr->addr))
continue; continue;
if (node_is_up(n_ptr)) if (tipc_node_is_up(n_ptr))
cnt++; cnt++;
} }
return cnt; return cnt;
} }
struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
{ {
u32 domain; u32 domain;
struct sk_buff *buf; struct sk_buff *buf;
...@@ -589,40 +588,40 @@ struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space) ...@@ -589,40 +588,40 @@ struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space)
struct tipc_node_info node_info; struct tipc_node_info node_info;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
domain = *(u32 *)TLV_DATA(req_tlv_area); domain = *(u32 *)TLV_DATA(req_tlv_area);
domain = ntohl(domain); domain = ntohl(domain);
if (!addr_domain_valid(domain)) if (!tipc_addr_domain_valid(domain))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (network address)"); " (network address)");
if (!nodes) if (!tipc_nodes)
return cfg_reply_none(); return tipc_cfg_reply_none();
/* For now, get space for all other nodes /* For now, get space for all other nodes
(will need to modify this when slave nodes are supported */ (will need to modify this when slave nodes are supported */
buf = cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) * buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(node_info)) *
(tipc_max_nodes - 1)); (tipc_max_nodes - 1));
if (!buf) if (!buf)
return NULL; return NULL;
/* Add TLVs for all nodes in scope */ /* Add TLVs for all nodes in scope */
for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
if (!in_scope(domain, n_ptr->addr)) if (!in_scope(domain, n_ptr->addr))
continue; continue;
node_info.addr = htonl(n_ptr->addr); node_info.addr = htonl(n_ptr->addr);
node_info.up = htonl(node_is_up(n_ptr)); node_info.up = htonl(tipc_node_is_up(n_ptr));
cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
&node_info, sizeof(node_info)); &node_info, sizeof(node_info));
} }
return buf; return buf;
} }
struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
{ {
u32 domain; u32 domain;
struct sk_buff *buf; struct sk_buff *buf;
...@@ -630,22 +629,22 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) ...@@ -630,22 +629,22 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space)
struct tipc_link_info link_info; struct tipc_link_info link_info;
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
return cfg_reply_error_string(TIPC_CFG_TLV_ERROR); return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
domain = *(u32 *)TLV_DATA(req_tlv_area); domain = *(u32 *)TLV_DATA(req_tlv_area);
domain = ntohl(domain); domain = ntohl(domain);
if (!addr_domain_valid(domain)) if (!tipc_addr_domain_valid(domain))
return cfg_reply_error_string(TIPC_CFG_INVALID_VALUE return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
" (network address)"); " (network address)");
if (!nodes) if (!tipc_nodes)
return cfg_reply_none(); return tipc_cfg_reply_none();
/* For now, get space for 2 links to all other nodes + bcast link /* For now, get space for 2 links to all other nodes + bcast link
(will need to modify this when slave nodes are supported */ (will need to modify this when slave nodes are supported */
buf = cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) * buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(link_info)) *
(2 * (tipc_max_nodes - 1) + 1)); (2 * (tipc_max_nodes - 1) + 1));
if (!buf) if (!buf)
return NULL; return NULL;
...@@ -654,12 +653,12 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) ...@@ -654,12 +653,12 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space)
link_info.dest = tipc_own_addr & 0xfffff00; link_info.dest = tipc_own_addr & 0xfffff00;
link_info.dest = htonl(link_info.dest); link_info.dest = htonl(link_info.dest);
link_info.up = htonl(1); link_info.up = htonl(1);
sprintf(link_info.str, bc_link_name); sprintf(link_info.str, tipc_bclink_name);
cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
/* Add TLVs for any other links in scope */ /* Add TLVs for any other links in scope */
for (n_ptr = nodes; n_ptr; n_ptr = n_ptr->next) { for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
u32 i; u32 i;
if (!in_scope(domain, n_ptr->addr)) if (!in_scope(domain, n_ptr->addr))
...@@ -668,10 +667,10 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space) ...@@ -668,10 +667,10 @@ struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space)
if (!n_ptr->links[i]) if (!n_ptr->links[i])
continue; continue;
link_info.dest = htonl(n_ptr->addr); link_info.dest = htonl(n_ptr->addr);
link_info.up = htonl(link_is_up(n_ptr->links[i])); link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
strcpy(link_info.str, n_ptr->links[i]->name); strcpy(link_info.str, n_ptr->links[i]->name);
cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
&link_info, sizeof(link_info)); &link_info, sizeof(link_info));
} }
} }
......
...@@ -92,31 +92,31 @@ struct node { ...@@ -92,31 +92,31 @@ struct node {
} bclink; } bclink;
}; };
extern struct node *nodes; extern struct node *tipc_nodes;
extern u32 tipc_own_tag; extern u32 tipc_own_tag;
struct node *node_create(u32 addr); struct node *tipc_node_create(u32 addr);
void node_delete(struct node *n_ptr); void tipc_node_delete(struct node *n_ptr);
struct node *node_attach_link(struct link *l_ptr); struct node *tipc_node_attach_link(struct link *l_ptr);
void node_detach_link(struct node *n_ptr, struct link *l_ptr); void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr);
void node_link_down(struct node *n_ptr, struct link *l_ptr); void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr);
void node_link_up(struct node *n_ptr, struct link *l_ptr); void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr);
int node_has_active_links(struct node *n_ptr); int tipc_node_has_active_links(struct node *n_ptr);
int node_has_redundant_links(struct node *n_ptr); int tipc_node_has_redundant_links(struct node *n_ptr);
u32 node_select_router(struct node *n_ptr, u32 ref); u32 tipc_node_select_router(struct node *n_ptr, u32 ref);
struct node *node_select_next_hop(u32 addr, u32 selector); struct node *tipc_node_select_next_hop(u32 addr, u32 selector);
int node_is_up(struct node *n_ptr); int tipc_node_is_up(struct node *n_ptr);
void node_add_router(struct node *n_ptr, u32 router); void tipc_node_add_router(struct node *n_ptr, u32 router);
void node_remove_router(struct node *n_ptr, u32 router); void tipc_node_remove_router(struct node *n_ptr, u32 router);
struct sk_buff *node_get_links(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space);
struct sk_buff *node_get_nodes(const void *req_tlv_area, int req_tlv_space); struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space);
static inline struct node *node_find(u32 addr) static inline struct node *tipc_node_find(u32 addr)
{ {
if (likely(in_own_cluster(addr))) if (likely(in_own_cluster(addr)))
return local_nodes[tipc_node(addr)]; return tipc_local_nodes[tipc_node(addr)];
else if (addr_domain_valid(addr)) { else if (tipc_addr_domain_valid(addr)) {
struct cluster *c_ptr = cluster_find(addr); struct cluster *c_ptr = tipc_cltr_find(addr);
if (c_ptr) if (c_ptr)
return c_ptr->nodes[tipc_node(addr)]; return c_ptr->nodes[tipc_node(addr)];
...@@ -124,19 +124,19 @@ static inline struct node *node_find(u32 addr) ...@@ -124,19 +124,19 @@ static inline struct node *node_find(u32 addr)
return 0; return 0;
} }
static inline struct node *node_select(u32 addr, u32 selector) static inline struct node *tipc_node_select(u32 addr, u32 selector)
{ {
if (likely(in_own_cluster(addr))) if (likely(in_own_cluster(addr)))
return local_nodes[tipc_node(addr)]; return tipc_local_nodes[tipc_node(addr)];
return node_select_next_hop(addr, selector); return tipc_node_select_next_hop(addr, selector);
} }
static inline void node_lock(struct node *n_ptr) static inline void tipc_node_lock(struct node *n_ptr)
{ {
spin_lock_bh(&n_ptr->lock); spin_lock_bh(&n_ptr->lock);
} }
static inline void node_unlock(struct node *n_ptr) static inline void tipc_node_unlock(struct node *n_ptr)
{ {
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
} }
......
...@@ -41,39 +41,39 @@ ...@@ -41,39 +41,39 @@
#include "addr.h" #include "addr.h"
/** /**
* nodesub_subscribe - create "node down" subscription for specified node * tipc_nodesub_subscribe - create "node down" subscription for specified node
*/ */
void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
void *usr_handle, net_ev_handler handle_down) void *usr_handle, net_ev_handler handle_down)
{ {
node_sub->node = 0; node_sub->node = 0;
if (addr == tipc_own_addr) if (addr == tipc_own_addr)
return; return;
if (!addr_node_valid(addr)) { if (!tipc_addr_node_valid(addr)) {
warn("node_subscr with illegal %x\n", addr); warn("node_subscr with illegal %x\n", addr);
return; return;
} }
node_sub->handle_node_down = handle_down; node_sub->handle_node_down = handle_down;
node_sub->usr_handle = usr_handle; node_sub->usr_handle = usr_handle;
node_sub->node = node_find(addr); node_sub->node = tipc_node_find(addr);
assert(node_sub->node); assert(node_sub->node);
node_lock(node_sub->node); tipc_node_lock(node_sub->node);
list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub); list_add_tail(&node_sub->nodesub_list, &node_sub->node->nsub);
node_unlock(node_sub->node); tipc_node_unlock(node_sub->node);
} }
/** /**
* nodesub_unsubscribe - cancel "node down" subscription (if any) * tipc_nodesub_unsubscribe - cancel "node down" subscription (if any)
*/ */
void nodesub_unsubscribe(struct node_subscr *node_sub) void tipc_nodesub_unsubscribe(struct node_subscr *node_sub)
{ {
if (!node_sub->node) if (!node_sub->node)
return; return;
node_lock(node_sub->node); tipc_node_lock(node_sub->node);
list_del_init(&node_sub->nodesub_list); list_del_init(&node_sub->nodesub_list);
node_unlock(node_sub->node); tipc_node_unlock(node_sub->node);
} }
...@@ -56,8 +56,8 @@ struct node_subscr { ...@@ -56,8 +56,8 @@ struct node_subscr {
struct list_head nodesub_list; struct list_head nodesub_list;
}; };
void nodesub_subscribe(struct node_subscr *node_sub, u32 addr, void tipc_nodesub_subscribe(struct node_subscr *node_sub, u32 addr,
void *usr_handle, net_ev_handler handle_down); void *usr_handle, net_ev_handler handle_down);
void nodesub_unsubscribe(struct node_subscr *node_sub); void tipc_nodesub_unsubscribe(struct node_subscr *node_sub);
#endif #endif
...@@ -57,10 +57,10 @@ ...@@ -57,10 +57,10 @@
static struct sk_buff *msg_queue_head = 0; static struct sk_buff *msg_queue_head = 0;
static struct sk_buff *msg_queue_tail = 0; static struct sk_buff *msg_queue_tail = 0;
spinlock_t port_list_lock = SPIN_LOCK_UNLOCKED; spinlock_t tipc_port_list_lock = SPIN_LOCK_UNLOCKED;
static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED; static spinlock_t queue_lock = SPIN_LOCK_UNLOCKED;
LIST_HEAD(ports); static LIST_HEAD(ports);
static void port_handle_node_down(unsigned long ref); static void port_handle_node_down(unsigned long ref);
static struct sk_buff* port_build_self_abort_msg(struct port *,u32 err); static struct sk_buff* port_build_self_abort_msg(struct port *,u32 err);
static struct sk_buff* port_build_peer_abort_msg(struct port *,u32 err); static struct sk_buff* port_build_peer_abort_msg(struct port *,u32 err);
...@@ -107,7 +107,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, ...@@ -107,7 +107,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
struct sk_buff *buf; struct sk_buff *buf;
struct sk_buff *ibuf = NULL; struct sk_buff *ibuf = NULL;
struct port_list dports = {0, NULL, }; struct port_list dports = {0, NULL, };
struct port *oport = port_deref(ref); struct port *oport = tipc_port_deref(ref);
int ext_targets; int ext_targets;
int res; int res;
...@@ -129,8 +129,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, ...@@ -129,8 +129,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
/* Figure out where to send multicast message */ /* Figure out where to send multicast message */
ext_targets = nametbl_mc_translate(seq->type, seq->lower, seq->upper, ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper,
TIPC_NODE_SCOPE, &dports); TIPC_NODE_SCOPE, &dports);
/* Send message to destinations (duplicate it only if necessary) */ /* Send message to destinations (duplicate it only if necessary) */
...@@ -138,12 +138,12 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, ...@@ -138,12 +138,12 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
if (dports.count != 0) { if (dports.count != 0) {
ibuf = skb_copy(buf, GFP_ATOMIC); ibuf = skb_copy(buf, GFP_ATOMIC);
if (ibuf == NULL) { if (ibuf == NULL) {
port_list_free(&dports); tipc_port_list_free(&dports);
buf_discard(buf); buf_discard(buf);
return -ENOMEM; return -ENOMEM;
} }
} }
res = bclink_send_msg(buf); res = tipc_bclink_send_msg(buf);
if ((res < 0) && (dports.count != 0)) { if ((res < 0) && (dports.count != 0)) {
buf_discard(ibuf); buf_discard(ibuf);
} }
...@@ -153,20 +153,20 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, ...@@ -153,20 +153,20 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain,
if (res >= 0) { if (res >= 0) {
if (ibuf) if (ibuf)
port_recv_mcast(ibuf, &dports); tipc_port_recv_mcast(ibuf, &dports);
} else { } else {
port_list_free(&dports); tipc_port_list_free(&dports);
} }
return res; return res;
} }
/** /**
* port_recv_mcast - deliver multicast message to all destination ports * tipc_port_recv_mcast - deliver multicast message to all destination ports
* *
* If there is no port list, perform a lookup to create one * If there is no port list, perform a lookup to create one
*/ */
void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
{ {
struct tipc_msg* msg; struct tipc_msg* msg;
struct port_list dports = {0, NULL, }; struct port_list dports = {0, NULL, };
...@@ -179,7 +179,7 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) ...@@ -179,7 +179,7 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
/* Create destination port list, if one wasn't supplied */ /* Create destination port list, if one wasn't supplied */
if (dp == NULL) { if (dp == NULL) {
nametbl_mc_translate(msg_nametype(msg), tipc_nametbl_mc_translate(msg_nametype(msg),
msg_namelower(msg), msg_namelower(msg),
msg_nameupper(msg), msg_nameupper(msg),
TIPC_CLUSTER_SCOPE, TIPC_CLUSTER_SCOPE,
...@@ -192,8 +192,8 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) ...@@ -192,8 +192,8 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
if (dp->count != 0) { if (dp->count != 0) {
if (dp->count == 1) { if (dp->count == 1) {
msg_set_destport(msg, dp->ports[0]); msg_set_destport(msg, dp->ports[0]);
port_recv_msg(buf); tipc_port_recv_msg(buf);
port_list_free(dp); tipc_port_list_free(dp);
return; return;
} }
for (; cnt < dp->count; cnt++) { for (; cnt < dp->count; cnt++) {
...@@ -209,12 +209,12 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp) ...@@ -209,12 +209,12 @@ void port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
item = item->next; item = item->next;
} }
msg_set_destport(buf_msg(b),item->ports[index]); msg_set_destport(buf_msg(b),item->ports[index]);
port_recv_msg(b); tipc_port_recv_msg(b);
} }
} }
exit: exit:
buf_discard(buf); buf_discard(buf);
port_list_free(dp); tipc_port_list_free(dp);
} }
/** /**
...@@ -238,14 +238,14 @@ u32 tipc_createport_raw(void *usr_handle, ...@@ -238,14 +238,14 @@ u32 tipc_createport_raw(void *usr_handle,
return 0; return 0;
} }
memset(p_ptr, 0, sizeof(*p_ptr)); memset(p_ptr, 0, sizeof(*p_ptr));
ref = ref_acquire(p_ptr, &p_ptr->publ.lock); ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
if (!ref) { if (!ref) {
warn("Reference Table Exhausted\n"); warn("Reference Table Exhausted\n");
kfree(p_ptr); kfree(p_ptr);
return 0; return 0;
} }
port_lock(ref); tipc_port_lock(ref);
p_ptr->publ.ref = ref; p_ptr->publ.ref = ref;
msg = &p_ptr->publ.phdr; msg = &p_ptr->publ.phdr;
msg_init(msg, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0); msg_init(msg, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0);
...@@ -264,12 +264,12 @@ u32 tipc_createport_raw(void *usr_handle, ...@@ -264,12 +264,12 @@ u32 tipc_createport_raw(void *usr_handle,
p_ptr->wakeup = wakeup; p_ptr->wakeup = wakeup;
p_ptr->user_port = 0; p_ptr->user_port = 0;
k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref); k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref);
spin_lock_bh(&port_list_lock); spin_lock_bh(&tipc_port_list_lock);
INIT_LIST_HEAD(&p_ptr->publications); INIT_LIST_HEAD(&p_ptr->publications);
INIT_LIST_HEAD(&p_ptr->port_list); INIT_LIST_HEAD(&p_ptr->port_list);
list_add_tail(&p_ptr->port_list, &ports); list_add_tail(&p_ptr->port_list, &ports);
spin_unlock_bh(&port_list_lock); spin_unlock_bh(&tipc_port_list_lock);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return ref; return ref;
} }
...@@ -279,31 +279,31 @@ int tipc_deleteport(u32 ref) ...@@ -279,31 +279,31 @@ int tipc_deleteport(u32 ref)
struct sk_buff *buf = 0; struct sk_buff *buf = 0;
tipc_withdraw(ref, 0, 0); tipc_withdraw(ref, 0, 0);
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
ref_discard(ref); tipc_ref_discard(ref);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
k_cancel_timer(&p_ptr->timer); k_cancel_timer(&p_ptr->timer);
if (p_ptr->publ.connected) { if (p_ptr->publ.connected) {
buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
nodesub_unsubscribe(&p_ptr->subscription); tipc_nodesub_unsubscribe(&p_ptr->subscription);
} }
if (p_ptr->user_port) { if (p_ptr->user_port) {
reg_remove_port(p_ptr->user_port); tipc_reg_remove_port(p_ptr->user_port);
kfree(p_ptr->user_port); kfree(p_ptr->user_port);
} }
spin_lock_bh(&port_list_lock); spin_lock_bh(&tipc_port_list_lock);
list_del(&p_ptr->port_list); list_del(&p_ptr->port_list);
list_del(&p_ptr->wait_list); list_del(&p_ptr->wait_list);
spin_unlock_bh(&port_list_lock); spin_unlock_bh(&tipc_port_list_lock);
k_term_timer(&p_ptr->timer); k_term_timer(&p_ptr->timer);
kfree(p_ptr); kfree(p_ptr);
dbg("Deleted port %u\n", ref); dbg("Deleted port %u\n", ref);
net_route_msg(buf); tipc_net_route_msg(buf);
return TIPC_OK; return TIPC_OK;
} }
...@@ -315,7 +315,7 @@ int tipc_deleteport(u32 ref) ...@@ -315,7 +315,7 @@ int tipc_deleteport(u32 ref)
struct tipc_port *tipc_get_port(const u32 ref) struct tipc_port *tipc_get_port(const u32 ref)
{ {
return (struct tipc_port *)ref_deref(ref); return (struct tipc_port *)tipc_ref_deref(ref);
} }
/** /**
...@@ -327,11 +327,11 @@ void *tipc_get_handle(const u32 ref) ...@@ -327,11 +327,11 @@ void *tipc_get_handle(const u32 ref)
struct port *p_ptr; struct port *p_ptr;
void * handle; void * handle;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return 0; return 0;
handle = p_ptr->publ.usr_handle; handle = p_ptr->publ.usr_handle;
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return handle; return handle;
} }
...@@ -344,7 +344,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable) ...@@ -344,7 +344,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable)
{ {
struct port *p_ptr; struct port *p_ptr;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
*isunreliable = port_unreliable(p_ptr); *isunreliable = port_unreliable(p_ptr);
...@@ -356,11 +356,11 @@ int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) ...@@ -356,11 +356,11 @@ int tipc_set_portunreliable(u32 ref, unsigned int isunreliable)
{ {
struct port *p_ptr; struct port *p_ptr;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
msg_set_src_droppable(&p_ptr->publ.phdr, (isunreliable != 0)); msg_set_src_droppable(&p_ptr->publ.phdr, (isunreliable != 0));
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return TIPC_OK; return TIPC_OK;
} }
...@@ -373,7 +373,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) ...@@ -373,7 +373,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable)
{ {
struct port *p_ptr; struct port *p_ptr;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
*isunrejectable = port_unreturnable(p_ptr); *isunrejectable = port_unreturnable(p_ptr);
...@@ -385,11 +385,11 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) ...@@ -385,11 +385,11 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
{ {
struct port *p_ptr; struct port *p_ptr;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
msg_set_dest_droppable(&p_ptr->publ.phdr, (isunrejectable != 0)); msg_set_dest_droppable(&p_ptr->publ.phdr, (isunrejectable != 0));
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return TIPC_OK; return TIPC_OK;
} }
...@@ -476,25 +476,25 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) ...@@ -476,25 +476,25 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
/* send self-abort message when rejecting on a connected port */ /* send self-abort message when rejecting on a connected port */
if (msg_connected(msg)) { if (msg_connected(msg)) {
struct sk_buff *abuf = 0; struct sk_buff *abuf = 0;
struct port *p_ptr = port_lock(msg_destport(msg)); struct port *p_ptr = tipc_port_lock(msg_destport(msg));
if (p_ptr) { if (p_ptr) {
if (p_ptr->publ.connected) if (p_ptr->publ.connected)
abuf = port_build_self_abort_msg(p_ptr, err); abuf = port_build_self_abort_msg(p_ptr, err);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
} }
net_route_msg(abuf); tipc_net_route_msg(abuf);
} }
/* send rejected message */ /* send rejected message */
buf_discard(buf); buf_discard(buf);
net_route_msg(rbuf); tipc_net_route_msg(rbuf);
return data_sz; return data_sz;
} }
int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect, struct iovec const *msg_sect, u32 num_sect,
int err) int err)
{ {
struct sk_buff *buf; struct sk_buff *buf;
int res; int res;
...@@ -509,7 +509,7 @@ int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, ...@@ -509,7 +509,7 @@ int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
static void port_timeout(unsigned long ref) static void port_timeout(unsigned long ref)
{ {
struct port *p_ptr = port_lock(ref); struct port *p_ptr = tipc_port_lock(ref);
struct sk_buff *buf = 0; struct sk_buff *buf = 0;
if (!p_ptr || !p_ptr->publ.connected) if (!p_ptr || !p_ptr->publ.connected)
...@@ -532,21 +532,21 @@ static void port_timeout(unsigned long ref) ...@@ -532,21 +532,21 @@ static void port_timeout(unsigned long ref)
p_ptr->probing_state = PROBING; p_ptr->probing_state = PROBING;
k_start_timer(&p_ptr->timer, p_ptr->probing_interval); k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
} }
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
net_route_msg(buf); tipc_net_route_msg(buf);
} }
static void port_handle_node_down(unsigned long ref) static void port_handle_node_down(unsigned long ref)
{ {
struct port *p_ptr = port_lock(ref); struct port *p_ptr = tipc_port_lock(ref);
struct sk_buff* buf = 0; struct sk_buff* buf = 0;
if (!p_ptr) if (!p_ptr)
return; return;
buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE); buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
net_route_msg(buf); tipc_net_route_msg(buf);
} }
...@@ -589,10 +589,10 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err) ...@@ -589,10 +589,10 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err)
0); 0);
} }
void port_recv_proto_msg(struct sk_buff *buf) void tipc_port_recv_proto_msg(struct sk_buff *buf)
{ {
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
struct port *p_ptr = port_lock(msg_destport(msg)); struct port *p_ptr = tipc_port_lock(msg_destport(msg));
u32 err = TIPC_OK; u32 err = TIPC_OK;
struct sk_buff *r_buf = 0; struct sk_buff *r_buf = 0;
struct sk_buff *abort_buf = 0; struct sk_buff *abort_buf = 0;
...@@ -615,11 +615,11 @@ void port_recv_proto_msg(struct sk_buff *buf) ...@@ -615,11 +615,11 @@ void port_recv_proto_msg(struct sk_buff *buf)
} }
} }
if (msg_type(msg) == CONN_ACK) { if (msg_type(msg) == CONN_ACK) {
int wakeup = port_congested(p_ptr) && int wakeup = tipc_port_congested(p_ptr) &&
p_ptr->publ.congested && p_ptr->publ.congested &&
p_ptr->wakeup; p_ptr->wakeup;
p_ptr->acked += msg_msgcnt(msg); p_ptr->acked += msg_msgcnt(msg);
if (port_congested(p_ptr)) if (tipc_port_congested(p_ptr))
goto exit; goto exit;
p_ptr->publ.congested = 0; p_ptr->publ.congested = 0;
if (!wakeup) if (!wakeup)
...@@ -659,9 +659,9 @@ void port_recv_proto_msg(struct sk_buff *buf) ...@@ -659,9 +659,9 @@ void port_recv_proto_msg(struct sk_buff *buf)
port_incr_out_seqno(p_ptr); port_incr_out_seqno(p_ptr);
exit: exit:
if (p_ptr) if (p_ptr)
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
net_route_msg(r_buf); tipc_net_route_msg(r_buf);
net_route_msg(abort_buf); tipc_net_route_msg(abort_buf);
buf_discard(buf); buf_discard(buf);
} }
...@@ -704,7 +704,7 @@ static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id) ...@@ -704,7 +704,7 @@ static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id)
#define MAX_PORT_QUERY 32768 #define MAX_PORT_QUERY 32768
struct sk_buff *port_get_ports(void) struct sk_buff *tipc_port_get_ports(void)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct tlv_desc *rep_tlv; struct tlv_desc *rep_tlv;
...@@ -712,20 +712,20 @@ struct sk_buff *port_get_ports(void) ...@@ -712,20 +712,20 @@ struct sk_buff *port_get_ports(void)
struct port *p_ptr; struct port *p_ptr;
int str_len; int str_len;
buf = cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY)); buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_QUERY));
if (!buf) if (!buf)
return NULL; return NULL;
rep_tlv = (struct tlv_desc *)buf->data; rep_tlv = (struct tlv_desc *)buf->data;
printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY); tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_QUERY);
spin_lock_bh(&port_list_lock); spin_lock_bh(&tipc_port_list_lock);
list_for_each_entry(p_ptr, &ports, port_list) { list_for_each_entry(p_ptr, &ports, port_list) {
spin_lock_bh(p_ptr->publ.lock); spin_lock_bh(p_ptr->publ.lock);
port_print(p_ptr, &pb, 0); port_print(p_ptr, &pb, 0);
spin_unlock_bh(p_ptr->publ.lock); spin_unlock_bh(p_ptr->publ.lock);
} }
spin_unlock_bh(&port_list_lock); spin_unlock_bh(&tipc_port_list_lock);
str_len = printbuf_validate(&pb); str_len = tipc_printbuf_validate(&pb);
skb_put(buf, TLV_SPACE(str_len)); skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
...@@ -752,22 +752,22 @@ struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space) ...@@ -752,22 +752,22 @@ struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space)
ref = *(u32 *)TLV_DATA(req_tlv_area); ref = *(u32 *)TLV_DATA(req_tlv_area);
ref = ntohl(ref); ref = ntohl(ref);
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return cfg_reply_error_string("port not found"); return cfg_reply_error_string("port not found");
buf = cfg_reply_alloc(TLV_SPACE(MAX_PORT_STATS)); buf = tipc_cfg_reply_alloc(TLV_SPACE(MAX_PORT_STATS));
if (!buf) { if (!buf) {
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return NULL; return NULL;
} }
rep_tlv = (struct tlv_desc *)buf->data; rep_tlv = (struct tlv_desc *)buf->data;
printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_STATS); tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), MAX_PORT_STATS);
port_print(p_ptr, &pb, 1); port_print(p_ptr, &pb, 1);
/* NEED TO FILL IN ADDITIONAL PORT STATISTICS HERE */ /* NEED TO FILL IN ADDITIONAL PORT STATISTICS HERE */
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
str_len = printbuf_validate(&pb); str_len = tipc_printbuf_validate(&pb);
skb_put(buf, TLV_SPACE(str_len)); skb_put(buf, TLV_SPACE(str_len));
TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
...@@ -777,19 +777,19 @@ struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space) ...@@ -777,19 +777,19 @@ struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space)
#endif #endif
void port_reinit(void) void tipc_port_reinit(void)
{ {
struct port *p_ptr; struct port *p_ptr;
struct tipc_msg *msg; struct tipc_msg *msg;
spin_lock_bh(&port_list_lock); spin_lock_bh(&tipc_port_list_lock);
list_for_each_entry(p_ptr, &ports, port_list) { list_for_each_entry(p_ptr, &ports, port_list) {
msg = &p_ptr->publ.phdr; msg = &p_ptr->publ.phdr;
if (msg_orignode(msg) == tipc_own_addr) if (msg_orignode(msg) == tipc_own_addr)
break; break;
msg_set_orignode(msg, tipc_own_addr); msg_set_orignode(msg, tipc_own_addr);
} }
spin_unlock_bh(&port_list_lock); spin_unlock_bh(&tipc_port_list_lock);
} }
...@@ -820,7 +820,7 @@ static void port_dispatcher_sigh(void *dummy) ...@@ -820,7 +820,7 @@ static void port_dispatcher_sigh(void *dummy)
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
u32 dref = msg_destport(msg); u32 dref = msg_destport(msg);
p_ptr = port_lock(dref); p_ptr = tipc_port_lock(dref);
if (!p_ptr) { if (!p_ptr) {
/* Port deleted while msg in queue */ /* Port deleted while msg in queue */
tipc_reject_msg(buf, TIPC_ERR_NO_PORT); tipc_reject_msg(buf, TIPC_ERR_NO_PORT);
...@@ -976,7 +976,7 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) ...@@ -976,7 +976,7 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf)
msg_queue_tail = buf; msg_queue_tail = buf;
} else { } else {
msg_queue_tail = msg_queue_head = buf; msg_queue_tail = msg_queue_head = buf;
k_signal((Handler)port_dispatcher_sigh, 0); tipc_k_signal((Handler)port_dispatcher_sigh, 0);
} }
spin_unlock_bh(&queue_lock); spin_unlock_bh(&queue_lock);
return TIPC_OK; return TIPC_OK;
...@@ -994,14 +994,14 @@ static void port_wakeup_sh(unsigned long ref) ...@@ -994,14 +994,14 @@ static void port_wakeup_sh(unsigned long ref)
tipc_continue_event cb = 0; tipc_continue_event cb = 0;
void *uh = 0; void *uh = 0;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (p_ptr) { if (p_ptr) {
up_ptr = p_ptr->user_port; up_ptr = p_ptr->user_port;
if (up_ptr) { if (up_ptr) {
cb = up_ptr->continue_event_cb; cb = up_ptr->continue_event_cb;
uh = up_ptr->usr_handle; uh = up_ptr->usr_handle;
} }
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
} }
if (cb) if (cb)
cb(uh, ref); cb(uh, ref);
...@@ -1010,7 +1010,7 @@ static void port_wakeup_sh(unsigned long ref) ...@@ -1010,7 +1010,7 @@ static void port_wakeup_sh(unsigned long ref)
static void port_wakeup(struct tipc_port *p_ptr) static void port_wakeup(struct tipc_port *p_ptr)
{ {
k_signal((Handler)port_wakeup_sh, p_ptr->ref); tipc_k_signal((Handler)port_wakeup_sh, p_ptr->ref);
} }
void tipc_acknowledge(u32 ref, u32 ack) void tipc_acknowledge(u32 ref, u32 ack)
...@@ -1018,7 +1018,7 @@ void tipc_acknowledge(u32 ref, u32 ack) ...@@ -1018,7 +1018,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
struct port *p_ptr; struct port *p_ptr;
struct sk_buff *buf = 0; struct sk_buff *buf = 0;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return; return;
if (p_ptr->publ.connected) { if (p_ptr->publ.connected) {
...@@ -1033,8 +1033,8 @@ void tipc_acknowledge(u32 ref, u32 ack) ...@@ -1033,8 +1033,8 @@ void tipc_acknowledge(u32 ref, u32 ack)
port_out_seqno(p_ptr), port_out_seqno(p_ptr),
ack); ack);
} }
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
net_route_msg(buf); tipc_net_route_msg(buf);
} }
/* /*
...@@ -1063,7 +1063,7 @@ int tipc_createport(u32 user_ref, ...@@ -1063,7 +1063,7 @@ int tipc_createport(u32 user_ref,
return -ENOMEM; return -ENOMEM;
} }
ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance); ref = tipc_createport_raw(0, port_dispatcher, port_wakeup, importance);
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) { if (!p_ptr) {
kfree(up_ptr); kfree(up_ptr);
return -ENOMEM; return -ENOMEM;
...@@ -1081,10 +1081,10 @@ int tipc_createport(u32 user_ref, ...@@ -1081,10 +1081,10 @@ int tipc_createport(u32 user_ref,
up_ptr->conn_msg_cb = conn_msg_cb; up_ptr->conn_msg_cb = conn_msg_cb;
up_ptr->continue_event_cb = continue_event_cb; up_ptr->continue_event_cb = continue_event_cb;
INIT_LIST_HEAD(&up_ptr->uport_list); INIT_LIST_HEAD(&up_ptr->uport_list);
reg_add_port(up_ptr); tipc_reg_add_port(up_ptr);
*portref = p_ptr->publ.ref; *portref = p_ptr->publ.ref;
dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref); dbg(" tipc_createport: %x with ref %u\n", p_ptr, p_ptr->publ.ref);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return TIPC_OK; return TIPC_OK;
} }
...@@ -1099,7 +1099,7 @@ int tipc_portimportance(u32 ref, unsigned int *importance) ...@@ -1099,7 +1099,7 @@ int tipc_portimportance(u32 ref, unsigned int *importance)
{ {
struct port *p_ptr; struct port *p_ptr;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
*importance = (unsigned int)msg_importance(&p_ptr->publ.phdr); *importance = (unsigned int)msg_importance(&p_ptr->publ.phdr);
...@@ -1114,7 +1114,7 @@ int tipc_set_portimportance(u32 ref, unsigned int imp) ...@@ -1114,7 +1114,7 @@ int tipc_set_portimportance(u32 ref, unsigned int imp)
if (imp > TIPC_CRITICAL_IMPORTANCE) if (imp > TIPC_CRITICAL_IMPORTANCE)
return -EINVAL; return -EINVAL;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
msg_set_importance(&p_ptr->publ.phdr, (u32)imp); msg_set_importance(&p_ptr->publ.phdr, (u32)imp);
...@@ -1130,7 +1130,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1130,7 +1130,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
u32 key; u32 key;
int res = -EINVAL; int res = -EINVAL;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, " dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, "
"lower = %u, upper = %u\n", "lower = %u, upper = %u\n",
ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper); ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper);
...@@ -1147,8 +1147,8 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1147,8 +1147,8 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
res = -EADDRINUSE; res = -EADDRINUSE;
goto exit; goto exit;
} }
publ = nametbl_publish(seq->type, seq->lower, seq->upper, publ = tipc_nametbl_publish(seq->type, seq->lower, seq->upper,
scope, p_ptr->publ.ref, key); scope, p_ptr->publ.ref, key);
if (publ) { if (publ) {
list_add(&publ->pport_list, &p_ptr->publications); list_add(&publ->pport_list, &p_ptr->publications);
p_ptr->pub_count++; p_ptr->pub_count++;
...@@ -1156,7 +1156,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1156,7 +1156,7 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
res = TIPC_OK; res = TIPC_OK;
} }
exit: exit:
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return res; return res;
} }
...@@ -1167,7 +1167,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1167,7 +1167,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
struct publication *tpubl; struct publication *tpubl;
int res = -EINVAL; int res = -EINVAL;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
if (!p_ptr->publ.published) if (!p_ptr->publ.published)
...@@ -1175,8 +1175,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1175,8 +1175,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
if (!seq) { if (!seq) {
list_for_each_entry_safe(publ, tpubl, list_for_each_entry_safe(publ, tpubl,
&p_ptr->publications, pport_list) { &p_ptr->publications, pport_list) {
nametbl_withdraw(publ->type, publ->lower, tipc_nametbl_withdraw(publ->type, publ->lower,
publ->ref, publ->key); publ->ref, publ->key);
} }
res = TIPC_OK; res = TIPC_OK;
} else { } else {
...@@ -1190,8 +1190,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1190,8 +1190,8 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
continue; continue;
if (publ->upper != seq->upper) if (publ->upper != seq->upper)
break; break;
nametbl_withdraw(publ->type, publ->lower, tipc_nametbl_withdraw(publ->type, publ->lower,
publ->ref, publ->key); publ->ref, publ->key);
res = TIPC_OK; res = TIPC_OK;
break; break;
} }
...@@ -1199,7 +1199,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) ...@@ -1199,7 +1199,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
if (list_empty(&p_ptr->publications)) if (list_empty(&p_ptr->publications))
p_ptr->publ.published = 0; p_ptr->publ.published = 0;
exit: exit:
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return res; return res;
} }
...@@ -1209,7 +1209,7 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer) ...@@ -1209,7 +1209,7 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer)
struct tipc_msg *msg; struct tipc_msg *msg;
int res = -EINVAL; int res = -EINVAL;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
if (p_ptr->publ.published || p_ptr->publ.connected) if (p_ptr->publ.published || p_ptr->publ.connected)
...@@ -1234,13 +1234,13 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer) ...@@ -1234,13 +1234,13 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer)
p_ptr->publ.connected = 1; p_ptr->publ.connected = 1;
k_start_timer(&p_ptr->timer, p_ptr->probing_interval); k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
nodesub_subscribe(&p_ptr->subscription,peer->node, tipc_nodesub_subscribe(&p_ptr->subscription,peer->node,
(void *)(unsigned long)ref, (void *)(unsigned long)ref,
(net_ev_handler)port_handle_node_down); (net_ev_handler)port_handle_node_down);
res = TIPC_OK; res = TIPC_OK;
exit: exit:
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
p_ptr->max_pkt = link_get_max_pkt(peer->node, ref); p_ptr->max_pkt = tipc_link_get_max_pkt(peer->node, ref);
return res; return res;
} }
...@@ -1254,16 +1254,16 @@ int tipc_disconnect(u32 ref) ...@@ -1254,16 +1254,16 @@ int tipc_disconnect(u32 ref)
struct port *p_ptr; struct port *p_ptr;
int res = -ENOTCONN; int res = -ENOTCONN;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
if (p_ptr->publ.connected) { if (p_ptr->publ.connected) {
p_ptr->publ.connected = 0; p_ptr->publ.connected = 0;
/* let timer expire on it's own to avoid deadlock! */ /* let timer expire on it's own to avoid deadlock! */
nodesub_unsubscribe(&p_ptr->subscription); tipc_nodesub_unsubscribe(&p_ptr->subscription);
res = TIPC_OK; res = TIPC_OK;
} }
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return res; return res;
} }
...@@ -1275,7 +1275,7 @@ int tipc_shutdown(u32 ref) ...@@ -1275,7 +1275,7 @@ int tipc_shutdown(u32 ref)
struct port *p_ptr; struct port *p_ptr;
struct sk_buff *buf = 0; struct sk_buff *buf = 0;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
...@@ -1293,8 +1293,8 @@ int tipc_shutdown(u32 ref) ...@@ -1293,8 +1293,8 @@ int tipc_shutdown(u32 ref)
port_out_seqno(p_ptr), port_out_seqno(p_ptr),
0); 0);
} }
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
net_route_msg(buf); tipc_net_route_msg(buf);
return tipc_disconnect(ref); return tipc_disconnect(ref);
} }
...@@ -1302,11 +1302,11 @@ int tipc_isconnected(u32 ref, int *isconnected) ...@@ -1302,11 +1302,11 @@ int tipc_isconnected(u32 ref, int *isconnected)
{ {
struct port *p_ptr; struct port *p_ptr;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
*isconnected = p_ptr->publ.connected; *isconnected = p_ptr->publ.connected;
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return TIPC_OK; return TIPC_OK;
} }
...@@ -1315,7 +1315,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer) ...@@ -1315,7 +1315,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer)
struct port *p_ptr; struct port *p_ptr;
int res; int res;
p_ptr = port_lock(ref); p_ptr = tipc_port_lock(ref);
if (!p_ptr) if (!p_ptr)
return -EINVAL; return -EINVAL;
if (p_ptr->publ.connected) { if (p_ptr->publ.connected) {
...@@ -1324,23 +1324,23 @@ int tipc_peer(u32 ref, struct tipc_portid *peer) ...@@ -1324,23 +1324,23 @@ int tipc_peer(u32 ref, struct tipc_portid *peer)
res = TIPC_OK; res = TIPC_OK;
} else } else
res = -ENOTCONN; res = -ENOTCONN;
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
return res; return res;
} }
int tipc_ref_valid(u32 ref) int tipc_ref_valid(u32 ref)
{ {
/* Works irrespective of type */ /* Works irrespective of type */
return !!ref_deref(ref); return !!tipc_ref_deref(ref);
} }
/* /*
* port_recv_sections(): Concatenate and deliver sectioned * tipc_port_recv_sections(): Concatenate and deliver sectioned
* message for this node. * message for this node.
*/ */
int port_recv_sections(struct port *sender, unsigned int num_sect, int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
struct iovec const *msg_sect) struct iovec const *msg_sect)
{ {
struct sk_buff *buf; struct sk_buff *buf;
...@@ -1349,7 +1349,7 @@ int port_recv_sections(struct port *sender, unsigned int num_sect, ...@@ -1349,7 +1349,7 @@ int port_recv_sections(struct port *sender, unsigned int num_sect,
res = msg_build(&sender->publ.phdr, msg_sect, num_sect, res = msg_build(&sender->publ.phdr, msg_sect, num_sect,
MAX_MSG_SIZE, !sender->user_port, &buf); MAX_MSG_SIZE, !sender->user_port, &buf);
if (likely(buf)) if (likely(buf))
port_recv_msg(buf); tipc_port_recv_msg(buf);
return res; return res;
} }
...@@ -1363,18 +1363,18 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect) ...@@ -1363,18 +1363,18 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
u32 destnode; u32 destnode;
int res; int res;
p_ptr = port_deref(ref); p_ptr = tipc_port_deref(ref);
if (!p_ptr || !p_ptr->publ.connected) if (!p_ptr || !p_ptr->publ.connected)
return -EINVAL; return -EINVAL;
p_ptr->publ.congested = 1; p_ptr->publ.congested = 1;
if (!port_congested(p_ptr)) { if (!tipc_port_congested(p_ptr)) {
destnode = port_peernode(p_ptr); destnode = port_peernode(p_ptr);
if (likely(destnode != tipc_own_addr)) if (likely(destnode != tipc_own_addr))
res = link_send_sections_fast(p_ptr, msg_sect, num_sect, res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
destnode); destnode);
else else
res = port_recv_sections(p_ptr, num_sect, msg_sect); res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
if (likely(res != -ELINKCONG)) { if (likely(res != -ELINKCONG)) {
port_incr_out_seqno(p_ptr); port_incr_out_seqno(p_ptr);
...@@ -1404,7 +1404,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) ...@@ -1404,7 +1404,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
u32 sz; u32 sz;
u32 res; u32 res;
p_ptr = port_deref(ref); p_ptr = tipc_port_deref(ref);
if (!p_ptr || !p_ptr->publ.connected) if (!p_ptr || !p_ptr->publ.connected)
return -EINVAL; return -EINVAL;
...@@ -1419,11 +1419,11 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) ...@@ -1419,11 +1419,11 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
memcpy(buf->data, (unchar *)msg, hsz); memcpy(buf->data, (unchar *)msg, hsz);
destnode = msg_destnode(msg); destnode = msg_destnode(msg);
p_ptr->publ.congested = 1; p_ptr->publ.congested = 1;
if (!port_congested(p_ptr)) { if (!tipc_port_congested(p_ptr)) {
if (likely(destnode != tipc_own_addr)) if (likely(destnode != tipc_own_addr))
res = tipc_send_buf_fast(buf, destnode); res = tipc_send_buf_fast(buf, destnode);
else { else {
port_recv_msg(buf); tipc_port_recv_msg(buf);
res = sz; res = sz;
} }
if (likely(res != -ELINKCONG)) { if (likely(res != -ELINKCONG)) {
...@@ -1458,7 +1458,7 @@ int tipc_forward2name(u32 ref, ...@@ -1458,7 +1458,7 @@ int tipc_forward2name(u32 ref,
u32 destport = 0; u32 destport = 0;
int res; int res;
p_ptr = port_deref(ref); p_ptr = tipc_port_deref(ref);
if (!p_ptr || p_ptr->publ.connected) if (!p_ptr || p_ptr->publ.connected)
return -EINVAL; return -EINVAL;
...@@ -1472,16 +1472,16 @@ int tipc_forward2name(u32 ref, ...@@ -1472,16 +1472,16 @@ int tipc_forward2name(u32 ref,
msg_set_lookup_scope(msg, addr_scope(domain)); msg_set_lookup_scope(msg, addr_scope(domain));
if (importance <= TIPC_CRITICAL_IMPORTANCE) if (importance <= TIPC_CRITICAL_IMPORTANCE)
msg_set_importance(msg,importance); msg_set_importance(msg,importance);
destport = nametbl_translate(name->type, name->instance, &destnode); destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
msg_set_destnode(msg, destnode); msg_set_destnode(msg, destnode);
msg_set_destport(msg, destport); msg_set_destport(msg, destport);
if (likely(destport || destnode)) { if (likely(destport || destnode)) {
p_ptr->sent++; p_ptr->sent++;
if (likely(destnode == tipc_own_addr)) if (likely(destnode == tipc_own_addr))
return port_recv_sections(p_ptr, num_sect, msg_sect); return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
res = link_send_sections_fast(p_ptr, msg_sect, num_sect, res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
destnode); destnode);
if (likely(res != -ELINKCONG)) if (likely(res != -ELINKCONG))
return res; return res;
if (port_unreliable(p_ptr)) { if (port_unreliable(p_ptr)) {
...@@ -1490,8 +1490,8 @@ int tipc_forward2name(u32 ref, ...@@ -1490,8 +1490,8 @@ int tipc_forward2name(u32 ref,
} }
return -ELINKCONG; return -ELINKCONG;
} }
return port_reject_sections(p_ptr, msg, msg_sect, num_sect, return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
TIPC_ERR_NO_NAME); TIPC_ERR_NO_NAME);
} }
/** /**
...@@ -1530,7 +1530,7 @@ int tipc_forward_buf2name(u32 ref, ...@@ -1530,7 +1530,7 @@ int tipc_forward_buf2name(u32 ref,
u32 destport = 0; u32 destport = 0;
int res; int res;
p_ptr = (struct port *)ref_deref(ref); p_ptr = (struct port *)tipc_ref_deref(ref);
if (!p_ptr || p_ptr->publ.connected) if (!p_ptr || p_ptr->publ.connected)
return -EINVAL; return -EINVAL;
...@@ -1545,7 +1545,7 @@ int tipc_forward_buf2name(u32 ref, ...@@ -1545,7 +1545,7 @@ int tipc_forward_buf2name(u32 ref,
msg_set_lookup_scope(msg, addr_scope(domain)); msg_set_lookup_scope(msg, addr_scope(domain));
msg_set_hdr_sz(msg, LONG_H_SIZE); msg_set_hdr_sz(msg, LONG_H_SIZE);
msg_set_size(msg, LONG_H_SIZE + dsz); msg_set_size(msg, LONG_H_SIZE + dsz);
destport = nametbl_translate(name->type, name->instance, &destnode); destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
msg_set_destnode(msg, destnode); msg_set_destnode(msg, destnode);
msg_set_destport(msg, destport); msg_set_destport(msg, destport);
msg_dbg(msg, "forw2name ==> "); msg_dbg(msg, "forw2name ==> ");
...@@ -1557,7 +1557,7 @@ int tipc_forward_buf2name(u32 ref, ...@@ -1557,7 +1557,7 @@ int tipc_forward_buf2name(u32 ref,
if (likely(destport || destnode)) { if (likely(destport || destnode)) {
p_ptr->sent++; p_ptr->sent++;
if (destnode == tipc_own_addr) if (destnode == tipc_own_addr)
return port_recv_msg(buf); return tipc_port_recv_msg(buf);
res = tipc_send_buf_fast(buf, destnode); res = tipc_send_buf_fast(buf, destnode);
if (likely(res != -ELINKCONG)) if (likely(res != -ELINKCONG))
return res; return res;
...@@ -1601,7 +1601,7 @@ int tipc_forward2port(u32 ref, ...@@ -1601,7 +1601,7 @@ int tipc_forward2port(u32 ref,
struct tipc_msg *msg; struct tipc_msg *msg;
int res; int res;
p_ptr = port_deref(ref); p_ptr = tipc_port_deref(ref);
if (!p_ptr || p_ptr->publ.connected) if (!p_ptr || p_ptr->publ.connected)
return -EINVAL; return -EINVAL;
...@@ -1616,8 +1616,8 @@ int tipc_forward2port(u32 ref, ...@@ -1616,8 +1616,8 @@ int tipc_forward2port(u32 ref,
msg_set_importance(msg, importance); msg_set_importance(msg, importance);
p_ptr->sent++; p_ptr->sent++;
if (dest->node == tipc_own_addr) if (dest->node == tipc_own_addr)
return port_recv_sections(p_ptr, num_sect, msg_sect); return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
res = link_send_sections_fast(p_ptr, msg_sect, num_sect, dest->node); res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, dest->node);
if (likely(res != -ELINKCONG)) if (likely(res != -ELINKCONG))
return res; return res;
if (port_unreliable(p_ptr)) { if (port_unreliable(p_ptr)) {
...@@ -1658,7 +1658,7 @@ int tipc_forward_buf2port(u32 ref, ...@@ -1658,7 +1658,7 @@ int tipc_forward_buf2port(u32 ref,
struct tipc_msg *msg; struct tipc_msg *msg;
int res; int res;
p_ptr = (struct port *)ref_deref(ref); p_ptr = (struct port *)tipc_ref_deref(ref);
if (!p_ptr || p_ptr->publ.connected) if (!p_ptr || p_ptr->publ.connected)
return -EINVAL; return -EINVAL;
...@@ -1680,7 +1680,7 @@ int tipc_forward_buf2port(u32 ref, ...@@ -1680,7 +1680,7 @@ int tipc_forward_buf2port(u32 ref,
msg_dbg(msg, "buf2port: "); msg_dbg(msg, "buf2port: ");
p_ptr->sent++; p_ptr->sent++;
if (dest->node == tipc_own_addr) if (dest->node == tipc_own_addr)
return port_recv_msg(buf); return tipc_port_recv_msg(buf);
res = tipc_send_buf_fast(buf, dest->node); res = tipc_send_buf_fast(buf, dest->node);
if (likely(res != -ELINKCONG)) if (likely(res != -ELINKCONG))
return res; return res;
......
...@@ -110,65 +110,65 @@ struct port { ...@@ -110,65 +110,65 @@ struct port {
struct node_subscr subscription; struct node_subscr subscription;
}; };
extern spinlock_t port_list_lock; extern spinlock_t tipc_port_list_lock;
struct port_list; struct port_list;
int port_recv_sections(struct port *p_ptr, u32 num_sect, int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
struct iovec const *msg_sect); struct iovec const *msg_sect);
int port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect, struct iovec const *msg_sect, u32 num_sect,
int err); int err);
struct sk_buff *port_get_ports(void); struct sk_buff *tipc_port_get_ports(void);
struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space); struct sk_buff *port_show_stats(const void *req_tlv_area, int req_tlv_space);
void port_recv_proto_msg(struct sk_buff *buf); void tipc_port_recv_proto_msg(struct sk_buff *buf);
void port_recv_mcast(struct sk_buff *buf, struct port_list *dp); void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp);
void port_reinit(void); void tipc_port_reinit(void);
/** /**
* port_lock - lock port instance referred to and return its pointer * tipc_port_lock - lock port instance referred to and return its pointer
*/ */
static inline struct port *port_lock(u32 ref) static inline struct port *tipc_port_lock(u32 ref)
{ {
return (struct port *)ref_lock(ref); return (struct port *)tipc_ref_lock(ref);
} }
/** /**
* port_unlock - unlock a port instance * tipc_port_unlock - unlock a port instance
* *
* Can use pointer instead of ref_unlock() since port is already locked. * Can use pointer instead of tipc_ref_unlock() since port is already locked.
*/ */
static inline void port_unlock(struct port *p_ptr) static inline void tipc_port_unlock(struct port *p_ptr)
{ {
spin_unlock_bh(p_ptr->publ.lock); spin_unlock_bh(p_ptr->publ.lock);
} }
static inline struct port* port_deref(u32 ref) static inline struct port* tipc_port_deref(u32 ref)
{ {
return (struct port *)ref_deref(ref); return (struct port *)tipc_ref_deref(ref);
} }
static inline u32 peer_port(struct port *p_ptr) static inline u32 tipc_peer_port(struct port *p_ptr)
{ {
return msg_destport(&p_ptr->publ.phdr); return msg_destport(&p_ptr->publ.phdr);
} }
static inline u32 peer_node(struct port *p_ptr) static inline u32 tipc_peer_node(struct port *p_ptr)
{ {
return msg_destnode(&p_ptr->publ.phdr); return msg_destnode(&p_ptr->publ.phdr);
} }
static inline int port_congested(struct port *p_ptr) static inline int tipc_port_congested(struct port *p_ptr)
{ {
return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2));
} }
/** /**
* port_recv_msg - receive message from lower layer and deliver to port user * tipc_port_recv_msg - receive message from lower layer and deliver to port user
*/ */
static inline int port_recv_msg(struct sk_buff *buf) static inline int tipc_port_recv_msg(struct sk_buff *buf)
{ {
struct port *p_ptr; struct port *p_ptr;
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
...@@ -178,24 +178,24 @@ static inline int port_recv_msg(struct sk_buff *buf) ...@@ -178,24 +178,24 @@ static inline int port_recv_msg(struct sk_buff *buf)
/* forward unresolved named message */ /* forward unresolved named message */
if (unlikely(!destport)) { if (unlikely(!destport)) {
net_route_msg(buf); tipc_net_route_msg(buf);
return dsz; return dsz;
} }
/* validate destination & pass to port, otherwise reject message */ /* validate destination & pass to port, otherwise reject message */
p_ptr = port_lock(destport); p_ptr = tipc_port_lock(destport);
if (likely(p_ptr)) { if (likely(p_ptr)) {
if (likely(p_ptr->publ.connected)) { if (likely(p_ptr->publ.connected)) {
if ((unlikely(msg_origport(msg) != peer_port(p_ptr))) || if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) ||
(unlikely(msg_orignode(msg) != peer_node(p_ptr))) || (unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) ||
(unlikely(!msg_connected(msg)))) { (unlikely(!msg_connected(msg)))) {
err = TIPC_ERR_NO_PORT; err = TIPC_ERR_NO_PORT;
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
goto reject; goto reject;
} }
} }
err = p_ptr->dispatcher(&p_ptr->publ, buf); err = p_ptr->dispatcher(&p_ptr->publ, buf);
port_unlock(p_ptr); tipc_port_unlock(p_ptr);
if (likely(!err)) if (likely(!err))
return dsz; return dsz;
} else { } else {
......
...@@ -61,15 +61,15 @@ ...@@ -61,15 +61,15 @@
* because entry 0's reference field has the form XXXX|1--1. * because entry 0's reference field has the form XXXX|1--1.
*/ */
struct ref_table ref_table = { 0 }; struct ref_table tipc_ref_table = { 0 };
rwlock_t reftbl_lock = RW_LOCK_UNLOCKED; static rwlock_t ref_table_lock = RW_LOCK_UNLOCKED;
/** /**
* ref_table_init - create reference table for objects * tipc_ref_table_init - create reference table for objects
*/ */
int ref_table_init(u32 requested_size, u32 start) int tipc_ref_table_init(u32 requested_size, u32 start)
{ {
struct reference *table; struct reference *table;
u32 sz = 1 << 4; u32 sz = 1 << 4;
...@@ -83,43 +83,43 @@ int ref_table_init(u32 requested_size, u32 start) ...@@ -83,43 +83,43 @@ int ref_table_init(u32 requested_size, u32 start)
if (table == NULL) if (table == NULL)
return -ENOMEM; return -ENOMEM;
write_lock_bh(&reftbl_lock); write_lock_bh(&ref_table_lock);
index_mask = sz - 1; index_mask = sz - 1;
for (i = sz - 1; i >= 0; i--) { for (i = sz - 1; i >= 0; i--) {
table[i].object = 0; table[i].object = 0;
table[i].lock = SPIN_LOCK_UNLOCKED; table[i].lock = SPIN_LOCK_UNLOCKED;
table[i].data.next_plus_upper = (start & ~index_mask) + i - 1; table[i].data.next_plus_upper = (start & ~index_mask) + i - 1;
} }
ref_table.entries = table; tipc_ref_table.entries = table;
ref_table.index_mask = index_mask; tipc_ref_table.index_mask = index_mask;
ref_table.first_free = sz - 1; tipc_ref_table.first_free = sz - 1;
ref_table.last_free = 1; tipc_ref_table.last_free = 1;
write_unlock_bh(&reftbl_lock); write_unlock_bh(&ref_table_lock);
return TIPC_OK; return TIPC_OK;
} }
/** /**
* ref_table_stop - destroy reference table for objects * tipc_ref_table_stop - destroy reference table for objects
*/ */
void ref_table_stop(void) void tipc_ref_table_stop(void)
{ {
if (!ref_table.entries) if (!tipc_ref_table.entries)
return; return;
vfree(ref_table.entries); vfree(tipc_ref_table.entries);
ref_table.entries = 0; tipc_ref_table.entries = 0;
} }
/** /**
* ref_acquire - create reference to an object * tipc_ref_acquire - create reference to an object
* *
* Return a unique reference value which can be translated back to the pointer * Return a unique reference value which can be translated back to the pointer
* 'object' at a later time. Also, pass back a pointer to the lock protecting * 'object' at a later time. Also, pass back a pointer to the lock protecting
* the object, but without locking it. * the object, but without locking it.
*/ */
u32 ref_acquire(void *object, spinlock_t **lock) u32 tipc_ref_acquire(void *object, spinlock_t **lock)
{ {
struct reference *entry; struct reference *entry;
u32 index; u32 index;
...@@ -127,17 +127,17 @@ u32 ref_acquire(void *object, spinlock_t **lock) ...@@ -127,17 +127,17 @@ u32 ref_acquire(void *object, spinlock_t **lock)
u32 next_plus_upper; u32 next_plus_upper;
u32 reference = 0; u32 reference = 0;
assert(ref_table.entries && object); assert(tipc_ref_table.entries && object);
write_lock_bh(&reftbl_lock); write_lock_bh(&ref_table_lock);
if (ref_table.first_free) { if (tipc_ref_table.first_free) {
index = ref_table.first_free; index = tipc_ref_table.first_free;
entry = &(ref_table.entries[index]); entry = &(tipc_ref_table.entries[index]);
index_mask = ref_table.index_mask; index_mask = tipc_ref_table.index_mask;
/* take lock in case a previous user of entry still holds it */ /* take lock in case a previous user of entry still holds it */
spin_lock_bh(&entry->lock); spin_lock_bh(&entry->lock);
next_plus_upper = entry->data.next_plus_upper; next_plus_upper = entry->data.next_plus_upper;
ref_table.first_free = next_plus_upper & index_mask; tipc_ref_table.first_free = next_plus_upper & index_mask;
reference = (next_plus_upper & ~index_mask) + index; reference = (next_plus_upper & ~index_mask) + index;
entry->data.reference = reference; entry->data.reference = reference;
entry->object = object; entry->object = object;
...@@ -145,45 +145,45 @@ u32 ref_acquire(void *object, spinlock_t **lock) ...@@ -145,45 +145,45 @@ u32 ref_acquire(void *object, spinlock_t **lock)
*lock = &entry->lock; *lock = &entry->lock;
spin_unlock_bh(&entry->lock); spin_unlock_bh(&entry->lock);
} }
write_unlock_bh(&reftbl_lock); write_unlock_bh(&ref_table_lock);
return reference; return reference;
} }
/** /**
* ref_discard - invalidate references to an object * tipc_ref_discard - invalidate references to an object
* *
* Disallow future references to an object and free up the entry for re-use. * Disallow future references to an object and free up the entry for re-use.
* Note: The entry's spin_lock may still be busy after discard * Note: The entry's spin_lock may still be busy after discard
*/ */
void ref_discard(u32 ref) void tipc_ref_discard(u32 ref)
{ {
struct reference *entry; struct reference *entry;
u32 index; u32 index;
u32 index_mask; u32 index_mask;
assert(ref_table.entries); assert(tipc_ref_table.entries);
assert(ref != 0); assert(ref != 0);
write_lock_bh(&reftbl_lock); write_lock_bh(&ref_table_lock);
index_mask = ref_table.index_mask; index_mask = tipc_ref_table.index_mask;
index = ref & index_mask; index = ref & index_mask;
entry = &(ref_table.entries[index]); entry = &(tipc_ref_table.entries[index]);
assert(entry->object != 0); assert(entry->object != 0);
assert(entry->data.reference == ref); assert(entry->data.reference == ref);
/* mark entry as unused */ /* mark entry as unused */
entry->object = 0; entry->object = 0;
if (ref_table.first_free == 0) if (tipc_ref_table.first_free == 0)
ref_table.first_free = index; tipc_ref_table.first_free = index;
else else
/* next_plus_upper is always XXXX|0--0 for last free entry */ /* next_plus_upper is always XXXX|0--0 for last free entry */
ref_table.entries[ref_table.last_free].data.next_plus_upper tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper
|= index; |= index;
ref_table.last_free = index; tipc_ref_table.last_free = index;
/* increment upper bits of entry to invalidate subsequent references */ /* increment upper bits of entry to invalidate subsequent references */
entry->data.next_plus_upper = (ref & ~index_mask) + (index_mask + 1); entry->data.next_plus_upper = (ref & ~index_mask) + (index_mask + 1);
write_unlock_bh(&reftbl_lock); write_unlock_bh(&ref_table_lock);
} }
...@@ -54,7 +54,7 @@ struct reference { ...@@ -54,7 +54,7 @@ struct reference {
}; };
/** /**
* struct ref_table - table of TIPC object reference entries * struct tipc_ref_table - table of TIPC object reference entries
* @entries: pointer to array of reference entries * @entries: pointer to array of reference entries
* @index_mask: bitmask for array index portion of reference values * @index_mask: bitmask for array index portion of reference values
* @first_free: array index of first unused object reference entry * @first_free: array index of first unused object reference entry
...@@ -68,24 +68,24 @@ struct ref_table { ...@@ -68,24 +68,24 @@ struct ref_table {
u32 last_free; u32 last_free;
}; };
extern struct ref_table ref_table; extern struct ref_table tipc_ref_table;
int ref_table_init(u32 requested_size, u32 start); int tipc_ref_table_init(u32 requested_size, u32 start);
void ref_table_stop(void); void tipc_ref_table_stop(void);
u32 ref_acquire(void *object, spinlock_t **lock); u32 tipc_ref_acquire(void *object, spinlock_t **lock);
void ref_discard(u32 ref); void tipc_ref_discard(u32 ref);
/** /**
* ref_lock - lock referenced object and return pointer to it * tipc_ref_lock - lock referenced object and return pointer to it
*/ */
static inline void *ref_lock(u32 ref) static inline void *tipc_ref_lock(u32 ref)
{ {
if (likely(ref_table.entries)) { if (likely(tipc_ref_table.entries)) {
struct reference *r = struct reference *r =
&ref_table.entries[ref & ref_table.index_mask]; &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
spin_lock_bh(&r->lock); spin_lock_bh(&r->lock);
if (likely(r->data.reference == ref)) if (likely(r->data.reference == ref))
...@@ -96,31 +96,31 @@ static inline void *ref_lock(u32 ref) ...@@ -96,31 +96,31 @@ static inline void *ref_lock(u32 ref)
} }
/** /**
* ref_unlock - unlock referenced object * tipc_ref_unlock - unlock referenced object
*/ */
static inline void ref_unlock(u32 ref) static inline void tipc_ref_unlock(u32 ref)
{ {
if (likely(ref_table.entries)) { if (likely(tipc_ref_table.entries)) {
struct reference *r = struct reference *r =
&ref_table.entries[ref & ref_table.index_mask]; &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
if (likely(r->data.reference == ref)) if (likely(r->data.reference == ref))
spin_unlock_bh(&r->lock); spin_unlock_bh(&r->lock);
else else
err("ref_unlock() invoked using obsolete reference\n"); err("tipc_ref_unlock() invoked using obsolete reference\n");
} }
} }
/** /**
* ref_deref - return pointer referenced object (without locking it) * tipc_ref_deref - return pointer referenced object (without locking it)
*/ */
static inline void *ref_deref(u32 ref) static inline void *tipc_ref_deref(u32 ref)
{ {
if (likely(ref_table.entries)) { if (likely(tipc_ref_table.entries)) {
struct reference *r = struct reference *r =
&ref_table.entries[ref & ref_table.index_mask]; &tipc_ref_table.entries[ref & tipc_ref_table.index_mask];
if (likely(r->data.reference == ref)) if (likely(r->data.reference == ref))
return r->object; return r->object;
......
...@@ -1183,7 +1183,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) ...@@ -1183,7 +1183,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) { if (unlikely(msg_errcode(msg) && (sock->state == SS_CONNECTED))) {
sock->state = SS_DISCONNECTING; sock->state = SS_DISCONNECTING;
/* Note: Use signal since port lock is already taken! */ /* Note: Use signal since port lock is already taken! */
k_signal((Handler)async_disconnect, tport->ref); tipc_k_signal((Handler)async_disconnect, tport->ref);
} }
/* Enqueue message (finally!) */ /* Enqueue message (finally!) */
...@@ -1683,11 +1683,11 @@ static struct proto tipc_proto = { ...@@ -1683,11 +1683,11 @@ static struct proto tipc_proto = {
}; };
/** /**
* socket_init - initialize TIPC socket interface * tipc_socket_init - initialize TIPC socket interface
* *
* Returns 0 on success, errno otherwise * Returns 0 on success, errno otherwise
*/ */
int socket_init(void) int tipc_socket_init(void)
{ {
int res; int res;
...@@ -1710,9 +1710,9 @@ int socket_init(void) ...@@ -1710,9 +1710,9 @@ int socket_init(void)
} }
/** /**
* sock_stop - stop TIPC socket interface * tipc_socket_stop - stop TIPC socket interface
*/ */
void socket_stop(void) void tipc_socket_stop(void)
{ {
if (!sockets_enabled) if (!sockets_enabled)
return; return;
......
...@@ -118,14 +118,14 @@ static void subscr_send_event(struct subscription *sub, ...@@ -118,14 +118,14 @@ static void subscr_send_event(struct subscription *sub,
} }
/** /**
* subscr_overlap - test for subscription overlap with the given values * tipc_subscr_overlap - test for subscription overlap with the given values
* *
* Returns 1 if there is overlap, otherwise 0. * Returns 1 if there is overlap, otherwise 0.
*/ */
int subscr_overlap(struct subscription *sub, int tipc_subscr_overlap(struct subscription *sub,
u32 found_lower, u32 found_lower,
u32 found_upper) u32 found_upper)
{ {
if (found_lower < sub->seq.lower) if (found_lower < sub->seq.lower)
...@@ -138,22 +138,22 @@ int subscr_overlap(struct subscription *sub, ...@@ -138,22 +138,22 @@ int subscr_overlap(struct subscription *sub,
} }
/** /**
* subscr_report_overlap - issue event if there is subscription overlap * tipc_subscr_report_overlap - issue event if there is subscription overlap
* *
* Protected by nameseq.lock in name_table.c * Protected by nameseq.lock in name_table.c
*/ */
void subscr_report_overlap(struct subscription *sub, void tipc_subscr_report_overlap(struct subscription *sub,
u32 found_lower, u32 found_lower,
u32 found_upper, u32 found_upper,
u32 event, u32 event,
u32 port_ref, u32 port_ref,
u32 node, u32 node,
int must) int must)
{ {
dbg("Rep overlap %u:%u,%u<->%u,%u\n", sub->seq.type, sub->seq.lower, dbg("Rep overlap %u:%u,%u<->%u,%u\n", sub->seq.type, sub->seq.lower,
sub->seq.upper, found_lower, found_upper); sub->seq.upper, found_lower, found_upper);
if (!subscr_overlap(sub, found_lower, found_upper)) if (!tipc_subscr_overlap(sub, found_lower, found_upper))
return; return;
if (!must && (sub->filter != TIPC_SUB_PORTS)) if (!must && (sub->filter != TIPC_SUB_PORTS))
return; return;
...@@ -172,13 +172,13 @@ static void subscr_timeout(struct subscription *sub) ...@@ -172,13 +172,13 @@ static void subscr_timeout(struct subscription *sub)
/* Validate subscriber reference (in case subscriber is terminating) */ /* Validate subscriber reference (in case subscriber is terminating) */
subscriber_ref = sub->owner->ref; subscriber_ref = sub->owner->ref;
subscriber = (struct subscriber *)ref_lock(subscriber_ref); subscriber = (struct subscriber *)tipc_ref_lock(subscriber_ref);
if (subscriber == NULL) if (subscriber == NULL)
return; return;
/* Unlink subscription from name table */ /* Unlink subscription from name table */
nametbl_unsubscribe(sub); tipc_nametbl_unsubscribe(sub);
/* Notify subscriber of timeout, then unlink subscription */ /* Notify subscriber of timeout, then unlink subscription */
...@@ -192,7 +192,7 @@ static void subscr_timeout(struct subscription *sub) ...@@ -192,7 +192,7 @@ static void subscr_timeout(struct subscription *sub)
/* Now destroy subscription */ /* Now destroy subscription */
ref_unlock(subscriber_ref); tipc_ref_unlock(subscriber_ref);
k_term_timer(&sub->timer); k_term_timer(&sub->timer);
kfree(sub); kfree(sub);
atomic_dec(&topsrv.subscription_count); atomic_dec(&topsrv.subscription_count);
...@@ -216,7 +216,7 @@ static void subscr_terminate(struct subscriber *subscriber) ...@@ -216,7 +216,7 @@ static void subscr_terminate(struct subscriber *subscriber)
/* Invalidate subscriber reference */ /* Invalidate subscriber reference */
ref_discard(subscriber->ref); tipc_ref_discard(subscriber->ref);
spin_unlock_bh(subscriber->lock); spin_unlock_bh(subscriber->lock);
/* Destroy any existing subscriptions for subscriber */ /* Destroy any existing subscriptions for subscriber */
...@@ -227,7 +227,7 @@ static void subscr_terminate(struct subscriber *subscriber) ...@@ -227,7 +227,7 @@ static void subscr_terminate(struct subscriber *subscriber)
k_cancel_timer(&sub->timer); k_cancel_timer(&sub->timer);
k_term_timer(&sub->timer); k_term_timer(&sub->timer);
} }
nametbl_unsubscribe(sub); tipc_nametbl_unsubscribe(sub);
list_del(&sub->subscription_list); list_del(&sub->subscription_list);
dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n", dbg("Term: Removed sub %u,%u,%u from subscriber %x list\n",
sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber); sub->seq.type, sub->seq.lower, sub->seq.upper, subscriber);
...@@ -315,7 +315,7 @@ static void subscr_subscribe(struct tipc_subscr *s, ...@@ -315,7 +315,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
k_start_timer(&sub->timer, sub->timeout); k_start_timer(&sub->timer, sub->timeout);
} }
sub->owner = subscriber; sub->owner = subscriber;
nametbl_subscribe(sub); tipc_nametbl_subscribe(sub);
} }
/** /**
...@@ -332,7 +332,7 @@ static void subscr_conn_shutdown_event(void *usr_handle, ...@@ -332,7 +332,7 @@ static void subscr_conn_shutdown_event(void *usr_handle,
struct subscriber *subscriber; struct subscriber *subscriber;
spinlock_t *subscriber_lock; spinlock_t *subscriber_lock;
subscriber = ref_lock((u32)(unsigned long)usr_handle); subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle);
if (subscriber == NULL) if (subscriber == NULL)
return; return;
...@@ -354,7 +354,7 @@ static void subscr_conn_msg_event(void *usr_handle, ...@@ -354,7 +354,7 @@ static void subscr_conn_msg_event(void *usr_handle,
struct subscriber *subscriber; struct subscriber *subscriber;
spinlock_t *subscriber_lock; spinlock_t *subscriber_lock;
subscriber = ref_lock((u32)(unsigned long)usr_handle); subscriber = tipc_ref_lock((u32)(unsigned long)usr_handle);
if (subscriber == NULL) if (subscriber == NULL)
return; return;
...@@ -401,7 +401,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -401,7 +401,7 @@ static void subscr_named_msg_event(void *usr_handle,
memset(subscriber, 0, sizeof(struct subscriber)); memset(subscriber, 0, sizeof(struct subscriber));
INIT_LIST_HEAD(&subscriber->subscription_list); INIT_LIST_HEAD(&subscriber->subscription_list);
INIT_LIST_HEAD(&subscriber->subscriber_list); INIT_LIST_HEAD(&subscriber->subscriber_list);
subscriber->ref = ref_acquire(subscriber, &subscriber->lock); subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock);
if (subscriber->ref == 0) { if (subscriber->ref == 0) {
warn("Failed to acquire subscriber reference\n"); warn("Failed to acquire subscriber reference\n");
kfree(subscriber); kfree(subscriber);
...@@ -423,7 +423,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -423,7 +423,7 @@ static void subscr_named_msg_event(void *usr_handle,
&subscriber->port_ref); &subscriber->port_ref);
if (subscriber->port_ref == 0) { if (subscriber->port_ref == 0) {
warn("Memory squeeze; failed to create subscription port\n"); warn("Memory squeeze; failed to create subscription port\n");
ref_discard(subscriber->ref); tipc_ref_discard(subscriber->ref);
kfree(subscriber); kfree(subscriber);
return; return;
} }
...@@ -432,7 +432,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -432,7 +432,7 @@ static void subscr_named_msg_event(void *usr_handle,
/* Add subscriber to topology server's subscriber list */ /* Add subscriber to topology server's subscriber list */
ref_lock(subscriber->ref); tipc_ref_lock(subscriber->ref);
spin_lock_bh(&topsrv.lock); spin_lock_bh(&topsrv.lock);
list_add(&subscriber->subscriber_list, &topsrv.subscriber_list); list_add(&subscriber->subscriber_list, &topsrv.subscriber_list);
spin_unlock_bh(&topsrv.lock); spin_unlock_bh(&topsrv.lock);
...@@ -451,7 +451,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -451,7 +451,7 @@ static void subscr_named_msg_event(void *usr_handle,
spin_unlock_bh(subscriber_lock); spin_unlock_bh(subscriber_lock);
} }
int subscr_start(void) int tipc_subscr_start(void)
{ {
struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV}; struct tipc_name_seq seq = {TIPC_TOP_SRV, TIPC_TOP_SRV, TIPC_TOP_SRV};
int res = -1; int res = -1;
...@@ -481,7 +481,7 @@ int subscr_start(void) ...@@ -481,7 +481,7 @@ int subscr_start(void)
if (res) if (res)
goto failed; goto failed;
res = nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq);
if (res) if (res)
goto failed; goto failed;
...@@ -496,7 +496,7 @@ int subscr_start(void) ...@@ -496,7 +496,7 @@ int subscr_start(void)
return res; return res;
} }
void subscr_stop(void) void tipc_subscr_stop(void)
{ {
struct subscriber *subscriber; struct subscriber *subscriber;
struct subscriber *subscriber_temp; struct subscriber *subscriber_temp;
...@@ -507,7 +507,7 @@ void subscr_stop(void) ...@@ -507,7 +507,7 @@ void subscr_stop(void)
list_for_each_entry_safe(subscriber, subscriber_temp, list_for_each_entry_safe(subscriber, subscriber_temp,
&topsrv.subscriber_list, &topsrv.subscriber_list,
subscriber_list) { subscriber_list) {
ref_lock(subscriber->ref); tipc_ref_lock(subscriber->ref);
subscriber_lock = subscriber->lock; subscriber_lock = subscriber->lock;
subscr_terminate(subscriber); subscr_terminate(subscriber);
spin_unlock_bh(subscriber_lock); spin_unlock_bh(subscriber_lock);
...@@ -522,6 +522,6 @@ int tipc_ispublished(struct tipc_name const *name) ...@@ -522,6 +522,6 @@ int tipc_ispublished(struct tipc_name const *name)
{ {
u32 domain = 0; u32 domain = 0;
return(nametbl_translate(name->type, name->instance,&domain) != 0); return(tipc_nametbl_translate(name->type, name->instance,&domain) != 0);
} }
...@@ -60,21 +60,21 @@ struct subscription { ...@@ -60,21 +60,21 @@ struct subscription {
struct subscriber *owner; struct subscriber *owner;
}; };
int subscr_overlap(struct subscription * sub, int tipc_subscr_overlap(struct subscription * sub,
u32 found_lower, u32 found_lower,
u32 found_upper); u32 found_upper);
void subscr_report_overlap(struct subscription * sub, void tipc_subscr_report_overlap(struct subscription * sub,
u32 found_lower, u32 found_lower,
u32 found_upper, u32 found_upper,
u32 event, u32 event,
u32 port_ref, u32 port_ref,
u32 node, u32 node,
int must_report); int must_report);
int subscr_start(void); int tipc_subscr_start(void);
void subscr_stop(void); void tipc_subscr_stop(void);
#endif #endif
...@@ -114,10 +114,10 @@ static void reg_callback(struct tipc_user *user_ptr) ...@@ -114,10 +114,10 @@ static void reg_callback(struct tipc_user *user_ptr)
} }
/** /**
* reg_start - activate TIPC user registry * tipc_reg_start - activate TIPC user registry
*/ */
int reg_start(void) int tipc_reg_start(void)
{ {
u32 u; u32 u;
int res; int res;
...@@ -127,17 +127,17 @@ int reg_start(void) ...@@ -127,17 +127,17 @@ int reg_start(void)
for (u = 1; u <= MAX_USERID; u++) { for (u = 1; u <= MAX_USERID; u++) {
if (users[u].callback) if (users[u].callback)
k_signal((Handler)reg_callback, tipc_k_signal((Handler)reg_callback,
(unsigned long)&users[u]); (unsigned long)&users[u]);
} }
return TIPC_OK; return TIPC_OK;
} }
/** /**
* reg_stop - shut down & delete TIPC user registry * tipc_reg_stop - shut down & delete TIPC user registry
*/ */
void reg_stop(void) void tipc_reg_stop(void)
{ {
int id; int id;
...@@ -184,7 +184,7 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle) ...@@ -184,7 +184,7 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
atomic_inc(&tipc_user_count); atomic_inc(&tipc_user_count);
if (cb && (tipc_mode != TIPC_NOT_RUNNING)) if (cb && (tipc_mode != TIPC_NOT_RUNNING))
k_signal((Handler)reg_callback, (unsigned long)user_ptr); tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr);
return TIPC_OK; return TIPC_OK;
} }
...@@ -223,10 +223,10 @@ void tipc_detach(u32 userid) ...@@ -223,10 +223,10 @@ void tipc_detach(u32 userid)
} }
/** /**
* reg_add_port - register a user's driver port * tipc_reg_add_port - register a user's driver port
*/ */
int reg_add_port(struct user_port *up_ptr) int tipc_reg_add_port(struct user_port *up_ptr)
{ {
struct tipc_user *user_ptr; struct tipc_user *user_ptr;
...@@ -245,10 +245,10 @@ int reg_add_port(struct user_port *up_ptr) ...@@ -245,10 +245,10 @@ int reg_add_port(struct user_port *up_ptr)
} }
/** /**
* reg_remove_port - deregister a user's driver port * tipc_reg_remove_port - deregister a user's driver port
*/ */
int reg_remove_port(struct user_port *up_ptr) int tipc_reg_remove_port(struct user_port *up_ptr)
{ {
if (up_ptr->user_ref == 0) if (up_ptr->user_ref == 0)
return TIPC_OK; return TIPC_OK;
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
#include "port.h" #include "port.h"
int reg_start(void); int tipc_reg_start(void);
void reg_stop(void); void tipc_reg_stop(void);
int reg_add_port(struct user_port *up_ptr); int tipc_reg_add_port(struct user_port *up_ptr);
int reg_remove_port(struct user_port *up_ptr); int tipc_reg_remove_port(struct user_port *up_ptr);
#endif #endif
...@@ -42,12 +42,12 @@ ...@@ -42,12 +42,12 @@
#include "cluster.h" #include "cluster.h"
#include "node.h" #include "node.h"
struct _zone *zone_create(u32 addr) struct _zone *tipc_zone_create(u32 addr)
{ {
struct _zone *z_ptr = 0; struct _zone *z_ptr = 0;
u32 z_num; u32 z_num;
if (!addr_domain_valid(addr)) if (!tipc_addr_domain_valid(addr))
return 0; return 0;
z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC); z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
...@@ -55,24 +55,24 @@ struct _zone *zone_create(u32 addr) ...@@ -55,24 +55,24 @@ struct _zone *zone_create(u32 addr)
memset(z_ptr, 0, sizeof(*z_ptr)); memset(z_ptr, 0, sizeof(*z_ptr));
z_num = tipc_zone(addr); z_num = tipc_zone(addr);
z_ptr->addr = tipc_addr(z_num, 0, 0); z_ptr->addr = tipc_addr(z_num, 0, 0);
net.zones[z_num] = z_ptr; tipc_net.zones[z_num] = z_ptr;
} }
return z_ptr; return z_ptr;
} }
void zone_delete(struct _zone *z_ptr) void tipc_zone_delete(struct _zone *z_ptr)
{ {
u32 c_num; u32 c_num;
if (!z_ptr) if (!z_ptr)
return; return;
for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
cluster_delete(z_ptr->clusters[c_num]); tipc_cltr_delete(z_ptr->clusters[c_num]);
} }
kfree(z_ptr); kfree(z_ptr);
} }
void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr) void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
{ {
u32 c_num = tipc_cluster(c_ptr->addr); u32 c_num = tipc_cluster(c_ptr->addr);
...@@ -82,19 +82,19 @@ void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr) ...@@ -82,19 +82,19 @@ void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
z_ptr->clusters[c_num] = c_ptr; z_ptr->clusters[c_num] = c_ptr;
} }
void zone_remove_as_router(struct _zone *z_ptr, u32 router) void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router)
{ {
u32 c_num; u32 c_num;
for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
if (z_ptr->clusters[c_num]) { if (z_ptr->clusters[c_num]) {
cluster_remove_as_router(z_ptr->clusters[c_num], tipc_cltr_remove_as_router(z_ptr->clusters[c_num],
router); router);
} }
} }
} }
void zone_send_external_routes(struct _zone *z_ptr, u32 dest) void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest)
{ {
u32 c_num; u32 c_num;
...@@ -102,12 +102,12 @@ void zone_send_external_routes(struct _zone *z_ptr, u32 dest) ...@@ -102,12 +102,12 @@ void zone_send_external_routes(struct _zone *z_ptr, u32 dest)
if (z_ptr->clusters[c_num]) { if (z_ptr->clusters[c_num]) {
if (in_own_cluster(z_ptr->addr)) if (in_own_cluster(z_ptr->addr))
continue; continue;
cluster_send_ext_routes(z_ptr->clusters[c_num], dest); tipc_cltr_send_ext_routes(z_ptr->clusters[c_num], dest);
} }
} }
} }
struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
{ {
struct cluster *c_ptr; struct cluster *c_ptr;
struct node *n_ptr; struct node *n_ptr;
...@@ -118,7 +118,7 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) ...@@ -118,7 +118,7 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
c_ptr = z_ptr->clusters[tipc_cluster(addr)]; c_ptr = z_ptr->clusters[tipc_cluster(addr)];
if (!c_ptr) if (!c_ptr)
return 0; return 0;
n_ptr = cluster_select_node(c_ptr, ref); n_ptr = tipc_cltr_select_node(c_ptr, ref);
if (n_ptr) if (n_ptr)
return n_ptr; return n_ptr;
...@@ -127,14 +127,14 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref) ...@@ -127,14 +127,14 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
c_ptr = z_ptr->clusters[c_num]; c_ptr = z_ptr->clusters[c_num];
if (!c_ptr) if (!c_ptr)
return 0; return 0;
n_ptr = cluster_select_node(c_ptr, ref); n_ptr = tipc_cltr_select_node(c_ptr, ref);
if (n_ptr) if (n_ptr)
return n_ptr; return n_ptr;
} }
return 0; return 0;
} }
u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
{ {
struct cluster *c_ptr; struct cluster *c_ptr;
u32 c_num; u32 c_num;
...@@ -143,14 +143,14 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) ...@@ -143,14 +143,14 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
if (!z_ptr) if (!z_ptr)
return 0; return 0;
c_ptr = z_ptr->clusters[tipc_cluster(addr)]; c_ptr = z_ptr->clusters[tipc_cluster(addr)];
router = c_ptr ? cluster_select_router(c_ptr, ref) : 0; router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
if (router) if (router)
return router; return router;
/* Links to any other clusters within the zone? */ /* Links to any other clusters within the zone? */
for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
c_ptr = z_ptr->clusters[c_num]; c_ptr = z_ptr->clusters[c_num];
router = c_ptr ? cluster_select_router(c_ptr, ref) : 0; router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
if (router) if (router)
return router; return router;
} }
...@@ -158,12 +158,12 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref) ...@@ -158,12 +158,12 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
} }
u32 zone_next_node(u32 addr) u32 tipc_zone_next_node(u32 addr)
{ {
struct cluster *c_ptr = cluster_find(addr); struct cluster *c_ptr = tipc_cltr_find(addr);
if (c_ptr) if (c_ptr)
return cluster_next_node(c_ptr, addr); return tipc_cltr_next_node(c_ptr, addr);
return 0; return 0;
} }
...@@ -54,18 +54,18 @@ struct _zone { ...@@ -54,18 +54,18 @@ struct _zone {
u32 links; u32 links;
}; };
struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref); struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref);
u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref); u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref);
void zone_remove_as_router(struct _zone *z_ptr, u32 router); void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router);
void zone_send_external_routes(struct _zone *z_ptr, u32 dest); void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest);
struct _zone *zone_create(u32 addr); struct _zone *tipc_zone_create(u32 addr);
void zone_delete(struct _zone *z_ptr); void tipc_zone_delete(struct _zone *z_ptr);
void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr); void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
u32 zone_next_node(u32 addr); u32 tipc_zone_next_node(u32 addr);
static inline struct _zone *zone_find(u32 addr) static inline struct _zone *tipc_zone_find(u32 addr)
{ {
return net.zones[tipc_zone(addr)]; return tipc_net.zones[tipc_zone(addr)];
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment