xref: /dpdk/doc/guides/sample_app_ug/ntb.rst (revision e2a94f9ad3ef949c0df3e63699bd4e381b5003d9)
1c5eebf85SXiaoyun Li..  SPDX-License-Identifier: BSD-3-Clause
2c5eebf85SXiaoyun Li    Copyright(c) 2019 Intel Corporation.
3c5eebf85SXiaoyun Li
4c5eebf85SXiaoyun LiNTB Sample Application
5c5eebf85SXiaoyun Li======================
6c5eebf85SXiaoyun Li
7c5eebf85SXiaoyun LiThe ntb sample application shows how to use ntb rawdev driver.
85194299dSXiaoyun LiThis sample provides interactive mode to do packet based processing
95194299dSXiaoyun Libetween two systems.
105194299dSXiaoyun Li
115194299dSXiaoyun LiThis sample supports 4 types of packet forwarding mode.
125194299dSXiaoyun Li
135194299dSXiaoyun Li* ``file-trans``: transmit files between two systems. The sample will
145194299dSXiaoyun Li  be polling to receive files from the peer and save the file as
155194299dSXiaoyun Li  ``ntb_recv_file[N]``, [N] represents the number of received file.
165194299dSXiaoyun Li* ``rxonly``: NTB receives packets but doesn't transmit them.
175194299dSXiaoyun Li* ``txonly``: NTB generates and transmits packets without receiving any.
185194299dSXiaoyun Li* ``iofwd``: iofwd between NTB device and ethdev.
19c5eebf85SXiaoyun Li
20c5eebf85SXiaoyun LiCompiling the Application
21c5eebf85SXiaoyun Li-------------------------
22c5eebf85SXiaoyun Li
23c5eebf85SXiaoyun LiTo compile the sample application see :doc:`compiling`.
24c5eebf85SXiaoyun Li
25c5eebf85SXiaoyun LiThe application is located in the ``ntb`` sub-directory.
26c5eebf85SXiaoyun Li
27c5eebf85SXiaoyun LiRunning the Application
28c5eebf85SXiaoyun Li-----------------------
29c5eebf85SXiaoyun Li
30c5eebf85SXiaoyun LiThe application requires an available core for each port, plus one.
31c5eebf85SXiaoyun LiThe only available options are the standard ones for the EAL:
32c5eebf85SXiaoyun Li
33c5eebf85SXiaoyun Li.. code-block:: console
34c5eebf85SXiaoyun Li
35*e2a94f9aSCiara Power    ./<build_dir>/examples/dpdk-ntb -c 0xf -n 6 -- -i
36c5eebf85SXiaoyun Li
37c5eebf85SXiaoyun LiRefer to the *DPDK Getting Started Guide* for general information on
38c5eebf85SXiaoyun Lirunning applications and the Environment Abstraction Layer (EAL)
39c5eebf85SXiaoyun Lioptions.
40c5eebf85SXiaoyun Li
415194299dSXiaoyun LiCommand-line Options
425194299dSXiaoyun Li--------------------
435194299dSXiaoyun Li
445194299dSXiaoyun LiThe application supports the following command-line options.
455194299dSXiaoyun Li
465194299dSXiaoyun Li* ``--buf-size=N``
475194299dSXiaoyun Li
485194299dSXiaoyun Li  Set the data size of the mbufs used to N bytes, where N < 65536.
495194299dSXiaoyun Li  The default value is 2048.
505194299dSXiaoyun Li
515194299dSXiaoyun Li* ``--fwd-mode=mode``
525194299dSXiaoyun Li
535194299dSXiaoyun Li  Set the packet forwarding mode as ``file-trans``, ``txonly``,
545194299dSXiaoyun Li  ``rxonly`` or ``iofwd``.
555194299dSXiaoyun Li
565194299dSXiaoyun Li* ``--nb-desc=N``
575194299dSXiaoyun Li
585194299dSXiaoyun Li  Set number of descriptors of queue as N, namely queue size,
595194299dSXiaoyun Li  where 64 <= N <= 1024. The default value is 1024.
605194299dSXiaoyun Li
615194299dSXiaoyun Li* ``--txfreet=N``
625194299dSXiaoyun Li
635194299dSXiaoyun Li  Set the transmit free threshold of TX rings to N, where 0 <= N <=
645194299dSXiaoyun Li  the value of ``--nb-desc``. The default value is 256.
655194299dSXiaoyun Li
665194299dSXiaoyun Li* ``--burst=N``
675194299dSXiaoyun Li
685194299dSXiaoyun Li  Set the number of packets per burst to N, where 1 <= N <= 32.
695194299dSXiaoyun Li  The default value is 32.
705194299dSXiaoyun Li
715194299dSXiaoyun Li* ``--qp=N``
725194299dSXiaoyun Li
735194299dSXiaoyun Li  Set the number of queues as N, where qp > 0. The default value is 1.
745194299dSXiaoyun Li
75c5eebf85SXiaoyun LiUsing the application
76c5eebf85SXiaoyun Li---------------------
77c5eebf85SXiaoyun Li
78c5eebf85SXiaoyun LiThe application is console-driven using the cmdline DPDK interface:
79c5eebf85SXiaoyun Li
80c5eebf85SXiaoyun Li.. code-block:: console
81c5eebf85SXiaoyun Li
82c5eebf85SXiaoyun Li        ntb>
83c5eebf85SXiaoyun Li
84c5eebf85SXiaoyun LiFrom this interface the available commands and descriptions of what
85f43d3dbbSDavid Marchandthey do as follows:
86c5eebf85SXiaoyun Li
875194299dSXiaoyun Li* ``send [filepath]``: Send file to the peer host. Need to be in
885194299dSXiaoyun Li  file-trans forwarding mode first.
895194299dSXiaoyun Li* ``start``: Start transmission.
905194299dSXiaoyun Li* ``stop``: Stop transmission.
915194299dSXiaoyun Li* ``show/clear port stats``: Show/Clear port stats and throughput.
925194299dSXiaoyun Li* ``set fwd file-trans/rxonly/txonly/iofwd``: Set packet forwarding
935194299dSXiaoyun Li  mode.
945194299dSXiaoyun Li* ``quit``: Exit program.
95