dpdk.cr

Crystal bindings to DPDK, development in progress.

Hello World (examples/hello.cr)

require "../src/dpdk"

class Hello < Dpdk
  def hello_thread
    printf("Hello from lcore: %d\n", rte_lcore_id)
  end

  def main(argc, argv)
    rte_eal_init(argc, argv)
    rte_eal_mp_remote_launch(hello_thread)
    rte_eal_mp_wait_lcore
  end
end

Hello.run

Requirements

Documentation

https://s-you.github.io/dpdk.cr/docs/index.html

Building

% make help

targets:
  all             Build all files (currently dpdk only) [default]
  clean           Clean up built directories and files
  clean_examples  Clean up examples
  docs            Generate standard library documentation
  dpdk            Build the library
  help            Show this help
  spec            Run all specs

optional variables:
  debug           Add symbolic debug info (not full)
  progress        Enable progress output [default]
  release         Compile in release mode [default]
  stats           Enable statistics output
  threads         Maximum number of threads to use
  verbose         Run specs in verbose mode

recipes:
  Build an example from examples/ directory and output in build/ directory
    % make hello
  Enable stats output of example
    % make l2fwd stats=1
  Build an example in non release mode
    % make hello release=
  Clean up built files then the library
    % make clean

Compiling an example

% make hello

Running an example

 % sudo build/hello
EAL: Detected 10 lcore(s)
EAL: Probing VFIO support...
EAL: PCI device 0000:00:03.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:08.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:09.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:0a.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:10.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:11.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:12.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:13.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
Hello from lcore: 1
Hello from lcore: 3
Hello from lcore: 2
Hello from lcore: 4
Hello from lcore: 5
Hello from lcore: 6
Hello from lcore: 7
Hello from lcore: 8
Hello from lcore: 9
Hello from lcore: 0

Examples (Tested only on VirtualBox)

Performance

rxtx_callbacks

2018-02-26 20 07 57 |

TODO

Limitations