Commit 55ae22d0 authored by David S. Miller's avatar David S. Miller
parents d12b0d9a bf781ecf
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* include/linux/tipc.h: Include file for TIPC socket interface * include/linux/tipc.h: Include file for TIPC socket interface
* *
* Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2003-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr) ...@@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr)
#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ #define TIPC_SUB_PORTS 0x01 /* filter for port availability */
#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ #define TIPC_SUB_SERVICE 0x02 /* filter for service availability */
#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ #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 */ #define TIPC_WAIT_FOREVER (~0) /* timeout for permanent subscription */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* include/linux/tipc_config.h: Include file for TIPC configuration interface * include/linux/tipc_config.h: Include file for TIPC configuration interface
* *
* Copyright (c) 2003-2006, Ericsson AB * 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. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -76,13 +76,6 @@ ...@@ -76,13 +76,6 @@
#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ #define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, 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: * Protected commands:
* May only be issued by "network administration capable" process. * May only be issued by "network administration capable" process.
...@@ -109,13 +102,6 @@ ...@@ -109,13 +102,6 @@
#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ #define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ #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: * Private commands:
* May only be issued by "network administration capable" process. * May only be issued by "network administration capable" process.
...@@ -123,9 +109,6 @@ ...@@ -123,9 +109,6 @@
*/ */
#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ #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_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* 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 */ #define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
...@@ -193,6 +176,10 @@ ...@@ -193,6 +176,10 @@
#define TIPC_DEF_LINK_TOL 1500 #define TIPC_DEF_LINK_TOL 1500
#define TIPC_MAX_LINK_TOL 30000 #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 * Link window limits (min, default, max), in packets
*/ */
...@@ -247,15 +234,6 @@ struct tipc_name_table_query { ...@@ -247,15 +234,6 @@ struct tipc_name_table_query {
#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ #define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ #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. * A TLV consists of a descriptor, followed by the TLV value.
* TLV descriptor fields are stored in network byte order; * TLV descriptor fields are stored in network byte order;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (c) 2004-2006, Ericsson AB * Copyright (c) 2004-2006, Ericsson AB
* Copyright (c) 2004, Intel Corporation. * Copyright (c) 2004, Intel Corporation.
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -61,8 +61,8 @@ ...@@ -61,8 +61,8 @@
*/ */
struct bcbearer_pair { struct bcbearer_pair {
struct bearer *primary; struct tipc_bearer *primary;
struct bearer *secondary; struct tipc_bearer *secondary;
}; };
/** /**
...@@ -81,7 +81,7 @@ struct bcbearer_pair { ...@@ -81,7 +81,7 @@ struct bcbearer_pair {
*/ */
struct bcbearer { struct bcbearer {
struct bearer bearer; struct tipc_bearer bearer;
struct media media; struct media media;
struct bcbearer_pair bpairs[MAX_BEARERS]; struct bcbearer_pair bpairs[MAX_BEARERS];
struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1]; struct bcbearer_pair bpairs_temp[TIPC_MAX_LINK_PRI + 1];
...@@ -93,6 +93,7 @@ struct bcbearer { ...@@ -93,6 +93,7 @@ struct bcbearer {
* struct bclink - link used for broadcast messages * struct bclink - link used for broadcast messages
* @link: (non-standard) broadcast link structure * @link: (non-standard) broadcast link structure
* @node: (non-standard) node structure representing b'cast link's peer node * @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. * Handles sequence numbering, fragmentation, bundling, etc.
*/ */
...@@ -100,6 +101,7 @@ struct bcbearer { ...@@ -100,6 +101,7 @@ struct bcbearer {
struct bclink { struct bclink {
struct link link; struct link link;
struct tipc_node node; struct tipc_node node;
struct tipc_node *retransmit_to;
}; };
...@@ -183,6 +185,17 @@ static int bclink_ack_allowed(u32 n) ...@@ -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 * bclink_retransmit_pkt - retransmit broadcast packets
* @after: sequence number of last packet to *not* retransmit * @after: sequence number of last packet to *not* retransmit
...@@ -285,6 +298,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr) ...@@ -285,6 +298,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr)
msg = buf_msg(buf); msg = buf_msg(buf);
tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
INT_H_SIZE, n_ptr->addr); INT_H_SIZE, n_ptr->addr);
msg_set_non_seq(msg, 1);
msg_set_mc_netid(msg, tipc_net_id); 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_after(msg, n_ptr->bclink.gap_after);
...@@ -405,8 +419,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf) ...@@ -405,8 +419,6 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
else else
bclink_set_last_sent(); 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.queue_sz_counts++;
bcl->stats.accu_queue_sz += bcl->out_queue_size; bcl->stats.accu_queue_sz += bcl->out_queue_size;
...@@ -444,10 +456,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) ...@@ -444,10 +456,9 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
tipc_node_unlock(node); tipc_node_unlock(node);
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
bcl->stats.recv_nacks++; bcl->stats.recv_nacks++;
bcl->owner->next = node; /* remember requestor */ bclink->retransmit_to = node;
bclink_retransmit_pkt(msg_bcgap_after(msg), bclink_retransmit_pkt(msg_bcgap_after(msg),
msg_bcgap_to(msg)); msg_bcgap_to(msg));
bcl->owner->next = NULL;
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
} else { } else {
tipc_bclink_peek_nack(msg_destnode(msg), tipc_bclink_peek_nack(msg_destnode(msg),
...@@ -574,8 +585,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, ...@@ -574,8 +585,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
bcbearer->remains = tipc_bcast_nmap; bcbearer->remains = tipc_bcast_nmap;
for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) { for (bp_index = 0; bp_index < MAX_BEARERS; bp_index++) {
struct bearer *p = bcbearer->bpairs[bp_index].primary; struct tipc_bearer *p = bcbearer->bpairs[bp_index].primary;
struct bearer *s = bcbearer->bpairs[bp_index].secondary; struct tipc_bearer *s = bcbearer->bpairs[bp_index].secondary;
if (!p) if (!p)
break; /* no more bearers to try */ break; /* no more bearers to try */
...@@ -584,11 +595,11 @@ static int tipc_bcbearer_send(struct sk_buff *buf, ...@@ -584,11 +595,11 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
if (bcbearer->remains_new.count == bcbearer->remains.count) if (bcbearer->remains_new.count == bcbearer->remains.count)
continue; /* bearer pair doesn't add anything */ continue; /* bearer pair doesn't add anything */
if (p->publ.blocked || if (p->blocked ||
p->media->send_msg(buf, &p->publ, &p->media->bcast_addr)) { p->media->send_msg(buf, p, &p->media->bcast_addr)) {
/* unable to send on primary bearer */ /* unable to send on primary bearer */
if (!s || s->publ.blocked || if (!s || s->blocked ||
s->media->send_msg(buf, &s->publ, s->media->send_msg(buf, s,
&s->media->bcast_addr)) { &s->media->bcast_addr)) {
/* unable to send on either bearer */ /* unable to send on either bearer */
continue; continue;
...@@ -633,7 +644,7 @@ void tipc_bcbearer_sort(void) ...@@ -633,7 +644,7 @@ void tipc_bcbearer_sort(void)
memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp)); memset(bp_temp, 0, sizeof(bcbearer->bpairs_temp));
for (b_index = 0; b_index < MAX_BEARERS; b_index++) { for (b_index = 0; b_index < MAX_BEARERS; b_index++) {
struct bearer *b = &tipc_bearers[b_index]; struct tipc_bearer *b = &tipc_bearers[b_index];
if (!b->active || !b->nodes.count) if (!b->active || !b->nodes.count)
continue; continue;
...@@ -682,12 +693,12 @@ void tipc_bcbearer_sort(void) ...@@ -682,12 +693,12 @@ void tipc_bcbearer_sort(void)
void tipc_bcbearer_push(void) void tipc_bcbearer_push(void)
{ {
struct bearer *b_ptr; struct tipc_bearer *b_ptr;
spin_lock_bh(&bc_lock); spin_lock_bh(&bc_lock);
b_ptr = &bcbearer->bearer; b_ptr = &bcbearer->bearer;
if (b_ptr->publ.blocked) { if (b_ptr->blocked) {
b_ptr->publ.blocked = 0; b_ptr->blocked = 0;
tipc_bearer_lock_push(b_ptr); tipc_bearer_lock_push(b_ptr);
} }
spin_unlock_bh(&bc_lock); spin_unlock_bh(&bc_lock);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/bcast.h: Include file for TIPC broadcast code * net/tipc/bcast.h: Include file for TIPC broadcast code
* *
* Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2003-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -90,6 +90,7 @@ void tipc_port_list_free(struct port_list *pl_ptr); ...@@ -90,6 +90,7 @@ void tipc_port_list_free(struct port_list *pl_ptr);
int tipc_bclink_init(void); int tipc_bclink_init(void);
void tipc_bclink_stop(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); void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked);
int tipc_bclink_send_msg(struct sk_buff *buf); int tipc_bclink_send_msg(struct sk_buff *buf);
void tipc_bclink_recv_pkt(struct sk_buff *buf); void tipc_bclink_recv_pkt(struct sk_buff *buf);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/bearer.c: TIPC bearer code * net/tipc/bearer.c: TIPC bearer code
* *
* Copyright (c) 1996-2006, Ericsson AB * 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. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
static struct media media_list[MAX_MEDIA]; static struct media media_list[MAX_MEDIA];
static u32 media_count; static u32 media_count;
struct bearer tipc_bearers[MAX_BEARERS]; struct tipc_bearer tipc_bearers[MAX_BEARERS];
/** /**
* media_name_valid - validate media name * media_name_valid - validate media name
...@@ -278,13 +278,13 @@ static int bearer_name_validate(const char *name, ...@@ -278,13 +278,13 @@ static int bearer_name_validate(const char *name,
* bearer_find - locates bearer object with matching bearer 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; u32 i;
for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) if (b_ptr->active && (!strcmp(b_ptr->name, name)))
return b_ptr; return b_ptr;
} }
return NULL; return NULL;
...@@ -294,16 +294,16 @@ static struct bearer *bearer_find(const char *name) ...@@ -294,16 +294,16 @@ static struct bearer *bearer_find(const char *name)
* tipc_bearer_find_interface - locates bearer object with matching interface 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; char *b_if_name;
u32 i; u32 i;
for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (!b_ptr->active) if (!b_ptr->active)
continue; continue;
b_if_name = strchr(b_ptr->publ.name, ':') + 1; b_if_name = strchr(b_ptr->name, ':') + 1;
if (!strcmp(b_if_name, if_name)) if (!strcmp(b_if_name, if_name))
return b_ptr; return b_ptr;
} }
...@@ -318,7 +318,7 @@ struct sk_buff *tipc_bearer_get_names(void) ...@@ -318,7 +318,7 @@ struct sk_buff *tipc_bearer_get_names(void)
{ {
struct sk_buff *buf; struct sk_buff *buf;
struct media *m_ptr; struct media *m_ptr;
struct bearer *b_ptr; struct tipc_bearer *b_ptr;
int i, j; int i, j;
buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME)); buf = tipc_cfg_reply_alloc(MAX_BEARERS * TLV_SPACE(TIPC_MAX_BEARER_NAME));
...@@ -331,8 +331,8 @@ struct sk_buff *tipc_bearer_get_names(void) ...@@ -331,8 +331,8 @@ struct sk_buff *tipc_bearer_get_names(void)
b_ptr = &tipc_bearers[j]; b_ptr = &tipc_bearers[j];
if (b_ptr->active && (b_ptr->media == m_ptr)) { if (b_ptr->active && (b_ptr->media == m_ptr)) {
tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME, tipc_cfg_append_tlv(buf, TIPC_TLV_BEARER_NAME,
b_ptr->publ.name, b_ptr->name,
strlen(b_ptr->publ.name) + 1); strlen(b_ptr->name) + 1);
} }
} }
} }
...@@ -340,14 +340,14 @@ struct sk_buff *tipc_bearer_get_names(void) ...@@ -340,14 +340,14 @@ struct sk_buff *tipc_bearer_get_names(void)
return buf; 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_nmap_add(&b_ptr->nodes, dest);
tipc_disc_update_link_req(b_ptr->link_req); tipc_disc_update_link_req(b_ptr->link_req);
tipc_bcbearer_sort(); 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_nmap_remove(&b_ptr->nodes, dest);
tipc_disc_update_link_req(b_ptr->link_req); tipc_disc_update_link_req(b_ptr->link_req);
...@@ -362,12 +362,12 @@ void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest) ...@@ -362,12 +362,12 @@ void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest)
* bearer.lock must be taken before calling * bearer.lock must be taken before calling
* Returns binary true(1) ore false(0) * Returns binary true(1) ore false(0)
*/ */
static int bearer_push(struct bearer *b_ptr) static int bearer_push(struct tipc_bearer *b_ptr)
{ {
u32 res = 0; u32 res = 0;
struct link *ln, *tln; struct link *ln, *tln;
if (b_ptr->publ.blocked) if (b_ptr->blocked)
return 0; return 0;
while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) { while (!list_empty(&b_ptr->cong_links) && (res != PUSH_FAILED)) {
...@@ -382,13 +382,13 @@ static int bearer_push(struct bearer *b_ptr) ...@@ -382,13 +382,13 @@ static int bearer_push(struct bearer *b_ptr)
return list_empty(&b_ptr->cong_links); 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; int res;
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock);
res = bearer_push(b_ptr); res = bearer_push(b_ptr);
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock);
if (res) if (res)
tipc_bcbearer_push(); tipc_bcbearer_push();
} }
...@@ -398,16 +398,14 @@ void tipc_bearer_lock_push(struct bearer *b_ptr) ...@@ -398,16 +398,14 @@ void tipc_bearer_lock_push(struct bearer *b_ptr)
* Interrupt enabling new requests after bearer congestion or blocking: * Interrupt enabling new requests after bearer congestion or blocking:
* See bearer_send(). * 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->lock);
spin_lock_bh(&b_ptr->publ.lock);
b_ptr->continue_count++; b_ptr->continue_count++;
if (!list_empty(&b_ptr->cong_links)) if (!list_empty(&b_ptr->cong_links))
tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr); tipc_k_signal((Handler)tipc_bearer_lock_push, (unsigned long)b_ptr);
b_ptr->publ.blocked = 0; b_ptr->blocked = 0;
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock);
} }
/* /*
...@@ -418,7 +416,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr) ...@@ -418,7 +416,7 @@ void tipc_continue(struct tipc_bearer *tb_ptr)
* bearer.lock is busy * 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); list_move_tail(&l_ptr->link_list, &b_ptr->cong_links);
} }
...@@ -431,11 +429,11 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p ...@@ -431,11 +429,11 @@ static void tipc_bearer_schedule_unlocked(struct bearer *b_ptr, struct link *l_p
* bearer.lock is free * 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); tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock);
} }
...@@ -444,18 +442,18 @@ void tipc_bearer_schedule(struct bearer *b_ptr, struct link *l_ptr) ...@@ -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. * and if there is, try to resolve it before returning.
* 'tipc_net_lock' is read_locked when this function is called * '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; int res = 1;
if (list_empty(&b_ptr->cong_links)) if (list_empty(&b_ptr->cong_links))
return 1; return 1;
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock);
if (!bearer_push(b_ptr)) { if (!bearer_push(b_ptr)) {
tipc_bearer_schedule_unlocked(b_ptr, l_ptr); tipc_bearer_schedule_unlocked(b_ptr, l_ptr);
res = 0; res = 0;
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock);
return res; return res;
} }
...@@ -463,9 +461,9 @@ int tipc_bearer_resolve_congestion(struct bearer *b_ptr, struct link *l_ptr) ...@@ -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 * 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; return 1;
if (likely(list_empty(&b_ptr->cong_links))) if (likely(list_empty(&b_ptr->cong_links)))
return 0; return 0;
...@@ -478,7 +476,7 @@ int tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr) ...@@ -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) 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 media *m_ptr;
struct bearer_name b_name; struct bearer_name b_name;
char addr_string[16]; char addr_string[16];
...@@ -528,7 +526,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -528,7 +526,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
bearer_id = i; bearer_id = i;
continue; continue;
} }
if (!strcmp(name, tipc_bearers[i].publ.name)) { if (!strcmp(name, tipc_bearers[i].name)) {
warn("Bearer <%s> rejected, already enabled\n", name); warn("Bearer <%s> rejected, already enabled\n", name);
goto failed; goto failed;
} }
...@@ -551,8 +549,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -551,8 +549,8 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
} }
b_ptr = &tipc_bearers[bearer_id]; b_ptr = &tipc_bearers[bearer_id];
strcpy(b_ptr->publ.name, name); strcpy(b_ptr->name, name);
res = m_ptr->enable_bearer(&b_ptr->publ); res = m_ptr->enable_bearer(b_ptr);
if (res) { if (res) {
warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res);
goto failed; goto failed;
...@@ -568,9 +566,9 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -568,9 +566,9 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
INIT_LIST_HEAD(&b_ptr->links); INIT_LIST_HEAD(&b_ptr->links);
if (m_ptr->bcast) { if (m_ptr->bcast) {
b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr, b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr,
bcast_scope, 2); bcast_scope);
} }
spin_lock_init(&b_ptr->publ.lock); spin_lock_init(&b_ptr->lock);
write_unlock_bh(&tipc_net_lock); write_unlock_bh(&tipc_net_lock);
info("Enabled bearer <%s>, discovery domain %s, priority %u\n", info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
name, tipc_addr_string_fill(addr_string, bcast_scope), priority); name, tipc_addr_string_fill(addr_string, bcast_scope), priority);
...@@ -587,7 +585,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -587,7 +585,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
int tipc_block_bearer(const char *name) int tipc_block_bearer(const char *name)
{ {
struct bearer *b_ptr = NULL; struct tipc_bearer *b_ptr = NULL;
struct link *l_ptr; struct link *l_ptr;
struct link *temp_l_ptr; struct link *temp_l_ptr;
...@@ -600,8 +598,8 @@ int tipc_block_bearer(const char *name) ...@@ -600,8 +598,8 @@ int tipc_block_bearer(const char *name)
} }
info("Blocking bearer <%s>\n", name); info("Blocking bearer <%s>\n", name);
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->lock);
b_ptr->publ.blocked = 1; b_ptr->blocked = 1;
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
struct tipc_node *n_ptr = l_ptr->owner; struct tipc_node *n_ptr = l_ptr->owner;
...@@ -609,7 +607,7 @@ int tipc_block_bearer(const char *name) ...@@ -609,7 +607,7 @@ int tipc_block_bearer(const char *name)
tipc_link_reset(l_ptr); tipc_link_reset(l_ptr);
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock);
read_unlock_bh(&tipc_net_lock); read_unlock_bh(&tipc_net_lock);
return 0; return 0;
} }
...@@ -620,27 +618,27 @@ int tipc_block_bearer(const char *name) ...@@ -620,27 +618,27 @@ int tipc_block_bearer(const char *name)
* Note: This routine assumes caller holds tipc_net_lock. * 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 *l_ptr;
struct link *temp_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); 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->link_req = NULL;
b_ptr->publ.blocked = 1; b_ptr->blocked = 1;
b_ptr->media->disable_bearer(&b_ptr->publ); b_ptr->media->disable_bearer(b_ptr);
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
tipc_link_delete(l_ptr); tipc_link_delete(l_ptr);
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->lock);
memset(b_ptr, 0, sizeof(struct bearer)); memset(b_ptr, 0, sizeof(struct tipc_bearer));
} }
int tipc_disable_bearer(const char *name) int tipc_disable_bearer(const char *name)
{ {
struct bearer *b_ptr; struct tipc_bearer *b_ptr;
int res; int res;
write_lock_bh(&tipc_net_lock); write_lock_bh(&tipc_net_lock);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/bearer.h: Include file for TIPC bearer code * net/tipc/bearer.h: Include file for TIPC bearer code
* *
* Copyright (c) 1996-2006, Ericsson AB * Copyright (c) 1996-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -61,26 +61,7 @@ struct tipc_media_addr { ...@@ -61,26 +61,7 @@ struct tipc_media_addr {
} dev_addr; } dev_addr;
}; };
/** struct tipc_bearer;
* struct tipc_bearer - TIPC bearer info available to media code
* @usr_handle: pointer to additional media-specific information about bearer
* @mtu: max packet size bearer can support
* @blocked: non-zero if bearer is blocked
* @lock: spinlock for controlling access to bearer
* @addr: media-specific address associated with bearer
* @name: bearer name (format = media:interface)
*
* Note: TIPC initializes "name" and "lock" fields; media code is responsible
* for initialization all other fields when a bearer is enabled.
*/
struct tipc_bearer {
void *usr_handle;
u32 mtu;
int blocked;
spinlock_t lock;
struct tipc_media_addr addr;
char name[TIPC_MAX_BEARER_NAME];
};
/** /**
* struct media - TIPC media information available to internal users * struct media - TIPC media information available to internal users
...@@ -115,8 +96,13 @@ struct media { ...@@ -115,8 +96,13 @@ struct media {
}; };
/** /**
* struct bearer - TIPC bearer information available to internal users * struct tipc_bearer - TIPC bearer structure
* @publ: bearer information available to privileged users * @usr_handle: pointer to additional media-specific information about bearer
* @mtu: max packet size bearer can support
* @blocked: non-zero if bearer is blocked
* @lock: spinlock for controlling access to bearer
* @addr: media-specific address associated with bearer
* @name: bearer name (format = media:interface)
* @media: ptr to media structure associated with bearer * @media: ptr to media structure associated with bearer
* @priority: default link priority for bearer * @priority: default link priority for bearer
* @detect_scope: network address mask used during automatic link creation * @detect_scope: network address mask used during automatic link creation
...@@ -128,10 +114,18 @@ struct media { ...@@ -128,10 +114,18 @@ struct media {
* @active: non-zero if bearer structure is represents a bearer * @active: non-zero if bearer structure is represents a bearer
* @net_plane: network plane ('A' through 'H') currently associated with bearer * @net_plane: network plane ('A' through 'H') currently associated with bearer
* @nodes: indicates which nodes in cluster can be reached through bearer * @nodes: indicates which nodes in cluster can be reached through bearer
*
* Note: media-specific code is responsible for initialization of the fields
* indicated below when a bearer is enabled; TIPC's generic bearer code takes
* care of initializing all other fields.
*/ */
struct tipc_bearer {
struct bearer { void *usr_handle; /* initalized by media */
struct tipc_bearer publ; u32 mtu; /* initalized by media */
int blocked; /* initalized by media */
struct tipc_media_addr addr; /* initalized by media */
char name[TIPC_MAX_BEARER_NAME];
spinlock_t lock;
struct media *media; struct media *media;
u32 priority; u32 priority;
u32 detect_scope; u32 detect_scope;
...@@ -152,7 +146,7 @@ struct bearer_name { ...@@ -152,7 +146,7 @@ struct bearer_name {
struct link; struct link;
extern struct bearer tipc_bearers[]; extern struct tipc_bearer tipc_bearers[];
/* /*
* TIPC routines available to supported media types * TIPC routines available to supported media types
...@@ -186,14 +180,14 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a); ...@@ -186,14 +180,14 @@ void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
struct sk_buff *tipc_media_get_names(void); struct sk_buff *tipc_media_get_names(void);
struct sk_buff *tipc_bearer_get_names(void); struct sk_buff *tipc_bearer_get_names(void);
void tipc_bearer_add_dest(struct bearer *b_ptr, u32 dest); void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest);
void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest); void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest);
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);
struct bearer *tipc_bearer_find_interface(const char *if_name); struct tipc_bearer *tipc_bearer_find_interface(const char *if_name);
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 tipc_bearer_congested(struct bearer *b_ptr, struct link *l_ptr); int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr);
void tipc_bearer_stop(void); void tipc_bearer_stop(void);
void tipc_bearer_lock_push(struct bearer *b_ptr); void tipc_bearer_lock_push(struct tipc_bearer *b_ptr);
/** /**
...@@ -214,10 +208,11 @@ void tipc_bearer_lock_push(struct bearer *b_ptr); ...@@ -214,10 +208,11 @@ void tipc_bearer_lock_push(struct bearer *b_ptr);
* and let TIPC's link code deal with the undelivered message. * and let TIPC's link code deal with the undelivered message.
*/ */
static inline int tipc_bearer_send(struct bearer *b_ptr, struct sk_buff *buf, static inline int tipc_bearer_send(struct tipc_bearer *b_ptr,
struct sk_buff *buf,
struct tipc_media_addr *dest) struct tipc_media_addr *dest)
{ {
return !b_ptr->media->send_msg(buf, &b_ptr->publ, dest); return !b_ptr->media->send_msg(buf, b_ptr, dest);
} }
#endif /* _TIPC_BEARER_H */ #endif /* _TIPC_BEARER_H */
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/core.c: TIPC module code * net/tipc/core.c: TIPC module code
* *
* Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2003-2006, Ericsson AB
* Copyright (c) 2005-2006, Wind River Systems * Copyright (c) 2005-2006, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
int tipc_mode = TIPC_NOT_RUNNING; int tipc_mode = TIPC_NOT_RUNNING;
int tipc_random; int tipc_random;
atomic_t tipc_user_count = ATOMIC_INIT(0);
const char tipc_alphabet[] = const char tipc_alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_."; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.";
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/core.h: Include file for TIPC global declarations * net/tipc/core.h: Include file for TIPC global declarations
* *
* Copyright (c) 2005-2006, Ericsson AB * Copyright (c) 2005-2006, Ericsson AB
* Copyright (c) 2005-2007, Wind River Systems * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -161,7 +161,6 @@ extern int tipc_remote_management; ...@@ -161,7 +161,6 @@ extern int tipc_remote_management;
extern int tipc_mode; extern int tipc_mode;
extern int tipc_random; extern int tipc_random;
extern const char tipc_alphabet[]; extern const char tipc_alphabet[];
extern atomic_t tipc_user_count;
/* /*
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/discover.c * net/tipc/discover.c
* *
* Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2003-2006, Ericsson AB
* Copyright (c) 2005-2006, Wind River Systems * Copyright (c) 2005-2006, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
* @timer_intv: current interval between requests (in ms) * @timer_intv: current interval between requests (in ms)
*/ */
struct link_req { struct link_req {
struct bearer *bearer; struct tipc_bearer *bearer;
struct tipc_media_addr dest; struct tipc_media_addr dest;
struct sk_buff *buf; struct sk_buff *buf;
struct timer_list timer; struct timer_list timer;
...@@ -67,15 +67,13 @@ struct link_req { ...@@ -67,15 +67,13 @@ struct link_req {
/** /**
* tipc_disc_init_msg - initialize a link setup message * tipc_disc_init_msg - initialize a link setup message
* @type: message type (request or response) * @type: message type (request or response)
* @req_links: number of links associated with message
* @dest_domain: network domain of node(s) which should respond to message * @dest_domain: network domain of node(s) which should respond to message
* @b_ptr: ptr to bearer issuing message * @b_ptr: ptr to bearer issuing message
*/ */
static struct sk_buff *tipc_disc_init_msg(u32 type, static struct sk_buff *tipc_disc_init_msg(u32 type,
u32 req_links,
u32 dest_domain, u32 dest_domain,
struct bearer *b_ptr) struct tipc_bearer *b_ptr)
{ {
struct sk_buff *buf = tipc_buf_acquire(DSC_H_SIZE); struct sk_buff *buf = tipc_buf_acquire(DSC_H_SIZE);
struct tipc_msg *msg; struct tipc_msg *msg;
...@@ -84,10 +82,9 @@ static struct sk_buff *tipc_disc_init_msg(u32 type, ...@@ -84,10 +82,9 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
msg = buf_msg(buf); msg = buf_msg(buf);
tipc_msg_init(msg, LINK_CONFIG, type, DSC_H_SIZE, dest_domain); tipc_msg_init(msg, LINK_CONFIG, type, DSC_H_SIZE, dest_domain);
msg_set_non_seq(msg, 1); msg_set_non_seq(msg, 1);
msg_set_req_links(msg, req_links);
msg_set_dest_domain(msg, dest_domain); msg_set_dest_domain(msg, dest_domain);
msg_set_bc_netid(msg, tipc_net_id); msg_set_bc_netid(msg, tipc_net_id);
msg_set_media_addr(msg, &b_ptr->publ.addr); msg_set_media_addr(msg, &b_ptr->addr);
} }
return buf; return buf;
} }
...@@ -99,7 +96,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type, ...@@ -99,7 +96,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
* @media_addr: media address advertised by duplicated node * @media_addr: media address advertised by duplicated node
*/ */
static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr, static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
struct tipc_media_addr *media_addr) struct tipc_media_addr *media_addr)
{ {
char node_addr_str[16]; char node_addr_str[16];
...@@ -111,7 +108,7 @@ static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr, ...@@ -111,7 +108,7 @@ static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr,
tipc_media_addr_printf(&pb, media_addr); tipc_media_addr_printf(&pb, media_addr);
tipc_printbuf_validate(&pb); tipc_printbuf_validate(&pb);
warn("Duplicate %s using %s seen on <%s>\n", warn("Duplicate %s using %s seen on <%s>\n",
node_addr_str, media_addr_str, b_ptr->publ.name); node_addr_str, media_addr_str, b_ptr->name);
} }
/** /**
...@@ -120,7 +117,7 @@ static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr, ...@@ -120,7 +117,7 @@ static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr,
* @b_ptr: bearer that message arrived on * @b_ptr: bearer that message arrived on
*/ */
void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr) void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
{ {
struct link *link; struct link *link;
struct tipc_media_addr media_addr; struct tipc_media_addr media_addr;
...@@ -140,7 +137,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr) ...@@ -140,7 +137,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr)
if (!tipc_addr_node_valid(orig)) if (!tipc_addr_node_valid(orig))
return; return;
if (orig == tipc_own_addr) { if (orig == tipc_own_addr) {
if (memcmp(&media_addr, &b_ptr->publ.addr, sizeof(media_addr))) if (memcmp(&media_addr, &b_ptr->addr, sizeof(media_addr)))
disc_dupl_alert(b_ptr, tipc_own_addr, &media_addr); disc_dupl_alert(b_ptr, tipc_own_addr, &media_addr);
return; return;
} }
...@@ -191,9 +188,9 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr) ...@@ -191,9 +188,9 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr)
spin_unlock_bh(&n_ptr->lock); spin_unlock_bh(&n_ptr->lock);
if ((type == DSC_RESP_MSG) || link_fully_up) if ((type == DSC_RESP_MSG) || link_fully_up)
return; return;
rbuf = tipc_disc_init_msg(DSC_RESP_MSG, 1, orig, b_ptr); rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr);
if (rbuf != NULL) { if (rbuf != NULL) {
b_ptr->media->send_msg(rbuf, &b_ptr->publ, &media_addr); b_ptr->media->send_msg(rbuf, b_ptr, &media_addr);
buf_discard(rbuf); buf_discard(rbuf);
} }
} }
...@@ -249,9 +246,9 @@ void tipc_disc_update_link_req(struct link_req *req) ...@@ -249,9 +246,9 @@ void tipc_disc_update_link_req(struct link_req *req)
static void disc_timeout(struct link_req *req) static void disc_timeout(struct link_req *req)
{ {
spin_lock_bh(&req->bearer->publ.lock); spin_lock_bh(&req->bearer->lock);
req->bearer->media->send_msg(req->buf, &req->bearer->publ, &req->dest); req->bearer->media->send_msg(req->buf, req->bearer, &req->dest);
if ((req->timer_intv == TIPC_LINK_REQ_SLOW) || if ((req->timer_intv == TIPC_LINK_REQ_SLOW) ||
(req->timer_intv == TIPC_LINK_REQ_FAST)) { (req->timer_intv == TIPC_LINK_REQ_FAST)) {
...@@ -266,7 +263,7 @@ static void disc_timeout(struct link_req *req) ...@@ -266,7 +263,7 @@ static void disc_timeout(struct link_req *req)
} }
k_start_timer(&req->timer, req->timer_intv); k_start_timer(&req->timer, req->timer_intv);
spin_unlock_bh(&req->bearer->publ.lock); spin_unlock_bh(&req->bearer->lock);
} }
/** /**
...@@ -274,15 +271,13 @@ static void disc_timeout(struct link_req *req) ...@@ -274,15 +271,13 @@ static void disc_timeout(struct link_req *req)
* @b_ptr: ptr to bearer issuing requests * @b_ptr: ptr to bearer issuing requests
* @dest: destination address for request messages * @dest: destination address for request messages
* @dest_domain: network domain of node(s) which should respond to message * @dest_domain: network domain of node(s) which should respond to message
* @req_links: max number of desired links
* *
* Returns pointer to link request structure, or NULL if unable to create. * Returns pointer to link request structure, or NULL if unable to create.
*/ */
struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
const struct tipc_media_addr *dest, const struct tipc_media_addr *dest,
u32 dest_domain, u32 dest_domain)
u32 req_links)
{ {
struct link_req *req; struct link_req *req;
...@@ -290,7 +285,7 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, ...@@ -290,7 +285,7 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
if (!req) if (!req)
return NULL; return NULL;
req->buf = tipc_disc_init_msg(DSC_REQ_MSG, req_links, dest_domain, b_ptr); req->buf = tipc_disc_init_msg(DSC_REQ_MSG, dest_domain, b_ptr);
if (!req->buf) { if (!req->buf) {
kfree(req); kfree(req);
return NULL; return NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/discover.h * net/tipc/discover.h
* *
* Copyright (c) 2003-2006, Ericsson AB * Copyright (c) 2003-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -39,13 +39,12 @@ ...@@ -39,13 +39,12 @@
struct link_req; struct link_req;
struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
const struct tipc_media_addr *dest, const struct tipc_media_addr *dest,
u32 dest_domain, u32 dest_domain);
u32 req_links);
void tipc_disc_update_link_req(struct link_req *req); void tipc_disc_update_link_req(struct link_req *req);
void tipc_disc_stop_link_req(struct link_req *req); void tipc_disc_stop_link_req(struct link_req *req);
void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr); void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr);
#endif #endif
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/link.h: Include file for TIPC link code * net/tipc/link.h: Include file for TIPC link code
* *
* Copyright (c) 1995-2006, Ericsson AB * Copyright (c) 1995-2006, Ericsson AB
* Copyright (c) 2004-2005, Wind River Systems * Copyright (c) 2004-2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -122,7 +122,7 @@ struct link { ...@@ -122,7 +122,7 @@ struct link {
u32 checkpoint; u32 checkpoint;
u32 peer_session; u32 peer_session;
u32 peer_bearer_id; u32 peer_bearer_id;
struct bearer *b_ptr; struct tipc_bearer *b_ptr;
u32 tolerance; u32 tolerance;
u32 continuity_interval; u32 continuity_interval;
u32 abort_limit; u32 abort_limit;
...@@ -196,24 +196,18 @@ struct link { ...@@ -196,24 +196,18 @@ struct link {
u32 bearer_congs; u32 bearer_congs;
u32 deferred_recv; u32 deferred_recv;
u32 duplicates; u32 duplicates;
u32 max_queue_sz; /* send queue size high water mark */
/* for statistical profiling of send queue size */ u32 accu_queue_sz; /* used for send queue size profiling */
u32 queue_sz_counts; /* used for send queue size profiling */
u32 max_queue_sz; u32 msg_length_counts; /* used for message length profiling */
u32 accu_queue_sz; u32 msg_lengths_total; /* used for message length profiling */
u32 queue_sz_counts; u32 msg_length_profile[7]; /* used for msg. length profiling */
/* for statistical profiling of message lengths */
u32 msg_length_counts;
u32 msg_lengths_total;
u32 msg_length_profile[7];
} stats; } stats;
}; };
struct port; struct tipc_port;
struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, struct link *tipc_link_create(struct tipc_bearer *b_ptr, const u32 peer,
const struct tipc_media_addr *media_addr); const struct tipc_media_addr *media_addr);
void tipc_link_delete(struct link *l_ptr); void tipc_link_delete(struct link *l_ptr);
void tipc_link_changeover(struct link *l_ptr); void tipc_link_changeover(struct link *l_ptr);
...@@ -230,7 +224,7 @@ void tipc_link_reset(struct link *l_ptr); ...@@ -230,7 +224,7 @@ void tipc_link_reset(struct link *l_ptr);
int tipc_link_send(struct sk_buff *buf, u32 dest, u32 selector); 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); int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf);
u32 tipc_link_get_max_pkt(u32 dest, u32 selector); 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 tipc_port *sender,
struct iovec const *msg_sect, struct iovec const *msg_sect,
const u32 num_sect, const u32 num_sect,
u32 destnode); u32 destnode);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/msg.c: TIPC message header routines * net/tipc/msg.c: TIPC message header routines
* *
* Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2000-2006, Ericsson AB
* Copyright (c) 2005, Wind River Systems * Copyright (c) 2005, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -381,20 +381,15 @@ void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str) ...@@ -381,20 +381,15 @@ void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str)
tipc_printf(buf, ":OPRT(%u):", msg_origport(msg)); tipc_printf(buf, ":OPRT(%u):", msg_origport(msg));
tipc_printf(buf, ":DPRT(%u):", msg_destport(msg)); tipc_printf(buf, ":DPRT(%u):", msg_destport(msg));
} }
if (msg_routed(msg) && !msg_non_seq(msg))
tipc_printf(buf, ":TSEQN(%u)", msg_transp_seqno(msg));
} }
if (msg_user(msg) == NAME_DISTRIBUTOR) { if (msg_user(msg) == NAME_DISTRIBUTOR) {
tipc_printf(buf, ":ONOD(%x):", msg_orignode(msg)); tipc_printf(buf, ":ONOD(%x):", msg_orignode(msg));
tipc_printf(buf, ":DNOD(%x):", msg_destnode(msg)); tipc_printf(buf, ":DNOD(%x):", msg_destnode(msg));
if (msg_routed(msg))
tipc_printf(buf, ":CSEQN(%u)", msg_transp_seqno(msg));
} }
if (msg_user(msg) == LINK_CONFIG) { if (msg_user(msg) == LINK_CONFIG) {
u32 *raw = (u32 *)msg; u32 *raw = (u32 *)msg;
struct tipc_media_addr *orig = (struct tipc_media_addr *)&raw[5]; struct tipc_media_addr *orig = (struct tipc_media_addr *)&raw[5];
tipc_printf(buf, ":REQL(%u):", msg_req_links(msg));
tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg)); tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg));
tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg)); tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg));
tipc_media_addr_printf(buf, orig); tipc_media_addr_printf(buf, orig);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/msg.h: Include file for TIPC message header routines * net/tipc/msg.h: Include file for TIPC message header routines
* *
* Copyright (c) 2000-2007, Ericsson AB * Copyright (c) 2000-2007, Ericsson AB
* Copyright (c) 2005-2008, Wind River Systems * Copyright (c) 2005-2008, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -438,11 +438,6 @@ static inline void msg_set_nametype(struct tipc_msg *m, u32 n) ...@@ -438,11 +438,6 @@ static inline void msg_set_nametype(struct tipc_msg *m, u32 n)
msg_set_word(m, 8, n); msg_set_word(m, 8, n);
} }
static inline u32 msg_transp_seqno(struct tipc_msg *m)
{
return msg_word(m, 8);
}
static inline void msg_set_timestamp(struct tipc_msg *m, u32 n) static inline void msg_set_timestamp(struct tipc_msg *m, u32 n)
{ {
msg_set_word(m, 8, n); msg_set_word(m, 8, n);
...@@ -453,11 +448,6 @@ static inline u32 msg_timestamp(struct tipc_msg *m) ...@@ -453,11 +448,6 @@ static inline u32 msg_timestamp(struct tipc_msg *m)
return msg_word(m, 8); return msg_word(m, 8);
} }
static inline void msg_set_transp_seqno(struct tipc_msg *m, u32 n)
{
msg_set_word(m, 8, n);
}
static inline u32 msg_nameinst(struct tipc_msg *m) static inline u32 msg_nameinst(struct tipc_msg *m)
{ {
return msg_word(m, 9); return msg_word(m, 9);
...@@ -577,16 +567,6 @@ static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n) ...@@ -577,16 +567,6 @@ static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n)
msg_set_bits(m, 1, 16, 0x1fff, n); msg_set_bits(m, 1, 16, 0x1fff, n);
} }
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)
{
msg_set_bits(m, 1, 16, 0xfff, n);
}
/* /*
* Word 2 * Word 2
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/node.c: TIPC node management routines * net/tipc/node.c: TIPC node management routines
* *
* Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2000-2006, Ericsson AB
* Copyright (c) 2005-2006, Wind River Systems * Copyright (c) 2005-2006, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -238,7 +238,7 @@ struct tipc_node *tipc_node_attach_link(struct link *l_ptr) ...@@ -238,7 +238,7 @@ struct tipc_node *tipc_node_attach_link(struct link *l_ptr)
return n_ptr; return n_ptr;
} }
err("Attempt to establish second link on <%s> to %s\n", err("Attempt to establish second link on <%s> to %s\n",
l_ptr->b_ptr->publ.name, l_ptr->b_ptr->name,
tipc_addr_string_fill(addr_string, l_ptr->addr)); tipc_addr_string_fill(addr_string, l_ptr->addr));
} }
return NULL; return NULL;
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/port.h: Include file for TIPC port code * net/tipc/port.h: Include file for TIPC port code
* *
* Copyright (c) 1994-2007, Ericsson AB * Copyright (c) 1994-2007, Ericsson AB
* Copyright (c) 2004-2007, Wind River Systems * Copyright (c) 2004-2007, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -95,7 +95,7 @@ struct user_port { ...@@ -95,7 +95,7 @@ struct user_port {
}; };
/** /**
* struct tipc_port - TIPC port info available to socket API * struct tipc_port - TIPC port structure
* @usr_handle: pointer to additional user-defined information about port * @usr_handle: pointer to additional user-defined information about port
* @lock: pointer to spinlock for controlling access to port * @lock: pointer to spinlock for controlling access to port
* @connected: non-zero if port is currently connected to a peer port * @connected: non-zero if port is currently connected to a peer port
...@@ -107,43 +107,33 @@ struct user_port { ...@@ -107,43 +107,33 @@ struct user_port {
* @max_pkt: maximum packet size "hint" used when building messages sent by port * @max_pkt: maximum packet size "hint" used when building messages sent by port
* @ref: unique reference to port in TIPC object registry * @ref: unique reference to port in TIPC object registry
* @phdr: preformatted message header used when sending messages * @phdr: preformatted message header used when sending messages
*/
struct tipc_port {
void *usr_handle;
spinlock_t *lock;
int connected;
u32 conn_type;
u32 conn_instance;
u32 conn_unacked;
int published;
u32 congested;
u32 max_pkt;
u32 ref;
struct tipc_msg phdr;
};
/**
* struct port - TIPC port structure
* @publ: TIPC port info available to privileged users
* @port_list: adjacent ports in TIPC's global list of ports * @port_list: adjacent ports in TIPC's global list of ports
* @dispatcher: ptr to routine which handles received messages * @dispatcher: ptr to routine which handles received messages
* @wakeup: ptr to routine to call when port is no longer congested * @wakeup: ptr to routine to call when port is no longer congested
* @user_port: ptr to user port associated with port (if any) * @user_port: ptr to user port associated with port (if any)
* @wait_list: adjacent ports in list of ports waiting on link congestion * @wait_list: adjacent ports in list of ports waiting on link congestion
* @waiting_pkts: * @waiting_pkts:
* @sent: * @sent: # of non-empty messages sent by port
* @acked: * @acked: # of non-empty message acknowledgements from connected port's peer
* @publications: list of publications for port * @publications: list of publications for port
* @pub_count: total # of publications port has made during its lifetime * @pub_count: total # of publications port has made during its lifetime
* @probing_state: * @probing_state:
* @probing_interval: * @probing_interval:
* @last_in_seqno:
* @timer_ref: * @timer_ref:
* @subscription: "node down" subscription used to terminate failed connections * @subscription: "node down" subscription used to terminate failed connections
*/ */
struct tipc_port {
struct port { void *usr_handle;
struct tipc_port publ; spinlock_t *lock;
int connected;
u32 conn_type;
u32 conn_instance;
u32 conn_unacked;
int published;
u32 congested;
u32 max_pkt;
u32 ref;
struct tipc_msg phdr;
struct list_head port_list; struct list_head port_list;
u32 (*dispatcher)(struct tipc_port *, struct sk_buff *); u32 (*dispatcher)(struct tipc_port *, struct sk_buff *);
void (*wakeup)(struct tipc_port *); void (*wakeup)(struct tipc_port *);
...@@ -156,7 +146,6 @@ struct port { ...@@ -156,7 +146,6 @@ struct port {
u32 pub_count; u32 pub_count;
u32 probing_state; u32 probing_state;
u32 probing_interval; u32 probing_interval;
u32 last_in_seqno;
struct timer_list timer; struct timer_list timer;
struct tipc_node_subscr subscription; struct tipc_node_subscr subscription;
}; };
...@@ -230,7 +219,7 @@ int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest, ...@@ -230,7 +219,7 @@ int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest,
int tipc_multicast(u32 portref, struct tipc_name_seq const *seq, int tipc_multicast(u32 portref, struct tipc_name_seq const *seq,
unsigned int section_count, struct iovec const *msg); unsigned int section_count, struct iovec const *msg);
int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr, int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect, struct iovec const *msg_sect, u32 num_sect,
int err); int err);
struct sk_buff *tipc_port_get_ports(void); struct sk_buff *tipc_port_get_ports(void);
...@@ -242,9 +231,9 @@ void tipc_port_reinit(void); ...@@ -242,9 +231,9 @@ void tipc_port_reinit(void);
* tipc_port_lock - lock port instance referred to and return its pointer * tipc_port_lock - lock port instance referred to and return its pointer
*/ */
static inline struct port *tipc_port_lock(u32 ref) static inline struct tipc_port *tipc_port_lock(u32 ref)
{ {
return (struct port *)tipc_ref_lock(ref); return (struct tipc_port *)tipc_ref_lock(ref);
} }
/** /**
...@@ -253,27 +242,27 @@ static inline struct port *tipc_port_lock(u32 ref) ...@@ -253,27 +242,27 @@ static inline struct port *tipc_port_lock(u32 ref)
* Can use pointer instead of tipc_ref_unlock() since port is already locked. * Can use pointer instead of tipc_ref_unlock() since port is already locked.
*/ */
static inline void tipc_port_unlock(struct port *p_ptr) static inline void tipc_port_unlock(struct tipc_port *p_ptr)
{ {
spin_unlock_bh(p_ptr->publ.lock); spin_unlock_bh(p_ptr->lock);
} }
static inline struct port *tipc_port_deref(u32 ref) static inline struct tipc_port *tipc_port_deref(u32 ref)
{ {
return (struct port *)tipc_ref_deref(ref); return (struct tipc_port *)tipc_ref_deref(ref);
} }
static inline u32 tipc_peer_port(struct port *p_ptr) static inline u32 tipc_peer_port(struct tipc_port *p_ptr)
{ {
return msg_destport(&p_ptr->publ.phdr); return msg_destport(&p_ptr->phdr);
} }
static inline u32 tipc_peer_node(struct port *p_ptr) static inline u32 tipc_peer_node(struct tipc_port *p_ptr)
{ {
return msg_destnode(&p_ptr->publ.phdr); return msg_destnode(&p_ptr->phdr);
} }
static inline int tipc_port_congested(struct port *p_ptr) static inline int tipc_port_congested(struct tipc_port *p_ptr)
{ {
return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2); return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2);
} }
...@@ -284,7 +273,7 @@ static inline int tipc_port_congested(struct port *p_ptr) ...@@ -284,7 +273,7 @@ static inline int tipc_port_congested(struct port *p_ptr)
static inline int tipc_port_recv_msg(struct sk_buff *buf) static inline int tipc_port_recv_msg(struct sk_buff *buf)
{ {
struct port *p_ptr; struct tipc_port *p_ptr;
struct tipc_msg *msg = buf_msg(buf); struct tipc_msg *msg = buf_msg(buf);
u32 destport = msg_destport(msg); u32 destport = msg_destport(msg);
u32 dsz = msg_data_sz(msg); u32 dsz = msg_data_sz(msg);
...@@ -299,7 +288,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf) ...@@ -299,7 +288,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf)
/* validate destination & pass to port, otherwise reject message */ /* validate destination & pass to port, otherwise reject message */
p_ptr = tipc_port_lock(destport); p_ptr = tipc_port_lock(destport);
if (likely(p_ptr)) { if (likely(p_ptr)) {
if (likely(p_ptr->publ.connected)) { if (likely(p_ptr->connected)) {
if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) || if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) ||
(unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) || (unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) ||
(unlikely(!msg_connected(msg)))) { (unlikely(!msg_connected(msg)))) {
...@@ -308,7 +297,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf) ...@@ -308,7 +297,7 @@ static inline int tipc_port_recv_msg(struct sk_buff *buf)
goto reject; goto reject;
} }
} }
err = p_ptr->dispatcher(&p_ptr->publ, buf); err = p_ptr->dispatcher(p_ptr, buf);
tipc_port_unlock(p_ptr); tipc_port_unlock(p_ptr);
if (likely(!err)) if (likely(!err))
return dsz; return dsz;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/socket.c: TIPC socket API * net/tipc/socket.c: TIPC socket API
* *
* Copyright (c) 2001-2007, Ericsson AB * Copyright (c) 2001-2007, Ericsson AB
* Copyright (c) 2004-2008, Wind River Systems * Copyright (c) 2004-2008, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -241,7 +241,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol, ...@@ -241,7 +241,6 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
tipc_set_portunreliable(tp_ptr->ref, 1); tipc_set_portunreliable(tp_ptr->ref, 1);
} }
atomic_inc(&tipc_user_count);
return 0; return 0;
} }
...@@ -321,7 +320,6 @@ static int release(struct socket *sock) ...@@ -321,7 +320,6 @@ static int release(struct socket *sock)
sock_put(sk); sock_put(sk);
sock->sk = NULL; sock->sk = NULL;
atomic_dec(&tipc_user_count);
return res; return res;
} }
...@@ -495,6 +493,8 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m) ...@@ -495,6 +493,8 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
if (likely(dest->addr.name.name.type != TIPC_CFG_SRV)) if (likely(dest->addr.name.name.type != TIPC_CFG_SRV))
return -EACCES; return -EACCES;
if (!m->msg_iovlen || (m->msg_iov[0].iov_len < sizeof(hdr)))
return -EMSGSIZE;
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; return -EFAULT;
if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN))) if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN)))
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* net/tipc/subscr.c: TIPC network topology service * net/tipc/subscr.c: TIPC network topology service
* *
* Copyright (c) 2000-2006, Ericsson AB * Copyright (c) 2000-2006, Ericsson AB
* Copyright (c) 2005-2007, Wind River Systems * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -160,7 +160,7 @@ void tipc_subscr_report_overlap(struct subscription *sub, ...@@ -160,7 +160,7 @@ void tipc_subscr_report_overlap(struct subscription *sub,
static void subscr_timeout(struct subscription *sub) static void subscr_timeout(struct subscription *sub)
{ {
struct port *server_port; struct tipc_port *server_port;
/* Validate server port reference (in case subscriber is terminating) */ /* Validate server port reference (in case subscriber is terminating) */
...@@ -472,8 +472,6 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -472,8 +472,6 @@ static void subscr_named_msg_event(void *usr_handle,
struct tipc_portid const *orig, struct tipc_portid const *orig,
struct tipc_name_seq const *dest) struct tipc_name_seq const *dest)
{ {
static struct iovec msg_sect = {NULL, 0};
struct subscriber *subscriber; struct subscriber *subscriber;
u32 server_port_ref; u32 server_port_ref;
...@@ -508,7 +506,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -508,7 +506,7 @@ static void subscr_named_msg_event(void *usr_handle,
/* Lock server port (& save lock address for future use) */ /* Lock server port (& save lock address for future use) */
subscriber->lock = tipc_port_lock(subscriber->port_ref)->publ.lock; subscriber->lock = tipc_port_lock(subscriber->port_ref)->lock;
/* Add subscriber to topology server's subscriber list */ /* Add subscriber to topology server's subscriber list */
...@@ -523,7 +521,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -523,7 +521,7 @@ static void subscr_named_msg_event(void *usr_handle,
/* Send an ACK- to complete connection handshaking */ /* Send an ACK- to complete connection handshaking */
tipc_send(server_port_ref, 1, &msg_sect); tipc_send(server_port_ref, 0, NULL);
/* Handle optional subscription request */ /* Handle optional subscription request */
...@@ -542,7 +540,6 @@ int tipc_subscr_start(void) ...@@ -542,7 +540,6 @@ int tipc_subscr_start(void)
spin_lock_init(&topsrv.lock); spin_lock_init(&topsrv.lock);
INIT_LIST_HEAD(&topsrv.subscriber_list); INIT_LIST_HEAD(&topsrv.subscriber_list);
spin_lock_bh(&topsrv.lock);
res = tipc_createport(NULL, res = tipc_createport(NULL,
TIPC_CRITICAL_IMPORTANCE, TIPC_CRITICAL_IMPORTANCE,
NULL, NULL,
...@@ -563,12 +560,10 @@ int tipc_subscr_start(void) ...@@ -563,12 +560,10 @@ int tipc_subscr_start(void)
goto failed; goto failed;
} }
spin_unlock_bh(&topsrv.lock);
return 0; return 0;
failed: failed:
err("Failed to create subscription service\n"); err("Failed to create subscription service\n");
spin_unlock_bh(&topsrv.lock);
return res; return res;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment