Commit 749c08f8 authored by Richard Sailer's avatar Richard Sailer Committed by David S. Miller

net: dccp: Add SIOCOUTQ IOCTL support (send buffer fill)

This adds support for the SIOCOUTQ IOCTL to get the send buffer fill
of a DCCP socket, like UDP and TCP sockets already have.

Regarding the used data field: DCCP uses per packet sequence numbers,
not per byte, so sequence numbers can't be used like in TCP. sk_wmem_queued
is not used by DCCP and always 0, even in test on highly congested paths.
Therefore this uses sk_wmem_alloc like in UDP.
Signed-off-by: default avatarRichard Sailer <richard_siegfried@systemli.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 09a0d326
...@@ -192,6 +192,9 @@ FIONREAD ...@@ -192,6 +192,9 @@ FIONREAD
Works as in udp(7): returns in the ``int`` argument pointer the size of Works as in udp(7): returns in the ``int`` argument pointer the size of
the next pending datagram in bytes, or 0 when no datagram is pending. the next pending datagram in bytes, or 0 when no datagram is pending.
SIOCOUTQ
Returns the number of unsent data bytes in the socket send queue as ``int``
into the buffer specified by the argument pointer.
Other tunables Other tunables
============== ==============
......
...@@ -375,6 +375,15 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) ...@@ -375,6 +375,15 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg)
goto out; goto out;
switch (cmd) { switch (cmd) {
case SIOCOUTQ: {
int amount = sk_wmem_alloc_get(sk);
/* Using sk_wmem_alloc here because sk_wmem_queued is not used by DCCP and
* always 0, comparably to UDP.
*/
rc = put_user(amount, (int __user *)arg);
}
break;
case SIOCINQ: { case SIOCINQ: {
struct sk_buff *skb; struct sk_buff *skb;
unsigned long amount = 0; unsigned long amount = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment