Skip to contentSkip to conversation

tipc: make use of kernel threads to simplify things

PATCH Superseded Paul Gortmaker 6 participants 28 messages May 30, 2013 – Jun 4, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover tipc: make use of kernel threads to simplify things

The biggest change here is the one where we make use of the fact that linux supports kernel threads and do the server like operations within kernel threads. As Jon says:

We remove the last remnants of the TIPC native API, to make it possible to simplify locking policy and solve a problem with lost topology events.

First, we introduce a socket-based alternative to the native API.

Second, we convert the two remaining users of the native API, the TIPC internal topology server and the configuarion server, to use the new API.

Third, we remove the remaining code pertaining to the native API.

We also ditch another Kconfig parameter, in favour of having it being able to be set at boot/module load time vs requiring a reconfig/recompile.

In addition, there is a follow up to fix an issue that Neil had highlighted during the previous round of TIPC commits.

I've tested this collection of commits between 32 and 64 bit x86 machines using the standard tipc test suite.

Paul.
---
Cc: Neil Horman <[email protected]>

The following changes since commit cbb963deed7bbf206f5077ab5742bee00ceefa46:

net/usb/kalmia: use %*phC to dump small buffers (2013-05-29 00:35:20 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git tipc_net-next

for you to fetch changes up to 9ea5c43104d88c985d95bf82f97097ae8335f3fc:

tipc: cosmetic realignment of function arguments (2013-05-30 15:30:54 -0400)

----------------------------------------------------------------
Erik Hugne (2):
tipc: Add "max_ports" configuration parameter
tipc: allow implicit connect for stream sockets

Jon Maloy (1):
tipc: change socket buffer overflow control to respect sk_rcvbuf

Paul Gortmaker (1):
tipc: cosmetic realignment of function arguments

Ying Xue (8):
tipc: introduce new TIPC server infrastructure
tipc: convert topology server to use new server facility
tipc: convert configuration server to use new server facility
tipc: delete code orphaned by new server infrastructure
tipc: remove user_port instance from tipc_port structure
tipc: rename tipc_createport_raw to tipc_createport
tipc: convert config_lock from spinlock to mutex
tipc: save sock structure pointer instead of void pointer to tipc_port

 net/tipc/Kconfig       |  12 -
 net/tipc/Makefile      |   2 +-
 net/tipc/bcast.c       |   3 +-
 net/tipc/bcast.h       |   3 +-
 net/tipc/config.c      | 139 ++++--------
 net/tipc/core.c        |  19 +-
 net/tipc/core.h        |  14 +-
 net/tipc/discover.c    |   7 +-
 net/tipc/eth_media.c   |   2 +-
 net/tipc/link.c        |  72 ++----
 net/tipc/msg.c         |  19 +-
 net/tipc/msg.h         |   8 +-
 net/tipc/name_table.c  |  10 +-
 net/tipc/name_table.h  |  11 +-
 net/tipc/node_subscr.c |   2 +-
 net/tipc/port.c        | 320 +-------------------------
 net/tipc/port.h        |  83 +------
 net/tipc/server.c      | 591 +++++++++++++++++++++++++++++++++++++++++++++++++
 net/tipc/server.h      |  92 ++++++++
 net/tipc/socket.c      | 139 +++++++++---
 net/tipc/subscr.c      | 348 ++++++++---------------------
 net/tipc/subscr.h      |  21 +-
 22 files changed, 1040 insertions(+), 877 deletions(-)
 create mode 100644 net/tipc/server.c
 create mode 100644 net/tipc/server.h
#1 lore raw

PATCH 1/12 tipc: change socket buffer overflow control to respect sk_rcvbuf

From: Jon Maloy <[email protected]>

As per feedback from the netdev community, we change the buffer overflow protection algorithm in receiving sockets so that it always respects the nominal upper limit set in sk_rcvbuf.

Instead of scaling up from a small sk_rcvbuf value, which leads to violation of the configured sk_rcvbuf limit, we now calculate the weighted per-message limit by scaling down from a much bigger value, still in the same field, according to the importance priority of the received message.

---
 net/tipc/socket.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/socket.c +7 -6
index 515ce38..2dfabc7 100644
@@ -1,7 +1,7 @@
 /*
  * net/tipc/socket.c: TIPC socket API
  *
- * Copyright (c) 2001-2007, 2012 Ericsson AB
+ * Copyright (c) 2001-2007, 2012-2013, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2012, Wind River Systems
  * All rights reserved.
  *
@@ -203,6 +203,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
 
 	sock_init_data(sock, sk);
 	sk->sk_backlog_rcv = backlog_rcv;
+	sk->sk_rcvbuf = CONN_OVERLOAD_LIMIT;
 	sk->sk_data_ready = tipc_data_ready;
 	sk->sk_write_space = tipc_write_space;
 	tipc_sk(sk)->p = tp_ptr;
@@ -1233,10 +1234,10 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
  * For all connectionless messages, by default new queue limits are
  * as belows:
  *
- * TIPC_LOW_IMPORTANCE       (5MB)
- * TIPC_MEDIUM_IMPORTANCE    (10MB)
- * TIPC_HIGH_IMPORTANCE      (20MB)
- * TIPC_CRITICAL_IMPORTANCE  (40MB)
+ * TIPC_LOW_IMPORTANCE       (4 MB)
+ * TIPC_MEDIUM_IMPORTANCE    (8 MB)
+ * TIPC_HIGH_IMPORTANCE      (16 MB)
+ * TIPC_CRITICAL_IMPORTANCE  (32 MB)
  *
  * Returns overload limit according to corresponding message importance
  */
@@ -1248,7 +1249,7 @@ static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf)
 	if (msg_connected(msg))
 		limit = CONN_OVERLOAD_LIMIT;
 	else
-		limit = sk->sk_rcvbuf << (msg_importance(msg) + 5);
+		limit = sk->sk_rcvbuf >> 4 << msg_importance(msg);
 	return limit;
 }
 
Signature · 1 line
1.8.1.2
#2 lore raw

Re: [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf

Quoted 33 lines · Paul Gortmaker

From: Jon Maloy <[email protected]>

As per feedback from the netdev community, we change the buffer overflow protection algorithm in receiving sockets so that it always respects the nominal upper limit set in sk_rcvbuf.

Instead of scaling up from a small sk_rcvbuf value, which leads to violation of the configured sk_rcvbuf limit, we now calculate the weighted per-message limit by scaling down from a much bigger value, still in the same field, according to the importance priority of the received message.

---
 net/tipc/socket.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/socket.c +1 -1
index 515ce38..2dfabc7 100644
@@ -1,7 +1,7 @@
 /*
  * net/tipc/socket.c: TIPC socket API
  *
- * Copyright (c) 2001-2007, 2012 Ericsson AB
+ * Copyright (c) 2001-2007, 2012-2013, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2012, Wind River Systems
  * All rights reserved.
  *

net/tipc/socket.c static int tipc_create(struct net *net, struct socket *sock, int protocol, · line 206

Quoted 4 lines
net/tipc/socket.c +1 -0
@@ -203,6 +203,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
 
 	sock_init_data(sock, sk);
 	sk->sk_backlog_rcv = backlog_rcv;
+	sk->sk_rcvbuf = CONN_OVERLOAD_LIMIT;

The last time Jon and I discussed this, I thought the consensus was to export sk_rcvbuf via its own sysctl, or tie it to sysctl_rmem (while requiring a protocol specific minimum on top of that), so administrators on memory constrained systems didn't wonder why their sysctl changes weren't being honored.

Quoted 19 lines
net/tipc/socket.c +4 -4
 	sk->sk_data_ready = tipc_data_ready;
 	sk->sk_write_space = tipc_write_space;
 	tipc_sk(sk)->p = tp_ptr;
@@ -1233,10 +1234,10 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
  * For all connectionless messages, by default new queue limits are
  * as belows:
  *
- * TIPC_LOW_IMPORTANCE       (5MB)
- * TIPC_MEDIUM_IMPORTANCE    (10MB)
- * TIPC_HIGH_IMPORTANCE      (20MB)
- * TIPC_CRITICAL_IMPORTANCE  (40MB)
+ * TIPC_LOW_IMPORTANCE       (4 MB)
+ * TIPC_MEDIUM_IMPORTANCE    (8 MB)
+ * TIPC_HIGH_IMPORTANCE      (16 MB)
+ * TIPC_CRITICAL_IMPORTANCE  (32 MB)
  *
  * Returns overload limit according to corresponding message importance
  */

net/tipc/socket.c static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf) · line 1252

Quoted 5 lines
net/tipc/socket.c +1 -1
@@ -1248,7 +1249,7 @@ static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf)
 	if (msg_connected(msg))
 		limit = CONN_OVERLOAD_LIMIT;
 	else
-		limit = sk->sk_rcvbuf << (msg_importance(msg) + 5);
+		limit = sk->sk_rcvbuf >> 4 << msg_importance(msg);

I still don't like this. I would much prefer that the minimum sk_rcvbuf value were defaulted to a value such that:
sk->sk_rcvbuf >> 4 << msg_importance(TIPC_CRITICAL_IMPORTANCE) = sk->sk_rcvbuf i.e. that the minimum sk_rcvbuf size allowed was equal to the size needed to hold the maximum number of critical messages TIPC required, and have less important messages be a fraction of that. that, in conjunction with the above default setting would allow for administrative tunability, while still giving you the receive space you need I think.

This is much better than what you have there currently though.

Regards
Neil

Quoted 7 lines
net/tipc/socket.c +0 -0
 	return limit;
 }
 
Signature · 1 line
1.8.1.2
#3 lore raw

Re: [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf

Quoted 35 lines · Neil Horman
Quoted 34 lines · Paul Gortmaker

From: Jon Maloy <[email protected]>

As per feedback from the netdev community, we change the buffer overflow protection algorithm in receiving sockets so that it always respects the nominal upper limit set in sk_rcvbuf.

Instead of scaling up from a small sk_rcvbuf value, which leads to violation of the configured sk_rcvbuf limit, we now calculate the weighted per-message limit by scaling down from a much bigger value, still in the same field, according to the importance priority of the received message.

---
 net/tipc/socket.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/socket.c +1 -1
index 515ce38..2dfabc7 100644
@@ -1,7 +1,7 @@
 /*
  * net/tipc/socket.c: TIPC socket API
  *
- * Copyright (c) 2001-2007, 2012 Ericsson AB
+ * Copyright (c) 2001-2007, 2012-2013, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2012, Wind River Systems
  * All rights reserved.
  *
@@ -203,6 +203,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
 
Quoted 8 lines

net/tipc/socket.c static int tipc_create(struct net *net, struct socket *sock, int protocol, · line 206

Quoted 3 lines
net/tipc/socket.c +1 -0
 	sock_init_data(sock, sk);
 	sk->sk_backlog_rcv = backlog_rcv;
+	sk->sk_rcvbuf = CONN_OVERLOAD_LIMIT;

The last time Jon and I discussed this, I thought the consensus was to export sk_rcvbuf via its own sysctl, or tie it to sysctl_rmem (while requiring a protocol specific minimum on top of that), so administrators on memory constrained systems didn't wonder why their sysctl changes weren't being honored.

Yes, your suggestion is reasonable, and I prefer to involve net.tipc.sysctl_rmem. But I have one question about it:

As you suggested as belows, the default value of sk->sk_rcvbuf is set to sk->sk_rcvbuf >> 4 << msg_importance(TIPC_CRITICAL_IMPORTANCE), that is, sk->sk_rcvbuf is about 32MB.

However, please see below code:

int sock_setsockopt()
{
...

	        case SO_RCVBUF:
                /* Don't error on this BSD doesn't and if you think
                 * about it this is right. Otherwise apps have to
                 * play 'guess the biggest size' games. RCVBUF/SNDBUF
                 * are treated in BSD as hints
                 */
                val = min_t(u32, val, sysctl_rmem_max);

set_rcvbuf:
sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
/*
* We double it on the way in to account for
* "struct sk_buff" etc. overhead. Applications
* assume that the SO_RCVBUF setting they make will
* allow that much actual data to be received on that
* socket.
*
* Applications are unaware that "struct sk_buff" and
* other overheads allocate from the receive buffer
* during socket buffer allocation.
*
* And after considering the possible alternatives,
* returning the value we actually used in getsockopt
* is the most desirable behavior.
*/
sk->sk_rcvbuf = max_t(u32, val * 2, SOCK_MIN_RCVBUF); break;
...
}

