Re: [PATCH net-next v1 5/5] selftest: net: add proc_net_pktgen

From: Peter Seiderer
Date: Wed Jan 22 2025 - 09:41:12 EST


Hello Jakub,

On Fri, 17 Jan 2025 13:11:54 -0800, Jakub Kicinski <kuba@xxxxxxxxxx> wrote:

> On Fri, 17 Jan 2025 15:16:13 +0100 Peter Seiderer wrote:
> > +FIXTURE_SETUP(proc_net_pktgen) {
> > + ssize_t len;
> > +
> > + self->ctrl_fd = open("/proc/net/pktgen/kpktgend_0", O_RDWR);
> > + ASSERT_GE(self->ctrl_fd, 0) TH_LOG("CONFIG_NET_PKTGEN not enabled, module pktgen nod loaded?");
>
> nod -> not?

Fixed...

>
> Please take a look at the instructions here:
> https://github.com/linux-netdev/nipa/wiki/How-to-run-netdev-selftests-CI-style
> the test currently fails in our CI, you need to add it to
> tools/testing/selftests/net/config, and perhaps try to call
> modprobe in the test?

Thanks for the hint, fixed (modprobe and CONFIG_NET_PKTGEN enabeled)...

>
> > + len = write(self->ctrl_fd, add_loopback_0, sizeof(add_loopback_0));
> > + ASSERT_EQ(len, sizeof(add_loopback_0)) TH_LOG("device lo@0 already registered?");
>
> FWIW we prefer to stick to 80 char line width in networking,
> but it's not a big deal for a test, up to you.
>
> > + // complete command string without/with trailing '\0'
> > + EXPECT_EQ(len, i);

Fixed...

>
> Run this patch thru checkpatch, please. This looks misaligned.

O.k.

>
> > + }
> > + }
> > +}
>
> > +#if 0 // needs CONFIG_XFRM
>
> Add it to the config, too, then?
>
> > +TEST_F(proc_net_pktgen, device_command_spi) {
> > + ssize_t len;
> > +
> > + len = write(self->device_fd, device_command_spi_0, sizeof(device_command_spi_0));
> > + EXPECT_EQ(len, sizeof(device_command_spi_0));
> > +}
> > +#endif

'#if' removed as as CONFIG_XFRM is already enabled via tools/testing/selftests/net/config
CONFIG_XFRM_INTERFACE/CONFIG_XFRM_USER...

Thanks for review!

New patch iteration is on the way...

Regards,
Peter

>
> Thanks for working on a test!