xref: /dpdk/doc/guides/rawdevs/cnxk_bphy.rst (revision 7a86a806dcf32213171adc9dc36d87b3d0c2750b)
13d27e49eSTomasz Duszynski..  SPDX-License-Identifier: BSD-3-Clause
23d27e49eSTomasz Duszynski    Copyright(c) 2021 Marvell.
33d27e49eSTomasz Duszynski
43d27e49eSTomasz DuszynskiMarvell CNXK BPHY Driver
53d27e49eSTomasz Duszynski========================
63d27e49eSTomasz Duszynski
73d27e49eSTomasz DuszynskiCN10K/CN9K Fusion product families offer an internal BPHY unit which provides
83d27e49eSTomasz Duszynskiset of hardware accelerators for performing baseband related operations.
93d27e49eSTomasz DuszynskiConnectivity to the outside world happens through a block called RFOE which is
103d27e49eSTomasz Duszynskibacked by ethernet I/O block called CGX or RPM (depending on the chip version).
113d27e49eSTomasz DuszynskiRFOE stands for Radio Frequency Over Ethernet and provides support for
123d27e49eSTomasz DuszynskiIEEE 1904.3 (RoE) standard.
133d27e49eSTomasz Duszynski
14df39890fSTomasz DuszynskiFeatures
15df39890fSTomasz Duszynski--------
16df39890fSTomasz Duszynski
17df39890fSTomasz DuszynskiThe BPHY CGX/RPM implements following features in the rawdev API:
18df39890fSTomasz Duszynski
19df39890fSTomasz Duszynski- Access to BPHY CGX/RPM via a set of predefined messages
20e50cb223STomasz Duszynski- Access to BPHY memory
2164fa1ebdSTomasz Duszynski- Custom interrupt handlers
22*7a86a806STomasz Duszynski- Multiprocess aware
23*7a86a806STomasz Duszynski
24*7a86a806STomasz DuszynskiLimitations
25*7a86a806STomasz Duszynski-----------
26*7a86a806STomasz Duszynski
27*7a86a806STomasz DuszynskiIn multiprocess mode user-space application must ensure
28*7a86a806STomasz Duszynskino resources sharing takes place.
29*7a86a806STomasz DuszynskiOtherwise, user-space application should ensure synchronization.
30df39890fSTomasz Duszynski
313d27e49eSTomasz DuszynskiDevice Setup
323d27e49eSTomasz Duszynski------------
333d27e49eSTomasz Duszynski
343d27e49eSTomasz DuszynskiThe BPHY CGX/RPM devices will need to be bound to a user-space IO driver for
353d27e49eSTomasz Duszynskiuse. The script ``dpdk-devbind.py`` script included with DPDK can be used to
363d27e49eSTomasz Duszynskiview the state of the devices and to bind them to a suitable DPDK-supported
373d27e49eSTomasz Duszynskikernel driver. When querying the status of the devices, they will appear under
383d27e49eSTomasz Duszynskithe category of "Misc (rawdev) devices", i.e. the command
393d27e49eSTomasz Duszynski``dpdk-devbind.py --status-dev misc`` can be used to see the state of those
403d27e49eSTomasz Duszynskidevices alone.
418614a691STomasz Duszynski
428614a691STomasz DuszynskiBefore performing actual data transfer one needs to first retrieve number of
438614a691STomasz Duszynskiavailable queues with ``rte_rawdev_queue_count()`` and capacity of each
448614a691STomasz Duszynskiusing ``rte_rawdev_queue_conf_get()``.
45df39890fSTomasz Duszynski
46df39890fSTomasz DuszynskiTo perform data transfer use standard ``rte_rawdev_enqueue_buffers()`` and
47df39890fSTomasz Duszynski``rte_rawdev_dequeue_buffers()`` APIs. Not all messages produce sensible
487be78d02SJosh Sorefresponses hence dequeuing is not always necessary.
49df39890fSTomasz Duszynski
507cf19768STomasz DuszynskiBPHY CGX/RPM PMD
517cf19768STomasz Duszynski----------------
527cf19768STomasz Duszynski
53df39890fSTomasz DuszynskiBPHY CGX/RPM PMD accepts ``struct cnxk_bphy_cgx_msg`` messages which differ by type and payload.
544d2b2267STomasz DuszynskiMessage types along with description are listed below. As for the usage examples please refer to
554d2b2267STomasz Duszynski``cnxk_bphy_cgx_dev_selftest()``.
56df39890fSTomasz Duszynski
57df39890fSTomasz DuszynskiGet link information
58df39890fSTomasz Duszynski~~~~~~~~~~~~~~~~~~~~
59df39890fSTomasz Duszynski
60df39890fSTomasz DuszynskiMessage is used to get information about link state.
61df39890fSTomasz Duszynski
62df39890fSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_GET_LINKINFO``. In response one will
63df39890fSTomasz Duszynskiget message containing payload i.e ``struct cnxk_bphy_cgx_msg_link_info`` filled with information
64df39890fSTomasz Duszynskiabout current link state.
65df39890fSTomasz Duszynski
66df39890fSTomasz DuszynskiChange internal loopback state
67df39890fSTomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68df39890fSTomasz Duszynski
69df39890fSTomasz DuszynskiMessage is used to enable or disable internal loopback.
70df39890fSTomasz Duszynski
71df39890fSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_INTLBK_ENABLE`` or
72df39890fSTomasz Duszynski``CNXK_BPHY_CGX_MSG_TYPE_INTLBK_DISABLE``. Former will activate internal loopback while the latter
73df39890fSTomasz Duszynskiwill do the opposite.
74df39890fSTomasz Duszynski
75df39890fSTomasz DuszynskiChange PTP RX state
76df39890fSTomasz Duszynski~~~~~~~~~~~~~~~~~~~
77df39890fSTomasz Duszynski
78df39890fSTomasz DuszynskiMessage is used to enable or disable PTP mode.
79df39890fSTomasz Duszynski
80df39890fSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_ENABLE`` or
81df39890fSTomasz Duszynski``CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_DISABLE``. Former will enable PTP while the latter will do the
82df39890fSTomasz Duszynskiopposite.
83df39890fSTomasz Duszynski
84df39890fSTomasz DuszynskiSet link mode
85df39890fSTomasz Duszynski~~~~~~~~~~~~~
86df39890fSTomasz Duszynski
87df39890fSTomasz DuszynskiMessage is used to change link mode.
88df39890fSTomasz Duszynski
89df39890fSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_SET_LINK_MODE``. Prior to sending actual
90df39890fSTomasz Duszynskimessage payload i.e ``struct cnxk_bphy_cgx_msg_link_mode`` needs to be filled with relevant
91df39890fSTomasz Duszynskiinformation.
92df39890fSTomasz Duszynski
93df39890fSTomasz DuszynskiChange link state
94df39890fSTomasz Duszynski~~~~~~~~~~~~~~~~~
95df39890fSTomasz Duszynski
96df39890fSTomasz DuszynskiMessage is used to set link up or down.
97df39890fSTomasz Duszynski
98df39890fSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_SET_LINK_STATE``. Prior to sending actual
99df39890fSTomasz Duszynskimessage payload i.e ``struct cnxk_bphy_cgx_msg_set_link_state`` needs to be filled with relevant
100df39890fSTomasz Duszynskiinformation.
101df39890fSTomasz Duszynski
102df39890fSTomasz DuszynskiStart or stop RX/TX
103df39890fSTomasz Duszynski~~~~~~~~~~~~~~~~~~~
104df39890fSTomasz Duszynski
105df39890fSTomasz DuszynskiMessage is used to start or stop accepting traffic.
106df39890fSTomasz Duszynski
107df39890fSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_START_RXTX`` or
108df39890fSTomasz Duszynski``CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX``. Former will enable traffic while the latter will
109df39890fSTomasz Duszynskido the opposite.
1104d2b2267STomasz Duszynski
1117af3e7aaSTomasz DuszynskiChange mode from eCPRI to CPRI
1127af3e7aaSTomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1137af3e7aaSTomasz Duszynski
1147af3e7aaSTomasz DuszynskiMessage is used to change operating mode from eCPRI to CPRI along with other
1157af3e7aaSTomasz Duszynskisettings.
1167af3e7aaSTomasz Duszynski
1177af3e7aaSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_CPRI_MODE_CHANGE``.
1187af3e7aaSTomasz DuszynskiPrior to sending actual message payload i.e
1197af3e7aaSTomasz Duszynski``struct cnxk_bphy_cgx_msg_cpri_mode_change`` needs to be filled with relevant
1207af3e7aaSTomasz Duszynskiinformation.
1217af3e7aaSTomasz Duszynski
122283c9175STomasz DuszynskiEnable TX for CPRI SERDES
123283c9175STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~
124283c9175STomasz Duszynski
125283c9175STomasz DuszynskiMessage is used to enable TX for SERDES configured in CPRI mode.
126283c9175STomasz Duszynski
127283c9175STomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_CPRI_TX_CONTROL``.
128283c9175STomasz DuszynskiPrior to sending actual message payload i.e
129283c9175STomasz Duszynski``struct cnxk_bphy_cgx_msg_cpri_mode_tx_ctrl`` needs to be filled with relevant
130283c9175STomasz Duszynskiinformation.
131283c9175STomasz Duszynski
132888123a6STomasz DuszynskiChange CPRI misc settings
133888123a6STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~
134888123a6STomasz Duszynski
135888123a6STomasz DuszynskiMessage is used to change misc CPRI settings, for example to reset RX state
136888123a6STomasz Duszynskimachine on CPRI SERDES.
137888123a6STomasz Duszynski
138888123a6STomasz DuszynskiMessage must have type set to ``CNXK_BPHY_CGX_MSG_TYPE_CPRI_MODE_MISC``.
139888123a6STomasz DuszynskiPrior to sending actual message payload i.e
140888123a6STomasz Duszynski``struct cnxk_bphy_cgx_msg_cpri_mode_misc`` needs to be filled with relevant
141888123a6STomasz Duszynskiinformation.
142888123a6STomasz Duszynski
1437cf19768STomasz DuszynskiBPHY PMD
1447cf19768STomasz Duszynski--------
1457cf19768STomasz Duszynski
1467cf19768STomasz DuszynskiBPHY PMD accepts ``struct cnxk_bphy_irq_msg`` messages which differ by type and payload.
1477cf19768STomasz DuszynskiMessage types along with description are listed below. For some usage examples please refer to
1487cf19768STomasz Duszynski``bphy_rawdev_selftest()``.
1497cf19768STomasz Duszynski
1507cf19768STomasz DuszynskiInitialize or finalize interrupt handling
1517cf19768STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1527cf19768STomasz Duszynski
1537cf19768STomasz DuszynskiMessage is used to setup low level interrupt handling.
1547cf19768STomasz Duszynski
1557cf19768STomasz DuszynskiMessage must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_INIT`` or ``CNXK_BPHY_IRQ_MSG_TYPE_FINI``.
1567cf19768STomasz DuszynskiThe former will setup low level interrupt handling while the latter will tear everything down. There
1577cf19768STomasz Duszynskiare also two convenience functions namely ``rte_pmd_bphy_intr_init()`` and
1587cf19768STomasz Duszynski``rte_pmd_bphy_intr_fini()`` that take care of all details.
1597cf19768STomasz Duszynski
160e50cb223STomasz Duszynski
16164fa1ebdSTomasz DuszynskiRegister or remove interrupt handler
16264fa1ebdSTomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16364fa1ebdSTomasz Duszynski
16464fa1ebdSTomasz DuszynskiMessage is used setup custom interrupt handler.
16564fa1ebdSTomasz Duszynski
16664fa1ebdSTomasz DuszynskiMessage must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_REGISTER`` or
16764fa1ebdSTomasz Duszynski``CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER``. The former will register an interrupt handler while the
16864fa1ebdSTomasz Duszynskilatter will remove it. Prior sending actual message payload i.e ``struct cnxk_bphy_irq_info`` needs
16964fa1ebdSTomasz Duszynskito be filled with relevant information. There are also two convenience functions namely
17064fa1ebdSTomasz Duszynski``rte_pmd_bphy_intr_register()`` and ``rte_pmd_bphy_intr_unregister()`` that take care of all
17164fa1ebdSTomasz Duszynskidetails.
17264fa1ebdSTomasz Duszynski
173e50cb223STomasz DuszynskiGet device memory
174e50cb223STomasz Duszynski~~~~~~~~~~~~~~~~~
175e50cb223STomasz Duszynski
176e50cb223STomasz DuszynskiMessage is used to read device MMIO address.
177e50cb223STomasz Duszynski
178e50cb223STomasz DuszynskiMessage must have type set to ``CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET``. There's a convenience function
179e50cb223STomasz Duszynski``rte_pmd_bphy_intr_mem_get()`` available that takes care of retrieving that address.
180e50cb223STomasz Duszynski
1814d2b2267STomasz DuszynskiSelf test
1824d2b2267STomasz Duszynski---------
1834d2b2267STomasz Duszynski
18482a15315STomasz DuszynskiOn EAL initialization BPHY and BPHY CGX/RPM devices will be probed and populated into
1854d2b2267STomasz Duszynskithe raw devices. The rawdev ID of the device can be obtained using invocation
1864d2b2267STomasz Duszynskiof ``rte_rawdev_get_dev_id("NAME:x")`` from the test application, where:
1874d2b2267STomasz Duszynski
18882a15315STomasz Duszynski- NAME is the desired subsystem: use "BPHY" for regular, and "BPHY_CGX" for
1896d72dce7STomasz Duszynski  RFOE module.
1906d72dce7STomasz Duszynski- x is the device's bus id specified in "bus:device.func" (BDF) format. BDF follows convention
1916d72dce7STomasz Duszynski  used by lspci i.e bus, device and func are specified using respectively two, two and one hex
1926d72dce7STomasz Duszynski  digit(s).
1934d2b2267STomasz Duszynski
1944d2b2267STomasz DuszynskiUse this identifier for further rawdev function calls.
1954d2b2267STomasz Duszynski
19682a15315STomasz DuszynskiSelftest rawdev API can be used to verify the BPHY and BPHY CGX/RPM functionality.
197