aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/port.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--net/tipc/port.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index f508614ca59b..2f5806410c64 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -242,7 +242,8 @@ u32 tipc_createport_raw(void *usr_handle,
p_ptr->publ.max_pkt = MAX_PKT_DEFAULT;
p_ptr->publ.ref = ref;
msg = &p_ptr->publ.phdr;
- msg_init(msg, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0);
+ msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE,
+ 0);
msg_set_orignode(msg, tipc_own_addr);
msg_set_prevnode(msg, tipc_own_addr);
msg_set_origport(msg, ref);
@@ -413,13 +414,6 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
return buf;
}
-int tipc_set_msg_option(struct tipc_port *tp_ptr, const char *opt, const u32 sz)
-{
- msg_expand(&tp_ptr->phdr, msg_destnode(&tp_ptr->phdr));
- msg_set_options(&tp_ptr->phdr, opt, sz);
- return TIPC_OK;
-}
-
int tipc_reject_msg(struct sk_buff *buf, u32 err)
{
struct tipc_msg *msg = buf_msg(buf);
@@ -632,7 +626,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
msg_orignode(msg),
msg_destport(msg),
tipc_own_addr,
- DATA_HIGH,
+ TIPC_HIGH_IMPORTANCE,
TIPC_CONN_MSG,
err,
0,
@@ -1246,6 +1240,28 @@ exit:
return res;
}
+/**
+ * tipc_disconnect_port - disconnect port from peer
+ *
+ * Port must be locked.
+ */
+
+int tipc_disconnect_port(struct tipc_port *tp_ptr)
+{
+ int res;
+
+ if (tp_ptr->connected) {
+ tp_ptr->connected = 0;
+ /* let timer expire on it's own to avoid deadlock! */
+ tipc_nodesub_unsubscribe(
+ &((struct port *)tp_ptr)->subscription);
+ res = TIPC_OK;
+ } else {
+ res = -ENOTCONN;
+ }
+ return res;
+}
+
/*
* tipc_disconnect(): Disconnect port form peer.
* This is a node local operation.
@@ -1254,17 +1270,12 @@ exit:
int tipc_disconnect(u32 ref)
{
struct port *p_ptr;
- int res = -ENOTCONN;
+ int res;
p_ptr = tipc_port_lock(ref);
if (!p_ptr)
return -EINVAL;
- if (p_ptr->publ.connected) {
- p_ptr->publ.connected = 0;
- /* let timer expire on it's own to avoid deadlock! */
- tipc_nodesub_unsubscribe(&p_ptr->subscription);
- res = TIPC_OK;
- }
+ res = tipc_disconnect_port((struct tipc_port *)p_ptr);
tipc_port_unlock(p_ptr);
return res;
}