From: Richard Sailer <richard_siegfried@systemli.org> To: gerrit@erg.abdn.ac.uk, davem@davemloft.net, dccp@vger.kernel.org Cc: netdev@vger.kernel.org Subject: [PATCH v3] net: dccp: Add SIOCOUTQ IOCTL support (send buffer fill) Date: Wed, 3 Jun 2020 13:10:51 +0200 [thread overview] Message-ID: <20200603111051.12224-1-richard_siegfried@systemli.org> (raw) 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 <richard_siegfried@systemli.org> --- v3: whitespace fixes --- Documentation/networking/dccp.txt | 2 ++ net/dccp/proto.c | 8 ++++++++ 2 files changed, 10 insertions(+) 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..148de5ec585b2 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; -- 2.26.2
WARNING: multiple messages have this Message-ID (diff)
From: Richard Sailer <richard_siegfried@systemli.org> To: dccp@vger.kernel.org Subject: [PATCH v3] net: dccp: Add SIOCOUTQ IOCTL support (send buffer fill) Date: Wed, 03 Jun 2020 11:10:51 +0000 [thread overview] Message-ID: <20200603111051.12224-1-richard_siegfried@systemli.org> (raw) 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 <richard_siegfried@systemli.org> --- v3: whitespace fixes --- Documentation/networking/dccp.txt | 2 ++ net/dccp/proto.c | 8 ++++++++ 2 files changed, 10 insertions(+) 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..148de5ec585b2 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; -- 2.26.2
next reply other threads:[~2020-06-03 11:11 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-03 11:10 Richard Sailer [this message] 2020-06-03 11:10 ` [PATCH v3] net: dccp: Add SIOCOUTQ IOCTL support (send buffer fill) Richard Sailer 2020-06-03 17:47 ` David Miller 2020-06-03 17:47 ` David Miller 2020-06-03 17:56 ` Richard Siegfried 2020-06-03 17:56 ` Richard Siegfried
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200603111051.12224-1-richard_siegfried@systemli.org \ --to=richard_siegfried@systemli.org \ --cc=davem@davemloft.net \ --cc=dccp@vger.kernel.org \ --cc=gerrit@erg.abdn.ac.uk \ --cc=netdev@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.