From 749c08f8206cdf5cad15d557912898ce22aa55da Mon Sep 17 00:00:00 2001 From: Richard Sailer Date: Mon, 20 Jul 2020 18:06:14 +0200 Subject: 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: Richard Sailer Signed-off-by: David S. Miller --- net/dccp/proto.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'net/dccp') diff --git a/net/dccp/proto.c b/net/dccp/proto.c index fd92d3fe321f..9e453611107f 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -375,6 +375,15 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) goto out; 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: { struct sk_buff *skb; unsigned long amount = 0; -- cgit v1.2.3