]> git.baikalelectronics.ru Git - kernel.git/commit
net: wwan: core: implement TIOCINQ ioctl
authorSergey Ryazanov <ryazanov.s.a@gmail.com>
Tue, 8 Jun 2021 04:02:39 +0000 (07:02 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jun 2021 21:33:43 +0000 (14:33 -0700)
commit50ccd9e132ff607a7f95753fc532e2e0ecaa6877
treebb5b63cdea2dd0058ad099aa546eded786e90c19
parent2626320c3f62e06f94f21ce1f22fb59c3143292a
net: wwan: core: implement TIOCINQ ioctl

It is quite common for a userpace program to fetch the buffered amount
of data in the rx queue to avoid the read block. Implement the TIOCINQ
ioctl to make the migration to the WWAN port usage smooth.

Despite the fact that the read call will return no more data than the
size of a first skb in the queue, TIOCINQ returns the entire amount of
buffered data (sum of all queued skbs). This is done to prevent the
breaking of programs that optimize reading, avoiding it if the buffered
amount of data is too small.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wwan/wwan_core.c