Quoted 1 line

From above logic of setting sk->sk_rcvbuf with SO_RCVBUF, it only

permits the maximum value of sk->sk_rcvbuf to sysctl_rmem_max * 2(ie, about 400KB normally).

So, even if the default value of sk->sk_rcvbuf is set to 32MB with net.tipc.sysctl_rmem, a bit smaller value than the default value can never be set to sk->sk_rcvbuf successfully with SO_RCVBUF option.

How can we avoid the limit?

Regards,
Ying

Quoted 47 lines
Quoted 20 lines
net/tipc/socket.c +4 -4
 	sk->sk_data_ready = tipc_data_ready;
 	sk->sk_write_space = tipc_write_space;
 	tipc_sk(sk)->p = tp_ptr;
@@ -1233,10 +1234,10 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
  * For all connectionless messages, by default new queue limits are
  * as belows:
  *
- * TIPC_LOW_IMPORTANCE       (5MB)
- * TIPC_MEDIUM_IMPORTANCE    (10MB)
- * TIPC_HIGH_IMPORTANCE      (20MB)
- * TIPC_CRITICAL_IMPORTANCE  (40MB)
+ * TIPC_LOW_IMPORTANCE       (4 MB)
+ * TIPC_MEDIUM_IMPORTANCE    (8 MB)
+ * TIPC_HIGH_IMPORTANCE      (16 MB)
+ * TIPC_CRITICAL_IMPORTANCE  (32 MB)
  *
  * Returns overload limit according to corresponding message importance
  */

net/tipc/socket.c static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf) · line 1252

Quoted 5 lines
net/tipc/socket.c +1 -1
@@ -1248,7 +1249,7 @@ static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *buf)
 	if (msg_connected(msg))
 		limit = CONN_OVERLOAD_LIMIT;
 	else
-		limit = sk->sk_rcvbuf << (msg_importance(msg) + 5);
+		limit = sk->sk_rcvbuf >> 4 << msg_importance(msg);

I still don't like this. I would much prefer that the minimum sk_rcvbuf value were defaulted to a value such that:
sk->sk_rcvbuf >> 4 << msg_importance(TIPC_CRITICAL_IMPORTANCE) = sk->sk_rcvbuf i.e. that the minimum sk_rcvbuf size allowed was equal to the size needed to hold the maximum number of critical messages TIPC required, and have less important messages be a fraction of that. that, in conjunction with the above default setting would allow for administrative tunability, while still giving you the receive space you need I think.

This is much better than what you have there currently though.

Regards
Neil

Quoted 7 lines
net/tipc/socket.c +0 -0
 	return limit;
 }
 
Signature · 1 line
1.8.1.2
#4 lore raw

Re: [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf

Quoted 90 lines · Ying Xue
Quoted 35 lines · Neil Horman
Quoted 34 lines · Paul Gortmaker

From: Jon Maloy <[email protected]>

As per feedback from the netdev community, we change the buffer overflow protection algorithm in receiving sockets so that it always respects the nominal upper limit set in sk_rcvbuf.

Instead of scaling up from a small sk_rcvbuf value, which leads to violation of the configured sk_rcvbuf limit, we now calculate the weighted per-message limit by scaling down from a much bigger value, still in the same field, according to the importance priority of the received message.

---
 net/tipc/socket.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/socket.c +1 -1
index 515ce38..2dfabc7 100644
@@ -1,7 +1,7 @@
 /*
  * net/tipc/socket.c: TIPC socket API
  *
- * Copyright (c) 2001-2007, 2012 Ericsson AB
+ * Copyright (c) 2001-2007, 2012-2013, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2012, Wind River Systems
  * All rights reserved.
  *
@@ -203,6 +203,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
 
Quoted 8 lines

net/tipc/socket.c static int tipc_create(struct net *net, struct socket *sock, int protocol, · line 206

Quoted 3 lines
net/tipc/socket.c +1 -0
 	sock_init_data(sock, sk);
 	sk->sk_backlog_rcv = backlog_rcv;
+	sk->sk_rcvbuf = CONN_OVERLOAD_LIMIT;

The last time Jon and I discussed this, I thought the consensus was to export sk_rcvbuf via its own sysctl, or tie it to sysctl_rmem (while requiring a protocol specific minimum on top of that), so administrators on memory constrained systems didn't wonder why their sysctl changes weren't being honored.

Yes, your suggestion is reasonable, and I prefer to involve net.tipc.sysctl_rmem. But I have one question about it:

As you suggested as belows, the default value of sk->sk_rcvbuf is set to sk->sk_rcvbuf >> 4 << msg_importance(TIPC_CRITICAL_IMPORTANCE), that is, sk->sk_rcvbuf is about 32MB.

However, please see below code:

int sock_setsockopt()
{
...

	        case SO_RCVBUF:
                /* Don't error on this BSD doesn't and if you think
                 * about it this is right. Otherwise apps have to
                 * play 'guess the biggest size' games. RCVBUF/SNDBUF
                 * are treated in BSD as hints
                 */
                val = min_t(u32, val, sysctl_rmem_max);

set_rcvbuf:
sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
/*
* We double it on the way in to account for
* "struct sk_buff" etc. overhead. Applications
* assume that the SO_RCVBUF setting they make will
* allow that much actual data to be received on that
* socket.
*
* Applications are unaware that "struct sk_buff" and
* other overheads allocate from the receive buffer
* during socket buffer allocation.
*
* And after considering the possible alternatives,
* returning the value we actually used in getsockopt
* is the most desirable behavior.
*/
sk->sk_rcvbuf = max_t(u32, val * 2, SOCK_MIN_RCVBUF); break;
...
}

From above logic of setting sk->sk_rcvbuf with SO_RCVBUF, it only permits the maximum value of sk->sk_rcvbuf to sysctl_rmem_max * 2(ie, about 400KB normally).

Quoted 6 lines

So, even if the default value of sk->sk_rcvbuf is set to 32MB with net.tipc.sysctl_rmem, a bit smaller value than the default value can never be set to sk->sk_rcvbuf successfully with SO_RCVBUF option.

How can we avoid the limit?

By administratively adjusting sysctl_rmem_max to be a sufficiently large value such that using SO_RCVBUF won't be clamed to a lower limit.

If you don't want to force users to have to manually adjust the sysctl, there might be support for you to automatically update sysctl_rmem_max in your tipc_init routine, and print an informational message indicating that tipc requires the additional space (although I still maintain its not strictly needed, but thats another argument).

Neil

#5 lore raw

Re: [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf

Quoted 97 lines · Neil Horman
Quoted 90 lines · Ying Xue
Quoted 35 lines · Neil Horman
Quoted 34 lines · Paul Gortmaker

From: Jon Maloy <[email protected]>

As per feedback from the netdev community, we change the buffer overflow protection algorithm in receiving sockets so that it always respects the nominal upper limit set in sk_rcvbuf.

Instead of scaling up from a small sk_rcvbuf value, which leads to violation of the configured sk_rcvbuf limit, we now calculate the weighted per-message limit by scaling down from a much bigger value, still in the same field, according to the importance priority of the received message.

---
 net/tipc/socket.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/socket.c +1 -1
index 515ce38..2dfabc7 100644
@@ -1,7 +1,7 @@
 /*
  * net/tipc/socket.c: TIPC socket API
  *
- * Copyright (c) 2001-2007, 2012 Ericsson AB
+ * Copyright (c) 2001-2007, 2012-2013, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2012, Wind River Systems
  * All rights reserved.
  *
@@ -203,6 +203,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
 
Quoted 8 lines

net/tipc/socket.c static int tipc_create(struct net *net, struct socket *sock, int protocol, · line 206

Quoted 3 lines
net/tipc/socket.c +1 -0
 	sock_init_data(sock, sk);
 	sk->sk_backlog_rcv = backlog_rcv;
+	sk->sk_rcvbuf = CONN_OVERLOAD_LIMIT;

The last time Jon and I discussed this, I thought the consensus was to export sk_rcvbuf via its own sysctl, or tie it to sysctl_rmem (while requiring a protocol specific minimum on top of that), so administrators on memory constrained systems didn't wonder why their sysctl changes weren't being honored.

Yes, your suggestion is reasonable, and I prefer to involve net.tipc.sysctl_rmem. But I have one question about it:

As you suggested as belows, the default value of sk->sk_rcvbuf is set to sk->sk_rcvbuf >> 4 << msg_importance(TIPC_CRITICAL_IMPORTANCE), that is, sk->sk_rcvbuf is about 32MB.

However, please see below code:

int sock_setsockopt()
{
...

	        case SO_RCVBUF:
                /* Don't error on this BSD doesn't and if you think
                 * about it this is right. Otherwise apps have to
                 * play 'guess the biggest size' games. RCVBUF/SNDBUF
                 * are treated in BSD as hints
                 */
                val = min_t(u32, val, sysctl_rmem_max);

set_rcvbuf:
sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
/*
* We double it on the way in to account for
* "struct sk_buff" etc. overhead. Applications
* assume that the SO_RCVBUF setting they make will
* allow that much actual data to be received on that
* socket.
*
* Applications are unaware that "struct sk_buff" and
* other overheads allocate from the receive buffer
* during socket buffer allocation.
*
* And after considering the possible alternatives,
* returning the value we actually used in getsockopt
* is the most desirable behavior.
*/
sk->sk_rcvbuf = max_t(u32, val * 2, SOCK_MIN_RCVBUF); break;
...
}

From above logic of setting sk->sk_rcvbuf with SO_RCVBUF, it only permits the maximum value of sk->sk_rcvbuf to sysctl_rmem_max * 2(ie, about 400KB normally).

Quoted 6 lines

So, even if the default value of sk->sk_rcvbuf is set to 32MB with net.tipc.sysctl_rmem, a bit smaller value than the default value can never be set to sk->sk_rcvbuf successfully with SO_RCVBUF option.

How can we avoid the limit?

Quoted 9 lines

By administratively adjusting sysctl_rmem_max to be a sufficiently large value such that using SO_RCVBUF won't be clamed to a lower limit.

If you don't want to force users to have to manually adjust the sysctl, there might be support for you to automatically update sysctl_rmem_max in your tipc_init routine, and print an informational message indicating that tipc requires the additional space (although I still maintain its not strictly needed, but thats another argument).

Thanks for your clear clarification.

I also have the same concern. If we override sysctl_rmem_max in tipc_init() with a larger value, I am afraid that other guys will oppose the behaviour.

