18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*  Marvell OcteonTx2 RVU Admin Function driver
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2018 Marvell International Ltd.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
78c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License version 2 as
88c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef MBOX_H
128c2ecf20Sopenharmony_ci#define MBOX_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/etherdevice.h>
158c2ecf20Sopenharmony_ci#include <linux/sizes.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include "rvu_struct.h"
188c2ecf20Sopenharmony_ci#include "common.h"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define MBOX_SIZE		SZ_64K
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* AF/PF: PF initiated, PF/VF VF initiated */
238c2ecf20Sopenharmony_ci#define MBOX_DOWN_RX_START	0
248c2ecf20Sopenharmony_ci#define MBOX_DOWN_RX_SIZE	(46 * SZ_1K)
258c2ecf20Sopenharmony_ci#define MBOX_DOWN_TX_START	(MBOX_DOWN_RX_START + MBOX_DOWN_RX_SIZE)
268c2ecf20Sopenharmony_ci#define MBOX_DOWN_TX_SIZE	(16 * SZ_1K)
278c2ecf20Sopenharmony_ci/* AF/PF: AF initiated, PF/VF PF initiated */
288c2ecf20Sopenharmony_ci#define MBOX_UP_RX_START	(MBOX_DOWN_TX_START + MBOX_DOWN_TX_SIZE)
298c2ecf20Sopenharmony_ci#define MBOX_UP_RX_SIZE		SZ_1K
308c2ecf20Sopenharmony_ci#define MBOX_UP_TX_START	(MBOX_UP_RX_START + MBOX_UP_RX_SIZE)
318c2ecf20Sopenharmony_ci#define MBOX_UP_TX_SIZE		SZ_1K
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#if MBOX_UP_TX_SIZE + MBOX_UP_TX_START != MBOX_SIZE
348c2ecf20Sopenharmony_ci# error "incorrect mailbox area sizes"
358c2ecf20Sopenharmony_ci#endif
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define INTR_MASK(pfvfs) ((pfvfs < 64) ? (BIT_ULL(pfvfs) - 1) : (~0ull))
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define MBOX_RSP_TIMEOUT	2000 /* Time(ms) to wait for mbox response */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define MBOX_MSG_ALIGN		16  /* Align mbox msg start to 16bytes */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Mailbox directions */
448c2ecf20Sopenharmony_ci#define MBOX_DIR_AFPF		0  /* AF replies to PF */
458c2ecf20Sopenharmony_ci#define MBOX_DIR_PFAF		1  /* PF sends messages to AF */
468c2ecf20Sopenharmony_ci#define MBOX_DIR_PFVF		2  /* PF replies to VF */
478c2ecf20Sopenharmony_ci#define MBOX_DIR_VFPF		3  /* VF sends messages to PF */
488c2ecf20Sopenharmony_ci#define MBOX_DIR_AFPF_UP	4  /* AF sends messages to PF */
498c2ecf20Sopenharmony_ci#define MBOX_DIR_PFAF_UP	5  /* PF replies to AF */
508c2ecf20Sopenharmony_ci#define MBOX_DIR_PFVF_UP	6  /* PF sends messages to VF */
518c2ecf20Sopenharmony_ci#define MBOX_DIR_VFPF_UP	7  /* VF replies to PF */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistruct otx2_mbox_dev {
548c2ecf20Sopenharmony_ci	void	    *mbase;   /* This dev's mbox region */
558c2ecf20Sopenharmony_ci	spinlock_t  mbox_lock;
568c2ecf20Sopenharmony_ci	u16         msg_size; /* Total msg size to be sent */
578c2ecf20Sopenharmony_ci	u16         rsp_size; /* Total rsp size to be sure the reply is ok */
588c2ecf20Sopenharmony_ci	u16         num_msgs; /* No of msgs sent or waiting for response */
598c2ecf20Sopenharmony_ci	u16         msgs_acked; /* No of msgs for which response is received */
608c2ecf20Sopenharmony_ci};
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cistruct otx2_mbox {
638c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
648c2ecf20Sopenharmony_ci	void   *hwbase;  /* Mbox region advertised by HW */
658c2ecf20Sopenharmony_ci	void   *reg_base;/* CSR base for this dev */
668c2ecf20Sopenharmony_ci	u64    trigger;  /* Trigger mbox notification */
678c2ecf20Sopenharmony_ci	u16    tr_shift; /* Mbox trigger shift */
688c2ecf20Sopenharmony_ci	u64    rx_start; /* Offset of Rx region in mbox memory */
698c2ecf20Sopenharmony_ci	u64    tx_start; /* Offset of Tx region in mbox memory */
708c2ecf20Sopenharmony_ci	u16    rx_size;  /* Size of Rx region */
718c2ecf20Sopenharmony_ci	u16    tx_size;  /* Size of Tx region */
728c2ecf20Sopenharmony_ci	u16    ndevs;    /* The number of peers */
738c2ecf20Sopenharmony_ci	struct otx2_mbox_dev *dev;
748c2ecf20Sopenharmony_ci};
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* Header which preceeds all mbox messages */
778c2ecf20Sopenharmony_cistruct mbox_hdr {
788c2ecf20Sopenharmony_ci	u64 msg_size;	/* Total msgs size embedded */
798c2ecf20Sopenharmony_ci	u16  num_msgs;   /* No of msgs embedded */
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci/* Header which preceeds every msg and is also part of it */
838c2ecf20Sopenharmony_cistruct mbox_msghdr {
848c2ecf20Sopenharmony_ci	u16 pcifunc;     /* Who's sending this msg */
858c2ecf20Sopenharmony_ci	u16 id;          /* Mbox message ID */
868c2ecf20Sopenharmony_ci#define OTX2_MBOX_REQ_SIG (0xdead)
878c2ecf20Sopenharmony_ci#define OTX2_MBOX_RSP_SIG (0xbeef)
888c2ecf20Sopenharmony_ci	u16 sig;         /* Signature, for validating corrupted msgs */
898c2ecf20Sopenharmony_ci#define OTX2_MBOX_VERSION (0x0001)
908c2ecf20Sopenharmony_ci	u16 ver;         /* Version of msg's structure for this ID */
918c2ecf20Sopenharmony_ci	u16 next_msgoff; /* Offset of next msg within mailbox region */
928c2ecf20Sopenharmony_ci	int rc;          /* Msg process'ed response code */
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_civoid otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
968c2ecf20Sopenharmony_civoid __otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
978c2ecf20Sopenharmony_civoid otx2_mbox_destroy(struct otx2_mbox *mbox);
988c2ecf20Sopenharmony_ciint otx2_mbox_init(struct otx2_mbox *mbox, void __force *hwbase,
998c2ecf20Sopenharmony_ci		   struct pci_dev *pdev, void __force *reg_base,
1008c2ecf20Sopenharmony_ci		   int direction, int ndevs);
1018c2ecf20Sopenharmony_civoid otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid);
1028c2ecf20Sopenharmony_ciint otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid);
1038c2ecf20Sopenharmony_ciint otx2_mbox_busy_poll_for_rsp(struct otx2_mbox *mbox, int devid);
1048c2ecf20Sopenharmony_cistruct mbox_msghdr *otx2_mbox_alloc_msg_rsp(struct otx2_mbox *mbox, int devid,
1058c2ecf20Sopenharmony_ci					    int size, int size_rsp);
1068c2ecf20Sopenharmony_cistruct mbox_msghdr *otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid,
1078c2ecf20Sopenharmony_ci				      struct mbox_msghdr *msg);
1088c2ecf20Sopenharmony_ciint otx2_mbox_check_rsp_msgs(struct otx2_mbox *mbox, int devid);
1098c2ecf20Sopenharmony_ciint otx2_reply_invalid_msg(struct otx2_mbox *mbox, int devid,
1108c2ecf20Sopenharmony_ci			   u16 pcifunc, u16 id);
1118c2ecf20Sopenharmony_cibool otx2_mbox_nonempty(struct otx2_mbox *mbox, int devid);
1128c2ecf20Sopenharmony_ciconst char *otx2_mbox_id2name(u16 id);
1138c2ecf20Sopenharmony_cistatic inline struct mbox_msghdr *otx2_mbox_alloc_msg(struct otx2_mbox *mbox,
1148c2ecf20Sopenharmony_ci						      int devid, int size)
1158c2ecf20Sopenharmony_ci{
1168c2ecf20Sopenharmony_ci	return otx2_mbox_alloc_msg_rsp(mbox, devid, size, 0);
1178c2ecf20Sopenharmony_ci}
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/* Mailbox message types */
1208c2ecf20Sopenharmony_ci#define MBOX_MSG_MASK				0xFFFF
1218c2ecf20Sopenharmony_ci#define MBOX_MSG_INVALID			0xFFFE
1228c2ecf20Sopenharmony_ci#define MBOX_MSG_MAX				0xFFFF
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define MBOX_MESSAGES							\
1258c2ecf20Sopenharmony_ci/* Generic mbox IDs (range 0x000 - 0x1FF) */				\
1268c2ecf20Sopenharmony_ciM(READY,		0x001, ready, msg_req, ready_msg_rsp)		\
1278c2ecf20Sopenharmony_ciM(ATTACH_RESOURCES,	0x002, attach_resources, rsrc_attach, msg_rsp)	\
1288c2ecf20Sopenharmony_ciM(DETACH_RESOURCES,	0x003, detach_resources, rsrc_detach, msg_rsp)	\
1298c2ecf20Sopenharmony_ciM(MSIX_OFFSET,		0x005, msix_offset, msg_req, msix_offset_rsp)	\
1308c2ecf20Sopenharmony_ciM(VF_FLR,		0x006, vf_flr, msg_req, msg_rsp)		\
1318c2ecf20Sopenharmony_ciM(PTP_OP,		0x007, ptp_op, ptp_req, ptp_rsp)		\
1328c2ecf20Sopenharmony_ciM(GET_HW_CAP,		0x008, get_hw_cap, msg_req, get_hw_cap_rsp)	\
1338c2ecf20Sopenharmony_ci/* CGX mbox IDs (range 0x200 - 0x3FF) */				\
1348c2ecf20Sopenharmony_ciM(CGX_START_RXTX,	0x200, cgx_start_rxtx, msg_req, msg_rsp)	\
1358c2ecf20Sopenharmony_ciM(CGX_STOP_RXTX,	0x201, cgx_stop_rxtx, msg_req, msg_rsp)		\
1368c2ecf20Sopenharmony_ciM(CGX_STATS,		0x202, cgx_stats, msg_req, cgx_stats_rsp)	\
1378c2ecf20Sopenharmony_ciM(CGX_MAC_ADDR_SET,	0x203, cgx_mac_addr_set, cgx_mac_addr_set_or_get,    \
1388c2ecf20Sopenharmony_ci				cgx_mac_addr_set_or_get)		\
1398c2ecf20Sopenharmony_ciM(CGX_MAC_ADDR_GET,	0x204, cgx_mac_addr_get, cgx_mac_addr_set_or_get,    \
1408c2ecf20Sopenharmony_ci				cgx_mac_addr_set_or_get)		\
1418c2ecf20Sopenharmony_ciM(CGX_PROMISC_ENABLE,	0x205, cgx_promisc_enable, msg_req, msg_rsp)	\
1428c2ecf20Sopenharmony_ciM(CGX_PROMISC_DISABLE,	0x206, cgx_promisc_disable, msg_req, msg_rsp)	\
1438c2ecf20Sopenharmony_ciM(CGX_START_LINKEVENTS, 0x207, cgx_start_linkevents, msg_req, msg_rsp)	\
1448c2ecf20Sopenharmony_ciM(CGX_STOP_LINKEVENTS,	0x208, cgx_stop_linkevents, msg_req, msg_rsp)	\
1458c2ecf20Sopenharmony_ciM(CGX_GET_LINKINFO,	0x209, cgx_get_linkinfo, msg_req, cgx_link_info_msg) \
1468c2ecf20Sopenharmony_ciM(CGX_INTLBK_ENABLE,	0x20A, cgx_intlbk_enable, msg_req, msg_rsp)	\
1478c2ecf20Sopenharmony_ciM(CGX_INTLBK_DISABLE,	0x20B, cgx_intlbk_disable, msg_req, msg_rsp)	\
1488c2ecf20Sopenharmony_ciM(CGX_PTP_RX_ENABLE,	0x20C, cgx_ptp_rx_enable, msg_req, msg_rsp)	\
1498c2ecf20Sopenharmony_ciM(CGX_PTP_RX_DISABLE,	0x20D, cgx_ptp_rx_disable, msg_req, msg_rsp)	\
1508c2ecf20Sopenharmony_ciM(CGX_CFG_PAUSE_FRM,	0x20E, cgx_cfg_pause_frm, cgx_pause_frm_cfg,	\
1518c2ecf20Sopenharmony_ci			       cgx_pause_frm_cfg)			\
1528c2ecf20Sopenharmony_ci/* NPA mbox IDs (range 0x400 - 0x5FF) */				\
1538c2ecf20Sopenharmony_ciM(NPA_LF_ALLOC,		0x400, npa_lf_alloc,				\
1548c2ecf20Sopenharmony_ci				npa_lf_alloc_req, npa_lf_alloc_rsp)	\
1558c2ecf20Sopenharmony_ciM(NPA_LF_FREE,		0x401, npa_lf_free, msg_req, msg_rsp)		\
1568c2ecf20Sopenharmony_ciM(NPA_AQ_ENQ,		0x402, npa_aq_enq, npa_aq_enq_req, npa_aq_enq_rsp)   \
1578c2ecf20Sopenharmony_ciM(NPA_HWCTX_DISABLE,	0x403, npa_hwctx_disable, hwctx_disable_req, msg_rsp)\
1588c2ecf20Sopenharmony_ci/* SSO/SSOW mbox IDs (range 0x600 - 0x7FF) */				\
1598c2ecf20Sopenharmony_ci/* TIM mbox IDs (range 0x800 - 0x9FF) */				\
1608c2ecf20Sopenharmony_ci/* CPT mbox IDs (range 0xA00 - 0xBFF) */				\
1618c2ecf20Sopenharmony_ci/* NPC mbox IDs (range 0x6000 - 0x7FFF) */				\
1628c2ecf20Sopenharmony_ciM(NPC_MCAM_ALLOC_ENTRY,	0x6000, npc_mcam_alloc_entry, npc_mcam_alloc_entry_req,\
1638c2ecf20Sopenharmony_ci				npc_mcam_alloc_entry_rsp)		\
1648c2ecf20Sopenharmony_ciM(NPC_MCAM_FREE_ENTRY,	0x6001, npc_mcam_free_entry,			\
1658c2ecf20Sopenharmony_ci				 npc_mcam_free_entry_req, msg_rsp)	\
1668c2ecf20Sopenharmony_ciM(NPC_MCAM_WRITE_ENTRY,	0x6002, npc_mcam_write_entry,			\
1678c2ecf20Sopenharmony_ci				 npc_mcam_write_entry_req, msg_rsp)	\
1688c2ecf20Sopenharmony_ciM(NPC_MCAM_ENA_ENTRY,   0x6003, npc_mcam_ena_entry,			\
1698c2ecf20Sopenharmony_ci				 npc_mcam_ena_dis_entry_req, msg_rsp)	\
1708c2ecf20Sopenharmony_ciM(NPC_MCAM_DIS_ENTRY,   0x6004, npc_mcam_dis_entry,			\
1718c2ecf20Sopenharmony_ci				 npc_mcam_ena_dis_entry_req, msg_rsp)	\
1728c2ecf20Sopenharmony_ciM(NPC_MCAM_SHIFT_ENTRY, 0x6005, npc_mcam_shift_entry, npc_mcam_shift_entry_req,\
1738c2ecf20Sopenharmony_ci				npc_mcam_shift_entry_rsp)		\
1748c2ecf20Sopenharmony_ciM(NPC_MCAM_ALLOC_COUNTER, 0x6006, npc_mcam_alloc_counter,		\
1758c2ecf20Sopenharmony_ci					npc_mcam_alloc_counter_req,	\
1768c2ecf20Sopenharmony_ci					npc_mcam_alloc_counter_rsp)	\
1778c2ecf20Sopenharmony_ciM(NPC_MCAM_FREE_COUNTER,  0x6007, npc_mcam_free_counter,		\
1788c2ecf20Sopenharmony_ci				    npc_mcam_oper_counter_req, msg_rsp)	\
1798c2ecf20Sopenharmony_ciM(NPC_MCAM_UNMAP_COUNTER, 0x6008, npc_mcam_unmap_counter,		\
1808c2ecf20Sopenharmony_ci				   npc_mcam_unmap_counter_req, msg_rsp)	\
1818c2ecf20Sopenharmony_ciM(NPC_MCAM_CLEAR_COUNTER, 0x6009, npc_mcam_clear_counter,		\
1828c2ecf20Sopenharmony_ci				   npc_mcam_oper_counter_req, msg_rsp)	\
1838c2ecf20Sopenharmony_ciM(NPC_MCAM_COUNTER_STATS, 0x600a, npc_mcam_counter_stats,		\
1848c2ecf20Sopenharmony_ci				   npc_mcam_oper_counter_req,		\
1858c2ecf20Sopenharmony_ci				   npc_mcam_oper_counter_rsp)		\
1868c2ecf20Sopenharmony_ciM(NPC_MCAM_ALLOC_AND_WRITE_ENTRY, 0x600b, npc_mcam_alloc_and_write_entry,      \
1878c2ecf20Sopenharmony_ci					  npc_mcam_alloc_and_write_entry_req,  \
1888c2ecf20Sopenharmony_ci					  npc_mcam_alloc_and_write_entry_rsp)  \
1898c2ecf20Sopenharmony_ciM(NPC_GET_KEX_CFG,	  0x600c, npc_get_kex_cfg,			\
1908c2ecf20Sopenharmony_ci				   msg_req, npc_get_kex_cfg_rsp)	\
1918c2ecf20Sopenharmony_ci/* NIX mbox IDs (range 0x8000 - 0xFFFF) */				\
1928c2ecf20Sopenharmony_ciM(NIX_LF_ALLOC,		0x8000, nix_lf_alloc,				\
1938c2ecf20Sopenharmony_ci				 nix_lf_alloc_req, nix_lf_alloc_rsp)	\
1948c2ecf20Sopenharmony_ciM(NIX_LF_FREE,		0x8001, nix_lf_free, msg_req, msg_rsp)		\
1958c2ecf20Sopenharmony_ciM(NIX_AQ_ENQ,		0x8002, nix_aq_enq, nix_aq_enq_req, nix_aq_enq_rsp)  \
1968c2ecf20Sopenharmony_ciM(NIX_HWCTX_DISABLE,	0x8003, nix_hwctx_disable,			\
1978c2ecf20Sopenharmony_ci				 hwctx_disable_req, msg_rsp)		\
1988c2ecf20Sopenharmony_ciM(NIX_TXSCH_ALLOC,	0x8004, nix_txsch_alloc,			\
1998c2ecf20Sopenharmony_ci				 nix_txsch_alloc_req, nix_txsch_alloc_rsp)   \
2008c2ecf20Sopenharmony_ciM(NIX_TXSCH_FREE,	0x8005, nix_txsch_free, nix_txsch_free_req, msg_rsp) \
2018c2ecf20Sopenharmony_ciM(NIX_TXSCHQ_CFG,	0x8006, nix_txschq_cfg, nix_txschq_config, msg_rsp)  \
2028c2ecf20Sopenharmony_ciM(NIX_STATS_RST,	0x8007, nix_stats_rst, msg_req, msg_rsp)	\
2038c2ecf20Sopenharmony_ciM(NIX_VTAG_CFG,		0x8008, nix_vtag_cfg, nix_vtag_config, msg_rsp)	\
2048c2ecf20Sopenharmony_ciM(NIX_RSS_FLOWKEY_CFG,  0x8009, nix_rss_flowkey_cfg,			\
2058c2ecf20Sopenharmony_ci				 nix_rss_flowkey_cfg,			\
2068c2ecf20Sopenharmony_ci				 nix_rss_flowkey_cfg_rsp)		\
2078c2ecf20Sopenharmony_ciM(NIX_SET_MAC_ADDR,	0x800a, nix_set_mac_addr, nix_set_mac_addr, msg_rsp) \
2088c2ecf20Sopenharmony_ciM(NIX_SET_RX_MODE,	0x800b, nix_set_rx_mode, nix_rx_mode, msg_rsp)	\
2098c2ecf20Sopenharmony_ciM(NIX_SET_HW_FRS,	0x800c, nix_set_hw_frs, nix_frs_cfg, msg_rsp)	\
2108c2ecf20Sopenharmony_ciM(NIX_LF_START_RX,	0x800d, nix_lf_start_rx, msg_req, msg_rsp)	\
2118c2ecf20Sopenharmony_ciM(NIX_LF_STOP_RX,	0x800e, nix_lf_stop_rx, msg_req, msg_rsp)	\
2128c2ecf20Sopenharmony_ciM(NIX_MARK_FORMAT_CFG,	0x800f, nix_mark_format_cfg,			\
2138c2ecf20Sopenharmony_ci				 nix_mark_format_cfg,			\
2148c2ecf20Sopenharmony_ci				 nix_mark_format_cfg_rsp)		\
2158c2ecf20Sopenharmony_ciM(NIX_SET_RX_CFG,	0x8010, nix_set_rx_cfg, nix_rx_cfg, msg_rsp)	\
2168c2ecf20Sopenharmony_ciM(NIX_LSO_FORMAT_CFG,	0x8011, nix_lso_format_cfg,			\
2178c2ecf20Sopenharmony_ci				 nix_lso_format_cfg,			\
2188c2ecf20Sopenharmony_ci				 nix_lso_format_cfg_rsp)		\
2198c2ecf20Sopenharmony_ciM(NIX_RXVLAN_ALLOC,	0x8012, nix_rxvlan_alloc, msg_req, msg_rsp)	\
2208c2ecf20Sopenharmony_ciM(NIX_LF_PTP_TX_ENABLE, 0x8013, nix_lf_ptp_tx_enable, msg_req, msg_rsp)	\
2218c2ecf20Sopenharmony_ciM(NIX_LF_PTP_TX_DISABLE, 0x8014, nix_lf_ptp_tx_disable, msg_req, msg_rsp) \
2228c2ecf20Sopenharmony_ciM(NIX_BP_ENABLE,	0x8016, nix_bp_enable, nix_bp_cfg_req,	\
2238c2ecf20Sopenharmony_ci				nix_bp_cfg_rsp)	\
2248c2ecf20Sopenharmony_ciM(NIX_BP_DISABLE,	0x8017, nix_bp_disable, nix_bp_cfg_req, msg_rsp) \
2258c2ecf20Sopenharmony_ciM(NIX_GET_MAC_ADDR, 0x8018, nix_get_mac_addr, msg_req, nix_get_mac_addr_rsp) \
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci/* Messages initiated by AF (range 0xC00 - 0xDFF) */
2288c2ecf20Sopenharmony_ci#define MBOX_UP_CGX_MESSAGES						\
2298c2ecf20Sopenharmony_ciM(CGX_LINK_EVENT,	0xC00, cgx_link_event, cgx_link_info_msg, msg_rsp)
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_cienum {
2328c2ecf20Sopenharmony_ci#define M(_name, _id, _1, _2, _3) MBOX_MSG_ ## _name = _id,
2338c2ecf20Sopenharmony_ciMBOX_MESSAGES
2348c2ecf20Sopenharmony_ciMBOX_UP_CGX_MESSAGES
2358c2ecf20Sopenharmony_ci#undef M
2368c2ecf20Sopenharmony_ci};
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/* Mailbox message formats */
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci#define RVU_DEFAULT_PF_FUNC     0xFFFF
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci/* Generic request msg used for those mbox messages which
2438c2ecf20Sopenharmony_ci * don't send any data in the request.
2448c2ecf20Sopenharmony_ci */
2458c2ecf20Sopenharmony_cistruct msg_req {
2468c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
2478c2ecf20Sopenharmony_ci};
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci/* Generic rsponse msg used a ack or response for those mbox
2508c2ecf20Sopenharmony_ci * messages which doesn't have a specific rsp msg format.
2518c2ecf20Sopenharmony_ci */
2528c2ecf20Sopenharmony_cistruct msg_rsp {
2538c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
2548c2ecf20Sopenharmony_ci};
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci/* RVU mailbox error codes
2578c2ecf20Sopenharmony_ci * Range 256 - 300.
2588c2ecf20Sopenharmony_ci */
2598c2ecf20Sopenharmony_cienum rvu_af_status {
2608c2ecf20Sopenharmony_ci	RVU_INVALID_VF_ID           = -256,
2618c2ecf20Sopenharmony_ci};
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistruct ready_msg_rsp {
2648c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
2658c2ecf20Sopenharmony_ci	u16    sclk_freq;	/* SCLK frequency (in MHz) */
2668c2ecf20Sopenharmony_ci	u16    rclk_freq;	/* RCLK frequency (in MHz) */
2678c2ecf20Sopenharmony_ci};
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/* Structure for requesting resource provisioning.
2708c2ecf20Sopenharmony_ci * 'modify' flag to be used when either requesting more
2718c2ecf20Sopenharmony_ci * or to detach partial of a cetain resource type.
2728c2ecf20Sopenharmony_ci * Rest of the fields specify how many of what type to
2738c2ecf20Sopenharmony_ci * be attached.
2748c2ecf20Sopenharmony_ci */
2758c2ecf20Sopenharmony_cistruct rsrc_attach {
2768c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
2778c2ecf20Sopenharmony_ci	u8   modify:1;
2788c2ecf20Sopenharmony_ci	u8   npalf:1;
2798c2ecf20Sopenharmony_ci	u8   nixlf:1;
2808c2ecf20Sopenharmony_ci	u16  sso;
2818c2ecf20Sopenharmony_ci	u16  ssow;
2828c2ecf20Sopenharmony_ci	u16  timlfs;
2838c2ecf20Sopenharmony_ci	u16  cptlfs;
2848c2ecf20Sopenharmony_ci};
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* Structure for relinquishing resources.
2878c2ecf20Sopenharmony_ci * 'partial' flag to be used when relinquishing all resources
2888c2ecf20Sopenharmony_ci * but only of a certain type. If not set, all resources of all
2898c2ecf20Sopenharmony_ci * types provisioned to the RVU function will be detached.
2908c2ecf20Sopenharmony_ci */
2918c2ecf20Sopenharmony_cistruct rsrc_detach {
2928c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
2938c2ecf20Sopenharmony_ci	u8 partial:1;
2948c2ecf20Sopenharmony_ci	u8 npalf:1;
2958c2ecf20Sopenharmony_ci	u8 nixlf:1;
2968c2ecf20Sopenharmony_ci	u8 sso:1;
2978c2ecf20Sopenharmony_ci	u8 ssow:1;
2988c2ecf20Sopenharmony_ci	u8 timlfs:1;
2998c2ecf20Sopenharmony_ci	u8 cptlfs:1;
3008c2ecf20Sopenharmony_ci};
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci#define MSIX_VECTOR_INVALID	0xFFFF
3038c2ecf20Sopenharmony_ci#define MAX_RVU_BLKLF_CNT	256
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_cistruct msix_offset_rsp {
3068c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3078c2ecf20Sopenharmony_ci	u16  npa_msixoff;
3088c2ecf20Sopenharmony_ci	u16  nix_msixoff;
3098c2ecf20Sopenharmony_ci	u8   sso;
3108c2ecf20Sopenharmony_ci	u8   ssow;
3118c2ecf20Sopenharmony_ci	u8   timlfs;
3128c2ecf20Sopenharmony_ci	u8   cptlfs;
3138c2ecf20Sopenharmony_ci	u16  sso_msixoff[MAX_RVU_BLKLF_CNT];
3148c2ecf20Sopenharmony_ci	u16  ssow_msixoff[MAX_RVU_BLKLF_CNT];
3158c2ecf20Sopenharmony_ci	u16  timlf_msixoff[MAX_RVU_BLKLF_CNT];
3168c2ecf20Sopenharmony_ci	u16  cptlf_msixoff[MAX_RVU_BLKLF_CNT];
3178c2ecf20Sopenharmony_ci};
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_cistruct get_hw_cap_rsp {
3208c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3218c2ecf20Sopenharmony_ci	u8 nix_fixed_txschq_mapping; /* Schq mapping fixed or flexible */
3228c2ecf20Sopenharmony_ci	u8 nix_shaping;		     /* Is shaping and coloring supported */
3238c2ecf20Sopenharmony_ci};
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci/* CGX mbox message formats */
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_cistruct cgx_stats_rsp {
3288c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3298c2ecf20Sopenharmony_ci#define CGX_RX_STATS_COUNT	13
3308c2ecf20Sopenharmony_ci#define CGX_TX_STATS_COUNT	18
3318c2ecf20Sopenharmony_ci	u64 rx_stats[CGX_RX_STATS_COUNT];
3328c2ecf20Sopenharmony_ci	u64 tx_stats[CGX_TX_STATS_COUNT];
3338c2ecf20Sopenharmony_ci};
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/* Structure for requesting the operation for
3368c2ecf20Sopenharmony_ci * setting/getting mac address in the CGX interface
3378c2ecf20Sopenharmony_ci */
3388c2ecf20Sopenharmony_cistruct cgx_mac_addr_set_or_get {
3398c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3408c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];
3418c2ecf20Sopenharmony_ci};
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cistruct cgx_link_user_info {
3448c2ecf20Sopenharmony_ci	uint64_t link_up:1;
3458c2ecf20Sopenharmony_ci	uint64_t full_duplex:1;
3468c2ecf20Sopenharmony_ci	uint64_t lmac_type_id:4;
3478c2ecf20Sopenharmony_ci	uint64_t speed:20; /* speed in Mbps */
3488c2ecf20Sopenharmony_ci#define LMACTYPE_STR_LEN 16
3498c2ecf20Sopenharmony_ci	char lmac_type[LMACTYPE_STR_LEN];
3508c2ecf20Sopenharmony_ci};
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_cistruct cgx_link_info_msg {
3538c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3548c2ecf20Sopenharmony_ci	struct cgx_link_user_info link_info;
3558c2ecf20Sopenharmony_ci};
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_cistruct cgx_pause_frm_cfg {
3588c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3598c2ecf20Sopenharmony_ci	u8 set;
3608c2ecf20Sopenharmony_ci	/* set = 1 if the request is to config pause frames */
3618c2ecf20Sopenharmony_ci	/* set = 0 if the request is to fetch pause frames config */
3628c2ecf20Sopenharmony_ci	u8 rx_pause;
3638c2ecf20Sopenharmony_ci	u8 tx_pause;
3648c2ecf20Sopenharmony_ci};
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci/* NPA mbox message formats */
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci/* NPA mailbox error codes
3698c2ecf20Sopenharmony_ci * Range 301 - 400.
3708c2ecf20Sopenharmony_ci */
3718c2ecf20Sopenharmony_cienum npa_af_status {
3728c2ecf20Sopenharmony_ci	NPA_AF_ERR_PARAM            = -301,
3738c2ecf20Sopenharmony_ci	NPA_AF_ERR_AQ_FULL          = -302,
3748c2ecf20Sopenharmony_ci	NPA_AF_ERR_AQ_ENQUEUE       = -303,
3758c2ecf20Sopenharmony_ci	NPA_AF_ERR_AF_LF_INVALID    = -304,
3768c2ecf20Sopenharmony_ci	NPA_AF_ERR_AF_LF_ALLOC      = -305,
3778c2ecf20Sopenharmony_ci	NPA_AF_ERR_LF_RESET         = -306,
3788c2ecf20Sopenharmony_ci};
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci/* For NPA LF context alloc and init */
3818c2ecf20Sopenharmony_cistruct npa_lf_alloc_req {
3828c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3838c2ecf20Sopenharmony_ci	int node;
3848c2ecf20Sopenharmony_ci	int aura_sz;  /* No of auras */
3858c2ecf20Sopenharmony_ci	u32 nr_pools; /* No of pools */
3868c2ecf20Sopenharmony_ci	u64 way_mask;
3878c2ecf20Sopenharmony_ci};
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_cistruct npa_lf_alloc_rsp {
3908c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3918c2ecf20Sopenharmony_ci	u32 stack_pg_ptrs;  /* No of ptrs per stack page */
3928c2ecf20Sopenharmony_ci	u32 stack_pg_bytes; /* Size of stack page */
3938c2ecf20Sopenharmony_ci	u16 qints; /* NPA_AF_CONST::QINTS */
3948c2ecf20Sopenharmony_ci};
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci/* NPA AQ enqueue msg */
3978c2ecf20Sopenharmony_cistruct npa_aq_enq_req {
3988c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
3998c2ecf20Sopenharmony_ci	u32 aura_id;
4008c2ecf20Sopenharmony_ci	u8 ctype;
4018c2ecf20Sopenharmony_ci	u8 op;
4028c2ecf20Sopenharmony_ci	union {
4038c2ecf20Sopenharmony_ci		/* Valid when op == WRITE/INIT and ctype == AURA.
4048c2ecf20Sopenharmony_ci		 * LF fills the pool_id in aura.pool_addr. AF will translate
4058c2ecf20Sopenharmony_ci		 * the pool_id to pool context pointer.
4068c2ecf20Sopenharmony_ci		 */
4078c2ecf20Sopenharmony_ci		struct npa_aura_s aura;
4088c2ecf20Sopenharmony_ci		/* Valid when op == WRITE/INIT and ctype == POOL */
4098c2ecf20Sopenharmony_ci		struct npa_pool_s pool;
4108c2ecf20Sopenharmony_ci	};
4118c2ecf20Sopenharmony_ci	/* Mask data when op == WRITE (1=write, 0=don't write) */
4128c2ecf20Sopenharmony_ci	union {
4138c2ecf20Sopenharmony_ci		/* Valid when op == WRITE and ctype == AURA */
4148c2ecf20Sopenharmony_ci		struct npa_aura_s aura_mask;
4158c2ecf20Sopenharmony_ci		/* Valid when op == WRITE and ctype == POOL */
4168c2ecf20Sopenharmony_ci		struct npa_pool_s pool_mask;
4178c2ecf20Sopenharmony_ci	};
4188c2ecf20Sopenharmony_ci};
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_cistruct npa_aq_enq_rsp {
4218c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
4228c2ecf20Sopenharmony_ci	union {
4238c2ecf20Sopenharmony_ci		/* Valid when op == READ and ctype == AURA */
4248c2ecf20Sopenharmony_ci		struct npa_aura_s aura;
4258c2ecf20Sopenharmony_ci		/* Valid when op == READ and ctype == POOL */
4268c2ecf20Sopenharmony_ci		struct npa_pool_s pool;
4278c2ecf20Sopenharmony_ci	};
4288c2ecf20Sopenharmony_ci};
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/* Disable all contexts of type 'ctype' */
4318c2ecf20Sopenharmony_cistruct hwctx_disable_req {
4328c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
4338c2ecf20Sopenharmony_ci	u8 ctype;
4348c2ecf20Sopenharmony_ci};
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci/* NIX mbox message formats */
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci/* NIX mailbox error codes
4398c2ecf20Sopenharmony_ci * Range 401 - 500.
4408c2ecf20Sopenharmony_ci */
4418c2ecf20Sopenharmony_cienum nix_af_status {
4428c2ecf20Sopenharmony_ci	NIX_AF_ERR_PARAM            = -401,
4438c2ecf20Sopenharmony_ci	NIX_AF_ERR_AQ_FULL          = -402,
4448c2ecf20Sopenharmony_ci	NIX_AF_ERR_AQ_ENQUEUE       = -403,
4458c2ecf20Sopenharmony_ci	NIX_AF_ERR_AF_LF_INVALID    = -404,
4468c2ecf20Sopenharmony_ci	NIX_AF_ERR_AF_LF_ALLOC      = -405,
4478c2ecf20Sopenharmony_ci	NIX_AF_ERR_TLX_ALLOC_FAIL   = -406,
4488c2ecf20Sopenharmony_ci	NIX_AF_ERR_TLX_INVALID      = -407,
4498c2ecf20Sopenharmony_ci	NIX_AF_ERR_RSS_SIZE_INVALID = -408,
4508c2ecf20Sopenharmony_ci	NIX_AF_ERR_RSS_GRPS_INVALID = -409,
4518c2ecf20Sopenharmony_ci	NIX_AF_ERR_FRS_INVALID      = -410,
4528c2ecf20Sopenharmony_ci	NIX_AF_ERR_RX_LINK_INVALID  = -411,
4538c2ecf20Sopenharmony_ci	NIX_AF_INVAL_TXSCHQ_CFG     = -412,
4548c2ecf20Sopenharmony_ci	NIX_AF_SMQ_FLUSH_FAILED     = -413,
4558c2ecf20Sopenharmony_ci	NIX_AF_ERR_LF_RESET         = -414,
4568c2ecf20Sopenharmony_ci	NIX_AF_ERR_RSS_NOSPC_FIELD  = -415,
4578c2ecf20Sopenharmony_ci	NIX_AF_ERR_RSS_NOSPC_ALGO   = -416,
4588c2ecf20Sopenharmony_ci	NIX_AF_ERR_MARK_CFG_FAIL    = -417,
4598c2ecf20Sopenharmony_ci	NIX_AF_ERR_LSO_CFG_FAIL     = -418,
4608c2ecf20Sopenharmony_ci	NIX_AF_INVAL_NPA_PF_FUNC    = -419,
4618c2ecf20Sopenharmony_ci	NIX_AF_INVAL_SSO_PF_FUNC    = -420,
4628c2ecf20Sopenharmony_ci};
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci/* For NIX LF context alloc and init */
4658c2ecf20Sopenharmony_cistruct nix_lf_alloc_req {
4668c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
4678c2ecf20Sopenharmony_ci	int node;
4688c2ecf20Sopenharmony_ci	u32 rq_cnt;   /* No of receive queues */
4698c2ecf20Sopenharmony_ci	u32 sq_cnt;   /* No of send queues */
4708c2ecf20Sopenharmony_ci	u32 cq_cnt;   /* No of completion queues */
4718c2ecf20Sopenharmony_ci	u8  xqe_sz;
4728c2ecf20Sopenharmony_ci	u16 rss_sz;
4738c2ecf20Sopenharmony_ci	u8  rss_grps;
4748c2ecf20Sopenharmony_ci	u16 npa_func;
4758c2ecf20Sopenharmony_ci	u16 sso_func;
4768c2ecf20Sopenharmony_ci	u64 rx_cfg;   /* See NIX_AF_LF(0..127)_RX_CFG */
4778c2ecf20Sopenharmony_ci	u64 way_mask;
4788c2ecf20Sopenharmony_ci};
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_cistruct nix_lf_alloc_rsp {
4818c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
4828c2ecf20Sopenharmony_ci	u16	sqb_size;
4838c2ecf20Sopenharmony_ci	u16	rx_chan_base;
4848c2ecf20Sopenharmony_ci	u16	tx_chan_base;
4858c2ecf20Sopenharmony_ci	u8      rx_chan_cnt; /* total number of RX channels */
4868c2ecf20Sopenharmony_ci	u8      tx_chan_cnt; /* total number of TX channels */
4878c2ecf20Sopenharmony_ci	u8	lso_tsov4_idx;
4888c2ecf20Sopenharmony_ci	u8	lso_tsov6_idx;
4898c2ecf20Sopenharmony_ci	u8      mac_addr[ETH_ALEN];
4908c2ecf20Sopenharmony_ci	u8	lf_rx_stats; /* NIX_AF_CONST1::LF_RX_STATS */
4918c2ecf20Sopenharmony_ci	u8	lf_tx_stats; /* NIX_AF_CONST1::LF_TX_STATS */
4928c2ecf20Sopenharmony_ci	u16	cints; /* NIX_AF_CONST2::CINTS */
4938c2ecf20Sopenharmony_ci	u16	qints; /* NIX_AF_CONST2::QINTS */
4948c2ecf20Sopenharmony_ci};
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/* NIX AQ enqueue msg */
4978c2ecf20Sopenharmony_cistruct nix_aq_enq_req {
4988c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
4998c2ecf20Sopenharmony_ci	u32  qidx;
5008c2ecf20Sopenharmony_ci	u8 ctype;
5018c2ecf20Sopenharmony_ci	u8 op;
5028c2ecf20Sopenharmony_ci	union {
5038c2ecf20Sopenharmony_ci		struct nix_rq_ctx_s rq;
5048c2ecf20Sopenharmony_ci		struct nix_sq_ctx_s sq;
5058c2ecf20Sopenharmony_ci		struct nix_cq_ctx_s cq;
5068c2ecf20Sopenharmony_ci		struct nix_rsse_s   rss;
5078c2ecf20Sopenharmony_ci		struct nix_rx_mce_s mce;
5088c2ecf20Sopenharmony_ci	};
5098c2ecf20Sopenharmony_ci	union {
5108c2ecf20Sopenharmony_ci		struct nix_rq_ctx_s rq_mask;
5118c2ecf20Sopenharmony_ci		struct nix_sq_ctx_s sq_mask;
5128c2ecf20Sopenharmony_ci		struct nix_cq_ctx_s cq_mask;
5138c2ecf20Sopenharmony_ci		struct nix_rsse_s   rss_mask;
5148c2ecf20Sopenharmony_ci		struct nix_rx_mce_s mce_mask;
5158c2ecf20Sopenharmony_ci	};
5168c2ecf20Sopenharmony_ci};
5178c2ecf20Sopenharmony_ci
5188c2ecf20Sopenharmony_cistruct nix_aq_enq_rsp {
5198c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
5208c2ecf20Sopenharmony_ci	union {
5218c2ecf20Sopenharmony_ci		struct nix_rq_ctx_s rq;
5228c2ecf20Sopenharmony_ci		struct nix_sq_ctx_s sq;
5238c2ecf20Sopenharmony_ci		struct nix_cq_ctx_s cq;
5248c2ecf20Sopenharmony_ci		struct nix_rsse_s   rss;
5258c2ecf20Sopenharmony_ci		struct nix_rx_mce_s mce;
5268c2ecf20Sopenharmony_ci	};
5278c2ecf20Sopenharmony_ci};
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci/* Tx scheduler/shaper mailbox messages */
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ci#define MAX_TXSCHQ_PER_FUNC		128
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_cistruct nix_txsch_alloc_req {
5348c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
5358c2ecf20Sopenharmony_ci	/* Scheduler queue count request at each level */
5368c2ecf20Sopenharmony_ci	u16 schq_contig[NIX_TXSCH_LVL_CNT]; /* No of contiguous queues */
5378c2ecf20Sopenharmony_ci	u16 schq[NIX_TXSCH_LVL_CNT]; /* No of non-contiguous queues */
5388c2ecf20Sopenharmony_ci};
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_cistruct nix_txsch_alloc_rsp {
5418c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
5428c2ecf20Sopenharmony_ci	/* Scheduler queue count allocated at each level */
5438c2ecf20Sopenharmony_ci	u16 schq_contig[NIX_TXSCH_LVL_CNT];
5448c2ecf20Sopenharmony_ci	u16 schq[NIX_TXSCH_LVL_CNT];
5458c2ecf20Sopenharmony_ci	/* Scheduler queue list allocated at each level */
5468c2ecf20Sopenharmony_ci	u16 schq_contig_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
5478c2ecf20Sopenharmony_ci	u16 schq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
5488c2ecf20Sopenharmony_ci	u8  aggr_level; /* Traffic aggregation scheduler level */
5498c2ecf20Sopenharmony_ci	u8  aggr_lvl_rr_prio; /* Aggregation lvl's RR_PRIO config */
5508c2ecf20Sopenharmony_ci	u8  link_cfg_lvl; /* LINKX_CFG CSRs mapped to TL3 or TL2's index ? */
5518c2ecf20Sopenharmony_ci};
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_cistruct nix_txsch_free_req {
5548c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
5558c2ecf20Sopenharmony_ci#define TXSCHQ_FREE_ALL BIT_ULL(0)
5568c2ecf20Sopenharmony_ci	u16 flags;
5578c2ecf20Sopenharmony_ci	/* Scheduler queue level to be freed */
5588c2ecf20Sopenharmony_ci	u16 schq_lvl;
5598c2ecf20Sopenharmony_ci	/* List of scheduler queues to be freed */
5608c2ecf20Sopenharmony_ci	u16 schq;
5618c2ecf20Sopenharmony_ci};
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_cistruct nix_txschq_config {
5648c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
5658c2ecf20Sopenharmony_ci	u8 lvl;	/* SMQ/MDQ/TL4/TL3/TL2/TL1 */
5668c2ecf20Sopenharmony_ci#define TXSCHQ_IDX_SHIFT	16
5678c2ecf20Sopenharmony_ci#define TXSCHQ_IDX_MASK		(BIT_ULL(10) - 1)
5688c2ecf20Sopenharmony_ci#define TXSCHQ_IDX(reg, shift)	(((reg) >> (shift)) & TXSCHQ_IDX_MASK)
5698c2ecf20Sopenharmony_ci	u8 num_regs;
5708c2ecf20Sopenharmony_ci#define MAX_REGS_PER_MBOX_MSG	20
5718c2ecf20Sopenharmony_ci	u64 reg[MAX_REGS_PER_MBOX_MSG];
5728c2ecf20Sopenharmony_ci	u64 regval[MAX_REGS_PER_MBOX_MSG];
5738c2ecf20Sopenharmony_ci};
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_cistruct nix_vtag_config {
5768c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
5778c2ecf20Sopenharmony_ci	/* '0' for 4 octet VTAG, '1' for 8 octet VTAG */
5788c2ecf20Sopenharmony_ci	u8 vtag_size;
5798c2ecf20Sopenharmony_ci	/* cfg_type is '0' for tx vlan cfg
5808c2ecf20Sopenharmony_ci	 * cfg_type is '1' for rx vlan cfg
5818c2ecf20Sopenharmony_ci	 */
5828c2ecf20Sopenharmony_ci	u8 cfg_type;
5838c2ecf20Sopenharmony_ci	union {
5848c2ecf20Sopenharmony_ci		/* valid when cfg_type is '0' */
5858c2ecf20Sopenharmony_ci		struct {
5868c2ecf20Sopenharmony_ci			/* tx vlan0 tag(C-VLAN) */
5878c2ecf20Sopenharmony_ci			u64 vlan0;
5888c2ecf20Sopenharmony_ci			/* tx vlan1 tag(S-VLAN) */
5898c2ecf20Sopenharmony_ci			u64 vlan1;
5908c2ecf20Sopenharmony_ci			/* insert tx vlan tag */
5918c2ecf20Sopenharmony_ci			u8 insert_vlan :1;
5928c2ecf20Sopenharmony_ci			/* insert tx double vlan tag */
5938c2ecf20Sopenharmony_ci			u8 double_vlan :1;
5948c2ecf20Sopenharmony_ci		} tx;
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci		/* valid when cfg_type is '1' */
5978c2ecf20Sopenharmony_ci		struct {
5988c2ecf20Sopenharmony_ci			/* rx vtag type index, valid values are in 0..7 range */
5998c2ecf20Sopenharmony_ci			u8 vtag_type;
6008c2ecf20Sopenharmony_ci			/* rx vtag strip */
6018c2ecf20Sopenharmony_ci			u8 strip_vtag :1;
6028c2ecf20Sopenharmony_ci			/* rx vtag capture */
6038c2ecf20Sopenharmony_ci			u8 capture_vtag :1;
6048c2ecf20Sopenharmony_ci		} rx;
6058c2ecf20Sopenharmony_ci	};
6068c2ecf20Sopenharmony_ci};
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_cistruct nix_rss_flowkey_cfg {
6098c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6108c2ecf20Sopenharmony_ci	int	mcam_index;  /* MCAM entry index to modify */
6118c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_PORT	BIT(0)
6128c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_IPV4	BIT(1)
6138c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_IPV6	BIT(2)
6148c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_TCP	BIT(3)
6158c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_UDP	BIT(4)
6168c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_SCTP	BIT(5)
6178c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_NVGRE    BIT(6)
6188c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_VXLAN    BIT(7)
6198c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_GENEVE   BIT(8)
6208c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_ETH_DMAC BIT(9)
6218c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_IPV6_EXT BIT(10)
6228c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_GTPU       BIT(11)
6238c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_INNR_IPV4     BIT(12)
6248c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_INNR_IPV6     BIT(13)
6258c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_INNR_TCP      BIT(14)
6268c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_INNR_UDP      BIT(15)
6278c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_INNR_SCTP     BIT(16)
6288c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_INNR_ETH_DMAC BIT(17)
6298c2ecf20Sopenharmony_ci#define NIX_FLOW_KEY_TYPE_VLAN		BIT(20)
6308c2ecf20Sopenharmony_ci	u32	flowkey_cfg; /* Flowkey types selected */
6318c2ecf20Sopenharmony_ci	u8	group;       /* RSS context or group */
6328c2ecf20Sopenharmony_ci};
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_cistruct nix_rss_flowkey_cfg_rsp {
6358c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6368c2ecf20Sopenharmony_ci	u8	alg_idx; /* Selected algo index */
6378c2ecf20Sopenharmony_ci};
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_cistruct nix_set_mac_addr {
6408c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6418c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN]; /* MAC address to be set for this pcifunc */
6428c2ecf20Sopenharmony_ci};
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_cistruct nix_get_mac_addr_rsp {
6458c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6468c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];
6478c2ecf20Sopenharmony_ci};
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_cistruct nix_mark_format_cfg {
6508c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6518c2ecf20Sopenharmony_ci	u8 offset;
6528c2ecf20Sopenharmony_ci	u8 y_mask;
6538c2ecf20Sopenharmony_ci	u8 y_val;
6548c2ecf20Sopenharmony_ci	u8 r_mask;
6558c2ecf20Sopenharmony_ci	u8 r_val;
6568c2ecf20Sopenharmony_ci};
6578c2ecf20Sopenharmony_ci
6588c2ecf20Sopenharmony_cistruct nix_mark_format_cfg_rsp {
6598c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6608c2ecf20Sopenharmony_ci	u8 mark_format_idx;
6618c2ecf20Sopenharmony_ci};
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_cistruct nix_rx_mode {
6648c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6658c2ecf20Sopenharmony_ci#define NIX_RX_MODE_UCAST	BIT(0)
6668c2ecf20Sopenharmony_ci#define NIX_RX_MODE_PROMISC	BIT(1)
6678c2ecf20Sopenharmony_ci#define NIX_RX_MODE_ALLMULTI	BIT(2)
6688c2ecf20Sopenharmony_ci	u16	mode;
6698c2ecf20Sopenharmony_ci};
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_cistruct nix_rx_cfg {
6728c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6738c2ecf20Sopenharmony_ci#define NIX_RX_OL3_VERIFY   BIT(0)
6748c2ecf20Sopenharmony_ci#define NIX_RX_OL4_VERIFY   BIT(1)
6758c2ecf20Sopenharmony_ci	u8 len_verify; /* Outer L3/L4 len check */
6768c2ecf20Sopenharmony_ci#define NIX_RX_CSUM_OL4_VERIFY  BIT(0)
6778c2ecf20Sopenharmony_ci	u8 csum_verify; /* Outer L4 checksum verification */
6788c2ecf20Sopenharmony_ci};
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_cistruct nix_frs_cfg {
6818c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6828c2ecf20Sopenharmony_ci	u8	update_smq;    /* Update SMQ's min/max lens */
6838c2ecf20Sopenharmony_ci	u8	update_minlen; /* Set minlen also */
6848c2ecf20Sopenharmony_ci	u8	sdp_link;      /* Set SDP RX link */
6858c2ecf20Sopenharmony_ci	u16	maxlen;
6868c2ecf20Sopenharmony_ci	u16	minlen;
6878c2ecf20Sopenharmony_ci};
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_cistruct nix_lso_format_cfg {
6908c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6918c2ecf20Sopenharmony_ci	u64 field_mask;
6928c2ecf20Sopenharmony_ci#define NIX_LSO_FIELD_MAX	8
6938c2ecf20Sopenharmony_ci	u64 fields[NIX_LSO_FIELD_MAX];
6948c2ecf20Sopenharmony_ci};
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_cistruct nix_lso_format_cfg_rsp {
6978c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
6988c2ecf20Sopenharmony_ci	u8 lso_format_idx;
6998c2ecf20Sopenharmony_ci};
7008c2ecf20Sopenharmony_ci
7018c2ecf20Sopenharmony_cistruct nix_bp_cfg_req {
7028c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7038c2ecf20Sopenharmony_ci	u16	chan_base; /* Starting channel number */
7048c2ecf20Sopenharmony_ci	u8	chan_cnt; /* Number of channels */
7058c2ecf20Sopenharmony_ci	u8	bpid_per_chan;
7068c2ecf20Sopenharmony_ci	/* bpid_per_chan = 0 assigns single bp id for range of channels */
7078c2ecf20Sopenharmony_ci	/* bpid_per_chan = 1 assigns separate bp id for each channel */
7088c2ecf20Sopenharmony_ci};
7098c2ecf20Sopenharmony_ci
7108c2ecf20Sopenharmony_ci/* PF can be mapped to either CGX or LBK interface,
7118c2ecf20Sopenharmony_ci * so maximum 64 channels are possible.
7128c2ecf20Sopenharmony_ci */
7138c2ecf20Sopenharmony_ci#define NIX_MAX_BPID_CHAN	64
7148c2ecf20Sopenharmony_cistruct nix_bp_cfg_rsp {
7158c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7168c2ecf20Sopenharmony_ci	u16	chan_bpid[NIX_MAX_BPID_CHAN]; /* Channel and bpid mapping */
7178c2ecf20Sopenharmony_ci	u8	chan_cnt; /* Number of channel for which bpids are assigned */
7188c2ecf20Sopenharmony_ci};
7198c2ecf20Sopenharmony_ci
7208c2ecf20Sopenharmony_ci/* NPC mbox message structs */
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci#define NPC_MCAM_ENTRY_INVALID	0xFFFF
7238c2ecf20Sopenharmony_ci#define NPC_MCAM_INVALID_MAP	0xFFFF
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci/* NPC mailbox error codes
7268c2ecf20Sopenharmony_ci * Range 701 - 800.
7278c2ecf20Sopenharmony_ci */
7288c2ecf20Sopenharmony_cienum npc_af_status {
7298c2ecf20Sopenharmony_ci	NPC_MCAM_INVALID_REQ	= -701,
7308c2ecf20Sopenharmony_ci	NPC_MCAM_ALLOC_DENIED	= -702,
7318c2ecf20Sopenharmony_ci	NPC_MCAM_ALLOC_FAILED	= -703,
7328c2ecf20Sopenharmony_ci	NPC_MCAM_PERM_DENIED	= -704,
7338c2ecf20Sopenharmony_ci};
7348c2ecf20Sopenharmony_ci
7358c2ecf20Sopenharmony_cistruct npc_mcam_alloc_entry_req {
7368c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7378c2ecf20Sopenharmony_ci#define NPC_MAX_NONCONTIG_ENTRIES	256
7388c2ecf20Sopenharmony_ci	u8  contig;   /* Contiguous entries ? */
7398c2ecf20Sopenharmony_ci#define NPC_MCAM_ANY_PRIO		0
7408c2ecf20Sopenharmony_ci#define NPC_MCAM_LOWER_PRIO		1
7418c2ecf20Sopenharmony_ci#define NPC_MCAM_HIGHER_PRIO		2
7428c2ecf20Sopenharmony_ci	u8  priority; /* Lower or higher w.r.t ref_entry */
7438c2ecf20Sopenharmony_ci	u16 ref_entry;
7448c2ecf20Sopenharmony_ci	u16 count;    /* Number of entries requested */
7458c2ecf20Sopenharmony_ci};
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_cistruct npc_mcam_alloc_entry_rsp {
7488c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7498c2ecf20Sopenharmony_ci	u16 entry; /* Entry allocated or start index if contiguous.
7508c2ecf20Sopenharmony_ci		    * Invalid incase of non-contiguous.
7518c2ecf20Sopenharmony_ci		    */
7528c2ecf20Sopenharmony_ci	u16 count; /* Number of entries allocated */
7538c2ecf20Sopenharmony_ci	u16 free_count; /* Number of entries available */
7548c2ecf20Sopenharmony_ci	u16 entry_list[NPC_MAX_NONCONTIG_ENTRIES];
7558c2ecf20Sopenharmony_ci};
7568c2ecf20Sopenharmony_ci
7578c2ecf20Sopenharmony_cistruct npc_mcam_free_entry_req {
7588c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7598c2ecf20Sopenharmony_ci	u16 entry; /* Entry index to be freed */
7608c2ecf20Sopenharmony_ci	u8  all;   /* If all entries allocated to this PFVF to be freed */
7618c2ecf20Sopenharmony_ci};
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_cistruct mcam_entry {
7648c2ecf20Sopenharmony_ci#define NPC_MAX_KWS_IN_KEY	7 /* Number of keywords in max keywidth */
7658c2ecf20Sopenharmony_ci	u64	kw[NPC_MAX_KWS_IN_KEY];
7668c2ecf20Sopenharmony_ci	u64	kw_mask[NPC_MAX_KWS_IN_KEY];
7678c2ecf20Sopenharmony_ci	u64	action;
7688c2ecf20Sopenharmony_ci	u64	vtag_action;
7698c2ecf20Sopenharmony_ci};
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_cistruct npc_mcam_write_entry_req {
7728c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7738c2ecf20Sopenharmony_ci	struct mcam_entry entry_data;
7748c2ecf20Sopenharmony_ci	u16 entry;	 /* MCAM entry to write this match key */
7758c2ecf20Sopenharmony_ci	u16 cntr;	 /* Counter for this MCAM entry */
7768c2ecf20Sopenharmony_ci	u8  intf;	 /* Rx or Tx interface */
7778c2ecf20Sopenharmony_ci	u8  enable_entry;/* Enable this MCAM entry ? */
7788c2ecf20Sopenharmony_ci	u8  set_cntr;    /* Set counter for this entry ? */
7798c2ecf20Sopenharmony_ci};
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_ci/* Enable/Disable a given entry */
7828c2ecf20Sopenharmony_cistruct npc_mcam_ena_dis_entry_req {
7838c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7848c2ecf20Sopenharmony_ci	u16 entry;
7858c2ecf20Sopenharmony_ci};
7868c2ecf20Sopenharmony_ci
7878c2ecf20Sopenharmony_cistruct npc_mcam_shift_entry_req {
7888c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7898c2ecf20Sopenharmony_ci#define NPC_MCAM_MAX_SHIFTS	64
7908c2ecf20Sopenharmony_ci	u16 curr_entry[NPC_MCAM_MAX_SHIFTS];
7918c2ecf20Sopenharmony_ci	u16 new_entry[NPC_MCAM_MAX_SHIFTS];
7928c2ecf20Sopenharmony_ci	u16 shift_count; /* Number of entries to shift */
7938c2ecf20Sopenharmony_ci};
7948c2ecf20Sopenharmony_ci
7958c2ecf20Sopenharmony_cistruct npc_mcam_shift_entry_rsp {
7968c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
7978c2ecf20Sopenharmony_ci	u16 failed_entry_idx; /* Index in 'curr_entry', not entry itself */
7988c2ecf20Sopenharmony_ci};
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_cistruct npc_mcam_alloc_counter_req {
8018c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8028c2ecf20Sopenharmony_ci	u8  contig;	/* Contiguous counters ? */
8038c2ecf20Sopenharmony_ci#define NPC_MAX_NONCONTIG_COUNTERS       64
8048c2ecf20Sopenharmony_ci	u16 count;	/* Number of counters requested */
8058c2ecf20Sopenharmony_ci};
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_cistruct npc_mcam_alloc_counter_rsp {
8088c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8098c2ecf20Sopenharmony_ci	u16 cntr;   /* Counter allocated or start index if contiguous.
8108c2ecf20Sopenharmony_ci		     * Invalid incase of non-contiguous.
8118c2ecf20Sopenharmony_ci		     */
8128c2ecf20Sopenharmony_ci	u16 count;  /* Number of counters allocated */
8138c2ecf20Sopenharmony_ci	u16 cntr_list[NPC_MAX_NONCONTIG_COUNTERS];
8148c2ecf20Sopenharmony_ci};
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_cistruct npc_mcam_oper_counter_req {
8178c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8188c2ecf20Sopenharmony_ci	u16 cntr;   /* Free a counter or clear/fetch it's stats */
8198c2ecf20Sopenharmony_ci};
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_cistruct npc_mcam_oper_counter_rsp {
8228c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8238c2ecf20Sopenharmony_ci	u64 stat;  /* valid only while fetching counter's stats */
8248c2ecf20Sopenharmony_ci};
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_cistruct npc_mcam_unmap_counter_req {
8278c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8288c2ecf20Sopenharmony_ci	u16 cntr;
8298c2ecf20Sopenharmony_ci	u16 entry; /* Entry and counter to be unmapped */
8308c2ecf20Sopenharmony_ci	u8  all;   /* Unmap all entries using this counter ? */
8318c2ecf20Sopenharmony_ci};
8328c2ecf20Sopenharmony_ci
8338c2ecf20Sopenharmony_cistruct npc_mcam_alloc_and_write_entry_req {
8348c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8358c2ecf20Sopenharmony_ci	struct mcam_entry entry_data;
8368c2ecf20Sopenharmony_ci	u16 ref_entry;
8378c2ecf20Sopenharmony_ci	u8  priority;    /* Lower or higher w.r.t ref_entry */
8388c2ecf20Sopenharmony_ci	u8  intf;	 /* Rx or Tx interface */
8398c2ecf20Sopenharmony_ci	u8  enable_entry;/* Enable this MCAM entry ? */
8408c2ecf20Sopenharmony_ci	u8  alloc_cntr;  /* Allocate counter and map ? */
8418c2ecf20Sopenharmony_ci};
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_cistruct npc_mcam_alloc_and_write_entry_rsp {
8448c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8458c2ecf20Sopenharmony_ci	u16 entry;
8468c2ecf20Sopenharmony_ci	u16 cntr;
8478c2ecf20Sopenharmony_ci};
8488c2ecf20Sopenharmony_ci
8498c2ecf20Sopenharmony_cistruct npc_get_kex_cfg_rsp {
8508c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8518c2ecf20Sopenharmony_ci	u64 rx_keyx_cfg;   /* NPC_AF_INTF(0)_KEX_CFG */
8528c2ecf20Sopenharmony_ci	u64 tx_keyx_cfg;   /* NPC_AF_INTF(1)_KEX_CFG */
8538c2ecf20Sopenharmony_ci#define NPC_MAX_INTF	2
8548c2ecf20Sopenharmony_ci#define NPC_MAX_LID	8
8558c2ecf20Sopenharmony_ci#define NPC_MAX_LT	16
8568c2ecf20Sopenharmony_ci#define NPC_MAX_LD	2
8578c2ecf20Sopenharmony_ci#define NPC_MAX_LFL	16
8588c2ecf20Sopenharmony_ci	/* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */
8598c2ecf20Sopenharmony_ci	u64 kex_ld_flags[NPC_MAX_LD];
8608c2ecf20Sopenharmony_ci	/* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG */
8618c2ecf20Sopenharmony_ci	u64 intf_lid_lt_ld[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];
8628c2ecf20Sopenharmony_ci	/* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG */
8638c2ecf20Sopenharmony_ci	u64 intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
8648c2ecf20Sopenharmony_ci#define MKEX_NAME_LEN 128
8658c2ecf20Sopenharmony_ci	u8 mkex_pfl_name[MKEX_NAME_LEN];
8668c2ecf20Sopenharmony_ci};
8678c2ecf20Sopenharmony_ci
8688c2ecf20Sopenharmony_cienum ptp_op {
8698c2ecf20Sopenharmony_ci	PTP_OP_ADJFINE = 0,
8708c2ecf20Sopenharmony_ci	PTP_OP_GET_CLOCK = 1,
8718c2ecf20Sopenharmony_ci};
8728c2ecf20Sopenharmony_ci
8738c2ecf20Sopenharmony_cistruct ptp_req {
8748c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8758c2ecf20Sopenharmony_ci	u8 op;
8768c2ecf20Sopenharmony_ci	s64 scaled_ppm;
8778c2ecf20Sopenharmony_ci};
8788c2ecf20Sopenharmony_ci
8798c2ecf20Sopenharmony_cistruct ptp_rsp {
8808c2ecf20Sopenharmony_ci	struct mbox_msghdr hdr;
8818c2ecf20Sopenharmony_ci	u64 clk;
8828c2ecf20Sopenharmony_ci};
8838c2ecf20Sopenharmony_ci
8848c2ecf20Sopenharmony_ci#endif /* MBOX_H */
885