mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 12:10:52 +07:00
tipc: cleanup function namespace
Do some cleanups of TIPC based on make namespacecheck 1. Don't export unused symbols 2. Eliminate dead code 3. Make functions and variables local 4. Rename buf_acquire to tipc_buf_acquire since it is used in several files Compile tested only. This make break out of tree kernel modules that depend on TIPC routines. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Acked-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
15419227f7
commit
31e3c3f6f1
@ -50,8 +50,6 @@
|
|||||||
* TIPC operating mode routines
|
* TIPC operating mode routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u32 tipc_get_addr(void);
|
|
||||||
|
|
||||||
#define TIPC_NOT_RUNNING 0
|
#define TIPC_NOT_RUNNING 0
|
||||||
#define TIPC_NODE_MODE 1
|
#define TIPC_NODE_MODE 1
|
||||||
#define TIPC_NET_MODE 2
|
#define TIPC_NET_MODE 2
|
||||||
@ -62,8 +60,6 @@ int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
|
|||||||
|
|
||||||
void tipc_detach(unsigned int userref);
|
void tipc_detach(unsigned int userref);
|
||||||
|
|
||||||
int tipc_get_mode(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TIPC port manipulation routines
|
* TIPC port manipulation routines
|
||||||
*/
|
*/
|
||||||
@ -153,12 +149,6 @@ int tipc_disconnect(u32 portref);
|
|||||||
|
|
||||||
int tipc_shutdown(u32 ref);
|
int tipc_shutdown(u32 ref);
|
||||||
|
|
||||||
int tipc_isconnected(u32 portref, int *isconnected);
|
|
||||||
|
|
||||||
int tipc_peer(u32 portref, struct tipc_portid *peer);
|
|
||||||
|
|
||||||
int tipc_ref_valid(u32 portref);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TIPC messaging routines
|
* TIPC messaging routines
|
||||||
*/
|
*/
|
||||||
@ -170,38 +160,12 @@ int tipc_send(u32 portref,
|
|||||||
unsigned int num_sect,
|
unsigned int num_sect,
|
||||||
struct iovec const *msg_sect);
|
struct iovec const *msg_sect);
|
||||||
|
|
||||||
int tipc_send_buf(u32 portref,
|
|
||||||
struct sk_buff *buf,
|
|
||||||
unsigned int dsz);
|
|
||||||
|
|
||||||
int tipc_send2name(u32 portref,
|
int tipc_send2name(u32 portref,
|
||||||
struct tipc_name const *name,
|
struct tipc_name const *name,
|
||||||
u32 domain,
|
u32 domain,
|
||||||
unsigned int num_sect,
|
unsigned int num_sect,
|
||||||
struct iovec const *msg_sect);
|
struct iovec const *msg_sect);
|
||||||
|
|
||||||
int tipc_send_buf2name(u32 portref,
|
|
||||||
struct tipc_name const *name,
|
|
||||||
u32 domain,
|
|
||||||
struct sk_buff *buf,
|
|
||||||
unsigned int dsz);
|
|
||||||
|
|
||||||
int tipc_forward2name(u32 portref,
|
|
||||||
struct tipc_name const *name,
|
|
||||||
u32 domain,
|
|
||||||
unsigned int section_count,
|
|
||||||
struct iovec const *msg_sect,
|
|
||||||
struct tipc_portid const *origin,
|
|
||||||
unsigned int importance);
|
|
||||||
|
|
||||||
int tipc_forward_buf2name(u32 portref,
|
|
||||||
struct tipc_name const *name,
|
|
||||||
u32 domain,
|
|
||||||
struct sk_buff *buf,
|
|
||||||
unsigned int dsz,
|
|
||||||
struct tipc_portid const *orig,
|
|
||||||
unsigned int importance);
|
|
||||||
|
|
||||||
int tipc_send2port(u32 portref,
|
int tipc_send2port(u32 portref,
|
||||||
struct tipc_portid const *dest,
|
struct tipc_portid const *dest,
|
||||||
unsigned int num_sect,
|
unsigned int num_sect,
|
||||||
@ -212,46 +176,11 @@ int tipc_send_buf2port(u32 portref,
|
|||||||
struct sk_buff *buf,
|
struct sk_buff *buf,
|
||||||
unsigned int dsz);
|
unsigned int dsz);
|
||||||
|
|
||||||
int tipc_forward2port(u32 portref,
|
|
||||||
struct tipc_portid const *dest,
|
|
||||||
unsigned int num_sect,
|
|
||||||
struct iovec const *msg_sect,
|
|
||||||
struct tipc_portid const *origin,
|
|
||||||
unsigned int importance);
|
|
||||||
|
|
||||||
int tipc_forward_buf2port(u32 portref,
|
|
||||||
struct tipc_portid const *dest,
|
|
||||||
struct sk_buff *buf,
|
|
||||||
unsigned int dsz,
|
|
||||||
struct tipc_portid const *orig,
|
|
||||||
unsigned int importance);
|
|
||||||
|
|
||||||
int tipc_multicast(u32 portref,
|
int tipc_multicast(u32 portref,
|
||||||
struct tipc_name_seq const *seq,
|
struct tipc_name_seq const *seq,
|
||||||
u32 domain, /* currently unused */
|
u32 domain, /* currently unused */
|
||||||
unsigned int section_count,
|
unsigned int section_count,
|
||||||
struct iovec const *msg);
|
struct iovec const *msg);
|
||||||
|
|
||||||
#if 0
|
|
||||||
int tipc_multicast_buf(u32 portref,
|
|
||||||
struct tipc_name_seq const *seq,
|
|
||||||
u32 domain,
|
|
||||||
void *buf,
|
|
||||||
unsigned int size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TIPC subscription routines
|
|
||||||
*/
|
|
||||||
|
|
||||||
int tipc_ispublished(struct tipc_name const *name);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get number of available nodes within specified domain (excluding own node)
|
|
||||||
*/
|
|
||||||
|
|
||||||
unsigned int tipc_available_nodes(const u32 domain);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,8 +88,6 @@ void tipc_acknowledge(u32 port_ref,u32 ack);
|
|||||||
|
|
||||||
struct tipc_port *tipc_get_port(const u32 ref);
|
struct tipc_port *tipc_get_port(const u32 ref);
|
||||||
|
|
||||||
void *tipc_get_handle(const u32 ref);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following routines require that the port be locked on entry
|
* The following routines require that the port be locked on entry
|
||||||
*/
|
*/
|
||||||
|
@ -41,11 +41,6 @@
|
|||||||
#include "cluster.h"
|
#include "cluster.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
||||||
u32 tipc_get_addr(void)
|
|
||||||
{
|
|
||||||
return tipc_own_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tipc_addr_domain_valid - validates a network domain address
|
* tipc_addr_domain_valid - validates a network domain address
|
||||||
*
|
*
|
||||||
|
@ -121,6 +121,9 @@ static DEFINE_SPINLOCK(bc_lock);
|
|||||||
|
|
||||||
const char tipc_bclink_name[] = "broadcast-link";
|
const char tipc_bclink_name[] = "broadcast-link";
|
||||||
|
|
||||||
|
static void tipc_nmap_diff(struct tipc_node_map *nm_a,
|
||||||
|
struct tipc_node_map *nm_b,
|
||||||
|
struct tipc_node_map *nm_diff);
|
||||||
|
|
||||||
static u32 buf_seqno(struct sk_buff *buf)
|
static u32 buf_seqno(struct sk_buff *buf)
|
||||||
{
|
{
|
||||||
@ -287,7 +290,7 @@ static void bclink_send_nack(struct tipc_node *n_ptr)
|
|||||||
if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
|
if (!less(n_ptr->bclink.gap_after, n_ptr->bclink.gap_to))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
buf = buf_acquire(INT_H_SIZE);
|
buf = tipc_buf_acquire(INT_H_SIZE);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
msg = buf_msg(buf);
|
msg = buf_msg(buf);
|
||||||
tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
|
tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
|
||||||
@ -871,8 +874,9 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node)
|
|||||||
* @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
|
* @nm_diff: output node map A-B (i.e. nodes of A that are not in B)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
|
static void tipc_nmap_diff(struct tipc_node_map *nm_a,
|
||||||
struct tipc_node_map *nm_diff)
|
struct tipc_node_map *nm_b,
|
||||||
|
struct tipc_node_map *nm_diff)
|
||||||
{
|
{
|
||||||
int stop = ARRAY_SIZE(nm_a->map);
|
int stop = ARRAY_SIZE(nm_a->map);
|
||||||
int w;
|
int w;
|
||||||
|
@ -84,9 +84,6 @@ static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_m
|
|||||||
return !memcmp(nm_a, nm_b, sizeof(*nm_a));
|
return !memcmp(nm_a, nm_b, sizeof(*nm_a));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tipc_nmap_diff(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b,
|
|
||||||
struct tipc_node_map *nm_diff);
|
|
||||||
|
|
||||||
void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
|
void tipc_port_list_add(struct port_list *pl_ptr, u32 port);
|
||||||
void tipc_port_list_free(struct port_list *pl_ptr);
|
void tipc_port_list_free(struct port_list *pl_ptr);
|
||||||
|
|
||||||
|
@ -113,25 +113,6 @@ void tipc_cltr_delete(struct cluster *c_ptr)
|
|||||||
kfree(c_ptr);
|
kfree(c_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
|
|
||||||
{
|
|
||||||
struct tipc_node *n_ptr;
|
|
||||||
u32 n_num = tipc_node(addr) + 1;
|
|
||||||
|
|
||||||
if (!c_ptr)
|
|
||||||
return addr;
|
|
||||||
for (; n_num <= c_ptr->highest_node; n_num++) {
|
|
||||||
n_ptr = c_ptr->nodes[n_num];
|
|
||||||
if (n_ptr && tipc_node_has_active_links(n_ptr))
|
|
||||||
return n_ptr->addr;
|
|
||||||
}
|
|
||||||
for (n_num = 1; n_num < tipc_node(addr); n_num++) {
|
|
||||||
n_ptr = c_ptr->nodes[n_num];
|
|
||||||
if (n_ptr && tipc_node_has_active_links(n_ptr))
|
|
||||||
return n_ptr->addr;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
|
void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr)
|
||||||
{
|
{
|
||||||
@ -232,7 +213,7 @@ struct tipc_node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
|
|||||||
static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
|
static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
|
||||||
{
|
{
|
||||||
u32 size = INT_H_SIZE + data_size;
|
u32 size = INT_H_SIZE + data_size;
|
||||||
struct sk_buff *buf = buf_acquire(size);
|
struct sk_buff *buf = tipc_buf_acquire(size);
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
@ -75,7 +75,7 @@ void tipc_cltr_attach_node(struct cluster *c_ptr, struct tipc_node *n_ptr);
|
|||||||
void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
|
void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest);
|
||||||
void tipc_cltr_broadcast(struct sk_buff *buf);
|
void tipc_cltr_broadcast(struct sk_buff *buf);
|
||||||
int tipc_cltr_init(void);
|
int tipc_cltr_init(void);
|
||||||
u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr);
|
|
||||||
void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
|
void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
|
||||||
void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
|
void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest);
|
||||||
void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
|
void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest, u32 lo, u32 hi);
|
||||||
|
@ -95,7 +95,7 @@ int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
|
static struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
|
||||||
{
|
{
|
||||||
struct sk_buff *buf;
|
struct sk_buff *buf;
|
||||||
__be32 value_net;
|
__be32 value_net;
|
||||||
@ -109,6 +109,11 @@ struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
|
||||||
|
{
|
||||||
|
return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
|
||||||
|
}
|
||||||
|
|
||||||
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
|
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string)
|
||||||
{
|
{
|
||||||
struct sk_buff *buf;
|
struct sk_buff *buf;
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
|
struct sk_buff *tipc_cfg_reply_alloc(int payload_size);
|
||||||
int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
|
int tipc_cfg_append_tlv(struct sk_buff *buf, int tlv_type,
|
||||||
void *tlv_data, int tlv_data_size);
|
void *tlv_data, int tlv_data_size);
|
||||||
struct sk_buff *tipc_cfg_reply_unsigned_type(u16 tlv_type, u32 value);
|
|
||||||
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
|
struct sk_buff *tipc_cfg_reply_string_type(u16 tlv_type, char *string);
|
||||||
|
|
||||||
static inline struct sk_buff *tipc_cfg_reply_none(void)
|
static inline struct sk_buff *tipc_cfg_reply_none(void)
|
||||||
@ -53,11 +52,6 @@ static inline struct sk_buff *tipc_cfg_reply_none(void)
|
|||||||
return tipc_cfg_reply_alloc(0);
|
return tipc_cfg_reply_alloc(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct sk_buff *tipc_cfg_reply_unsigned(u32 value)
|
|
||||||
{
|
|
||||||
return tipc_cfg_reply_unsigned_type(TIPC_TLV_UNSIGNED, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
|
static inline struct sk_buff *tipc_cfg_reply_error_string(char *string)
|
||||||
{
|
{
|
||||||
return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
|
return tipc_cfg_reply_string_type(TIPC_TLV_ERROR_STRING, string);
|
||||||
|
@ -96,13 +96,13 @@ int tipc_net_id;
|
|||||||
int tipc_remote_management;
|
int tipc_remote_management;
|
||||||
|
|
||||||
|
|
||||||
int tipc_get_mode(void)
|
static int tipc_get_mode(void)
|
||||||
{
|
{
|
||||||
return tipc_mode;
|
return tipc_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* buf_acquire - creates a TIPC message buffer
|
* tipc_buf_acquire - creates a TIPC message buffer
|
||||||
* @size: message size (including TIPC header)
|
* @size: message size (including TIPC header)
|
||||||
*
|
*
|
||||||
* Returns a new buffer with data pointers set to the specified size.
|
* Returns a new buffer with data pointers set to the specified size.
|
||||||
@ -111,7 +111,7 @@ int tipc_get_mode(void)
|
|||||||
* There may also be unrequested tailroom present at the buffer's end.
|
* There may also be unrequested tailroom present at the buffer's end.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct sk_buff *buf_acquire(u32 size)
|
struct sk_buff *tipc_buf_acquire(u32 size)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
|
unsigned int buf_size = (BUF_HEADROOM + size + 3) & ~3u;
|
||||||
@ -129,7 +129,7 @@ struct sk_buff *buf_acquire(u32 size)
|
|||||||
* tipc_core_stop_net - shut down TIPC networking sub-systems
|
* tipc_core_stop_net - shut down TIPC networking sub-systems
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void tipc_core_stop_net(void)
|
static void tipc_core_stop_net(void)
|
||||||
{
|
{
|
||||||
tipc_eth_media_stop();
|
tipc_eth_media_stop();
|
||||||
tipc_net_stop();
|
tipc_net_stop();
|
||||||
@ -154,7 +154,7 @@ int tipc_core_start_net(unsigned long addr)
|
|||||||
* tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
|
* tipc_core_stop - switch TIPC from SINGLE NODE to NOT RUNNING mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void tipc_core_stop(void)
|
static void tipc_core_stop(void)
|
||||||
{
|
{
|
||||||
if (tipc_mode != TIPC_NODE_MODE)
|
if (tipc_mode != TIPC_NODE_MODE)
|
||||||
return;
|
return;
|
||||||
@ -176,7 +176,7 @@ void tipc_core_stop(void)
|
|||||||
* tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
|
* tipc_core_start - switch TIPC from NOT RUNNING to SINGLE NODE mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int tipc_core_start(void)
|
static int tipc_core_start(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -246,7 +246,6 @@ MODULE_VERSION(TIPC_MOD_VER);
|
|||||||
|
|
||||||
EXPORT_SYMBOL(tipc_attach);
|
EXPORT_SYMBOL(tipc_attach);
|
||||||
EXPORT_SYMBOL(tipc_detach);
|
EXPORT_SYMBOL(tipc_detach);
|
||||||
EXPORT_SYMBOL(tipc_get_addr);
|
|
||||||
EXPORT_SYMBOL(tipc_get_mode);
|
EXPORT_SYMBOL(tipc_get_mode);
|
||||||
EXPORT_SYMBOL(tipc_createport);
|
EXPORT_SYMBOL(tipc_createport);
|
||||||
EXPORT_SYMBOL(tipc_deleteport);
|
EXPORT_SYMBOL(tipc_deleteport);
|
||||||
@ -262,23 +261,10 @@ EXPORT_SYMBOL(tipc_withdraw);
|
|||||||
EXPORT_SYMBOL(tipc_connect2port);
|
EXPORT_SYMBOL(tipc_connect2port);
|
||||||
EXPORT_SYMBOL(tipc_disconnect);
|
EXPORT_SYMBOL(tipc_disconnect);
|
||||||
EXPORT_SYMBOL(tipc_shutdown);
|
EXPORT_SYMBOL(tipc_shutdown);
|
||||||
EXPORT_SYMBOL(tipc_isconnected);
|
|
||||||
EXPORT_SYMBOL(tipc_peer);
|
|
||||||
EXPORT_SYMBOL(tipc_ref_valid);
|
|
||||||
EXPORT_SYMBOL(tipc_send);
|
EXPORT_SYMBOL(tipc_send);
|
||||||
EXPORT_SYMBOL(tipc_send_buf);
|
|
||||||
EXPORT_SYMBOL(tipc_send2name);
|
EXPORT_SYMBOL(tipc_send2name);
|
||||||
EXPORT_SYMBOL(tipc_forward2name);
|
|
||||||
EXPORT_SYMBOL(tipc_send_buf2name);
|
|
||||||
EXPORT_SYMBOL(tipc_forward_buf2name);
|
|
||||||
EXPORT_SYMBOL(tipc_send2port);
|
EXPORT_SYMBOL(tipc_send2port);
|
||||||
EXPORT_SYMBOL(tipc_forward2port);
|
|
||||||
EXPORT_SYMBOL(tipc_send_buf2port);
|
|
||||||
EXPORT_SYMBOL(tipc_forward_buf2port);
|
|
||||||
EXPORT_SYMBOL(tipc_multicast);
|
EXPORT_SYMBOL(tipc_multicast);
|
||||||
/* EXPORT_SYMBOL(tipc_multicast_buf); not available yet */
|
|
||||||
EXPORT_SYMBOL(tipc_ispublished);
|
|
||||||
EXPORT_SYMBOL(tipc_available_nodes);
|
|
||||||
|
|
||||||
/* TIPC API for external bearers (see tipc_bearer.h) */
|
/* TIPC API for external bearers (see tipc_bearer.h) */
|
||||||
|
|
||||||
@ -295,6 +281,4 @@ EXPORT_SYMBOL(tipc_createport_raw);
|
|||||||
EXPORT_SYMBOL(tipc_reject_msg);
|
EXPORT_SYMBOL(tipc_reject_msg);
|
||||||
EXPORT_SYMBOL(tipc_send_buf_fast);
|
EXPORT_SYMBOL(tipc_send_buf_fast);
|
||||||
EXPORT_SYMBOL(tipc_acknowledge);
|
EXPORT_SYMBOL(tipc_acknowledge);
|
||||||
EXPORT_SYMBOL(tipc_get_port);
|
|
||||||
EXPORT_SYMBOL(tipc_get_handle);
|
|
||||||
|
|
||||||
|
@ -83,9 +83,7 @@
|
|||||||
* Note: TIPC_LOG is configured to echo its output to the system console;
|
* Note: TIPC_LOG is configured to echo its output to the system console;
|
||||||
* user-defined buffers can be configured to do the same thing.
|
* user-defined buffers can be configured to do the same thing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern struct print_buf *const TIPC_NULL;
|
extern struct print_buf *const TIPC_NULL;
|
||||||
extern struct print_buf *const TIPC_CONS;
|
|
||||||
extern struct print_buf *const TIPC_LOG;
|
extern struct print_buf *const TIPC_LOG;
|
||||||
|
|
||||||
void tipc_printf(struct print_buf *, const char *fmt, ...);
|
void tipc_printf(struct print_buf *, const char *fmt, ...);
|
||||||
@ -204,10 +202,7 @@ extern atomic_t tipc_user_count;
|
|||||||
* Routines available to privileged subsystems
|
* Routines available to privileged subsystems
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int tipc_core_start(void);
|
extern int tipc_core_start_net(unsigned long);
|
||||||
extern void tipc_core_stop(void);
|
|
||||||
extern int tipc_core_start_net(unsigned long addr);
|
|
||||||
extern void tipc_core_stop_net(void);
|
|
||||||
extern int tipc_handler_start(void);
|
extern int tipc_handler_start(void);
|
||||||
extern void tipc_handler_stop(void);
|
extern void tipc_handler_stop(void);
|
||||||
extern int tipc_netlink_start(void);
|
extern int tipc_netlink_start(void);
|
||||||
@ -328,7 +323,7 @@ static inline struct tipc_msg *buf_msg(struct sk_buff *skb)
|
|||||||
return (struct tipc_msg *)skb->data;
|
return (struct tipc_msg *)skb->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct sk_buff *buf_acquire(u32 size);
|
extern struct sk_buff *tipc_buf_acquire(u32 size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* buf_discard - frees a TIPC message buffer
|
* buf_discard - frees a TIPC message buffer
|
||||||
|
@ -52,7 +52,7 @@ static struct print_buf null_buf = { NULL, 0, NULL, 0 };
|
|||||||
struct print_buf *const TIPC_NULL = &null_buf;
|
struct print_buf *const TIPC_NULL = &null_buf;
|
||||||
|
|
||||||
static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
|
static struct print_buf cons_buf = { NULL, 0, NULL, 1 };
|
||||||
struct print_buf *const TIPC_CONS = &cons_buf;
|
static struct print_buf *const TIPC_CONS = &cons_buf;
|
||||||
|
|
||||||
static struct print_buf log_buf = { NULL, 0, NULL, 1 };
|
static struct print_buf log_buf = { NULL, 0, NULL, 1 };
|
||||||
struct print_buf *const TIPC_LOG = &log_buf;
|
struct print_buf *const TIPC_LOG = &log_buf;
|
||||||
@ -76,6 +76,10 @@ struct print_buf *const TIPC_LOG = &log_buf;
|
|||||||
static char print_string[TIPC_PB_MAX_STR];
|
static char print_string[TIPC_PB_MAX_STR];
|
||||||
static DEFINE_SPINLOCK(print_lock);
|
static DEFINE_SPINLOCK(print_lock);
|
||||||
|
|
||||||
|
static void tipc_printbuf_reset(struct print_buf *pb);
|
||||||
|
static int tipc_printbuf_empty(struct print_buf *pb);
|
||||||
|
static void tipc_printbuf_move(struct print_buf *pb_to,
|
||||||
|
struct print_buf *pb_from);
|
||||||
|
|
||||||
#define FORMAT(PTR,LEN,FMT) \
|
#define FORMAT(PTR,LEN,FMT) \
|
||||||
{\
|
{\
|
||||||
@ -116,7 +120,7 @@ void tipc_printbuf_init(struct print_buf *pb, char *raw, u32 size)
|
|||||||
* @pb: pointer to print buffer structure
|
* @pb: pointer to print buffer structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void tipc_printbuf_reset(struct print_buf *pb)
|
static void tipc_printbuf_reset(struct print_buf *pb)
|
||||||
{
|
{
|
||||||
if (pb->buf) {
|
if (pb->buf) {
|
||||||
pb->crs = pb->buf;
|
pb->crs = pb->buf;
|
||||||
@ -132,7 +136,7 @@ void tipc_printbuf_reset(struct print_buf *pb)
|
|||||||
* Returns non-zero if print buffer is empty.
|
* Returns non-zero if print buffer is empty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int tipc_printbuf_empty(struct print_buf *pb)
|
static int tipc_printbuf_empty(struct print_buf *pb)
|
||||||
{
|
{
|
||||||
return !pb->buf || (pb->crs == pb->buf);
|
return !pb->buf || (pb->crs == pb->buf);
|
||||||
}
|
}
|
||||||
@ -181,7 +185,8 @@ int tipc_printbuf_validate(struct print_buf *pb)
|
|||||||
* Source print buffer becomes empty if a successful move occurs.
|
* Source print buffer becomes empty if a successful move occurs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
|
static void tipc_printbuf_move(struct print_buf *pb_to,
|
||||||
|
struct print_buf *pb_from)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -56,10 +56,7 @@ struct print_buf {
|
|||||||
#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
|
#define TIPC_PB_MAX_STR 512 /* max printable string (with trailing NUL) */
|
||||||
|
|
||||||
void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
|
void tipc_printbuf_init(struct print_buf *pb, char *buf, u32 size);
|
||||||
void tipc_printbuf_reset(struct print_buf *pb);
|
|
||||||
int tipc_printbuf_empty(struct print_buf *pb);
|
|
||||||
int tipc_printbuf_validate(struct print_buf *pb);
|
int tipc_printbuf_validate(struct print_buf *pb);
|
||||||
void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from);
|
|
||||||
|
|
||||||
int tipc_log_resize(int log_size);
|
int tipc_log_resize(int log_size);
|
||||||
|
|
||||||
|
@ -68,20 +68,6 @@ struct link_req {
|
|||||||
unsigned int timer_intv;
|
unsigned int timer_intv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* disc_lost_link(): A link has lost contact
|
|
||||||
*/
|
|
||||||
|
|
||||||
void tipc_disc_link_event(u32 addr, char *name, int up)
|
|
||||||
{
|
|
||||||
if (in_own_cluster(addr))
|
|
||||||
return;
|
|
||||||
/*
|
|
||||||
* Code for inter cluster link setup here
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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)
|
||||||
@ -95,7 +81,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
|
|||||||
u32 dest_domain,
|
u32 dest_domain,
|
||||||
struct bearer *b_ptr)
|
struct bearer *b_ptr)
|
||||||
{
|
{
|
||||||
struct sk_buff *buf = buf_acquire(DSC_H_SIZE);
|
struct sk_buff *buf = tipc_buf_acquire(DSC_H_SIZE);
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
@ -50,6 +50,4 @@ 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 bearer *b_ptr);
|
||||||
|
|
||||||
void tipc_disc_link_event(u32 addr, char *name, int up);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,6 +112,9 @@ static void link_state_event(struct link *l_ptr, u32 event);
|
|||||||
static void link_reset_statistics(struct link *l_ptr);
|
static void link_reset_statistics(struct link *l_ptr);
|
||||||
static void link_print(struct link *l_ptr, struct print_buf *buf,
|
static void link_print(struct link *l_ptr, struct print_buf *buf,
|
||||||
const char *str);
|
const char *str);
|
||||||
|
static void link_start(struct link *l_ptr);
|
||||||
|
static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Debugging code used by link routines only
|
* Debugging code used by link routines only
|
||||||
@ -442,7 +445,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
|
|||||||
|
|
||||||
k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
|
k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
|
||||||
list_add_tail(&l_ptr->link_list, &b_ptr->links);
|
list_add_tail(&l_ptr->link_list, &b_ptr->links);
|
||||||
tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
|
tipc_k_signal((Handler)link_start, (unsigned long)l_ptr);
|
||||||
|
|
||||||
dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
|
dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
|
||||||
l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
|
l_ptr->tolerance, l_ptr->continuity_interval, l_ptr->abort_limit);
|
||||||
@ -482,9 +485,9 @@ void tipc_link_delete(struct link *l_ptr)
|
|||||||
kfree(l_ptr);
|
kfree(l_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tipc_link_start(struct link *l_ptr)
|
static void link_start(struct link *l_ptr)
|
||||||
{
|
{
|
||||||
dbg("tipc_link_start %x\n", l_ptr);
|
dbg("link_start %x\n", l_ptr);
|
||||||
link_state_event(l_ptr, STARTING_EVT);
|
link_state_event(l_ptr, STARTING_EVT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,7 +1003,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
|
|||||||
/* Fragmentation needed ? */
|
/* Fragmentation needed ? */
|
||||||
|
|
||||||
if (size > max_packet)
|
if (size > max_packet)
|
||||||
return tipc_link_send_long_buf(l_ptr, buf);
|
return link_send_long_buf(l_ptr, buf);
|
||||||
|
|
||||||
/* Packet can be queued or sent: */
|
/* Packet can be queued or sent: */
|
||||||
|
|
||||||
@ -1036,7 +1039,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
|
|||||||
/* Try creating a new bundle */
|
/* Try creating a new bundle */
|
||||||
|
|
||||||
if (size <= max_packet * 2 / 3) {
|
if (size <= max_packet * 2 / 3) {
|
||||||
struct sk_buff *bundler = buf_acquire(max_packet);
|
struct sk_buff *bundler = tipc_buf_acquire(max_packet);
|
||||||
struct tipc_msg bundler_hdr;
|
struct tipc_msg bundler_hdr;
|
||||||
|
|
||||||
if (bundler) {
|
if (bundler) {
|
||||||
@ -1312,7 +1315,7 @@ static int link_send_sections_long(struct port *sender,
|
|||||||
|
|
||||||
/* Prepare header of first fragment: */
|
/* Prepare header of first fragment: */
|
||||||
|
|
||||||
buf_chain = buf = buf_acquire(max_pkt);
|
buf_chain = buf = tipc_buf_acquire(max_pkt);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
buf->next = NULL;
|
buf->next = NULL;
|
||||||
@ -1369,7 +1372,7 @@ static int link_send_sections_long(struct port *sender,
|
|||||||
msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE);
|
msg_set_size(&fragm_hdr, fragm_sz + INT_H_SIZE);
|
||||||
msg_set_fragm_no(&fragm_hdr, ++fragm_no);
|
msg_set_fragm_no(&fragm_hdr, ++fragm_no);
|
||||||
prev = buf;
|
prev = buf;
|
||||||
buf = buf_acquire(fragm_sz + INT_H_SIZE);
|
buf = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -2145,7 +2148,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
|
|||||||
if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
|
if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
|
||||||
if (!l_ptr->proto_msg_queue) {
|
if (!l_ptr->proto_msg_queue) {
|
||||||
l_ptr->proto_msg_queue =
|
l_ptr->proto_msg_queue =
|
||||||
buf_acquire(sizeof(l_ptr->proto_msg));
|
tipc_buf_acquire(sizeof(l_ptr->proto_msg));
|
||||||
}
|
}
|
||||||
buf = l_ptr->proto_msg_queue;
|
buf = l_ptr->proto_msg_queue;
|
||||||
if (!buf)
|
if (!buf)
|
||||||
@ -2159,7 +2162,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
|
|||||||
|
|
||||||
msg_dbg(msg, ">>");
|
msg_dbg(msg, ">>");
|
||||||
|
|
||||||
buf = buf_acquire(msg_size);
|
buf = tipc_buf_acquire(msg_size);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2318,10 +2321,10 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
|
|||||||
* tipc_link_tunnel(): Send one message via a link belonging to
|
* tipc_link_tunnel(): Send one message via a link belonging to
|
||||||
* another bearer. Owner node is locked.
|
* another bearer. Owner node is locked.
|
||||||
*/
|
*/
|
||||||
void tipc_link_tunnel(struct link *l_ptr,
|
static void tipc_link_tunnel(struct link *l_ptr,
|
||||||
struct tipc_msg *tunnel_hdr,
|
struct tipc_msg *tunnel_hdr,
|
||||||
struct tipc_msg *msg,
|
struct tipc_msg *msg,
|
||||||
u32 selector)
|
u32 selector)
|
||||||
{
|
{
|
||||||
struct link *tunnel;
|
struct link *tunnel;
|
||||||
struct sk_buff *buf;
|
struct sk_buff *buf;
|
||||||
@ -2334,7 +2337,7 @@ void tipc_link_tunnel(struct link *l_ptr,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msg_set_size(tunnel_hdr, length + INT_H_SIZE);
|
msg_set_size(tunnel_hdr, length + INT_H_SIZE);
|
||||||
buf = buf_acquire(length + INT_H_SIZE);
|
buf = tipc_buf_acquire(length + INT_H_SIZE);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
warn("Link changeover error, "
|
warn("Link changeover error, "
|
||||||
"unable to send tunnel msg\n");
|
"unable to send tunnel msg\n");
|
||||||
@ -2380,7 +2383,7 @@ void tipc_link_changeover(struct link *l_ptr)
|
|||||||
if (!l_ptr->first_out) {
|
if (!l_ptr->first_out) {
|
||||||
struct sk_buff *buf;
|
struct sk_buff *buf;
|
||||||
|
|
||||||
buf = buf_acquire(INT_H_SIZE);
|
buf = tipc_buf_acquire(INT_H_SIZE);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE);
|
skb_copy_to_linear_data(buf, &tunnel_hdr, INT_H_SIZE);
|
||||||
msg_set_size(&tunnel_hdr, INT_H_SIZE);
|
msg_set_size(&tunnel_hdr, INT_H_SIZE);
|
||||||
@ -2441,7 +2444,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
|
|||||||
msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
|
msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); /* Update */
|
||||||
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
|
msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
|
||||||
msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
|
msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
|
||||||
outbuf = buf_acquire(length + INT_H_SIZE);
|
outbuf = tipc_buf_acquire(length + INT_H_SIZE);
|
||||||
if (outbuf == NULL) {
|
if (outbuf == NULL) {
|
||||||
warn("Link changeover error, "
|
warn("Link changeover error, "
|
||||||
"unable to send duplicate msg\n");
|
"unable to send duplicate msg\n");
|
||||||
@ -2477,7 +2480,7 @@ static struct sk_buff *buf_extract(struct sk_buff *skb, u32 from_pos)
|
|||||||
u32 size = msg_size(msg);
|
u32 size = msg_size(msg);
|
||||||
struct sk_buff *eb;
|
struct sk_buff *eb;
|
||||||
|
|
||||||
eb = buf_acquire(size);
|
eb = tipc_buf_acquire(size);
|
||||||
if (eb)
|
if (eb)
|
||||||
skb_copy_to_linear_data(eb, msg, size);
|
skb_copy_to_linear_data(eb, msg, size);
|
||||||
return eb;
|
return eb;
|
||||||
@ -2605,11 +2608,11 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tipc_link_send_long_buf: Entry for buffers needing fragmentation.
|
* link_send_long_buf: Entry for buffers needing fragmentation.
|
||||||
* The buffer is complete, inclusive total message length.
|
* The buffer is complete, inclusive total message length.
|
||||||
* Returns user data length.
|
* Returns user data length.
|
||||||
*/
|
*/
|
||||||
int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
|
static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
|
||||||
{
|
{
|
||||||
struct tipc_msg *inmsg = buf_msg(buf);
|
struct tipc_msg *inmsg = buf_msg(buf);
|
||||||
struct tipc_msg fragm_hdr;
|
struct tipc_msg fragm_hdr;
|
||||||
@ -2648,7 +2651,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
|
|||||||
fragm_sz = rest;
|
fragm_sz = rest;
|
||||||
msg_set_type(&fragm_hdr, LAST_FRAGMENT);
|
msg_set_type(&fragm_hdr, LAST_FRAGMENT);
|
||||||
}
|
}
|
||||||
fragm = buf_acquire(fragm_sz + INT_H_SIZE);
|
fragm = tipc_buf_acquire(fragm_sz + INT_H_SIZE);
|
||||||
if (fragm == NULL) {
|
if (fragm == NULL) {
|
||||||
warn("Link unable to fragment message\n");
|
warn("Link unable to fragment message\n");
|
||||||
dsz = -ENOMEM;
|
dsz = -ENOMEM;
|
||||||
@ -2753,7 +2756,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
|
|||||||
buf_discard(fbuf);
|
buf_discard(fbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
pbuf = buf_acquire(msg_size(imsg));
|
pbuf = tipc_buf_acquire(msg_size(imsg));
|
||||||
if (pbuf != NULL) {
|
if (pbuf != NULL) {
|
||||||
pbuf->next = *pending;
|
pbuf->next = *pending;
|
||||||
*pending = pbuf;
|
*pending = pbuf;
|
||||||
|
@ -225,7 +225,6 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *dest);
|
|||||||
void tipc_link_reset_fragments(struct link *l_ptr);
|
void tipc_link_reset_fragments(struct link *l_ptr);
|
||||||
int tipc_link_is_up(struct link *l_ptr);
|
int tipc_link_is_up(struct link *l_ptr);
|
||||||
int tipc_link_is_active(struct link *l_ptr);
|
int tipc_link_is_active(struct link *l_ptr);
|
||||||
void tipc_link_start(struct link *l_ptr);
|
|
||||||
u32 tipc_link_push_packet(struct link *l_ptr);
|
u32 tipc_link_push_packet(struct link *l_ptr);
|
||||||
void tipc_link_stop(struct link *l_ptr);
|
void tipc_link_stop(struct link *l_ptr);
|
||||||
struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
|
struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space, u16 cmd);
|
||||||
@ -239,9 +238,6 @@ int tipc_link_send_sections_fast(struct port* sender,
|
|||||||
struct iovec const *msg_sect,
|
struct iovec const *msg_sect,
|
||||||
const u32 num_sect,
|
const u32 num_sect,
|
||||||
u32 destnode);
|
u32 destnode);
|
||||||
int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
|
|
||||||
void tipc_link_tunnel(struct link *l_ptr, struct tipc_msg *tnl_hdr,
|
|
||||||
struct tipc_msg *msg, u32 selector);
|
|
||||||
void tipc_link_recv_bundle(struct sk_buff *buf);
|
void tipc_link_recv_bundle(struct sk_buff *buf);
|
||||||
int tipc_link_recv_fragment(struct sk_buff **pending,
|
int tipc_link_recv_fragment(struct sk_buff **pending,
|
||||||
struct sk_buff **fb,
|
struct sk_buff **fb,
|
||||||
|
@ -112,7 +112,7 @@ int tipc_msg_build(struct tipc_msg *hdr,
|
|||||||
return dsz;
|
return dsz;
|
||||||
}
|
}
|
||||||
|
|
||||||
*buf = buf_acquire(sz);
|
*buf = tipc_buf_acquire(sz);
|
||||||
if (!(*buf))
|
if (!(*buf))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
skb_copy_to_linear_data(*buf, hdr, hsz);
|
skb_copy_to_linear_data(*buf, hdr, hsz);
|
||||||
|
@ -98,7 +98,7 @@ static void publ_to_item(struct distr_item *i, struct publication *p)
|
|||||||
|
|
||||||
static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
|
static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
|
||||||
{
|
{
|
||||||
struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size);
|
struct sk_buff *buf = tipc_buf_acquire(LONG_H_SIZE + size);
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
|
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
|
@ -50,7 +50,8 @@ void node_print(struct print_buf *buf, struct tipc_node *n_ptr, char *str);
|
|||||||
static void node_lost_contact(struct tipc_node *n_ptr);
|
static void node_lost_contact(struct tipc_node *n_ptr);
|
||||||
static void node_established_contact(struct tipc_node *n_ptr);
|
static void node_established_contact(struct tipc_node *n_ptr);
|
||||||
|
|
||||||
struct tipc_node *tipc_nodes = NULL; /* sorted list of nodes within cluster */
|
/* sorted list of nodes within cluster */
|
||||||
|
static struct tipc_node *tipc_nodes = NULL;
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(node_create_lock);
|
static DEFINE_SPINLOCK(node_create_lock);
|
||||||
|
|
||||||
@ -587,22 +588,6 @@ void tipc_node_remove_router(struct tipc_node *n_ptr, u32 router)
|
|||||||
node_lost_contact(n_ptr);
|
node_lost_contact(n_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 tipc_available_nodes(const u32 domain)
|
|
||||||
{
|
|
||||||
struct tipc_node *n_ptr;
|
|
||||||
u32 cnt = 0;
|
|
||||||
|
|
||||||
read_lock_bh(&tipc_net_lock);
|
|
||||||
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
|
|
||||||
if (!tipc_in_scope(domain, n_ptr->addr))
|
|
||||||
continue;
|
|
||||||
if (tipc_node_is_up(n_ptr))
|
|
||||||
cnt++;
|
|
||||||
}
|
|
||||||
read_unlock_bh(&tipc_net_lock);
|
|
||||||
return cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
|
struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
|
||||||
{
|
{
|
||||||
u32 domain;
|
u32 domain;
|
||||||
|
@ -96,7 +96,6 @@ struct tipc_node {
|
|||||||
} bclink;
|
} bclink;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct tipc_node *tipc_nodes;
|
|
||||||
extern u32 tipc_own_tag;
|
extern u32 tipc_own_tag;
|
||||||
|
|
||||||
struct tipc_node *tipc_node_create(u32 addr);
|
struct tipc_node *tipc_node_create(u32 addr);
|
||||||
|
234
net/tipc/port.c
234
net/tipc/port.c
@ -293,34 +293,6 @@ int tipc_deleteport(u32 ref)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* tipc_get_port() - return port associated with 'ref'
|
|
||||||
*
|
|
||||||
* Note: Port is not locked.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct tipc_port *tipc_get_port(const u32 ref)
|
|
||||||
{
|
|
||||||
return (struct tipc_port *)tipc_ref_deref(ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* tipc_get_handle - return user handle associated to port 'ref'
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *tipc_get_handle(const u32 ref)
|
|
||||||
{
|
|
||||||
struct port *p_ptr;
|
|
||||||
void * handle;
|
|
||||||
|
|
||||||
p_ptr = tipc_port_lock(ref);
|
|
||||||
if (!p_ptr)
|
|
||||||
return NULL;
|
|
||||||
handle = p_ptr->publ.usr_handle;
|
|
||||||
tipc_port_unlock(p_ptr);
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int port_unreliable(struct port *p_ptr)
|
static int port_unreliable(struct port *p_ptr)
|
||||||
{
|
{
|
||||||
return msg_src_droppable(&p_ptr->publ.phdr);
|
return msg_src_droppable(&p_ptr->publ.phdr);
|
||||||
@ -392,7 +364,7 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
|
|||||||
struct sk_buff *buf;
|
struct sk_buff *buf;
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
|
|
||||||
buf = buf_acquire(LONG_H_SIZE);
|
buf = tipc_buf_acquire(LONG_H_SIZE);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
msg = buf_msg(buf);
|
msg = buf_msg(buf);
|
||||||
tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode);
|
tipc_msg_init(msg, usr, type, LONG_H_SIZE, destnode);
|
||||||
@ -433,7 +405,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
|
|||||||
hdr_sz = MCAST_H_SIZE;
|
hdr_sz = MCAST_H_SIZE;
|
||||||
else
|
else
|
||||||
hdr_sz = LONG_H_SIZE;
|
hdr_sz = LONG_H_SIZE;
|
||||||
rbuf = buf_acquire(data_sz + hdr_sz);
|
rbuf = tipc_buf_acquire(data_sz + hdr_sz);
|
||||||
if (rbuf == NULL) {
|
if (rbuf == NULL) {
|
||||||
buf_discard(buf);
|
buf_discard(buf);
|
||||||
return data_sz;
|
return data_sz;
|
||||||
@ -1242,50 +1214,13 @@ int tipc_shutdown(u32 ref)
|
|||||||
return tipc_disconnect(ref);
|
return tipc_disconnect(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
int tipc_isconnected(u32 ref, int *isconnected)
|
|
||||||
{
|
|
||||||
struct port *p_ptr;
|
|
||||||
|
|
||||||
p_ptr = tipc_port_lock(ref);
|
|
||||||
if (!p_ptr)
|
|
||||||
return -EINVAL;
|
|
||||||
*isconnected = p_ptr->publ.connected;
|
|
||||||
tipc_port_unlock(p_ptr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int tipc_peer(u32 ref, struct tipc_portid *peer)
|
|
||||||
{
|
|
||||||
struct port *p_ptr;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
p_ptr = tipc_port_lock(ref);
|
|
||||||
if (!p_ptr)
|
|
||||||
return -EINVAL;
|
|
||||||
if (p_ptr->publ.connected) {
|
|
||||||
peer->ref = port_peerport(p_ptr);
|
|
||||||
peer->node = port_peernode(p_ptr);
|
|
||||||
res = 0;
|
|
||||||
} else
|
|
||||||
res = -ENOTCONN;
|
|
||||||
tipc_port_unlock(p_ptr);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
int tipc_ref_valid(u32 ref)
|
|
||||||
{
|
|
||||||
/* Works irrespective of type */
|
|
||||||
return !!tipc_ref_deref(ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tipc_port_recv_sections(): Concatenate and deliver sectioned
|
* tipc_port_recv_sections(): Concatenate and deliver sectioned
|
||||||
* message for this node.
|
* message for this node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
|
static int tipc_port_recv_sections(struct port *sender, unsigned int num_sect,
|
||||||
struct iovec const *msg_sect)
|
struct iovec const *msg_sect)
|
||||||
{
|
{
|
||||||
struct sk_buff *buf;
|
struct sk_buff *buf;
|
||||||
int res;
|
int res;
|
||||||
@ -1335,66 +1270,17 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
|
|||||||
return -ELINKCONG;
|
return -ELINKCONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* tipc_send_buf - send message buffer on connection
|
|
||||||
*/
|
|
||||||
|
|
||||||
int tipc_send_buf(u32 ref, struct sk_buff *buf, unsigned int dsz)
|
|
||||||
{
|
|
||||||
struct port *p_ptr;
|
|
||||||
struct tipc_msg *msg;
|
|
||||||
u32 destnode;
|
|
||||||
u32 hsz;
|
|
||||||
u32 sz;
|
|
||||||
u32 res;
|
|
||||||
|
|
||||||
p_ptr = tipc_port_deref(ref);
|
|
||||||
if (!p_ptr || !p_ptr->publ.connected)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
msg = &p_ptr->publ.phdr;
|
|
||||||
hsz = msg_hdr_sz(msg);
|
|
||||||
sz = hsz + dsz;
|
|
||||||
msg_set_size(msg, sz);
|
|
||||||
if (skb_cow(buf, hsz))
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
skb_push(buf, hsz);
|
|
||||||
skb_copy_to_linear_data(buf, msg, hsz);
|
|
||||||
destnode = msg_destnode(msg);
|
|
||||||
p_ptr->publ.congested = 1;
|
|
||||||
if (!tipc_port_congested(p_ptr)) {
|
|
||||||
if (likely(destnode != tipc_own_addr))
|
|
||||||
res = tipc_send_buf_fast(buf, destnode);
|
|
||||||
else {
|
|
||||||
tipc_port_recv_msg(buf);
|
|
||||||
res = sz;
|
|
||||||
}
|
|
||||||
if (likely(res != -ELINKCONG)) {
|
|
||||||
port_incr_out_seqno(p_ptr);
|
|
||||||
p_ptr->sent++;
|
|
||||||
p_ptr->publ.congested = 0;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (port_unreliable(p_ptr)) {
|
|
||||||
p_ptr->publ.congested = 0;
|
|
||||||
return dsz;
|
|
||||||
}
|
|
||||||
return -ELINKCONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tipc_forward2name - forward message sections to port name
|
* tipc_forward2name - forward message sections to port name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int tipc_forward2name(u32 ref,
|
static int tipc_forward2name(u32 ref,
|
||||||
struct tipc_name const *name,
|
struct tipc_name const *name,
|
||||||
u32 domain,
|
u32 domain,
|
||||||
u32 num_sect,
|
u32 num_sect,
|
||||||
struct iovec const *msg_sect,
|
struct iovec const *msg_sect,
|
||||||
struct tipc_portid const *orig,
|
struct tipc_portid const *orig,
|
||||||
unsigned int importance)
|
unsigned int importance)
|
||||||
{
|
{
|
||||||
struct port *p_ptr;
|
struct port *p_ptr;
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
@ -1456,90 +1342,16 @@ int tipc_send2name(u32 ref,
|
|||||||
TIPC_PORT_IMPORTANCE);
|
TIPC_PORT_IMPORTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* tipc_forward_buf2name - forward message buffer to port name
|
|
||||||
*/
|
|
||||||
|
|
||||||
int tipc_forward_buf2name(u32 ref,
|
|
||||||
struct tipc_name const *name,
|
|
||||||
u32 domain,
|
|
||||||
struct sk_buff *buf,
|
|
||||||
unsigned int dsz,
|
|
||||||
struct tipc_portid const *orig,
|
|
||||||
unsigned int importance)
|
|
||||||
{
|
|
||||||
struct port *p_ptr;
|
|
||||||
struct tipc_msg *msg;
|
|
||||||
u32 destnode = domain;
|
|
||||||
u32 destport;
|
|
||||||
int res;
|
|
||||||
|
|
||||||
p_ptr = (struct port *)tipc_ref_deref(ref);
|
|
||||||
if (!p_ptr || p_ptr->publ.connected)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
msg = &p_ptr->publ.phdr;
|
|
||||||
if (importance <= TIPC_CRITICAL_IMPORTANCE)
|
|
||||||
msg_set_importance(msg, importance);
|
|
||||||
msg_set_type(msg, TIPC_NAMED_MSG);
|
|
||||||
msg_set_orignode(msg, orig->node);
|
|
||||||
msg_set_origport(msg, orig->ref);
|
|
||||||
msg_set_nametype(msg, name->type);
|
|
||||||
msg_set_nameinst(msg, name->instance);
|
|
||||||
msg_set_lookup_scope(msg, tipc_addr_scope(domain));
|
|
||||||
msg_set_hdr_sz(msg, LONG_H_SIZE);
|
|
||||||
msg_set_size(msg, LONG_H_SIZE + dsz);
|
|
||||||
destport = tipc_nametbl_translate(name->type, name->instance, &destnode);
|
|
||||||
msg_set_destnode(msg, destnode);
|
|
||||||
msg_set_destport(msg, destport);
|
|
||||||
msg_dbg(msg, "forw2name ==> ");
|
|
||||||
if (skb_cow(buf, LONG_H_SIZE))
|
|
||||||
return -ENOMEM;
|
|
||||||
skb_push(buf, LONG_H_SIZE);
|
|
||||||
skb_copy_to_linear_data(buf, msg, LONG_H_SIZE);
|
|
||||||
msg_dbg(buf_msg(buf),"PREP:");
|
|
||||||
if (likely(destport)) {
|
|
||||||
p_ptr->sent++;
|
|
||||||
if (destnode == tipc_own_addr)
|
|
||||||
return tipc_port_recv_msg(buf);
|
|
||||||
res = tipc_send_buf_fast(buf, destnode);
|
|
||||||
if (likely(res != -ELINKCONG))
|
|
||||||
return res;
|
|
||||||
if (port_unreliable(p_ptr))
|
|
||||||
return dsz;
|
|
||||||
return -ELINKCONG;
|
|
||||||
}
|
|
||||||
return tipc_reject_msg(buf, TIPC_ERR_NO_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* tipc_send_buf2name - send message buffer to port name
|
|
||||||
*/
|
|
||||||
|
|
||||||
int tipc_send_buf2name(u32 ref,
|
|
||||||
struct tipc_name const *dest,
|
|
||||||
u32 domain,
|
|
||||||
struct sk_buff *buf,
|
|
||||||
unsigned int dsz)
|
|
||||||
{
|
|
||||||
struct tipc_portid orig;
|
|
||||||
|
|
||||||
orig.ref = ref;
|
|
||||||
orig.node = tipc_own_addr;
|
|
||||||
return tipc_forward_buf2name(ref, dest, domain, buf, dsz, &orig,
|
|
||||||
TIPC_PORT_IMPORTANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tipc_forward2port - forward message sections to port identity
|
* tipc_forward2port - forward message sections to port identity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int tipc_forward2port(u32 ref,
|
static int tipc_forward2port(u32 ref,
|
||||||
struct tipc_portid const *dest,
|
struct tipc_portid const *dest,
|
||||||
unsigned int num_sect,
|
unsigned int num_sect,
|
||||||
struct iovec const *msg_sect,
|
struct iovec const *msg_sect,
|
||||||
struct tipc_portid const *orig,
|
struct tipc_portid const *orig,
|
||||||
unsigned int importance)
|
unsigned int importance)
|
||||||
{
|
{
|
||||||
struct port *p_ptr;
|
struct port *p_ptr;
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
@ -1591,12 +1403,12 @@ int tipc_send2port(u32 ref,
|
|||||||
/**
|
/**
|
||||||
* tipc_forward_buf2port - forward message buffer to port identity
|
* tipc_forward_buf2port - forward message buffer to port identity
|
||||||
*/
|
*/
|
||||||
int tipc_forward_buf2port(u32 ref,
|
static int tipc_forward_buf2port(u32 ref,
|
||||||
struct tipc_portid const *dest,
|
struct tipc_portid const *dest,
|
||||||
struct sk_buff *buf,
|
struct sk_buff *buf,
|
||||||
unsigned int dsz,
|
unsigned int dsz,
|
||||||
struct tipc_portid const *orig,
|
struct tipc_portid const *orig,
|
||||||
unsigned int importance)
|
unsigned int importance)
|
||||||
{
|
{
|
||||||
struct port *p_ptr;
|
struct port *p_ptr;
|
||||||
struct tipc_msg *msg;
|
struct tipc_msg *msg;
|
||||||
|
@ -109,8 +109,6 @@ struct port {
|
|||||||
extern spinlock_t tipc_port_list_lock;
|
extern spinlock_t tipc_port_list_lock;
|
||||||
struct port_list;
|
struct port_list;
|
||||||
|
|
||||||
int tipc_port_recv_sections(struct port *p_ptr, u32 num_sect,
|
|
||||||
struct iovec const *msg_sect);
|
|
||||||
int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
|
int tipc_port_reject_sections(struct port *p_ptr, struct tipc_msg *hdr,
|
||||||
struct iovec const *msg_sect, u32 num_sect,
|
struct iovec const *msg_sect, u32 num_sect,
|
||||||
int err);
|
int err);
|
||||||
|
@ -282,23 +282,6 @@ void *tipc_ref_lock(u32 ref)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* tipc_ref_unlock - unlock referenced object
|
|
||||||
*/
|
|
||||||
|
|
||||||
void tipc_ref_unlock(u32 ref)
|
|
||||||
{
|
|
||||||
if (likely(tipc_ref_table.entries)) {
|
|
||||||
struct reference *entry;
|
|
||||||
|
|
||||||
entry = &tipc_ref_table.entries[ref &
|
|
||||||
tipc_ref_table.index_mask];
|
|
||||||
if (likely((entry->ref == ref) && (entry->object)))
|
|
||||||
spin_unlock_bh(&entry->lock);
|
|
||||||
else
|
|
||||||
err("Attempt to unlock non-existent reference\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tipc_ref_deref - return pointer referenced object (without locking it)
|
* tipc_ref_deref - return pointer referenced object (without locking it)
|
||||||
|
@ -44,7 +44,6 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock);
|
|||||||
void tipc_ref_discard(u32 ref);
|
void tipc_ref_discard(u32 ref);
|
||||||
|
|
||||||
void *tipc_ref_lock(u32 ref);
|
void *tipc_ref_lock(u32 ref);
|
||||||
void tipc_ref_unlock(u32 ref);
|
|
||||||
void *tipc_ref_deref(u32 ref);
|
void *tipc_ref_deref(u32 ref);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -598,12 +598,3 @@ void tipc_subscr_stop(void)
|
|||||||
topsrv.user_ref = 0;
|
topsrv.user_ref = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int tipc_ispublished(struct tipc_name const *name)
|
|
||||||
{
|
|
||||||
u32 domain = 0;
|
|
||||||
|
|
||||||
return tipc_nametbl_translate(name->type, name->instance, &domain) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -160,14 +160,3 @@ u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u32 tipc_zone_next_node(u32 addr)
|
|
||||||
{
|
|
||||||
struct cluster *c_ptr = tipc_cltr_find(addr);
|
|
||||||
|
|
||||||
if (c_ptr)
|
|
||||||
return tipc_cltr_next_node(c_ptr, addr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest);
|
|||||||
struct _zone *tipc_zone_create(u32 addr);
|
struct _zone *tipc_zone_create(u32 addr);
|
||||||
void tipc_zone_delete(struct _zone *z_ptr);
|
void tipc_zone_delete(struct _zone *z_ptr);
|
||||||
void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
|
void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr);
|
||||||
u32 tipc_zone_next_node(u32 addr);
|
|
||||||
|
|
||||||
static inline struct _zone *tipc_zone_find(u32 addr)
|
static inline struct _zone *tipc_zone_find(u32 addr)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user