11.. SPDX-License-Identifier: BSD-3-Clause
2- Copyright(c) 2019 Intel Corporation.
2+ Copyright(c) 2019-2021 Intel Corporation.
33
44 .. include :: <isonum.txt>
55
6- Packet copying using Intel \ | reg | QuickData Technology
7- ======================================================
6+ Packet copying using DMAdev library
7+ ===================================
88
99Overview
1010--------
1111
1212This sample is intended as a demonstration of the basic components of a DPDK
13- forwarding application and example of how to use IOAT driver API to make
14- packets copies .
13+ forwarding application and example of how to use the DMAdev API to make a packet
14+ copy application .
1515
1616Also while forwarding, the MAC addresses are affected as follows:
1717
@@ -29,7 +29,7 @@ Compiling the Application
2929
3030To compile the sample application see :doc: `compiling `.
3131
32- The application is located in the ``ioat `` sub-directory.
32+ The application is located in the ``dma `` sub-directory.
3333
3434
3535Running the Application
@@ -38,8 +38,8 @@ Running the Application
3838In order to run the hardware copy application, the copying device
3939needs to be bound to user-space IO driver.
4040
41- Refer to the "IOAT Rawdev Driver " chapter in the "Rawdev Drivers" document
42- for information on using the driver .
41+ Refer to the "DMAdev library " chapter in the "Programmers guide" for information
42+ on using the library .
4343
4444The application requires a number of command line options:
4545
@@ -52,13 +52,13 @@ where,
5252
5353* p MASK: A hexadecimal bitmask of the ports to configure (default is all)
5454
55- * q NQ: Number of Rx queues used per port equivalent to CBDMA channels
55+ * q NQ: Number of Rx queues used per port equivalent to DMA channels
5656 per port (default is 1)
5757
5858* c CT: Performed packet copy type: software (sw) or hardware using
5959 DMA (hw) (default is hw)
6060
61- * s RS: Size of IOAT rawdev ring for hardware copy mode or rte_ring for
61+ * s RS: Size of dmadev descriptor ring for hardware copy mode or rte_ring for
6262 software copy mode (default is 2048)
6363
6464* --[no-]mac-updating: Whether MAC address of packets should be changed
@@ -87,15 +87,15 @@ updating issue the command:
8787
8888.. code-block :: console
8989
90- $ ./<build_dir>/examples/dpdk-ioat -l 0-2 -n 2 -- -p 0x1 --mac-updating -c sw
90+ $ ./<build_dir>/examples/dpdk-dma -l 0-2 -n 2 -- -p 0x1 --mac-updating -c sw
9191
9292 To run the application in a Linux environment with 2 lcores (the main lcore,
9393plus one forwarding core), 2 ports (ports 0 and 1), hardware copying and no MAC
9494updating issue the command:
9595
9696.. code-block :: console
9797
98- $ ./<build_dir>/examples/dpdk-ioat -l 0-1 -n 1 -- -p 0x3 --no-mac-updating -c hw
98+ $ ./<build_dir>/examples/dpdk-dma -l 0-1 -n 1 -- -p 0x3 --no-mac-updating -c hw
9999
100100 Refer to the *DPDK Getting Started Guide * for general information on
101101running applications and the Environment Abstraction Layer (EAL) options.
@@ -120,7 +120,7 @@ The first task is to initialize the Environment Abstraction Layer (EAL).
120120The ``argc `` and ``argv `` arguments are provided to the ``rte_eal_init() ``
121121function. The value returned is the number of parsed arguments:
122122
123- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
123+ .. literalinclude :: ../../../examples/dma/dmafwd .c
124124 :language: c
125125 :start-after: Init EAL. 8<
126126 :end-before: >8 End of init EAL.
@@ -130,7 +130,7 @@ function. The value returned is the number of parsed arguments:
130130The ``main() `` also allocates a mempool to hold the mbufs (Message Buffers)
131131used by the application:
132132
133- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
133+ .. literalinclude :: ../../../examples/dma/dmafwd .c
134134 :language: c
135135 :start-after: Allocates mempool to hold the mbufs. 8<
136136 :end-before: >8 End of allocates mempool to hold the mbufs.
@@ -141,7 +141,7 @@ detail in the "Mbuf Library" section of the *DPDK Programmer's Guide*.
141141
142142The ``main() `` function also initializes the ports:
143143
144- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
144+ .. literalinclude :: ../../../examples/dma/dmafwd .c
145145 :language: c
146146 :start-after: Initialize each port. 8<
147147 :end-before: >8 End of initializing each port.
@@ -151,9 +151,9 @@ Each port is configured using ``port_init()`` function. The Ethernet
151151ports are configured with local settings using the ``rte_eth_dev_configure() ``
152152function and the ``port_conf `` struct. The RSS is enabled so that
153153multiple Rx queues could be used for packet receiving and copying by
154- multiple CBDMA channels per port:
154+ multiple DMA channels per port:
155155
156- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
156+ .. literalinclude :: ../../../examples/dma/dmafwd .c
157157 :language: c
158158 :start-after: Configuring port to use RSS for multiple RX queues. 8<
159159 :end-before: >8 End of configuring port to use RSS for multiple RX queues.
@@ -165,7 +165,7 @@ and ``rte_eth_tx_queue_setup()`` functions.
165165
166166The Ethernet port is then started:
167167
168- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
168+ .. literalinclude :: ../../../examples/dma/dmafwd .c
169169 :language: c
170170 :start-after: Start device. 8<
171171 :end-before: >8 End of starting device.
@@ -174,7 +174,7 @@ The Ethernet port is then started:
174174
175175Finally the Rx port is set in promiscuous mode:
176176
177- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
177+ .. literalinclude :: ../../../examples/dma/dmafwd .c
178178 :language: c
179179 :start-after: RX port is set in promiscuous mode. 8<
180180 :end-before: >8 End of RX port is set in promiscuous mode.
@@ -183,7 +183,7 @@ Finally the Rx port is set in promiscuous mode:
183183
184184After that each port application assigns resources needed.
185185
186- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
186+ .. literalinclude :: ../../../examples/dma/dmafwd .c
187187 :language: c
188188 :start-after: Assigning each port resources. 8<
189189 :end-before: >8 End of assigning each port resources.
@@ -192,30 +192,30 @@ After that each port application assigns resources needed.
192192Ring structures are assigned for exchanging packets between lcores for both SW
193193and HW copy modes.
194194
195- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
195+ .. literalinclude :: ../../../examples/dma/dmafwd .c
196196 :language: c
197197 :start-after: Assign ring structures for packet exchanging. 8<
198198 :end-before: >8 End of assigning ring structures for packet exchanging.
199199 :dedent: 0
200200
201201
202- When using hardware copy each Rx queue of the port is assigned an
203- IOAT device (``assign_rawdevs() ``) using IOAT Rawdev Driver API
204- functions:
202+ When using hardware copy each Rx queue of the port is assigned a DMA device
203+ (``assign_dmadevs() ``) using DMAdev library API functions:
205204
206- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
205+ .. literalinclude :: ../../../examples/dma/dmafwd .c
207206 :language: c
208- :start-after: Using IOAT rawdev API functions. 8<
209- :end-before: >8 End of using IOAT rawdev API functions.
207+ :start-after: Using dmadev API functions. 8<
208+ :end-before: >8 End of using dmadev API functions.
210209 :dedent: 0
211210
212211
213- The initialization of hardware device is done by ``rte_rawdev_configure() ``
214- function using ``rte_rawdev_info `` struct. After configuration the device is
215- started using ``rte_rawdev_start() `` function. Each of the above operations
216- is done in ``configure_rawdev_queue() ``.
212+ The initialization of hardware device is done by ``rte_dma_configure() `` and
213+ ``rte_dma_vchan_setup() `` functions using the ``rte_dma_conf `` and
214+ ``rte_dma_vchan_conf `` structs. After configuration the device is started
215+ using ``rte_dma_start() `` function. Each of the above operations is done in
216+ ``configure_dmadev_queue() ``.
217217
218- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
218+ .. literalinclude :: ../../../examples/dma/dmafwd .c
219219 :language: c
220220 :start-after: Configuration of device. 8<
221221 :end-before: >8 End of configuration of device.
@@ -237,7 +237,7 @@ The Lcores Launching Functions
237237As described above, ``main() `` function invokes ``start_forwarding_cores() ``
238238function in order to start processing for each lcore:
239239
240- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
240+ .. literalinclude :: ../../../examples/dma/dmafwd .c
241241 :language: c
242242 :start-after: Start processing for each lcore. 8<
243243 :end-before: >8 End of starting to processfor each lcore.
@@ -248,7 +248,7 @@ using ``rte_eal_remote_launch()``. The configured ports, their number
248248and number of assigned lcores are stored in user-defined
249249``rxtx_transmission_config `` struct:
250250
251- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
251+ .. literalinclude :: ../../../examples/dma/dmafwd .c
252252 :language: c
253253 :start-after: Configuring ports and number of assigned lcores in struct. 8<
254254 :end-before: >8 End of configuration of ports and number of assigned lcores.
@@ -260,48 +260,48 @@ corresponding to ports and lcores configuration provided by the user.
260260The Lcores Processing Functions
261261~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262262
263- For receiving packets on each port, the ``ioat_rx_port () `` function is used.
263+ For receiving packets on each port, the ``dma_rx_port () `` function is used.
264264The function receives packets on each configured Rx queue. Depending on the
265- mode the user chose, it will enqueue packets to IOAT rawdev channels and
265+ mode the user chose, it will enqueue packets to DMA channels and
266266then invoke copy process (hardware copy), or perform software copy of each
267267packet using ``pktmbuf_sw_copy() `` function and enqueue them to an rte_ring:
268268
269- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
269+ .. literalinclude :: ../../../examples/dma/dmafwd .c
270270 :language: c
271- :start-after: Receive packets on one port and enqueue to IOAT rawdev or rte_ring. 8<
272- :end-before: >8 End of receive packets on one port and enqueue to IOAT rawdev or rte_ring.
271+ :start-after: Receive packets on one port and enqueue to dmadev or rte_ring. 8<
272+ :end-before: >8 End of receive packets on one port and enqueue to dmadev or rte_ring.
273273 :dedent: 0
274274
275275The packets are received in burst mode using ``rte_eth_rx_burst() ``
276276function. When using hardware copy mode the packets are enqueued in
277- copying device's buffer using ``ioat_enqueue_packets () `` which calls
278- ``rte_ioat_enqueue_copy () ``. When all received packets are in the
279- buffer the copy operations are started by calling ``rte_ioat_perform_ops () ``.
280- Function ``rte_ioat_enqueue_copy () `` operates on physical address of
277+ copying device's buffer using ``dma_enqueue_packets () `` which calls
278+ ``rte_dma_copy () ``. When all received packets are in the
279+ buffer the copy operations are started by calling ``rte_dma_submit () ``.
280+ Function ``rte_dma_copy () `` operates on physical address of
281281the packet. Structure ``rte_mbuf `` contains only physical address to
282282start of the data buffer (``buf_iova ``). Thus the ``rte_pktmbuf_iova() `` API is
283283used to get the address of the start of the data within the mbuf.
284284
285- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
285+ .. literalinclude :: ../../../examples/dma/dmafwd .c
286286 :language: c
287- :start-after: Receive packets on one port and enqueue to IOAT rawdev or rte_ring. 8<
288- :end-before: >8 End of receive packets on one port and enqueue to IOAT rawdev or rte_ring.
287+ :start-after: Receive packets on one port and enqueue to dmadev or rte_ring. 8<
288+ :end-before: >8 End of receive packets on one port and enqueue to dmadev or rte_ring.
289289 :dedent: 0
290290
291291
292292Once the copies have been completed (this includes gathering the completions in
293293HW copy mode), the copied packets are enqueued to the ``rx_to_tx_ring ``, which
294294is used to pass the packets to the TX function.
295295
296- All completed copies are processed by ``ioat_tx_port () `` function. This function
296+ All completed copies are processed by ``dma_tx_port () `` function. This function
297297dequeues copied packets from the ``rx_to_tx_ring ``. Then each packet MAC address is changed
298298if it was enabled. After that copies are sent in burst mode using ``rte_eth_tx_burst() ``.
299299
300300
301- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
301+ .. literalinclude :: ../../../examples/dma/dmafwd .c
302302 :language: c
303- :start-after: Transmit packets from IOAT rawdev /rte_ring for one port. 8<
304- :end-before: >8 End of transmitting packets from IOAT .
303+ :start-after: Transmit packets from dmadev /rte_ring for one port. 8<
304+ :end-before: >8 End of transmitting packets from dmadev .
305305 :dedent: 0
306306
307307The Packet Copying Functions
@@ -311,7 +311,7 @@ In order to perform SW packet copy, there are user-defined functions to first co
311311the packet metadata (``pktmbuf_metadata_copy() ``) and then the packet data
312312(``pktmbuf_sw_copy() ``):
313313
314- .. literalinclude :: ../../../examples/ioat/ioatfwd .c
314+ .. literalinclude :: ../../../examples/dma/dmafwd .c
315315 :language: c
316316 :start-after: Perform packet copy there is a user-defined function. 8<
317317 :end-before: >8 End of perform packet copy there is a user-defined function.
0 commit comments