All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BUG-FIX] udp_diag: implement idiag_get_info for udp/udplite to get queue information
@ 2012-04-25  4:15 Shan Wei
  2012-04-25 12:28 ` Pavel Emelyanov
  0 siblings, 1 reply; 3+ messages in thread
From: Shan Wei @ 2012-04-25  4:15 UTC (permalink / raw)
  To: David Miller, kuznet, jmorris, xemul; +Cc: NetDev, davidshan

From: Shan Wei <davidshan@tencent.com>

When we use netlink to monitor queue information for udp socket,
idiag_rqueue and idiag_wqueue of inet_diag_msg are returned with 0.

Keep consistent with netstat, just return back allocated rmem/wmem size.

Signed-off-by: Shan Wei <davidshan@tencent.com>
---
 net/ipv4/inet_diag.c |    2 +-
 net/ipv4/udp_diag.c  |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 8d25a1c..8f8db72 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -141,7 +141,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
 			goto rtattr_failure;
 
 	if (icsk == NULL) {
-		r->idiag_rqueue = r->idiag_wqueue = 0;
+		handler->idiag_get_info(sk, r, NULL);
 		goto out;
 	}
 
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 8a949f1..a7f86a3 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -146,9 +146,17 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
 	return udp_dump_one(&udp_table, in_skb, nlh, req);
 }
 
+static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
+		void *info)
+{
+	r->idiag_rqueue = sk_rmem_alloc_get(sk);
+	r->idiag_wqueue = sk_wmem_alloc_get(sk);
+}
+
 static const struct inet_diag_handler udp_diag_handler = {
 	.dump		 = udp_diag_dump,
 	.dump_one	 = udp_diag_dump_one,
+	.idiag_get_info  = udp_diag_get_info,
 	.idiag_type	 = IPPROTO_UDP,
 };
 
@@ -167,6 +175,7 @@ static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *
 static const struct inet_diag_handler udplite_diag_handler = {
 	.dump		 = udplite_diag_dump,
 	.dump_one	 = udplite_diag_dump_one,
+	.idiag_get_info  = udp_diag_get_info,
 	.idiag_type	 = IPPROTO_UDPLITE,
 };
 
-- 
1.7.1

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

* Re: [PATCH BUG-FIX] udp_diag: implement idiag_get_info for udp/udplite to get queue information
  2012-04-25  4:15 [PATCH BUG-FIX] udp_diag: implement idiag_get_info for udp/udplite to get queue information Shan Wei
@ 2012-04-25 12:28 ` Pavel Emelyanov
  2012-04-26  0:46   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2012-04-25 12:28 UTC (permalink / raw)
  To: Shan Wei; +Cc: David Miller, Alexey Kuznetsov, jmorris, NetDev, davidshan

On 04/25/2012 08:15 AM, Shan Wei wrote:
> From: Shan Wei <davidshan@tencent.com>
> 
> When we use netlink to monitor queue information for udp socket,
> idiag_rqueue and idiag_wqueue of inet_diag_msg are returned with 0.
> 
> Keep consistent with netstat, just return back allocated rmem/wmem size.
> 
> Signed-off-by: Shan Wei <davidshan@tencent.com>

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

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

* Re: [PATCH BUG-FIX] udp_diag: implement idiag_get_info for udp/udplite to get queue information
  2012-04-25 12:28 ` Pavel Emelyanov
@ 2012-04-26  0:46   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-04-26  0:46 UTC (permalink / raw)
  To: xemul; +Cc: shanwei88, kuznet, jmorris, netdev, davidshan

From: Pavel Emelyanov <xemul@parallels.com>
Date: Wed, 25 Apr 2012 16:28:31 +0400

> On 04/25/2012 08:15 AM, Shan Wei wrote:
>> From: Shan Wei <davidshan@tencent.com>
>> 
>> When we use netlink to monitor queue information for udp socket,
>> idiag_rqueue and idiag_wqueue of inet_diag_msg are returned with 0.
>> 
>> Keep consistent with netstat, just return back allocated rmem/wmem size.
>> 
>> Signed-off-by: Shan Wei <davidshan@tencent.com>
> 
> Acked-by: Pavel Emelyanov <xemul@parallels.com>

Applied, thanks.

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

end of thread, other threads:[~2012-04-26  0:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25  4:15 [PATCH BUG-FIX] udp_diag: implement idiag_get_info for udp/udplite to get queue information Shan Wei
2012-04-25 12:28 ` Pavel Emelyanov
2012-04-26  0:46   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.