The truth is that little TIPC user adjusts the sk->sk_rcvbuf with SO_RCVBUF option in practice. If he really wants to do, he should follow your suggestion he manually enlarges the sysctl.

OK, I will rewrite the patch with your suggestion.

Regards,
Ying

Quoted 4 lines

Neil

#6 lore raw

Re: [PATCH net-next 01/12] tipc: change socket buffer overflow control to respect sk_rcvbuf

Quoted 114 lines · Ying Xue
Quoted 97 lines · Neil Horman
Quoted 90 lines · Ying Xue
Quoted 35 lines · Neil Horman
Quoted 34 lines · Paul Gortmaker

From: Jon Maloy <[email protected]>

As per feedback from the netdev community, we change the buffer overflow protection algorithm in receiving sockets so that it always respects the nominal upper limit set in sk_rcvbuf.

Instead of scaling up from a small sk_rcvbuf value, which leads to violation of the configured sk_rcvbuf limit, we now calculate the weighted per-message limit by scaling down from a much bigger value, still in the same field, according to the importance priority of the received message.

---
 net/tipc/socket.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
net/tipc/socket.c +1 -1
index 515ce38..2dfabc7 100644
@@ -1,7 +1,7 @@
 /*
  * net/tipc/socket.c: TIPC socket API
  *
- * Copyright (c) 2001-2007, 2012 Ericsson AB
+ * Copyright (c) 2001-2007, 2012-2013, Ericsson AB
  * Copyright (c) 2004-2008, 2010-2012, Wind River Systems
  * All rights reserved.
  *
@@ -203,6 +203,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
 
Quoted 8 lines

net/tipc/socket.c static int tipc_create(struct net *net, struct socket *sock, int protocol, · line 206

Quoted 3 lines
net/tipc/socket.c +1 -0
 	sock_init_data(sock, sk);
 	sk->sk_backlog_rcv = backlog_rcv;
+	sk->sk_rcvbuf = CONN_OVERLOAD_LIMIT;

The last time Jon and I discussed this, I thought the consensus was to export sk_rcvbuf via its own sysctl, or tie it to sysctl_rmem (while requiring a protocol specific minimum on top of that), so administrators on memory constrained systems didn't wonder why their sysctl changes weren't being honored.

Yes, your suggestion is reasonable, and I prefer to involve net.tipc.sysctl_rmem. But I have one question about it:

As you suggested as belows, the default value of sk->sk_rcvbuf is set to sk->sk_rcvbuf >> 4 << msg_importance(TIPC_CRITICAL_IMPORTANCE), that is, sk->sk_rcvbuf is about 32MB.

However, please see below code:

int sock_setsockopt()
{
...

	        case SO_RCVBUF:
                /* Don't error on this BSD doesn't and if you think
                 * about it this is right. Otherwise apps have to
                 * play 'guess the biggest size' games. RCVBUF/SNDBUF
                 * are treated in BSD as hints
                 */
                val = min_t(u32, val, sysctl_rmem_max);

set_rcvbuf:
sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
/*
* We double it on the way in to account for
* "struct sk_buff" etc. overhead. Applications
* assume that the SO_RCVBUF setting they make will
* allow that much actual data to be received on that
* socket.
*
* Applications are unaware that "struct sk_buff" and
* other overheads allocate from the receive buffer
* during socket buffer allocation.
*
* And after considering the possible alternatives,
* returning the value we actually used in getsockopt
* is the most desirable behavior.
*/
sk->sk_rcvbuf = max_t(u32, val * 2, SOCK_MIN_RCVBUF); break;
...
}

From above logic of setting sk->sk_rcvbuf with SO_RCVBUF, it only permits the maximum value of sk->sk_rcvbuf to sysctl_rmem_max * 2(ie, about 400KB normally).

Quoted 6 lines

So, even if the default value of sk->sk_rcvbuf is set to 32MB with net.tipc.sysctl_rmem, a bit smaller value than the default value can never be set to sk->sk_rcvbuf successfully with SO_RCVBUF option.

How can we avoid the limit?

Quoted 9 lines

By administratively adjusting sysctl_rmem_max to be a sufficiently large value such that using SO_RCVBUF won't be clamed to a lower limit.

If you don't want to force users to have to manually adjust the sysctl, there might be support for you to automatically update sysctl_rmem_max in your tipc_init routine, and print an informational message indicating that tipc requires the additional space (although I still maintain its not strictly needed, but thats another argument).

Thanks for your clear clarification.

I also have the same concern. If we override sysctl_rmem_max in tipc_init() with a larger value, I am afraid that other guys will oppose the behaviour.

Quoted 15 lines

The truth is that little TIPC user adjusts the sk->sk_rcvbuf with SO_RCVBUF option in practice. If he really wants to do, he should follow your suggestion he manually enlarges the sysctl.

OK, I will rewrite the patch with your suggestion.

Regards,
Ying

Quoted 4 lines

Neil

Sounds good, thanks!
Neil

#7 lore raw

PATCH 2/12 tipc: Add "max_ports" configuration parameter

In reply to Paul Gortmaker

From: Erik Hugne <[email protected]>

Introduce the "max_ports" module parameter, which allows the maximum number of ports supported by TIPC to be changed from the default value at boot, or at module load time. Because of the way the port reference table is structured and initiated, this value must be known at module start time, and can not be changed later.

Until now this value has been set via a macro, and hence things have to be recompiled if the value is to be changed. The Kconfig knob and the dead code intended to change this parameter at runtime are dropped.

Considering TIPC node addresses are unique on the entire node, the 64k port limit has proven to be a little too strict. We increase the allowed max to 128k. This is safe since the protocol headers allow for up to 2^32 -1 ports.

Usage for module: "insmod tipc.ko max_ports=<value>" ; at boot, append "tipc.max_ports=<value>" to the kernel command line.

---
 net/tipc/Kconfig  | 12 ------------
 net/tipc/config.c | 20 +-------------------
 net/tipc/core.c   |  9 +++++++--
 net/tipc/core.h   |  5 ++++-
 4 files changed, 12 insertions(+), 34 deletions(-)
net/tipc/Kconfig +0 -12
index c890848..91c8a8e 100644
@@ -20,18 +20,6 @@ menuconfig TIPC
 
 	  If in doubt, say N.
 
-config TIPC_PORTS
-	int "Maximum number of ports in a node"
-	depends on TIPC
-	range 127 65535
-	default "8191"
-	help
-	  Specifies how many ports can be supported by a node.
-	  Can range from 127 to 65535 ports; default is 8191.
-
-	  Setting this to a smaller value saves some memory,
-	  setting it to higher allows for more ports.
-
 config TIPC_MEDIA_IB
 	bool "InfiniBand media type support"
 	depends on TIPC && INFINIBAND_IPOIB
net/tipc/config.c +1 -19
index f67866c..79cada1 100644
@@ -208,22 +208,6 @@ static struct sk_buff *cfg_set_remote_mng(void)
 	return tipc_cfg_reply_none();
 }
 
-static struct sk_buff *cfg_set_max_ports(void)
-{
-	u32 value;
-
-	if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_UNSIGNED))
-		return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
-	value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
-	if (value == tipc_max_ports)
-		return tipc_cfg_reply_none();
-	if (value < 127 || value > 65535)
-		return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
-						   " (max ports must be 127-65535)");
-	return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
-		" (cannot change max ports while TIPC is active)");
-}
-
 static struct sk_buff *cfg_set_netid(void)
 {
 	u32 value;
@@ -324,9 +308,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
 	case TIPC_CMD_SET_REMOTE_MNG:
 		rep_tlv_buf = cfg_set_remote_mng();
 		break;
-	case TIPC_CMD_SET_MAX_PORTS:
-		rep_tlv_buf = cfg_set_max_ports();
-		break;
 	case TIPC_CMD_SET_NETID:
 		rep_tlv_buf = cfg_set_netid();
 		break;
@@ -356,6 +337,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
 	case TIPC_CMD_SET_MAX_PUBL:
 	case TIPC_CMD_GET_MAX_PUBL:
 	case TIPC_CMD_SET_LOG_SIZE:
+	case TIPC_CMD_SET_MAX_PORTS:
 	case TIPC_CMD_DUMP_LOG:
 		rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
 							  " (obsolete command)");
net/tipc/core.c +7 -2
index 7ec2c1e..f8abe8e 100644
@@ -47,10 +47,11 @@ int tipc_random __read_mostly;
 
 /* configurable TIPC parameters */
 u32 tipc_own_addr __read_mostly;
-int tipc_max_ports __read_mostly;
+unsigned int tipc_max_ports __read_mostly;
 int tipc_net_id __read_mostly;
 int tipc_remote_management __read_mostly;
 
+static unsigned int max_ports = TIPC_DEFAULT_PORTS;
 
 /**
  * tipc_buf_acquire - creates a TIPC message buffer
@@ -157,7 +158,8 @@ static int __init tipc_init(void)
 
 	tipc_own_addr = 0;
 	tipc_remote_management = 1;
-	tipc_max_ports = CONFIG_TIPC_PORTS;
+	tipc_max_ports = clamp_t(unsigned int, max_ports,
+				 TIPC_MIN_PORTS, TIPC_MAX_PORTS);
 	tipc_net_id = 4711;
 
 	res = tipc_core_start();
@@ -181,3 +183,6 @@ module_exit(tipc_exit);
 MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_VERSION(TIPC_MOD_VER);
+
+module_param(max_ports, uint, S_IRUGO);
+MODULE_PARM_DESC(max_ports, "Maximum number of ports (127 - 128K)");
net/tipc/core.h +4 -1
index 0207db0..9d6a47e 100644
@@ -63,6 +63,9 @@
 #define ULTRA_STRING_MAX_LEN	32768
 #define TIPC_MAX_SUBSCRIPTIONS	65535
 #define TIPC_MAX_PUBLICATIONS	65535
+#define TIPC_DEFAULT_PORTS	8192
+#define TIPC_MIN_PORTS		127
+#define TIPC_MAX_PORTS		131072
 
 struct tipc_msg;	/* msg.h */
 
@@ -77,7 +80,7 @@ int tipc_snprintf(char *buf, int len, const char *fmt, ...);
  * Global configuration variables
  */
 extern u32 tipc_own_addr __read_mostly;
-extern int tipc_max_ports __read_mostly;
+extern unsigned int tipc_max_ports __read_mostly;
 extern int tipc_net_id __read_mostly;
 extern int tipc_remote_management __read_mostly;
 
Signature · 1 line
1.8.1.2
maintainer
#8 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

From: Paul Gortmaker <[email protected]>
Date: Thu, 30 May 2013 15:36:07 -0400

Quoted 18 lines

From: Erik Hugne <[email protected]>

Introduce the "max_ports" module parameter, which allows the maximum number of ports supported by TIPC to be changed from the default value at boot, or at module load time. Because of the way the port reference table is structured and initiated, this value must be known at module start time, and can not be changed later.

Until now this value has been set via a macro, and hence things have to be recompiled if the value is to be changed. The Kconfig knob and the dead code intended to change this parameter at runtime are dropped.

Considering TIPC node addresses are unique on the entire node, the 64k port limit has proven to be a little too strict. We increase the allowed max to 128k. This is safe since the protocol headers allow for up to 2^32 -1 ports.

Quoted 6 lines

