1 .. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
3 ====================================
4 Marvell OcteonTx2 RVU Kernel Drivers
5 ====================================
7 Copyright (c) 2020 Marvell International Ltd.
14 - `Basic packet flow`_
15 - `Devlink health reporters`_
20 Resource virtualization unit (RVU) on Marvell's OcteonTX2 SOC maps HW
21 resources from the network, crypto and other functional blocks into
22 PCI-compatible physical and virtual functions. Each functional block
23 again has multiple local functions (LFs) for provisioning to PCI devices.
24 RVU supports multiple PCIe SRIOV physical functions (PFs) and virtual
25 functions (VFs). PF0 is called the administrative / admin function (AF)
26 and has privileges to provision RVU functional block's LFs to each of the
29 RVU managed networking functional blocks
30 - Network pool or buffer allocator (NPA)
31 - Network interface controller (NIX)
32 - Network parser CAM (NPC)
33 - Schedule/Synchronize/Order unit (SSO)
34 - Loopback interface (LBK)
36 RVU managed non-networking functional blocks
37 - Crypto accelerator (CPT)
38 - Scheduled timers unit (TIM)
39 - Schedule/Synchronize/Order unit (SSO)
40 Used for both networking and non networking usecases
42 Resource provisioning examples
43 - A PF/VF with NIX-LF & NPA-LF resources works as a pure network device
44 - A PF/VF with CPT-LF resource works as a pure crypto offload device.
46 RVU functional blocks are highly configurable as per software requirements.
48 Firmware setups following stuff before kernel boots
49 - Enables required number of RVU PFs based on number of physical links.
50 - Number of VFs per PF are either static or configurable at compile time.
51 Based on config, firmware assigns VFs to each of the PFs.
52 - Also assigns MSIX vectors to each of PF and VFs.
53 - These are not changed after kernel boot.
58 Linux kernel will have multiple drivers registering to different PF and VFs
59 of RVU. Wrt networking there will be 3 flavours of drivers.
64 As mentioned above RVU PF0 is called the admin function (AF), this driver
65 supports resource provisioning and configuration of functional blocks.
66 Doesn't handle any I/O. It sets up few basic stuff but most of the
67 funcionality is achieved via configuration requests from PFs and VFs.
69 PF/VFs communicates with AF via a shared memory region (mailbox). Upon
70 receiving requests AF does resource provisioning and other HW configuration.
71 AF is always attached to host kernel, but PFs and their VFs may be used by host
72 kernel itself, or attached to VMs or to userspace applications like
73 DPDK etc. So AF has to handle provisioning/configuration requests sent
74 by any device from any domain.
76 AF driver also interacts with underlying firmware to
77 - Manage physical ethernet links ie CGX LMACs.
78 - Retrieve information like speed, duplex, autoneg etc
79 - Retrieve PHY EEPROM and stats.
80 - Configure FEC, PAM modes
83 From pure networking side AF driver supports following functionality.
84 - Map a physical link to a RVU PF to which a netdev is registered.
85 - Attach NIX and NPA block LFs to RVU PF/VF which provide buffer pools, RQs, SQs
86 for regular networking functionality.
87 - Flow control (pause frames) enable/disable/config.
88 - HW PTP timestamping related config.
89 - NPC parser profile config, basically how to parse pkt and what info to extract.
90 - NPC extract profile config, what to extract from the pkt to match data in MCAM entries.
91 - Manage NPC MCAM entries, upon request can frame and install requested packet forwarding rules.
92 - Defines receive side scaling (RSS) algorithms.
93 - Defines segmentation offload algorithms (eg TSO)
94 - VLAN stripping, capture and insertion config.
95 - SSO and TIM blocks config which provide packet scheduling support.
96 - Debugfs support, to check current resource provising, current status of
97 NPA pools, NIX RQ, SQ and CQs, various stats etc which helps in debugging issues.
100 Physical Function driver
101 ------------------------
103 This RVU PF handles IO, is mapped to a physical ethernet link and this
104 driver registers a netdev. This supports SR-IOV. As said above this driver
105 communicates with AF with a mailbox. To retrieve information from physical
106 links this driver talks to AF and AF gets that info from firmware and responds
107 back ie cannot talk to firmware directly.
109 Supports ethtool for configuring links, RSS, queue count, queue size,
110 flow control, ntuple filters, dump PHY EEPROM, config FEC etc.
112 Virtual Function driver
113 -----------------------
115 There are two types VFs, VFs that share the physical link with their parent
116 SR-IOV PF and the VFs which work in pairs using internal HW loopback channels (LBK).
119 - These VFs and their parent PF share a physical link and used for outside communication.
120 - VFs cannot communicate with AF directly, they send mbox message to PF and PF
121 forwards that to AF. AF after processing, responds back to PF and PF forwards
123 - From functionality point of view there is no difference between PF and VF as same type
124 HW resources are attached to both. But user would be able to configure few stuff only
125 from PF as PF is treated as owner/admin of the link.
128 - RVU PF0 ie admin function creates these VFs and maps them to loopback block's channels.
129 - A set of two VFs (VF0 & VF1, VF2 & VF3 .. so on) works as a pair ie pkts sent out of
130 VF0 will be received by VF1 and viceversa.
131 - These VFs can be used by applications or virtual machines to communicate between them
132 without sending traffic outside. There is no switch present in HW, hence the support
134 - These communicate directly with AF (PF0) via mbox.
136 Except for the IO channels or links used for packet reception and transmission there is
137 no other difference between these VF types. AF driver takes care of IO channel mapping,
138 hence same VF driver works for both types of devices.
146 1. CGX LMAC receives packet.
147 2. Forwards the packet to the NIX block.
148 3. Then submitted to NPC block for parsing and then MCAM lookup to get the destination RVU device.
149 4. NIX LF attached to the destination RVU device allocates a buffer from RQ mapped buffer pool of NPA block LF.
150 5. RQ may be selected by RSS or by configuring MCAM rule with a RQ number.
151 6. Packet is DMA'ed and driver is notified.
156 1. Driver prepares a send descriptor and submits to SQ for transmission.
157 2. The SQ is already configured (by AF) to transmit on a specific link/channel.
158 3. The SQ descriptor ring is maintained in buffers allocated from SQ mapped pool of NPA block LF.
159 4. NIX block transmits the pkt on the designated channel.
160 5. NPC MCAM entries can be installed to divert pkt onto a different channel.
162 Devlink health reporters
163 ========================
167 The NPA reporters are responsible for reporting and recovering the following group of errors
169 - Error due to operation of unmapped PF.
170 - Error due to disabled alloc/free for other HW blocks (NIX, SSO, TIM, DPI and AURA).
172 - Fault due to NPA_AQ_INST_S read or NPA_AQ_RES_S write.
175 - RAS Error Reporting for NPA_AQ_INST_S/NPA_AQ_RES_S.
177 - Error due to unmapped slot.
184 state healthy error 2872 recover 2872 last_dump_date 2020-12-10 last_dump_time 09:39:09 grace_period 0 auto_recover true auto_dump true
186 state healthy error 2872 recover 2872 last_dump_date 2020-12-11 last_dump_time 04:43:04 grace_period 0 auto_recover true auto_dump true
188 state healthy error 2871 recover 2871 last_dump_date 2020-12-10 last_dump_time 09:39:17 grace_period 0 auto_recover true auto_dump true
190 state healthy error 0 recover 0 last_dump_date 2020-12-10 last_dump_time 09:32:40 grace_period 0 auto_recover true auto_dump true
192 Each reporter dumps the
194 - Error Register value
198 ~# devlink health dump show pci/0002:01:00.0 reporter hw_npa_gen
200 NPA General Interrupt Reg : 1
201 NIX0: free disabled RX
202 ~# devlink health dump show pci/0002:01:00.0 reporter hw_npa_intr
204 NPA RVU Interrupt Reg : 1
206 ~# devlink health dump show pci/0002:01:00.0 reporter hw_npa_err
208 NPA Error Interrupt Reg : 4096