1
2
3
4
5#ifndef __OTX2_MBOX_H__
6#define __OTX2_MBOX_H__
7
8#include <errno.h>
9#include <stdbool.h>
10
11#include <rte_ether.h>
12#include <rte_spinlock.h>
13
14#include <otx2_common.h>
15
16#define SZ_64K (64ULL * 1024ULL)
17#define SZ_1K (1ULL * 1024ULL)
18#define MBOX_SIZE SZ_64K
19
20
21#define MBOX_DOWN_RX_START 0
22#define MBOX_DOWN_RX_SIZE (46 * SZ_1K)
23#define MBOX_DOWN_TX_START (MBOX_DOWN_RX_START + MBOX_DOWN_RX_SIZE)
24#define MBOX_DOWN_TX_SIZE (16 * SZ_1K)
25
26#define MBOX_UP_RX_START (MBOX_DOWN_TX_START + MBOX_DOWN_TX_SIZE)
27#define MBOX_UP_RX_SIZE SZ_1K
28#define MBOX_UP_TX_START (MBOX_UP_RX_START + MBOX_UP_RX_SIZE)
29#define MBOX_UP_TX_SIZE SZ_1K
30
31#if MBOX_UP_TX_SIZE + MBOX_UP_TX_START != MBOX_SIZE
32# error "Incorrect mailbox area sizes"
33#endif
34
35#define INTR_MASK(pfvfs) ((pfvfs < 64) ? (BIT_ULL(pfvfs) - 1) : (~0ull))
36
37#define MBOX_RSP_TIMEOUT 3000
38
39#define MBOX_MSG_ALIGN 16
40
41
42#define MBOX_DIR_AFPF 0
43#define MBOX_DIR_PFAF 1
44#define MBOX_DIR_PFVF 2
45#define MBOX_DIR_VFPF 3
46#define MBOX_DIR_AFPF_UP 4
47#define MBOX_DIR_PFAF_UP 5
48#define MBOX_DIR_PFVF_UP 6
49#define MBOX_DIR_VFPF_UP 7
50
51
52
53
54#define __otx2_io volatile
55
56struct otx2_mbox_dev {
57 void *mbase;
58 rte_spinlock_t mbox_lock;
59 uint16_t msg_size;
60 uint16_t rsp_size;
61 uint16_t num_msgs;
62 uint16_t msgs_acked;
63};
64
65struct otx2_mbox {
66 uintptr_t hwbase;
67 uintptr_t reg_base;
68 uint64_t trigger;
69 uint16_t tr_shift;
70 uint64_t rx_start;
71 uint64_t tx_start;
72 uint16_t rx_size;
73 uint16_t tx_size;
74 uint16_t ndevs;
75 struct otx2_mbox_dev *dev;
76 uint64_t intr_offset;
77};
78
79
80struct mbox_hdr {
81 uint64_t __otx2_io msg_size;
82 uint16_t __otx2_io num_msgs;
83};
84
85
86struct mbox_msghdr {
87 uint16_t __otx2_io pcifunc;
88 uint16_t __otx2_io id;
89#define OTX2_MBOX_REQ_SIG (0xdead)
90#define OTX2_MBOX_RSP_SIG (0xbeef)
91
92 uint16_t __otx2_io sig;
93#define OTX2_MBOX_VERSION (0x000a)
94
95 uint16_t __otx2_io ver;
96
97 uint16_t __otx2_io next_msgoff;
98 int __otx2_io rc;
99};
100
101
102#define MBOX_MSG_MASK 0xFFFF
103#define MBOX_MSG_INVALID 0xFFFE
104#define MBOX_MSG_MAX 0xFFFF
105
106#define MBOX_MESSAGES \
107 \
108M(READY, 0x001, ready, msg_req, ready_msg_rsp) \
109M(ATTACH_RESOURCES, 0x002, attach_resources, rsrc_attach_req, msg_rsp)\
110M(DETACH_RESOURCES, 0x003, detach_resources, rsrc_detach_req, msg_rsp)\
111M(FREE_RSRC_CNT, 0x004, free_rsrc_cnt, msg_req, free_rsrcs_rsp) \
112M(MSIX_OFFSET, 0x005, msix_offset, msg_req, msix_offset_rsp) \
113M(VF_FLR, 0x006, vf_flr, msg_req, msg_rsp) \
114M(PTP_OP, 0x007, ptp_op, ptp_req, ptp_rsp) \
115M(GET_HW_CAP, 0x008, get_hw_cap, msg_req, get_hw_cap_rsp) \
116M(NDC_SYNC_OP, 0x009, ndc_sync_op, ndc_sync_op, msg_rsp) \
117 \
118M(CGX_START_RXTX, 0x200, cgx_start_rxtx, msg_req, msg_rsp) \
119M(CGX_STOP_RXTX, 0x201, cgx_stop_rxtx, msg_req, msg_rsp) \
120M(CGX_STATS, 0x202, cgx_stats, msg_req, cgx_stats_rsp) \
121M(CGX_MAC_ADDR_SET, 0x203, cgx_mac_addr_set, cgx_mac_addr_set_or_get,\
122 cgx_mac_addr_set_or_get) \
123M(CGX_MAC_ADDR_GET, 0x204, cgx_mac_addr_get, cgx_mac_addr_set_or_get,\
124 cgx_mac_addr_set_or_get) \
125M(CGX_PROMISC_ENABLE, 0x205, cgx_promisc_enable, msg_req, msg_rsp) \
126M(CGX_PROMISC_DISABLE, 0x206, cgx_promisc_disable, msg_req, msg_rsp) \
127M(CGX_START_LINKEVENTS, 0x207, cgx_start_linkevents, msg_req, msg_rsp) \
128M(CGX_STOP_LINKEVENTS, 0x208, cgx_stop_linkevents, msg_req, msg_rsp) \
129M(CGX_GET_LINKINFO, 0x209, cgx_get_linkinfo, msg_req, cgx_link_info_msg)\
130M(CGX_INTLBK_ENABLE, 0x20A, cgx_intlbk_enable, msg_req, msg_rsp) \
131M(CGX_INTLBK_DISABLE, 0x20B, cgx_intlbk_disable, msg_req, msg_rsp) \
132M(CGX_PTP_RX_ENABLE, 0x20C, cgx_ptp_rx_enable, msg_req, msg_rsp) \
133M(CGX_PTP_RX_DISABLE, 0x20D, cgx_ptp_rx_disable, msg_req, msg_rsp) \
134M(CGX_CFG_PAUSE_FRM, 0x20E, cgx_cfg_pause_frm, cgx_pause_frm_cfg, \
135 cgx_pause_frm_cfg) \
136M(CGX_FW_DATA_GET, 0x20F, cgx_get_aux_link_info, msg_req, cgx_fw_data) \
137M(CGX_FEC_SET, 0x210, cgx_set_fec_param, fec_mode, fec_mode) \
138M(CGX_MAC_ADDR_ADD, 0x211, cgx_mac_addr_add, cgx_mac_addr_add_req, \
139 cgx_mac_addr_add_rsp) \
140M(CGX_MAC_ADDR_DEL, 0x212, cgx_mac_addr_del, cgx_mac_addr_del_req, \
141 msg_rsp) \
142M(CGX_MAC_MAX_ENTRIES_GET, 0x213, cgx_mac_max_entries_get, msg_req, \
143 cgx_max_dmac_entries_get_rsp) \
144M(CGX_SET_LINK_STATE, 0x214, cgx_set_link_state, \
145 cgx_set_link_state_msg, msg_rsp) \
146M(CGX_GET_PHY_MOD_TYPE, 0x215, cgx_get_phy_mod_type, msg_req, \
147 cgx_phy_mod_type) \
148M(CGX_SET_PHY_MOD_TYPE, 0x216, cgx_set_phy_mod_type, cgx_phy_mod_type, \
149 msg_rsp) \
150M(CGX_FEC_STATS, 0x217, cgx_fec_stats, msg_req, cgx_fec_stats_rsp) \
151M(CGX_SET_LINK_MODE, 0x218, cgx_set_link_mode, cgx_set_link_mode_req,\
152 cgx_set_link_mode_rsp) \
153M(CGX_GET_PHY_FEC_STATS, 0x219, cgx_get_phy_fec_stats, msg_req, msg_rsp) \
154M(CGX_STATS_RST, 0x21A, cgx_stats_rst, msg_req, msg_rsp) \
155 \
156M(NPA_LF_ALLOC, 0x400, npa_lf_alloc, npa_lf_alloc_req, \
157 npa_lf_alloc_rsp) \
158M(NPA_LF_FREE, 0x401, npa_lf_free, msg_req, msg_rsp) \
159M(NPA_AQ_ENQ, 0x402, npa_aq_enq, npa_aq_enq_req, npa_aq_enq_rsp)\
160M(NPA_HWCTX_DISABLE, 0x403, npa_hwctx_disable, hwctx_disable_req, msg_rsp)\
161 \
162M(SSO_LF_ALLOC, 0x600, sso_lf_alloc, sso_lf_alloc_req, \
163 sso_lf_alloc_rsp) \
164M(SSO_LF_FREE, 0x601, sso_lf_free, sso_lf_free_req, msg_rsp) \
165M(SSOW_LF_ALLOC, 0x602, ssow_lf_alloc, ssow_lf_alloc_req, msg_rsp)\
166M(SSOW_LF_FREE, 0x603, ssow_lf_free, ssow_lf_free_req, msg_rsp) \
167M(SSO_HW_SETCONFIG, 0x604, sso_hw_setconfig, sso_hw_setconfig, \
168 msg_rsp) \
169M(SSO_GRP_SET_PRIORITY, 0x605, sso_grp_set_priority, sso_grp_priority, \
170 msg_rsp) \
171M(SSO_GRP_GET_PRIORITY, 0x606, sso_grp_get_priority, sso_info_req, \
172 sso_grp_priority) \
173M(SSO_WS_CACHE_INV, 0x607, sso_ws_cache_inv, msg_req, msg_rsp) \
174M(SSO_GRP_QOS_CONFIG, 0x608, sso_grp_qos_config, sso_grp_qos_cfg, \
175 msg_rsp) \
176M(SSO_GRP_GET_STATS, 0x609, sso_grp_get_stats, sso_info_req, \
177 sso_grp_stats) \
178M(SSO_HWS_GET_STATS, 0x610, sso_hws_get_stats, sso_info_req, \
179 sso_hws_stats) \
180M(SSO_HW_RELEASE_XAQ, 0x611, sso_hw_release_xaq_aura, \
181 sso_release_xaq, msg_rsp) \
182 \
183M(TIM_LF_ALLOC, 0x800, tim_lf_alloc, tim_lf_alloc_req, \
184 tim_lf_alloc_rsp) \
185M(TIM_LF_FREE, 0x801, tim_lf_free, tim_ring_req, msg_rsp) \
186M(TIM_CONFIG_RING, 0x802, tim_config_ring, tim_config_req, msg_rsp)\
187M(TIM_ENABLE_RING, 0x803, tim_enable_ring, tim_ring_req, \
188 tim_enable_rsp) \
189M(TIM_DISABLE_RING, 0x804, tim_disable_ring, tim_ring_req, msg_rsp) \
190 \
191M(CPT_LF_ALLOC, 0xA00, cpt_lf_alloc, cpt_lf_alloc_req_msg, \
192 cpt_lf_alloc_rsp_msg) \
193M(CPT_LF_FREE, 0xA01, cpt_lf_free, msg_req, msg_rsp) \
194M(CPT_RD_WR_REGISTER, 0xA02, cpt_rd_wr_register, cpt_rd_wr_reg_msg, \
195 cpt_rd_wr_reg_msg) \
196M(CPT_SET_CRYPTO_GRP, 0xA03, cpt_set_crypto_grp, \
197 cpt_set_crypto_grp_req_msg, \
198 msg_rsp) \
199M(CPT_INLINE_IPSEC_CFG, 0xA04, cpt_inline_ipsec_cfg, \
200 cpt_inline_ipsec_cfg_msg, msg_rsp) \
201M(CPT_RX_INLINE_LF_CFG, 0xBFE, cpt_rx_inline_lf_cfg, \
202 cpt_rx_inline_lf_cfg_msg, msg_rsp) \
203M(CPT_GET_CAPS, 0xBFD, cpt_caps_get, msg_req, cpt_caps_rsp_msg) \
204 \
205M(REE_CONFIG_LF, 0xE01, ree_config_lf, ree_lf_req_msg, \
206 msg_rsp) \
207M(REE_RD_WR_REGISTER, 0xE02, ree_rd_wr_register, ree_rd_wr_reg_msg, \
208 ree_rd_wr_reg_msg) \
209M(REE_RULE_DB_PROG, 0xE03, ree_rule_db_prog, \
210 ree_rule_db_prog_req_msg, \
211 msg_rsp) \
212M(REE_RULE_DB_LEN_GET, 0xE04, ree_rule_db_len_get, ree_req_msg, \
213 ree_rule_db_len_rsp_msg) \
214M(REE_RULE_DB_GET, 0xE05, ree_rule_db_get, \
215 ree_rule_db_get_req_msg, \
216 ree_rule_db_get_rsp_msg) \
217 \
218M(NPC_MCAM_ALLOC_ENTRY, 0x6000, npc_mcam_alloc_entry, \
219 npc_mcam_alloc_entry_req, \
220 npc_mcam_alloc_entry_rsp) \
221M(NPC_MCAM_FREE_ENTRY, 0x6001, npc_mcam_free_entry, \
222 npc_mcam_free_entry_req, msg_rsp) \
223M(NPC_MCAM_WRITE_ENTRY, 0x6002, npc_mcam_write_entry, \
224 npc_mcam_write_entry_req, msg_rsp) \
225M(NPC_MCAM_ENA_ENTRY, 0x6003, npc_mcam_ena_entry, \
226 npc_mcam_ena_dis_entry_req, msg_rsp) \
227M(NPC_MCAM_DIS_ENTRY, 0x6004, npc_mcam_dis_entry, \
228 npc_mcam_ena_dis_entry_req, msg_rsp) \
229M(NPC_MCAM_SHIFT_ENTRY, 0x6005, npc_mcam_shift_entry, \
230 npc_mcam_shift_entry_req, \
231 npc_mcam_shift_entry_rsp) \
232M(NPC_MCAM_ALLOC_COUNTER, 0x6006, npc_mcam_alloc_counter, \
233 npc_mcam_alloc_counter_req, \
234 npc_mcam_alloc_counter_rsp) \
235M(NPC_MCAM_FREE_COUNTER, 0x6007, npc_mcam_free_counter, \
236 npc_mcam_oper_counter_req, \
237 msg_rsp) \
238M(NPC_MCAM_UNMAP_COUNTER, 0x6008, npc_mcam_unmap_counter, \
239 npc_mcam_unmap_counter_req, \
240 msg_rsp) \
241M(NPC_MCAM_CLEAR_COUNTER, 0x6009, npc_mcam_clear_counter, \
242 npc_mcam_oper_counter_req, \
243 msg_rsp) \
244M(NPC_MCAM_COUNTER_STATS, 0x600a, npc_mcam_counter_stats, \
245 npc_mcam_oper_counter_req, \
246 npc_mcam_oper_counter_rsp) \
247M(NPC_MCAM_ALLOC_AND_WRITE_ENTRY, 0x600b, npc_mcam_alloc_and_write_entry,\
248 npc_mcam_alloc_and_write_entry_req, \
249 npc_mcam_alloc_and_write_entry_rsp) \
250M(NPC_GET_KEX_CFG, 0x600c, npc_get_kex_cfg, msg_req, \
251 npc_get_kex_cfg_rsp) \
252M(NPC_INSTALL_FLOW, 0x600d, npc_install_flow, \
253 npc_install_flow_req, \
254 npc_install_flow_rsp) \
255M(NPC_DELETE_FLOW, 0x600e, npc_delete_flow, \
256 npc_delete_flow_req, msg_rsp) \
257M(NPC_MCAM_READ_ENTRY, 0x600f, npc_mcam_read_entry, \
258 npc_mcam_read_entry_req, \
259 npc_mcam_read_entry_rsp) \
260M(NPC_SET_PKIND, 0x6010, npc_set_pkind, \
261 npc_set_pkind, \
262 msg_rsp) \
263M(NPC_MCAM_READ_BASE_RULE, 0x6011, npc_read_base_steer_rule, msg_req, \
264 npc_mcam_read_base_rule_rsp) \
265 \
266M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc, nix_lf_alloc_req, \
267 nix_lf_alloc_rsp) \
268M(NIX_LF_FREE, 0x8001, nix_lf_free, nix_lf_free_req, msg_rsp) \
269M(NIX_AQ_ENQ, 0x8002, nix_aq_enq, nix_aq_enq_req, \
270 nix_aq_enq_rsp) \
271M(NIX_HWCTX_DISABLE, 0x8003, nix_hwctx_disable, hwctx_disable_req, \
272 msg_rsp) \
273M(NIX_TXSCH_ALLOC, 0x8004, nix_txsch_alloc, nix_txsch_alloc_req, \
274 nix_txsch_alloc_rsp) \
275M(NIX_TXSCH_FREE, 0x8005, nix_txsch_free, nix_txsch_free_req, \
276 msg_rsp) \
277M(NIX_TXSCHQ_CFG, 0x8006, nix_txschq_cfg, nix_txschq_config, \
278 nix_txschq_config) \
279M(NIX_STATS_RST, 0x8007, nix_stats_rst, msg_req, msg_rsp) \
280M(NIX_VTAG_CFG, 0x8008, nix_vtag_cfg, nix_vtag_config, msg_rsp) \
281M(NIX_RSS_FLOWKEY_CFG, 0x8009, nix_rss_flowkey_cfg, \
282 nix_rss_flowkey_cfg, \
283 nix_rss_flowkey_cfg_rsp) \
284M(NIX_SET_MAC_ADDR, 0x800a, nix_set_mac_addr, nix_set_mac_addr, \
285 msg_rsp) \
286M(NIX_SET_RX_MODE, 0x800b, nix_set_rx_mode, nix_rx_mode, msg_rsp) \
287M(NIX_SET_HW_FRS, 0x800c, nix_set_hw_frs, nix_frs_cfg, msg_rsp) \
288M(NIX_LF_START_RX, 0x800d, nix_lf_start_rx, msg_req, msg_rsp) \
289M(NIX_LF_STOP_RX, 0x800e, nix_lf_stop_rx, msg_req, msg_rsp) \
290M(NIX_MARK_FORMAT_CFG, 0x800f, nix_mark_format_cfg, \
291 nix_mark_format_cfg, \
292 nix_mark_format_cfg_rsp) \
293M(NIX_SET_RX_CFG, 0x8010, nix_set_rx_cfg, nix_rx_cfg, msg_rsp) \
294M(NIX_LSO_FORMAT_CFG, 0x8011, nix_lso_format_cfg, nix_lso_format_cfg, \
295 nix_lso_format_cfg_rsp) \
296M(NIX_LF_PTP_TX_ENABLE, 0x8013, nix_lf_ptp_tx_enable, msg_req, \
297 msg_rsp) \
298M(NIX_LF_PTP_TX_DISABLE, 0x8014, nix_lf_ptp_tx_disable, msg_req, \
299 msg_rsp) \
300M(NIX_SET_VLAN_TPID, 0x8015, nix_set_vlan_tpid, nix_set_vlan_tpid, \
301 msg_rsp) \
302M(NIX_BP_ENABLE, 0x8016, nix_bp_enable, nix_bp_cfg_req, \
303 nix_bp_cfg_rsp) \
304M(NIX_BP_DISABLE, 0x8017, nix_bp_disable, nix_bp_cfg_req, msg_rsp)\
305M(NIX_GET_MAC_ADDR, 0x8018, nix_get_mac_addr, msg_req, \
306 nix_get_mac_addr_rsp) \
307M(NIX_INLINE_IPSEC_CFG, 0x8019, nix_inline_ipsec_cfg, \
308 nix_inline_ipsec_cfg, msg_rsp) \
309M(NIX_INLINE_IPSEC_LF_CFG, \
310 0x801a, nix_inline_ipsec_lf_cfg, \
311 nix_inline_ipsec_lf_cfg, msg_rsp)
312
313
314#define MBOX_UP_CGX_MESSAGES \
315M(CGX_LINK_EVENT, 0xC00, cgx_link_event, cgx_link_info_msg, \
316 msg_rsp) \
317M(CGX_PTP_RX_INFO, 0xC01, cgx_ptp_rx_info, cgx_ptp_rx_info_msg, \
318 msg_rsp)
319
320enum {
321#define M(_name, _id, _1, _2, _3) MBOX_MSG_ ## _name = _id,
322MBOX_MESSAGES
323MBOX_UP_CGX_MESSAGES
324#undef M
325};
326
327
328
329#define RVU_DEFAULT_PF_FUNC 0xFFFF
330
331
332
333
334struct msg_req {
335 struct mbox_msghdr hdr;
336};
337
338
339
340
341struct msg_rsp {
342 struct mbox_msghdr hdr;
343};
344
345
346
347
348enum rvu_af_status {
349 RVU_INVALID_VF_ID = -256,
350};
351
352struct ready_msg_rsp {
353 struct mbox_msghdr hdr;
354 uint16_t __otx2_io sclk_feq;
355 uint16_t __otx2_io rclk_freq;
356};
357
358enum npc_pkind_type {
359 NPC_RX_VLAN_EXDSA_PKIND = 56ULL,
360 NPC_RX_CHLEN24B_PKIND,
361 NPC_RX_CPT_HDR_PKIND,
362 NPC_RX_CHLEN90B_PKIND,
363 NPC_TX_HIGIG_PKIND,
364 NPC_RX_HIGIG_PKIND,
365 NPC_RX_EXDSA_PKIND,
366 NPC_RX_EDSA_PKIND,
367 NPC_TX_DEF_PKIND,
368};
369
370#define OTX2_PRIV_FLAGS_CH_LEN_90B 254
371#define OTX2_PRIV_FLAGS_CH_LEN_24B 255
372
373
374struct npc_set_pkind {
375 struct mbox_msghdr hdr;
376#define OTX2_PRIV_FLAGS_DEFAULT BIT_ULL(0)
377#define OTX2_PRIV_FLAGS_EDSA BIT_ULL(1)
378#define OTX2_PRIV_FLAGS_HIGIG BIT_ULL(2)
379#define OTX2_PRIV_FLAGS_FDSA BIT_ULL(3)
380#define OTX2_PRIV_FLAGS_EXDSA BIT_ULL(4)
381#define OTX2_PRIV_FLAGS_VLAN_EXDSA BIT_ULL(5)
382#define OTX2_PRIV_FLAGS_CUSTOM BIT_ULL(63)
383 uint64_t __otx2_io mode;
384#define PKIND_TX BIT_ULL(0)
385#define PKIND_RX BIT_ULL(1)
386 uint8_t __otx2_io dir;
387 uint8_t __otx2_io pkind;
388};
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407struct rsrc_attach_req {
408 struct mbox_msghdr hdr;
409 uint8_t __otx2_io modify:1;
410 uint8_t __otx2_io npalf:1;
411 uint8_t __otx2_io nixlf:1;
412 uint16_t __otx2_io sso;
413 uint16_t __otx2_io ssow;
414 uint16_t __otx2_io timlfs;
415 uint16_t __otx2_io cptlfs;
416 uint16_t __otx2_io reelfs;
417
418 int __otx2_io cpt_blkaddr;
419
420 int __otx2_io ree_blkaddr;
421};
422
423
424
425
426
427
428struct rsrc_detach_req {
429 struct mbox_msghdr hdr;
430 uint8_t __otx2_io partial:1;
431 uint8_t __otx2_io npalf:1;
432 uint8_t __otx2_io nixlf:1;
433 uint8_t __otx2_io sso:1;
434 uint8_t __otx2_io ssow:1;
435 uint8_t __otx2_io timlfs:1;
436 uint8_t __otx2_io cptlfs:1;
437 uint8_t __otx2_io reelfs:1;
438};
439
440
441#define NIX_TXSCH_LVL_SMQ 0x0
442#define NIX_TXSCH_LVL_MDQ 0x0
443#define NIX_TXSCH_LVL_TL4 0x1
444#define NIX_TXSCH_LVL_TL3 0x2
445#define NIX_TXSCH_LVL_TL2 0x3
446#define NIX_TXSCH_LVL_TL1 0x4
447#define NIX_TXSCH_LVL_CNT 0x5
448
449
450
451
452
453struct free_rsrcs_rsp {
454 struct mbox_msghdr hdr;
455 uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT];
456 uint16_t __otx2_io sso;
457 uint16_t __otx2_io tim;
458 uint16_t __otx2_io ssow;
459 uint16_t __otx2_io cpt;
460 uint8_t __otx2_io npa;
461 uint8_t __otx2_io nix;
462 uint16_t __otx2_io schq_nix1[NIX_TXSCH_LVL_CNT];
463 uint8_t __otx2_io nix1;
464 uint8_t __otx2_io cpt1;
465 uint8_t __otx2_io ree0;
466 uint8_t __otx2_io ree1;
467};
468
469#define MSIX_VECTOR_INVALID 0xFFFF
470#define MAX_RVU_BLKLF_CNT 256
471
472struct msix_offset_rsp {
473 struct mbox_msghdr hdr;
474 uint16_t __otx2_io npa_msixoff;
475 uint16_t __otx2_io nix_msixoff;
476 uint16_t __otx2_io sso;
477 uint16_t __otx2_io ssow;
478 uint16_t __otx2_io timlfs;
479 uint16_t __otx2_io cptlfs;
480 uint16_t __otx2_io sso_msixoff[MAX_RVU_BLKLF_CNT];
481 uint16_t __otx2_io ssow_msixoff[MAX_RVU_BLKLF_CNT];
482 uint16_t __otx2_io timlf_msixoff[MAX_RVU_BLKLF_CNT];
483 uint16_t __otx2_io cptlf_msixoff[MAX_RVU_BLKLF_CNT];
484 uint16_t __otx2_io cpt1_lfs;
485 uint16_t __otx2_io ree0_lfs;
486 uint16_t __otx2_io ree1_lfs;
487 uint16_t __otx2_io cpt1_lf_msixoff[MAX_RVU_BLKLF_CNT];
488 uint16_t __otx2_io ree0_lf_msixoff[MAX_RVU_BLKLF_CNT];
489 uint16_t __otx2_io ree1_lf_msixoff[MAX_RVU_BLKLF_CNT];
490
491};
492
493
494
495struct cgx_stats_rsp {
496 struct mbox_msghdr hdr;
497#define CGX_RX_STATS_COUNT 13
498#define CGX_TX_STATS_COUNT 18
499 uint64_t __otx2_io rx_stats[CGX_RX_STATS_COUNT];
500 uint64_t __otx2_io tx_stats[CGX_TX_STATS_COUNT];
501};
502
503struct cgx_fec_stats_rsp {
504 struct mbox_msghdr hdr;
505 uint64_t __otx2_io fec_corr_blks;
506 uint64_t __otx2_io fec_uncorr_blks;
507};
508
509
510
511struct cgx_mac_addr_set_or_get {
512 struct mbox_msghdr hdr;
513 uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
514};
515
516
517
518
519struct cgx_mac_addr_add_req {
520 struct mbox_msghdr hdr;
521 uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
522};
523
524
525
526
527struct cgx_mac_addr_add_rsp {
528 struct mbox_msghdr hdr;
529 uint8_t __otx2_io index;
530};
531
532
533
534
535struct cgx_mac_addr_del_req {
536 struct mbox_msghdr hdr;
537 uint8_t __otx2_io index;
538};
539
540
541
542
543struct cgx_max_dmac_entries_get_rsp {
544 struct mbox_msghdr hdr;
545 uint8_t __otx2_io max_dmac_filters;
546};
547
548struct cgx_link_user_info {
549 uint64_t __otx2_io link_up:1;
550 uint64_t __otx2_io full_duplex:1;
551 uint64_t __otx2_io lmac_type_id:4;
552 uint64_t __otx2_io speed:20;
553 uint64_t __otx2_io an:1;
554 uint64_t __otx2_io fec:2;
555 uint64_t __otx2_io port:8;
556#define LMACTYPE_STR_LEN 16
557 char lmac_type[LMACTYPE_STR_LEN];
558};
559
560struct cgx_link_info_msg {
561 struct mbox_msghdr hdr;
562 struct cgx_link_user_info link_info;
563};
564
565struct cgx_ptp_rx_info_msg {
566 struct mbox_msghdr hdr;
567 uint8_t __otx2_io ptp_en;
568};
569
570struct cgx_pause_frm_cfg {
571 struct mbox_msghdr hdr;
572 uint8_t __otx2_io set;
573
574
575 uint8_t __otx2_io rx_pause;
576 uint8_t __otx2_io tx_pause;
577};
578
579struct sfp_eeprom_s {
580#define SFP_EEPROM_SIZE 256
581 uint16_t __otx2_io sff_id;
582 uint8_t __otx2_io buf[SFP_EEPROM_SIZE];
583 uint64_t __otx2_io reserved;
584};
585
586enum fec_type {
587 OTX2_FEC_NONE,
588 OTX2_FEC_BASER,
589 OTX2_FEC_RS,
590};
591
592struct phy_s {
593 uint64_t __otx2_io can_change_mod_type : 1;
594 uint64_t __otx2_io mod_type : 1;
595};
596
597struct cgx_lmac_fwdata_s {
598 uint16_t __otx2_io rw_valid;
599 uint64_t __otx2_io supported_fec;
600 uint64_t __otx2_io supported_an;
601 uint64_t __otx2_io supported_link_modes;
602
603 uint64_t __otx2_io advertised_fec;
604 uint64_t __otx2_io advertised_link_modes;
605
606 struct sfp_eeprom_s sfp_eeprom;
607 struct phy_s phy;
608#define LMAC_FWDATA_RESERVED_MEM 1023
609 uint64_t __otx2_io reserved[LMAC_FWDATA_RESERVED_MEM];
610};
611
612struct cgx_fw_data {
613 struct mbox_msghdr hdr;
614 struct cgx_lmac_fwdata_s fwdata;
615};
616
617struct fec_mode {
618 struct mbox_msghdr hdr;
619 int __otx2_io fec;
620};
621
622struct cgx_set_link_state_msg {
623 struct mbox_msghdr hdr;
624 uint8_t __otx2_io enable;
625};
626
627struct cgx_phy_mod_type {
628 struct mbox_msghdr hdr;
629 int __otx2_io mod;
630};
631
632struct cgx_set_link_mode_args {
633 uint32_t __otx2_io speed;
634 uint8_t __otx2_io duplex;
635 uint8_t __otx2_io an;
636 uint8_t __otx2_io ports;
637 uint64_t __otx2_io mode;
638};
639
640struct cgx_set_link_mode_req {
641 struct mbox_msghdr hdr;
642 struct cgx_set_link_mode_args args;
643};
644
645struct cgx_set_link_mode_rsp {
646 struct mbox_msghdr hdr;
647 int __otx2_io status;
648};
649
650
651
652
653
654enum npa_af_status {
655 NPA_AF_ERR_PARAM = -301,
656 NPA_AF_ERR_AQ_FULL = -302,
657 NPA_AF_ERR_AQ_ENQUEUE = -303,
658 NPA_AF_ERR_AF_LF_INVALID = -304,
659 NPA_AF_ERR_AF_LF_ALLOC = -305,
660 NPA_AF_ERR_LF_RESET = -306,
661};
662
663#define NPA_AURA_SZ_0 0
664#define NPA_AURA_SZ_128 1
665#define NPA_AURA_SZ_256 2
666#define NPA_AURA_SZ_512 3
667#define NPA_AURA_SZ_1K 4
668#define NPA_AURA_SZ_2K 5
669#define NPA_AURA_SZ_4K 6
670#define NPA_AURA_SZ_8K 7
671#define NPA_AURA_SZ_16K 8
672#define NPA_AURA_SZ_32K 9
673#define NPA_AURA_SZ_64K 10
674#define NPA_AURA_SZ_128K 11
675#define NPA_AURA_SZ_256K 12
676#define NPA_AURA_SZ_512K 13
677#define NPA_AURA_SZ_1M 14
678#define NPA_AURA_SZ_MAX 15
679
680
681struct npa_lf_alloc_req {
682 struct mbox_msghdr hdr;
683 int __otx2_io node;
684 int __otx2_io aura_sz;
685 uint32_t __otx2_io nr_pools;
686 uint64_t __otx2_io way_mask;
687};
688
689struct npa_lf_alloc_rsp {
690 struct mbox_msghdr hdr;
691 uint32_t __otx2_io stack_pg_ptrs;
692 uint32_t __otx2_io stack_pg_bytes;
693 uint16_t __otx2_io qints;
694};
695
696
697struct npa_aq_enq_req {
698 struct mbox_msghdr hdr;
699 uint32_t __otx2_io aura_id;
700 uint8_t __otx2_io ctype;
701 uint8_t __otx2_io op;
702 union {
703
704
705
706
707 __otx2_io struct npa_aura_s aura;
708
709 __otx2_io struct npa_pool_s pool;
710 };
711
712 union {
713
714 __otx2_io struct npa_aura_s aura_mask;
715
716 __otx2_io struct npa_pool_s pool_mask;
717 };
718};
719
720struct npa_aq_enq_rsp {
721 struct mbox_msghdr hdr;
722 union {
723
724 __otx2_io struct npa_aura_s aura;
725
726 __otx2_io struct npa_pool_s pool;
727 };
728};
729
730
731struct hwctx_disable_req {
732 struct mbox_msghdr hdr;
733 uint8_t __otx2_io ctype;
734};
735
736
737
738
739
740
741enum nix_af_status {
742 NIX_AF_ERR_PARAM = -401,
743 NIX_AF_ERR_AQ_FULL = -402,
744 NIX_AF_ERR_AQ_ENQUEUE = -403,
745 NIX_AF_ERR_AF_LF_INVALID = -404,
746 NIX_AF_ERR_AF_LF_ALLOC = -405,
747 NIX_AF_ERR_TLX_ALLOC_FAIL = -406,
748 NIX_AF_ERR_TLX_INVALID = -407,
749 NIX_AF_ERR_RSS_SIZE_INVALID = -408,
750 NIX_AF_ERR_RSS_GRPS_INVALID = -409,
751 NIX_AF_ERR_FRS_INVALID = -410,
752 NIX_AF_ERR_RX_LINK_INVALID = -411,
753 NIX_AF_INVAL_TXSCHQ_CFG = -412,
754 NIX_AF_SMQ_FLUSH_FAILED = -413,
755 NIX_AF_ERR_LF_RESET = -414,
756 NIX_AF_ERR_RSS_NOSPC_FIELD = -415,
757 NIX_AF_ERR_RSS_NOSPC_ALGO = -416,
758 NIX_AF_ERR_MARK_CFG_FAIL = -417,
759 NIX_AF_ERR_LSO_CFG_FAIL = -418,
760 NIX_AF_INVAL_NPA_PF_FUNC = -419,
761 NIX_AF_INVAL_SSO_PF_FUNC = -420,
762 NIX_AF_ERR_TX_VTAG_NOSPC = -421,
763 NIX_AF_ERR_RX_VTAG_INUSE = -422,
764 NIX_AF_ERR_PTP_CONFIG_FAIL = -423,
765};
766
767
768struct nix_lf_alloc_req {
769 struct mbox_msghdr hdr;
770 int __otx2_io node;
771 uint32_t __otx2_io rq_cnt;
772 uint32_t __otx2_io sq_cnt;
773 uint32_t __otx2_io cq_cnt;
774 uint8_t __otx2_io xqe_sz;
775 uint16_t __otx2_io rss_sz;
776 uint8_t __otx2_io rss_grps;
777 uint16_t __otx2_io npa_func;
778
779 uint16_t __otx2_io sso_func;
780 uint64_t __otx2_io rx_cfg;
781 uint64_t __otx2_io way_mask;
782#define NIX_LF_RSS_TAG_LSB_AS_ADDER BIT_ULL(0)
783 uint64_t flags;
784};
785
786struct nix_lf_alloc_rsp {
787 struct mbox_msghdr hdr;
788 uint16_t __otx2_io sqb_size;
789 uint16_t __otx2_io rx_chan_base;
790 uint16_t __otx2_io tx_chan_base;
791 uint8_t __otx2_io rx_chan_cnt;
792 uint8_t __otx2_io tx_chan_cnt;
793 uint8_t __otx2_io lso_tsov4_idx;
794 uint8_t __otx2_io lso_tsov6_idx;
795 uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
796 uint8_t __otx2_io lf_rx_stats;
797 uint8_t __otx2_io lf_tx_stats;
798 uint16_t __otx2_io cints;
799 uint16_t __otx2_io qints;
800 uint8_t __otx2_io hw_rx_tstamp_en;
801 uint8_t __otx2_io cgx_links;
802 uint8_t __otx2_io lbk_links;
803 uint8_t __otx2_io sdp_links;
804 uint8_t __otx2_io tx_link;
805};
806
807struct nix_lf_free_req {
808 struct mbox_msghdr hdr;
809#define NIX_LF_DISABLE_FLOWS BIT_ULL(0)
810#define NIX_LF_DONT_FREE_TX_VTAG BIT_ULL(1)
811 uint64_t __otx2_io flags;
812};
813
814
815struct nix_aq_enq_req {
816 struct mbox_msghdr hdr;
817 uint32_t __otx2_io qidx;
818 uint8_t __otx2_io ctype;
819 uint8_t __otx2_io op;
820 union {
821
822 __otx2_io struct nix_rq_ctx_s rq;
823
824 __otx2_io struct nix_sq_ctx_s sq;
825
826 __otx2_io struct nix_cq_ctx_s cq;
827
828 __otx2_io struct nix_rsse_s rss;
829
830 __otx2_io struct nix_rx_mce_s mce;
831 };
832
833 union {
834
835 __otx2_io struct nix_rq_ctx_s rq_mask;
836
837 __otx2_io struct nix_sq_ctx_s sq_mask;
838
839 __otx2_io struct nix_cq_ctx_s cq_mask;
840
841 __otx2_io struct nix_rsse_s rss_mask;
842
843 __otx2_io struct nix_rx_mce_s mce_mask;
844 };
845};
846
847struct nix_aq_enq_rsp {
848 struct mbox_msghdr hdr;
849 union {
850 __otx2_io struct nix_rq_ctx_s rq;
851 __otx2_io struct nix_sq_ctx_s sq;
852 __otx2_io struct nix_cq_ctx_s cq;
853 __otx2_io struct nix_rsse_s rss;
854 __otx2_io struct nix_rx_mce_s mce;
855 };
856};
857
858
859
860#define MAX_TXSCHQ_PER_FUNC 128
861
862struct nix_txsch_alloc_req {
863 struct mbox_msghdr hdr;
864
865 uint16_t __otx2_io schq_contig[NIX_TXSCH_LVL_CNT];
866 uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT];
867};
868
869struct nix_txsch_alloc_rsp {
870 struct mbox_msghdr hdr;
871
872 uint16_t __otx2_io schq_contig[NIX_TXSCH_LVL_CNT];
873 uint16_t __otx2_io schq[NIX_TXSCH_LVL_CNT];
874
875 uint16_t __otx2_io
876 schq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
877 uint16_t __otx2_io schq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
878
879 uint8_t __otx2_io aggr_level;
880
881 uint8_t __otx2_io aggr_lvl_rr_prio;
882
883 uint8_t __otx2_io link_cfg_lvl;
884};
885
886struct nix_txsch_free_req {
887 struct mbox_msghdr hdr;
888#define TXSCHQ_FREE_ALL BIT_ULL(0)
889 uint16_t __otx2_io flags;
890
891 uint16_t __otx2_io schq_lvl;
892
893 uint16_t __otx2_io schq;
894};
895
896struct nix_txschq_config {
897 struct mbox_msghdr hdr;
898 uint8_t __otx2_io lvl;
899 uint8_t __otx2_io read;
900#define TXSCHQ_IDX_SHIFT 16
901#define TXSCHQ_IDX_MASK (BIT_ULL(10) - 1)
902#define TXSCHQ_IDX(reg, shift) (((reg) >> (shift)) & TXSCHQ_IDX_MASK)
903 uint8_t __otx2_io num_regs;
904#define MAX_REGS_PER_MBOX_MSG 20
905 uint64_t __otx2_io reg[MAX_REGS_PER_MBOX_MSG];
906 uint64_t __otx2_io regval[MAX_REGS_PER_MBOX_MSG];
907
908 uint64_t __otx2_io regval_mask[MAX_REGS_PER_MBOX_MSG];
909};
910
911struct nix_vtag_config {
912 struct mbox_msghdr hdr;
913
914 uint8_t __otx2_io vtag_size;
915
916
917
918 uint8_t __otx2_io cfg_type;
919 union {
920
921 struct {
922 uint64_t __otx2_io vtag0;
923 uint64_t __otx2_io vtag1;
924
925
926
927
928
929 uint8_t __otx2_io cfg_vtag0 :1;
930
931 uint8_t __otx2_io cfg_vtag1 :1;
932
933
934
935
936
937
938
939
940
941
942 int __otx2_io vtag0_idx;
943 int __otx2_io vtag1_idx;
944
945
946
947
948
949
950
951 uint8_t __otx2_io free_vtag0 :1;
952
953
954
955 uint8_t __otx2_io free_vtag1 :1;
956 } tx;
957
958
959 struct {
960
961 uint8_t __otx2_io vtag_type;
962
963 uint8_t __otx2_io strip_vtag :1;
964
965 uint8_t __otx2_io capture_vtag :1;
966 } rx;
967 };
968};
969
970struct nix_vtag_config_rsp {
971 struct mbox_msghdr hdr;
972
973
974
975
976
977 int __otx2_io vtag0_idx;
978 int __otx2_io vtag1_idx;
979};
980
981struct nix_rss_flowkey_cfg {
982 struct mbox_msghdr hdr;
983 int __otx2_io mcam_index;
984 uint32_t __otx2_io flowkey_cfg;
985#define FLOW_KEY_TYPE_PORT BIT(0)
986#define FLOW_KEY_TYPE_IPV4 BIT(1)
987#define FLOW_KEY_TYPE_IPV6 BIT(2)
988#define FLOW_KEY_TYPE_TCP BIT(3)
989#define FLOW_KEY_TYPE_UDP BIT(4)
990#define FLOW_KEY_TYPE_SCTP BIT(5)
991#define FLOW_KEY_TYPE_NVGRE BIT(6)
992#define FLOW_KEY_TYPE_VXLAN BIT(7)
993#define FLOW_KEY_TYPE_GENEVE BIT(8)
994#define FLOW_KEY_TYPE_ETH_DMAC BIT(9)
995#define FLOW_KEY_TYPE_IPV6_EXT BIT(10)
996#define FLOW_KEY_TYPE_GTPU BIT(11)
997#define FLOW_KEY_TYPE_INNR_IPV4 BIT(12)
998#define FLOW_KEY_TYPE_INNR_IPV6 BIT(13)
999#define FLOW_KEY_TYPE_INNR_TCP BIT(14)
1000#define FLOW_KEY_TYPE_INNR_UDP BIT(15)
1001#define FLOW_KEY_TYPE_INNR_SCTP BIT(16)
1002#define FLOW_KEY_TYPE_INNR_ETH_DMAC BIT(17)
1003#define FLOW_KEY_TYPE_CH_LEN_90B BIT(18)
1004#define FLOW_KEY_TYPE_CUSTOM0 BIT(19)
1005#define FLOW_KEY_TYPE_VLAN BIT(20)
1006#define FLOW_KEY_TYPE_L4_DST BIT(28)
1007#define FLOW_KEY_TYPE_L4_SRC BIT(29)
1008#define FLOW_KEY_TYPE_L3_DST BIT(30)
1009#define FLOW_KEY_TYPE_L3_SRC BIT(31)
1010 uint8_t __otx2_io group;
1011};
1012
1013struct nix_rss_flowkey_cfg_rsp {
1014 struct mbox_msghdr hdr;
1015 uint8_t __otx2_io alg_idx;
1016};
1017
1018struct nix_set_mac_addr {
1019 struct mbox_msghdr hdr;
1020 uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
1021};
1022
1023struct nix_get_mac_addr_rsp {
1024 struct mbox_msghdr hdr;
1025 uint8_t __otx2_io mac_addr[RTE_ETHER_ADDR_LEN];
1026};
1027
1028struct nix_mark_format_cfg {
1029 struct mbox_msghdr hdr;
1030 uint8_t __otx2_io offset;
1031 uint8_t __otx2_io y_mask;
1032 uint8_t __otx2_io y_val;
1033 uint8_t __otx2_io r_mask;
1034 uint8_t __otx2_io r_val;
1035};
1036
1037struct nix_mark_format_cfg_rsp {
1038 struct mbox_msghdr hdr;
1039 uint8_t __otx2_io mark_format_idx;
1040};
1041
1042struct nix_lso_format_cfg {
1043 struct mbox_msghdr hdr;
1044 uint64_t __otx2_io field_mask;
1045 uint64_t __otx2_io fields[NIX_LSO_FIELD_MAX];
1046};
1047
1048struct nix_lso_format_cfg_rsp {
1049 struct mbox_msghdr hdr;
1050 uint8_t __otx2_io lso_format_idx;
1051};
1052
1053struct nix_rx_mode {
1054 struct mbox_msghdr hdr;
1055#define NIX_RX_MODE_UCAST BIT(0)
1056#define NIX_RX_MODE_PROMISC BIT(1)
1057#define NIX_RX_MODE_ALLMULTI BIT(2)
1058 uint16_t __otx2_io mode;
1059};
1060
1061struct nix_rx_cfg {
1062 struct mbox_msghdr hdr;
1063#define NIX_RX_OL3_VERIFY BIT(0)
1064#define NIX_RX_OL4_VERIFY BIT(1)
1065 uint8_t __otx2_io len_verify;
1066#define NIX_RX_CSUM_OL4_VERIFY BIT(0)
1067 uint8_t __otx2_io csum_verify;
1068};
1069
1070struct nix_frs_cfg {
1071 struct mbox_msghdr hdr;
1072 uint8_t __otx2_io update_smq;
1073 uint8_t __otx2_io update_minlen;
1074 uint8_t __otx2_io sdp_link;
1075 uint16_t __otx2_io maxlen;
1076 uint16_t __otx2_io minlen;
1077};
1078
1079struct nix_set_vlan_tpid {
1080 struct mbox_msghdr hdr;
1081#define NIX_VLAN_TYPE_INNER 0
1082#define NIX_VLAN_TYPE_OUTER 1
1083 uint8_t __otx2_io vlan_type;
1084 uint16_t __otx2_io tpid;
1085};
1086
1087struct nix_bp_cfg_req {
1088 struct mbox_msghdr hdr;
1089 uint16_t __otx2_io chan_base;
1090 uint8_t __otx2_io chan_cnt;
1091 uint8_t __otx2_io bpid_per_chan;
1092
1093
1094};
1095
1096
1097
1098
1099#define NIX_MAX_CHAN 64
1100struct nix_bp_cfg_rsp {
1101 struct mbox_msghdr hdr;
1102
1103 uint16_t __otx2_io chan_bpid[NIX_MAX_CHAN];
1104
1105 uint8_t __otx2_io chan_cnt;
1106};
1107
1108
1109struct nix_inline_ipsec_cfg {
1110 struct mbox_msghdr hdr;
1111 uint32_t __otx2_io cpt_credit;
1112 struct {
1113 uint8_t __otx2_io egrp;
1114 uint8_t __otx2_io opcode;
1115 } gen_cfg;
1116 struct {
1117 uint16_t __otx2_io cpt_pf_func;
1118 uint8_t __otx2_io cpt_slot;
1119 } inst_qsel;
1120 uint8_t __otx2_io enable;
1121};
1122
1123
1124struct nix_inline_ipsec_lf_cfg {
1125 struct mbox_msghdr hdr;
1126 uint64_t __otx2_io sa_base_addr;
1127 struct {
1128 uint32_t __otx2_io tag_const;
1129 uint16_t __otx2_io lenm1_max;
1130 uint8_t __otx2_io sa_pow2_size;
1131 uint8_t __otx2_io tt;
1132 } ipsec_cfg0;
1133 struct {
1134 uint32_t __otx2_io sa_idx_max;
1135 uint8_t __otx2_io sa_idx_w;
1136 } ipsec_cfg1;
1137 uint8_t __otx2_io enable;
1138};
1139
1140
1141
1142
1143enum sso_af_status {
1144 SSO_AF_ERR_PARAM = -501,
1145 SSO_AF_ERR_LF_INVALID = -502,
1146 SSO_AF_ERR_AF_LF_ALLOC = -503,
1147 SSO_AF_ERR_GRP_EBUSY = -504,
1148 SSO_AF_INVAL_NPA_PF_FUNC = -505,
1149};
1150
1151struct sso_lf_alloc_req {
1152 struct mbox_msghdr hdr;
1153 int __otx2_io node;
1154 uint16_t __otx2_io hwgrps;
1155};
1156
1157struct sso_lf_alloc_rsp {
1158 struct mbox_msghdr hdr;
1159 uint32_t __otx2_io xaq_buf_size;
1160 uint32_t __otx2_io xaq_wq_entries;
1161 uint32_t __otx2_io in_unit_entries;
1162 uint16_t __otx2_io hwgrps;
1163};
1164
1165struct sso_lf_free_req {
1166 struct mbox_msghdr hdr;
1167 int __otx2_io node;
1168 uint16_t __otx2_io hwgrps;
1169};
1170
1171
1172
1173
1174enum ssow_af_status {
1175 SSOW_AF_ERR_PARAM = -601,
1176 SSOW_AF_ERR_LF_INVALID = -602,
1177 SSOW_AF_ERR_AF_LF_ALLOC = -603,
1178};
1179
1180struct ssow_lf_alloc_req {
1181 struct mbox_msghdr hdr;
1182 int __otx2_io node;
1183 uint16_t __otx2_io hws;
1184};
1185
1186struct ssow_lf_free_req {
1187 struct mbox_msghdr hdr;
1188 int __otx2_io node;
1189 uint16_t __otx2_io hws;
1190};
1191
1192struct sso_hw_setconfig {
1193 struct mbox_msghdr hdr;
1194 uint32_t __otx2_io npa_aura_id;
1195 uint16_t __otx2_io npa_pf_func;
1196 uint16_t __otx2_io hwgrps;
1197};
1198
1199struct sso_release_xaq {
1200 struct mbox_msghdr hdr;
1201 uint16_t __otx2_io hwgrps;
1202};
1203
1204struct sso_info_req {
1205 struct mbox_msghdr hdr;
1206 union {
1207 uint16_t __otx2_io grp;
1208 uint16_t __otx2_io hws;
1209 };
1210};
1211
1212struct sso_grp_priority {
1213 struct mbox_msghdr hdr;
1214 uint16_t __otx2_io grp;
1215 uint8_t __otx2_io priority;
1216 uint8_t __otx2_io affinity;
1217 uint8_t __otx2_io weight;
1218};
1219
1220struct sso_grp_qos_cfg {
1221 struct mbox_msghdr hdr;
1222 uint16_t __otx2_io grp;
1223 uint32_t __otx2_io xaq_limit;
1224 uint16_t __otx2_io taq_thr;
1225 uint16_t __otx2_io iaq_thr;
1226};
1227
1228struct sso_grp_stats {
1229 struct mbox_msghdr hdr;
1230 uint16_t __otx2_io grp;
1231 uint64_t __otx2_io ws_pc;
1232 uint64_t __otx2_io ext_pc;
1233 uint64_t __otx2_io wa_pc;
1234 uint64_t __otx2_io ts_pc;
1235 uint64_t __otx2_io ds_pc;
1236 uint64_t __otx2_io dq_pc;
1237 uint64_t __otx2_io aw_status;
1238 uint64_t __otx2_io page_cnt;
1239};
1240
1241struct sso_hws_stats {
1242 struct mbox_msghdr hdr;
1243 uint16_t __otx2_io hws;
1244 uint64_t __otx2_io arbitration;
1245};
1246
1247
1248
1249
1250enum cpt_af_status {
1251 CPT_AF_ERR_PARAM = -901,
1252 CPT_AF_ERR_GRP_INVALID = -902,
1253 CPT_AF_ERR_LF_INVALID = -903,
1254 CPT_AF_ERR_ACCESS_DENIED = -904,
1255 CPT_AF_ERR_SSO_PF_FUNC_INVALID = -905,
1256 CPT_AF_ERR_NIX_PF_FUNC_INVALID = -906,
1257 CPT_AF_ERR_INLINE_IPSEC_INB_ENA = -907,
1258 CPT_AF_ERR_INLINE_IPSEC_OUT_ENA = -908
1259};
1260
1261
1262
1263struct cpt_rd_wr_reg_msg {
1264 struct mbox_msghdr hdr;
1265 uint64_t __otx2_io reg_offset;
1266 uint64_t __otx2_io *ret_val;
1267 uint64_t __otx2_io val;
1268 uint8_t __otx2_io is_write;
1269
1270 uint8_t __otx2_io blkaddr;
1271};
1272
1273struct cpt_set_crypto_grp_req_msg {
1274 struct mbox_msghdr hdr;
1275 uint8_t __otx2_io crypto_eng_grp;
1276};
1277
1278struct cpt_lf_alloc_req_msg {
1279 struct mbox_msghdr hdr;
1280 uint16_t __otx2_io nix_pf_func;
1281 uint16_t __otx2_io sso_pf_func;
1282 uint16_t __otx2_io eng_grpmask;
1283
1284 uint8_t __otx2_io blkaddr;
1285};
1286
1287struct cpt_lf_alloc_rsp_msg {
1288 struct mbox_msghdr hdr;
1289 uint16_t __otx2_io eng_grpmsk;
1290};
1291
1292#define CPT_INLINE_INBOUND 0
1293#define CPT_INLINE_OUTBOUND 1
1294
1295struct cpt_inline_ipsec_cfg_msg {
1296 struct mbox_msghdr hdr;
1297 uint8_t __otx2_io enable;
1298 uint8_t __otx2_io slot;
1299 uint8_t __otx2_io dir;
1300 uint16_t __otx2_io sso_pf_func;
1301 uint16_t __otx2_io nix_pf_func;
1302};
1303
1304struct cpt_rx_inline_lf_cfg_msg {
1305 struct mbox_msghdr hdr;
1306 uint16_t __otx2_io sso_pf_func;
1307};
1308
1309enum cpt_eng_type {
1310 CPT_ENG_TYPE_AE = 1,
1311 CPT_ENG_TYPE_SE = 2,
1312 CPT_ENG_TYPE_IE = 3,
1313 CPT_MAX_ENG_TYPES,
1314};
1315
1316
1317union cpt_eng_caps {
1318 uint64_t __otx2_io u;
1319 struct {
1320 uint64_t __otx2_io reserved_0_4:5;
1321 uint64_t __otx2_io mul:1;
1322 uint64_t __otx2_io sha1_sha2:1;
1323 uint64_t __otx2_io chacha20:1;
1324 uint64_t __otx2_io zuc_snow3g:1;
1325 uint64_t __otx2_io sha3:1;
1326 uint64_t __otx2_io aes:1;
1327 uint64_t __otx2_io kasumi:1;
1328 uint64_t __otx2_io des:1;
1329 uint64_t __otx2_io crc:1;
1330 uint64_t __otx2_io reserved_14_63:50;
1331 };
1332};
1333
1334struct cpt_caps_rsp_msg {
1335 struct mbox_msghdr hdr;
1336 uint16_t __otx2_io cpt_pf_drv_version;
1337 uint8_t __otx2_io cpt_revision;
1338 union cpt_eng_caps eng_caps[CPT_MAX_ENG_TYPES];
1339};
1340
1341
1342
1343#define NPC_MCAM_ENTRY_INVALID 0xFFFF
1344#define NPC_MCAM_INVALID_MAP 0xFFFF
1345
1346
1347
1348
1349enum npc_af_status {
1350 NPC_MCAM_INVALID_REQ = -701,
1351 NPC_MCAM_ALLOC_DENIED = -702,
1352 NPC_MCAM_ALLOC_FAILED = -703,
1353 NPC_MCAM_PERM_DENIED = -704,
1354 NPC_AF_ERR_HIGIG_CONFIG_FAIL = -705,
1355};
1356
1357struct npc_mcam_alloc_entry_req {
1358 struct mbox_msghdr hdr;
1359#define NPC_MAX_NONCONTIG_ENTRIES 256
1360 uint8_t __otx2_io contig;
1361#define NPC_MCAM_ANY_PRIO 0
1362#define NPC_MCAM_LOWER_PRIO 1
1363#define NPC_MCAM_HIGHER_PRIO 2
1364 uint8_t __otx2_io priority;
1365 uint16_t __otx2_io ref_entry;
1366 uint16_t __otx2_io count;
1367};
1368
1369struct npc_mcam_alloc_entry_rsp {
1370 struct mbox_msghdr hdr;
1371
1372
1373
1374 uint16_t __otx2_io entry;
1375 uint16_t __otx2_io count;
1376 uint16_t __otx2_io free_count;
1377 uint16_t __otx2_io entry_list[NPC_MAX_NONCONTIG_ENTRIES];
1378};
1379
1380struct npc_mcam_free_entry_req {
1381 struct mbox_msghdr hdr;
1382 uint16_t __otx2_io entry;
1383 uint8_t __otx2_io all;
1384};
1385
1386struct mcam_entry {
1387#define NPC_MAX_KWS_IN_KEY 7
1388 uint64_t __otx2_io kw[NPC_MAX_KWS_IN_KEY];
1389 uint64_t __otx2_io kw_mask[NPC_MAX_KWS_IN_KEY];
1390 uint64_t __otx2_io action;
1391 uint64_t __otx2_io vtag_action;
1392};
1393
1394struct npc_mcam_write_entry_req {
1395 struct mbox_msghdr hdr;
1396 struct mcam_entry entry_data;
1397 uint16_t __otx2_io entry;
1398 uint16_t __otx2_io cntr;
1399 uint8_t __otx2_io intf;
1400 uint8_t __otx2_io enable_entry;
1401 uint8_t __otx2_io set_cntr;
1402};
1403
1404
1405struct npc_mcam_ena_dis_entry_req {
1406 struct mbox_msghdr hdr;
1407 uint16_t __otx2_io entry;
1408};
1409
1410struct npc_mcam_shift_entry_req {
1411 struct mbox_msghdr hdr;
1412#define NPC_MCAM_MAX_SHIFTS 64
1413 uint16_t __otx2_io curr_entry[NPC_MCAM_MAX_SHIFTS];
1414 uint16_t __otx2_io new_entry[NPC_MCAM_MAX_SHIFTS];
1415 uint16_t __otx2_io shift_count;
1416};
1417
1418struct npc_mcam_shift_entry_rsp {
1419 struct mbox_msghdr hdr;
1420
1421 uint16_t __otx2_io failed_entry_idx;
1422};
1423
1424struct npc_mcam_alloc_counter_req {
1425 struct mbox_msghdr hdr;
1426 uint8_t __otx2_io contig;
1427#define NPC_MAX_NONCONTIG_COUNTERS 64
1428 uint16_t __otx2_io count;
1429};
1430
1431struct npc_mcam_alloc_counter_rsp {
1432 struct mbox_msghdr hdr;
1433
1434
1435
1436 uint16_t __otx2_io cntr;
1437 uint16_t __otx2_io count;
1438 uint16_t __otx2_io cntr_list[NPC_MAX_NONCONTIG_COUNTERS];
1439};
1440
1441struct npc_mcam_oper_counter_req {
1442 struct mbox_msghdr hdr;
1443 uint16_t __otx2_io cntr;
1444};
1445
1446struct npc_mcam_oper_counter_rsp {
1447 struct mbox_msghdr hdr;
1448
1449 uint64_t __otx2_io stat;
1450};
1451
1452struct npc_mcam_unmap_counter_req {
1453 struct mbox_msghdr hdr;
1454 uint16_t __otx2_io cntr;
1455 uint16_t __otx2_io entry;
1456 uint8_t __otx2_io all;
1457};
1458
1459struct npc_mcam_alloc_and_write_entry_req {
1460 struct mbox_msghdr hdr;
1461 struct mcam_entry entry_data;
1462 uint16_t __otx2_io ref_entry;
1463 uint8_t __otx2_io priority;
1464 uint8_t __otx2_io intf;
1465 uint8_t __otx2_io enable_entry;
1466 uint8_t __otx2_io alloc_cntr;
1467};
1468
1469struct npc_mcam_alloc_and_write_entry_rsp {
1470 struct mbox_msghdr hdr;
1471 uint16_t __otx2_io entry;
1472 uint16_t __otx2_io cntr;
1473};
1474
1475struct npc_get_kex_cfg_rsp {
1476 struct mbox_msghdr hdr;
1477 uint64_t __otx2_io rx_keyx_cfg;
1478 uint64_t __otx2_io tx_keyx_cfg;
1479#define NPC_MAX_INTF 2
1480#define NPC_MAX_LID 8
1481#define NPC_MAX_LT 16
1482#define NPC_MAX_LD 2
1483#define NPC_MAX_LFL 16
1484
1485 uint64_t __otx2_io kex_ld_flags[NPC_MAX_LD];
1486
1487 uint64_t __otx2_io
1488 intf_lid_lt_ld[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];
1489
1490 uint64_t __otx2_io
1491 intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
1492#define MKEX_NAME_LEN 128
1493 uint8_t __otx2_io mkex_pfl_name[MKEX_NAME_LEN];
1494};
1495
1496enum header_fields {
1497 NPC_DMAC,
1498 NPC_SMAC,
1499 NPC_ETYPE,
1500 NPC_OUTER_VID,
1501 NPC_TOS,
1502 NPC_SIP_IPV4,
1503 NPC_DIP_IPV4,
1504 NPC_SIP_IPV6,
1505 NPC_DIP_IPV6,
1506 NPC_SPORT_TCP,
1507 NPC_DPORT_TCP,
1508 NPC_SPORT_UDP,
1509 NPC_DPORT_UDP,
1510 NPC_FDSA_VAL,
1511 NPC_HEADER_FIELDS_MAX,
1512};
1513
1514struct flow_msg {
1515 unsigned char __otx2_io dmac[6];
1516 unsigned char __otx2_io smac[6];
1517 uint16_t __otx2_io etype;
1518 uint16_t __otx2_io vlan_etype;
1519 uint16_t __otx2_io vlan_tci;
1520 union {
1521 uint32_t __otx2_io ip4src;
1522 uint32_t __otx2_io ip6src[4];
1523 };
1524 union {
1525 uint32_t __otx2_io ip4dst;
1526 uint32_t __otx2_io ip6dst[4];
1527 };
1528 uint8_t __otx2_io tos;
1529 uint8_t __otx2_io ip_ver;
1530 uint8_t __otx2_io ip_proto;
1531 uint8_t __otx2_io tc;
1532 uint16_t __otx2_io sport;
1533 uint16_t __otx2_io dport;
1534};
1535
1536struct npc_install_flow_req {
1537 struct mbox_msghdr hdr;
1538 struct flow_msg packet;
1539 struct flow_msg mask;
1540 uint64_t __otx2_io features;
1541 uint16_t __otx2_io entry;
1542 uint16_t __otx2_io channel;
1543 uint8_t __otx2_io intf;
1544 uint8_t __otx2_io set_cntr;
1545 uint8_t __otx2_io default_rule;
1546
1547 uint8_t __otx2_io append;
1548 uint16_t __otx2_io vf;
1549
1550 uint32_t __otx2_io index;
1551 uint16_t __otx2_io match_id;
1552 uint8_t __otx2_io flow_key_alg;
1553 uint8_t __otx2_io op;
1554
1555 uint8_t __otx2_io vtag0_type;
1556 uint8_t __otx2_io vtag0_valid;
1557 uint8_t __otx2_io vtag1_type;
1558 uint8_t __otx2_io vtag1_valid;
1559
1560
1561 uint16_t __otx2_io vtag0_def;
1562 uint8_t __otx2_io vtag0_op;
1563 uint16_t __otx2_io vtag1_def;
1564 uint8_t __otx2_io vtag1_op;
1565};
1566
1567struct npc_install_flow_rsp {
1568 struct mbox_msghdr hdr;
1569
1570 int __otx2_io counter;
1571};
1572
1573struct npc_delete_flow_req {
1574 struct mbox_msghdr hdr;
1575 uint16_t __otx2_io entry;
1576 uint16_t __otx2_io start;
1577 uint16_t __otx2_io end;
1578 uint8_t __otx2_io all;
1579};
1580
1581struct npc_mcam_read_entry_req {
1582 struct mbox_msghdr hdr;
1583
1584 uint16_t __otx2_io entry;
1585};
1586
1587struct npc_mcam_read_entry_rsp {
1588 struct mbox_msghdr hdr;
1589 struct mcam_entry entry_data;
1590 uint8_t __otx2_io intf;
1591 uint8_t __otx2_io enable;
1592};
1593
1594struct npc_mcam_read_base_rule_rsp {
1595 struct mbox_msghdr hdr;
1596 struct mcam_entry entry_data;
1597};
1598
1599
1600
1601
1602enum tim_af_status {
1603 TIM_AF_NO_RINGS_LEFT = -801,
1604 TIM_AF_INVALID_NPA_PF_FUNC = -802,
1605 TIM_AF_INVALID_SSO_PF_FUNC = -803,
1606 TIM_AF_RING_STILL_RUNNING = -804,
1607 TIM_AF_LF_INVALID = -805,
1608 TIM_AF_CSIZE_NOT_ALIGNED = -806,
1609 TIM_AF_CSIZE_TOO_SMALL = -807,
1610 TIM_AF_CSIZE_TOO_BIG = -808,
1611 TIM_AF_INTERVAL_TOO_SMALL = -809,
1612 TIM_AF_INVALID_BIG_ENDIAN_VALUE = -810,
1613 TIM_AF_INVALID_CLOCK_SOURCE = -811,
1614 TIM_AF_GPIO_CLK_SRC_NOT_ENABLED = -812,
1615 TIM_AF_INVALID_BSIZE = -813,
1616 TIM_AF_INVALID_ENABLE_PERIODIC = -814,
1617 TIM_AF_INVALID_ENABLE_DONTFREE = -815,
1618 TIM_AF_ENA_DONTFRE_NSET_PERIODIC = -816,
1619 TIM_AF_RING_ALREADY_DISABLED = -817,
1620};
1621
1622enum tim_clk_srcs {
1623 TIM_CLK_SRCS_TENNS = 0,
1624 TIM_CLK_SRCS_GPIO = 1,
1625 TIM_CLK_SRCS_GTI = 2,
1626 TIM_CLK_SRCS_PTP = 3,
1627 TIM_CLK_SRSC_INVALID,
1628};
1629
1630enum tim_gpio_edge {
1631 TIM_GPIO_NO_EDGE = 0,
1632 TIM_GPIO_LTOH_TRANS = 1,
1633 TIM_GPIO_HTOL_TRANS = 2,
1634 TIM_GPIO_BOTH_TRANS = 3,
1635 TIM_GPIO_INVALID,
1636};
1637
1638enum ptp_op {
1639 PTP_OP_ADJFINE = 0,
1640 PTP_OP_GET_CLOCK = 1,
1641};
1642
1643struct ptp_req {
1644 struct mbox_msghdr hdr;
1645 uint8_t __otx2_io op;
1646 int64_t __otx2_io scaled_ppm;
1647 uint8_t __otx2_io is_pmu;
1648};
1649
1650struct ptp_rsp {
1651 struct mbox_msghdr hdr;
1652 uint64_t __otx2_io clk;
1653 uint64_t __otx2_io tsc;
1654};
1655
1656struct get_hw_cap_rsp {
1657 struct mbox_msghdr hdr;
1658
1659 uint8_t __otx2_io nix_fixed_txschq_mapping;
1660 uint8_t __otx2_io nix_shaping;
1661};
1662
1663struct ndc_sync_op {
1664 struct mbox_msghdr hdr;
1665 uint8_t __otx2_io nix_lf_tx_sync;
1666 uint8_t __otx2_io nix_lf_rx_sync;
1667 uint8_t __otx2_io npa_lf_sync;
1668};
1669
1670struct tim_lf_alloc_req {
1671 struct mbox_msghdr hdr;
1672 uint16_t __otx2_io ring;
1673 uint16_t __otx2_io npa_pf_func;
1674 uint16_t __otx2_io sso_pf_func;
1675};
1676
1677struct tim_ring_req {
1678 struct mbox_msghdr hdr;
1679 uint16_t __otx2_io ring;
1680};
1681
1682struct tim_config_req {
1683 struct mbox_msghdr hdr;
1684 uint16_t __otx2_io ring;
1685 uint8_t __otx2_io bigendian;
1686 uint8_t __otx2_io clocksource;
1687 uint8_t __otx2_io enableperiodic;
1688 uint8_t __otx2_io enabledontfreebuffer;
1689 uint32_t __otx2_io bucketsize;
1690 uint32_t __otx2_io chunksize;
1691 uint32_t __otx2_io interval;
1692};
1693
1694struct tim_lf_alloc_rsp {
1695 struct mbox_msghdr hdr;
1696 uint64_t __otx2_io tenns_clk;
1697};
1698
1699struct tim_enable_rsp {
1700 struct mbox_msghdr hdr;
1701 uint64_t __otx2_io timestarted;
1702 uint32_t __otx2_io currentbucket;
1703};
1704
1705
1706
1707
1708enum ree_af_status {
1709 REE_AF_ERR_RULE_UNKNOWN_VALUE = -1001,
1710 REE_AF_ERR_LF_NO_MORE_RESOURCES = -1002,
1711 REE_AF_ERR_LF_INVALID = -1003,
1712 REE_AF_ERR_ACCESS_DENIED = -1004,
1713 REE_AF_ERR_RULE_DB_PARTIAL = -1005,
1714 REE_AF_ERR_RULE_DB_EQ_BAD_VALUE = -1006,
1715 REE_AF_ERR_RULE_DB_BLOCK_ALLOC_FAILED = -1007,
1716 REE_AF_ERR_BLOCK_NOT_IMPLEMENTED = -1008,
1717 REE_AF_ERR_RULE_DB_INC_OFFSET_TOO_BIG = -1009,
1718 REE_AF_ERR_RULE_DB_OFFSET_TOO_BIG = -1010,
1719 REE_AF_ERR_Q_IS_GRACEFUL_DIS = -1011,
1720 REE_AF_ERR_Q_NOT_GRACEFUL_DIS = -1012,
1721 REE_AF_ERR_RULE_DB_ALLOC_FAILED = -1013,
1722 REE_AF_ERR_RULE_DB_TOO_BIG = -1014,
1723 REE_AF_ERR_RULE_DB_GEQ_BAD_VALUE = -1015,
1724 REE_AF_ERR_RULE_DB_LEQ_BAD_VALUE = -1016,
1725 REE_AF_ERR_RULE_DB_WRONG_LENGTH = -1017,
1726 REE_AF_ERR_RULE_DB_WRONG_OFFSET = -1018,
1727 REE_AF_ERR_RULE_DB_BLOCK_TOO_BIG = -1019,
1728 REE_AF_ERR_RULE_DB_SHOULD_FILL_REQUEST = -1020,
1729 REE_AF_ERR_RULE_DBI_ALLOC_FAILED = -1021,
1730 REE_AF_ERR_LF_WRONG_PRIORITY = -1022,
1731 REE_AF_ERR_LF_SIZE_TOO_BIG = -1023,
1732};
1733
1734
1735
1736struct ree_req_msg {
1737 struct mbox_msghdr hdr;
1738 uint32_t __otx2_io blkaddr;
1739};
1740
1741struct ree_lf_req_msg {
1742 struct mbox_msghdr hdr;
1743 uint32_t __otx2_io blkaddr;
1744 uint32_t __otx2_io size;
1745 uint8_t __otx2_io lf;
1746 uint8_t __otx2_io pri;
1747};
1748
1749struct ree_rule_db_prog_req_msg {
1750 struct mbox_msghdr hdr;
1751#define REE_RULE_DB_REQ_BLOCK_SIZE (MBOX_SIZE >> 1)
1752 uint8_t __otx2_io rule_db[REE_RULE_DB_REQ_BLOCK_SIZE];
1753 uint32_t __otx2_io blkaddr;
1754 uint32_t __otx2_io total_len;
1755 uint32_t __otx2_io offset;
1756 uint16_t __otx2_io len;
1757 uint8_t __otx2_io is_last;
1758 uint8_t __otx2_io is_incremental;
1759 uint8_t __otx2_io is_dbi;
1760};
1761
1762struct ree_rule_db_get_req_msg {
1763 struct mbox_msghdr hdr;
1764 uint32_t __otx2_io blkaddr;
1765 uint32_t __otx2_io offset;
1766 uint8_t __otx2_io is_dbi;
1767};
1768
1769struct ree_rd_wr_reg_msg {
1770 struct mbox_msghdr hdr;
1771 uint64_t __otx2_io reg_offset;
1772 uint64_t __otx2_io *ret_val;
1773 uint64_t __otx2_io val;
1774 uint32_t __otx2_io blkaddr;
1775 uint8_t __otx2_io is_write;
1776};
1777
1778struct ree_rule_db_len_rsp_msg {
1779 struct mbox_msghdr hdr;
1780 uint32_t __otx2_io blkaddr;
1781 uint32_t __otx2_io len;
1782 uint32_t __otx2_io inc_len;
1783};
1784
1785struct ree_rule_db_get_rsp_msg {
1786 struct mbox_msghdr hdr;
1787#define REE_RULE_DB_RSP_BLOCK_SIZE (MBOX_DOWN_TX_SIZE - SZ_1K)
1788 uint8_t __otx2_io rule_db[REE_RULE_DB_RSP_BLOCK_SIZE];
1789 uint32_t __otx2_io total_len;
1790 uint32_t __otx2_io offset;
1791 uint16_t __otx2_io len;
1792 uint8_t __otx2_io is_last;
1793};
1794
1795__rte_internal
1796const char *otx2_mbox_id2name(uint16_t id);
1797int otx2_mbox_id2size(uint16_t id);
1798void otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
1799int otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t reg_base,
1800 int direction, int ndevsi, uint64_t intr_offset);
1801void otx2_mbox_fini(struct otx2_mbox *mbox);
1802__rte_internal
1803void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid);
1804__rte_internal
1805int otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid);
1806int otx2_mbox_wait_for_rsp_tmo(struct otx2_mbox *mbox, int devid, uint32_t tmo);
1807__rte_internal
1808int otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid, void **msg);
1809__rte_internal
1810int otx2_mbox_get_rsp_tmo(struct otx2_mbox *mbox, int devid, void **msg,
1811 uint32_t tmo);
1812int otx2_mbox_get_availmem(struct otx2_mbox *mbox, int devid);
1813__rte_internal
1814struct mbox_msghdr *otx2_mbox_alloc_msg_rsp(struct otx2_mbox *mbox, int devid,
1815 int size, int size_rsp);
1816
1817static inline struct mbox_msghdr *
1818otx2_mbox_alloc_msg(struct otx2_mbox *mbox, int devid, int size)
1819{
1820 return otx2_mbox_alloc_msg_rsp(mbox, devid, size, 0);
1821}
1822
1823static inline void
1824otx2_mbox_req_init(uint16_t mbox_id, void *msghdr)
1825{
1826 struct mbox_msghdr *hdr = msghdr;
1827
1828 hdr->sig = OTX2_MBOX_REQ_SIG;
1829 hdr->ver = OTX2_MBOX_VERSION;
1830 hdr->id = mbox_id;
1831 hdr->pcifunc = 0;
1832}
1833
1834static inline void
1835otx2_mbox_rsp_init(uint16_t mbox_id, void *msghdr)
1836{
1837 struct mbox_msghdr *hdr = msghdr;
1838
1839 hdr->sig = OTX2_MBOX_RSP_SIG;
1840 hdr->rc = -ETIMEDOUT;
1841 hdr->id = mbox_id;
1842}
1843
1844static inline bool
1845otx2_mbox_nonempty(struct otx2_mbox *mbox, int devid)
1846{
1847 struct otx2_mbox_dev *mdev = &mbox->dev[devid];
1848 bool ret;
1849
1850 rte_spinlock_lock(&mdev->mbox_lock);
1851 ret = mdev->num_msgs != 0;
1852 rte_spinlock_unlock(&mdev->mbox_lock);
1853
1854 return ret;
1855}
1856
1857static inline int
1858otx2_mbox_process(struct otx2_mbox *mbox)
1859{
1860 otx2_mbox_msg_send(mbox, 0);
1861 return otx2_mbox_get_rsp(mbox, 0, NULL);
1862}
1863
1864static inline int
1865otx2_mbox_process_msg(struct otx2_mbox *mbox, void **msg)
1866{
1867 otx2_mbox_msg_send(mbox, 0);
1868 return otx2_mbox_get_rsp(mbox, 0, msg);
1869}
1870
1871static inline int
1872otx2_mbox_process_tmo(struct otx2_mbox *mbox, uint32_t tmo)
1873{
1874 otx2_mbox_msg_send(mbox, 0);
1875 return otx2_mbox_get_rsp_tmo(mbox, 0, NULL, tmo);
1876}
1877
1878static inline int
1879otx2_mbox_process_msg_tmo(struct otx2_mbox *mbox, void **msg, uint32_t tmo)
1880{
1881 otx2_mbox_msg_send(mbox, 0);
1882 return otx2_mbox_get_rsp_tmo(mbox, 0, msg, tmo);
1883}
1884
1885int otx2_send_ready_msg(struct otx2_mbox *mbox, uint16_t *pf_func );
1886int otx2_reply_invalid_msg(struct otx2_mbox *mbox, int devid, uint16_t pf_func,
1887 uint16_t id);
1888
1889#define M(_name, _id, _fn_name, _req_type, _rsp_type) \
1890static inline struct _req_type \
1891*otx2_mbox_alloc_msg_ ## _fn_name(struct otx2_mbox *mbox) \
1892{ \
1893 struct _req_type *req; \
1894 \
1895 req = (struct _req_type *)otx2_mbox_alloc_msg_rsp( \
1896 mbox, 0, sizeof(struct _req_type), \
1897 sizeof(struct _rsp_type)); \
1898 if (!req) \
1899 return NULL; \
1900 \
1901 req->hdr.sig = OTX2_MBOX_REQ_SIG; \
1902 req->hdr.id = _id; \
1903 otx2_mbox_dbg("id=0x%x (%s)", \
1904 req->hdr.id, otx2_mbox_id2name(req->hdr.id)); \
1905 return req; \
1906}
1907
1908MBOX_MESSAGES
1909#undef M
1910
1911
1912
1913
1914
1915static inline volatile void *
1916otx2_mbox_memcpy(volatile void *d, const volatile void *s, size_t l)
1917{
1918 const volatile uint8_t *sb;
1919 volatile uint8_t *db;
1920 size_t i;
1921
1922 if (!d || !s)
1923 return NULL;
1924 db = (volatile uint8_t *)d;
1925 sb = (const volatile uint8_t *)s;
1926 for (i = 0; i < l; i++)
1927 db[i] = sb[i];
1928 return d;
1929}
1930
1931
1932
1933
1934
1935static inline void
1936otx2_mbox_memset(volatile void *d, uint8_t val, size_t l)
1937{
1938 volatile uint8_t *db;
1939 size_t i = 0;
1940
1941 if (!d || !l)
1942 return;
1943 db = (volatile uint8_t *)d;
1944 for (i = 0; i < l; i++)
1945 db[i] = val;
1946}
1947
1948#endif
1949