Usage for module: "insmod tipc.ko max_ports=<value>" ; at boot, append "tipc.max_ports=<value>" to the kernel command line.

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

Please reimplement it in that way.

Thanks.

#9 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

Quoted 5 lines · David Miller

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

The TIPC ref table index is used directly as the port identity in the TIPC publications. When a socket is bound, this ID is published to all other nodes in the cluster.
If we where to allow the table to be changed dynamically, we would need to change the port identities for already bound sockets/ports, withdraw the old identity and publish the new one.
In the best case, this will lead to a temporary interruption for all TIPC services until the new port ID's have been propagated out to the cluster.

Quoted 3 lines

Please reimplement it in that way.

To allow dynamic resizing without the problem mentioned above, we would need to invent a new way of handling port ID's. Changing the direct indexing by port ID to a more generic method independant of the table size will cause an additional overhead in the data path, and I'm not sure it's worth the performance penalty to be able to change this limit dynamically.

//E

maintainer
#10 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

From: Erik Hugne <[email protected]>
Date: Fri, 31 May 2013 10:25:38 +0200

Quoted 7 lines · David Miller
Quoted 5 lines

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

Quoted 6 lines

The TIPC ref table index is used directly as the port identity in the TIPC publications. When a socket is bound, this ID is published to all other nodes in the cluster.
If we where to allow the table to be changed dynamically, we would need to change the port identities for already bound sockets/ports, withdraw the old identity and publish the new one.

No you do not, simply grow the table just like we dynamically grow hash tables in response to network/socket activity elsewhere in the kernel. You'll only allocate new indexes from the newly allocated area, the existing indexes will remain the same.

I really will accept no excuses for this limitation, especially if the response is an ugly module paramter.

Thanks.

#11 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

Quoted 17 lines · David Miller

From: Erik Hugne <[email protected]>
Date: Fri, 31 May 2013 10:25:38 +0200

Quoted 7 lines · David Miller
Quoted 5 lines

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

Quoted 6 lines

The TIPC ref table index is used directly as the port identity in the TIPC publications. When a socket is bound, this ID is published to all other nodes in the cluster.
If we where to allow the table to be changed dynamically, we would need to change the port identities for already bound sockets/ports, withdraw the old identity and publish the new one.

Quoted 4 lines

No you do not, simply grow the table just like we dynamically grow hash tables in response to network/socket activity elsewhere in the kernel. You'll only allocate new indexes from the newly allocated area, the existing indexes will remain the same.

And if someone tries to reduce the table size?
Should we simply disallow that?

//E

maintainer
#12 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

From: Erik Hugne <[email protected]>
Date: Fri, 31 May 2013 10:34:55 +0200

Quoted 18 lines · David Miller
Quoted 17 lines

From: Erik Hugne <[email protected]>
Date: Fri, 31 May 2013 10:25:38 +0200

Quoted 13 lines · David Miller
Quoted 5 lines

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

The TIPC ref table index is used directly as the port identity in the TIPC publications. When a socket is bound, this ID is published to all other nodes in the cluster.
If we where to allow the table to be changed dynamically, we would need to change the port identities for already bound sockets/ports, withdraw the old identity and publish the new one.

Quoted 7 lines
Quoted 4 lines

No you do not, simply grow the table just like we dynamically grow hash tables in response to network/socket activity elsewhere in the kernel. You'll only allocate new indexes from the newly allocated area, the existing indexes will remain the same.

And if someone tries to reduce the table size?
Should we simply disallow that?

We never shrink the hash tables once we've grown them. That's a reasonable way to behave.

#13 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

Quoted 2 lines · David Miller

We never shrink the hash tables once we've grown them. That's a reasonable way to behave.

Very well.
Currently, the refs/portID's are built up of a random part, and an index part. The index is obtained by masking against the table size. If the table is allowed to grow, we must remove the random part from the portID. Otherwise we would index out a nonexistant or wrong port from a received packet..

But removing the random part would be a violation of the protocol spec, and potentially break interop between other implementations (like link selection..)

//E

maintainer
#14 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

From: Erik Hugne <[email protected]>
Date: Fri, 31 May 2013 11:23:02 +0200

Quoted 11 lines · David Miller
Quoted 2 lines

We never shrink the hash tables once we've grown them. That's a reasonable way to behave.

Very well.
Currently, the refs/portID's are built up of a random part, and an index part. The index is obtained by masking against the table size. If the table is allowed to grow, we must remove the random part from the portID. Otherwise we would index out a nonexistant or wrong port from a received packet..

Quoted 2 lines

But removing the random part would be a violation of the protocol spec, and potentially break interop between other implementations (like link selection..)

We allocate ports randomly for IPV4/IPV6 sockets, you can just fine too.

#15 lore raw

RE: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

In reply to Erik Hugne
Quoted 9 lines
Quoted 2 lines

We never shrink the hash tables once we've grown them. That's a reasonable way to behave.

Very well.
Currently, the refs/portID's are built up of a random part, and an index part. The index is obtained by masking against the table size. If the table is allowed to grow, we must remove the random part from the portID. Otherwise we would index out a nonexistant or wrong port from a received packet..

No - you just copy the entry into the correct location in the new array.
One of the 'random' bits becomes an 'index' bit.

David

#16 lore raw

RE: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

In reply to Erik Hugne
Quoted 6 lines
Quoted 5 lines

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

Quoted 8 lines

The TIPC ref table index is used directly as the port identity in the TIPC publications. When a socket is bound, this ID is published to all other nodes in the cluster.
If we where to allow the table to be changed dynamically, we would need to change the port identities for already bound sockets/ports, withdraw the old identity and publish the new one.
In the best case, this will lead to a temporary interruption for all TIPC services until the new port ID's have been propagated out to the cluster.

Eh?
Doubling the size of the array doesn't require that the old index be invalidated. At most it requires an rcu before the old index array is discarded.

If you use the low bits of the port indentity (32bits ?) as the table index and the higher bits as a seq value to identify stale references then you need to distribute the old entries into the correct places in the new table.
This isn't hard and there could be generic 'reference allocator' that would do this for you.

David

#17 lore raw

Re: [PATCH net-next 02/12] tipc: Add "max_ports" configuration parameter

In reply to David Miller
Quoted 24 lines · David Miller

From: Paul Gortmaker <[email protected]>
Date: Thu, 30 May 2013 15:36:07 -0400

Quoted 21 lines

From: Erik Hugne <[email protected]>

Introduce the "max_ports" module parameter, which allows the maximum number of ports supported by TIPC to be changed from the default value at boot, or at module load time. Because of the way the port reference table is structured and initiated, this value must be known at module start time, and can not be changed later.

Until now this value has been set via a macro, and hence things have to be recompiled if the value is to be changed. The Kconfig knob and the dead code intended to change this parameter at runtime are dropped.

Considering TIPC node addresses are unique on the entire node, the 64k port limit has proven to be a little too strict. We increase the allowed max to 128k. This is safe since the protocol headers allow for up to 2^32 -1 ports.

Usage for module: "insmod tipc.ko max_ports=<value>" ; at boot, append "tipc.max_ports=<value>" to the kernel command line.

Quoted 6 lines
Quoted 3 lines

View compile time constants and module parameters as artificial limits, they are terrible and unnecessary.

I can't argue with that; I was thinking that the module param was better than a recompile, but as you say, not having it at all is yet better again. I'll drop this patch, and if the reimplementation isn't ready before 3.10-rc6, I'll just resend the series without it.

Thanks,
Paul.
--

Quoted 8 lines

There is no reason you cannot restructure this table so that you can dynamically size it at run time.

Please reimplement it in that way.

Thanks.

#18 lore raw

PATCH 3/12 tipc: allow implicit connect for stream sockets

In reply to Paul Gortmaker

From: Erik Hugne <[email protected]>

TIPC's implied connect feature, aka piggyback connect, allows applications to save one syscall and all SYN/SYN-ACK signalling overhead when setting up a connection. Until now, this has only been supported for SEQPACKET sockets. Here, we make it possible to use this feature even with stream sockets.

At the connecting side, the connection is completed when the first data message arrives from the accepting peer. This means that we must allow the connecting user to call blocking recv() before the socket has reached state SS_CONNECTED. So we must must relax the state machine check at recv_stream(), and allow the recv() call even if socket is in state SS_CONNECTING.

---
 net/tipc/socket.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/tipc/socket.c +2 -4
index 2dfabc7..10eba4d 100644
@@ -520,8 +520,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
 			res = -EISCONN;
 			goto exit;
 		}
-		if ((tport->published) ||
-		    ((sock->type == SOCK_STREAM) && (total_len != 0))) {
+		if (tport->published) {
 			res = -EOPNOTSUPP;
 			goto exit;
 		}
@@ -1012,8 +1011,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
 
 	lock_sock(sk);
 
-	if (unlikely((sock->state == SS_UNCONNECTED) ||
-		     (sock->state == SS_CONNECTING))) {
+	if (unlikely((sock->state == SS_UNCONNECTED))) {
 		res = -ENOTCONN;
 		goto exit;
 	}
Signature · 1 line
1.8.1.2
#19 lore raw

PATCH 4/12 tipc: introduce new TIPC server infrastructure

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

TIPC has two internal servers, one providing a subscription service for topology events, and another providing the configuration interface. These servers have previously been running in BH context, accessing the TIPC-port (aka native) API directly. Apart from these servers, even the TIPC socket implementation is partially built on this API.

As this API may simultaneously be called via different paths and in different contexts, a complex and costly lock policiy is required in order to protect TIPC internal resources.

To eliminate the need for this complex lock policiy, we introduce a new, generic service API that uses kernel sockets for message passing instead of the native API. Once the toplogy and configuration servers are converted to use this new service, all code pertaining to the native API can be removed. This entails a significant reduction in code amount and complexity, and opens up for a complete rework of the locking policy in TIPC.

The new service also solves another problem:

As the current topology server works in BH context, it cannot easily be blocked when sending of events fails due to congestion. In such cases events may have to be silently dropped, something that is unacceptable. Therefore, the new service keeps a dedicated outbound queue receiving messages from BH context. Once messages are inserted into this queue, we will immediately schedule a work from a special workqueue. This way, messages/events from the topology server are in reality sent in process context, and the server can block if necessary.

Analogously, there is a new workqueue for receiving messages. Once a notification about an arriving message is received in BH context, we schedule a work from the receive workqueue to do the job of receiving the message in process context.

As both sending and receive messages are now finished in processes, subscribed events cannot be dropped any more.

As of this commit, this new server infrastructure is built, but not actually yet called by the existing TIPC code, but since the conversion changes required in order to use it are significant, the addition is kept here as a separate commit.

---
 net/tipc/Makefile |   2 +-
 net/tipc/core.h   |   9 +-
 net/tipc/server.c | 591 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 net/tipc/server.h |  92 +++++++++
 net/tipc/socket.c |  98 ++++++++-
 5 files changed, 781 insertions(+), 11 deletions(-)
 create mode 100644 net/tipc/server.c
 create mode 100644 net/tipc/server.h
net/tipc/Makefile +1 -1
index 4df8e02..d1005b5 100644
@@ -8,6 +8,6 @@ tipc-y	+= addr.o bcast.o bearer.o config.o \
 	   core.o handler.o link.o discover.o msg.o  \
 	   name_distr.o  subscr.o name_table.o net.o  \
 	   netlink.o node.o node_subscr.o port.o ref.o  \
-	   socket.o log.o eth_media.o
+	   socket.o log.o eth_media.o server.o
 
 tipc-$(CONFIG_TIPC_MEDIA_IB)	+= ib_media.o
net/tipc/core.h +6 -3
index 9d6a47e..b173d20 100644
@@ -1,8 +1,8 @@
 /*
  * net/tipc/core.h: Include file for TIPC global declarations
  *
- * Copyright (c) 2005-2006, Ericsson AB
- * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
+ * Copyright (c) 2005-2006, 2013 Ericsson AB
+ * Copyright (c) 2005-2007, 2010-2013, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -99,7 +99,10 @@ extern int  tipc_netlink_start(void);
 extern void tipc_netlink_stop(void);
 extern int  tipc_socket_init(void);
 extern void tipc_socket_stop(void);
-
+extern int tipc_sock_create_local(int type, struct socket **res);
+extern void tipc_sock_release_local(struct socket *sock);
+extern int tipc_sock_accept_local(struct socket *sock,
+				  struct socket **newsock, int flags);
 /*
  * TIPC timer and signal code
  */
net/tipc/server.c new file +591 -0

591 lines not on this page · raw message

net/tipc/server.h new file +92 -0

92 lines not on this page · raw message

net/tipc/socket.c +91 -7

158 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#20 lore raw

PATCH 5/12 tipc: convert topology server to use new server facility

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

As the new TIPC server infrastructure has been introduced, we can now convert the TIPC topology server to it. We get two benefits from doing this:

1) It simplifies the topology server locking policy. In the original locking policy, we placed one spin lock pointer in the tipc_subscriber structure to reuse the lock of the subscriber's server port, controlling access to members of tipc_subscriber instance. That is, we only used one lock to ensure both tipc_port and tipc_subscriber members were safely accessed.

Now we introduce another spin lock for tipc_subscriber structure only protecting themselves, to get a finer granularity locking policy. Moreover, the change will allow us to make the topology server code more readable and maintainable.

2) It fixes a bug where sent subscription events may be lost when the topology port is congested. Using the new service, the topology server now queues sent events into an outgoing buffer, and then wakes up a sender process which has been blocked in workqueue context. The process will keep picking events from the buffer and send them to their respective subscribers, using the kernel socket interface, until the buffer is empty. Even if the socket is congested during transmission there is no risk that events may be dropped, since the sender process may block when needed.

