Message ID | 20200530163159.932749-1-richard_siegfried@systemli.org |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | [v2] net: dccp: Add SIOCOUTQ IOCTL support (send buffer fill) | expand |
From: Richard Sailer <richard_siegfried@systemli.org> Date: Sat, 30 May 2020 18:31:59 +0200 > @@ -375,6 +375,14 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) > goto out; > > switch (cmd) { > + case SIOCOUTQ: { > + /* Using sk_wmem_alloc here because sk_wmem_queued is not used by DCCP and > + * always 0, comparably to UDP. > + */ > + int amount = sk_wmem_alloc_get(sk); > + rc = put_user(amount, (int __user *)arg); > + } > + break; Please fix this indentation.
diff --git a/Documentation/networking/dccp.txt b/Documentation/networking/dccp.txt index 55c575fcaf17d..682ecf8288827 100644 --- a/Documentation/networking/dccp.txt +++ b/Documentation/networking/dccp.txt @@ -185,6 +185,8 @@ FIONREAD 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. +SIOCOUTQ + Returns the number of data bytes in the local send queue. Other tunables ============== diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 4af8a98fe7846..53ed36705b820 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -375,6 +375,14 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) goto out; switch (cmd) { + case SIOCOUTQ: { + /* Using sk_wmem_alloc here because sk_wmem_queued is not used by DCCP and + * always 0, comparably to UDP. + */ + int amount = sk_wmem_alloc_get(sk); + rc = put_user(amount, (int __user *)arg); + } + break; case SIOCINQ: { struct sk_buff *skb; unsigned long amount = 0;