|
1 | | -# librte_pmd_rvif: a poll mode driver for rvif |
2 | | - |
3 | | -This is a DPDK device driver for rvif, an [rvs](https://github.com/yasukata/rvs)-compatible virtual interface. |
4 | | - |
5 | | -## How to use |
6 | | - |
7 | | -### Compilation |
8 | | - |
9 | | -#### librte_pmd_rvif.so |
10 | | - |
11 | | -Please type the following to compile the program. |
12 | | - |
13 | | -``` |
14 | | -make |
15 | | -``` |
16 | | - |
17 | | -The command above will: |
18 | | -- download the source code of DPDK at ([LOCATION_OF_MAKEFILE]/dpdk/dpdk-$(DPDK_VER).tar.xz) |
19 | | -- compile it in ([LOCATION_OF_MAKEFILE]/dpdk/dpdk-$(DPDK_VER)) |
20 | | -- install the compiled binaries at [LOCATION_OF_MAKEFILE]/dpdk/install . |
21 | | -- download the rvif header file at [LOCATION_OF_MAKEFILE]/deps/rvs/include . |
22 | | -- compile [LOCATION_OF_MAKEFILE]/main.c |
23 | | - |
24 | | -DPDK is installed in [LOCATION_OF_MAKEFILE]/dpdk/install; therefore, you do not need the root permission for the installation, and this does not overwrite the existing DPDK library. |
25 | | - |
26 | | - |
27 | | -#### deps/rvs/apps/fwd/a.out |
28 | | - |
29 | | -The following command will generate a binary of the forwarder application. |
30 | | - |
31 | | -``` |
32 | | -make -C deps/rvs/apps/fwd |
33 | | -``` |
34 | | - |
35 | | -### Preparation |
36 | | - |
37 | | -For testing, please create two of 32 MB shared memory files by the following commands. |
38 | | - |
39 | | -``` |
40 | | -dd if=/dev/zero of=/dev/shm/rvs_shm00 bs=1M count=0 seek=32 |
41 | | -``` |
42 | | - |
43 | | -``` |
44 | | -dd if=/dev/zero of=/dev/shm/rvs_shm01 bs=1M count=0 seek=32 |
45 | | -``` |
46 | | - |
47 | | -### Run |
48 | | - |
49 | | -We run the testpmd application of DPDK at ```deps/dpdk/install/bin/dpdk-testpmd``` for testing. |
50 | | - |
51 | | -Terminal/console 1: please execute the following command to launche the forwarder application. |
52 | | - |
53 | | -``` |
54 | | -./deps/rvs/apps/fwd/a.out -m /dev/shm/rvs_shm00 -m /dev/shm/rvs_shm01 |
55 | | -``` |
56 | | - |
57 | | -Terminal/console 2: please open a terminal/console and type the following to start testpmd with the rxonly mode. |
58 | | - |
59 | | -``` |
60 | | -sudo LD_LIBRARY_PATH=./deps/dpdk/install/lib/x86_64-linux-gnu LD_PRELOAD=./deps/dpdk/install/lib/x86_64-linux-gnu/dpdk/pmds-23.0/librte_mempool_ring.so.23.0:./librte_pmd_rvif.so ./deps/dpdk/install/bin/dpdk-testpmd -l 0-1 --proc-type=primary --file-prefix=pmd1 --vdev=net_rvif,mac=aa:bb:cc:dd:ee:00,mem=/dev/shm/rvs_shm00 --no-pci -- --nb-cores 1 --forward-mode=rxonly --txq=1 --rxq=1 --txd=512 --rxd=512 --stats-period=1 |
61 | | -``` |
62 | | - |
63 | | -Terminal/console 3: please open a terminal/console and execute the following to launch testpmd with the txonly mode. |
64 | | - |
65 | | -``` |
66 | | -sudo LD_LIBRARY_PATH=./deps/dpdk/install/lib/x86_64-linux-gnu LD_PRELOAD=./deps/dpdk/install/lib/x86_64-linux-gnu/dpdk/pmds-23.0/librte_mempool_ring.so.23.0:./librte_pmd_rvif.so ./deps/dpdk/install/bin/dpdk-testpmd -l 2-3 --proc-type=primary --file-prefix=pmd2 --vdev=net_rvif,mac=aa:bb:cc:dd:ee:01,mem=/dev/shm/rvs_shm01 --no-pci -- --nb-cores 1 --forward-mode=txonly --txq=1 --rxq=1 --txd=512 --rxd=512 --stats-period=1 --txpkts=64 |
67 | | -``` |
68 | | - |
69 | | -Supposedly, you will see incoming packets in terminal/console 2, which are sent from testpmd in terminal/console 3. |
70 | | - |
71 | | -The meaning of the command is as follows. |
72 | | - |
73 | | -- ```LD_LIBRARY_PATH=./deps/dpdk/install/lib/x86_64-linux-gnu```: ensure the DPDK library built by us is loaded |
74 | | -- ```LD_PRELOAD=./deps/dpdk/install/lib/x86_64-linux-gnu/dpdk/pmds-23.0/librte_mempool_ring.so.23.0:./librte_pmd_rvif.so```: load ```librte_pmd_rvif.so ``` at the execution time |
75 | | -- ```./deps/dpdk/install/bin/dpdk-testpmd```: path to the application |
76 | | -- ```-l 0-1 --proc-type=primary --file-prefix=pmd1```: the arguments passed to DPDK, and this is the default syntax defined by DPDK |
77 | | -- ```--vdev=net_rvif,mac=aa:bb:cc:dd:ee:00,mem=/dev/shm/rvs_shm00```: request DPDK to create an rvif virtual interface, whose mac address is ```aa:bb:cc:dd:ee:00``` and shared memory file is ```/dev/shm/rvs_shm00```; this part is handled by our librte_pmd_rvif.so |
78 | | -- ```--no-pci```: DPDK does not try to look up PCI devices |
79 | | -- ```--```: separator between the arguments passed to DPDK and the testpmd application |
80 | | -- ```--nb-cores 1 --forward-mode=rxonly --txq=1 --rxq=1 --txd=512 --rxd=512 --stats-period=1```: handled by the testpmd application |
81 | | - |
82 | | -### Some points |
83 | | - |
84 | | -For modularity, we build ```librte_pmd_rvif.so``` as an independent shared library file, and apply it through LD_PRELOAD. |
85 | | - |
86 | | -To use testpmd of DPDK, we specify ```--default-library=share``` for the build option of DPDK; otherwise, the DPDK compilation phase statically links the DPDK library and testpmd, and LD_PRELOAD cannot load our librte_pmd_rvif.so for the execution of it. |
87 | | - |
88 | | -https://github.com/yasukata/librte_pmd_rvif/blob/9fbd375484cef415ea61bb6b436d509dca707c87/mk/dpdk/1.mk#L15 |
| 1 | +# librte_pmd_rvif: a DPDK driver example |
89 | 2 |
|
0 commit comments