Some minor reordering of initialization is done, since we now have a scenario where the topology server must be started after socket initialization has taken place, as the former depends on the latter. And overall, we see a simplification of the TIPC subscriber code in making this changeover.

---
 net/tipc/core.c   |   6 +-
 net/tipc/socket.c |   3 +-
 net/tipc/subscr.c | 334 +++++++++++++++---------------------------------------
 net/tipc/subscr.h |   8 +-
 4 files changed, 104 insertions(+), 247 deletions(-)
net/tipc/core.c +3 -3
index f8abe8e..c898edf 100644
@@ -2,7 +2,7 @@
  * net/tipc/core.c: TIPC module code
  *
  * Copyright (c) 2003-2006, Ericsson AB
- * Copyright (c) 2005-2006, 2010-2011, Wind River Systems
+ * Copyright (c) 2005-2006, 2010-2013, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -136,13 +136,13 @@ static int tipc_core_start(void)
 	if (!res)
 		res = tipc_nametbl_init();
 	if (!res)
-		res = tipc_subscr_start();
-	if (!res)
 		res = tipc_cfg_init();
 	if (!res)
 		res = tipc_netlink_start();
 	if (!res)
 		res = tipc_socket_init();
+	if (!res)
+		res = tipc_subscr_start();
 	if (res)
 		tipc_core_stop();
 
net/tipc/socket.c +2 -1
index 17d87a7..1f123c6 100644
@@ -404,7 +404,8 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
 	else if (addr->addrtype != TIPC_ADDR_NAMESEQ)
 		return -EAFNOSUPPORT;
 
-	if (addr->addr.nameseq.type < TIPC_RESERVED_TYPES)
+	if ((addr->addr.nameseq.type < TIPC_RESERVED_TYPES) &&
+	    (addr->addr.nameseq.type != TIPC_TOP_SRV))
 		return -EACCES;
 
 	return (addr->scope > 0) ?
net/tipc/subscr.c +93 -241

490 lines not on this page · raw message

net/tipc/subscr.h +6 -2
index 218d2e0..43e6d63 100644
@@ -2,7 +2,7 @@
  * net/tipc/subscr.h: Include file for TIPC network topology service
  *
  * Copyright (c) 2003-2006, Ericsson AB
- * Copyright (c) 2005-2007, Wind River Systems
+ * Copyright (c) 2005-2007, 2012-2013, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,10 +37,14 @@
 #ifndef _TIPC_SUBSCR_H
 #define _TIPC_SUBSCR_H
 
+#include "server.h"
+
 struct tipc_subscription;
+struct tipc_subscriber;
 
 /**
  * struct tipc_subscription - TIPC network topology subscription object
+ * @subscriber: pointer to its subscriber
  * @seq: name sequence associated with subscription
  * @timeout: duration of subscription (in ms)
  * @filter: event filtering to be done for subscription
@@ -52,13 +56,13 @@ struct tipc_subscription;
  * @evt: template for events generated by subscription
  */
 struct tipc_subscription {
+	struct tipc_subscriber *subscriber;
 	struct tipc_name_seq seq;
 	u32 timeout;
 	u32 filter;
 	struct timer_list timer;
 	struct list_head nameseq_list;
 	struct list_head subscription_list;
-	u32 server_ref;
 	int swap;
 	struct tipc_event evt;
 };
Signature · 1 line
1.8.1.2
#21 lore raw

PATCH 6/12 tipc: convert configuration server to use new server facility

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

As the new socket-based TIPC server infrastructure has been introduced, we can now convert the configuration server to use it. Then we can take future steps to simplify the configuration server locking policy.

Some minor reordering of initialization is done, due to the dependency on having tipc_socket_init completed.

---
 net/tipc/config.c | 102 ++++++++++++++++++++++++------------------------------
 net/tipc/core.c   |   4 +--
 net/tipc/socket.c |   3 +-
 3 files changed, 49 insertions(+), 60 deletions(-)
net/tipc/config.c +45 -57
index 79cada1..d183479 100644
@@ -2,7 +2,7 @@
  * net/tipc/config.c: TIPC configuration management code
  *
  * Copyright (c) 2002-2006, Ericsson AB
- * Copyright (c) 2004-2007, 2010-2012, Wind River Systems
+ * Copyright (c) 2004-2007, 2010-2013, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,12 +38,12 @@
 #include "port.h"
 #include "name_table.h"
 #include "config.h"
+#include "server.h"
 
 #define REPLY_TRUNCATED "<truncated>\n"
 
-static u32 config_port_ref;
-
 static DEFINE_SPINLOCK(config_lock);
+static struct tipc_server cfgsrv;
 
 static const void *req_tlv_area;	/* request message TLV area */
 static int req_tlv_space;		/* request message TLV area size */
@@ -363,33 +363,27 @@ exit:
 	return rep_tlv_buf;
 }
 
