DPDK patches and discussions
 help / color / mirror / Atom feed
* BPF elf examples
@ 2025-10-20 20:16 Stephen Hemminger
  2025-10-21 11:30 ` Konstantin Ananyev
  2025-10-21 11:42 ` Marat Khalili
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-10-20 20:16 UTC (permalink / raw)
  To: Konstantin Ananyev; +Cc: dev

While looking in more detail at BPF use of VLA, went down a rabbit hole
because there are no tests and no examples of loading a BPF program using
the elf_load API's in BPF.

Tried using AI to generate tests, and as usual it sort of worked but the
example code generated won't load or work. Is there anywhere to find working
DPDK examples of using BPF load?

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

* RE: BPF elf examples
  2025-10-20 20:16 BPF elf examples Stephen Hemminger
@ 2025-10-21 11:30 ` Konstantin Ananyev
  2025-10-21 11:42 ` Marat Khalili
  1 sibling, 0 replies; 4+ messages in thread
From: Konstantin Ananyev @ 2025-10-21 11:30 UTC (permalink / raw)
  To: Stephen Hemminger, Konstantin Ananyev; +Cc: dev


> While looking in more detail at BPF use of VLA, went down a rabbit hole
> because there are no tests and no examples of loading a BPF program using
> the elf_load API's in BPF.
> 
> Tried using AI to generate tests, and as usual it sort of worked but the
> example code generated won't load or work. Is there anywhere to find working
> DPDK examples of using BPF load? 

app/test-pmd/bpf_cmd.c calls rte_bpf_eth_rx_elf_load/ rte_bpf_eth_tx_elf_load,
which in turn calls rte_bpf_elf_load().
Though it is a good point, will think can we add a UT for it too.

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

* RE: BPF elf examples
  2025-10-20 20:16 BPF elf examples Stephen Hemminger
  2025-10-21 11:30 ` Konstantin Ananyev
@ 2025-10-21 11:42 ` Marat Khalili
  2025-10-21 13:38   ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Marat Khalili @ 2025-10-21 11:42 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Konstantin Ananyev

> -----Original Message-----
> Tried using AI to generate tests, and as usual it sort of worked but the
> example code generated won't load or work. Is there anywhere to find working
> DPDK examples of using BPF load?

Hello! I'm sitting on some patches adding a framework for generating BPF ELF 
files using libelf and some basic unit tests based on it. Hopefully I'll be 
able to upstream it within the next couple of months.

Generating ELF files is probably beyond the reach of current AI, but once the 
framework is there perhaps it could be used to add test cases, would be 
interesting to try...

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

* Re: BPF elf examples
  2025-10-21 11:42 ` Marat Khalili
@ 2025-10-21 13:38   ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-10-21 13:38 UTC (permalink / raw)
  To: Marat Khalili; +Cc: dev, Konstantin Ananyev

On Tue, 21 Oct 2025 11:42:25 +0000
Marat Khalili <marat.khalili@huawei.com> wrote:

> > -----Original Message-----
> > Tried using AI to generate tests, and as usual it sort of worked but the
> > example code generated won't load or work. Is there anywhere to find working
> > DPDK examples of using BPF load?  
> 
> Hello! I'm sitting on some patches adding a framework for generating BPF ELF 
> files using libelf and some basic unit tests based on it. Hopefully I'll be 
> able to upstream it within the next couple of months.
> 
> Generating ELF files is probably beyond the reach of current AI, but once the 
> framework is there perhaps it could be used to add test cases, would be 
> interesting to try...

I have sample programs now (thanks AI). But building them in meson is messy.
And integrating standalone files in UT is brittle.
Perhaps using bpftool like tap driver does to generate a header file (.h) and
then have UT write a /tmp file to load.

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

end of thread, other threads:[~2025-10-21 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-20 20:16 BPF elf examples Stephen Hemminger
2025-10-21 11:30 ` Konstantin Ananyev
2025-10-21 11:42 ` Marat Khalili
2025-10-21 13:38   ` Stephen Hemminger

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).