diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2009-10-12 16:26:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-12 16:26:31 -0400 |
commit | 3b885787ea4112eaa80945999ea0901bf742707f (patch) | |
tree | 06fc15f8e8083d5652ccb4d06653d9812dce9c0b /arch | |
parent | d5e63bded6e819ca77ee1a1d97c783a31f6caf30 (diff) |
net: Generalize socket rx gap / receive queue overflow cmsg
Create a new socket level option to report number of queue overflows
Recently I augmented the AF_PACKET protocol to report the number of frames lost
on the socket receive queue between any two enqueued frames. This value was
exported via a SOL_PACKET level cmsg. AFter I completed that work it was
requested that this feature be generalized so that any datagram oriented socket
could make use of this option. As such I've created this patch, It creates a
new SOL_SOCKET level option called SO_RXQ_OVFL, which when enabled exports a
SOL_SOCKET level cmsg that reports the nubmer of times the sk_receive_queue
overflowed between any two given frames. It also augments the AF_PACKET
protocol to take advantage of this new feature (as it previously did not touch
sk->sk_drops, which this patch uses to record the overflow count). Tested
successfully by me.
Notes:
1) Unlike my previous patch, this patch simply records the sk_drops value, which
is not a number of drops between packets, but rather a total number of drops.
Deltas must be computed in user space.
2) While this patch currently works with datagram oriented protocols, it will
also be accepted by non-datagram oriented protocols. I'm not sure if thats
agreeable to everyone, but my argument in favor of doing so is that, for those
protocols which aren't applicable to this option, sk_drops will always be zero,
and reporting no drops on a receive queue that isn't used for those
non-participating protocols seems reasonable to me. This also saves us having
to code in a per-protocol opt in mechanism.
3) This applies cleanly to net-next assuming that commit
977750076d98c7ff6cbda51858bb5a5894a9d9ab (my af packet cmsg patch) is reverted
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/avr32/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/cris/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/frv/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/h8300/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/ia64/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/m32r/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/mips/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/mn10300/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/parisc/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/sparc/include/asm/socket.h | 2 | ||||
-rw-r--r-- | arch/xtensa/include/asm/socket.h | 2 |
16 files changed, 32 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/socket.h b/arch/alpha/include/asm/socket.h index 26773e3246e2..06edfefc3373 100644 --- a/arch/alpha/include/asm/socket.h +++ b/arch/alpha/include/asm/socket.h | |||
@@ -67,6 +67,8 @@ | |||
67 | #define SO_TIMESTAMPING 37 | 67 | #define SO_TIMESTAMPING 37 |
68 | #define SCM_TIMESTAMPING SO_TIMESTAMPING | 68 | #define SCM_TIMESTAMPING SO_TIMESTAMPING |
69 | 69 | ||
70 | #define SO_RXQ_OVFL 40 | ||
71 | |||
70 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we | 72 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we |
71 | * have to define SOCK_NONBLOCK to a different value here. | 73 | * have to define SOCK_NONBLOCK to a different value here. |
72 | */ | 74 | */ |
diff --git a/arch/arm/include/asm/socket.h b/arch/arm/include/asm/socket.h index 92ac61d294fd..90ffd04b8e74 100644 --- a/arch/arm/include/asm/socket.h +++ b/arch/arm/include/asm/socket.h | |||
@@ -60,4 +60,6 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* _ASM_SOCKET_H */ | 65 | #endif /* _ASM_SOCKET_H */ |
diff --git a/arch/avr32/include/asm/socket.h b/arch/avr32/include/asm/socket.h index fe863f9794d5..c8d1fae49476 100644 --- a/arch/avr32/include/asm/socket.h +++ b/arch/avr32/include/asm/socket.h | |||
@@ -60,4 +60,6 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* __ASM_AVR32_SOCKET_H */ | 65 | #endif /* __ASM_AVR32_SOCKET_H */ |
diff --git a/arch/cris/include/asm/socket.h b/arch/cris/include/asm/socket.h index 45ec49bdb7b1..1a4a61909ca8 100644 --- a/arch/cris/include/asm/socket.h +++ b/arch/cris/include/asm/socket.h | |||
@@ -62,6 +62,8 @@ | |||
62 | #define SO_PROTOCOL 38 | 62 | #define SO_PROTOCOL 38 |
63 | #define SO_DOMAIN 39 | 63 | #define SO_DOMAIN 39 |
64 | 64 | ||
65 | #define SO_RXQ_OVFL 40 | ||
66 | |||
65 | #endif /* _ASM_SOCKET_H */ | 67 | #endif /* _ASM_SOCKET_H */ |
66 | 68 | ||
67 | 69 | ||
diff --git a/arch/frv/include/asm/socket.h b/arch/frv/include/asm/socket.h index 2dea726095c2..a6b26880c1ec 100644 --- a/arch/frv/include/asm/socket.h +++ b/arch/frv/include/asm/socket.h | |||
@@ -60,5 +60,7 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* _ASM_SOCKET_H */ | 65 | #endif /* _ASM_SOCKET_H */ |
64 | 66 | ||
diff --git a/arch/h8300/include/asm/socket.h b/arch/h8300/include/asm/socket.h index 1547f01c8e22..04c0f4596eb5 100644 --- a/arch/h8300/include/asm/socket.h +++ b/arch/h8300/include/asm/socket.h | |||
@@ -60,4 +60,6 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* _ASM_SOCKET_H */ | 65 | #endif /* _ASM_SOCKET_H */ |
diff --git a/arch/ia64/include/asm/socket.h b/arch/ia64/include/asm/socket.h index 0b0d5ff062e5..51427eaa51ba 100644 --- a/arch/ia64/include/asm/socket.h +++ b/arch/ia64/include/asm/socket.h | |||
@@ -69,4 +69,6 @@ | |||
69 | #define SO_PROTOCOL 38 | 69 | #define SO_PROTOCOL 38 |
70 | #define SO_DOMAIN 39 | 70 | #define SO_DOMAIN 39 |
71 | 71 | ||
72 | #define SO_RXQ_OVFL 40 | ||
73 | |||
72 | #endif /* _ASM_IA64_SOCKET_H */ | 74 | #endif /* _ASM_IA64_SOCKET_H */ |
diff --git a/arch/m32r/include/asm/socket.h b/arch/m32r/include/asm/socket.h index 3390a864f224..469787c30098 100644 --- a/arch/m32r/include/asm/socket.h +++ b/arch/m32r/include/asm/socket.h | |||
@@ -60,4 +60,6 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* _ASM_M32R_SOCKET_H */ | 65 | #endif /* _ASM_M32R_SOCKET_H */ |
diff --git a/arch/m68k/include/asm/socket.h b/arch/m68k/include/asm/socket.h index eee01cce921b..9bf49c87d954 100644 --- a/arch/m68k/include/asm/socket.h +++ b/arch/m68k/include/asm/socket.h | |||
@@ -60,4 +60,6 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* _ASM_SOCKET_H */ | 65 | #endif /* _ASM_SOCKET_H */ |
diff --git a/arch/mips/include/asm/socket.h b/arch/mips/include/asm/socket.h index ae05accd9fe4..9de5190f2487 100644 --- a/arch/mips/include/asm/socket.h +++ b/arch/mips/include/asm/socket.h | |||
@@ -80,6 +80,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */ | |||
80 | #define SO_TIMESTAMPING 37 | 80 | #define SO_TIMESTAMPING 37 |
81 | #define SCM_TIMESTAMPING SO_TIMESTAMPING | 81 | #define SCM_TIMESTAMPING SO_TIMESTAMPING |
82 | 82 | ||
83 | #define SO_RXQ_OVFL 40 | ||
84 | |||
83 | #ifdef __KERNEL__ | 85 | #ifdef __KERNEL__ |
84 | 86 | ||
85 | /** sock_type - Socket types | 87 | /** sock_type - Socket types |
diff --git a/arch/mn10300/include/asm/socket.h b/arch/mn10300/include/asm/socket.h index 4df75af29d76..4e60c4281288 100644 --- a/arch/mn10300/include/asm/socket.h +++ b/arch/mn10300/include/asm/socket.h | |||
@@ -60,4 +60,6 @@ | |||
60 | #define SO_PROTOCOL 38 | 60 | #define SO_PROTOCOL 38 |
61 | #define SO_DOMAIN 39 | 61 | #define SO_DOMAIN 39 |
62 | 62 | ||
63 | #define SO_RXQ_OVFL 40 | ||
64 | |||
63 | #endif /* _ASM_SOCKET_H */ | 65 | #endif /* _ASM_SOCKET_H */ |
diff --git a/arch/parisc/include/asm/socket.h b/arch/parisc/include/asm/socket.h index 960b1e5d8e16..225b7d6a1a0a 100644 --- a/arch/parisc/include/asm/socket.h +++ b/arch/parisc/include/asm/socket.h | |||
@@ -59,6 +59,8 @@ | |||
59 | #define SO_TIMESTAMPING 0x4020 | 59 | #define SO_TIMESTAMPING 0x4020 |
60 | #define SCM_TIMESTAMPING SO_TIMESTAMPING | 60 | #define SCM_TIMESTAMPING SO_TIMESTAMPING |
61 | 61 | ||
62 | #define SO_RXQ_OVFL 0x4021 | ||
63 | |||
62 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we | 64 | /* O_NONBLOCK clashes with the bits used for socket types. Therefore we |
63 | * have to define SOCK_NONBLOCK to a different value here. | 65 | * have to define SOCK_NONBLOCK to a different value here. |
64 | */ | 66 | */ |
diff --git a/arch/powerpc/include/asm/socket.h b/arch/powerpc/include/asm/socket.h index 3ab8b3e6feb0..866f7606da68 100644 --- a/arch/powerpc/include/asm/socket.h +++ b/arch/powerpc/include/asm/socket.h | |||
@@ -67,4 +67,6 @@ | |||
67 | #define SO_PROTOCOL 38 | 67 | #define SO_PROTOCOL 38 |
68 | #define SO_DOMAIN 39 | 68 | #define SO_DOMAIN 39 |
69 | 69 | ||
70 | #define SO_RXQ_OVFL 40 | ||
71 | |||
70 | #endif /* _ASM_POWERPC_SOCKET_H */ | 72 | #endif /* _ASM_POWERPC_SOCKET_H */ |
diff --git a/arch/s390/include/asm/socket.h b/arch/s390/include/asm/socket.h index e42df89a0b85..fdff1e995c73 100644 --- a/arch/s390/include/asm/socket.h +++ b/arch/s390/include/asm/socket.h | |||
@@ -68,4 +68,6 @@ | |||
68 | #define SO_PROTOCOL 38 | 68 | #define SO_PROTOCOL 38 |
69 | #define SO_DOMAIN 39 | 69 | #define SO_DOMAIN 39 |
70 | 70 | ||
71 | #define SO_RXQ_OVFL 40 | ||
72 | |||
71 | #endif /* _ASM_SOCKET_H */ | 73 | #endif /* _ASM_SOCKET_H */ |
diff --git a/arch/sparc/include/asm/socket.h b/arch/sparc/include/asm/socket.h index 3a5ae3d12088..9d3fefcff2f5 100644 --- a/arch/sparc/include/asm/socket.h +++ b/arch/sparc/include/asm/socket.h | |||
@@ -56,6 +56,8 @@ | |||
56 | #define SO_TIMESTAMPING 0x0023 | 56 | #define SO_TIMESTAMPING 0x0023 |
57 | #define SCM_TIMESTAMPING SO_TIMESTAMPING | 57 | #define SCM_TIMESTAMPING SO_TIMESTAMPING |
58 | 58 | ||
59 | #define SO_RXQ_OVFL 0x0024 | ||
60 | |||
59 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | 61 | /* Security levels - as per NRL IPv6 - don't actually do anything */ |
60 | #define SO_SECURITY_AUTHENTICATION 0x5001 | 62 | #define SO_SECURITY_AUTHENTICATION 0x5001 |
61 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 | 63 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 |
diff --git a/arch/xtensa/include/asm/socket.h b/arch/xtensa/include/asm/socket.h index beb3a6bdb61d..cbdf2ffaacff 100644 --- a/arch/xtensa/include/asm/socket.h +++ b/arch/xtensa/include/asm/socket.h | |||
@@ -71,4 +71,6 @@ | |||
71 | #define SO_PROTOCOL 38 | 71 | #define SO_PROTOCOL 38 |
72 | #define SO_DOMAIN 39 | 72 | #define SO_DOMAIN 39 |
73 | 73 | ||
74 | #define SO_RXQ_OVFL 40 | ||
75 | |||
74 | #endif /* _XTENSA_SOCKET_H */ | 76 | #endif /* _XTENSA_SOCKET_H */ |