-static void cfg_named_msg_event(void *userdata,
-				u32 port_ref,
-				struct sk_buff **buf,
-				const unchar *msg,
-				u32 size,
-				u32 importance,
-				struct tipc_portid const *orig,
-				struct tipc_name_seq const *dest)
+static void cfg_conn_msg_event(int conid, struct sockaddr_tipc *addr,
+			       void *usr_data, void *buf, size_t len)
 {
 	struct tipc_cfg_msg_hdr *req_hdr;
 	struct tipc_cfg_msg_hdr *rep_hdr;
 	struct sk_buff *rep_buf;
+	int ret;
 
 	/* Validate configuration message header (ignore invalid message) */
-	req_hdr = (struct tipc_cfg_msg_hdr *)msg;
-	if ((size < sizeof(*req_hdr)) ||
-	    (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
+	req_hdr = (struct tipc_cfg_msg_hdr *)buf;
+	if ((len < sizeof(*req_hdr)) ||
+	    (len != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
 	    (ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) {
 		pr_warn("Invalid configuration message discarded\n");
 		return;
 	}
 
 	/* Generate reply for request (if can't, return request) */
-	rep_buf = tipc_cfg_do_cmd(orig->node,
-				  ntohs(req_hdr->tcm_type),
-				  msg + sizeof(*req_hdr),
-				  size - sizeof(*req_hdr),
+	rep_buf = tipc_cfg_do_cmd(addr->addr.id.node, ntohs(req_hdr->tcm_type),
+				  buf + sizeof(*req_hdr),
+				  len - sizeof(*req_hdr),
 				  BUF_HEADROOM + MAX_H_SIZE + sizeof(*rep_hdr));
 	if (rep_buf) {
 		skb_push(rep_buf, sizeof(*rep_hdr));
@@ -397,57 +391,51 @@ static void cfg_named_msg_event(void *userdata,
 		memcpy(rep_hdr, req_hdr, sizeof(*rep_hdr));
 		rep_hdr->tcm_len = htonl(rep_buf->len);
 		rep_hdr->tcm_flags &= htons(~TCM_F_REQUEST);
-	} else {
-		rep_buf = *buf;
-		*buf = NULL;
-	}
 
-	/* NEED TO ADD CODE TO HANDLE FAILED SEND (SUCH AS CONGESTION) */
-	tipc_send_buf2port(port_ref, orig, rep_buf, rep_buf->len);
+		ret = tipc_conn_sendmsg(&cfgsrv, conid, addr, rep_buf->data,
+					rep_buf->len);
+		if (ret < 0)
+			pr_err("Sending cfg reply message failed, no memory\n");
+
+		kfree_skb(rep_buf);
+	}
 }
 
+static struct sockaddr_tipc cfgsrv_addr __read_mostly = {
+	.family			= AF_TIPC,
+	.addrtype		= TIPC_ADDR_NAMESEQ,
+	.addr.nameseq.type	= TIPC_CFG_SRV,
+	.addr.nameseq.lower	= 0,
+	.addr.nameseq.upper	= 0,
+	.scope			= TIPC_ZONE_SCOPE
+};
+
+static struct tipc_server cfgsrv __read_mostly = {
+	.saddr			= &cfgsrv_addr,
+	.imp			= TIPC_CRITICAL_IMPORTANCE,
+	.type			= SOCK_RDM,
+	.max_rcvbuf_size	= 64 * 1024,
+	.name			= "configuration server",
+	.tipc_conn_recvmsg	= cfg_conn_msg_event,
+	.tipc_conn_new		= NULL,
+	.tipc_conn_shutdown	= NULL
+};
+
 int tipc_cfg_init(void)
 {
-	struct tipc_name_seq seq;
-	int res;
-
-	res = tipc_createport(NULL, TIPC_CRITICAL_IMPORTANCE,
-			      NULL, NULL, NULL,
-			      NULL, cfg_named_msg_event, NULL,
-			      NULL, &config_port_ref);
-	if (res)
-		goto failed;
-
-	seq.type = TIPC_CFG_SRV;
-	seq.lower = seq.upper = tipc_own_addr;
-	res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq);
-	if (res)
-		goto failed;
-
-	return 0;
-
-failed:
-	pr_err("Unable to create configuration service\n");
-	return res;
+	return tipc_server_start(&cfgsrv);
 }
 
 void tipc_cfg_reinit(void)
 {
-	struct tipc_name_seq seq;
-	int res;
-
-	seq.type = TIPC_CFG_SRV;
-	seq.lower = seq.upper = 0;
-	tipc_withdraw(config_port_ref, TIPC_ZONE_SCOPE, &seq);
+	tipc_server_stop(&cfgsrv);
 
-	seq.lower = seq.upper = tipc_own_addr;
-	res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq);
-	if (res)
-		pr_err("Unable to reinitialize configuration service\n");
+	cfgsrv_addr.addr.nameseq.lower = tipc_own_addr;
+	cfgsrv_addr.addr.nameseq.upper = tipc_own_addr;
+	tipc_server_start(&cfgsrv);
 }
 
 void tipc_cfg_stop(void)
 {
-	tipc_deleteport(config_port_ref);
-	config_port_ref = 0;
+	tipc_server_stop(&cfgsrv);
 }
net/tipc/core.c +2 -2
index c898edf..dbca706 100644
@@ -136,13 +136,13 @@ static int tipc_core_start(void)
 	if (!res)
 		res = tipc_nametbl_init();
 	if (!res)
-		res = tipc_cfg_init();
-	if (!res)
 		res = tipc_netlink_start();
 	if (!res)
 		res = tipc_socket_init();
 	if (!res)
 		res = tipc_subscr_start();
+	if (!res)
+		res = tipc_cfg_init();
 	if (res)
 		tipc_core_stop();
 
net/tipc/socket.c +2 -1
index 1f123c6..6259068 100644
@@ -405,7 +405,8 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
 		return -EAFNOSUPPORT;
 
 	if ((addr->addr.nameseq.type < TIPC_RESERVED_TYPES) &&
-	    (addr->addr.nameseq.type != TIPC_TOP_SRV))
+	    (addr->addr.nameseq.type != TIPC_TOP_SRV) &&
+	    (addr->addr.nameseq.type != TIPC_CFG_SRV))
 		return -EACCES;
 
 	return (addr->scope > 0) ?
Signature · 1 line
1.8.1.2
#22 lore raw

PATCH 7/12 tipc: delete code orphaned by new server infrastructure

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

Having completed the conversion of the topology server and configuration server to use the new server infrastructure, the following functions become unused, and can be deleted:

- tipc_createport()
- port_wakeup_sh()
- port_dispatcher()
- port_dispatcher_sigh()
- tipc_send_buf_fast()
- tipc_send_buf2port

Additionally, the following variables become orphaned, and can be deleted:

- tipc_msg_err_event
- tipc_named_msg_err_event
- tipc_conn_shutdown_event
- tipc_msg_event
- tipc_named_msg_event
- tipc_conn_msg_event
- tipc_continue_event
- msg_queue_head
- msg_queue_tail
- queue_lock

Deletion is done here in a separate commit in order to allow the actual conversion changes to be more easily viewed.

---
 net/tipc/link.c |  36 +------
 net/tipc/port.c | 299 +-------------------------------------------------------
 net/tipc/port.h |  53 +---------
 3 files changed, 3 insertions(+), 385 deletions(-)
net/tipc/link.c +1 -35
index a80feee..0a4c3a1 100644
@@ -2,7 +2,7 @@
  * net/tipc/link.c: TIPC link code
  *
  * Copyright (c) 1996-2007, 2012, Ericsson AB
- * Copyright (c) 2004-2007, 2010-2011, Wind River Systems
+ * Copyright (c) 2004-2007, 2010-2013, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1057,40 +1057,6 @@ static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
 }
 
 /*
- * tipc_send_buf_fast: Entry for data messages where the
- * destination node is known and the header is complete,
- * inclusive total message length.
- * Returns user data length.
- */
-int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
-{
-	struct tipc_link *l_ptr;
-	struct tipc_node *n_ptr;
-	int res;
-	u32 selector = msg_origport(buf_msg(buf)) & 1;
-	u32 dummy;
-
-	read_lock_bh(&tipc_net_lock);
-	n_ptr = tipc_node_find(destnode);
-	if (likely(n_ptr)) {
-		tipc_node_lock(n_ptr);
-		l_ptr = n_ptr->active_links[selector];
-		if (likely(l_ptr)) {
-			res = link_send_buf_fast(l_ptr, buf, &dummy);
-			tipc_node_unlock(n_ptr);
-			read_unlock_bh(&tipc_net_lock);
-			return res;
-		}
-		tipc_node_unlock(n_ptr);
-	}
-	read_unlock_bh(&tipc_net_lock);
-	res = msg_data_sz(buf_msg(buf));
-	tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
-	return res;
-}
-
-
-/*
  * tipc_link_send_sections_fast: Entry for messages where the
  * destination processor is known and the header is complete,
  * except for total message length.
net/tipc/port.c +1 -298

327 lines not on this page · raw message

net/tipc/port.h +1 -52

85 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#23 lore raw

PATCH 8/12 tipc: remove user_port instance from tipc_port structure

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

After the native API has been completely removed, the 'user_port' field in struct tipc_port becomes unused, and can be removed. As a consequence, the "usrmem" argument in tipc_msg_build() is no longer needed, and so we remove that one too.

---
 net/tipc/link.c | 18 +++++++-----------
 net/tipc/msg.c  | 15 +++++----------
 net/tipc/msg.h  |  4 ++--
 net/tipc/port.c |  8 +++-----
 net/tipc/port.h | 14 --------------
 5 files changed, 17 insertions(+), 42 deletions(-)
net/tipc/link.c +7 -11
index 0a4c3a1..d34429d 100644
@@ -1081,7 +1081,7 @@ again:
 	 * (Must not hold any locks while building message.)
 	 */
 	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
-			     sender->max_pkt, !sender->user_port, &buf);
+			     sender->max_pkt, &buf);
 
 	read_lock_bh(&tipc_net_lock);
 	node = tipc_node_find(destaddr);
@@ -1216,18 +1216,14 @@ again:
 		else
 			sz = fragm_rest;
 
-		if (likely(!sender->user_port)) {
-			if (copy_from_user(buf->data + fragm_crs, sect_crs, sz)) {
+		if (copy_from_user(buf->data + fragm_crs, sect_crs, sz)) {
 error:
-				for (; buf_chain; buf_chain = buf) {
-					buf = buf_chain->next;
-					kfree_skb(buf_chain);
-				}
-				return -EFAULT;
+			for (; buf_chain; buf_chain = buf) {
+				buf = buf_chain->next;
+				kfree_skb(buf_chain);
 			}
-		} else
-			skb_copy_to_linear_data_offset(buf, fragm_crs,
-						       sect_crs, sz);
+			return -EFAULT;
+		}
 		sect_crs += sz;
 		sect_rest -= sz;
 		fragm_crs += sz;
net/tipc/msg.c +5 -10
index f2db8a8..c2a2613 100644
@@ -73,8 +73,8 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
  * Returns message data size or errno
  */
 int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
-		   u32 num_sect, unsigned int total_len,
-			    int max_size, int usrmem, struct sk_buff **buf)
+		   u32 num_sect, unsigned int total_len, int max_size,
+		   struct sk_buff **buf)
 {
 	int dsz, sz, hsz, pos, res, cnt;
 
@@ -92,14 +92,9 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
 		return -ENOMEM;
 	skb_copy_to_linear_data(*buf, hdr, hsz);
 	for (res = 1, cnt = 0; res && (cnt < num_sect); cnt++) {
-		if (likely(usrmem))
-			res = !copy_from_user((*buf)->data + pos,
-					      msg_sect[cnt].iov_base,
-					      msg_sect[cnt].iov_len);
-		else
-			skb_copy_to_linear_data_offset(*buf, pos,
-						       msg_sect[cnt].iov_base,
-						       msg_sect[cnt].iov_len);
+		skb_copy_to_linear_data_offset(*buf, pos,
+					       msg_sect[cnt].iov_base,
+					       msg_sect[cnt].iov_len);
 		pos += msg_sect[cnt].iov_len;
 	}
 	if (likely(res))
net/tipc/msg.h +2 -2
index ba2a72b..511019a 100644
@@ -722,6 +722,6 @@ u32 tipc_msg_tot_importance(struct tipc_msg *m);
 void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
 			    u32 hsize, u32 destnode);
 int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
-		   u32 num_sect, unsigned int total_len,
-			    int max_size, int usrmem, struct sk_buff **buf);
+		   u32 num_sect, unsigned int total_len, int max_size,
+		   struct sk_buff **buf);
 #endif
net/tipc/port.c +3 -5
index 0651522..f628c84 100644
@@ -115,7 +115,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
 	msg_set_nameupper(hdr, seq->upper);
 	msg_set_hdr_sz(hdr, MCAST_H_SIZE);
 	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
-			!oport->user_port, &buf);
+			     &buf);
 	if (unlikely(!buf))
 		return res;
 
@@ -234,7 +234,6 @@ struct tipc_port *tipc_createport_raw(void *usr_handle,
 	INIT_LIST_HEAD(&p_ptr->subscription.nodesub_list);
 	p_ptr->dispatcher = dispatcher;
 	p_ptr->wakeup = wakeup;
-	p_ptr->user_port = NULL;
 	k_init_timer(&p_ptr->timer, (Handler)port_timeout, ref);
 	INIT_LIST_HEAD(&p_ptr->publications);
 	INIT_LIST_HEAD(&p_ptr->port_list);
@@ -271,7 +270,6 @@ int tipc_deleteport(u32 ref)
 		buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
 		tipc_nodesub_unsubscribe(&p_ptr->subscription);
 	}
-	kfree(p_ptr->user_port);
 
 	spin_lock_bh(&tipc_port_list_lock);
 	list_del(&p_ptr->port_list);
@@ -444,7 +442,7 @@ int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
 	int res;
 
 	res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
-			!p_ptr->user_port, &buf);
+			     &buf);
 	if (!buf)
 		return res;
 
@@ -927,7 +925,7 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se
 	int res;
 
 	res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len,
-			MAX_MSG_SIZE, !sender->user_port, &buf);
+			     MAX_MSG_SIZE, &buf);
 	if (likely(buf))
 		tipc_port_recv_msg(buf);
 	return res;
net/tipc/port.h +0 -14
index 9d8557a..71d1cd3 100644
@@ -45,18 +45,6 @@
 #define TIPC_FLOW_CONTROL_WIN 512
 
 /**
- * struct user_port - TIPC user port (used with native API)
- * @usr_handle: user-specified field
- * @ref: object reference to associated TIPC port
- *
- * <various callback routines>
- */
-struct user_port {
-	void *usr_handle;
-	u32 ref;
-};
-
-/**
  * struct tipc_port - TIPC port structure
  * @usr_handle: pointer to additional user-defined information about port
  * @lock: pointer to spinlock for controlling access to port
@@ -72,7 +60,6 @@ struct user_port {
  * @port_list: adjacent ports in TIPC's global list of ports
  * @dispatcher: ptr to routine which handles received messages
  * @wakeup: ptr to routine to call when port is no longer congested
- * @user_port: ptr to user port associated with port (if any)
  * @wait_list: adjacent ports in list of ports waiting on link congestion
  * @waiting_pkts:
  * @sent: # of non-empty messages sent by port
@@ -99,7 +86,6 @@ struct tipc_port {
 	struct list_head port_list;
 	u32 (*dispatcher)(struct tipc_port *, struct sk_buff *);
 	void (*wakeup)(struct tipc_port *);
-	struct user_port *user_port;
 	struct list_head wait_list;
 	u32 waiting_pkts;
 	u32 sent;
Signature · 1 line
1.8.1.2
#24 lore raw

PATCH 9/12 tipc: rename tipc_createport_raw to tipc_createport

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

After the removal of the native API, there is now only one way to to create a TIPC port instance -- the function tipc_createport_raw(). We make it more readable by renaming it to tipc_createport().

---
 net/tipc/port.c   | 4 ++--
 net/tipc/port.h   | 2 +-
 net/tipc/socket.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
net/tipc/port.c +2 -2
index f628c84..84b2a57 100644
@@ -202,11 +202,11 @@ exit:
 }
 
 /**
- * tipc_createport_raw - create a generic TIPC port
+ * tipc_createport - create a generic TIPC port
  *
  * Returns pointer to (locked) TIPC port, or NULL if unable to create it
  */
