Loading include/linux/tipc.h +1 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * include/linux/tipc.h: Include file for TIPC socket interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr) #define TIPC_SUB_PORTS 0x01 /* filter for port availability */ #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ #define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ #if 0 /* The following filter options are not currently implemented */ #define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ #define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */ #define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */ #endif #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ Loading include/linux/tipc_config.h +5 −27 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * include/linux/tipc_config.h: Include file for TIPC configuration interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2007, Wind River Systems * Copyright (c) 2005-2007, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -76,13 +76,6 @@ #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ #if 0 #define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ #define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */ #define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */ #define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */ #endif /* * Protected commands: * May only be issued by "network administration capable" process. Loading @@ -109,13 +102,6 @@ #define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ #if 0 #define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */ #define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */ #define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */ #define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */ #endif /* * Private commands: * May only be issued by "network administration capable" process. Loading @@ -123,9 +109,6 @@ */ #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ #if 0 #define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */ #endif #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ Loading Loading @@ -193,6 +176,10 @@ #define TIPC_DEF_LINK_TOL 1500 #define TIPC_MAX_LINK_TOL 30000 #if (TIPC_MIN_LINK_TOL < 16) #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" #endif /* * Link window limits (min, default, max), in packets */ Loading Loading @@ -247,15 +234,6 @@ struct tipc_name_table_query { #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ #if 0 /* prototypes TLV structures for proposed commands */ struct tipc_link_create { __u32 domain; struct tipc_media_addr peer_addr; char bearer_name[TIPC_MAX_BEARER_NAME]; }; #endif /* * A TLV consists of a descriptor, followed by the TLV value. * TLV descriptor fields are stored in network byte order; Loading net/tipc/bcast.c +29 −18 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * * Copyright (c) 2004-2006, Ericsson AB * Copyright (c) 2004, Intel Corporation. * Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -61,8 +61,8 @@ */ struct bcbearer_pair { struct bearer *primary; struct bearer *secondary; struct tipc_bearer *primary; struct tipc_bearer *secondary; }; /** Loading @@ -81,7 +81,7 @@ struct bcbearer_pair { */ struct bcbearer { struct bearer bearer; struct tipc_bearer bearer; struct media media; struct bcbearer_pair bpairs[MAX_BEARERS]; struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; Loading @@ -93,6 +93,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 * @retransmit_to: node that most recently requested a retransmit * * Handles sequence numbering, fragmentation, bundling, etc. */ Loading @@ -100,6 +101,7 @@ struct bcbearer { struct bclink { struct link link; struct tipc_node node; struct tipc_node *retransmit_to; }; Loading Loading @@ -183,6 +185,17 @@ static int bclink_ack_allowed(u32 n) } /** * tipc_bclink_retransmit_to - get most recent node to request retransmission * * Called with bc_lock locked */ struct tipc_node *tipc_bclink_retransmit_to(void) { return bclink->retransmit_to; } /** * bclink_retransmit_pkt - retransmit broadcast packets * @after: sequence number of last packet to *not* retransmit Loading Loading @@ -285,6 +298,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr) msg = buf_msg(buf); tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, INT_H_SIZE, n_ptr->addr); msg_set_non_seq(msg, 1); msg_set_mc_netid(msg, tipc_net_id); msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); Loading Loading @@ -405,8 +419,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf) else bclink_set_last_sent(); if (bcl->out_queue_size > bcl->stats.max_queue_sz) bcl->stats.max_queue_sz = bcl->out_queue_size; bcl->stats.queue_sz_counts++; bcl->stats.accu_queue_sz += bcl->out_queue_size; Loading Loading @@ -444,10 +456,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) tipc_node_unlock(node); spin_lock_bh(&bc_lock); bcl->stats.recv_nacks++; bcl->owner->next = node; /* remember requestor */ bclink->retransmit_to = node; bclink_retransmit_pkt(msg_bcgap_after(msg), msg_bcgap_to(msg)); bcl->owner->next = NULL; spin_unlock_bh(&bc_lock); } else { tipc_bclink_peek_nack(msg_destnode(msg), Loading Loading @@ -574,8 +585,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, bcbearer->remains = tipc_bcast_nmap; for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { struct bearer *p = bcbearer->bpairs[bp_index].primary; struct bearer *s = bcbearer->bpairs[bp_index].secondary; struct tipc_bearer *p = bcbearer->bpairs[bp_index].primary; struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary; if (!p) break; /* no more bearers to try */ Loading @@ -584,11 +595,11 @@ static int tipc_bcbearer_send(struct sk_buff *buf, if (bcbearer->remains_new.count == bcbearer->remains.count) continue; /* bearer pair doesn't add anything */ if (p->publ.blocked || p->media->send_msg(buf, &p->publ, &p->media->bcast_addr)) { if (p->blocked || p->media->send_msg(buf, p, &p->media->bcast_addr)) { /* unable to send on primary bearer */ if (!s || s->publ.blocked || s->media->send_msg(buf, &s->publ, if (!s || s->blocked || s->media->send_msg(buf, s, &s->media->bcast_addr)) { /* unable to send on either bearer */ continue; Loading Loading @@ -633,7 +644,7 @@ void tipc_bcbearer_sort(void) memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); for (b_index = 0; b_index < MAX_BEARERS; b_index++) { struct bearer *b = &tipc_bearers[b_index]; struct tipc_bearer *b = &tipc_bearers[b_index]; if (!b->active || !b->nodes.count) continue; Loading Loading @@ -682,12 +693,12 @@ void tipc_bcbearer_sort(void) void tipc_bcbearer_push(void) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; spin_lock_bh(&bc_lock); b_ptr = &bcbearer->bearer; if (b_ptr->publ.blocked) { b_ptr->publ.blocked = 0; if (b_ptr->blocked) { b_ptr->blocked = 0; tipc_bearer_lock_push(b_ptr); } spin_unlock_bh(&bc_lock); Loading net/tipc/bcast.h +2 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * net/tipc/bcast.h: Include file for TIPC broadcast code * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -90,6 +90,7 @@ void tipc_port_list_free(struct port_list *pl_ptr); int tipc_bclink_init(void); void tipc_bclink_stop(void); struct tipc_node *tipc_bclink_retransmit_to(void); void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); int tipc_bclink_send_msg(struct sk_buff *buf); void tipc_bclink_recv_pkt(struct sk_buff *buf); Loading net/tipc/bearer.c +49 −51 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * net/tipc/bearer.c: TIPC bearer code * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * Copyright (c) 2004-2006, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -44,7 +44,7 @@ static struct media media_list[MAX_MEDIA]; static u32 media_count; struct bearer tipc_bearers[MAX_BEARERS]; struct tipc_bearer tipc_bearers[MAX_BEARERS]; /** * media_name_valid - validate media name Loading Loading @@ -278,13 +278,13 @@ static int bearer_name_validate(const char *name, * bearer_find - locates bearer object with matching bearer name */ static struct bearer *bearer_find(const char *name) static struct tipc_bearer *bearer_find(const char *name) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; u32 i; for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) if (b_ptr->active && (!strcmp(b_ptr->name, name))) return b_ptr; } return NULL; Loading @@ -294,16 +294,16 @@ static struct bearer *bearer_find(const char *name) * tipc_bearer_find_interface - locates bearer object with matching interface name */ struct bearer *tipc_bearer_find_interface(const char *if_name) struct tipc_bearer *tipc_bearer_find_interface(const char *if_name) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; char *b_if_name; u32 i; for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (!b_ptr->active) continue; b_if_name = strchr(b_ptr->publ.name, ':') + 1; b_if_name = strchr(b_ptr->name, ':') + 1; if (!strcmp(b_if_name, if_name)) return b_ptr; } Loading @@ -318,7 +318,7 @@ struct sk_buff *tipc_bearer_get_names(void) { struct sk_buff *buf; struct media *m_ptr; struct bearer *b_ptr; struct tipc_bearer *b_ptr; int i, j; buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); Loading @@ -331,8 +331,8 @@ struct sk_buff *tipc_bearer_get_names(void) 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, strlen(b_ptr->publ.name) + 1); b_ptr->name, strlen(b_ptr->name) + 1); } } } Loading @@ -340,14 +340,14 @@ struct sk_buff *tipc_bearer_get_names(void) return buf; } void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest) void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest) { tipc_nmap_add(&b_ptr->nodes, dest); tipc_disc_update_link_req(b_ptr->link_req); tipc_bcbearer_sort(); } void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest) void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest) { tipc_nmap_remove(&b_ptr->nodes, dest); tipc_disc_update_link_req(b_ptr->link_req); Loading @@ -362,12 +362,12 @@ void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest) * bearer.lock must be taken before calling * Returns binary true(1) ore false(0) */ static int bearer_push(struct bearer *b_ptr) static int bearer_push(struct tipc_bearer *b_ptr) { u32 res = 0; struct link *ln, *tln; if (b_ptr->publ.blocked) if (b_ptr->blocked) return 0; while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { Loading @@ -382,13 +382,13 @@ static int bearer_push(struct bearer *b_ptr) return list_empty(&b_ptr->cong_links); } void tipc_bearer_lock_push(struct bearer *b_ptr) void tipc_bearer_lock_push(struct tipc_bearer *b_ptr) { int res; spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); res = bearer_push(b_ptr); spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); if (res) tipc_bcbearer_push(); } Loading @@ -398,16 +398,14 @@ void tipc_bearer_lock_push(struct bearer *b_ptr) * Interrupt enabling new requests after bearer congestion or blocking: * See bearer_send(). */ void tipc_continue(struct tipc_bearer *tb_ptr) void tipc_continue(struct tipc_bearer *b_ptr) { struct bearer *b_ptr = (struct bearer *)tb_ptr; spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); b_ptr->continue_count++; if (!list_empty(&b_ptr->cong_links)) tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr); b_ptr->publ.blocked = 0; spin_unlock_bh(&b_ptr->publ.lock); b_ptr->blocked = 0; spin_unlock_bh(&b_ptr->lock); } /* Loading @@ -418,7 +416,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr) * bearer.lock is busy */ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) static void tipc_bearer_schedule_unlocked(struct tipc_bearer *b_ptr, struct link *l_ptr) { list_move_tail(&l_ptr->link_list, &b_ptr->cong_links); } Loading @@ -431,11 +429,11 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p * bearer.lock is free */ void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct link *l_ptr) { spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); tipc_bearer_schedule_unlocked(b_ptr, l_ptr); spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); } Loading @@ -444,18 +442,18 @@ void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) * and if there is, try to resolve it before returning. * 'tipc_net_lock' is read_locked when this function is called */ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) int tipc_bearer_resolve_congestion(struct tipc_bearer *b_ptr, struct link *l_ptr) { int res = 1; if (list_empty(&b_ptr->cong_links)) return 1; spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); if (!bearer_push(b_ptr)) { tipc_bearer_schedule_unlocked(b_ptr, l_ptr); res = 0; } spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); return res; } Loading @@ -463,9 +461,9 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) * tipc_bearer_congested - determines if bearer is currently congested */ int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr) int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr) { if (unlikely(b_ptr->publ.blocked)) if (unlikely(b_ptr->blocked)) return 1; if (likely(list_empty(&b_ptr->cong_links))) return 0; Loading @@ -478,7 +476,7 @@ int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr) int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; struct media *m_ptr; struct bearer_name b_name; char addr_string[16]; Loading Loading @@ -528,7 +526,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) bearer_id = i; continue; } if (!strcmp(name, tipc_bearers[i].publ.name)) { if (!strcmp(name, tipc_bearers[i].name)) { warn("Bearer <%s> rejected, already enabled\n", name); goto failed; } Loading @@ -551,8 +549,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) } b_ptr = &tipc_bearers[bearer_id]; strcpy(b_ptr->publ.name, name); res = m_ptr->enable_bearer(&b_ptr->publ); strcpy(b_ptr->name, name); res = m_ptr->enable_bearer(b_ptr); if (res) { warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); goto failed; Loading @@ -568,9 +566,9 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) INIT_LIST_HEAD(&b_ptr->links); if (m_ptr->bcast) { b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr, bcast_scope, 2); bcast_scope); } spin_lock_init(&b_ptr->publ.lock); spin_lock_init(&b_ptr->lock); write_unlock_bh(&tipc_net_lock); info("Enabled bearer <%s>, discovery domain %s, priority %u\n", name, tipc_addr_string_fill(addr_string, bcast_scope), priority); Loading @@ -587,7 +585,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) int tipc_block_bearer(const char *name) { struct bearer *b_ptr = NULL; struct tipc_bearer *b_ptr = NULL; struct link *l_ptr; struct link *temp_l_ptr; Loading @@ -600,8 +598,8 @@ int tipc_block_bearer(const char *name) } info("Blocking bearer <%s>\n", name); spin_lock_bh(&b_ptr->publ.lock); b_ptr->publ.blocked = 1; spin_lock_bh(&b_ptr->lock); b_ptr->blocked = 1; list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { struct tipc_node *n_ptr = l_ptr->owner; Loading @@ -609,7 +607,7 @@ int tipc_block_bearer(const char *name) tipc_link_reset(l_ptr); spin_unlock_bh(&n_ptr->lock); } spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); read_unlock_bh(&tipc_net_lock); return 0; } Loading @@ -620,27 +618,27 @@ int tipc_block_bearer(const char *name) * Note: This routine assumes caller holds tipc_net_lock. */ static void bearer_disable(struct bearer *b_ptr) static void bearer_disable(struct tipc_bearer *b_ptr) { struct link *l_ptr; struct link *temp_l_ptr; info("Disabling bearer <%s>\n", b_ptr->publ.name); info("Disabling bearer <%s>\n", b_ptr->name); tipc_disc_stop_link_req(b_ptr->link_req); spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); b_ptr->link_req = NULL; b_ptr->publ.blocked = 1; b_ptr->media->disable_bearer(&b_ptr->publ); b_ptr->blocked = 1; b_ptr->media->disable_bearer(b_ptr); list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { tipc_link_delete(l_ptr); } spin_unlock_bh(&b_ptr->publ.lock); memset(b_ptr, 0, sizeof(struct bearer)); spin_unlock_bh(&b_ptr->lock); memset(b_ptr, 0, sizeof(struct tipc_bearer)); } int tipc_disable_bearer(const char *name) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; int res; write_lock_bh(&tipc_net_lock); Loading Loading
include/linux/tipc.h +1 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * include/linux/tipc.h: Include file for TIPC socket interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr) #define TIPC_SUB_PORTS 0x01 /* filter for port availability */ #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ #define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ #if 0 /* The following filter options are not currently implemented */ #define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */ #define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */ #define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */ #endif #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */ Loading
include/linux/tipc_config.h +5 −27 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * include/linux/tipc_config.h: Include file for TIPC configuration interface * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005-2007, Wind River Systems * Copyright (c) 2005-2007, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -76,13 +76,6 @@ #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ #define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */ #if 0 #define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ #define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */ #define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */ #define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */ #endif /* * Protected commands: * May only be issued by "network administration capable" process. Loading @@ -109,13 +102,6 @@ #define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ #define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ #if 0 #define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */ #define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */ #define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */ #define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */ #endif /* * Private commands: * May only be issued by "network administration capable" process. Loading @@ -123,9 +109,6 @@ */ #define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ #if 0 #define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */ #endif #define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ Loading Loading @@ -193,6 +176,10 @@ #define TIPC_DEF_LINK_TOL 1500 #define TIPC_MAX_LINK_TOL 30000 #if (TIPC_MIN_LINK_TOL < 16) #error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)" #endif /* * Link window limits (min, default, max), in packets */ Loading Loading @@ -247,15 +234,6 @@ struct tipc_name_table_query { #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ #define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ #if 0 /* prototypes TLV structures for proposed commands */ struct tipc_link_create { __u32 domain; struct tipc_media_addr peer_addr; char bearer_name[TIPC_MAX_BEARER_NAME]; }; #endif /* * A TLV consists of a descriptor, followed by the TLV value. * TLV descriptor fields are stored in network byte order; Loading
net/tipc/bcast.c +29 −18 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * * Copyright (c) 2004-2006, Ericsson AB * Copyright (c) 2004, Intel Corporation. * Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -61,8 +61,8 @@ */ struct bcbearer_pair { struct bearer *primary; struct bearer *secondary; struct tipc_bearer *primary; struct tipc_bearer *secondary; }; /** Loading @@ -81,7 +81,7 @@ struct bcbearer_pair { */ struct bcbearer { struct bearer bearer; struct tipc_bearer bearer; struct media media; struct bcbearer_pair bpairs[MAX_BEARERS]; struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; Loading @@ -93,6 +93,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 * @retransmit_to: node that most recently requested a retransmit * * Handles sequence numbering, fragmentation, bundling, etc. */ Loading @@ -100,6 +101,7 @@ struct bcbearer { struct bclink { struct link link; struct tipc_node node; struct tipc_node *retransmit_to; }; Loading Loading @@ -183,6 +185,17 @@ static int bclink_ack_allowed(u32 n) } /** * tipc_bclink_retransmit_to - get most recent node to request retransmission * * Called with bc_lock locked */ struct tipc_node *tipc_bclink_retransmit_to(void) { return bclink->retransmit_to; } /** * bclink_retransmit_pkt - retransmit broadcast packets * @after: sequence number of last packet to *not* retransmit Loading Loading @@ -285,6 +298,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr) msg = buf_msg(buf); tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, INT_H_SIZE, n_ptr->addr); msg_set_non_seq(msg, 1); msg_set_mc_netid(msg, tipc_net_id); msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in)); msg_set_bcgap_after(msg, n_ptr->bclink.gap_after); Loading Loading @@ -405,8 +419,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf) else bclink_set_last_sent(); if (bcl->out_queue_size > bcl->stats.max_queue_sz) bcl->stats.max_queue_sz = bcl->out_queue_size; bcl->stats.queue_sz_counts++; bcl->stats.accu_queue_sz += bcl->out_queue_size; Loading Loading @@ -444,10 +456,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) tipc_node_unlock(node); spin_lock_bh(&bc_lock); bcl->stats.recv_nacks++; bcl->owner->next = node; /* remember requestor */ bclink->retransmit_to = node; bclink_retransmit_pkt(msg_bcgap_after(msg), msg_bcgap_to(msg)); bcl->owner->next = NULL; spin_unlock_bh(&bc_lock); } else { tipc_bclink_peek_nack(msg_destnode(msg), Loading Loading @@ -574,8 +585,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, bcbearer->remains = tipc_bcast_nmap; for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { struct bearer *p = bcbearer->bpairs[bp_index].primary; struct bearer *s = bcbearer->bpairs[bp_index].secondary; struct tipc_bearer *p = bcbearer->bpairs[bp_index].primary; struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary; if (!p) break; /* no more bearers to try */ Loading @@ -584,11 +595,11 @@ static int tipc_bcbearer_send(struct sk_buff *buf, if (bcbearer->remains_new.count == bcbearer->remains.count) continue; /* bearer pair doesn't add anything */ if (p->publ.blocked || p->media->send_msg(buf, &p->publ, &p->media->bcast_addr)) { if (p->blocked || p->media->send_msg(buf, p, &p->media->bcast_addr)) { /* unable to send on primary bearer */ if (!s || s->publ.blocked || s->media->send_msg(buf, &s->publ, if (!s || s->blocked || s->media->send_msg(buf, s, &s->media->bcast_addr)) { /* unable to send on either bearer */ continue; Loading Loading @@ -633,7 +644,7 @@ void tipc_bcbearer_sort(void) memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); for (b_index = 0; b_index < MAX_BEARERS; b_index++) { struct bearer *b = &tipc_bearers[b_index]; struct tipc_bearer *b = &tipc_bearers[b_index]; if (!b->active || !b->nodes.count) continue; Loading Loading @@ -682,12 +693,12 @@ void tipc_bcbearer_sort(void) void tipc_bcbearer_push(void) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; spin_lock_bh(&bc_lock); b_ptr = &bcbearer->bearer; if (b_ptr->publ.blocked) { b_ptr->publ.blocked = 0; if (b_ptr->blocked) { b_ptr->blocked = 0; tipc_bearer_lock_push(b_ptr); } spin_unlock_bh(&bc_lock); Loading
net/tipc/bcast.h +2 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * net/tipc/bcast.h: Include file for TIPC broadcast code * * Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -90,6 +90,7 @@ void tipc_port_list_free(struct port_list *pl_ptr); int tipc_bclink_init(void); void tipc_bclink_stop(void); struct tipc_node *tipc_bclink_retransmit_to(void); void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked); int tipc_bclink_send_msg(struct sk_buff *buf); void tipc_bclink_recv_pkt(struct sk_buff *buf); Loading
net/tipc/bearer.c +49 −51 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * net/tipc/bearer.c: TIPC bearer code * * Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 2004-2006, Wind River Systems * Copyright (c) 2004-2006, 2010-2011, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without Loading Loading @@ -44,7 +44,7 @@ static struct media media_list[MAX_MEDIA]; static u32 media_count; struct bearer tipc_bearers[MAX_BEARERS]; struct tipc_bearer tipc_bearers[MAX_BEARERS]; /** * media_name_valid - validate media name Loading Loading @@ -278,13 +278,13 @@ static int bearer_name_validate(const char *name, * bearer_find - locates bearer object with matching bearer name */ static struct bearer *bearer_find(const char *name) static struct tipc_bearer *bearer_find(const char *name) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; u32 i; for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) if (b_ptr->active && (!strcmp(b_ptr->name, name))) return b_ptr; } return NULL; Loading @@ -294,16 +294,16 @@ static struct bearer *bearer_find(const char *name) * tipc_bearer_find_interface - locates bearer object with matching interface name */ struct bearer *tipc_bearer_find_interface(const char *if_name) struct tipc_bearer *tipc_bearer_find_interface(const char *if_name) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; char *b_if_name; u32 i; for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (!b_ptr->active) continue; b_if_name = strchr(b_ptr->publ.name, ':') + 1; b_if_name = strchr(b_ptr->name, ':') + 1; if (!strcmp(b_if_name, if_name)) return b_ptr; } Loading @@ -318,7 +318,7 @@ struct sk_buff *tipc_bearer_get_names(void) { struct sk_buff *buf; struct media *m_ptr; struct bearer *b_ptr; struct tipc_bearer *b_ptr; int i, j; buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); Loading @@ -331,8 +331,8 @@ struct sk_buff *tipc_bearer_get_names(void) 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, strlen(b_ptr->publ.name) + 1); b_ptr->name, strlen(b_ptr->name) + 1); } } } Loading @@ -340,14 +340,14 @@ struct sk_buff *tipc_bearer_get_names(void) return buf; } void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest) void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest) { tipc_nmap_add(&b_ptr->nodes, dest); tipc_disc_update_link_req(b_ptr->link_req); tipc_bcbearer_sort(); } void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest) void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest) { tipc_nmap_remove(&b_ptr->nodes, dest); tipc_disc_update_link_req(b_ptr->link_req); Loading @@ -362,12 +362,12 @@ void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest) * bearer.lock must be taken before calling * Returns binary true(1) ore false(0) */ static int bearer_push(struct bearer *b_ptr) static int bearer_push(struct tipc_bearer *b_ptr) { u32 res = 0; struct link *ln, *tln; if (b_ptr->publ.blocked) if (b_ptr->blocked) return 0; while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { Loading @@ -382,13 +382,13 @@ static int bearer_push(struct bearer *b_ptr) return list_empty(&b_ptr->cong_links); } void tipc_bearer_lock_push(struct bearer *b_ptr) void tipc_bearer_lock_push(struct tipc_bearer *b_ptr) { int res; spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); res = bearer_push(b_ptr); spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); if (res) tipc_bcbearer_push(); } Loading @@ -398,16 +398,14 @@ void tipc_bearer_lock_push(struct bearer *b_ptr) * Interrupt enabling new requests after bearer congestion or blocking: * See bearer_send(). */ void tipc_continue(struct tipc_bearer *tb_ptr) void tipc_continue(struct tipc_bearer *b_ptr) { struct bearer *b_ptr = (struct bearer *)tb_ptr; spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); b_ptr->continue_count++; if (!list_empty(&b_ptr->cong_links)) tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr); b_ptr->publ.blocked = 0; spin_unlock_bh(&b_ptr->publ.lock); b_ptr->blocked = 0; spin_unlock_bh(&b_ptr->lock); } /* Loading @@ -418,7 +416,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr) * bearer.lock is busy */ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_ptr) static void tipc_bearer_schedule_unlocked(struct tipc_bearer *b_ptr, struct link *l_ptr) { list_move_tail(&l_ptr->link_list, &b_ptr->cong_links); } Loading @@ -431,11 +429,11 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p * bearer.lock is free */ void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct link *l_ptr) { spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); tipc_bearer_schedule_unlocked(b_ptr, l_ptr); spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); } Loading @@ -444,18 +442,18 @@ void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) * and if there is, try to resolve it before returning. * 'tipc_net_lock' is read_locked when this function is called */ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) int tipc_bearer_resolve_congestion(struct tipc_bearer *b_ptr, struct link *l_ptr) { int res = 1; if (list_empty(&b_ptr->cong_links)) return 1; spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); if (!bearer_push(b_ptr)) { tipc_bearer_schedule_unlocked(b_ptr, l_ptr); res = 0; } spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); return res; } Loading @@ -463,9 +461,9 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) * tipc_bearer_congested - determines if bearer is currently congested */ int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr) int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr) { if (unlikely(b_ptr->publ.blocked)) if (unlikely(b_ptr->blocked)) return 1; if (likely(list_empty(&b_ptr->cong_links))) return 0; Loading @@ -478,7 +476,7 @@ int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr) int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; struct media *m_ptr; struct bearer_name b_name; char addr_string[16]; Loading Loading @@ -528,7 +526,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) bearer_id = i; continue; } if (!strcmp(name, tipc_bearers[i].publ.name)) { if (!strcmp(name, tipc_bearers[i].name)) { warn("Bearer <%s> rejected, already enabled\n", name); goto failed; } Loading @@ -551,8 +549,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) } b_ptr = &tipc_bearers[bearer_id]; strcpy(b_ptr->publ.name, name); res = m_ptr->enable_bearer(&b_ptr->publ); strcpy(b_ptr->name, name); res = m_ptr->enable_bearer(b_ptr); if (res) { warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); goto failed; Loading @@ -568,9 +566,9 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) INIT_LIST_HEAD(&b_ptr->links); if (m_ptr->bcast) { b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr, bcast_scope, 2); bcast_scope); } spin_lock_init(&b_ptr->publ.lock); spin_lock_init(&b_ptr->lock); write_unlock_bh(&tipc_net_lock); info("Enabled bearer <%s>, discovery domain %s, priority %u\n", name, tipc_addr_string_fill(addr_string, bcast_scope), priority); Loading @@ -587,7 +585,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) int tipc_block_bearer(const char *name) { struct bearer *b_ptr = NULL; struct tipc_bearer *b_ptr = NULL; struct link *l_ptr; struct link *temp_l_ptr; Loading @@ -600,8 +598,8 @@ int tipc_block_bearer(const char *name) } info("Blocking bearer <%s>\n", name); spin_lock_bh(&b_ptr->publ.lock); b_ptr->publ.blocked = 1; spin_lock_bh(&b_ptr->lock); b_ptr->blocked = 1; list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { struct tipc_node *n_ptr = l_ptr->owner; Loading @@ -609,7 +607,7 @@ int tipc_block_bearer(const char *name) tipc_link_reset(l_ptr); spin_unlock_bh(&n_ptr->lock); } spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock); read_unlock_bh(&tipc_net_lock); return 0; } Loading @@ -620,27 +618,27 @@ int tipc_block_bearer(const char *name) * Note: This routine assumes caller holds tipc_net_lock. */ static void bearer_disable(struct bearer *b_ptr) static void bearer_disable(struct tipc_bearer *b_ptr) { struct link *l_ptr; struct link *temp_l_ptr; info("Disabling bearer <%s>\n", b_ptr->publ.name); info("Disabling bearer <%s>\n", b_ptr->name); tipc_disc_stop_link_req(b_ptr->link_req); spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock); b_ptr->link_req = NULL; b_ptr->publ.blocked = 1; b_ptr->media->disable_bearer(&b_ptr->publ); b_ptr->blocked = 1; b_ptr->media->disable_bearer(b_ptr); list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { tipc_link_delete(l_ptr); } spin_unlock_bh(&b_ptr->publ.lock); memset(b_ptr, 0, sizeof(struct bearer)); spin_unlock_bh(&b_ptr->lock); memset(b_ptr, 0, sizeof(struct tipc_bearer)); } int tipc_disable_bearer(const char *name) { struct bearer *b_ptr; struct tipc_bearer *b_ptr; int res; write_lock_bh(&tipc_net_lock); Loading