All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 08/10] net: wwan: core: implement TIOCINQ ioctl
@ 2021-06-08  8:15 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-06-08  8:15 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3561 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210608040241.10658-9-ryazanov.s.a@gmail.com>
References: <20210608040241.10658-9-ryazanov.s.a@gmail.com>
TO: Sergey Ryazanov <ryazanov.s.a@gmail.com>
TO: Loic Poulain <loic.poulain@linaro.org>
TO: "David S. Miller" <davem@davemloft.net>
CC: netdev(a)vger.kernel.org
TO: Jakub Kicinski <kuba@kernel.org>
CC: linux-wireless(a)vger.kernel.org

Hi Sergey,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on next-20210607]
[cannot apply to net/master linus/master v5.13-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sergey-Ryazanov/net-WWAN-subsystem-improvements/20210608-120615
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git dc8cf7550a703b8b9c94beed621c6c2474347eff
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: x86_64-randconfig-b001-20210607 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d32cc150feb72f315a5bbd34f92e7beca21a50da)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # apt-get install iwyu # include-what-you-use
        # https://github.com/0day-ci/linux/commit/b7ae097823b5d259af4ac8f8d2e5eb6b21698197
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sergey-Ryazanov/net-WWAN-subsystem-improvements/20210608-120615
        git checkout b7ae097823b5d259af4ac8f8d2e5eb6b21698197
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross C=1 CHECK=iwyu ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


iwyu warnings: (new ones prefixed by >>)
>> drivers/net/wwan/wwan_core.c:15:1: iwyu: warning: superfluous #include <linux/termios.h>

vim +15 drivers/net/wwan/wwan_core.c

9a44c1cc638876 Loic Poulain    2021-04-16   3  
9a44c1cc638876 Loic Poulain    2021-04-16   4  #include <linux/err.h>
9a44c1cc638876 Loic Poulain    2021-04-16   5  #include <linux/errno.h>
9a44c1cc638876 Loic Poulain    2021-04-16   6  #include <linux/fs.h>
9a44c1cc638876 Loic Poulain    2021-04-16   7  #include <linux/init.h>
9a44c1cc638876 Loic Poulain    2021-04-16   8  #include <linux/idr.h>
9a44c1cc638876 Loic Poulain    2021-04-16   9  #include <linux/kernel.h>
9a44c1cc638876 Loic Poulain    2021-04-16  10  #include <linux/module.h>
9a44c1cc638876 Loic Poulain    2021-04-16  11  #include <linux/poll.h>
9a44c1cc638876 Loic Poulain    2021-04-16  12  #include <linux/skbuff.h>
9a44c1cc638876 Loic Poulain    2021-04-16  13  #include <linux/slab.h>
9a44c1cc638876 Loic Poulain    2021-04-16  14  #include <linux/types.h>
b7ae097823b5d2 Sergey Ryazanov 2021-06-08 @15  #include <linux/termios.h>
9a44c1cc638876 Loic Poulain    2021-04-16  16  #include <linux/wwan.h>
9a44c1cc638876 Loic Poulain    2021-04-16  17  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33031 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 08/10] net: wwan: core: implement TIOCINQ ioctl
  2021-06-08  4:02 ` [PATCH 08/10] net: wwan: core: implement TIOCINQ ioctl Sergey Ryazanov
@ 2021-06-08  8:51   ` Loic Poulain
  0 siblings, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2021-06-08  8:51 UTC (permalink / raw)
  To: Sergey Ryazanov
  Cc: David S. Miller, Jakub Kicinski, Network Development, linux-wireless

On Tue, 8 Jun 2021 at 06:02, Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 08/10] net: wwan: core: implement TIOCINQ ioctl
  2021-06-08  4:02 [PATCH 00/10] net: WWAN subsystem improvements Sergey Ryazanov
@ 2021-06-08  4:02 ` Sergey Ryazanov
  2021-06-08  8:51   ` Loic Poulain
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Ryazanov @ 2021-06-08  4:02 UTC (permalink / raw)
  To: Loic Poulain, David S. Miller, Jakub Kicinski; +Cc: netdev, linux-wireless

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>
---
 drivers/net/wwan/wwan_core.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 9346b2661eb3..d5a197da4a41 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -12,6 +12,7 @@
 #include <linux/skbuff.h>
 #include <linux/slab.h>
 #include <linux/types.h>
+#include <linux/termios.h>
 #include <linux/wwan.h>
 
 /* Maximum number of minors in use */
@@ -618,6 +619,30 @@ static __poll_t wwan_port_fops_poll(struct file *filp, poll_table *wait)
 	return mask;
 }
 
+static long wwan_port_fops_ioctl(struct file *filp, unsigned int cmd,
+				 unsigned long arg)
+{
+	struct wwan_port *port = filp->private_data;
+
+	switch (cmd) {
+	case TIOCINQ: {	/* aka SIOCINQ aka FIONREAD */
+		unsigned long flags;
+		struct sk_buff *skb;
+		int amount = 0;
+
+		spin_lock_irqsave(&port->rxq.lock, flags);
+		skb_queue_walk(&port->rxq, skb)
+			amount += skb->len;
+		spin_unlock_irqrestore(&port->rxq.lock, flags);
+
+		return put_user(amount, (int __user *)arg);
+	}
+
+	default:
+		return -ENOIOCTLCMD;
+	}
+}
+
 static const struct file_operations wwan_port_fops = {
 	.owner = THIS_MODULE,
 	.open = wwan_port_fops_open,
@@ -625,6 +650,10 @@ static const struct file_operations wwan_port_fops = {
 	.read = wwan_port_fops_read,
 	.write = wwan_port_fops_write,
 	.poll = wwan_port_fops_poll,
+	.unlocked_ioctl = wwan_port_fops_ioctl,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl = compat_ptr_ioctl,
+#endif
 	.llseek = noop_llseek,
 };
 
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-08  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  8:15 [PATCH 08/10] net: wwan: core: implement TIOCINQ ioctl kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-06-08  4:02 [PATCH 00/10] net: WWAN subsystem improvements Sergey Ryazanov
2021-06-08  4:02 ` [PATCH 08/10] net: wwan: core: implement TIOCINQ ioctl Sergey Ryazanov
2021-06-08  8:51   ` Loic Poulain

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.