xref: /dpdk/doc/guides/rawdevs/cnxk_bphy.rst (revision 7be78d02)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2021 Marvell.
3
4Marvell CNXK BPHY Driver
5========================
6
7CN10K/CN9K Fusion product families offer an internal BPHY unit which provides
8set of hardware accelerators for performing baseband related operations.
9Connectivity to the outside world happens through a block called RFOE which is
10backed by ethernet I/O block called CGX or RPM (depending on the chip version).
11RFOE stands for Radio Frequency Over Ethernet and provides support for
12IEEE 1904.3 (RoE) standard.
13
14Features
15--------
16
17The BPHY CGX/RPM implements following features in the rawdev API:
18
19- Access to BPHY CGX/RPM via a set of predefined messages
20- Access to BPHY memory
21- Custom interrupt handlers
22
23Device Setup
24------------
25
26The BPHY CGX/RPM devices will need to be bound to a user-space IO driver for
27use. The script ``dpdk-devbind.py`` script included with DPDK can be used to
28view the state of the devices and to bind them to a suitable DPDK-supported
29kernel driver. When querying the status of the devices, they will appear under
30the category of "Misc (rawdev) devices", i.e. the command
31``dpdk-devbind.py --status-dev misc`` can be used to see the state of those
32devices alone.
33
34Before performing actual data transfer one needs to first retrieve number of
35available queues with ``rte_rawdev_queue_count()`` and capacity of each
36using ``rte_rawdev_queue_conf_get()``.
37
38To perform data transfer use standard ``rte_rawdev_enqueue_buffers()`` and
39``rte_rawdev_dequeue_buffers()`` APIs. Not all messages produce sensible
40responses hence dequeuing is not always necessary.
41
42BPHY CGX/RPM PMD
43----------------
44
45BPHY CGX/RPM PMD accepts ``struct cnxk_bphy_cgx_msg`` messages which differ by type and payload.
46Message types along with description are listed below. As for the usage examples please refer to
47``cnxk_bphy_cgx_dev_selftest()``.
48
49Get link information
50~~~~~~~~~~~~~~~~~~~~
51
52Message is used to get information about link state.
53
54Message must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_GET_LINKINFO``. In response one will
55get message containing payload i.e ``struct cnxk_bphy_cgx_msg_link_info`` filled with information
56about current link state.
57
58Change internal loopback state
59~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
61Message is used to enable or disable internal loopback.
62
63Message must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_INTLBK_ENABLE`` or
64``CNXK_BPHY_CGX_MSG_TYPE_INTLBK_DISABLE``. Former will activate internal loopback while the latter
65will do the opposite.
66
67Change PTP RX state
68~~~~~~~~~~~~~~~~~~~
69
70Message is used to enable or disable PTP mode.
71
72Message must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_ENABLE`` or
73``CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_DISABLE``. Former will enable PTP while the latter will do the
74opposite.
75
76Set link mode
77~~~~~~~~~~~~~
78
79Message is used to change link mode.
80
81Message must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_SET_LINK_MODE``. Prior to sending actual
82message payload i.e ``struct cnxk_bphy_cgx_msg_link_mode`` needs to be filled with relevant
83information.
84
85Change link state
86~~~~~~~~~~~~~~~~~
87
88Message is used to set link up or down.
89
90Message must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_SET_LINK_STATE``. Prior to sending actual
91message payload i.e ``struct cnxk_bphy_cgx_msg_set_link_state`` needs to be filled with relevant
92information.
93
94Start or stop RX/TX
95~~~~~~~~~~~~~~~~~~~
96
97Message is used to start or stop accepting traffic.
98
99Message must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_START_RXTX`` or
100``CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX``. Former will enable traffic while the latter will
101do the opposite.
102
103BPHY PMD
104--------
105
106BPHY PMD accepts ``struct cnxk_bphy_irq_msg`` messages which differ by type and payload.
107Message types along with description are listed below. For some usage examples please refer to
108``bphy_rawdev_selftest()``.
109
110Initialize or finalize interrupt handling
111~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112
113Message is used to setup low level interrupt handling.
114
115Message must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_INIT`` or ``CNXK_BPHY_IRQ_MSG_TYPE_FINI``.
116The former will setup low level interrupt handling while the latter will tear everything down. There
117are also two convenience functions namely ``rte_pmd_bphy_intr_init()`` and
118``rte_pmd_bphy_intr_fini()`` that take care of all details.
119
120
121Register or remove interrupt handler
122~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123
124Message is used setup custom interrupt handler.
125
126Message must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_REGISTER`` or
127``CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER``. The former will register an interrupt handler while the
128latter will remove it. Prior sending actual message payload i.e ``struct cnxk_bphy_irq_info`` needs
129to be filled with relevant information. There are also two convenience functions namely
130``rte_pmd_bphy_intr_register()`` and ``rte_pmd_bphy_intr_unregister()`` that take care of all
131details.
132
133Get device memory
134~~~~~~~~~~~~~~~~~
135
136Message is used to read device MMIO address.
137
138Message must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET``. There's a convenience function
139``rte_pmd_bphy_intr_mem_get()`` available that takes care of retrieving that address.
140
141Self test
142---------
143
144On EAL initialization BPHY and BPHY CGX/RPM devices will be probed and populated into
145the raw devices. The rawdev ID of the device can be obtained using invocation
146of ``rte_rawdev_get_dev_id("NAME:x")`` from the test application, where:
147
148- NAME is the desired subsystem: use "BPHY" for regular, and "BPHY_CGX" for
149  RFOE module.
150- x is the device's bus id specified in "bus:device.func" (BDF) format. BDF follows convention
151  used by lspci i.e bus, device and func are specified using respectively two, two and one hex
152  digit(s).
153
154Use this identifier for further rawdev function calls.
155
156Selftest rawdev API can be used to verify the BPHY and BPHY CGX/RPM functionality.
157