-struct tipc_port *tipc_createport_raw(void *usr_handle,
+struct tipc_port *tipc_createport(void *usr_handle,
 			u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
 			void (*wakeup)(struct tipc_port *),
 			const u32 importance)
net/tipc/port.h +1 -1
index 71d1cd3..6579e47 100644
@@ -104,7 +104,7 @@ struct tipc_port_list;
 /*
  * TIPC port manipulation routines
  */
-struct tipc_port *tipc_createport_raw(void *usr_handle,
+struct tipc_port *tipc_createport(void *usr_handle,
 		u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
 		void (*wakeup)(struct tipc_port *), const u32 importance);
 
net/tipc/socket.c +2 -2
index 6259068..258e98d 100644
@@ -197,8 +197,8 @@ static int tipc_sk_create(struct net *net, struct socket *sock, int protocol,
 		return -ENOMEM;
 
 	/* Allocate TIPC port for socket to use */
-	tp_ptr = tipc_createport_raw(sk, &dispatch, &wakeupdispatch,
-				     TIPC_LOW_IMPORTANCE);
+	tp_ptr = tipc_createport(sk, &dispatch, &wakeupdispatch,
+				 TIPC_LOW_IMPORTANCE);
 	if (unlikely(!tp_ptr)) {
 		sk_free(sk);
 		return -ENOMEM;
Signature · 1 line
1.8.1.2
#25 lore raw

PATCH 10/12 tipc: convert config_lock from spinlock to mutex

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

As the configuration server is now running under process context, it's unnecessary for us to have a spinlock serializing the TIPC configuration process. Instead, we replace it with a mutex lock, which gives us more freedom. For instance, we can now call pre-emptable functions within the protected area.

---
 net/tipc/config.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
net/tipc/config.c +3 -14
index d183479..8be6052 100644
@@ -42,7 +42,7 @@
 
 #define REPLY_TRUNCATED "<truncated>\n"
 
-static DEFINE_SPINLOCK(config_lock);
+static DEFINE_MUTEX(config_mutex);
 static struct tipc_server cfgsrv;
 
 static const void *req_tlv_area;	/* request message TLV area */
@@ -181,18 +181,7 @@ static struct sk_buff *cfg_set_own_addr(void)
 	if (tipc_own_addr)
 		return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
 						   " (cannot change node address once assigned)");
-
-	/*
-	 * Must temporarily release configuration spinlock while switching into
-	 * networking mode as it calls tipc_eth_media_start(), which may sleep.
-	 * Releasing the lock is harmless as other locally-issued configuration
-	 * commands won't occur until this one completes, and remotely-issued
-	 * configuration commands can't be received until a local configuration
-	 * command to enable the first bearer is received and processed.
-	 */
-	spin_unlock_bh(&config_lock);
 	tipc_core_start_net(addr);
-	spin_lock_bh(&config_lock);
 	return tipc_cfg_reply_none();
 }
 
@@ -232,7 +221,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
 {
 	struct sk_buff *rep_tlv_buf;
 
-	spin_lock_bh(&config_lock);
+	mutex_lock(&config_mutex);
 
 	/* Save request and reply details in a well-known location */
 	req_tlv_area = request_area;
@@ -359,7 +348,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
 
 	/* Return reply buffer */
 exit:
-	spin_unlock_bh(&config_lock);
+	mutex_unlock(&config_mutex);
 	return rep_tlv_buf;
 }
 
Signature · 1 line
1.8.1.2
#26 lore raw

PATCH 11/12 tipc: save sock structure pointer instead of void pointer to tipc_port

In reply to Paul Gortmaker

From: Ying Xue <[email protected]>

Directly save sock structure pointer instead of void pointer to avoid unnecessary cast conversions.

---
 net/tipc/port.c   | 4 ++--
 net/tipc/port.h   | 6 +++---
 net/tipc/socket.c | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
net/tipc/port.c +2 -2
index 84b2a57..0bb185a 100644
@@ -206,7 +206,7 @@ exit:
  *
  * Returns pointer to (locked) TIPC port, or NULL if unable to create it
  */
-struct tipc_port *tipc_createport(void *usr_handle,
+struct tipc_port *tipc_createport(struct sock *sk,
 			u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
 			void (*wakeup)(struct tipc_port *),
 			const u32 importance)
@@ -227,7 +227,7 @@ struct tipc_port *tipc_createport(void *usr_handle,
 		return NULL;
 	}
 
-	p_ptr->usr_handle = usr_handle;
+	p_ptr->sk = sk;
 	p_ptr->max_pkt = MAX_PKT_DEFAULT;
 	p_ptr->ref = ref;
 	INIT_LIST_HEAD(&p_ptr->wait_list);
net/tipc/port.h +3 -3
index 6579e47..ef0df6a 100644
@@ -46,7 +46,7 @@
 
 /**
  * struct tipc_port - TIPC port structure
- * @usr_handle: pointer to additional user-defined information about port
+ * @sk: pointer to socket handle
  * @lock: pointer to spinlock for controlling access to port
  * @connected: non-zero if port is currently connected to a peer port
  * @conn_type: TIPC type used when connection was established
@@ -72,7 +72,7 @@
  * @subscription: "node down" subscription used to terminate failed connections
  */
 struct tipc_port {
-	void *usr_handle;
+	struct sock *sk;
 	spinlock_t *lock;
 	int connected;
 	u32 conn_type;
@@ -104,7 +104,7 @@ struct tipc_port_list;
 /*
  * TIPC port manipulation routines
  */
-struct tipc_port *tipc_createport(void *usr_handle,
+struct tipc_port *tipc_createport(struct sock *sk,
 		u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
 		void (*wakeup)(struct tipc_port *), const u32 importance);
 
net/tipc/socket.c +2 -2
index 258e98d..8c135c5 100644
@@ -1407,7 +1407,7 @@ static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
  */
 static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
 {
-	struct sock *sk = (struct sock *)tport->usr_handle;
+	struct sock *sk = tport->sk;
 	u32 res;
 
 	/*
@@ -1438,7 +1438,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
  */
 static void wakeupdispatch(struct tipc_port *tport)
 {
-	struct sock *sk = (struct sock *)tport->usr_handle;
+	struct sock *sk = tport->sk;
 
 	sk->sk_write_space(sk);
 }
Signature · 1 line
1.8.1.2
#27 lore raw

PATCH 12/12 tipc: cosmetic realignment of function arguments

In reply to Paul Gortmaker

No runtime code changes here. Just a realign of the function arguments to start where the 1st one was, and fit as many args as can be put in an 80 char line.

---
 net/tipc/bcast.c       |  3 +--
 net/tipc/bcast.h       |  3 ++-
 net/tipc/discover.c    |  7 +++----
 net/tipc/eth_media.c   |  2 +-
 net/tipc/link.c        | 18 +++++++-----------
 net/tipc/msg.c         |  4 ++--
 net/tipc/msg.h         |  4 ++--
 net/tipc/name_table.c  | 10 +++++-----
 net/tipc/name_table.h  | 11 ++++++-----
 net/tipc/node_subscr.c |  2 +-
 net/tipc/port.c        |  7 ++++---
 net/tipc/port.h        | 10 ++++++----
 net/tipc/socket.c      | 12 ++++++------
 net/tipc/subscr.c      | 14 ++++----------
 net/tipc/subscr.h      | 13 ++++---------
 15 files changed, 54 insertions(+), 66 deletions(-)
net/tipc/bcast.c +1 -2
index e5f3da5..716de1a 100644
@@ -578,8 +578,7 @@ u32 tipc_bclink_acks_missing(struct tipc_node *n_ptr)
  * Returns 0 (packet sent successfully) under all circumstances,
  * since the broadcast link's pseudo-bearer never blocks
  */
-static int tipc_bcbearer_send(struct sk_buff *buf,
-			      struct tipc_bearer *unused1,
+static int tipc_bcbearer_send(struct sk_buff *buf, struct tipc_bearer *unused1,
 			      struct tipc_media_addr *unused2)
 {
 	int bp_index;
net/tipc/bcast.h +2 -1
index a933065..6ee587b 100644
@@ -75,7 +75,8 @@ void tipc_nmap_remove(struct tipc_node_map *nm_ptr, u32 node);
 /**
  * tipc_nmap_equal - test for equality of node maps
  */
-static inline int tipc_nmap_equal(struct tipc_node_map *nm_a, struct tipc_node_map *nm_b)
+static inline int tipc_nmap_equal(struct tipc_node_map *nm_a,
+				  struct tipc_node_map *nm_b)
 {
 	return !memcmp(nm_a, nm_b, sizeof(*nm_a));
 }
net/tipc/discover.c +3 -4
index eedff58..ecc758c 100644
@@ -70,8 +70,7 @@ struct tipc_link_req {
  * @dest_domain: network domain of node(s) which should respond to message
  * @b_ptr: ptr to bearer issuing message
  */
-static struct sk_buff *tipc_disc_init_msg(u32 type,
-					  u32 dest_domain,
+static struct sk_buff *tipc_disc_init_msg(u32 type, u32 dest_domain,
 					  struct tipc_bearer *b_ptr)
 {
 	struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE);
@@ -346,8 +345,8 @@ exit:
  *
  * Returns 0 if successful, otherwise -errno.
  */
-int tipc_disc_create(struct tipc_bearer *b_ptr,
-		     struct tipc_media_addr *dest, u32 dest_domain)
+int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
+		     u32 dest_domain)
 {
 	struct tipc_link_req *req;
 
net/tipc/eth_media.c +1 -1
index fc60bea..c1aa37f 100644
@@ -62,7 +62,7 @@ static struct eth_bearer eth_bearers[MAX_ETH_BEARERS];
 static int eth_started;
 
 static int recv_notification(struct notifier_block *nb, unsigned long evt,
-			      void *dv);
+			     void *dv);
 /*
  * Network device notifier info
  */
net/tipc/link.c +7 -11
index d34429d..b852c94 100644
@@ -771,8 +771,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
  * link_bundle_buf(): Append contents of a buffer to
  * the tail of an existing one.
  */
-static int link_bundle_buf(struct tipc_link *l_ptr,
-			   struct sk_buff *bundler,
+static int link_bundle_buf(struct tipc_link *l_ptr, struct sk_buff *bundler,
 			   struct sk_buff *buf)
 {
 	struct tipc_msg *bundler_msg = buf_msg(bundler);
@@ -1064,8 +1063,7 @@ static int link_send_buf_fast(struct tipc_link *l_ptr, struct sk_buff *buf,
  */
 int tipc_link_send_sections_fast(struct tipc_port *sender,
 				 struct iovec const *msg_sect,
-				 const u32 num_sect,
-				 unsigned int total_len,
+				 const u32 num_sect, unsigned int total_len,
 				 u32 destaddr)
 {
 	struct tipc_msg *hdr = &sender->phdr;
@@ -1155,8 +1153,7 @@ exit:
  */
 static int link_send_sections_long(struct tipc_port *sender,
 				   struct iovec const *msg_sect,
-				   u32 num_sect,
-				   unsigned int total_len,
+				   u32 num_sect, unsigned int total_len,
 				   u32 destaddr)
 {
 	struct tipc_link *l_ptr;
@@ -1408,7 +1405,7 @@ static void link_reset_all(unsigned long addr)
 }
 
 static void link_retransmit_failure(struct tipc_link *l_ptr,
-					struct sk_buff *buf)
+				    struct sk_buff *buf)
 {
 	struct tipc_msg *msg = buf_msg(buf);
 
@@ -1863,8 +1860,8 @@ static void link_handle_out_of_seq_msg(struct tipc_link *l_ptr,
  * Send protocol message to the other endpoint.
  */
 void tipc_link_send_proto_msg(struct tipc_link *l_ptr, u32 msg_typ,
-				int probe_msg, u32 gap, u32 tolerance,
-				u32 priority, u32 ack_mtu)
+			      int probe_msg, u32 gap, u32 tolerance,
+			      u32 priority, u32 ack_mtu)
 {
 	struct sk_buff *buf = NULL;
 	struct tipc_msg *msg = l_ptr->pmsg;
@@ -2107,8 +2104,7 @@ exit:
  * another bearer. Owner node is locked.
  */
 static void tipc_link_tunnel(struct tipc_link *l_ptr,
-			     struct tipc_msg *tunnel_hdr,
-			     struct tipc_msg  *msg,
+			     struct tipc_msg *tunnel_hdr, struct tipc_msg *msg,
 			     u32 selector)
 {
 	struct tipc_link *tunnel;
net/tipc/msg.c +2 -2
index c2a2613..ced60e2 100644
@@ -51,8 +51,8 @@ u32 tipc_msg_tot_importance(struct tipc_msg *m)
 }
 
 
-void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
-			    u32 hsize, u32 destnode)
+void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize,
+		   u32 destnode)
 {
 	memset(m, 0, hsize);
 	msg_set_version(m);
net/tipc/msg.h +2 -2
index 511019a..5e4ccf5 100644
@@ -719,8 +719,8 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n)
 }
 
 u32 tipc_msg_tot_importance(struct tipc_msg *m);
-void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
-			    u32 hsize, u32 destnode);
+void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, u32 hsize,
+		   u32 destnode);
 int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
 		   u32 num_sect, unsigned int total_len, int max_size,
 		   struct sk_buff **buf);
net/tipc/name_table.c +5 -5
index 24b1679..09dcd54 100644
@@ -440,7 +440,7 @@ found:
  * sequence overlapping with the requested sequence
  */
 static void tipc_nameseq_subscribe(struct name_seq *nseq,
-					struct tipc_subscription *s)
+				   struct tipc_subscription *s)
 {
 	struct sub_seq *sseq = nseq->sseqs;
 
@@ -662,7 +662,7 @@ exit:
  * tipc_nametbl_publish - add name publication to network name tables
  */
 struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
-				    u32 scope, u32 port_ref, u32 key)
+					 u32 scope, u32 port_ref, u32 key)
 {
 	struct publication *publ;
 
@@ -753,7 +753,7 @@ void tipc_nametbl_unsubscribe(struct tipc_subscription *s)
  * subseq_list - print specified sub-sequence contents into the given buffer
  */
 static int subseq_list(struct sub_seq *sseq, char *buf, int len, u32 depth,
-			u32 index)
+		       u32 index)
 {
 	char portIdStr[27];
 	const char *scope_str[] = {"", " zone", " cluster", " node"};
@@ -792,7 +792,7 @@ static int subseq_list(struct sub_seq *sseq, char *buf, int len, u32 depth,
  * nameseq_list - print specified name sequence contents into the given buffer
  */
 static int nameseq_list(struct name_seq *seq, char *buf, int len, u32 depth,
-			 u32 type, u32 lowbound, u32 upbound, u32 index)
+			u32 type, u32 lowbound, u32 upbound, u32 index)
 {
 	struct sub_seq *sseq;
 	char typearea[11];
@@ -849,7 +849,7 @@ static int nametbl_header(char *buf, int len, u32 depth)
  * nametbl_list - print specified name table contents into the given buffer
  */
 static int nametbl_list(char *buf, int len, u32 depth_info,
-			 u32 type, u32 lowbound, u32 upbound)
+			u32 type, u32 lowbound, u32 upbound)
 {
 	struct hlist_head *seq_head;
 	struct name_seq *seq;
net/tipc/name_table.h +6 -5
index 71cb4dc..f02f48b 100644
@@ -87,14 +87,15 @@ extern rwlock_t tipc_nametbl_lock;
 struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space);
 u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *node);
 int tipc_nametbl_mc_translate(u32 type, u32 lower, u32 upper, u32 limit,
-			 struct tipc_port_list *dports);
+			      struct tipc_port_list *dports);
 struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
-				    u32 scope, u32 port_ref, u32 key);
+					 u32 scope, u32 port_ref, u32 key);
 int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key);
 struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
-					u32 scope, u32 node, u32 ref, u32 key);
-struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
-					u32 node, u32 ref, u32 key);
+					     u32 scope, u32 node, u32 ref,
+					     u32 key);
+struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, u32 node,
+					     u32 ref, u32 key);
 void tipc_nametbl_subscribe(struct tipc_subscription *s);
 void tipc_nametbl_unsubscribe(struct tipc_subscription *s);
 int tipc_nametbl_init(void);
