Re: [PATCH v4 bpf-next 8/8] selftests/bpf: introduce XDP compliance test tool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 28, Alexei Starovoitov wrote:
> On Sat, Jan 28, 2023 at 6:07 AM Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote:
> > diff --git a/tools/testing/selftests/bpf/xdp_features.h b/tools/testing/selftests/bpf/xdp_features.h
> > new file mode 100644
> > index 000000000000..28d7614c4f02
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/xdp_features.h
> > @@ -0,0 +1,33 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +
> > +/* test commands */
> > +enum test_commands {
> > +       CMD_STOP,               /* CMD */
> > +       CMD_START,              /* CMD + xdp feature */
> > +       CMD_ECHO,               /* CMD */
> > +       CMD_ACK,                /* CMD + data */
> > +       CMD_GET_XDP_CAP,        /* CMD */
> > +       CMD_GET_STATS,          /* CMD */
> > +};
> > +
> > +#define DUT_CTRL_PORT  12345
> > +#define DUT_ECHO_PORT  12346
> > +
> > +struct tlv_hdr {
> > +       __be16 type;
> > +       __be16 len;
> > +       __be32 data[];
> > +};
> > +
> > +enum {
> > +       XDP_FEATURE_ABORTED,
> > +       XDP_FEATURE_DROP,
> > +       XDP_FEATURE_PASS,
> > +       XDP_FEATURE_TX,
> > +       XDP_FEATURE_REDIRECT,
> > +       XDP_FEATURE_NDO_XMIT,
> > +       XDP_FEATURE_XSK_ZEROCOPY,
> > +       XDP_FEATURE_HW_OFFLOAD,
> > +       XDP_FEATURE_RX_SG,
> > +       XDP_FEATURE_NDO_XMIT_SG,
> > +};
> 
> This doesn't match the kernel.
> How did you test this?
> What should be the way to prevent such mistakes in the future?

Hi Alexei,

I added the XDP_FEATURE_* enum above since the XDP compliance test tool needs
to differentiate between actions in NETDEV_XDP_ACT_BASIC (e.g XDP_TX and
XDP_PASS or XDP_REDIRECT are handled differently in the ebpf programs installed
on the tester and DUT devices). However, combining netdev_xdp_act and xdp_action
enum definitions, I think we can keep this logic in xdp_feature userspace part
and we can get rid of the XDP_FEATURE_* enum above.
I will fix it in v5.

Regards,
Lorenzo

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux