netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* test ./tools/testing/selftests/bpf/test_offload.py failed
@ 2022-09-07  5:16 Jie2x Zhou
  2022-09-07  6:43 ` Ido Schimmel
  0 siblings, 1 reply; 9+ messages in thread
From: Jie2x Zhou @ 2022-09-07  5:16 UTC (permalink / raw)
  To: jie2x.zhou, andrii, mykolal, ast, daniel, martin.lau, davem, kuba,
	hawk
  Cc: netdev, bpf, linux-kselftest, linux-kernel, Philip Li

hi,

I try to know why output following error?
I found that "disable_ifindex" file do not set read function, so return -EINVAL when do read.
Is it a bug in test_offload.py?

test output:
 selftests: bpf: test_offload.py
 Test destruction of generic XDP...
......
     raise Exception("Command failed: %s\n%s" % (proc.args, stderr))
 Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex
 
 cat: /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex: Invalid argument
 not ok 20 selftests: bpf: test_offload.py # exit=1

source code:
In drivers/net/netdevsim/hwstats.c:
define NSIM_DEV_HWSTATS_FOPS(ACTION, TYPE)                     \
        {                                                       \
                .fops = {                                       \
                        .open = simple_open,                    \
                        .write = nsim_dev_hwstats_do_write,     \
                        .llseek = generic_file_llseek,          \
                        .owner = THIS_MODULE,                   \
                },                                              \
                .action = ACTION,                               \
                .type = TYPE,                                   \
        }

static const struct nsim_dev_hwstats_fops nsim_dev_hwstats_l3_disable_fops =
        NSIM_DEV_HWSTATS_FOPS(NSIM_DEV_HWSTATS_DO_DISABLE,
                              NETDEV_OFFLOAD_XSTATS_TYPE_L3);

        debugfs_create_file("disable_ifindex", 0600, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_disable_fops.fops);

In fs/read_write.c:
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{
......
        if (file->f_op->read)
                ret = file->f_op->read(file, buf, count, pos);
        else if (file->f_op->read_iter)
                ret = new_sync_read(file, buf, count, pos);
        else
                ret = -EINVAL;
......
}

best regards,

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

end of thread, other threads:[~2022-09-09  9:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07  5:16 test ./tools/testing/selftests/bpf/test_offload.py failed Jie2x Zhou
2022-09-07  6:43 ` Ido Schimmel
2022-09-07  8:51   ` Zhou, Jie2X
2022-09-07 16:08     ` Ido Schimmel
2022-09-08  3:10       ` Zhou, Jie2X
2022-09-08  6:23         ` Ido Schimmel
2022-09-08  7:44           ` Zhou, Jie2X
2022-09-08  8:03             ` Ido Schimmel
2022-09-09  9:11               ` Zhou, Jie2X

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).