net/tipc/node_subscr.c +1 -1
index 5e34b01..8a7384c 100644
@@ -42,7 +42,7 @@
  * tipc_nodesub_subscribe - create "node down" subscription for specified node
  */
 void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
-		       void *usr_handle, net_ev_handler handle_down)
+			    void *usr_handle, net_ev_handler handle_down)
 {
 	if (in_own_node(addr)) {
 		node_sub->node = NULL;
net/tipc/port.c +4 -3
index 0bb185a..b3ed2fc 100644
@@ -207,9 +207,10 @@ exit:
  * Returns pointer to (locked) TIPC port, or NULL if unable to create it
  */
 struct tipc_port *tipc_createport(struct sock *sk,
-			u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
-			void (*wakeup)(struct tipc_port *),
-			const u32 importance)
+				  u32 (*dispatcher)(struct tipc_port *,
+				  struct sk_buff *),
+				  void (*wakeup)(struct tipc_port *),
+				  const u32 importance)
 {
 	struct tipc_port *p_ptr;
 	struct tipc_msg *msg;
net/tipc/port.h +6 -4
index ef0df6a..0661246 100644
@@ -105,8 +105,10 @@ struct tipc_port_list;
  * TIPC port manipulation routines
  */
 struct tipc_port *tipc_createport(struct sock *sk,
-		u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
-		void (*wakeup)(struct tipc_port *), const u32 importance);
+				  u32 (*dispatcher)(struct tipc_port *,
+				  struct sk_buff *),
+				  void (*wakeup)(struct tipc_port *),
+				  const u32 importance);
 
 int tipc_reject_msg(struct sk_buff *buf, u32 err);
 
@@ -124,9 +126,9 @@ int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
 int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
 
 int tipc_publish(u32 portref, unsigned int scope,
-		struct tipc_name_seq const *name_seq);
+		 struct tipc_name_seq const *name_seq);
 int tipc_withdraw(u32 portref, unsigned int scope,
-		struct tipc_name_seq const *name_seq);
+		  struct tipc_name_seq const *name_seq);
 
 int tipc_connect(u32 portref, struct tipc_portid const *port);
 
net/tipc/socket.c +6 -6
index 8c135c5..970c3a1 100644
@@ -280,7 +280,7 @@ void tipc_sock_release_local(struct socket *sock)
  */
 
 int tipc_sock_accept_local(struct socket *sock, struct socket **newsock,
-			    int flags)
+			   int flags)
 {
 	struct sock *sk = sock->sk;
 	int ret;
@@ -891,7 +891,7 @@ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
  * Returns 0 if successful, otherwise errno
  */
 static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg,
-				struct tipc_port *tport)
+			 struct tipc_port *tport)
 {
 	u32 anc_data[3];
 	u32 err;
@@ -1737,8 +1737,8 @@ restart:
  *
  * Returns 0 on success, errno otherwise
  */
-static int setsockopt(struct socket *sock,
-		      int lvl, int opt, char __user *ov, unsigned int ol)
+static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov,
+		      unsigned int ol)
 {
 	struct sock *sk = sock->sk;
 	struct tipc_port *tport = tipc_sk_port(sk);
@@ -1796,8 +1796,8 @@ static int setsockopt(struct socket *sock,
  *
  * Returns 0 on success, errno otherwise
  */
-static int getsockopt(struct socket *sock,
-		      int lvl, int opt, char __user *ov, int __user *ol)
+static int getsockopt(struct socket *sock, int lvl, int opt, char __user *ov,
+		      int __user *ol)
 {
 	struct sock *sk = sock->sk;
 	struct tipc_port *tport = tipc_sk_port(sk);
net/tipc/subscr.c +4 -10
index b2bb565..05dc20a 100644
@@ -117,10 +117,8 @@ static void subscr_send_event(struct tipc_subscription *sub, u32 found_lower,
  *
  * Returns 1 if there is overlap, otherwise 0.
  */
-int tipc_subscr_overlap(struct tipc_subscription *sub,
-			u32 found_lower,
+int tipc_subscr_overlap(struct tipc_subscription *sub, u32 found_lower,
 			u32 found_upper)
-
 {
 	if (found_lower < sub->seq.lower)
 		found_lower = sub->seq.lower;
@@ -136,13 +134,9 @@ int tipc_subscr_overlap(struct tipc_subscription *sub,
  *
  * Protected by nameseq.lock in name_table.c
  */
-void tipc_subscr_report_overlap(struct tipc_subscription *sub,
-				u32 found_lower,
-				u32 found_upper,
-				u32 event,
-				u32 port_ref,
-				u32 node,
-				int must)
+void tipc_subscr_report_overlap(struct tipc_subscription *sub, u32 found_lower,
+				u32 found_upper, u32 event, u32 port_ref,
+				u32 node, int must)
 {
 	if (!tipc_subscr_overlap(sub, found_lower, found_upper))
 		return;
net/tipc/subscr.h +4 -9
index 43e6d63..393e417 100644
@@ -67,17 +67,12 @@ struct tipc_subscription {
 	struct tipc_event evt;
 };
 
-int tipc_subscr_overlap(struct tipc_subscription *sub,
-			u32 found_lower,
+int tipc_subscr_overlap(struct tipc_subscription *sub, u32 found_lower,
 			u32 found_upper);
 
-void tipc_subscr_report_overlap(struct tipc_subscription *sub,
-				u32 found_lower,
-				u32 found_upper,
-				u32 event,
-				u32 port_ref,
-				u32 node,
-				int must_report);
+void tipc_subscr_report_overlap(struct tipc_subscription *sub, u32 found_lower,
+				u32 found_upper, u32 event, u32 port_ref,
+				u32 node, int must);
 
 int tipc_subscr_start(void);
 
Signature · 1 line
1.8.1.2