diff options
author | Tung Nguyen <tung.q.nguyen@dektech.com.au> | 2019-04-18 10:02:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-19 17:59:05 -0400 |
commit | 42e5425aa0dfd8a6cdd7e177cfd9703df05c7411 (patch) | |
tree | 39e900102d0b395f3759cb8d252ec84cfc4fb65e /net/tipc/socket.c | |
parent | a26deec69fa4a1843f11f11e123b49ed0699ff00 (diff) |
tipc: introduce new socket option TIPC_SOCK_RECVQ_USED
When using TIPC_SOCK_RECVQ_DEPTH for getsockopt(), it returns the
number of buffers in receive socket buffer which is not so helpful
for user space applications.
This commit introduces the new option TIPC_SOCK_RECVQ_USED which
returns the current allocated bytes of the receive socket buffer.
This helps user space applications dimension its buffer usage to
avoid buffer overload issue.
Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 8ac8ddf1e324..1385207a301f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -3070,6 +3070,9 @@ static int tipc_getsockopt(struct socket *sock, int lvl, int opt, | |||
3070 | case TIPC_SOCK_RECVQ_DEPTH: | 3070 | case TIPC_SOCK_RECVQ_DEPTH: |
3071 | value = skb_queue_len(&sk->sk_receive_queue); | 3071 | value = skb_queue_len(&sk->sk_receive_queue); |
3072 | break; | 3072 | break; |
3073 | case TIPC_SOCK_RECVQ_USED: | ||
3074 | value = sk_rmem_alloc_get(sk); | ||
3075 | break; | ||
3073 | case TIPC_GROUP_JOIN: | 3076 | case TIPC_GROUP_JOIN: |
3074 | seq.type = 0; | 3077 | seq.type = 0; |
3075 | if (tsk->group) | 3078 | if (tsk->group) |