netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/7] unix_diag: Fixup RQLEN extension report
@ 2011-12-30 10:54 Pavel Emelyanov
  2011-12-30 21:47 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2011-12-30 10:54 UTC (permalink / raw)
  To: David Miller, Linux Netdev List

While it's not too late fix the recently added RQLEN diag extension
to report rqlen and wqlen in the same way as TCP does.

I.e. for listening sockets the ack backlog length (which is the input
queue length for socket) in rqlen and the max ack backlog length in
wqlen, and what the CINQ/OUTQ ioctls do for established.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---
 include/linux/unix_diag.h |    5 +++++
 net/unix/diag.c           |   13 ++++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
index 93fdb78..b1d2bf1 100644
--- a/include/linux/unix_diag.h
+++ b/include/linux/unix_diag.h
@@ -46,4 +46,9 @@ struct unix_diag_vfs {
 	__u32	udiag_vfs_dev;
 };
 
+struct unix_diag_rqlen {
+	__u32	udiag_rqueue;
+	__u32	udiag_wqueue;
+};
+
 #endif
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 9517bdd..9eb63a4 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -101,7 +101,18 @@ rtattr_failure:
 
 static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)
 {
-	RTA_PUT_U32(nlskb, UNIX_DIAG_RQLEN, sk->sk_receive_queue.qlen);
+	struct unix_diag_rqlen *rql;
+
+	rql = UNIX_DIAG_PUT(nlskb, UNIX_DIAG_RQLEN, sizeof(*rql));
+
+	if (sk->sk_state == TCP_LISTEN) {
+		rql->udiag_rqueue = sk->sk_receive_queue.qlen;
+		rql->udiag_wqueue = sk->sk_max_ack_backlog;
+	} else {
+		rql->udiag_rqueue = (__u32)unix_inq_len(sk);
+		rql->udiag_wqueue = (__u32)unix_outq_len(sk);
+	}
+
 	return 0;
 
 rtattr_failure:
-- 
1.5.5.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 7/7] unix_diag: Fixup RQLEN extension report
  2011-12-30 10:54 [PATCH 7/7] unix_diag: Fixup RQLEN extension report Pavel Emelyanov
@ 2011-12-30 21:47 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-12-30 21:47 UTC (permalink / raw)
  To: xemul; +Cc: netdev

From: Pavel Emelyanov <xemul@parallels.com>
Date: Fri, 30 Dec 2011 14:54:39 +0400

> While it's not too late fix the recently added RQLEN diag extension
> to report rqlen and wqlen in the same way as TCP does.
> 
> I.e. for listening sockets the ack backlog length (which is the input
> queue length for socket) in rqlen and the max ack backlog length in
> wqlen, and what the CINQ/OUTQ ioctls do for established.
> 
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-30 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-30 10:54 [PATCH 7/7] unix_diag: Fixup RQLEN extension report Pavel Emelyanov
2011-12-30 21:47 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).