BPF List
 help / color / mirror / Atom feed
From: Jie2x Zhou <jie2x.zhou@intel.com>
To: jie2x.zhou@intel.com, andrii@kernel.org, mykolal@fb.com,
	ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
	davem@davemloft.net, kuba@kernel.org, hawk@kernel.org
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Philip Li <philip.li@intel.com>
Subject: test ./tools/testing/selftests/bpf/test_offload.py failed
Date: Wed,  7 Sep 2022 13:16:57 +0800	[thread overview]
Message-ID: <20220907051657.55597-1-jie2x.zhou@intel.com> (raw)

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,

             reply	other threads:[~2022-09-07  5:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07  5:16 Jie2x Zhou [this message]
2022-09-07  6:43 ` test ./tools/testing/selftests/bpf/test_offload.py failed 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

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=20220907051657.55597-1-jie2x.zhou@intel.com \
    --to=jie2x.zhou@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=philip.li@intel.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox