From c43072852649d8382b81237ce51195bcec36f24a Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Fri, 9 Feb 2007 23:25:21 +0900 Subject: [PATCH] [NET] TIPC: Fix whitespace errors. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- net/tipc/addr.c | 14 +- net/tipc/addr.h | 6 +- net/tipc/bcast.c | 98 +++++----- net/tipc/bcast.h | 6 +- net/tipc/bearer.c | 58 +++--- net/tipc/bearer.h | 22 +-- net/tipc/cluster.c | 22 +-- net/tipc/cluster.h | 4 +- net/tipc/config.c | 16 +- net/tipc/config.h | 8 +- net/tipc/core.c | 18 +- net/tipc/core.h | 40 ++-- net/tipc/dbg.c | 56 +++--- net/tipc/dbg.h | 2 +- net/tipc/discover.c | 50 ++--- net/tipc/discover.h | 2 +- net/tipc/eth_media.c | 58 +++--- net/tipc/handler.c | 6 +- net/tipc/link.c | 394 ++++++++++++++++++------------------- net/tipc/link.h | 32 ++-- net/tipc/msg.c | 2 +- net/tipc/msg.h | 138 ++++++------- net/tipc/name_distr.c | 64 +++---- net/tipc/name_distr.h | 2 +- net/tipc/name_table.c | 106 +++++----- net/tipc/name_table.h | 10 +- net/tipc/net.c | 74 +++---- net/tipc/net.h | 4 +- net/tipc/netlink.c | 16 +- net/tipc/node.c | 216 ++++++++++----------- net/tipc/node.h | 8 +- net/tipc/node_subscr.c | 6 +- net/tipc/node_subscr.h | 2 +- net/tipc/port.c | 224 +++++++++++----------- net/tipc/port.h | 28 +-- net/tipc/ref.c | 24 +-- net/tipc/ref.h | 8 +- net/tipc/socket.c | 426 ++++++++++++++++++++--------------------- net/tipc/subscr.c | 82 ++++---- net/tipc/subscr.h | 16 +- net/tipc/user_reg.c | 22 +-- net/tipc/user_reg.h | 2 +- net/tipc/zone.c | 4 +- net/tipc/zone.h | 4 +- 44 files changed, 1200 insertions(+), 1200 deletions(-) diff --git a/net/tipc/addr.c b/net/tipc/addr.c index 0be25e175b9..e5207a11edf 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c @@ -1,6 +1,6 @@ /* * net/tipc/addr.c: TIPC address utility routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -48,10 +48,10 @@ u32 tipc_get_addr(void) /** * tipc_addr_domain_valid - validates a network domain address - * - * Accepts , , , and <0.0.0>, + * + * Accepts , , , and <0.0.0>, * where Z, C, and N are non-zero and do not exceed the configured limits. - * + * * Returns 1 if domain address is valid, otherwise 0 */ @@ -80,10 +80,10 @@ int tipc_addr_domain_valid(u32 addr) /** * tipc_addr_node_valid - validates a proposed network address for this node - * - * Accepts , where Z, C, and N are non-zero and do not exceed + * + * Accepts , where Z, C, and N are non-zero and do not exceed * the configured limits. - * + * * Returns 1 if address can be used, otherwise 0 */ diff --git a/net/tipc/addr.h b/net/tipc/addr.h index bcfebb3cbbf..e4bd5335e48 100644 --- a/net/tipc/addr.h +++ b/net/tipc/addr.h @@ -1,6 +1,6 @@ /* * net/tipc/addr.h: Include file for TIPC address utility routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -100,8 +100,8 @@ static inline int addr_scope(u32 domain) /** * addr_domain - convert 2-bit scope value to equivalent message lookup domain - * - * Needed when address of a named message must be looked up a second time + * + * Needed when address of a named message must be looked up a second time * after a network hop. */ diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 730c5c47ed8..e7880172ef1 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c @@ -1,6 +1,6 @@ /* * net/tipc/bcast.c: TIPC broadcast code - * + * * Copyright (c) 2004-2006, Ericsson AB * Copyright (c) 2004, Intel Corporation. * Copyright (c) 2005, Wind River Systems @@ -59,15 +59,15 @@ * Loss rate for incoming broadcast frames; used to test retransmission code. * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. */ - + #define TIPC_BCAST_LOSS_RATE 0 /** * struct bcbearer_pair - a pair of bearers used by broadcast link * @primary: pointer to primary bearer * @secondary: pointer to secondary bearer - * - * Bearers must have same priority and same set of reachable destinations + * + * Bearers must have same priority and same set of reachable destinations * to be paired. */ @@ -84,7 +84,7 @@ struct bcbearer_pair { * @bpairs_temp: temporary array of bearer pairs used by tipc_bcbearer_sort() * @remains: temporary node map used by tipc_bcbearer_send() * @remains_new: temporary node map used tipc_bcbearer_send() - * + * * Note: The fields labelled "temporary" are incorporated into the bearer * to avoid consuming potentially limited stack space through the use of * large local variables within multicast routines. Concurrent access is @@ -104,7 +104,7 @@ struct bcbearer { * struct bclink - link used for broadcast messages * @link: (non-standard) broadcast link structure * @node: (non-standard) node structure representing b'cast link's peer node - * + * * Handles sequence numbering, fragmentation, bundling, etc. */ @@ -125,7 +125,7 @@ char tipc_bclink_name[] = "multicast-link"; static u32 buf_seqno(struct sk_buff *buf) { return msg_seqno(buf_msg(buf)); -} +} static u32 bcbuf_acks(struct sk_buff *buf) { @@ -143,9 +143,9 @@ static void bcbuf_decr_acks(struct sk_buff *buf) } -/** +/** * bclink_set_gap - set gap according to contents of current deferred pkt queue - * + * * Called with 'node' locked, bc_lock unlocked */ @@ -159,14 +159,14 @@ static void bclink_set_gap(struct node *n_ptr) n_ptr->bclink.gap_to = mod(buf_seqno(buf) - 1); } -/** +/** * bclink_ack_allowed - test if ACK or NACK message can be sent at this moment - * + * * This mechanism endeavours to prevent all nodes in network from trying * to ACK or NACK at the same time. - * + * * Note: TIPC uses a different trigger to distribute ACKs than it does to - * distribute NACKs, but tries to use the same spacing (divide by 16). + * distribute NACKs, but tries to use the same spacing (divide by 16). */ static int bclink_ack_allowed(u32 n) @@ -175,11 +175,11 @@ static int bclink_ack_allowed(u32 n) } -/** +/** * bclink_retransmit_pkt - retransmit broadcast packets * @after: sequence number of last packet to *not* retransmit * @to: sequence number of last packet to retransmit - * + * * Called with bc_lock locked */ @@ -189,16 +189,16 @@ static void bclink_retransmit_pkt(u32 after, u32 to) buf = bcl->first_out; while (buf && less_eq(buf_seqno(buf), after)) { - buf = buf->next; + buf = buf->next; } tipc_link_retransmit(bcl, buf, mod(to - after)); } -/** +/** * tipc_bclink_acknowledge - handle acknowledgement of broadcast packets * @n_ptr: node that sent acknowledgement info * @acked: broadcast sequence # that has been acknowledged - * + * * Node is locked, bc_lock unlocked. */ @@ -244,9 +244,9 @@ void tipc_bclink_acknowledge(struct node *n_ptr, u32 acked) spin_unlock_bh(&bc_lock); } -/** +/** * bclink_send_ack - unicast an ACK msg - * + * * tipc_net_lock and node lock set */ @@ -258,9 +258,9 @@ static void bclink_send_ack(struct node *n_ptr) tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); } -/** +/** * bclink_send_nack- broadcast a NACK msg - * + * * tipc_net_lock and node lock set */ @@ -278,7 +278,7 @@ static void bclink_send_nack(struct node *n_ptr) msg_init(msg, BCAST_PROTOCOL, STATE_MSG, TIPC_OK, INT_H_SIZE, n_ptr->addr); msg_set_mc_netid(msg, tipc_net_id); - msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); + msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); msg_set_bcgap_to(msg, n_ptr->bclink.gap_to); msg_set_bcast_tag(msg, tipc_own_tag); @@ -292,17 +292,17 @@ static void bclink_send_nack(struct node *n_ptr) bcl->stats.bearer_congs++; } - /* + /* * Ensure we doesn't send another NACK msg to the node * until 16 more deferred messages arrive from it * (i.e. helps prevent all nodes from NACK'ing at same time) */ - + n_ptr->bclink.nack_sync = tipc_own_tag; } } -/** +/** * tipc_bclink_check_gap - send a NACK if a sequence gap exists * * tipc_net_lock and node lock set @@ -320,9 +320,9 @@ void tipc_bclink_check_gap(struct node *n_ptr, u32 last_sent) bclink_send_nack(n_ptr); } -/** +/** * tipc_bclink_peek_nack - process a NACK msg meant for another node - * + * * Only tipc_net_lock set. */ @@ -349,7 +349,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g if (less_eq(my_to, gap_to)) n_ptr->bclink.gap_to = gap_after; } else { - /* + /* * Expand gap if missing bufs not in deferred queue: */ struct sk_buff *buf = n_ptr->bclink.deferred_head; @@ -371,7 +371,7 @@ static void tipc_bclink_peek_nack(u32 dest, u32 sender_tag, u32 gap_after, u32 g } /* * Some nodes may send a complementary NACK now: - */ + */ if (bclink_ack_allowed(sender_tag + 1)) { if (n_ptr->bclink.gap_to != n_ptr->bclink.gap_after) { bclink_send_nack(n_ptr); @@ -408,7 +408,7 @@ int tipc_bclink_send_msg(struct sk_buff *buf) /** * tipc_bclink_recv_pkt - receive a broadcast packet, and deliver upwards - * + * * tipc_net_lock is read_locked, no other locks set */ @@ -425,7 +425,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) msg_dbg(msg, "bclink.supported || + if (unlikely(!node || !tipc_node_is_up(node) || !node->bclink.supported || (msg_mc_netid(msg) != tipc_net_id))) { buf_discard(buf); return; @@ -443,7 +443,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) bclink_retransmit_pkt(msg_bcgap_after(msg), msg_bcgap_to(msg)); bcl->owner->next = NULL; - spin_unlock_bh(&bc_lock); + spin_unlock_bh(&bc_lock); } else { tipc_bclink_peek_nack(msg_destnode(msg), msg_bcast_tag(msg), @@ -547,10 +547,10 @@ u32 tipc_bclink_acks_missing(struct node *n_ptr) /** * tipc_bcbearer_send - send a packet through the broadcast pseudo-bearer - * + * * Send through as many bearers as necessary to reach all nodes * that support TIPC multicasting. - * + * * Returns 0 if packet sent successfully, non-zero if not */ @@ -581,7 +581,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf, send_count = 0; /* Send buffer over bearers until all targets reached */ - + bcbearer->remains = tipc_cltr_bcast_nodes; for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { @@ -615,7 +615,7 @@ update: bcbearer->remains = bcbearer->remains_new; } - + /* Unable to reach all targets */ bcbearer->bearer.publ.blocked = 1; @@ -682,7 +682,7 @@ void tipc_bcbearer_sort(void) /** * tipc_bcbearer_push - resolve bearer congestion - * + * * Forces bclink to push out any unsent packets, until all packets are gone * or congestion reoccurs. * No locks set when function called @@ -714,27 +714,27 @@ int tipc_bclink_stats(char *buf, const u32 buf_size) spin_lock_bh(&bc_lock); tipc_printf(&pb, "Link <%s>\n" - " Window:%u packets\n", + " Window:%u packets\n", bcl->name, bcl->queue_limit[0]); - tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", bcl->stats.recv_info, bcl->stats.recv_fragments, bcl->stats.recv_fragmented, bcl->stats.recv_bundles, bcl->stats.recv_bundled); - tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", bcl->stats.sent_info, bcl->stats.sent_fragments, - bcl->stats.sent_fragmented, + bcl->stats.sent_fragmented, bcl->stats.sent_bundles, bcl->stats.sent_bundled); - tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n", + tipc_printf(&pb, " RX naks:%u defs:%u dups:%u\n", bcl->stats.recv_nacks, - bcl->stats.deferred_recv, + bcl->stats.deferred_recv, bcl->stats.duplicates); - tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n", - bcl->stats.sent_nacks, - bcl->stats.sent_acks, + tipc_printf(&pb, " TX naks:%u acks:%u dups:%u\n", + bcl->stats.sent_nacks, + bcl->stats.sent_acks, bcl->stats.retransmitted); tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", bcl->stats.bearer_congs, @@ -778,7 +778,7 @@ int tipc_bclink_init(void) bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); if (!bcbearer || !bclink) { nomem: - warn("Multicast link creation failed, no memory\n"); + warn("Multicast link creation failed, no memory\n"); kfree(bcbearer); bcbearer = NULL; kfree(bclink); @@ -796,7 +796,7 @@ int tipc_bclink_init(void) bcl->next_out_no = 1; spin_lock_init(&bclink->node.lock); bcl->owner = &bclink->node; - bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; + bcl->max_pkt = MAX_PKT_DEFAULT_MCAST; tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT); bcl->b_ptr = &bcbearer->bearer; bcl->state = WORKING_WORKING; diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h index b243d9d495f..f910ed29d05 100644 --- a/net/tipc/bcast.h +++ b/net/tipc/bcast.h @@ -1,6 +1,6 @@ /* * net/tipc/bcast.h: Include file for TIPC broadcast code - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -102,7 +102,7 @@ static inline void tipc_nmap_add(struct node_map *nm_ptr, u32 node) } } -/** +/** * nmap_remove - remove a node from a node map */ @@ -190,7 +190,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) /** * port_list_free - free dynamically created entries in port_list chain - * + * * Note: First item is on stack, so it doesn't need to be released */ diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 39744a33bd3..271a375b49b 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -1,6 +1,6 @@ /* * net/tipc/bearer.c: TIPC bearer code - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -52,7 +52,7 @@ struct bearer *tipc_bearers = NULL; /** * media_name_valid - validate media name - * + * * Returns 1 if media name is valid, otherwise 0. */ @@ -84,17 +84,17 @@ static struct media *media_find(const char *name) /** * tipc_register_media - register a media type - * + * * Bearers for this media type must be activated separately at a later stage. */ int tipc_register_media(u32 media_type, - char *name, - int (*enable)(struct tipc_bearer *), - void (*disable)(struct tipc_bearer *), - int (*send_msg)(struct sk_buff *, + char *name, + int (*enable)(struct tipc_bearer *), + void (*disable)(struct tipc_bearer *), + int (*send_msg)(struct sk_buff *, struct tipc_bearer *, - struct tipc_media_addr *), + struct tipc_media_addr *), char *(*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size), struct tipc_media_addr *bcast_addr, @@ -121,11 +121,11 @@ int tipc_register_media(u32 media_type, } if ((bearer_priority < TIPC_MIN_LINK_PRI) && (bearer_priority > TIPC_MAX_LINK_PRI)) { - warn("Media <%s> rejected, illegal priority (%u)\n", name, + warn("Media <%s> rejected, illegal priority (%u)\n", name, bearer_priority); goto exit; } - if ((link_tolerance < TIPC_MIN_LINK_TOL) || + if ((link_tolerance < TIPC_MIN_LINK_TOL) || (link_tolerance > TIPC_MAX_LINK_TOL)) { warn("Media <%s> rejected, illegal tolerance (%u)\n", name, link_tolerance); @@ -219,7 +219,7 @@ struct sk_buff *tipc_media_get_names(void) read_lock_bh(&tipc_net_lock); for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { - tipc_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); } read_unlock_bh(&tipc_net_lock); @@ -230,11 +230,11 @@ struct sk_buff *tipc_media_get_names(void) * bearer_name_validate - validate & (optionally) deconstruct bearer name * @name - ptr to bearer name string * @name_parts - ptr to area for bearer name components (or NULL if not needed) - * + * * Returns 1 if bearer name is valid, otherwise 0. */ -static int bearer_name_validate(const char *name, +static int bearer_name_validate(const char *name, struct bearer_name *name_parts) { char name_copy[TIPC_MAX_BEARER_NAME]; @@ -262,8 +262,8 @@ static int bearer_name_validate(const char *name, /* validate component parts of bearer name */ - if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || - (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || + if ((media_len <= 1) || (media_len > TIPC_MAX_MEDIA_NAME) || + (if_len <= 1) || (if_len > TIPC_MAX_IF_NAME) || (strspn(media_name, tipc_alphabet) != (media_len - 1)) || (strspn(if_name, tipc_alphabet) != (if_len - 1))) return 0; @@ -336,8 +336,8 @@ struct sk_buff *tipc_bearer_get_names(void) for (j = 0; j < MAX_BEARERS; j++) { b_ptr = &tipc_bearers[j]; if (b_ptr->active && (b_ptr->media == m_ptr)) { - tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, - b_ptr->publ.name, + tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, + b_ptr->publ.name, strlen(b_ptr->publ.name) + 1); } } @@ -401,8 +401,8 @@ void tipc_bearer_lock_push(struct bearer *b_ptr) /* - * Interrupt enabling new requests after bearer congestion or blocking: - * See bearer_send(). + * Interrupt enabling new requests after bearer congestion or blocking: + * See bearer_send(). */ void tipc_continue(struct tipc_bearer *tb_ptr) { @@ -417,9 +417,9 @@ void tipc_continue(struct tipc_bearer *tb_ptr) } /* - * Schedule link for sending of messages after the bearer - * has been deblocked by 'continue()'. This method is called - * when somebody tries to send a message via this link while + * Schedule link for sending of messages after the bearer + * has been deblocked by 'continue()'. This method is called + * when somebody tries to send a message via this link while * the bearer is congested. 'tipc_net_lock' is in read_lock here * bearer.lock is busy */ @@ -430,9 +430,9 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p } /* - * Schedule link for sending of messages after the bearer - * has been deblocked by 'continue()'. This method is called - * when somebody tries to send a message via this link while + * Schedule link for sending of messages after the bearer + * has been deblocked by 'continue()'. This method is called + * when somebody tries to send a message via this link while * the bearer is congested. 'tipc_net_lock' is in read_lock here, * bearer.lock is free */ @@ -468,7 +468,7 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) /** * tipc_enable_bearer - enable bearer with the given name - */ + */ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) { @@ -490,7 +490,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) warn("Bearer <%s> rejected, illegal name\n", name); return -EINVAL; } - if (!tipc_addr_domain_valid(bcast_scope) || + if (!tipc_addr_domain_valid(bcast_scope) || !in_scope(bcast_scope, tipc_own_addr)) { warn("Bearer <%s> rejected, illegal broadcast scope\n", name); return -EINVAL; @@ -539,7 +539,7 @@ restart: } } if (bearer_id >= MAX_BEARERS) { - warn("Bearer <%s> rejected, bearer limit reached (%u)\n", + warn("Bearer <%s> rejected, bearer limit reached (%u)\n", name, MAX_BEARERS); goto failed; } @@ -612,7 +612,7 @@ int tipc_block_bearer(const char *name) /** * bearer_disable - - * + * * Note: This routine assumes caller holds tipc_net_lock. */ diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index c4e7c1c3655..6a36b6600e6 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h @@ -1,6 +1,6 @@ /* * net/tipc/bearer.h: Include file for TIPC bearer code - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -58,14 +58,14 @@ * @type_id: TIPC media identifier [defined in tipc_bearer.h] * @name: media name */ - + struct media { - int (*send_msg)(struct sk_buff *buf, + int (*send_msg)(struct sk_buff *buf, struct tipc_bearer *b_ptr, struct tipc_media_addr *dest); int (*enable_bearer)(struct tipc_bearer *b_ptr); void (*disable_bearer)(struct tipc_bearer *b_ptr); - char *(*addr2str)(struct tipc_media_addr *a, + char *(*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size); struct tipc_media_addr bcast_addr; int bcast; @@ -91,7 +91,7 @@ struct media { * @net_plane: network plane ('A' through 'H') currently associated with bearer * @nodes: indicates which nodes in cluster can be reached through bearer */ - + struct bearer { struct tipc_bearer publ; struct media *media; @@ -131,21 +131,21 @@ void tipc_bearer_lock_push(struct bearer *b_ptr); /** - * tipc_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 - * + * * IMPORTANT: * The media send routine must not alter the buffer being passed in * as it may be needed for later retransmission! - * - * If the media send routine returns a non-zero value (indicating that + * + * If the media send routine returns a non-zero value (indicating that * it was unable to send the buffer), it must: * 1) mark the bearer as blocked, * 2) call tipc_continue() once the bearer is able to send again. * Media types that are unable to meet these two critera must ensure their * send routine always returns success -- even if the buffer was not sent -- - * 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 tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c index b46b5188a9f..95b373913aa 100644 --- a/net/tipc/cluster.c +++ b/net/tipc/cluster.c @@ -1,6 +1,6 @@ /* * net/tipc/cluster.c: TIPC cluster management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -56,7 +56,7 @@ struct cluster *tipc_cltr_create(u32 addr) { struct _zone *z_ptr; struct cluster *c_ptr; - int max_nodes; + int max_nodes; c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC); if (c_ptr == NULL) { @@ -81,7 +81,7 @@ struct cluster *tipc_cltr_create(u32 addr) tipc_local_nodes = c_ptr->nodes; c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_node = 0; - + z_ptr = tipc_zone_find(tipc_zone(addr)); if (!z_ptr) { z_ptr = tipc_zone_create(addr); @@ -150,7 +150,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr) /** * tipc_cltr_select_router - select router to a cluster - * + * * Uses deterministic and fair algorithm. */ @@ -192,7 +192,7 @@ u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref) /** * tipc_cltr_select_node - select destination node within a remote cluster - * + * * Uses deterministic and fair algorithm. */ @@ -295,7 +295,7 @@ void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest) msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, SLAVE_ROUTING_TABLE); for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) { - if (c_ptr->nodes[n_num] && + if (c_ptr->nodes[n_num] && tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); @@ -329,7 +329,7 @@ void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest) msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, EXT_ROUTING_TABLE); for (n_num = 1; n_num <= highest; n_num++) { - if (c_ptr->nodes[n_num] && + if (c_ptr->nodes[n_num] && tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); @@ -360,7 +360,7 @@ void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest) msg_set_remote_node(msg, c_ptr->addr); msg_set_type(msg, LOCAL_ROUTING_TABLE); for (n_num = 1; n_num <= highest; n_num++) { - if (c_ptr->nodes[n_num] && + if (c_ptr->nodes[n_num] && tipc_node_has_active_links(c_ptr->nodes[n_num])) { send = 1; msg_set_dataoctet(msg, n_num); @@ -492,7 +492,7 @@ void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router) } /** - * tipc_cltr_multicast - multicast message to local nodes + * tipc_cltr_multicast - multicast message to local nodes */ static void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf, @@ -554,9 +554,9 @@ void tipc_cltr_broadcast(struct sk_buff *buf) buf_copy = skb_copy(buf, GFP_ATOMIC); if (buf_copy == NULL) goto exit; - msg_set_destnode(buf_msg(buf_copy), + msg_set_destnode(buf_msg(buf_copy), n_ptr->addr); - tipc_link_send(buf_copy, n_ptr->addr, + tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr); } } diff --git a/net/tipc/cluster.h b/net/tipc/cluster.h index 1b4cd309495..62df074afae 100644 --- a/net/tipc/cluster.h +++ b/net/tipc/cluster.h @@ -1,6 +1,6 @@ /* * net/tipc/cluster.h: Include file for TIPC cluster management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -50,7 +50,7 @@ * @highest_node: id of highest numbered node within cluster * @highest_slave: (used for secondary node support) */ - + struct cluster { u32 addr; struct _zone *owner; diff --git a/net/tipc/config.c b/net/tipc/config.c index baf55c459c8..14789a82de5 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c @@ -1,6 +1,6 @@ /* * net/tipc/config.c: TIPC configuration management code - * + * * Copyright (c) 2002-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -86,7 +86,7 @@ struct sk_buff *tipc_cfg_reply_alloc(int payload_size) return buf; } -int tipc_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) { struct tlv_desc *tlv = (struct tlv_desc *)buf->tail; @@ -112,7 +112,7 @@ struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value) buf = tipc_cfg_reply_alloc(TLV_SPACE(sizeof(value))); if (buf) { value_net = htonl(value); - tipc_cfg_append_tlv(buf, tlv_type, &value_net, + tipc_cfg_append_tlv(buf, tlv_type, &value_net, sizeof(value_net)); } return buf; @@ -182,7 +182,7 @@ int tipc_cfg_cmd(const struct tipc_cmd_msg * msg, static void cfg_cmd_event(struct tipc_cmd_msg *msg, char *data, - u32 sz, + u32 sz, struct tipc_portid const *orig) { int rv = -EINVAL; @@ -192,7 +192,7 @@ static void cfg_cmd_event(struct tipc_cmd_msg *msg, msg->cmd = ntohl(msg->cmd); - cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect, + cfg_prepare_res_msg(msg->cmd, msg->usr_handle, rv, &rmsg, msg_sect, data, 0); if (ntohl(msg->magic) != TIPC_MAGIC) goto exit; @@ -295,7 +295,7 @@ static struct sk_buff *cfg_set_own_addr(void) " (cannot change node address once assigned)"); tipc_own_addr = addr; - /* + /* * Must release all spinlocks before calling start_net() because * Linux version of TIPC calls eth_media_start() which calls * register_netdevice_notifier() which may block! @@ -619,7 +619,7 @@ static void cfg_named_msg_event(void *userdata, struct sk_buff **buf, const unchar *msg, u32 size, - u32 importance, + u32 importance, struct tipc_portid const *orig, struct tipc_name_seq const *dest) { @@ -640,7 +640,7 @@ static void cfg_named_msg_event(void *userdata, /* Generate reply for request (if can't, return request) */ rep_buf = tipc_cfg_do_cmd(orig->node, - ntohs(req_hdr->tcm_type), + ntohs(req_hdr->tcm_type), msg + sizeof(*req_hdr), size - sizeof(*req_hdr), BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr)); diff --git a/net/tipc/config.h b/net/tipc/config.h index 7a728f954d8..5cd7cc56c54 100644 --- a/net/tipc/config.h +++ b/net/tipc/config.h @@ -1,6 +1,6 @@ /* * net/tipc/config.h: Include file for TIPC configuration service code - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -43,7 +43,7 @@ #include "link.h" struct sk_buff *tipc_cfg_reply_alloc(int payload_size); -int tipc_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); struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value); struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string); @@ -68,8 +68,8 @@ static inline struct sk_buff *tipc_cfg_reply_ultra_string(char *string) return tipc_cfg_reply_string_type(TIPC_TLV_ULTRA_STRING, string); } -struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, - const void *req_tlv_area, int req_tlv_space, +struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, + const void *req_tlv_area, int req_tlv_space, int headroom); void tipc_cfg_link_event(u32 addr, char *name, int up); diff --git a/net/tipc/core.c b/net/tipc/core.c index 6f5b7ee3118..d2d7d32c02c 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -89,7 +89,7 @@ int tipc_mode = TIPC_NOT_RUNNING; int tipc_random; atomic_t tipc_user_count = ATOMIC_INIT(0); -const char tipc_alphabet[] = +const char tipc_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; /* configurable TIPC parameters */ @@ -171,13 +171,13 @@ int tipc_core_start(void) get_random_bytes(&tipc_random, sizeof(tipc_random)); tipc_mode = TIPC_NODE_MODE; - if ((res = tipc_handler_start()) || + if ((res = tipc_handler_start()) || (res = tipc_ref_table_init(tipc_max_ports + tipc_max_subscriptions, tipc_random)) || (res = tipc_reg_start()) || (res = tipc_nametbl_init()) || - (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || - (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || + (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || + (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || (res = tipc_netlink_start()) || (res = tipc_socket_init())) { tipc_core_stop(); @@ -191,7 +191,7 @@ static int __init tipc_init(void) int res; tipc_log_reinit(CONFIG_TIPC_LOG); - info("Activated (version " TIPC_MOD_VER + info("Activated (version " TIPC_MOD_VER " compiled " __DATE__ " " __TIME__ ")\n"); tipc_own_addr = 0; @@ -207,9 +207,9 @@ static int __init tipc_init(void) if ((res = tipc_core_start())) err("Unable to start in single node mode\n"); - else + else info("Started in single node mode\n"); - return res; + return res; } static void __exit tipc_exit(void) @@ -268,11 +268,11 @@ EXPORT_SYMBOL(tipc_available_nodes); /* TIPC API for external bearers (see tipc_bearer.h) */ EXPORT_SYMBOL(tipc_block_bearer); -EXPORT_SYMBOL(tipc_continue); +EXPORT_SYMBOL(tipc_continue); EXPORT_SYMBOL(tipc_disable_bearer); EXPORT_SYMBOL(tipc_enable_bearer); EXPORT_SYMBOL(tipc_recv_msg); -EXPORT_SYMBOL(tipc_register_media); +EXPORT_SYMBOL(tipc_register_media); /* TIPC API for external APIs (see tipc_port.h) */ diff --git a/net/tipc/core.h b/net/tipc/core.h index 4638947c232..e40ada964d6 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -1,6 +1,6 @@ /* * net/tipc/core.h: Include file for TIPC global declarations - * + * * Copyright (c) 2005-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include @@ -88,7 +88,7 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #define dump(fmt, arg...) do {if (DBG_OUTPUT != TIPC_NULL) tipc_dump(DBG_OUTPUT, fmt, ##arg);} while(0) -/* +/* * By default, TIPC_OUTPUT is defined to be system console and TIPC log buffer, * while DBG_OUTPUT is the null print buffer. These defaults can be changed * here, or on a per .c file basis, by redefining these symbols. The following @@ -126,9 +126,9 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #define dump(fmt,arg...) do {} while (0) -/* +/* * TIPC_OUTPUT is defined to be the system console, while DBG_OUTPUT is - * the null print buffer. Thes ensures that any system or debug messages + * the null print buffer. Thes ensures that any system or debug messages * that are generated without using the above macros are handled correctly. */ @@ -138,10 +138,10 @@ void tipc_dump(struct print_buf*,const char *fmt, ...); #undef DBG_OUTPUT #define DBG_OUTPUT TIPC_NULL -#endif +#endif -/* +/* * TIPC-specific error codes */ @@ -204,11 +204,11 @@ u32 tipc_k_signal(Handler routine, unsigned long argument); * @timer: pointer to timer structure * @routine: pointer to routine to invoke when timer expires * @argument: value to pass to routine when timer expires - * + * * Timer must be initialized before use (and terminated when no longer needed). */ -static inline void k_init_timer(struct timer_list *timer, Handler routine, +static inline void k_init_timer(struct timer_list *timer, Handler routine, unsigned long argument) { dbg("initializing timer %p\n", timer); @@ -221,13 +221,13 @@ static inline void k_init_timer(struct timer_list *timer, Handler routine, * k_start_timer - start a timer * @timer: pointer to timer structure * @msec: time to delay (in ms) - * + * * Schedules a previously initialized timer for later execution. * If timer is already running, the new timeout overrides the previous request. - * + * * To ensure the timer doesn't expire before the specified delay elapses, * the amount of delay is rounded up when converting to the jiffies - * then an additional jiffy is added to account for the fact that + * then an additional jiffy is added to account for the fact that * the starting time may be in the middle of the current jiffy. */ @@ -240,10 +240,10 @@ static inline void k_start_timer(struct timer_list *timer, unsigned long msec) /** * k_cancel_timer - cancel a timer * @timer: pointer to timer structure - * - * Cancels a previously initialized timer. + * + * Cancels a previously initialized timer. * Can be called safely even if the timer is already inactive. - * + * * WARNING: Must not be called when holding locks required by the timer's * timeout routine, otherwise deadlock can occur on SMP systems! */ @@ -257,11 +257,11 @@ static inline void k_cancel_timer(struct timer_list *timer) /** * k_term_timer - terminate a timer * @timer: pointer to timer structure - * + * * Prevents further use of a previously initialized timer. - * + * * WARNING: Caller must ensure timer isn't currently running. - * + * * (Do not "enhance" this routine to automatically cancel an active timer, * otherwise deadlock can arise when a timeout routine calls k_term_timer.) */ @@ -302,7 +302,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb) * @size: message size (including TIPC header) * * Returns a new buffer with data pointers set to the specified size. - * + * * NOTE: Headroom is reserved to allow prepending of a data link header. * There may also be unrequested tailroom present at the buffer's end. */ @@ -334,4 +334,4 @@ static inline void buf_discard(struct sk_buff *skb) kfree_skb(skb); } -#endif +#endif diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c index 627f99b7afd..e809d2a2ce0 100644 --- a/net/tipc/dbg.c +++ b/net/tipc/dbg.c @@ -1,6 +1,6 @@ /* * net/tipc/dbg.c: TIPC print buffer routines for debugging - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -123,34 +123,34 @@ int tipc_printbuf_empty(struct print_buf *pb) /** * tipc_printbuf_validate - check for print buffer overflow * @pb: pointer to print buffer structure - * - * 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 - * + * * Returns length of print buffer data string (including trailing NUL) */ int tipc_printbuf_validate(struct print_buf *pb) { - char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; - char *cp_buf; - struct print_buf cb; + char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n"; + char *cp_buf; + struct print_buf cb; if (!pb->buf) return 0; if (pb->buf[pb->size - 1] == 0) { - cp_buf = kmalloc(pb->size, GFP_ATOMIC); - if (cp_buf != NULL){ - tipc_printbuf_init(&cb, cp_buf, pb->size); - tipc_printbuf_move(&cb, pb); - tipc_printbuf_move(pb, &cb); - kfree(cp_buf); - memcpy(pb->buf, err, strlen(err)); - } else { - tipc_printbuf_reset(pb); - tipc_printf(pb, err); - } + cp_buf = kmalloc(pb->size, GFP_ATOMIC); + if (cp_buf != NULL){ + tipc_printbuf_init(&cb, cp_buf, pb->size); + tipc_printbuf_move(&cb, pb); + tipc_printbuf_move(pb, &cb); + kfree(cp_buf); + memcpy(pb->buf, err, strlen(err)); + } else { + tipc_printbuf_reset(pb); + tipc_printf(pb, err); + } } return (pb->crs - pb->buf + 1); } @@ -159,7 +159,7 @@ int tipc_printbuf_validate(struct print_buf *pb) * tipc_printbuf_move - move print buffer contents to another print buffer * @pb_to: pointer to destination print buffer structure * @pb_from: pointer to source print buffer structure - * + * * Current contents of destination print buffer (if any) are discarded. * Source print buffer becomes empty if a successful move occurs. */ @@ -234,13 +234,13 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) pb->crs = pb->buf + pb->size - 1; } else { strcpy(pb->buf, print_string + chars_left); - save_char = print_string[chars_left]; - print_string[chars_left] = 0; - strcpy(pb->crs, print_string); - print_string[chars_left] = save_char; - pb->crs = pb->buf + chars_to_add - chars_left; - } - } + save_char = print_string[chars_left]; + print_string[chars_left] = 0; + strcpy(pb->crs, print_string); + print_string[chars_left] = save_char; + pb->crs = pb->buf + chars_to_add - chars_left; + } + } pb_next = pb->next; pb->next = NULL; pb = pb_next; @@ -249,7 +249,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...) } /** - * TIPC_TEE - perform next output operation on both print buffers + * TIPC_TEE - perform next output operation on both print buffers * @b0: pointer to chain of print buffers (may be NULL) * @b1: pointer to print buffer to add to chain * @@ -350,7 +350,7 @@ void tipc_dump(struct print_buf *pb, const char *fmt, ...) } /** - * tipc_log_stop - free up TIPC log print buffer + * tipc_log_stop - free up TIPC log print buffer */ void tipc_log_stop(void) diff --git a/net/tipc/dbg.h b/net/tipc/dbg.h index 467c0bc78a7..c01b085000e 100644 --- a/net/tipc/dbg.h +++ b/net/tipc/dbg.h @@ -1,6 +1,6 @@ /* * net/tipc/dbg.h: Include file for TIPC print buffer routines - * + * * Copyright (c) 1997-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. diff --git a/net/tipc/discover.c b/net/tipc/discover.c index 3b0cd12f37d..5d643e5721e 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c @@ -1,6 +1,6 @@ /* * net/tipc/discover.c - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -56,10 +56,10 @@ #define CHECK_LINK_COUNT 306 #endif -/* +/* * TODO: Most of the inter-cluster setup stuff should be * rewritten, and be made conformant with specification. - */ + */ /** @@ -80,10 +80,10 @@ struct link_req { #if 0 -int disc_create_link(const struct tipc_link_create *argv) +int disc_create_link(const struct tipc_link_create *argv) { - /* - * Code for inter cluster link setup here + /* + * Code for inter cluster link setup here */ return TIPC_OK; } @@ -93,16 +93,16 @@ int disc_create_link(const struct tipc_link_create *argv) * disc_lost_link(): A link has lost contact */ -void tipc_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)) return; - /* - * Code for inter cluster link setup here + /* + * Code for inter cluster link setup here */ } -/** +/** * tipc_disc_init_msg - initialize a link setup message * @type: message type (request or response) * @req_links: number of links associated with message @@ -210,7 +210,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf) dbg("creating link\n"); link = tipc_link_create(b_ptr, orig, &media_addr); if (!link) { - spin_unlock_bh(&n_ptr->lock); + spin_unlock_bh(&n_ptr->lock); return; } } @@ -224,10 +224,10 @@ void tipc_disc_recv_msg(struct sk_buff *buf) warn("Resetting link <%s>, peer interface address changed\n", link->name); memcpy(addr, &media_addr, sizeof(*addr)); - tipc_link_reset(link); + tipc_link_reset(link); } link_fully_up = (link->state == WORKING_WORKING); - spin_unlock_bh(&n_ptr->lock); + spin_unlock_bh(&n_ptr->lock); if ((type == DSC_RESP_MSG) || link_fully_up) return; rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); @@ -244,23 +244,23 @@ void tipc_disc_recv_msg(struct sk_buff *buf) * @req: ptr to link request structure */ -void tipc_disc_stop_link_req(struct link_req *req) +void tipc_disc_stop_link_req(struct link_req *req) { if (!req) return; - + k_cancel_timer(&req->timer); k_term_timer(&req->timer); buf_discard(req->buf); kfree(req); -} +} /** * tipc_disc_update_link_req - update frequency of periodic link setup requests * @req: ptr to link request structure */ -void tipc_disc_update_link_req(struct link_req *req) +void tipc_disc_update_link_req(struct link_req *req) { if (!req) return; @@ -278,16 +278,16 @@ void tipc_disc_update_link_req(struct link_req *req) } else { /* leave timer "as is" if haven't yet reached a "normal" rate */ } -} +} /** * disc_timeout - send a periodic link setup request * @req: ptr to link request structure - * + * * Called whenever a link setup request timer associated with a bearer expires. */ -static void disc_timeout(struct link_req *req) +static void disc_timeout(struct link_req *req) { spin_lock_bh(&req->bearer->publ.lock); @@ -300,7 +300,7 @@ static void disc_timeout(struct link_req *req) req->timer_intv *= 2; if (req->timer_intv > TIPC_LINK_REQ_FAST) req->timer_intv = TIPC_LINK_REQ_FAST; - if ((req->timer_intv == TIPC_LINK_REQ_FAST) && + if ((req->timer_intv == TIPC_LINK_REQ_FAST) && (req->bearer->nodes.count)) req->timer_intv = TIPC_LINK_REQ_SLOW; } @@ -315,14 +315,14 @@ static void disc_timeout(struct link_req *req) * @dest: destination address for request messages * @dest_domain: network domain of node(s) which should respond to message * @req_links: max number of desired links - * + * * Returns pointer to link request structure, or NULL if unable to create. */ -struct link_req *tipc_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, u32 dest_domain, - u32 req_links) + u32 req_links) { struct link_req *req; @@ -342,5 +342,5 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req); k_start_timer(&req->timer, req->timer_intv); return req; -} +} diff --git a/net/tipc/discover.h b/net/tipc/discover.h index 0454fd1ae7f..9fd7587b143 100644 --- a/net/tipc/discover.h +++ b/net/tipc/discover.h @@ -41,7 +41,7 @@ struct link_req; -struct link_req *tipc_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, u32 dest_domain, u32 req_links); diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 682da4a2804..9be4839e32c 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -1,6 +1,6 @@ /* * net/tipc/eth_media.c: Ethernet bearer support for TIPC - * + * * Copyright (c) 2001-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -50,7 +50,7 @@ * @dev: ptr to associated Ethernet network device * @tipc_packet_type: used in binding TIPC to Ethernet driver */ - + struct eth_bearer { struct tipc_bearer *bearer; struct net_device *dev; @@ -62,10 +62,10 @@ static int eth_started = 0; static struct notifier_block notifier; /** - * send_msg - send a TIPC message out over an Ethernet interface + * send_msg - send a TIPC message out over an Ethernet interface */ -static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, +static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, struct tipc_media_addr *dest) { struct sk_buff *clone; @@ -76,7 +76,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, clone->nh.raw = clone->data; dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; clone->dev = dev; - dev->hard_header(clone, dev, ETH_P_TIPC, + dev->hard_header(clone, dev, ETH_P_TIPC, &dest->dev_addr.eth_addr, dev->dev_addr, clone->len); dev_queue_xmit(clone); @@ -86,12 +86,12 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, /** * recv_msg - handle incoming TIPC message from an Ethernet interface - * + * * Routine truncates any Ethernet padding/CRC appended to the message, * and ensures message size matches actual length */ -static int recv_msg(struct sk_buff *buf, struct net_device *dev, +static int recv_msg(struct sk_buff *buf, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; @@ -99,14 +99,14 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, if (likely(eb_ptr->bearer)) { if (likely(!dev->promiscuity) || - !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || - !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { - size = msg_size((struct tipc_msg *)buf->data); - skb_trim(buf, size); - if (likely(buf->len == size)) { - buf->next = NULL; - tipc_recv_msg(buf, eb_ptr->bearer); - return TIPC_OK; + !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || + !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { + size = msg_size((struct tipc_msg *)buf->data); + skb_trim(buf, size); + if (likely(buf->len == size)) { + buf->next = NULL; + tipc_recv_msg(buf, eb_ptr->bearer); + return TIPC_OK; } } } @@ -115,7 +115,7 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, } /** - * enable_bearer - attach TIPC bearer to an Ethernet interface + * enable_bearer - attach TIPC bearer to an Ethernet interface */ static int enable_bearer(struct tipc_bearer *tb_ptr) @@ -127,7 +127,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) /* Find device with specified name */ - while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { + while (dev && dev->name && strncmp(dev->name, driver_name, IFNAMSIZ)) { dev = dev->next; } if (!dev) @@ -154,14 +154,14 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) eb_ptr->bearer = tb_ptr; tb_ptr->usr_handle = (void *)eb_ptr; tb_ptr->mtu = dev->mtu; - tb_ptr->blocked = 0; + tb_ptr->blocked = 0; tb_ptr->addr.type = htonl(TIPC_MEDIA_TYPE_ETH); memcpy(&tb_ptr->addr.dev_addr, &dev->dev_addr, ETH_ALEN); return 0; } /** - * disable_bearer - detach TIPC bearer from an Ethernet interface + * disable_bearer - detach TIPC bearer from an Ethernet interface * * We really should do dev_remove_pack() here, but this function can not be * called at tasklet level. => Use eth_bearer->bearer as a flag to throw away @@ -176,11 +176,11 @@ static void disable_bearer(struct tipc_bearer *tb_ptr) /** * recv_notification - handle device updates from OS * - * Change the state of the Ethernet bearer (if any) associated with the + * Change the state of the Ethernet bearer (if any) associated with the * specified device. */ -static int recv_notification(struct notifier_block *nb, unsigned long evt, +static int recv_notification(struct notifier_block *nb, unsigned long evt, void *dv) { struct net_device *dev = (struct net_device *)dv; @@ -194,7 +194,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, if (!eb_ptr->bearer) return NOTIFY_DONE; /* bearer had been disabled */ - eb_ptr->bearer->mtu = dev->mtu; + eb_ptr->bearer->mtu = dev->mtu; switch (evt) { case NETDEV_CHANGE: @@ -210,12 +210,12 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, tipc_block_bearer(eb_ptr->bearer->name); break; case NETDEV_CHANGEMTU: - case NETDEV_CHANGEADDR: + case NETDEV_CHANGEADDR: tipc_block_bearer(eb_ptr->bearer->name); - tipc_continue(eb_ptr->bearer); + tipc_continue(eb_ptr->bearer); break; case NETDEV_UNREGISTER: - case NETDEV_CHANGENAME: + case NETDEV_CHANGENAME: tipc_disable_bearer(eb_ptr->bearer->name); break; } @@ -227,7 +227,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, */ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) -{ +{ unchar *addr = (unchar *)&a->dev_addr; if (str_size < 18) @@ -246,7 +246,7 @@ static char *eth_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size */ int tipc_eth_media_start(void) -{ +{ struct tipc_media_addr bcast_addr; int res; @@ -259,8 +259,8 @@ int tipc_eth_media_start(void) memset(eth_bearers, 0, sizeof(eth_bearers)); res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth", - enable_bearer, disable_bearer, send_msg, - eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, + enable_bearer, disable_bearer, send_msg, + eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY, ETH_LINK_TOLERANCE, ETH_LINK_WINDOW); if (res) return res; diff --git a/net/tipc/handler.c b/net/tipc/handler.c index eb80778d6d9..e1dcf663f8a 100644 --- a/net/tipc/handler.c +++ b/net/tipc/handler.c @@ -1,6 +1,6 @@ /* * net/tipc/handler.c: TIPC signal handling - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -95,7 +95,7 @@ static void process_signal_queue(unsigned long dummy) int tipc_handler_start(void) { - tipc_queue_item_cache = + tipc_queue_item_cache = kmem_cache_create("tipc_queue_items", sizeof(struct queue_item), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if (!tipc_queue_item_cache) @@ -110,7 +110,7 @@ int tipc_handler_start(void) void tipc_handler_stop(void) { struct list_head *l, *n; - struct queue_item *item; + struct queue_item *item; if (!handler_enabled) return; diff --git a/net/tipc/link.c b/net/tipc/link.c index 1bb983c8130..71c2f2fd405 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1,6 +1,6 @@ /* * net/tipc/link.c: TIPC link code - * + * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -50,29 +50,29 @@ #include "bcast.h" -/* - * Limit for deferred reception queue: +/* + * Limit for deferred reception queue: */ #define DEF_QUEUE_LIMIT 256u -/* - * Link state events: +/* + * Link state events: */ #define STARTING_EVT 856384768 /* link processing trigger */ #define TRAFFIC_MSG_EVT 560815u /* rx'd ??? */ #define TIMEOUT_EVT 560817u /* link timer expired */ -/* - * The following two 'message types' is really just implementation - * data conveniently stored in the message header. +/* + * The following two 'message types' is really just implementation + * data conveniently stored in the message header. * They must not be considered part of the protocol */ #define OPEN_MSG 0 #define CLOSED_MSG 1 -/* +/* * State value stored in 'exp_msg_count' */ @@ -97,7 +97,7 @@ struct link_name { /* LINK EVENT CODE IS NOT SUPPORTED AT PRESENT */ -/** +/** * struct link_event - link up/down event notification */ @@ -121,7 +121,7 @@ static int link_send_sections_long(struct port *sender, static void link_check_defragm_bufs(struct link *l_ptr); static void link_state_event(struct link *l_ptr, u32 event); static void link_reset_statistics(struct link *l_ptr); -static void link_print(struct link *l_ptr, struct print_buf *buf, +static void link_print(struct link *l_ptr, struct print_buf *buf, const char *str); /* @@ -136,13 +136,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, * * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0, - * the dbg_link_XXX() routines simply send their output to the standard + * the dbg_link_XXX() routines simply send their output to the standard * debug print buffer (DBG_OUTPUT), if it has been defined; this can be useful * when there is only a single link in the system being debugged. * * Notes: * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE - * - "l_ptr" must be valid when using dbg_link_XXX() macros + * - "l_ptr" must be valid when using dbg_link_XXX() macros */ #define LINK_LOG_BUF_SIZE 0 @@ -222,18 +222,18 @@ static u32 link_max_pkt(struct link *l_ptr) static void link_init_max_pkt(struct link *l_ptr) { u32 max_pkt; - + max_pkt = (l_ptr->b_ptr->publ.mtu & ~3); if (max_pkt > MAX_MSG_SIZE) max_pkt = MAX_MSG_SIZE; - l_ptr->max_pkt_target = max_pkt; + l_ptr->max_pkt_target = max_pkt; if (l_ptr->max_pkt_target < MAX_PKT_DEFAULT) l_ptr->max_pkt = l_ptr->max_pkt_target; - else + else l_ptr->max_pkt = MAX_PKT_DEFAULT; - l_ptr->max_pkt_probes = 0; + l_ptr->max_pkt_probes = 0; } static u32 link_next_sent(struct link *l_ptr) @@ -269,7 +269,7 @@ int tipc_link_is_active(struct link *l_ptr) * link_name_validate - validate & (optionally) deconstruct link name * @name - ptr to link name string * @name_parts - ptr to area for link name components (or NULL if not needed) - * + * * Returns 1 if link name is valid, otherwise 0. */ @@ -317,8 +317,8 @@ static int link_name_validate(const char *name, struct link_name *name_parts) &z_peer, &c_peer, &n_peer, &dummy) != 3) || (z_local > 255) || (c_local > 4095) || (n_local > 4095) || (z_peer > 255) || (c_peer > 4095) || (n_peer > 4095) || - (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) || - (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) || + (if_local_len <= 1) || (if_local_len > TIPC_MAX_IF_NAME) || + (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME) || (strspn(if_local, tipc_alphabet) != (if_local_len - 1)) || (strspn(if_peer, tipc_alphabet) != (if_peer_len - 1))) return 0; @@ -337,7 +337,7 @@ static int link_name_validate(const char *name, struct link_name *name_parts) /** * link_timeout - handle expiration of link timer * @l_ptr: pointer to link - * + * * This routine must not grab "tipc_net_lock" to avoid a potential deadlock conflict * with tipc_link_delete(). (There is no risk that the node will be deleted by * another thread because tipc_link_delete() always cancels the link timer before @@ -406,7 +406,7 @@ static void link_set_timer(struct link *l_ptr, u32 time) * @b_ptr: pointer to associated bearer * @peer: network address of node at other end of link * @media_addr: media address to use when sending messages over link - * + * * Returns pointer to link. */ @@ -427,7 +427,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, if_name = strchr(b_ptr->publ.name, ':') + 1; sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), - tipc_node(tipc_own_addr), + tipc_node(tipc_own_addr), if_name, tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); /* note: peer i/f is appended to link name by reset/activate */ @@ -478,17 +478,17 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n", l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit); - + return l_ptr; } -/** +/** * tipc_link_delete - delete a link * @l_ptr: pointer to link - * + * * Note: 'tipc_net_lock' is write_locked, bearer is locked. * 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 tipc_link_delete(struct link *l_ptr) @@ -501,7 +501,7 @@ void tipc_link_delete(struct link *l_ptr) dbg("tipc_link_delete()\n"); k_cancel_timer(&l_ptr->timer); - + tipc_node_lock(l_ptr->owner); tipc_link_reset(l_ptr); tipc_node_detach_link(l_ptr->owner, l_ptr); @@ -521,12 +521,12 @@ void tipc_link_start(struct link *l_ptr) } /** - * link_schedule_port - schedule port for deferred sending + * link_schedule_port - schedule port for deferred sending * @l_ptr: pointer to link * @origport: reference to sending port * @sz: amount of data to be sent - * - * Schedules port for renewed sending of messages after link congestion + * + * Schedules port for renewed sending of messages after link congestion * has abated. */ @@ -567,7 +567,7 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all) return; if (link_congested(l_ptr)) goto exit; - list_for_each_entry_safe(p_ptr, temp_p_ptr, &l_ptr->waiting_ports, + list_for_each_entry_safe(p_ptr, temp_p_ptr, &l_ptr->waiting_ports, wait_list) { if (win <= 0) break; @@ -584,7 +584,7 @@ exit: spin_unlock_bh(&tipc_port_list_lock); } -/** +/** * link_release_outqueue - purge link's outbound message queue * @l_ptr: pointer to link */ @@ -621,7 +621,7 @@ void tipc_link_reset_fragments(struct link *l_ptr) l_ptr->defragm_buf = NULL; } -/** +/** * tipc_link_stop - purge all inbound and outbound messages associated with link * @l_ptr: pointer to link */ @@ -665,7 +665,7 @@ static void link_send_event(void (*fcn)(u32 a, char *n, int up), struct link *l_ptr, int up) { struct link_event *ev; - + ev = kmalloc(sizeof(*ev), GFP_ATOMIC); if (!ev) { warn("Link event allocation failure\n"); @@ -690,15 +690,15 @@ void tipc_link_reset(struct link *l_ptr) u32 prev_state = l_ptr->state; u32 checkpoint = l_ptr->next_in_no; int was_active_link = tipc_link_is_active(l_ptr); - + msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1); - /* Link is down, accept any session: */ + /* Link is down, accept any session: */ l_ptr->peer_session = 0; - /* Prepare for max packet size negotiation */ + /* Prepare for max packet size negotiation */ link_init_max_pkt(l_ptr); - + l_ptr->state = RESET_UNKNOWN; dbg_link_state("Resetting Link\n"); @@ -770,7 +770,7 @@ static void link_activate(struct link *l_ptr) static void link_state_event(struct link *l_ptr, unsigned event) { - struct link *other; + struct link *other; u32 cont_intv = l_ptr->continuity_interval; if (!l_ptr->started && (event != STARTING_EVT)) @@ -799,11 +799,11 @@ static void link_state_event(struct link *l_ptr, unsigned event) if (l_ptr->next_in_no != l_ptr->checkpoint) { l_ptr->checkpoint = l_ptr->next_in_no; if (tipc_bclink_acks_missing(l_ptr->owner)) { - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } else if (l_ptr->max_pkt < l_ptr->max_pkt_target) { - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; } @@ -819,7 +819,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) break; case RESET_MSG: dbg_link("RES -> RR\n"); - info("Resetting link <%s>, requested by peer\n", + info("Resetting link <%s>, requested by peer\n", l_ptr->name); tipc_link_reset(l_ptr); l_ptr->state = RESET_RESET; @@ -871,7 +871,7 @@ static void link_state_event(struct link *l_ptr, unsigned event) dbg_link("Probing %u/%u,timer = %u ms)\n", l_ptr->fsm_msg_cnt, l_ptr->abort_limit, cont_intv / 4); - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); l_ptr->fsm_msg_cnt++; link_set_timer(l_ptr, cont_intv / 4); @@ -977,11 +977,11 @@ static void link_state_event(struct link *l_ptr, unsigned event) /* * link_bundle_buf(): Append contents of a buffer to - * the tail of an existing one. + * the tail of an existing one. */ static int link_bundle_buf(struct link *l_ptr, - struct sk_buff *bundler, + struct sk_buff *bundler, struct sk_buff *buf) { struct tipc_msg *bundler_msg = buf_msg(bundler); @@ -1030,8 +1030,8 @@ static void link_add_to_outqueue(struct link *l_ptr, l_ptr->out_queue_size++; } -/* - * tipc_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 * has failed, and from link_send() */ @@ -1074,7 +1074,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) if (queue_size > l_ptr->stats.max_queue_sz) l_ptr->stats.max_queue_sz = queue_size; - if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && + if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && !link_congested(l_ptr))) { link_add_to_outqueue(l_ptr, buf, msg); @@ -1094,7 +1094,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) /* Try adding message to an existing bundle */ - if (l_ptr->next_out && + if (l_ptr->next_out && link_bundle_buf(l_ptr, l_ptr->last_out, buf)) { tipc_bearer_resolve_congestion(l_ptr->b_ptr, l_ptr); return dsz; @@ -1109,7 +1109,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) if (bundler) { msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr); - memcpy(bundler->data, (unchar *)&bundler_hdr, + memcpy(bundler->data, (unchar *)&bundler_hdr, INT_H_SIZE); skb_trim(bundler, INT_H_SIZE); link_bundle_buf(l_ptr, bundler, buf); @@ -1126,8 +1126,8 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) return dsz; } -/* - * tipc_link_send(): same as tipc_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 * Called by TIPC internal users, e.g. the name distributor */ @@ -1161,8 +1161,8 @@ int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector) return res; } -/* - * link_send_buf_fast: Entry for data messages where the +/* + * link_send_buf_fast: Entry for data messages where the * destination link is known and the header is complete, * inclusive total message length. Very time critical. * Link is locked. Returns user data length. @@ -1197,8 +1197,8 @@ static int link_send_buf_fast(struct link *l_ptr, struct sk_buff *buf, return tipc_link_send_buf(l_ptr, buf); /* All other cases */ } -/* - * tipc_send_buf_fast: Entry for data messages where the +/* + * tipc_send_buf_fast: Entry for data messages where the * destination node is known and the header is complete, * inclusive total message length. * Returns user data length. @@ -1236,15 +1236,15 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) } -/* - * tipc_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, - * except for total message length. + * except for total message length. * Returns user data length or errno. */ -int tipc_link_send_sections_fast(struct port *sender, +int tipc_link_send_sections_fast(struct port *sender, struct iovec const *msg_sect, - const u32 num_sect, + const u32 num_sect, u32 destaddr) { struct tipc_msg *hdr = &sender->publ.phdr; @@ -1287,14 +1287,14 @@ exit: /* Exit if link (or bearer) is congested */ - if (link_congested(l_ptr) || + if (link_congested(l_ptr) || !list_empty(&l_ptr->b_ptr->cong_links)) { res = link_schedule_port(l_ptr, sender->publ.ref, res); goto exit; } - /* + /* * Message size exceeds max_pkt hint; update hint, * then re-try fast path or fragment the message */ @@ -1324,10 +1324,10 @@ exit: return res; } -/* - * link_send_sections_long(): Entry for long messages where the +/* + * link_send_sections_long(): Entry for long messages where the * destination node is known and the header is complete, - * inclusive total message length. + * inclusive total message length. * Link and bearer congestion status have been checked to be ok, * and are ignored if they change. * @@ -1357,9 +1357,9 @@ static int link_send_sections_long(struct port *sender, again: fragm_no = 1; - max_pkt = sender->max_pkt - INT_H_SIZE; + max_pkt = sender->max_pkt - INT_H_SIZE; /* leave room for tunnel header in case of link changeover */ - fragm_sz = max_pkt - INT_H_SIZE; + fragm_sz = max_pkt - INT_H_SIZE; /* leave room for fragmentation header in each fragment */ rest = dsz; fragm_crs = 0; @@ -1440,7 +1440,7 @@ error: if (!buf) goto error; - buf->next = NULL; + buf->next = NULL; prev->next = buf; memcpy(buf->data, (unchar *)&fragm_hdr, INT_H_SIZE); fragm_crs = INT_H_SIZE; @@ -1450,7 +1450,7 @@ error: } while (rest > 0); - /* + /* * Now we have a buffer chain. Select a link and check * that packet size is still OK */ @@ -1506,7 +1506,7 @@ reject: return dsz; } -/* +/* * tipc_link_push_packet: Push one unsent packet to the media */ u32 tipc_link_push_packet(struct link *l_ptr) @@ -1519,7 +1519,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) /* consider that buffers may have been released in meantime */ if (r_q_size && buf) { - u32 last = lesser(mod(r_q_head + r_q_size), + u32 last = lesser(mod(r_q_head + r_q_size), link_last_sent(l_ptr)); u32 first = msg_seqno(buf_msg(buf)); @@ -1535,7 +1535,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) if (r_q_size && buf && !skb_cloned(buf)) { 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 (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">DEF-RETR>"); l_ptr->retransm_queue_head = mod(++r_q_head); @@ -1554,7 +1554,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) buf = l_ptr->proto_msg_queue; if (buf) { 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 (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">DEF-PROT>"); l_ptr->unacked_window = 0; @@ -1578,7 +1578,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) if (mod(next - first) < l_ptr->queue_limit[0]) { 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 (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { if (msg_user(msg) == MSG_BUNDLER) msg_set_type(msg, CLOSED_MSG); @@ -1629,12 +1629,12 @@ static void link_reset_all(unsigned long addr) tipc_node_lock(n_ptr); - warn("Resetting all links to %s\n", + warn("Resetting all links to %s\n", addr_string_fill(addr_string, n_ptr->addr)); for (i = 0; i < MAX_BEARERS; i++) { if (n_ptr->links[i]) { - link_print(n_ptr->links[i], TIPC_OUTPUT, + link_print(n_ptr->links[i], TIPC_OUTPUT, "Resetting link\n"); tipc_link_reset(n_ptr->links[i]); } @@ -1689,7 +1689,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) } } -void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, +void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, u32 retransmits) { struct tipc_msg *msg; @@ -1698,7 +1698,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, return; msg = buf_msg(buf); - + dbg("Retransmitting %u in link %x\n", retransmits, l_ptr); if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { @@ -1728,7 +1728,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, while (retransmits && (buf != l_ptr->next_out) && buf && !skb_cloned(buf)) { msg = buf_msg(buf); 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 (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { msg_dbg(buf_msg(buf), ">RETR>"); buf = buf->next; @@ -1746,7 +1746,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; } -/* +/* * link_recv_non_seq: Receive packets which are outside * the link sequence flow */ @@ -1761,11 +1761,11 @@ static void link_recv_non_seq(struct sk_buff *buf) tipc_bclink_recv_pkt(buf); } -/** +/** * link_insert_deferred_queue - insert deferred messages back into receive chain */ -static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, +static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, struct sk_buff *buf) { u32 seq_no; @@ -1813,11 +1813,11 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) link_recv_non_seq(buf); continue; } - + if (unlikely(!msg_short(msg) && (msg_destnode(msg) != tipc_own_addr))) goto cont; - + n_ptr = tipc_node_find(msg_prevnode(msg)); if (unlikely(!n_ptr)) goto cont; @@ -1828,8 +1828,8 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) tipc_node_unlock(n_ptr); goto cont; } - /* - * Release acked messages + /* + * Release acked messages */ if (less(n_ptr->bclink.acked, msg_bcast_ack(msg))) { if (tipc_node_is_up(n_ptr) && n_ptr->bclink.supported) @@ -1837,7 +1837,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) } crs = l_ptr->first_out; - while ((crs != l_ptr->next_out) && + while ((crs != l_ptr->next_out) && less_eq(msg_seqno(buf_msg(crs)), ackd)) { struct sk_buff *next = crs->next; @@ -1875,7 +1875,7 @@ deliver: switch (msg_user(msg)) { case MSG_BUNDLER: l_ptr->stats.recv_bundles++; - l_ptr->stats.recv_bundled += + l_ptr->stats.recv_bundled += msg_msgcnt(msg); tipc_node_unlock(n_ptr); tipc_link_recv_bundle(buf); @@ -1894,7 +1894,7 @@ deliver: continue; case MSG_FRAGMENTER: l_ptr->stats.recv_fragments++; - if (tipc_link_recv_fragment(&l_ptr->defragm_buf, + if (tipc_link_recv_fragment(&l_ptr->defragm_buf, &buf, &msg)) { l_ptr->stats.recv_fragmented++; goto deliver; @@ -1905,7 +1905,7 @@ deliver: if (link_recv_changeover_msg(&l_ptr, &buf)) { msg = buf_msg(buf); seq_no = msg_seqno(msg); - TIPC_SKB_CB(buf)->handle + TIPC_SKB_CB(buf)->handle = b_ptr; if (type == ORIGINAL_MSG) goto deliver; @@ -1948,8 +1948,8 @@ cont: read_unlock_bh(&tipc_net_lock); } -/* - * link_defer_buf(): Sort a received out-of-sequence packet +/* + * link_defer_buf(): Sort a received out-of-sequence packet * into the deferred reception queue. * Returns the increase of the queue length,i.e. 0 or 1 */ @@ -1986,7 +1986,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, if (prev) prev->next = buf; else - *head = buf; + *head = buf; return 1; } if (seq_no == msg_seqno(msg)) { @@ -2003,11 +2003,11 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, return 0; } -/** +/** * link_handle_out_of_seq_msg - handle arrival of out-of-sequence packet */ -static void link_handle_out_of_seq_msg(struct link *l_ptr, +static void link_handle_out_of_seq_msg(struct link *l_ptr, struct sk_buff *buf) { u32 seq_no = msg_seqno(buf_msg(buf)); @@ -2017,14 +2017,14 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, return; } - dbg("rx OOS msg: seq_no %u, expecting %u (%u)\n", + dbg("rx OOS msg: seq_no %u, expecting %u (%u)\n", seq_no, mod(l_ptr->next_in_no), l_ptr->next_in_no); /* Record OOS packet arrival (force mismatch on next timeout) */ l_ptr->checkpoint--; - /* + /* * Discard packet if a duplicate; otherwise add it to deferred queue * and notify peer of gap as per protocol specification */ @@ -2053,13 +2053,13 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, { struct sk_buff *buf = NULL; struct tipc_msg *msg = l_ptr->pmsg; - u32 msg_size = sizeof(l_ptr->proto_msg); + u32 msg_size = sizeof(l_ptr->proto_msg); if (link_blocked(l_ptr)) return; msg_set_type(msg, msg_typ); 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, tipc_bclink_get_last_sent()); if (msg_typ == STATE_MSG) { @@ -2082,23 +2082,23 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, msg_set_max_pkt(msg, ack_mtu); msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); msg_set_probe(msg, probe_msg != 0); - if (probe_msg) { + if (probe_msg) { u32 mtu = l_ptr->max_pkt; - if ((mtu < l_ptr->max_pkt_target) && + if ((mtu < l_ptr->max_pkt_target) && link_working_working(l_ptr) && l_ptr->fsm_msg_cnt) { msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3; - if (l_ptr->max_pkt_probes == 10) { - l_ptr->max_pkt_target = (msg_size - 4); - l_ptr->max_pkt_probes = 0; + if (l_ptr->max_pkt_probes == 10) { + l_ptr->max_pkt_target = (msg_size - 4); + l_ptr->max_pkt_probes = 0; msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3; - } + } l_ptr->max_pkt_probes++; - } + } l_ptr->stats.sent_probes++; - } + } l_ptr->stats.sent_states++; } else { /* RESET_MSG or ACTIVATE_MSG */ msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1)); @@ -2144,7 +2144,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, return; 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 (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) { l_ptr->unacked_window = 0; @@ -2160,15 +2160,15 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, /* * Receive protocol message : - * Note that network plane id propagates through the network, and may - * change at any time. The node with lowest address rules + * Note that network plane id propagates through the network, and may + * change at any time. The node with lowest address rules */ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) { u32 rec_gap = 0; u32 max_pkt_info; - u32 max_pkt_ack; + u32 max_pkt_ack; u32 msg_tol; struct tipc_msg *msg = buf_msg(buf); @@ -2188,12 +2188,12 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) l_ptr->owner->permit_changeover = msg_redundant_link(msg); switch (msg_type(msg)) { - + case RESET_MSG: if (!link_working_unknown(l_ptr) && l_ptr->peer_session) { if (msg_session(msg) == l_ptr->peer_session) { dbg("Duplicate RESET: %u<->%u\n", - msg_session(msg), l_ptr->peer_session); + msg_session(msg), l_ptr->peer_session); break; /* duplicate: ignore */ } } @@ -2211,13 +2211,13 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) l_ptr->priority = msg_linkprio(msg); max_pkt_info = msg_max_pkt(msg); - if (max_pkt_info) { + if (max_pkt_info) { if (max_pkt_info < l_ptr->max_pkt_target) l_ptr->max_pkt_target = max_pkt_info; if (l_ptr->max_pkt > l_ptr->max_pkt_target) l_ptr->max_pkt = l_ptr->max_pkt_target; } else { - l_ptr->max_pkt = l_ptr->max_pkt_target; + l_ptr->max_pkt = l_ptr->max_pkt_target; } l_ptr->owner->bclink.supported = (max_pkt_info != 0); @@ -2235,8 +2235,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) if ((msg_tol = msg_link_tolerance(msg))) link_set_supervision_props(l_ptr, msg_tol); - - if (msg_linkprio(msg) && + + if (msg_linkprio(msg) && (msg_linkprio(msg) != l_ptr->priority)) { warn("Resetting link <%s>, priority change %u->%u\n", l_ptr->name, l_ptr->priority, msg_linkprio(msg)); @@ -2250,25 +2250,25 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) break; if (less_eq(mod(l_ptr->next_in_no), msg_next_sent(msg))) { - rec_gap = mod(msg_next_sent(msg) - + rec_gap = mod(msg_next_sent(msg) - mod(l_ptr->next_in_no)); } max_pkt_ack = msg_max_pkt(msg); - if (max_pkt_ack > l_ptr->max_pkt) { - dbg("Link <%s> updated MTU %u -> %u\n", - l_ptr->name, l_ptr->max_pkt, max_pkt_ack); - l_ptr->max_pkt = max_pkt_ack; - l_ptr->max_pkt_probes = 0; - } + if (max_pkt_ack > l_ptr->max_pkt) { + dbg("Link <%s> updated MTU %u -> %u\n", + l_ptr->name, l_ptr->max_pkt, max_pkt_ack); + l_ptr->max_pkt = max_pkt_ack; + l_ptr->max_pkt_probes = 0; + } max_pkt_ack = 0; - if (msg_probe(msg)) { + if (msg_probe(msg)) { l_ptr->stats.recv_probes++; - if (msg_size(msg) > sizeof(l_ptr->proto_msg)) { - max_pkt_ack = msg_size(msg); - } - } + if (msg_size(msg) > sizeof(l_ptr->proto_msg)) { + max_pkt_ack = msg_size(msg); + } + } /* Protocol message before retransmits, reduce loss risk */ @@ -2294,11 +2294,11 @@ exit: /* - * tipc_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. */ -void tipc_link_tunnel(struct link *l_ptr, - struct tipc_msg *tunnel_hdr, +void tipc_link_tunnel(struct link *l_ptr, + struct tipc_msg *tunnel_hdr, struct tipc_msg *msg, u32 selector) { @@ -2374,7 +2374,7 @@ void tipc_link_changeover(struct link *l_ptr) return; } - split_bundles = (l_ptr->owner->active_links[0] != + split_bundles = (l_ptr->owner->active_links[0] != l_ptr->owner->active_links[1]); while (crs) { @@ -2418,7 +2418,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) if (msg_user(msg) == MSG_BUNDLER) msg_set_type(msg, CLOSED_MSG); msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */ - msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); + msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); msg_set_size(&tunnel_hdr, length + INT_H_SIZE); outbuf = buf_acquire(length + INT_H_SIZE); if (outbuf == NULL) { @@ -2445,7 +2445,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) * @skb: encapsulating message buffer * @from_pos: offset to extract from * - * Returns a new message buffer containing an embedded message. The + * Returns a new message buffer containing an embedded message. The * encapsulating message itself is left unchanged. */ @@ -2461,7 +2461,7 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos) return eb; } -/* +/* * link_recv_changeover_msg(): Receive tunneled packet sent * via other link. Node is locked. Return extracted buffer. */ @@ -2482,7 +2482,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, goto exit; } if (dest_link == *l_ptr) { - err("Unexpected changeover message on link <%s>\n", + err("Unexpected changeover message on link <%s>\n", (*l_ptr)->name); goto exit; } @@ -2582,9 +2582,9 @@ void tipc_link_recv_bundle(struct sk_buff *buf) */ -/* +/* * 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. */ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) @@ -2650,9 +2650,9 @@ exit: return dsz; } -/* - * A pending message being re-assembled must store certain values - * to handle subsequent fragments correctly. The following functions +/* + * A pending message being re-assembled must store certain values + * to handle subsequent fragments correctly. The following functions * help storing these values in unused, available fields in the * pending message. This makes dynamic memory allocation unecessary. */ @@ -2692,11 +2692,11 @@ static void incr_timer_cnt(struct sk_buff *buf) msg_incr_reroute_cnt(buf_msg(buf)); } -/* - * tipc_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. */ -int tipc_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 sk_buff *prev = NULL; @@ -2737,9 +2737,9 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, /* Prepare buffer for subsequent fragments. */ - set_long_msg_seqno(pbuf, long_msg_seq_no); - set_fragm_size(pbuf,fragm_sz); - set_expected_frags(pbuf,exp_fragm_cnt - 1); + set_long_msg_seqno(pbuf, long_msg_seq_no); + set_fragm_size(pbuf,fragm_sz); + set_expected_frags(pbuf,exp_fragm_cnt - 1); } else { warn("Link unable to reassemble fragmented message\n"); } @@ -2765,7 +2765,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, *m = buf_msg(pbuf); return 1; } - set_expected_frags(pbuf,exp_frags); + set_expected_frags(pbuf,exp_frags); return 0; } dbg(" Discarding orphan fragment %x\n",fbuf); @@ -2849,10 +2849,10 @@ void tipc_link_set_queue_limits(struct link *l_ptr, u32 window) * link_find_link - locate link by name * @name - ptr to link name string * @node - ptr to area to be filled with ptr to associated node - * + * * Caller must hold 'tipc_net_lock' to ensure node and bearer are not deleted; * this also prevents link deletion. - * + * * Returns pointer to link (or 0 if invalid link name). */ @@ -2860,7 +2860,7 @@ static struct link *link_find_link(const char *name, struct node **node) { struct link_name link_name_parts; struct bearer *b_ptr; - struct link *l_ptr; + struct link *l_ptr; if (!link_name_validate(name, &link_name_parts)) return NULL; @@ -2869,7 +2869,7 @@ static struct link *link_find_link(const char *name, struct node **node) if (!b_ptr) return NULL; - *node = tipc_node_find(link_name_parts.addr_peer); + *node = tipc_node_find(link_name_parts.addr_peer); if (!*node) return NULL; @@ -2880,14 +2880,14 @@ static struct link *link_find_link(const char *name, struct node **node) return l_ptr; } -struct sk_buff *tipc_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) { struct tipc_link_config *args; - u32 new_value; + u32 new_value; struct link *l_ptr; struct node *node; - int res; + int res; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG)) return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); @@ -2899,40 +2899,40 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space if ((cmd == TIPC_CMD_SET_LINK_WINDOW) && (tipc_bclink_set_queue_limits(new_value) == 0)) return tipc_cfg_reply_none(); - return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED + return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED " (cannot change setting on broadcast link)"); } 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) { read_unlock_bh(&tipc_net_lock); - return tipc_cfg_reply_error_string("link not found"); + return tipc_cfg_reply_error_string("link not found"); } tipc_node_lock(node); res = -EINVAL; switch (cmd) { - case TIPC_CMD_SET_LINK_TOL: - if ((new_value >= TIPC_MIN_LINK_TOL) && + case TIPC_CMD_SET_LINK_TOL: + if ((new_value >= TIPC_MIN_LINK_TOL) && (new_value <= TIPC_MAX_LINK_TOL)) { link_set_supervision_props(l_ptr, new_value); - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, new_value, 0, 0); res = TIPC_OK; } break; - case TIPC_CMD_SET_LINK_PRI: + case TIPC_CMD_SET_LINK_PRI: if ((new_value >= TIPC_MIN_LINK_PRI) && (new_value <= TIPC_MAX_LINK_PRI)) { l_ptr->priority = new_value; - tipc_link_send_proto_msg(l_ptr, STATE_MSG, + tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, new_value, 0); res = TIPC_OK; } break; - case TIPC_CMD_SET_LINK_WINDOW: - if ((new_value >= TIPC_MIN_LINK_WIN) && + case TIPC_CMD_SET_LINK_WINDOW: + if ((new_value >= TIPC_MIN_LINK_WIN) && (new_value <= TIPC_MAX_LINK_WIN)) { tipc_link_set_queue_limits(l_ptr, new_value); res = TIPC_OK; @@ -2943,7 +2943,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space read_unlock_bh(&tipc_net_lock); if (res) - return tipc_cfg_reply_error_string("cannot change link setting"); + return tipc_cfg_reply_error_string("cannot change link setting"); return tipc_cfg_reply_none(); } @@ -2963,7 +2963,7 @@ static void link_reset_statistics(struct link *l_ptr) struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_space) { char *link_name; - struct link *l_ptr; + struct link *l_ptr; struct node *node; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_NAME)) @@ -2977,7 +2977,7 @@ struct sk_buff *tipc_link_cmd_reset_stats(const void *req_tlv_area, int req_tlv_ } 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) { read_unlock_bh(&tipc_net_lock); return tipc_cfg_reply_error_string("link not found"); @@ -3004,14 +3004,14 @@ static u32 percent(u32 count, u32 total) * @name: link name * @buf: print buffer area * @buf_size: size of print buffer area - * + * * Returns length of print buffer data string (or 0 if error) */ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) { struct print_buf pb; - struct link *l_ptr; + struct link *l_ptr; struct node *node; char *status; u32 profile_total = 0; @@ -3022,7 +3022,7 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) tipc_printbuf_init(&pb, buf, buf_size); read_lock_bh(&tipc_net_lock); - l_ptr = link_find_link(name, &node); + l_ptr = link_find_link(name, &node); if (!l_ptr) { read_unlock_bh(&tipc_net_lock); return 0; @@ -3036,28 +3036,28 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) else status = "DEFUNCT"; tipc_printf(&pb, "Link <%s>\n" - " %s MTU:%u Priority:%u Tolerance:%u ms" - " Window:%u packets\n", - l_ptr->name, status, link_max_pkt(l_ptr), + " %s MTU:%u Priority:%u Tolerance:%u ms" + " Window:%u packets\n", + l_ptr->name, status, link_max_pkt(l_ptr), l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]); - tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n", l_ptr->next_in_no - l_ptr->stats.recv_info, l_ptr->stats.recv_fragments, l_ptr->stats.recv_fragmented, l_ptr->stats.recv_bundles, l_ptr->stats.recv_bundled); - tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", + tipc_printf(&pb, " TX packets:%u fragments:%u/%u bundles:%u/%u\n", l_ptr->next_out_no - l_ptr->stats.sent_info, l_ptr->stats.sent_fragments, - l_ptr->stats.sent_fragmented, + l_ptr->stats.sent_fragmented, l_ptr->stats.sent_bundles, l_ptr->stats.sent_bundled); profile_total = l_ptr->stats.msg_length_counts; if (!profile_total) profile_total = 1; tipc_printf(&pb, " TX profile sample:%u packets average:%u octets\n" - " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% " - "-16354:%u%% -32768:%u%% -66000:%u%%\n", + " 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% " + "-16354:%u%% -32768:%u%% -66000:%u%%\n", l_ptr->stats.msg_length_counts, l_ptr->stats.msg_lengths_total / profile_total, percent(l_ptr->stats.msg_length_profile[0], profile_total), @@ -3067,21 +3067,21 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size) percent(l_ptr->stats.msg_length_profile[4], profile_total), percent(l_ptr->stats.msg_length_profile[5], profile_total), percent(l_ptr->stats.msg_length_profile[6], profile_total)); - tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n", + tipc_printf(&pb, " RX states:%u probes:%u naks:%u defs:%u dups:%u\n", l_ptr->stats.recv_states, l_ptr->stats.recv_probes, l_ptr->stats.recv_nacks, - l_ptr->stats.deferred_recv, + l_ptr->stats.deferred_recv, l_ptr->stats.duplicates); - tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n", - l_ptr->stats.sent_states, - l_ptr->stats.sent_probes, - l_ptr->stats.sent_nacks, - l_ptr->stats.sent_acks, + tipc_printf(&pb, " TX states:%u probes:%u naks:%u acks:%u dups:%u\n", + l_ptr->stats.sent_states, + l_ptr->stats.sent_probes, + l_ptr->stats.sent_nacks, + l_ptr->stats.sent_acks, l_ptr->stats.retransmitted); tipc_printf(&pb, " Congestion bearer:%u link:%u Send queue max:%u avg:%u\n", l_ptr->stats.bearer_congs, - l_ptr->stats.link_congs, + l_ptr->stats.link_congs, l_ptr->stats.max_queue_sz, l_ptr->stats.queue_sz_counts ? (l_ptr->stats.accu_queue_sz / l_ptr->stats.queue_sz_counts) @@ -3113,7 +3113,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s (char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO); if (!str_len) { buf_discard(buf); - return tipc_cfg_reply_error_string("link not found"); + return tipc_cfg_reply_error_string("link not found"); } skb_put(buf, TLV_SPACE(str_len)); @@ -3164,7 +3164,7 @@ int link_control(const char *name, u32 op, u32 val) * tipc_link_get_max_pkt - get maximum packet size to use when sending to destination * @dest: network address of destination node * @selector: used to select from set of active links - * + * * If no active link can be found, uses default maximum packet size. */ @@ -3173,11 +3173,11 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector) struct node *n_ptr; struct link *l_ptr; u32 res = MAX_PKT_DEFAULT; - + if (dest == tipc_own_addr) return MAX_MSG_SIZE; - read_lock_bh(&tipc_net_lock); + read_lock_bh(&tipc_net_lock); n_ptr = tipc_node_select(dest, selector); if (n_ptr) { tipc_node_lock(n_ptr); @@ -3186,7 +3186,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector) res = link_max_pkt(l_ptr); tipc_node_unlock(n_ptr); } - read_unlock_bh(&tipc_net_lock); + read_unlock_bh(&tipc_net_lock); return res; } @@ -3244,8 +3244,8 @@ static void link_print(struct link *l_ptr, struct print_buf *buf, tipc_printf(buf, "%u]", msg_seqno(buf_msg (l_ptr->last_out)), l_ptr->out_queue_size); - if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - - msg_seqno(buf_msg(l_ptr->first_out))) + if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - + msg_seqno(buf_msg(l_ptr->first_out))) != (l_ptr->out_queue_size - 1)) || (l_ptr->last_out->next != 0)) { tipc_printf(buf, "\nSend queue inconsistency\n"); diff --git a/net/tipc/link.h b/net/tipc/link.h index 2d3c157f707..52f3e7c1871 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h @@ -1,6 +1,6 @@ /* * net/tipc/link.h: Include file for TIPC link code - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -45,8 +45,8 @@ #define PUSH_FAILED 1 #define PUSH_FINISHED 2 -/* - * Link states +/* + * Link states */ #define WORKING_WORKING 560810u @@ -54,7 +54,7 @@ #define RESET_UNKNOWN 560812u #define RESET_RESET 560813u -/* +/* * Starting value for maximum packet size negotiation on unicast links * (unless bearer MTU is less) */ @@ -74,7 +74,7 @@ * @peer_session: link session # being used by peer end of link * @peer_bearer_id: bearer id used by link's peer endpoint * @b_ptr: pointer to bearer used by link - * @tolerance: minimum link continuity loss needed to reset link [in ms] + * @tolerance: minimum link continuity loss needed to reset link [in ms] * @continuity_interval: link continuity testing interval [in ms] * @abort_limit: # of unacknowledged continuity probes needed to reset link * @state: current state of link FSM @@ -110,7 +110,7 @@ * @stats: collects statistics regarding link activity * @print_buf: print buffer used to log link activity */ - + struct link { u32 addr; char name[TIPC_MAX_LINK_NAME]; @@ -143,18 +143,18 @@ struct link { u32 exp_msg_count; u32 reset_checkpoint; - /* Max packet negotiation */ - u32 max_pkt; - u32 max_pkt_target; - u32 max_pkt_probes; + /* Max packet negotiation */ + u32 max_pkt; + u32 max_pkt_target; + u32 max_pkt_probes; /* Sending */ u32 out_queue_size; struct sk_buff *first_out; struct sk_buff *last_out; u32 next_out_no; - u32 last_retransmitted; - u32 stale_count; + u32 last_retransmitted; + u32 stale_count; /* Reception */ u32 next_in_no; @@ -174,7 +174,7 @@ struct link { u32 long_msg_seq_no; struct sk_buff *defragm_buf; - /* Statistics */ + /* Statistics */ struct { u32 sent_info; /* used in counting # sent packets */ u32 recv_info; /* used in counting # recv'd packets */ @@ -239,9 +239,9 @@ void tipc_link_reset(struct link *l_ptr); int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf); u32 tipc_link_get_max_pkt(u32 dest,u32 selector); -int tipc_link_send_sections_fast(struct port* sender, +int tipc_link_send_sections_fast(struct port* sender, struct iovec const *msg_sect, - const u32 num_sect, + const u32 num_sect, u32 destnode); int tipc_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, @@ -250,7 +250,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf); int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, struct tipc_msg **msg); -void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, +void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int prob, u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); void tipc_link_push_queue(struct link *l_ptr); u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 3bd345a344e..782485468fb 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c @@ -1,6 +1,6 @@ /* * net/tipc/msg.c: TIPC message header routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 6699aaf7bd4..62d54906360 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h @@ -1,6 +1,6 @@ /* * net/tipc/msg.h: Include file for TIPC message header routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -56,10 +56,10 @@ /* TIPC user data message header format, version 2 - + - Fundamental definitions available to privileged TIPC users are located in tipc_msg.h. - - Remaining definitions available to TIPC internal users appear below. + - Remaining definitions available to TIPC internal users appear below. */ @@ -75,7 +75,7 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w, msg_set_word(m, w, (word |= (val << pos))); } -/* +/* * Word 0 */ @@ -84,7 +84,7 @@ static inline u32 msg_version(struct tipc_msg *m) return msg_bits(m, 0, 29, 7); } -static inline void msg_set_version(struct tipc_msg *m) +static inline void msg_set_version(struct tipc_msg *m) { msg_set_bits(m, 0, 29, 0xf, TIPC_VERSION); } @@ -99,47 +99,47 @@ static inline u32 msg_isdata(struct tipc_msg *m) return (msg_user(m) <= DATA_CRITICAL); } -static inline void msg_set_user(struct tipc_msg *m, u32 n) +static inline void msg_set_user(struct tipc_msg *m, u32 n) { msg_set_bits(m, 0, 25, 0xf, n); } -static inline void msg_set_importance(struct tipc_msg *m, u32 i) +static inline void msg_set_importance(struct tipc_msg *m, u32 i) { msg_set_user(m, i); } -static inline void msg_set_hdr_sz(struct tipc_msg *m,u32 n) +static inline void msg_set_hdr_sz(struct tipc_msg *m,u32 n) { msg_set_bits(m, 0, 21, 0xf, n>>2); } -static inline int msg_non_seq(struct tipc_msg *m) +static inline int msg_non_seq(struct tipc_msg *m) { return msg_bits(m, 0, 20, 1); } -static inline void msg_set_non_seq(struct tipc_msg *m) +static inline void msg_set_non_seq(struct tipc_msg *m) { msg_set_bits(m, 0, 20, 1, 1); } -static inline int msg_dest_droppable(struct tipc_msg *m) +static inline int msg_dest_droppable(struct tipc_msg *m) { return msg_bits(m, 0, 19, 1); } -static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d) +static inline void msg_set_dest_droppable(struct tipc_msg *m, u32 d) { msg_set_bits(m, 0, 19, 1, d); } -static inline int msg_src_droppable(struct tipc_msg *m) +static inline int msg_src_droppable(struct tipc_msg *m) { return msg_bits(m, 0, 18, 1); } -static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d) +static inline void msg_set_src_droppable(struct tipc_msg *m, u32 d) { msg_set_bits(m, 0, 18, 1, d); } @@ -150,31 +150,31 @@ static inline void msg_set_size(struct tipc_msg *m, u32 sz) } -/* +/* * Word 1 */ -static inline void msg_set_type(struct tipc_msg *m, u32 n) +static inline void msg_set_type(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 29, 0x7, n); } -static inline void msg_set_errcode(struct tipc_msg *m, u32 err) +static inline void msg_set_errcode(struct tipc_msg *m, u32 err) { msg_set_bits(m, 1, 25, 0xf, err); } -static inline u32 msg_reroute_cnt(struct tipc_msg *m) +static inline u32 msg_reroute_cnt(struct tipc_msg *m) { return msg_bits(m, 1, 21, 0xf); } -static inline void msg_incr_reroute_cnt(struct tipc_msg *m) +static inline void msg_incr_reroute_cnt(struct tipc_msg *m) { msg_set_bits(m, 1, 21, 0xf, msg_reroute_cnt(m) + 1); } -static inline void msg_reset_reroute_cnt(struct tipc_msg *m) +static inline void msg_reset_reroute_cnt(struct tipc_msg *m) { msg_set_bits(m, 1, 21, 0xf, 0); } @@ -184,12 +184,12 @@ static inline u32 msg_lookup_scope(struct tipc_msg *m) return msg_bits(m, 1, 19, 0x3); } -static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n) +static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 19, 0x3, n); } -static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz) +static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz) { u32 hsz = msg_hdr_sz(m); char *to = (char *)&m->hdr[hsz/4]; @@ -206,13 +206,13 @@ static inline u32 msg_bcast_ack(struct tipc_msg *m) return msg_bits(m, 1, 0, 0xffff); } -static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n) +static inline void msg_set_bcast_ack(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 0, 0xffff, n); } -/* +/* * Word 2 */ @@ -221,7 +221,7 @@ static inline u32 msg_ack(struct tipc_msg *m) return msg_bits(m, 2, 16, 0xffff); } -static inline void msg_set_ack(struct tipc_msg *m, u32 n) +static inline void msg_set_ack(struct tipc_msg *m, u32 n) { msg_set_bits(m, 2, 16, 0xffff, n); } @@ -231,48 +231,48 @@ static inline u32 msg_seqno(struct tipc_msg *m) return msg_bits(m, 2, 0, 0xffff); } -static inline void msg_set_seqno(struct tipc_msg *m, u32 n) +static inline void msg_set_seqno(struct tipc_msg *m, u32 n) { msg_set_bits(m, 2, 0, 0xffff, n); } -/* +/* * Words 3-10 */ -static inline void msg_set_prevnode(struct tipc_msg *m, u32 a) +static inline void msg_set_prevnode(struct tipc_msg *m, u32 a) { msg_set_word(m, 3, a); } -static inline void msg_set_origport(struct tipc_msg *m, u32 p) +static inline void msg_set_origport(struct tipc_msg *m, u32 p) { msg_set_word(m, 4, p); } -static inline void msg_set_destport(struct tipc_msg *m, u32 p) +static inline void msg_set_destport(struct tipc_msg *m, u32 p) { msg_set_word(m, 5, p); } -static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p) +static inline void msg_set_mc_netid(struct tipc_msg *m, u32 p) { msg_set_word(m, 5, p); } -static inline void msg_set_orignode(struct tipc_msg *m, u32 a) +static inline void msg_set_orignode(struct tipc_msg *m, u32 a) { msg_set_word(m, 6, a); } -static inline void msg_set_destnode(struct tipc_msg *m, u32 a) +static inline void msg_set_destnode(struct tipc_msg *m, u32 a) { msg_set_word(m, 7, a); } -static inline int msg_is_dest(struct tipc_msg *m, u32 d) +static inline int msg_is_dest(struct tipc_msg *m, u32 d) { return(msg_short(m) || (msg_destnode(m) == d)); } @@ -284,7 +284,7 @@ static inline u32 msg_routed(struct tipc_msg *m) return(msg_destnode(m) ^ msg_orignode(m)) >> 11; } -static inline void msg_set_nametype(struct tipc_msg *m, u32 n) +static inline void msg_set_nametype(struct tipc_msg *m, u32 n) { msg_set_word(m, 8, n); } @@ -309,17 +309,17 @@ static inline void msg_set_transp_seqno(struct tipc_msg *m, u32 n) msg_set_word(m, 8, n); } -static inline void msg_set_namelower(struct tipc_msg *m, u32 n) +static inline void msg_set_namelower(struct tipc_msg *m, u32 n) { msg_set_word(m, 9, n); } -static inline void msg_set_nameinst(struct tipc_msg *m, u32 n) +static inline void msg_set_nameinst(struct tipc_msg *m, u32 n) { msg_set_namelower(m, n); } -static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) +static inline void msg_set_nameupper(struct tipc_msg *m, u32 n) { msg_set_word(m, 10, n); } @@ -329,7 +329,7 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) return (struct tipc_msg *)msg_data(m); } -static inline void msg_expand(struct tipc_msg *m, u32 destnode) +static inline void msg_expand(struct tipc_msg *m, u32 destnode) { if (!msg_short(m)) return; @@ -344,7 +344,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) /* TIPC internal message header format, version 2 - 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 + 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ w0:|vers |msg usr|hdr sz |n|resrv| packet size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @@ -372,9 +372,9 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ NB: CONN_MANAGER use data message format. LINK_CONFIG has own format. -*/ +*/ -/* +/* * Internal users */ @@ -390,7 +390,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) #define INT_H_SIZE 40 #define DSC_H_SIZE 40 -/* +/* * Connection management protocol messages */ @@ -398,7 +398,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) #define CONN_PROBE_REPLY 1 #define CONN_ACK 2 -/* +/* * Name distributor messages */ @@ -406,7 +406,7 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode) #define WITHDRAWAL 1 -/* +/* * Word 1 */ @@ -425,13 +425,13 @@ static inline u32 msg_req_links(struct tipc_msg *m) return msg_bits(m, 1, 16, 0xfff); } -static inline void msg_set_req_links(struct tipc_msg *m, u32 n) +static inline void msg_set_req_links(struct tipc_msg *m, u32 n) { msg_set_bits(m, 1, 16, 0xfff, n); } -/* +/* * Word 2 */ @@ -440,7 +440,7 @@ static inline u32 msg_dest_domain(struct tipc_msg *m) return msg_word(m, 2); } -static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n) +static inline void msg_set_dest_domain(struct tipc_msg *m, u32 n) { msg_set_word(m, 2, n); } @@ -460,13 +460,13 @@ static inline u32 msg_bcgap_to(struct tipc_msg *m) return msg_bits(m, 2, 0, 0xffff); } -static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n) +static inline void msg_set_bcgap_to(struct tipc_msg *m, u32 n) { msg_set_bits(m, 2, 0, 0xffff, n); } -/* +/* * Word 4 */ @@ -533,7 +533,7 @@ static inline void msg_set_link_selector(struct tipc_msg *m, u32 n) msg_set_bits(m, 4, 0, 1, (n & 1)); } -/* +/* * Word 5 */ @@ -603,7 +603,7 @@ static inline void msg_clear_redundant_link(struct tipc_msg *m) } -/* +/* * Word 9 */ @@ -627,12 +627,12 @@ static inline void msg_set_bcast_tag(struct tipc_msg *m, u32 n) msg_set_bits(m, 9, 16, 0xffff, n); } -static inline u32 msg_max_pkt(struct tipc_msg *m) +static inline u32 msg_max_pkt(struct tipc_msg *m) { return (msg_bits(m, 9, 16, 0xffff) * 4); } -static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n) +static inline void msg_set_max_pkt(struct tipc_msg *m, u32 n) { msg_set_bits(m, 9, 16, 0xffff, (n / 4)); } @@ -647,7 +647,7 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n) msg_set_bits(m, 9, 0, 0xffff, n); } -/* +/* * Routing table message data */ @@ -672,7 +672,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) msg_data(m)[pos + 4] = 1; } -/* +/* * Segmentation message types */ @@ -680,7 +680,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) #define FRAGMENT 1 #define LAST_FRAGMENT 2 -/* +/* * Link management protocol message types */ @@ -688,13 +688,13 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) #define RESET_MSG 1 #define ACTIVATE_MSG 2 -/* +/* * Changeover tunnel message types */ #define DUPLICATE_MSG 0 #define ORIGINAL_MSG 1 -/* +/* * Routing table message types */ #define EXT_ROUTING_TABLE 0 @@ -703,7 +703,7 @@ static inline void msg_set_dataoctet(struct tipc_msg *m, u32 pos) #define ROUTE_ADDITION 3 #define ROUTE_REMOVAL 4 -/* +/* * Config protocol message types */ @@ -724,7 +724,7 @@ static inline u32 msg_tot_importance(struct tipc_msg *m) } -static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, +static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, u32 err, u32 hsize, u32 destnode) { memset(m, 0, hsize); @@ -741,7 +741,7 @@ static inline void msg_init(struct tipc_msg *m, u32 user, u32 type, } } -/** +/** * msg_calc_data_size - determine total data size for message */ @@ -755,15 +755,15 @@ static inline int msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect) return dsz; } -/** +/** * msg_build - create message using specified header and data - * + * * Note: Caller must not hold any locks in case copy_from_user() is interrupted! - * + * * Returns message data size or errno */ -static inline int msg_build(struct tipc_msg *hdr, +static inline int msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, u32 num_sect, int max_size, int usrmem, struct sk_buff** buf) { @@ -789,11 +789,11 @@ static inline int msg_build(struct tipc_msg *hdr, memcpy((*buf)->data, (unchar *)hdr, hsz); for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) { if (likely(usrmem)) - res = !copy_from_user((*buf)->data + pos, - msg_sect[cnt].iov_base, + res = !copy_from_user((*buf)->data + pos, + msg_sect[cnt].iov_base, msg_sect[cnt].iov_len); else - memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, + memcpy((*buf)->data + pos, msg_sect[cnt].iov_base, msg_sect[cnt].iov_len); pos += msg_sect[cnt].iov_len; } diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 7bf87cb26ef..39fd1619feb 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c @@ -1,6 +1,6 @@ /* * net/tipc/name_distr.c: TIPC name distribution code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -53,15 +53,15 @@ * @upper: name sequence upper bound * @ref: publishing port reference * @key: publication key - * + * * ===> All fields are stored in network byte order. <=== - * + * * First 3 fields identify (name or) name sequence being published. * Reference field uniquely identifies port that published name sequence. * Key field uniquely identifies publication, in the event a port has * multiple publications of the same name sequence. - * - * Note: There is no field that identifies the publishing node because it is + * + * Note: There is no field that identifies the publishing node because it is * the same for all items contained within a publication message. */ @@ -74,12 +74,12 @@ struct distr_item { }; /** - * List of externally visible publications by this node -- + * List of externally visible publications by this node -- * that is, all publications having scope > TIPC_NODE_SCOPE. */ static LIST_HEAD(publ_root); -static u32 publ_cnt = 0; +static u32 publ_cnt = 0; /** * publ_to_item - add publication info to a publication message @@ -101,12 +101,12 @@ static void publ_to_item(struct distr_item *i, struct publication *p) static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest) { - struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); + struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); struct tipc_msg *msg; if (buf != NULL) { msg = buf_msg(buf); - msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK, + msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK, LONG_H_SIZE, dest); msg_set_size(msg, LONG_H_SIZE + size); } @@ -174,7 +174,7 @@ void tipc_named_node_up(unsigned long node) u32 rest; u32 max_item_buf; - read_lock_bh(&tipc_nametbl_lock); + read_lock_bh(&tipc_nametbl_lock); max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE; max_item_buf *= ITEM_SIZE; rest = publ_cnt * ITEM_SIZE; @@ -183,7 +183,7 @@ void tipc_named_node_up(unsigned long node) if (!buf) { left = (rest <= max_item_buf) ? rest : max_item_buf; rest -= left; - buf = named_prepare_buf(PUBLICATION, left, node); + buf = named_prepare_buf(PUBLICATION, left, node); if (!buf) { warn("Bulk publication distribution failure\n"); goto exit; @@ -196,20 +196,20 @@ void tipc_named_node_up(unsigned long node) if (!left) { msg_set_link_selector(buf_msg(buf), node); 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_link_send(buf, node, node); buf = NULL; } } exit: - read_unlock_bh(&tipc_nametbl_lock); + read_unlock_bh(&tipc_nametbl_lock); } /** * node_is_down - remove publication associated with a failed node - * - * Invoked for each publication issued by a newly failed node. + * + * Invoked for each publication issued by a newly failed node. * Removes publication structure from name table & deletes it. * In rare cases the link may have come back up again when this * function is called, and we have two items representing the same @@ -221,15 +221,15 @@ static void node_is_down(struct publication *publ) { struct publication *p; - write_lock_bh(&tipc_nametbl_lock); - dbg("node_is_down: withdrawing %u, %u, %u\n", + write_lock_bh(&tipc_nametbl_lock); + dbg("node_is_down: withdrawing %u, %u, %u\n", publ->type, publ->lower, publ->upper); - publ->key += 1222345; - p = tipc_nametbl_remove_publ(publ->type, publ->lower, + publ->key += 1222345; + p = tipc_nametbl_remove_publ(publ->type, publ->lower, publ->node, publ->ref, publ->key); write_unlock_bh(&tipc_nametbl_lock); - if (p != publ) { + if (p != publ) { err("Unable to remove publication from failed node\n" "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n", publ->type, publ->lower, publ->node, publ->ref, publ->key); @@ -251,27 +251,27 @@ void tipc_named_recv(struct sk_buff *buf) struct distr_item *item = (struct distr_item *)msg_data(msg); u32 count = msg_data_sz(msg) / ITEM_SIZE; - write_lock_bh(&tipc_nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); while (count--) { if (msg_type(msg) == PUBLICATION) { - dbg("tipc_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->upper)); - publ = tipc_nametbl_insert_publ(ntohl(item->type), + publ = tipc_nametbl_insert_publ(ntohl(item->type), ntohl(item->lower), ntohl(item->upper), TIPC_CLUSTER_SCOPE, - msg_orignode(msg), + msg_orignode(msg), ntohl(item->ref), ntohl(item->key)); if (publ) { - tipc_nodesub_subscribe(&publ->subscr, - msg_orignode(msg), + tipc_nodesub_subscribe(&publ->subscr, + msg_orignode(msg), publ, (net_ev_handler)node_is_down); } } else if (msg_type(msg) == WITHDRAWAL) { - dbg("tipc_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->upper)); publ = tipc_nametbl_remove_publ(ntohl(item->type), @@ -282,7 +282,7 @@ void tipc_named_recv(struct sk_buff *buf) if (publ) { tipc_nodesub_unsubscribe(&publ->subscr); - kfree(publ); + kfree(publ); } else { err("Unable to remove publication by node 0x%x\n" "(type=%u, lower=%u, ref=%u, key=%u)\n", @@ -295,13 +295,13 @@ void tipc_named_recv(struct sk_buff *buf) } item++; } - write_unlock_bh(&tipc_nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); buf_discard(buf); } /** * tipc_named_reinit - re-initialize local publication list - * + * * This routine is called whenever TIPC networking is (re)enabled. * All existing publications by this node that have "cluster" or "zone" scope * are updated to reflect the node's current network address. @@ -312,11 +312,11 @@ void tipc_named_reinit(void) { struct publication *publ; - write_lock_bh(&tipc_nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); list_for_each_entry(publ, &publ_root, local_list) { if (publ->node == tipc_own_addr) break; publ->node = tipc_own_addr; } - write_unlock_bh(&tipc_nametbl_lock); + write_unlock_bh(&tipc_nametbl_lock); } diff --git a/net/tipc/name_distr.h b/net/tipc/name_distr.h index 843da0172f4..1e41bdd4f25 100644 --- a/net/tipc/name_distr.h +++ b/net/tipc/name_distr.h @@ -1,6 +1,6 @@ /* * net/tipc/name_distr.h: Include file for TIPC name distribution code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 049242ea5c3..9dfc9127acd 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -1,6 +1,6 @@ /* * net/tipc/name_table.c: TIPC name table code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -65,7 +65,7 @@ struct sub_seq { struct publication *zone_list; }; -/** +/** * struct name_seq - container for all published instances of a name type * @type: 32 bit 'type' value for name sequence * @sseq: pointer to dynamically-sized array of sub-sequences of this 'type'; @@ -89,7 +89,7 @@ struct name_seq { /** * struct name_table - table containing all existing port name publications - * @types: pointer to fixed-sized array of name sequence lists, + * @types: pointer to fixed-sized array of name sequence lists, * accessed via hashing on 'type'; name sequence lists are *not* sorted * @local_publ_count: number of publications issued by this node */ @@ -113,8 +113,8 @@ static int hash(int x) * publ_create - create a publication structure */ -static struct publication *publ_create(u32 type, u32 lower, u32 upper, - u32 scope, u32 node, u32 port_ref, +static struct publication *publ_create(u32 type, u32 lower, u32 upper, + u32 scope, u32 node, u32 port_ref, u32 key) { struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC); @@ -148,7 +148,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt) /** * 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. */ @@ -178,7 +178,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea /** * nameseq_find_subseq - find sub-sequence (if any) matching a name instance - * + * * Very time-critical, so binary searches through sub-sequence array. */ @@ -204,7 +204,7 @@ static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, /** * nameseq_locate_subseq - determine position of name instance in sub-sequence - * + * * Returns index in sub-sequence array of the entry that contains the specified * instance value; if no entry contains that value, returns the position * where a new entry for it would be inserted in the array. @@ -232,7 +232,7 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) } /** - * tipc_nameseq_insert_publ - + * tipc_nameseq_insert_publ - */ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, @@ -343,8 +343,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, } } - /* - * Any subscriptions waiting for notification? + /* + * Any subscriptions waiting for notification? */ list_for_each_entry_safe(s, st, &nseq->subscriptions, nameseq_list) { dbg("calling report_overlap()\n"); @@ -352,7 +352,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, publ->lower, publ->upper, TIPC_PUBLISHED, - publ->ref, + publ->ref, publ->node, created_subseq); } @@ -361,7 +361,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, /** * tipc_nameseq_remove_publ - - * + * * NOTE: There may be cases where TIPC is asked to remove a publication * that is not in the name table. For example, if another node issues a * publication for a name sequence that overlaps an existing name sequence @@ -392,12 +392,12 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i prev = sseq->zone_list; publ = sseq->zone_list->zone_list_next; - while ((publ->key != key) || (publ->ref != ref) || + while ((publ->key != key) || (publ->ref != ref) || (publ->node && (publ->node != node))) { prev = publ; publ = publ->zone_list_next; if (prev == sseq->zone_list) { - + /* Prevent endless loop if publication not found */ return NULL; @@ -426,7 +426,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i err("Unable to de-list cluster publication\n" "{%u%u}, node=0x%x, ref=%u, key=%u)\n", - publ->type, publ->lower, publ->node, + publ->type, publ->lower, publ->node, publ->ref, publ->key); goto end_cluster; } @@ -456,7 +456,7 @@ end_cluster: err("Unable to de-list node publication\n" "{%u%u}, node=0x%x, ref=%u, key=%u)\n", - publ->type, publ->lower, publ->node, + publ->type, publ->lower, publ->node, publ->ref, publ->key); goto end_node; } @@ -486,8 +486,8 @@ end_node: tipc_subscr_report_overlap(s, publ->lower, publ->upper, - TIPC_WITHDRAWN, - publ->ref, + TIPC_WITHDRAWN, + publ->ref, publ->node, removed_subseq); } @@ -517,8 +517,8 @@ void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s) int must_report = 1; do { - tipc_subscr_report_overlap(s, - sseq->lower, + tipc_subscr_report_overlap(s, + sseq->lower, sseq->upper, TIPC_PUBLISHED, crs->ref, @@ -576,7 +576,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, scope, node, port, key); } -struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, +struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node, u32 ref, u32 key) { struct publication *publ; @@ -676,14 +676,14 @@ not_found: /** * tipc_nametbl_mc_translate - find multicast destinations - * + * * Creates list of all local ports that overlap the given multicast address; * also determines if any off-node ports overlap. * * Note: Publications with a scope narrower than 'limit' are ignored. * (i.e. local node-scope publications mustn't receive messages arriving * from another node, even if the multcast link brought it here) - * + * * Returns non-zero if any off-node ports overlap */ @@ -730,7 +730,7 @@ exit: * tipc_nametbl_publish_rsv - publish port name using a reserved name type */ -int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, +int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) { int res; @@ -745,13 +745,13 @@ int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, * tipc_nametbl_publish - add name publication to network name tables */ -struct publication *tipc_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) { struct publication *publ; if (table.local_publ_count >= tipc_max_publications) { - warn("Publication failed, local publication limit reached (%u)\n", + warn("Publication failed, local publication limit reached (%u)\n", tipc_max_publications); return NULL; } @@ -808,22 +808,22 @@ void tipc_nametbl_subscribe(struct subscription *s) u32 type = s->seq.type; struct name_seq *seq; - write_lock_bh(&tipc_nametbl_lock); + write_lock_bh(&tipc_nametbl_lock); seq = nametbl_find_seq(type); if (!seq) { seq = tipc_nameseq_create(type, &table.types[hash(type)]); } - if (seq){ - spin_lock_bh(&seq->lock); - dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", - seq, type, s->seq.lower, s->seq.upper); - tipc_nameseq_subscribe(seq, s); - spin_unlock_bh(&seq->lock); - } else { + if (seq){ + spin_lock_bh(&seq->lock); + dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n", + seq, type, s->seq.lower, s->seq.upper); + tipc_nameseq_subscribe(seq, s); + spin_unlock_bh(&seq->lock); + } else { warn("Failed to create subscription for {%u,%u,%u}\n", s->seq.type, s->seq.lower, s->seq.upper); - } - write_unlock_bh(&tipc_nametbl_lock); + } + write_unlock_bh(&tipc_nametbl_lock); } /** @@ -834,19 +834,19 @@ void tipc_nametbl_unsubscribe(struct subscription *s) { struct name_seq *seq; - write_lock_bh(&tipc_nametbl_lock); - seq = nametbl_find_seq(s->seq.type); + write_lock_bh(&tipc_nametbl_lock); + seq = nametbl_find_seq(s->seq.type); if (seq != NULL){ - spin_lock_bh(&seq->lock); - list_del_init(&s->nameseq_list); - spin_unlock_bh(&seq->lock); - if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { - hlist_del_init(&seq->ns_list); - kfree(seq->sseqs); - kfree(seq); - } - } - write_unlock_bh(&tipc_nametbl_lock); + spin_lock_bh(&seq->lock); + list_del_init(&s->nameseq_list); + spin_unlock_bh(&seq->lock); + if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) { + hlist_del_init(&seq->ns_list); + kfree(seq->sseqs); + kfree(seq); + } + } + write_unlock_bh(&tipc_nametbl_lock); } @@ -952,7 +952,7 @@ static void nametbl_header(struct print_buf *buf, u32 depth) * nametbl_list - print specified name table contents into the given buffer */ -static void nametbl_list(struct print_buf *buf, u32 depth_info, +static void nametbl_list(struct print_buf *buf, u32 depth_info, u32 type, u32 lowbound, u32 upbound) { struct hlist_head *seq_head; @@ -976,7 +976,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, for (i = 0; i < tipc_nametbl_size; i++) { seq_head = &table.types[i]; hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { - nameseq_list(seq, buf, depth, seq->type, + nameseq_list(seq, buf, depth, seq->type, lowbound, upbound, i); } } @@ -991,7 +991,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info, seq_head = &table.types[i]; hlist_for_each_entry(seq, seq_node, seq_head, ns_list) { if (seq->type == type) { - nameseq_list(seq, buf, depth, type, + nameseq_list(seq, buf, depth, type, lowbound, upbound, i); break; } @@ -1030,7 +1030,7 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space) tipc_printbuf_init(&b, TLV_DATA(rep_tlv), MAX_NAME_TBL_QUERY); argv = (struct tipc_name_table_query *)TLV_DATA(req_tlv_area); 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)); read_unlock_bh(&tipc_nametbl_lock); str_len = tipc_printbuf_validate(&b); diff --git a/net/tipc/name_table.h b/net/tipc/name_table.h index e8a3d71763c..b9e7cd336d7 100644 --- a/net/tipc/name_table.h +++ b/net/tipc/name_table.h @@ -1,6 +1,6 @@ /* * net/tipc/name_table.h: Include file for TIPC name table code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -64,7 +64,7 @@ struct port_list; * @node_list: next matching name seq publication with >= node scope * @cluster_list: next matching name seq publication with >= cluster scope * @zone_list: next matching name seq publication with >= zone scope - * + * * Note that the node list, cluster list, and zone list are circular lists. */ @@ -89,16 +89,16 @@ extern rwlock_t tipc_nametbl_lock; struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space); u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node); -int tipc_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); -int tipc_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 publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key); int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key); struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, u32 scope, u32 node, u32 ref, u32 key); -struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, +struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node, u32 ref, u32 key); void tipc_nametbl_subscribe(struct subscription *s); void tipc_nametbl_unsubscribe(struct subscription *s); diff --git a/net/tipc/net.c b/net/tipc/net.c index a991bf8a7f7..c39c76201e8 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c @@ -1,6 +1,6 @@ /* * net/tipc/net.c: TIPC network routing code - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -49,63 +49,63 @@ #include "discover.h" #include "config.h" -/* +/* * The TIPC locking policy is designed to ensure a very fine locking * granularity, permitting complete parallel access to individual - * port and node/link instances. The code consists of three major + * port and node/link instances. The code consists of three major * locking domains, each protected with their own disjunct set of locks. * * 1: The routing hierarchy. - * Comprises the structures 'zone', 'cluster', 'node', 'link' - * and 'bearer'. The whole hierarchy is protected by a big - * read/write lock, tipc_net_lock, to enssure that nothing is added - * or removed while code is accessing any of these structures. - * This layer must not be called from the two others while they + * Comprises the structures 'zone', 'cluster', 'node', 'link' + * and 'bearer'. The whole hierarchy is protected by a big + * read/write lock, tipc_net_lock, to enssure that nothing is added + * or removed while code is accessing any of these structures. + * This layer must not be called from the two others while they * hold any of their own locks. * Neither must it itself do any upcalls to the other two before * it has released tipc_net_lock and other protective locks. * - * Within the tipc_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, * provided that those are protected by individual spin_locks - * per instance. Code holding tipc_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 - * subordinate links. I.e, it can update link counters and queues, - * change link state, send protocol messages, and alter the - * "active_links" array in the node; but it can _not_ remove a link + * subordinate links. I.e, it can update link counters and queues, + * change link state, send protocol messages, and alter the + * "active_links" array in the node; but it can _not_ remove a link * or a node from the overall structure. - * Correspondingly, individual bearers may change status within a - * tipc_net_lock(read), protected by an individual spin_lock ber bearer + * Correspondingly, individual bearers may change status within a + * tipc_net_lock(read), protected by an individual spin_lock ber bearer * instance, but it needs tipc_net_lock(write) to remove/add any bearers. - * * - * 2: The transport level of the protocol. - * This consists of the structures port, (and its user level - * representations, such as user_port and tipc_sock), reference and - * tipc_user (port.c, reg.c, socket.c). + * + * 2: The transport level of the protocol. + * This consists of the structures port, (and its user level + * representations, such as user_port and tipc_sock), reference and + * tipc_user (port.c, reg.c, socket.c). * * This layer has four different locks: * - The tipc_port spin_lock. This is protecting each port instance - * from parallel data access and removal. Since we can not place - * this lock in the port itself, it has been placed in the + * from parallel data access and removal. Since we can not place + * this lock in the port itself, it has been placed in the * corresponding reference table entry, which has the same life - * cycle as the module. This entry is difficult to access from - * outside the TIPC core, however, so a pointer to the lock has - * been added in the port instance, -to be used for unlocking + * cycle as the module. This entry is difficult to access from + * outside the TIPC core, however, so a pointer to the lock has + * been added in the port instance, -to be used for unlocking * only. - * - A read/write lock to protect the reference table itself (teg.c). - * (Nobody is using read-only access to this, so it can just as + * - A read/write lock to protect the reference table itself (teg.c). + * (Nobody is using read-only access to this, so it can just as * well be changed to a spin_lock) * - A spin lock to protect the registry of kernel/driver users (reg.c) - * - A global spin_lock (tipc_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, * 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, * and 'wait_list', which is used to queue ports during congestion. - * + * * 3: The name table (name_table.c, name_distr.c, subscription.c) - * - There is one big read/write-lock (tipc_nametbl_lock) protecting the - * overall name table structure. Nothing must be added/removed to + * - There is one big read/write-lock (tipc_nametbl_lock) protecting the + * overall name table structure. Nothing must be added/removed to * this structure without holding write access to it. * - There is one local spin_lock per sub_sequence, which can be seen * as a sub-domain to the tipc_nametbl_lock domain. It is used only @@ -118,7 +118,7 @@ DEFINE_RWLOCK(tipc_net_lock); struct network tipc_net = { NULL }; -struct node *tipc_net_select_remote_node(u32 addr, u32 ref) +struct node *tipc_net_select_remote_node(u32 addr, u32 ref) { return tipc_zone_select_remote_node(tipc_net.zones[tipc_zone(addr)], addr, ref); } @@ -224,7 +224,7 @@ void tipc_net_route_msg(struct sk_buff *buf) buf_discard(buf); } else { msg_dbg(msg, "NET>REJ>:"); - tipc_reject_msg(buf, msg_destport(msg) ? + tipc_reject_msg(buf, msg_destport(msg) ? TIPC_ERR_NO_PORT : TIPC_ERR_NO_NAME); } return; @@ -236,7 +236,7 @@ void tipc_net_route_msg(struct sk_buff *buf) dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); if (in_scope(dnode, tipc_own_addr)) { if (msg_isdata(msg)) { - if (msg_mcast(msg)) + if (msg_mcast(msg)) tipc_port_recv_mcast(buf, NULL); else if (msg_destport(msg)) tipc_port_recv_msg(buf); @@ -284,7 +284,7 @@ int tipc_net_start(void) (res = tipc_bclink_init())) { return res; } - tipc_subscr_stop(); + tipc_subscr_stop(); tipc_cfg_stop(); tipc_k_signal((Handler)tipc_subscr_start, 0); tipc_k_signal((Handler)tipc_cfg_init, 0); @@ -298,12 +298,12 @@ void tipc_net_stop(void) { if (tipc_mode != TIPC_NET_MODE) return; - write_lock_bh(&tipc_net_lock); + write_lock_bh(&tipc_net_lock); tipc_bearer_stop(); tipc_mode = TIPC_NODE_MODE; tipc_bclink_stop(); net_stop(); - write_unlock_bh(&tipc_net_lock); + write_unlock_bh(&tipc_net_lock); info("Left network mode \n"); } diff --git a/net/tipc/net.h b/net/tipc/net.h index f3e0b85e647..a6a0e9976ac 100644 --- a/net/tipc/net.h +++ b/net/tipc/net.h @@ -1,6 +1,6 @@ /* * net/tipc/net.h: Include file for TIPC network routing code - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -43,7 +43,7 @@ struct _zone; * struct network - TIPC network structure * @zones: array of pointers to all zones within network */ - + struct network { struct _zone **zones; }; diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index eb1bb4dce7a..b8e1edc2bad 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c @@ -1,6 +1,6 @@ /* * net/tipc/netlink.c: TIPC configuration handling - * + * * Copyright (c) 2005-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -63,15 +63,15 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info) genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid); } - return 0; + return 0; } static struct genl_family family = { - .id = GENL_ID_GENERATE, - .name = TIPC_GENL_NAME, - .version = TIPC_GENL_VERSION, - .hdrsize = TIPC_GENL_HDRLEN, - .maxattr = 0, + .id = GENL_ID_GENERATE, + .name = TIPC_GENL_NAME, + .version = TIPC_GENL_VERSION, + .hdrsize = TIPC_GENL_HDRLEN, + .maxattr = 0, }; static struct genl_ops ops = { @@ -93,7 +93,7 @@ int tipc_netlink_start(void) if (genl_register_ops(&family, &ops)) goto err_unregister; - return 0; + return 0; err_unregister: genl_unregister_family(&family); diff --git a/net/tipc/node.c b/net/tipc/node.c index 4111a31def7..e2e452a62ba 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1,6 +1,6 @@ /* * net/tipc/node.c: TIPC node management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -58,7 +58,7 @@ struct node *tipc_node_create(u32 addr) { struct cluster *c_ptr; struct node *n_ptr; - struct node **curr_node; + struct node **curr_node; n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC); if (!n_ptr) { @@ -74,16 +74,16 @@ struct node *tipc_node_create(u32 addr) kfree(n_ptr); return NULL; } - + n_ptr->addr = addr; - spin_lock_init(&n_ptr->lock); + spin_lock_init(&n_ptr->lock); INIT_LIST_HEAD(&n_ptr->nsub); n_ptr->owner = c_ptr; tipc_cltr_attach_node(c_ptr, n_ptr); n_ptr->last_router = -1; /* Insert node into ordered list */ - for (curr_node = &tipc_nodes; *curr_node; + for (curr_node = &tipc_nodes; *curr_node; curr_node = &(*curr_node)->next) { if (addr < (*curr_node)->addr) { n_ptr->next = *curr_node; @@ -116,7 +116,7 @@ void tipc_node_delete(struct node *n_ptr) /** * tipc_node_link_up - handle addition of link - * + * * Link becomes active (alone or shared) or standby, depending on its priority. */ @@ -128,19 +128,19 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) info("Established link <%s> on network plane %c\n", l_ptr->name, l_ptr->b_ptr->net_plane); - + if (!active[0]) { dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]); active[0] = active[1] = l_ptr; node_established_contact(n_ptr); return; } - if (l_ptr->priority < active[0]->priority) { + if (l_ptr->priority < active[0]->priority) { info("New link <%s> becomes standby\n", l_ptr->name); return; } 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; return; } @@ -160,17 +160,17 @@ static void node_select_active_links(struct node *n_ptr) u32 i; u32 highest_prio = 0; - active[0] = active[1] = NULL; + active[0] = active[1] = NULL; 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 || !tipc_link_is_up(l_ptr) || (l_ptr->priority < highest_prio)) continue; if (l_ptr->priority > highest_prio) { - highest_prio = l_ptr->priority; + highest_prio = l_ptr->priority; active[0] = active[1] = l_ptr; } else { active[1] = l_ptr; @@ -203,15 +203,15 @@ void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr) active[1] = active[0]; if (active[0] == l_ptr) node_select_active_links(n_ptr); - if (tipc_node_is_up(n_ptr)) + if (tipc_node_is_up(n_ptr)) tipc_link_changeover(l_ptr); - else + else node_lost_contact(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]))); } @@ -236,28 +236,28 @@ struct node *tipc_node_attach_link(struct link *l_ptr) if (!n_ptr) n_ptr = tipc_node_create(l_ptr->addr); - if (n_ptr) { + if (n_ptr) { u32 bearer_id = l_ptr->b_ptr->identity; char addr_string[16]; - if (n_ptr->link_cnt >= 2) { + if (n_ptr->link_cnt >= 2) { char addr_string[16]; - err("Attempt to create third link to %s\n", + err("Attempt to create third link to %s\n", addr_string_fill(addr_string, n_ptr->addr)); - return NULL; - } + return NULL; + } - if (!n_ptr->links[bearer_id]) { - n_ptr->links[bearer_id] = l_ptr; - tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; - n_ptr->link_cnt++; - return n_ptr; - } - err("Attempt to establish second link on <%s> to %s \n", - l_ptr->b_ptr->publ.name, + if (!n_ptr->links[bearer_id]) { + n_ptr->links[bearer_id] = l_ptr; + tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; + n_ptr->link_cnt++; + return n_ptr; + } + err("Attempt to establish second link on <%s> to %s \n", + l_ptr->b_ptr->publ.name, addr_string_fill(addr_string, l_ptr->addr)); - } + } return NULL; } @@ -272,17 +272,17 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) * Routing table management - five cases to handle: * * 1: A link towards a zone/cluster external node comes up. - * => Send a multicast message updating routing tables of all - * system nodes within own cluster that the new destination - * can be reached via this node. + * => Send a multicast message updating routing tables of all + * system nodes within own cluster that the new destination + * can be reached via this node. * (node.establishedContact()=>cluster.multicastNewRoute()) * * 2: A link towards a slave node comes up. - * => Send a multicast message updating routing tables of all - * system nodes within own cluster that the new destination - * can be reached via this node. + * => Send a multicast message updating routing tables of all + * system nodes within own cluster that the new destination + * can be reached via this node. * (node.establishedContact()=>cluster.multicastNewRoute()) - * => Send a message to the slave node about existence + * => Send a message to the slave node about existence * of all system nodes within cluster: * (node.establishedContact()=>cluster.sendLocalRoutes()) * @@ -292,13 +292,13 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) * nodes which can be reached via this node. * (node.establishedContact()==>network.sendExternalRoutes()) * (node.establishedContact()==>network.sendSlaveRoutes()) - * => Send messages to all directly connected slave nodes + * => Send messages to all directly connected slave nodes * containing information about the existence of the new node * (node.establishedContact()=>cluster.multicastNewRoute()) - * + * * 4: The link towards a zone/cluster external node or slave * node goes down. - * => Send a multcast message updating routing tables of all + * => Send a multcast message updating routing tables of all * nodes within cluster that the new destination can not any * longer be reached via this node. * (node.lostAllLinks()=>cluster.bcastLostRoute()) @@ -308,7 +308,7 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr) * routing tables. Note: This is a completely node * local operation. * (node.lostAllLinks()=>network.removeAsRouter()) - * => Send messages to all directly connected slave nodes + * => Send messages to all directly connected slave nodes * containing information about loss of the node * (node.establishedContact()=>cluster.multicastLostRoute()) * @@ -319,12 +319,12 @@ static void node_established_contact(struct node *n_ptr) struct cluster *c_ptr; dbg("node_established_contact:-> %x\n", n_ptr->addr); - if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { + if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); } - /* Syncronize broadcast acks */ - n_ptr->bclink.acked = tipc_bclink_get_last_sent(); + /* Syncronize broadcast acks */ + n_ptr->bclink.acked = tipc_bclink_get_last_sent(); if (is_slave(tipc_own_addr)) return; @@ -333,11 +333,11 @@ static void node_established_contact(struct node *n_ptr) c_ptr = tipc_cltr_find(tipc_own_addr); if (!c_ptr) c_ptr = tipc_cltr_create(tipc_own_addr); - if (c_ptr) - tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, + if (c_ptr) + tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, tipc_max_nodes); return; - } + } c_ptr = n_ptr->owner; if (is_slave(n_ptr->addr)) { @@ -367,26 +367,26 @@ static void node_lost_contact(struct node *n_ptr) char addr_string[16]; u32 i; - /* Clean up broadcast reception remains */ - n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; - while (n_ptr->bclink.deferred_head) { - struct sk_buff* buf = n_ptr->bclink.deferred_head; - n_ptr->bclink.deferred_head = buf->next; - buf_discard(buf); - } - if (n_ptr->bclink.defragm) { - buf_discard(n_ptr->bclink.defragm); - n_ptr->bclink.defragm = NULL; - } - if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { - tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); - } + /* Clean up broadcast reception remains */ + n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; + while (n_ptr->bclink.deferred_head) { + struct sk_buff* buf = n_ptr->bclink.deferred_head; + n_ptr->bclink.deferred_head = buf->next; + buf_discard(buf); + } + if (n_ptr->bclink.defragm) { + buf_discard(n_ptr->bclink.defragm); + n_ptr->bclink.defragm = NULL; + } + if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { + tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); + } - /* Update routing tables */ + /* Update routing tables */ if (is_slave(tipc_own_addr)) { tipc_net_remove_as_router(n_ptr->addr); } else { - if (!in_own_cluster(n_ptr->addr)) { + if (!in_own_cluster(n_ptr->addr)) { /* Case 4 (see above) */ c_ptr = tipc_cltr_find(tipc_own_addr); tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, @@ -399,7 +399,7 @@ static void node_lost_contact(struct node *n_ptr) tipc_max_nodes); } else { if (n_ptr->bclink.supported) { - tipc_nmap_remove(&tipc_cltr_bcast_nodes, + tipc_nmap_remove(&tipc_cltr_bcast_nodes, n_ptr->addr); if (n_ptr->addr < tipc_own_addr) tipc_own_tag--; @@ -414,13 +414,13 @@ static void node_lost_contact(struct node *n_ptr) if (tipc_node_has_active_routes(n_ptr)) return; - info("Lost contact with %s\n", + info("Lost contact with %s\n", addr_string_fill(addr_string, n_ptr->addr)); /* Abort link changeover */ for (i = 0; i < MAX_BEARERS; i++) { struct link *l_ptr = n_ptr->links[i]; - if (!l_ptr) + if (!l_ptr) continue; l_ptr->reset_checkpoint = l_ptr->next_in_no; l_ptr->exp_msg_count = 0; @@ -429,7 +429,7 @@ static void node_lost_contact(struct node *n_ptr) /* Notify subscribers */ list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { - ns->node = NULL; + ns->node = NULL; list_del_init(&ns->nodesub_list); tipc_k_signal((Handler)ns->handle_node_down, (unsigned long)ns->usr_handle); @@ -438,7 +438,7 @@ static void node_lost_contact(struct node *n_ptr) /** * tipc_node_select_next_hop - find the next-hop node for a message - * + * * Called by when cluster local lookup has failed. */ @@ -447,13 +447,13 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) struct node *n_ptr; u32 router_addr; - if (!tipc_addr_domain_valid(addr)) - return NULL; + if (!tipc_addr_domain_valid(addr)) + return NULL; /* Look for direct link to destination processsor */ n_ptr = tipc_node_find(addr); if (n_ptr && tipc_node_has_active_links(n_ptr)) - return n_ptr; + return n_ptr; /* Cluster local system nodes *must* have direct links */ if (!is_slave(addr) && in_own_cluster(addr)) @@ -461,10 +461,10 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) /* Look for cluster local router with direct link to node */ router_addr = tipc_node_select_router(n_ptr, selector); - if (router_addr) - return tipc_node_select(router_addr, selector); + if (router_addr) + 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 */ if (is_slave(addr)) return NULL; @@ -473,20 +473,20 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector) addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); n_ptr = tipc_net_select_remote_node(addr, selector); 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 */ router_addr = tipc_net_select_router(addr, selector); - if (router_addr) - return tipc_node_select(router_addr, selector); + if (router_addr) + return tipc_node_select(router_addr, selector); - return NULL; + return NULL; } /** * 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 tipc_node_select_router(struct node *n_ptr, u32 ref) @@ -496,8 +496,8 @@ u32 tipc_node_select_router(struct node *n_ptr, u32 ref) u32 start; u32 r; - if (!n_ptr) - return 0; + if (!n_ptr) + return 0; if (n_ptr->last_router < 0) return 0; @@ -531,10 +531,10 @@ void tipc_node_add_router(struct node *n_ptr, u32 router) { u32 r_num = tipc_node(router); - n_ptr->routers[r_num / 32] = + n_ptr->routers[r_num / 32] = ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]); n_ptr->last_router = tipc_max_nodes / 32; - while ((--n_ptr->last_router >= 0) && + while ((--n_ptr->last_router >= 0) && !n_ptr->routers[n_ptr->last_router]); } @@ -548,7 +548,7 @@ void tipc_node_remove_router(struct node *n_ptr, u32 router) n_ptr->routers[r_num / 32] = ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32])); n_ptr->last_router = tipc_max_nodes / 32; - while ((--n_ptr->last_router >= 0) && + while ((--n_ptr->last_router >= 0) && !n_ptr->routers[n_ptr->last_router]); if (!tipc_node_is_up(n_ptr)) @@ -562,7 +562,7 @@ void node_print(struct print_buf *buf, struct node *n_ptr, char *str) tipc_printf(buf, "\n\n%s", str); for (i = 0; i < MAX_BEARERS; i++) { - if (!n_ptr->links[i]) + if (!n_ptr->links[i]) continue; tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]); } @@ -590,7 +590,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) u32 domain; struct sk_buff *buf; struct node *n_ptr; - struct tipc_node_info node_info; + struct tipc_node_info node_info; u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) @@ -601,10 +601,10 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (network address)"); - if (!tipc_nodes) - return tipc_cfg_reply_none(); + if (!tipc_nodes) + 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 */ payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); @@ -620,9 +620,9 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { if (!in_scope(domain, n_ptr->addr)) continue; - node_info.addr = htonl(n_ptr->addr); - node_info.up = htonl(tipc_node_is_up(n_ptr)); - tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, + node_info.addr = htonl(n_ptr->addr); + node_info.up = htonl(tipc_node_is_up(n_ptr)); + tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, &node_info, sizeof(node_info)); } @@ -634,7 +634,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) u32 domain; struct sk_buff *buf; struct node *n_ptr; - struct tipc_link_info link_info; + struct tipc_link_info link_info; u32 payload_size; if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) @@ -645,9 +645,9 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE " (network address)"); - if (tipc_mode != TIPC_NET_MODE) - return tipc_cfg_reply_none(); - + if (tipc_mode != TIPC_NET_MODE) + return tipc_cfg_reply_none(); + /* Get space for all unicast links + multicast link */ payload_size = TLV_SPACE(sizeof(link_info)) * @@ -661,27 +661,27 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) /* Add TLV for broadcast link */ - link_info.dest = htonl(tipc_own_addr & 0xfffff00); - link_info.up = htonl(1); - sprintf(link_info.str, tipc_bclink_name); + link_info.dest = htonl(tipc_own_addr & 0xfffff00); + link_info.up = htonl(1); + sprintf(link_info.str, tipc_bclink_name); tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); /* Add TLVs for any other links in scope */ for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { - u32 i; + u32 i; if (!in_scope(domain, n_ptr->addr)) continue; - for (i = 0; i < MAX_BEARERS; i++) { - if (!n_ptr->links[i]) - continue; - link_info.dest = htonl(n_ptr->addr); - link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); - strcpy(link_info.str, n_ptr->links[i]->name); - tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, + for (i = 0; i < MAX_BEARERS; i++) { + if (!n_ptr->links[i]) + continue; + link_info.dest = htonl(n_ptr->addr); + link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); + strcpy(link_info.str, n_ptr->links[i]->name); + tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); - } + } } return buf; diff --git a/net/tipc/node.h b/net/tipc/node.h index a07cc79ea63..cd1882654bb 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h @@ -1,6 +1,6 @@ /* * net/tipc/node.h: Include file for TIPC node management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -67,7 +67,7 @@ * @deferred_tail: newest OOS b'cast message received from node * @defragm: list of partially reassembled b'cast message fragments from node */ - + struct node { u32 addr; spinlock_t lock; @@ -85,8 +85,8 @@ struct node { int supported; u32 acked; u32 last_in; - u32 gap_after; - u32 gap_to; + u32 gap_after; + u32 gap_to; u32 nack_sync; struct sk_buff *deferred_head; struct sk_buff *deferred_tail; diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c index cc3fff3dec4..8ecbd0fb610 100644 --- a/net/tipc/node_subscr.c +++ b/net/tipc/node_subscr.c @@ -1,6 +1,6 @@ /* * net/tipc/node_subscr.c: TIPC "node down" subscription handling - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -44,14 +44,14 @@ * tipc_nodesub_subscribe - create "node down" subscription for specified node */ -void tipc_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) { if (addr == tipc_own_addr) { node_sub->node = NULL; return; } - + node_sub->node = tipc_node_find(addr); if (!node_sub->node) { warn("Node subscription rejected, unknown node 0x%x\n", addr); diff --git a/net/tipc/node_subscr.h b/net/tipc/node_subscr.h index 01751c4fbb4..5f3f5859b84 100644 --- a/net/tipc/node_subscr.h +++ b/net/tipc/node_subscr.h @@ -1,6 +1,6 @@ /* * net/tipc/node_subscr.h: Include file for TIPC "node down" subscription handling - * + * * Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/port.c b/net/tipc/port.c index b7f3199523c..5f8217d4b45 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c @@ -1,6 +1,6 @@ /* * net/tipc/port.c: TIPC port code - * + * * Copyright (c) 1992-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -126,8 +126,8 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, ext_targets = tipc_nametbl_mc_translate(seq->type, seq->lower, seq->upper, TIPC_NODE_SCOPE, &dports); - - /* Send message to destinations (duplicate it only if necessary) */ + + /* Send message to destinations (duplicate it only if necessary) */ if (ext_targets) { if (dports.count != 0) { @@ -157,7 +157,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq, u32 domain, /** * tipc_port_recv_mcast - deliver multicast message to all destination ports - * + * * If there is no port list, perform a lookup to create one */ @@ -213,7 +213,7 @@ exit: /** * tipc_createport_raw - create a native TIPC port - * + * * Returns local port reference */ @@ -273,7 +273,7 @@ int tipc_deleteport(u32 ref) tipc_withdraw(ref, 0, NULL); p_ptr = tipc_port_lock(ref); - if (!p_ptr) + if (!p_ptr) return -EINVAL; tipc_ref_discard(ref); @@ -302,7 +302,7 @@ int tipc_deleteport(u32 ref) /** * tipc_get_port() - return port associated with 'ref' - * + * * Note: Port is not locked. */ @@ -336,7 +336,7 @@ static int port_unreliable(struct port *p_ptr) int tipc_portunreliable(u32 ref, unsigned int *isunreliable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -348,7 +348,7 @@ int tipc_portunreliable(u32 ref, unsigned int *isunreliable) int tipc_set_portunreliable(u32 ref, unsigned int isunreliable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -365,7 +365,7 @@ static int port_unreturnable(struct port *p_ptr) int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -377,7 +377,7 @@ int tipc_portunreturnable(u32 ref, unsigned int *isunrejectable) int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -386,19 +386,19 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable) return TIPC_OK; } -/* - * port_build_proto_msg(): build a port level protocol - * or a connection abortion message. Called with +/* + * port_build_proto_msg(): build a port level protocol + * or a connection abortion message. Called with * tipc_port lock on. */ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode, u32 origport, u32 orignode, - u32 usr, u32 type, u32 err, + u32 usr, u32 type, u32 err, u32 seqno, u32 ack) { struct sk_buff *buf; struct tipc_msg *msg; - + buf = buf_acquire(LONG_H_SIZE); if (buf) { msg = buf_msg(buf); @@ -461,7 +461,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err) msg_set_orignode(rmsg, tipc_own_addr); else msg_set_orignode(rmsg, msg_destnode(msg)); - msg_set_size(rmsg, data_sz + hdr_sz); + msg_set_size(rmsg, data_sz + hdr_sz); msg_set_nametype(rmsg, msg_nametype(msg)); msg_set_nameinst(rmsg, msg_nameinst(msg)); memcpy(rbuf->data + hdr_sz, msg_data(msg), data_sz); @@ -492,7 +492,7 @@ int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, struct sk_buff *buf; int res; - res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, + res = msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE, !p_ptr->user_port, &buf); if (!buf) return res; @@ -523,7 +523,7 @@ static void port_timeout(unsigned long ref) tipc_own_addr, CONN_MANAGER, CONN_PROBE, - TIPC_OK, + TIPC_OK, port_out_seqno(p_ptr), 0); port_incr_out_seqno(p_ptr); @@ -562,7 +562,7 @@ static struct sk_buff *port_build_self_abort_msg(struct port *p_ptr, u32 err) port_peernode(p_ptr), imp, TIPC_CONN_MSG, - err, + err, p_ptr->last_in_seqno + 1, 0); } @@ -582,7 +582,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct port *p_ptr, u32 err) tipc_own_addr, imp, TIPC_CONN_MSG, - err, + err, port_out_seqno(p_ptr), 0); } @@ -613,7 +613,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) } } if (msg_type(msg) == CONN_ACK) { - int wakeup = tipc_port_congested(p_ptr) && + int wakeup = tipc_port_congested(p_ptr) && p_ptr->publ.congested && p_ptr->wakeup; p_ptr->acked += msg_msgcnt(msg); @@ -630,8 +630,8 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) } if (err) { r_buf = port_build_proto_msg(msg_origport(msg), - msg_orignode(msg), - msg_destport(msg), + msg_orignode(msg), + msg_destport(msg), tipc_own_addr, DATA_HIGH, TIPC_CONN_MSG, @@ -643,10 +643,10 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf) /* All is fine */ if (msg_type(msg) == CONN_PROBE) { - r_buf = port_build_proto_msg(msg_origport(msg), - msg_orignode(msg), - msg_destport(msg), - tipc_own_addr, + r_buf = port_build_proto_msg(msg_origport(msg), + msg_orignode(msg), + msg_destport(msg), + tipc_own_addr, CONN_MANAGER, CONN_PROBE_REPLY, TIPC_OK, @@ -665,39 +665,39 @@ exit: static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id) { - struct publication *publ; + struct publication *publ; if (full_id) - tipc_printf(buf, "<%u.%u.%u:%u>:", + tipc_printf(buf, "<%u.%u.%u:%u>:", tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), - tipc_node(tipc_own_addr), p_ptr->publ.ref); + tipc_node(tipc_own_addr), p_ptr->publ.ref); else tipc_printf(buf, "%-10u:", p_ptr->publ.ref); - if (p_ptr->publ.connected) { - u32 dport = port_peerport(p_ptr); - u32 destnode = port_peernode(p_ptr); + if (p_ptr->publ.connected) { + u32 dport = port_peerport(p_ptr); + u32 destnode = port_peernode(p_ptr); - tipc_printf(buf, " connected to <%u.%u.%u:%u>", - tipc_zone(destnode), tipc_cluster(destnode), - tipc_node(destnode), dport); - if (p_ptr->publ.conn_type != 0) - tipc_printf(buf, " via {%u,%u}", - p_ptr->publ.conn_type, - p_ptr->publ.conn_instance); - } - else if (p_ptr->publ.published) { - tipc_printf(buf, " bound to"); - list_for_each_entry(publ, &p_ptr->publications, pport_list) { + tipc_printf(buf, " connected to <%u.%u.%u:%u>", + tipc_zone(destnode), tipc_cluster(destnode), + tipc_node(destnode), dport); + if (p_ptr->publ.conn_type != 0) + tipc_printf(buf, " via {%u,%u}", + p_ptr->publ.conn_type, + p_ptr->publ.conn_instance); + } + else if (p_ptr->publ.published) { + tipc_printf(buf, " bound to"); + list_for_each_entry(publ, &p_ptr->publications, pport_list) { if (publ->lower == publ->upper) tipc_printf(buf, " {%u,%u}", publ->type, publ->lower); else - tipc_printf(buf, " {%u,%u,%u}", publ->type, + tipc_printf(buf, " {%u,%u,%u}", publ->type, publ->lower, publ->upper); - } - } - tipc_printf(buf, "\n"); + } + } + tipc_printf(buf, "\n"); } #define MAX_PORT_QUERY 32768 @@ -818,7 +818,7 @@ static void port_dispatcher_sigh(void *dummy) struct sk_buff *next = buf->next; struct tipc_msg *msg = buf_msg(buf); u32 dref = msg_destport(msg); - + message_type = msg_type(msg); if (message_type > TIPC_DIRECT_MSG) goto reject; /* Unsupported message type */ @@ -838,7 +838,7 @@ static void port_dispatcher_sigh(void *dummy) goto err; switch (message_type) { - + case TIPC_CONN_MSG:{ tipc_conn_msg_event cb = up_ptr->conn_msg_cb; u32 peer_port = port_peerport(p_ptr); @@ -856,9 +856,9 @@ static void port_dispatcher_sigh(void *dummy) goto reject; if (unlikely(!cb)) goto reject; - if (unlikely(++p_ptr->publ.conn_unacked >= + if (unlikely(++p_ptr->publ.conn_unacked >= TIPC_FLOW_CONTROL_WIN)) - tipc_acknowledge(dref, + tipc_acknowledge(dref, p_ptr->publ.conn_unacked); skb_pull(buf, msg_hdr_sz(msg)); cb(usr_handle, dref, &buf, msg_data(msg), @@ -874,7 +874,7 @@ static void port_dispatcher_sigh(void *dummy) if (unlikely(!cb)) goto reject; skb_pull(buf, msg_hdr_sz(msg)); - cb(usr_handle, dref, &buf, msg_data(msg), + cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_importance(msg), &orig); break; @@ -895,7 +895,7 @@ static void port_dispatcher_sigh(void *dummy) dseq.upper = (message_type == TIPC_NAMED_MSG) ? dseq.lower : msg_nameupper(msg); skb_pull(buf, msg_hdr_sz(msg)); - cb(usr_handle, dref, &buf, msg_data(msg), + cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_importance(msg), &orig, &dseq); break; @@ -907,9 +907,9 @@ static void port_dispatcher_sigh(void *dummy) continue; err: switch (message_type) { - + case TIPC_CONN_MSG:{ - tipc_conn_shutdown_event cb = + tipc_conn_shutdown_event cb = up_ptr->conn_err_cb; u32 peer_port = port_peerport(p_ptr); u32 peer_node = port_peernode(p_ptr); @@ -940,7 +940,7 @@ err: } case TIPC_MCAST_MSG: case TIPC_NAMED_MSG:{ - tipc_named_msg_err_event cb = + tipc_named_msg_err_event cb = up_ptr->named_err_cb; spin_unlock_bh(p_ptr->publ.lock); @@ -951,7 +951,7 @@ err: dseq.upper = (message_type == TIPC_NAMED_MSG) ? dseq.lower : msg_nameupper(msg); skb_pull(buf, msg_hdr_sz(msg)); - cb(usr_handle, dref, &buf, msg_data(msg), + cb(usr_handle, dref, &buf, msg_data(msg), msg_data_sz(msg), msg_errcode(msg), &dseq); break; } @@ -986,9 +986,9 @@ static u32 port_dispatcher(struct tipc_port *dummy, struct sk_buff *buf) return TIPC_OK; } -/* +/* * Wake up port after congestion: Called with port locked, - * + * */ static void port_wakeup_sh(unsigned long ref) @@ -1033,7 +1033,7 @@ void tipc_acknowledge(u32 ref, u32 ack) tipc_own_addr, CONN_MANAGER, CONN_ACK, - TIPC_OK, + TIPC_OK, port_out_seqno(p_ptr), ack); } @@ -1046,20 +1046,20 @@ void tipc_acknowledge(u32 ref, u32 ack) * registry if non-zero user_ref. */ -int tipc_createport(u32 user_ref, - void *usr_handle, - unsigned int importance, - tipc_msg_err_event error_cb, - tipc_named_msg_err_event named_error_cb, - tipc_conn_shutdown_event conn_error_cb, - tipc_msg_event msg_cb, - tipc_named_msg_event named_msg_cb, - tipc_conn_msg_event conn_msg_cb, +int tipc_createport(u32 user_ref, + void *usr_handle, + unsigned int importance, + tipc_msg_err_event error_cb, + tipc_named_msg_err_event named_error_cb, + tipc_conn_shutdown_event conn_error_cb, + tipc_msg_event msg_cb, + tipc_named_msg_event named_msg_cb, + tipc_conn_msg_event conn_msg_cb, tipc_continue_event continue_event_cb,/* May be zero */ u32 *portref) { struct user_port *up_ptr; - struct port *p_ptr; + struct port *p_ptr; u32 ref; up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC); @@ -1088,7 +1088,7 @@ int tipc_createport(u32 user_ref, INIT_LIST_HEAD(&up_ptr->uport_list); tipc_reg_add_port(up_ptr); *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); tipc_port_unlock(p_ptr); return TIPC_OK; } @@ -1103,7 +1103,7 @@ int tipc_ownidentity(u32 ref, struct tipc_portid *id) int tipc_portimportance(u32 ref, unsigned int *importance) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1172,19 +1172,19 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) struct publication *publ; struct publication *tpubl; int res = -EINVAL; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; if (!seq) { - list_for_each_entry_safe(publ, tpubl, + list_for_each_entry_safe(publ, tpubl, &p_ptr->publications, pport_list) { - tipc_nametbl_withdraw(publ->type, publ->lower, + tipc_nametbl_withdraw(publ->type, publ->lower, publ->ref, publ->key); } res = TIPC_OK; } else { - list_for_each_entry_safe(publ, tpubl, + list_for_each_entry_safe(publ, tpubl, &p_ptr->publications, pport_list) { if (publ->scope != scope) continue; @@ -1194,7 +1194,7 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) continue; if (publ->upper != seq->upper) break; - tipc_nametbl_withdraw(publ->type, publ->lower, + tipc_nametbl_withdraw(publ->type, publ->lower, publ->ref, publ->key); res = TIPC_OK; break; @@ -1292,7 +1292,7 @@ int tipc_shutdown(u32 ref) tipc_own_addr, imp, TIPC_CONN_MSG, - TIPC_CONN_SHUTDOWN, + TIPC_CONN_SHUTDOWN, port_out_seqno(p_ptr), 0); } @@ -1304,7 +1304,7 @@ int tipc_shutdown(u32 ref) int tipc_isconnected(u32 ref, int *isconnected) { struct port *p_ptr; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1317,7 +1317,7 @@ int tipc_peer(u32 ref, struct tipc_portid *peer) { struct port *p_ptr; int res; - + p_ptr = tipc_port_lock(ref); if (!p_ptr) return -EINVAL; @@ -1348,7 +1348,7 @@ int tipc_port_recv_sections(struct port *sender, unsigned int num_sect, { struct sk_buff *buf; int res; - + res = msg_build(&sender->publ.phdr, msg_sect, num_sect, MAX_MSG_SIZE, !sender->user_port, &buf); if (likely(buf)) @@ -1394,7 +1394,7 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect) return -ELINKCONG; } -/** +/** * tipc_send_buf - send message buffer on connection */ @@ -1406,7 +1406,7 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) u32 hsz; u32 sz; u32 res; - + p_ptr = tipc_port_deref(ref); if (!p_ptr || !p_ptr->publ.connected) return -EINVAL; @@ -1447,12 +1447,12 @@ int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz) * tipc_forward2name - forward message sections to port name */ -int tipc_forward2name(u32 ref, - struct tipc_name const *name, +int tipc_forward2name(u32 ref, + struct tipc_name const *name, u32 domain, - u32 num_sect, + u32 num_sect, struct iovec const *msg_sect, - struct tipc_portid const *orig, + struct tipc_portid const *orig, unsigned int importance) { struct port *p_ptr; @@ -1483,7 +1483,7 @@ int tipc_forward2name(u32 ref, p_ptr->sent++; if (likely(destnode == tipc_own_addr)) return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); - res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, + res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, destnode); if (likely(res != -ELINKCONG)) return res; @@ -1493,7 +1493,7 @@ int tipc_forward2name(u32 ref, } return -ELINKCONG; } - return tipc_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); } @@ -1501,10 +1501,10 @@ int tipc_forward2name(u32 ref, * tipc_send2name - send message sections to port name */ -int tipc_send2name(u32 ref, +int tipc_send2name(u32 ref, struct tipc_name const *name, - unsigned int domain, - unsigned int num_sect, + unsigned int domain, + unsigned int num_sect, struct iovec const *msg_sect) { struct tipc_portid orig; @@ -1515,7 +1515,7 @@ int tipc_send2name(u32 ref, TIPC_PORT_IMPORTANCE); } -/** +/** * tipc_forward_buf2name - forward message buffer to port name */ @@ -1571,14 +1571,14 @@ int tipc_forward_buf2name(u32 ref, return tipc_reject_msg(buf, TIPC_ERR_NO_NAME); } -/** +/** * tipc_send_buf2name - send message buffer to port name */ -int tipc_send_buf2name(u32 ref, - struct tipc_name const *dest, +int tipc_send_buf2name(u32 ref, + struct tipc_name const *dest, u32 domain, - struct sk_buff *buf, + struct sk_buff *buf, unsigned int dsz) { struct tipc_portid orig; @@ -1589,15 +1589,15 @@ int tipc_send_buf2name(u32 ref, TIPC_PORT_IMPORTANCE); } -/** +/** * tipc_forward2port - forward message sections to port identity */ int tipc_forward2port(u32 ref, struct tipc_portid const *dest, - unsigned int num_sect, + unsigned int num_sect, struct iovec const *msg_sect, - struct tipc_portid const *orig, + struct tipc_portid const *orig, unsigned int importance) { struct port *p_ptr; @@ -1630,24 +1630,24 @@ int tipc_forward2port(u32 ref, return -ELINKCONG; } -/** - * tipc_send2port - send message sections to port identity +/** + * tipc_send2port - send message sections to port identity */ -int tipc_send2port(u32 ref, +int tipc_send2port(u32 ref, struct tipc_portid const *dest, - unsigned int num_sect, + unsigned int num_sect, struct iovec const *msg_sect) { struct tipc_portid orig; orig.ref = ref; orig.node = tipc_own_addr; - return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, + return tipc_forward2port(ref, dest, num_sect, msg_sect, &orig, TIPC_PORT_IMPORTANCE); } -/** +/** * tipc_forward_buf2port - forward message buffer to port identity */ int tipc_forward_buf2port(u32 ref, @@ -1692,20 +1692,20 @@ int tipc_forward_buf2port(u32 ref, return -ELINKCONG; } -/** +/** * tipc_send_buf2port - send message buffer to port identity */ -int tipc_send_buf2port(u32 ref, +int tipc_send_buf2port(u32 ref, struct tipc_portid const *dest, - struct sk_buff *buf, + struct sk_buff *buf, unsigned int dsz) { struct tipc_portid orig; orig.ref = ref; orig.node = tipc_own_addr; - return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, + return tipc_forward_buf2port(ref, dest, buf, dsz, &orig, TIPC_PORT_IMPORTANCE); } diff --git a/net/tipc/port.h b/net/tipc/port.h index 839f100da64..7ef4d64b32f 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h @@ -1,6 +1,6 @@ /* * net/tipc/port.h: Include file for TIPC port code - * + * * Copyright (c) 1994-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -52,17 +52,17 @@ * * @uport_list: adjacent user ports in list of ports held by user */ - + struct user_port { u32 user_ref; - void *usr_handle; + void *usr_handle; u32 ref; - tipc_msg_err_event err_cb; - tipc_named_msg_err_event named_err_cb; - tipc_conn_shutdown_event conn_err_cb; - tipc_msg_event msg_cb; - tipc_named_msg_event named_msg_cb; - tipc_conn_msg_event conn_msg_cb; + tipc_msg_err_event err_cb; + tipc_named_msg_err_event named_err_cb; + tipc_conn_shutdown_event conn_err_cb; + tipc_msg_event msg_cb; + tipc_named_msg_event named_msg_cb; + tipc_conn_msg_event conn_msg_cb; tipc_continue_event continue_event_cb; struct list_head uport_list; }; @@ -113,7 +113,7 @@ struct port { extern spinlock_t tipc_port_list_lock; struct port_list; -int tipc_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); int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, struct iovec const *msg_sect, u32 num_sect, @@ -133,9 +133,9 @@ static inline struct port *tipc_port_lock(u32 ref) return (struct port *)tipc_ref_lock(ref); } -/** +/** * tipc_port_unlock - unlock a port instance - * + * * Can use pointer instead of tipc_ref_unlock() since port is already locked. */ @@ -164,7 +164,7 @@ static inline int tipc_port_congested(struct port *p_ptr) return((p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2)); } -/** +/** * tipc_port_recv_msg - receive message from lower layer and deliver to port user */ @@ -175,7 +175,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf) u32 destport = msg_destport(msg); u32 dsz = msg_data_sz(msg); u32 err; - + /* forward unresolved named message */ if (unlikely(!destport)) { tipc_net_route_msg(buf); diff --git a/net/tipc/ref.c b/net/tipc/ref.c index e6d6ae22ea4..6704a58c785 100644 --- a/net/tipc/ref.c +++ b/net/tipc/ref.c @@ -1,6 +1,6 @@ /* * net/tipc/ref.c: TIPC object registry code - * + * * Copyright (c) 1991-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -50,11 +50,11 @@ * Object reference table consists of 2**N entries. * * A used entry has object ptr != 0, reference == XXXX|own index - * (XXXX changes each time entry is acquired) + * (XXXX changes each time entry is acquired) * A free entry has object ptr == 0, reference == YYYY|next free index * (YYYY is one more than last used XXXX) * - * Free list is initially chained from entry (2**N)-1 to entry 1. + * Free list is initially chained from entry (2**N)-1 to entry 1. * Entry 0 is not used to allow index 0 to indicate the end of the free list. * * Note: Any accidental reference of the form XXXX|0--0 won't match entry 0 @@ -113,9 +113,9 @@ void tipc_ref_table_stop(void) /** * tipc_ref_acquire - create reference to an object - * + * * 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. */ @@ -141,15 +141,15 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock) index = tipc_ref_table.first_free; entry = &(tipc_ref_table.entries[index]); index_mask = tipc_ref_table.index_mask; - /* take lock in case a previous user of entry still holds it */ - spin_lock_bh(&entry->lock); + /* take lock in case a previous user of entry still holds it */ + spin_lock_bh(&entry->lock); next_plus_upper = entry->data.next_plus_upper; tipc_ref_table.first_free = next_plus_upper & index_mask; reference = (next_plus_upper & ~index_mask) + index; entry->data.reference = reference; entry->object = object; - if (lock != 0) - *lock = &entry->lock; + if (lock != 0) + *lock = &entry->lock; spin_unlock_bh(&entry->lock); } write_unlock_bh(&ref_table_lock); @@ -158,7 +158,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock) /** * tipc_ref_discard - invalidate references to an object - * + * * 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 */ @@ -166,7 +166,7 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock) void tipc_ref_discard(u32 ref) { struct reference *entry; - u32 index; + u32 index; u32 index_mask; if (!ref) { @@ -198,7 +198,7 @@ void tipc_ref_discard(u32 ref) tipc_ref_table.first_free = index; else /* next_plus_upper is always XXXX|0--0 for last free entry */ - tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper + tipc_ref_table.entries[tipc_ref_table.last_free].data.next_plus_upper |= index; tipc_ref_table.last_free = index; diff --git a/net/tipc/ref.h b/net/tipc/ref.h index 6d20006be45..38f3a7f4a78 100644 --- a/net/tipc/ref.h +++ b/net/tipc/ref.h @@ -1,6 +1,6 @@ /* * net/tipc/ref.h: Include file for TIPC object registry code - * + * * Copyright (c) 1991-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -43,7 +43,7 @@ * @lock: spinlock controlling access to object * @data: reference value associated with object (or link to next unused entry) */ - + struct reference { void *object; spinlock_t lock; @@ -96,7 +96,7 @@ static inline void *tipc_ref_lock(u32 ref) } /** - * tipc_ref_unlock - unlock referenced object + * tipc_ref_unlock - unlock referenced object */ static inline void tipc_ref_unlock(u32 ref) @@ -119,7 +119,7 @@ static inline void tipc_ref_unlock(u32 ref) static inline void *tipc_ref_deref(u32 ref) { if (likely(tipc_ref_table.entries)) { - struct reference *r = + struct reference *r = &tipc_ref_table.entries[ref & tipc_ref_table.index_mask]; if (likely(r->data.reference == ref)) diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 2a6a5a6b4c1..b71739fbe2c 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1,6 +1,6 @@ /* * net/tipc/socket.c: TIPC socket API - * + * * Copyright (c) 2001-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * All rights reserved. @@ -82,29 +82,29 @@ static int sockets_enabled = 0; static atomic_t tipc_queue_size = ATOMIC_INIT(0); -/* - * sock_lock(): Lock a port/socket pair. lock_sock() can - * not be used here, since the same lock must protect ports +/* + * sock_lock(): Lock a port/socket pair. lock_sock() can + * not be used here, since the same lock must protect ports * with non-socket interfaces. * See net.c for description of locking policy. */ static void sock_lock(struct tipc_sock* tsock) { - spin_lock_bh(tsock->p->lock); + spin_lock_bh(tsock->p->lock); } -/* +/* * sock_unlock(): Unlock a port/socket pair */ static void sock_unlock(struct tipc_sock* tsock) { - spin_unlock_bh(tsock->p->lock); + spin_unlock_bh(tsock->p->lock); } /** * pollmask - determine the current set of poll() events for a socket * @sock: socket structure - * + * * TIPC sets the returned events as follows: * a) POLLRDNORM and POLLIN are set if the socket's receive queue is non-empty * or if a connection-oriented socket is does not have an active connection @@ -115,7 +115,7 @@ static void sock_unlock(struct tipc_sock* tsock) * * IMPORTANT: The fact that a read or write operation will not block does NOT * imply that the operation will succeed! - * + * * Returns pollmask value */ @@ -130,7 +130,7 @@ static u32 pollmask(struct socket *sock) else mask = 0; - if (sock->state == SS_DISCONNECTING) + if (sock->state == SS_DISCONNECTING) mask |= POLLHUP; else mask |= POLLOUT; @@ -146,9 +146,9 @@ static u32 pollmask(struct socket *sock) static void advance_queue(struct tipc_sock *tsock) { - sock_lock(tsock); + sock_lock(tsock); buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue)); - sock_unlock(tsock); + sock_unlock(tsock); atomic_dec(&tipc_queue_size); } @@ -156,7 +156,7 @@ static void advance_queue(struct tipc_sock *tsock) * tipc_create - create a TIPC socket * @sock: pre-allocated socket structure * @protocol: protocol indicator (must be 0) - * + * * This routine creates and attaches a 'struct sock' to the 'struct socket', * then create and attaches a TIPC port to the 'struct sock' part. * @@ -167,7 +167,7 @@ static int tipc_create(struct socket *sock, int protocol) struct tipc_sock *tsock; struct tipc_port *port; struct sock *sk; - u32 ref; + u32 ref; if (unlikely(protocol != 0)) return -EPROTONOSUPPORT; @@ -232,7 +232,7 @@ static int tipc_create(struct socket *sock, int protocol) * For SEQPACKET and STREAM socket types, the first message is rejected * and any others are discarded. (If the first message on a STREAM socket * is partially-read, it is discarded and the next one is rejected instead.) - * + * * NOTE: Rejected messages are not necessarily returned to the sender! They * are returned or discarded according to the "destination droppable" setting * specified for the message by the sender. @@ -247,7 +247,7 @@ static int release(struct socket *sock) int res = TIPC_OK; struct sk_buff *buf; - dbg("sock_delete: %x\n",tsock); + dbg("sock_delete: %x\n",tsock); if (!tsock) return 0; down_interruptible(&tsock->sem); @@ -255,7 +255,7 @@ static int release(struct socket *sock) up(&tsock->sem); return 0; } - + /* Reject unreceived messages, unless no longer connected */ while (sock->state != SS_DISCONNECTING) { @@ -289,7 +289,7 @@ static int release(struct socket *sock) sock_put(sk); - atomic_dec(&tipc_user_count); + atomic_dec(&tipc_user_count); return res; } @@ -298,11 +298,11 @@ static int release(struct socket *sock) * @sock: socket structure * @uaddr: socket address describing name(s) and desired operation * @uaddr_len: size of socket address data structure - * + * * Name and name sequence binding is indicated using a positive scope value; * a negative scope value unbinds the specified name. Specifying no name * (i.e. a socket address length of 0) unbinds all names from the socket. - * + * * Returns 0 on success, errno otherwise */ @@ -314,7 +314,7 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; - + if (unlikely(!uaddr_len)) { res = tipc_withdraw(tsock->p->ref, 0, NULL); goto exit; @@ -335,8 +335,8 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len) res = -EAFNOSUPPORT; goto exit; } - - if (addr->scope > 0) + + if (addr->scope > 0) res = tipc_publish(tsock->p->ref, addr->scope, &addr->addr.nameseq); else @@ -347,17 +347,17 @@ exit: return res; } -/** +/** * get_name - get port ID of socket or peer socket * @sock: socket structure * @uaddr: area for returned socket address * @uaddr_len: area for returned length of socket address * @peer: 0 to obtain socket name, 1 to obtain peer socket name - * + * * Returns 0 on success, errno otherwise */ -static int get_name(struct socket *sock, struct sockaddr *uaddr, +static int get_name(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct tipc_sock *tsock = tipc_sk(sock->sk); @@ -390,7 +390,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr, * Returns the pollmask */ -static unsigned int poll(struct file *file, struct socket *sock, +static unsigned int poll(struct file *file, struct socket *sock, poll_table *wait) { poll_wait(file, sock->sk->sk_sleep, wait); @@ -398,14 +398,14 @@ static unsigned int poll(struct file *file, struct socket *sock, return pollmask(sock); } -/** +/** * dest_name_check - verify user is permitted to send to specified port name * @dest: destination address * @m: descriptor for message to be sent - * + * * Prevents restricted configuration commands from being issued by * unauthorized users. - * + * * Returns 0 if permission is granted, otherwise errno */ @@ -413,19 +413,19 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) { struct tipc_cfg_msg_hdr hdr; - if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES)) - return 0; - if (likely(dest->addr.name.name.type == TIPC_TOP_SRV)) - return 0; + if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES)) + return 0; + if (likely(dest->addr.name.name.type == TIPC_TOP_SRV)) + return 0; - if (likely(dest->addr.name.name.type != TIPC_CFG_SRV)) - return -EACCES; + if (likely(dest->addr.name.name.type != TIPC_CFG_SRV)) + return -EACCES; - if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr))) + if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr))) return -EFAULT; if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN))) return -EACCES; - + return 0; } @@ -435,12 +435,12 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) * @sock: socket structure * @m: message to send * @total_len: length of message - * + * * Message must have an destination specified explicitly. - * Used for SOCK_RDM and SOCK_DGRAM messages, + * Used for SOCK_RDM and SOCK_DGRAM messages, * and for 'SYN' messages on SOCK_SEQPACKET and SOCK_STREAM connections. * (Note: 'SYN+' is prohibited on SOCK_STREAM.) - * + * * Returns the number of bytes sent on success, or errno otherwise */ @@ -448,7 +448,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct tipc_sock *tsock = tipc_sk(sock->sk); - struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; + struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; struct sk_buff *buf; int needs_conn; int res = -EINVAL; @@ -489,61 +489,61 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, sock->state = SS_CONNECTING; } - do { - if (dest->addrtype == TIPC_ADDR_NAME) { - if ((res = dest_name_check(dest, m))) - goto exit; - res = tipc_send2name(tsock->p->ref, - &dest->addr.name.name, - dest->addr.name.domain, - m->msg_iovlen, - m->msg_iov); - } - else if (dest->addrtype == TIPC_ADDR_ID) { - res = tipc_send2port(tsock->p->ref, - &dest->addr.id, - m->msg_iovlen, - m->msg_iov); - } - else if (dest->addrtype == TIPC_ADDR_MCAST) { + do { + if (dest->addrtype == TIPC_ADDR_NAME) { + if ((res = dest_name_check(dest, m))) + goto exit; + res = tipc_send2name(tsock->p->ref, + &dest->addr.name.name, + dest->addr.name.domain, + m->msg_iovlen, + m->msg_iov); + } + else if (dest->addrtype == TIPC_ADDR_ID) { + res = tipc_send2port(tsock->p->ref, + &dest->addr.id, + m->msg_iovlen, + m->msg_iov); + } + else if (dest->addrtype == TIPC_ADDR_MCAST) { if (needs_conn) { res = -EOPNOTSUPP; goto exit; } - if ((res = dest_name_check(dest, m))) - goto exit; - res = tipc_multicast(tsock->p->ref, - &dest->addr.nameseq, - 0, - m->msg_iovlen, - m->msg_iov); - } - if (likely(res != -ELINKCONG)) { -exit: - up(&tsock->sem); - return res; - } + if ((res = dest_name_check(dest, m))) + goto exit; + res = tipc_multicast(tsock->p->ref, + &dest->addr.nameseq, + 0, + m->msg_iovlen, + m->msg_iov); + } + if (likely(res != -ELINKCONG)) { +exit: + up(&tsock->sem); + return res; + } if (m->msg_flags & MSG_DONTWAIT) { res = -EWOULDBLOCK; goto exit; } - if (wait_event_interruptible(*sock->sk->sk_sleep, - !tsock->p->congested)) { - res = -ERESTARTSYS; - goto exit; - } - } while (1); + if (wait_event_interruptible(*sock->sk->sk_sleep, + !tsock->p->congested)) { + res = -ERESTARTSYS; + goto exit; + } + } while (1); } -/** +/** * send_packet - send a connection-oriented message * @iocb: (unused) * @sock: socket structure * @m: message to send * @total_len: length of message - * + * * Used for SOCK_SEQPACKET messages and SOCK_STREAM data. - * + * * Returns the number of bytes sent on success, or errno otherwise */ @@ -551,7 +551,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct tipc_sock *tsock = tipc_sk(sock->sk); - struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; + struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name; int res; /* Handle implied connection establishment */ @@ -561,45 +561,45 @@ static int send_packet(struct kiocb *iocb, struct socket *sock, if (down_interruptible(&tsock->sem)) { return -ERESTARTSYS; - } + } - do { + do { if (unlikely(sock->state != SS_CONNECTED)) { if (sock->state == SS_DISCONNECTING) - res = -EPIPE; + res = -EPIPE; else res = -ENOTCONN; goto exit; } - res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov); - if (likely(res != -ELINKCONG)) { + res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov); + if (likely(res != -ELINKCONG)) { exit: - up(&tsock->sem); - return res; - } + up(&tsock->sem); + return res; + } if (m->msg_flags & MSG_DONTWAIT) { res = -EWOULDBLOCK; goto exit; } - if (wait_event_interruptible(*sock->sk->sk_sleep, - !tsock->p->congested)) { - res = -ERESTARTSYS; - goto exit; - } - } while (1); + if (wait_event_interruptible(*sock->sk->sk_sleep, + !tsock->p->congested)) { + res = -ERESTARTSYS; + goto exit; + } + } while (1); } -/** +/** * send_stream - send stream-oriented data * @iocb: (unused) * @sock: socket structure * @m: data to send * @total_len: total length of data to be sent - * + * * Used for SOCK_STREAM data. - * - * Returns the number of bytes sent on success (or partial success), + * + * Returns the number of bytes sent on success (or partial success), * or errno if no data sent */ @@ -616,26 +616,26 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, int bytes_to_send; int bytes_sent; int res; - + if (likely(total_len <= TIPC_MAX_USER_MSG_SIZE)) return send_packet(iocb, sock, m, total_len); /* Can only send large data streams if already connected */ - if (unlikely(sock->state != SS_CONNECTED)) { - if (sock->state == SS_DISCONNECTING) - return -EPIPE; - else - return -ENOTCONN; - } + if (unlikely(sock->state != SS_CONNECTED)) { + if (sock->state == SS_DISCONNECTING) + return -EPIPE; + else + return -ENOTCONN; + } if (unlikely(m->msg_name)) return -EISCONN; - /* + /* * Send each iovec entry using one or more messages * - * Note: This algorithm is good for the most likely case + * Note: This algorithm is good for the most likely case * (i.e. one large iovec entry), but could be improved to pass sets * of small iovec entries into send_packet(). */ @@ -657,7 +657,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, ? curr_left : TIPC_MAX_USER_MSG_SIZE; my_iov.iov_base = curr_start; my_iov.iov_len = bytes_to_send; - if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) { + if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) { return bytes_sent ? bytes_sent : res; } curr_left -= bytes_to_send; @@ -676,11 +676,11 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, * @sock: socket structure * @tsock: TIPC-specific socket structure * @msg: peer's response message - * + * * Returns 0 on success, errno otherwise */ -static int auto_connect(struct socket *sock, struct tipc_sock *tsock, +static int auto_connect(struct socket *sock, struct tipc_sock *tsock, struct tipc_msg *msg) { struct tipc_portid peer; @@ -702,15 +702,15 @@ static int auto_connect(struct socket *sock, struct tipc_sock *tsock, * set_orig_addr - capture sender's address for received message * @m: descriptor for message info * @msg: received message header - * + * * Note: Address is not captured if not requested by receiver. */ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) { - struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; + struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name; - if (addr) { + if (addr) { addr->family = AF_TIPC; addr->addrtype = TIPC_ADDR_ID; addr->addr.id.ref = msg_origport(msg); @@ -722,13 +722,13 @@ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) } /** - * anc_data_recv - optionally capture ancillary data for received message + * anc_data_recv - optionally capture ancillary data for received message * @m: descriptor for message info * @msg: received message header * @tport: TIPC port associated with message - * + * * Note: Ancillary data is not captured if not requested by receiver. - * + * * Returns 0 if successful, otherwise errno */ @@ -753,7 +753,7 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, if ((res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data))) return res; if (anc_data[1] && - (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], + (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], msg_data(msg)))) return res; } @@ -790,13 +790,13 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, return 0; } -/** +/** * recv_msg - receive packet-oriented message * @iocb: (unused) * @m: descriptor for message info * @buf_len: total size of user buffer area * @flags: receive flags - * + * * Used for SOCK_DGRAM, SOCK_RDM, and SOCK_SEQPACKET messages. * If the complete message doesn't fit in user area, truncate it. * @@ -827,9 +827,9 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock, if (sock->type == SOCK_SEQPACKET) { if (unlikely(sock->state == SS_UNCONNECTED)) return -ENOTCONN; - if (unlikely((sock->state == SS_DISCONNECTING) && + if (unlikely((sock->state == SS_DISCONNECTING) && (skb_queue_len(&sock->sk->sk_receive_queue) == 0))) - return -ENOTCONN; + return -ENOTCONN; } /* Look for a message in receive queue; wait if necessary */ @@ -845,7 +845,7 @@ restart: } if ((res = wait_event_interruptible( - *sock->sk->sk_sleep, + *sock->sk->sk_sleep, ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || (sock->state == SS_DISCONNECTING))) )) { goto exit; @@ -890,7 +890,7 @@ restart: goto exit; /* Capture message data (if valid) & compute return value (always) */ - + if (!err) { if (unlikely(buf_len < sz)) { sz = buf_len; @@ -913,23 +913,23 @@ restart: /* Consume received message (optional) */ if (likely(!(flags & MSG_PEEK))) { - if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) - tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); + if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) + tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); advance_queue(tsock); - } + } exit: up(&tsock->sem); return res; } -/** +/** * recv_stream - receive stream-oriented data * @iocb: (unused) * @m: descriptor for message info * @buf_len: total size of user buffer area * @flags: receive flags - * - * Used for SOCK_STREAM messages only. If not enough data is available + * + * Used for SOCK_STREAM messages only. If not enough data is available * will optionally wait for more; never truncates data. * * Returns size of returned message data, errno otherwise @@ -980,7 +980,7 @@ restart: } if ((res = wait_event_interruptible( - *sock->sk->sk_sleep, + *sock->sk->sk_sleep, ((q_len = skb_queue_len(&sock->sk->sk_receive_queue)) || (sock->state == SS_DISCONNECTING))) )) { goto exit; @@ -1017,7 +1017,7 @@ restart: } /* Capture message data (if valid) & compute return value (always) */ - + if (!err) { buf_crs = (unsigned char *)(TIPC_SKB_CB(buf)->handle); sz = buf->tail - buf_crs; @@ -1050,14 +1050,14 @@ restart: /* Consume received message (optional) */ if (likely(!(flags & MSG_PEEK))) { - if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) - tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); + if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN)) + tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked); advance_queue(tsock); - } + } /* Loop around if more data is required */ - if ((sz_copied < buf_len) /* didn't get all requested data */ + if ((sz_copied < buf_len) /* didn't get all requested data */ && (flags & MSG_WAITALL) /* ... and need to wait for more */ && (!(flags & MSG_PEEK)) /* ... and aren't just peeking at data */ && (!err) /* ... and haven't reached a FIN */ @@ -1074,7 +1074,7 @@ exit: * @queue_size: current size of queue * @base: nominal maximum size of queue * @msg: message to be added to queue - * + * * Returns 1 if queue is currently overloaded, 0 otherwise */ @@ -1098,7 +1098,7 @@ static int queue_overloaded(u32 queue_size, u32 base, struct tipc_msg *msg) return (queue_size > threshold); } -/** +/** * async_disconnect - wrapper function used to disconnect port * @portref: TIPC port reference (passed as pointer-sized value) */ @@ -1108,13 +1108,13 @@ static void async_disconnect(unsigned long portref) tipc_disconnect((u32)portref); } -/** +/** * dispatch - handle arriving message * @tport: TIPC port that received message * @buf: message - * + * * Called with port locked. Must not take socket lock to avoid deadlock risk. - * + * * Returns TIPC error status code (TIPC_OK if message is not to be rejected) */ @@ -1159,13 +1159,13 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) msg_dbg(msg, "dispatch filter 4\n"); return TIPC_ERR_NO_PORT; } - } + } else if (sock->state == SS_LISTENING) { if (msg_connected(msg) || msg_errcode(msg)) { msg_dbg(msg, "dispatch filter 5\n"); return TIPC_ERR_NO_PORT; } - } + } else if (sock->state == SS_DISCONNECTING) { msg_dbg(msg, "dispatch filter 6\n"); return TIPC_ERR_NO_PORT; @@ -1180,18 +1180,18 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) /* Reject message if there isn't room to queue it */ - if (unlikely((u32)atomic_read(&tipc_queue_size) > + if (unlikely((u32)atomic_read(&tipc_queue_size) > OVERLOAD_LIMIT_BASE)) { - if (queue_overloaded(atomic_read(&tipc_queue_size), + if (queue_overloaded(atomic_read(&tipc_queue_size), OVERLOAD_LIMIT_BASE, msg)) return TIPC_ERR_OVERLOAD; - } + } recv_q_len = skb_queue_len(&tsock->sk.sk_receive_queue); if (unlikely(recv_q_len > (OVERLOAD_LIMIT_BASE / 2))) { - if (queue_overloaded(recv_q_len, - OVERLOAD_LIMIT_BASE / 2, msg)) + if (queue_overloaded(recv_q_len, + OVERLOAD_LIMIT_BASE / 2, msg)) return TIPC_ERR_OVERLOAD; - } + } /* Initiate connection termination for an incoming 'FIN' */ @@ -1213,10 +1213,10 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf) return TIPC_OK; } -/** +/** * wakeupdispatch - wake up port after congestion * @tport: port to wakeup - * + * * Called with port lock on. */ @@ -1238,7 +1238,7 @@ static void wakeupdispatch(struct tipc_port *tport) * Returns 0 on success, errno otherwise */ -static int connect(struct socket *sock, struct sockaddr *dest, int destlen, +static int connect(struct socket *sock, struct sockaddr *dest, int destlen, int flags) { struct tipc_sock *tsock = tipc_sk(sock->sk); @@ -1260,7 +1260,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, if (sock->state == SS_CONNECTING) return -EALREADY; if (sock->state != SS_UNCONNECTED) - return -EISCONN; + return -EISCONN; /* * Reject connection attempt using multicast address @@ -1270,7 +1270,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, */ if (dst->addrtype == TIPC_ADDR_MCAST) - return -EINVAL; + return -EINVAL; /* Send a 'SYN-' to destination */ @@ -1281,19 +1281,19 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, return res; } - if (down_interruptible(&tsock->sem)) - return -ERESTARTSYS; - + if (down_interruptible(&tsock->sem)) + return -ERESTARTSYS; + /* Wait for destination's 'ACK' response */ res = wait_event_interruptible_timeout(*sock->sk->sk_sleep, - skb_queue_len(&sock->sk->sk_receive_queue), + skb_queue_len(&sock->sk->sk_receive_queue), sock->sk->sk_rcvtimeo); buf = skb_peek(&sock->sk->sk_receive_queue); if (res > 0) { msg = buf_msg(buf); - res = auto_connect(sock, tsock, msg); - if (!res) { + res = auto_connect(sock, tsock, msg); + if (!res) { if (!msg_data_sz(msg)) advance_queue(tsock); } @@ -1301,7 +1301,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, if (res == 0) { res = -ETIMEDOUT; } else - { /* leave "res" unchanged */ } + { /* leave "res" unchanged */ } sock->state = SS_DISCONNECTING; } @@ -1309,11 +1309,11 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen, return res; } -/** +/** * listen - allow socket to listen for incoming connections * @sock: socket structure * @len: (unused) - * + * * Returns 0 on success, errno otherwise */ @@ -1326,15 +1326,15 @@ static int listen(struct socket *sock, int len) if (sock->state != SS_UNCONNECTED) return -EINVAL; sock->state = SS_LISTENING; - return 0; + return 0; } -/** +/** * accept - wait for connection request * @sock: listening socket * @newsock: new socket that is to be connected * @flags: file-related flags associated with socket - * + * * Returns 0 on success, errno otherwise */ @@ -1348,15 +1348,15 @@ static int accept(struct socket *sock, struct socket *newsock, int flags) return -EOPNOTSUPP; if (sock->state != SS_LISTENING) return -EINVAL; - - if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && + + if (unlikely((skb_queue_len(&sock->sk->sk_receive_queue) == 0) && (flags & O_NONBLOCK))) return -EWOULDBLOCK; if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; - if (wait_event_interruptible(*sock->sk->sk_sleep, + if (wait_event_interruptible(*sock->sk->sk_sleep, skb_queue_len(&sock->sk->sk_receive_queue))) { res = -ERESTARTSYS; goto exit; @@ -1381,18 +1381,18 @@ static int accept(struct socket *sock, struct socket *newsock, int flags) new_tsock->p->conn_instance = msg_nameinst(msg); } - /* + /* * Respond to 'SYN-' by discarding it & returning 'ACK'-. * Respond to 'SYN+' by queuing it on new socket. */ msg_dbg(msg,"sk->sk_receive_queue); sock_unlock(tsock); @@ -1410,7 +1410,7 @@ exit: * @how: direction to close (unused; always treated as read + write) * * Terminates connection (if necessary), then purges socket's receive queue. - * + * * Returns 0 on success, errno otherwise */ @@ -1483,32 +1483,32 @@ restart: * @opt: option identifier * @ov: pointer to new option value * @ol: length of option value - * - * For stream sockets only, accepts and ignores all IPPROTO_TCP options + * + * For stream sockets only, accepts and ignores all IPPROTO_TCP options * (to ease compatibility). - * + * * Returns 0 on success, errno otherwise */ -static int setsockopt(struct socket *sock, +static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int ol) { struct tipc_sock *tsock = tipc_sk(sock->sk); u32 value; int res; - if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) - return 0; + if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) + return 0; if (lvl != SOL_TIPC) return -ENOPROTOOPT; if (ol < sizeof(value)) return -EINVAL; - if ((res = get_user(value, (u32 __user *)ov))) + if ((res = get_user(value, (u32 __user *)ov))) return res; - if (down_interruptible(&tsock->sem)) + if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; - + switch (opt) { case TIPC_IMPORTANCE: res = tipc_set_portimportance(tsock->p->ref, value); @@ -1516,7 +1516,7 @@ static int setsockopt(struct socket *sock, case TIPC_SRC_DROPPABLE: if (sock->type != SOCK_STREAM) res = tipc_set_portunreliable(tsock->p->ref, value); - else + else res = -ENOPROTOOPT; break; case TIPC_DEST_DROPPABLE: @@ -1540,29 +1540,29 @@ static int setsockopt(struct socket *sock, * @opt: option identifier * @ov: receptacle for option value * @ol: receptacle for length of option value - * - * For stream sockets only, returns 0 length result for all IPPROTO_TCP options + * + * For stream sockets only, returns 0 length result for all IPPROTO_TCP options * (to ease compatibility). - * + * * Returns 0 on success, errno otherwise */ -static int getsockopt(struct socket *sock, +static int getsockopt(struct socket *sock, int lvl, int opt, char __user *ov, int __user *ol) { struct tipc_sock *tsock = tipc_sk(sock->sk); - int len; + int len; u32 value; - int res; + int res; - if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) - return put_user(0, ol); + if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) + return put_user(0, ol); if (lvl != SOL_TIPC) return -ENOPROTOOPT; - if ((res = get_user(len, ol))) - return res; + if ((res = get_user(len, ol))) + return res; - if (down_interruptible(&tsock->sem)) + if (down_interruptible(&tsock->sem)) return -ERESTARTSYS; switch (opt) { @@ -1595,30 +1595,30 @@ static int getsockopt(struct socket *sock, res = put_user(sizeof(value), ol); } - up(&tsock->sem); + up(&tsock->sem); return res; } /** * Placeholders for non-implemented functionality - * + * * Returns error code (POSIX-compliant where defined) */ static int ioctl(struct socket *s, u32 cmd, unsigned long arg) { - return -EINVAL; + return -EINVAL; } static int no_mmap(struct file *file, struct socket *sock, - struct vm_area_struct *vma) + struct vm_area_struct *vma) { - return -EINVAL; + return -EINVAL; } static ssize_t no_sendpage(struct socket *sock, struct page *page, - int offset, size_t size, int flags) + int offset, size_t size, int flags) { - return -EINVAL; + return -EINVAL; } static int no_skpair(struct socket *s1, struct socket *s2) @@ -1647,8 +1647,8 @@ static struct proto_ops msg_ops = { .getsockopt = getsockopt, .sendmsg = send_msg, .recvmsg = recv_msg, - .mmap = no_mmap, - .sendpage = no_sendpage + .mmap = no_mmap, + .sendpage = no_sendpage }; static struct proto_ops packet_ops = { @@ -1668,8 +1668,8 @@ static struct proto_ops packet_ops = { .getsockopt = getsockopt, .sendmsg = send_packet, .recvmsg = recv_msg, - .mmap = no_mmap, - .sendpage = no_sendpage + .mmap = no_mmap, + .sendpage = no_sendpage }; static struct proto_ops stream_ops = { @@ -1689,8 +1689,8 @@ static struct proto_ops stream_ops = { .getsockopt = getsockopt, .sendmsg = send_stream, .recvmsg = recv_stream, - .mmap = no_mmap, - .sendpage = no_sendpage + .mmap = no_mmap, + .sendpage = no_sendpage }; static struct net_proto_family tipc_family_ops = { @@ -1707,14 +1707,14 @@ static struct proto tipc_proto = { /** * tipc_socket_init - initialize TIPC socket interface - * + * * Returns 0 on success, errno otherwise */ int tipc_socket_init(void) { int res; - res = proto_register(&tipc_proto, 1); + res = proto_register(&tipc_proto, 1); if (res) { err("Failed to register TIPC protocol type\n"); goto out; diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index ddade7388aa..8c01ccd3626 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c @@ -1,6 +1,6 @@ /* * net/tipc/subscr.c: TIPC subscription service - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -49,10 +49,10 @@ * @port_ref: object reference to port used to communicate with subscriber * @swap: indicates if subscriber uses opposite endianness in its messages */ - + struct subscriber { u32 ref; - spinlock_t *lock; + spinlock_t *lock; struct list_head subscriber_list; struct list_head subscription_list; u32 port_ref; @@ -82,7 +82,7 @@ static struct top_srv topsrv = { 0 }; * htohl - convert value to endianness used by destination * @in: value to convert * @swap: non-zero if endianness must be reversed - * + * * Returns converted value */ @@ -97,11 +97,11 @@ static u32 htohl(u32 in, int swap) * subscr_send_event - send a message containing a tipc_event to the subscriber */ -static void subscr_send_event(struct subscription *sub, - u32 found_lower, +static void subscr_send_event(struct subscription *sub, + u32 found_lower, u32 found_upper, - u32 event, - u32 port_ref, + u32 event, + u32 port_ref, u32 node) { struct iovec msg_sect; @@ -123,8 +123,8 @@ static void subscr_send_event(struct subscription *sub, * Returns 1 if there is overlap, otherwise 0. */ -int tipc_subscr_overlap(struct subscription *sub, - u32 found_lower, +int tipc_subscr_overlap(struct subscription *sub, + u32 found_lower, u32 found_upper) { @@ -139,15 +139,15 @@ int tipc_subscr_overlap(struct subscription *sub, /** * tipc_subscr_report_overlap - issue event if there is subscription overlap - * + * * Protected by nameseq.lock in name_table.c */ -void tipc_subscr_report_overlap(struct subscription *sub, - u32 found_lower, +void tipc_subscr_report_overlap(struct subscription *sub, + u32 found_lower, u32 found_upper, - u32 event, - u32 port_ref, + u32 event, + u32 port_ref, u32 node, int must) { @@ -189,11 +189,11 @@ static void subscr_timeout(struct subscription *sub) /* Notify subscriber of timeout, then unlink subscription */ - subscr_send_event(sub, - sub->evt.s.seq.lower, + subscr_send_event(sub, + sub->evt.s.seq.lower, sub->evt.s.seq.upper, - TIPC_SUBSCR_TIMEOUT, - 0, + TIPC_SUBSCR_TIMEOUT, + 0, 0); list_del(&sub->subscription_list); @@ -221,11 +221,11 @@ static void subscr_del(struct subscription *sub) /** * subscr_terminate - terminate communication with a subscriber - * + * * Called with subscriber locked. Routine must temporarily release this lock - * to enable subscription timeout routine(s) to finish without deadlocking; + * to enable subscription timeout routine(s) to finish without deadlocking; * the lock is then reclaimed to allow caller to release it upon return. - * (This should work even in the unlikely event some other thread creates + * (This should work even in the unlikely event some other thread creates * a new object reference in the interim that uses this lock; this routine will * simply wait for it to be released, then claim it.) */ @@ -241,7 +241,7 @@ static void subscr_terminate(struct subscriber *subscriber) spin_unlock_bh(subscriber->lock); /* Destroy any existing subscriptions for subscriber */ - + list_for_each_entry_safe(sub, sub_temp, &subscriber->subscription_list, subscription_list) { if (sub->timeout != TIPC_WAIT_FOREVER) { @@ -315,7 +315,7 @@ static void subscr_cancel(struct tipc_subscr *s, /** * subscr_subscribe - create subscription for subscriber - * + * * Called with subscriber locked */ @@ -431,7 +431,7 @@ static void subscr_conn_msg_event(void *usr_handle, subscr_terminate(subscriber); else subscr_subscribe((struct tipc_subscr *)data, subscriber); - + spin_unlock_bh(subscriber_lock); } @@ -444,7 +444,7 @@ static void subscr_named_msg_event(void *usr_handle, struct sk_buff **buf, const unchar *data, u32 size, - u32 importance, + u32 importance, struct tipc_portid const *orig, struct tipc_name_seq const *dest) { @@ -534,22 +534,22 @@ int tipc_subscr_start(void) return res; } - res = tipc_createport(topsrv.user_ref, - NULL, - TIPC_CRITICAL_IMPORTANCE, - NULL, - NULL, - NULL, - NULL, - subscr_named_msg_event, - NULL, - NULL, - &topsrv.setup_port); - if (res) + res = tipc_createport(topsrv.user_ref, + NULL, + TIPC_CRITICAL_IMPORTANCE, + NULL, + NULL, + NULL, + NULL, + subscr_named_msg_event, + NULL, + NULL, + &topsrv.setup_port); + if (res) goto failed; - res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); - if (res) + res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq); + if (res) goto failed; spin_unlock_bh(&topsrv.lock); @@ -571,7 +571,7 @@ void tipc_subscr_stop(void) if (topsrv.user_ref) { tipc_deleteport(topsrv.setup_port); - list_for_each_entry_safe(subscriber, subscriber_temp, + list_for_each_entry_safe(subscriber, subscriber_temp, &topsrv.subscriber_list, subscriber_list) { tipc_ref_lock(subscriber->ref); diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h index 1e5090465d2..93a8e674fac 100644 --- a/net/tipc/subscr.h +++ b/net/tipc/subscr.h @@ -1,6 +1,6 @@ /* * net/tipc/subscr.h: Include file for TIPC subscription service - * + * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -48,7 +48,7 @@ * @timer_ref: reference to timer governing subscription duration (may be NULL) * @owner: pointer to subscriber object associated with this subscription */ - + struct subscription { struct tipc_name_seq seq; u32 timeout; @@ -60,15 +60,15 @@ struct subscription { struct subscriber *owner; }; -int tipc_subscr_overlap(struct subscription * sub, - u32 found_lower, +int tipc_subscr_overlap(struct subscription * sub, + u32 found_lower, u32 found_upper); -void tipc_subscr_report_overlap(struct subscription * sub, - u32 found_lower, +void tipc_subscr_report_overlap(struct subscription * sub, + u32 found_lower, u32 found_upper, - u32 event, - u32 port_ref, + u32 event, + u32 port_ref, u32 node, int must_report); diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c index 04d1b9be9c5..4146c40cd20 100644 --- a/net/tipc/user_reg.c +++ b/net/tipc/user_reg.c @@ -1,6 +1,6 @@ /* * net/tipc/user_reg.c: TIPC user registry code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems * All rights reserved. @@ -40,7 +40,7 @@ /* * TIPC user registry keeps track of users of the tipc_port interface. * - * The registry utilizes an array of "TIPC user" entries; + * The registry utilizes an array of "TIPC user" entries; * a user's ID is the index of their associated array entry. * Array entry 0 is not used, so userid 0 is not valid; * TIPC sometimes uses this value to denote an anonymous user. @@ -51,7 +51,7 @@ * struct tipc_user - registered TIPC user info * @next: index of next free registry entry (or -1 for an allocated entry) * @callback: ptr to routine to call when TIPC mode changes (NULL if none) - * @usr_handle: user-defined value passed to callback routine + * @usr_handle: user-defined value passed to callback routine * @ports: list of user ports owned by the user */ @@ -71,7 +71,7 @@ static DEFINE_SPINLOCK(reg_lock); /** * reg_init - create TIPC user registry (but don't activate it) - * + * * If registry has been pre-initialized it is left "as is". * NOTE: This routine may be called when TIPC is inactive. */ @@ -79,7 +79,7 @@ static DEFINE_SPINLOCK(reg_lock); static int reg_init(void) { u32 i; - + spin_lock_bh(®_lock); if (!users) { users = kzalloc(USER_LIST_SIZE, GFP_ATOMIC); @@ -137,7 +137,7 @@ int tipc_reg_start(void) */ void tipc_reg_stop(void) -{ +{ int id; if (!users) @@ -174,14 +174,14 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle) user_ptr = &users[next_free_user]; *userid = next_free_user; next_free_user = user_ptr->next; - user_ptr->next = -1; + user_ptr->next = -1; spin_unlock_bh(®_lock); user_ptr->callback = cb; user_ptr->usr_handle = usr_handle; INIT_LIST_HEAD(&user_ptr->ports); atomic_inc(&tipc_user_count); - + if (cb && (tipc_mode != TIPC_NOT_RUNNING)) tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr); return TIPC_OK; @@ -207,16 +207,16 @@ void tipc_detach(u32 userid) } user_ptr = &users[userid]; - user_ptr->callback = NULL; + user_ptr->callback = NULL; INIT_LIST_HEAD(&ports_temp); - list_splice(&user_ptr->ports, &ports_temp); + list_splice(&user_ptr->ports, &ports_temp); user_ptr->next = next_free_user; next_free_user = userid; spin_unlock_bh(®_lock); atomic_dec(&tipc_user_count); - list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { + list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) { tipc_deleteport(up_ptr->ref); } } diff --git a/net/tipc/user_reg.h b/net/tipc/user_reg.h index d0e88794ed1..81dc12e2882 100644 --- a/net/tipc/user_reg.h +++ b/net/tipc/user_reg.h @@ -1,6 +1,6 @@ /* * net/tipc/user_reg.h: Include file for TIPC user registry code - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. diff --git a/net/tipc/zone.c b/net/tipc/zone.c index f5b00ea2d5a..114e173f11a 100644 --- a/net/tipc/zone.c +++ b/net/tipc/zone.c @@ -1,6 +1,6 @@ /* * net/tipc/zone.c: TIPC zone management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * All rights reserved. @@ -92,7 +92,7 @@ void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router) for (c_num = 1; c_num <= tipc_max_clusters; c_num++) { if (z_ptr->clusters[c_num]) { - tipc_cltr_remove_as_router(z_ptr->clusters[c_num], + tipc_cltr_remove_as_router(z_ptr->clusters[c_num], router); } } diff --git a/net/tipc/zone.h b/net/tipc/zone.h index 5ab3d08602e..6e7a08df8af 100644 --- a/net/tipc/zone.h +++ b/net/tipc/zone.h @@ -1,6 +1,6 @@ /* * net/tipc/zone.h: Include file for TIPC zone management routines - * + * * Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2005-2006, Wind River Systems * All rights reserved. @@ -47,7 +47,7 @@ * @clusters: array of pointers to all clusters within zone * @links: number of (unicast) links to zone */ - + struct _zone { u32 addr; struct cluster *clusters[2]; /* currently limited to just 1 cluster */