raw/octeontx2_ep: add device configuration
[dpdk.git] / doc / guides / rawdevs / octeontx2_ep.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2019 Marvell International Ltd.
3
4 Marvell OCTEON TX2 End Point Rawdev Driver
5 ==========================================
6
7 OCTEON TX2 has an internal SDP unit which provides End Point mode of operation
8 by exposing its IOQs to Host, IOQs are used for packet I/O between Host and
9 OCTEON TX2. Each OCTEON TX2 SDP PF supports a max of 128 VFs and Each VF is
10 associated with a set of IOQ pairs.
11
12 Features
13 --------
14
15 This OCTEON TX2 End Point mode PMD supports
16
17 #. Packet Input - Host to OCTEON TX2 with direct data instruction mode.
18
19 #. Packet Output - OCTEON TX2 to Host with info pointer mode.
20
21 Config File Options
22 ~~~~~~~~~~~~~~~~~~~
23
24 The following options can be modified in the ``config`` file.
25
26 - ``CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV`` (default ``y``)
27
28   Toggle compilation of the ``lrte_pmd_octeontx2_ep`` driver.
29
30 Initialization
31 --------------
32
33 The number of SDP VFs enabled, can be controlled by setting sysfs
34 entry `sriov_numvfs` for the corresponding PF driver.
35
36 .. code-block:: console
37
38  echo <num_vfs> > /sys/bus/pci/drivers/octeontx2-ep/0000\:04\:00.0/sriov_numvfs
39
40 Once the required VFs are enabled, to be accessible from DPDK, VFs need to be
41 bound to vfio-pci driver.
42
43 Device Setup
44 ------------
45
46 The OCTEON TX2 SDP End Point VF devices will need to be bound to a
47 user-space IO driver for use. The script ``dpdk-devbind.py`` script
48 included with DPDK can be used to view the state of the devices and to bind
49 them to a suitable DPDK-supported kernel driver. When querying the status
50 of the devices, they will appear under the category of "Misc (rawdev)
51 devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
52 used to see the state of those devices alone.
53
54 Device Configuration
55 --------------------
56
57 Configuring SDP EP rawdev device is done using the ``rte_rawdev_configure()``
58 API, which takes the mempool as parameter. PMD uses this pool to send/receive
59 packets to/from the HW.
60
61 The following code shows how the device is configured
62
63 .. code-block:: c
64
65    struct sdp_rawdev_info config = {0};
66    struct rte_rawdev_info rdev_info = {.dev_private = &config};
67    config.enqdeq_mpool = (void *)rte_mempool_create(...);
68
69    rte_rawdev_configure(dev_id, (rte_rawdev_obj_t)&rdev_info);