* [PATCH] tcp: ioctl type SIOCOUTQNSD returns amount of data not sent
@ 2010-10-05 9:32 Mario Schuknecht
2011-02-23 12:14 ` Steffen Sledz
0 siblings, 1 reply; 3+ messages in thread
From: Mario Schuknecht @ 2010-10-05 9:32 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Cox, linux-net, Mario Schuknecht
In contrast to SIOCOUTQ which returns the amount of data sent
but not yet acknowledged plus data not yet sent this patch only
returns the data not sent.
For various methods of live streaming bitrate control it may
be helpful to know how much data are in the tcp outqueue are
not sent yet.
Signed-off-by: Mario Schuknecht <m.schuknecht@dresearch.de>
---
include/asm-generic/ioctls.h | 1 +
include/linux/sockios.h | 1 +
net/ipv4/tcp.c | 9 +++++++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a321665..b87115b 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -72,6 +72,7 @@
#define TCSETXF 0x5434
#define TCSETXW 0x5435
#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
+#define TIOCOUTQNSD 0x5437
#define FIONCLEX 0x5450
#define FIOCLEX 0x5451
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 241f179..4c5ca47 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -23,6 +23,7 @@
/* Linux-specific socket ioctls */
#define SIOCINQ FIONREAD
#define SIOCOUTQ TIOCOUTQ
+#define SIOCOUTQNSD TIOCOUTQNSD
/* Routing table calls. */
#define SIOCADDRT 0x890B /* add routing table entry */
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1664a05..c2d52e8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -505,6 +505,15 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
else
answ = tp->write_seq - tp->snd_una;
break;
+ case SIOCOUTQNSD:
+ if (sk->sk_state == TCP_LISTEN)
+ return -EINVAL;
+
+ if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
+ answ = 0;
+ else
+ answ = tp->write_seq - tp->snd_nxt;
+ break;
default:
return -ENOIOCTLCMD;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp: ioctl type SIOCOUTQNSD returns amount of data not sent
2010-10-05 9:32 [PATCH] tcp: ioctl type SIOCOUTQNSD returns amount of data not sent Mario Schuknecht
@ 2011-02-23 12:14 ` Steffen Sledz
2011-03-04 11:49 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Steffen Sledz @ 2011-02-23 12:14 UTC (permalink / raw)
To: linux-kernel, linux-net
Cc: Mario Schuknecht, Alan Cox, Fred N. van Kempen, Mark Evans,
Corey Minyard, Florian La Roche, Charles Hedrick, Linus Torvalds,
Alan Cox, Matthew Dillon, Arnt Gulbrandsen, Jorge Cwik,
Matthew Dillon, Alan Cox, Linus Torvalds, Charles Hedrick,
Fred.van.Kempen
Am 05.10.2010 11:32, schrieb Mario Schuknecht:
> In contrast to SIOCOUTQ which returns the amount of data sent
> but not yet acknowledged plus data not yet sent this patch only
> returns the data not sent.
>
> For various methods of live streaming bitrate control it may
> be helpful to know how much data are in the tcp outqueue are
> not sent yet.
>
> Signed-off-by: Mario Schuknecht <m.schuknecht@dresearch.de>
> ---
> include/asm-generic/ioctls.h | 1 +
> include/linux/sockios.h | 1 +
> net/ipv4/tcp.c | 9 +++++++++
> 3 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
> index a321665..b87115b 100644
> --- a/include/asm-generic/ioctls.h
> +++ b/include/asm-generic/ioctls.h
> @@ -72,6 +72,7 @@
> #define TCSETXF 0x5434
> #define TCSETXW 0x5435
> #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
> +#define TIOCOUTQNSD 0x5437
>
> #define FIONCLEX 0x5450
> #define FIOCLEX 0x5451
> diff --git a/include/linux/sockios.h b/include/linux/sockios.h
> index 241f179..4c5ca47 100644
> --- a/include/linux/sockios.h
> +++ b/include/linux/sockios.h
> @@ -23,6 +23,7 @@
> /* Linux-specific socket ioctls */
> #define SIOCINQ FIONREAD
> #define SIOCOUTQ TIOCOUTQ
> +#define SIOCOUTQNSD TIOCOUTQNSD
>
> /* Routing table calls. */
> #define SIOCADDRT 0x890B /* add routing table entry */
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 1664a05..c2d52e8 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -505,6 +505,15 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
> else
> answ = tp->write_seq - tp->snd_una;
> break;
> + case SIOCOUTQNSD:
> + if (sk->sk_state == TCP_LISTEN)
> + return -EINVAL;
> +
> + if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
> + answ = 0;
> + else
> + answ = tp->write_seq - tp->snd_nxt;
> + break;
> default:
> return -ENOIOCTLCMD;
> }
Ping!
It would be nice to get some feedback on this. We really need an extension of this kind.
If the patch does something in a wrong way (esp. choosing the TIOCOUTQNSD id) please give us a hint how to do it in the right way.
Thx,
Steffen Sledz
--
DResearch Fahrzeugelektronik GmbH
Otto-Schmirgal-Str. 3, 10319 Berlin, Germany
Tel: +49 30 515932-237 mailto:sledz@DResearch.de
Fax: +49 30 515932-299
Geschäftsführer: Dr. Michael Weber, Werner Mögle;
Amtsgericht Berlin Charlottenburg; HRB 130120 B;
Ust.-IDNr. DE273952058
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp: ioctl type SIOCOUTQNSD returns amount of data not sent
2011-02-23 12:14 ` Steffen Sledz
@ 2011-03-04 11:49 ` Alan Cox
0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2011-03-04 11:49 UTC (permalink / raw)
To: Steffen Sledz
Cc: linux-kernel, linux-net, Mario Schuknecht, Fred N. van Kempen,
Mark Evans, Corey Minyard, Florian La Roche, Charles Hedrick,
Linus Torvalds, Alan Cox, Matthew Dillon, Arnt Gulbrandsen,
Jorge Cwik, Matthew Dillon, Alan Cox, Linus Torvalds,
Charles Hedrick, Fred.van.Kempen
On Wed, 23 Feb 2011 13:14:10 +0100
Steffen Sledz <sledz@dresearch.de> wrote:
> Am 05.10.2010 11:32, schrieb Mario Schuknecht:
> > In contrast to SIOCOUTQ which returns the amount of data sent
> > but not yet acknowledged plus data not yet sent this patch only
> > returns the data not sent.
> >
> > For various methods of live streaming bitrate control it may
> > be helpful to know how much data are in the tcp outqueue are
> > not sent yet.
> >
> > Signed-off-by: Mario Schuknecht <m.schuknecht@dresearch.de>
> > ---
> > include/asm-generic/ioctls.h | 1 +
> > include/linux/sockios.h | 1 +
> > net/ipv4/tcp.c | 9 +++++++++
> > 3 files changed, 11 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
> > index a321665..b87115b 100644
> > --- a/include/asm-generic/ioctls.h
> > +++ b/include/asm-generic/ioctls.h
> > @@ -72,6 +72,7 @@
> > #define TCSETXF 0x5434
> > #define TCSETXW 0x5435
> > #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
> > +#define TIOCOUTQNSD 0x5437
These are tty not socket ioctl codes. For various historical reasons some
of them got sort of emulated by the socket layer in Unix and thus in
Linux.
If you plan to add one to Linux then please post the accompanying *tty
layer* patches and reasoning, otherwise if it is socket only please stick
to the socket ioctl.
Alan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-04 11:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-05 9:32 [PATCH] tcp: ioctl type SIOCOUTQNSD returns amount of data not sent Mario Schuknecht
2011-02-23 12:14 ` Steffen Sledz
2011-03-04 11:49 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox