linux/drivers/net/ethernet/marvell/octeontx2/af/mbox.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Marvell RVU Admin Function driver
 *
 * Copyright (C) 2018 Marvell.
 *
 */

#ifndef MBOX_H
#define MBOX_H

#include <linux/etherdevice.h>
#include <linux/sizes.h>

#include "rvu_struct.h"
#include "common.h"

#define MBOX_SIZE

#define MBOX_DOWN_MSG
#define MBOX_UP_MSG

/* AF/PF: PF initiated, PF/VF VF initiated */
#define MBOX_DOWN_RX_START
#define MBOX_DOWN_RX_SIZE
#define MBOX_DOWN_TX_START
#define MBOX_DOWN_TX_SIZE
/* AF/PF: AF initiated, PF/VF PF initiated */
#define MBOX_UP_RX_START
#define MBOX_UP_RX_SIZE
#define MBOX_UP_TX_START
#define MBOX_UP_TX_SIZE

#if MBOX_UP_TX_SIZE + MBOX_UP_TX_START != MBOX_SIZE
# error "incorrect mailbox area sizes"
#endif

#define INTR_MASK(pfvfs)

#define MBOX_RSP_TIMEOUT

#define MBOX_MSG_ALIGN

/* Mailbox directions */
#define MBOX_DIR_AFPF
#define MBOX_DIR_PFAF
#define MBOX_DIR_PFVF
#define MBOX_DIR_VFPF
#define MBOX_DIR_AFPF_UP
#define MBOX_DIR_PFAF_UP
#define MBOX_DIR_PFVF_UP
#define MBOX_DIR_VFPF_UP

struct otx2_mbox_dev {};

struct otx2_mbox {};

/* Header which precedes all mbox messages */
struct mbox_hdr {};

/* Header which precedes every msg and is also part of it */
struct mbox_msghdr {};

void otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
void __otx2_mbox_reset(struct otx2_mbox *mbox, int devid);
void otx2_mbox_destroy(struct otx2_mbox *mbox);
int otx2_mbox_init(struct otx2_mbox *mbox, void __force *hwbase,
		   struct pci_dev *pdev, void __force *reg_base,
		   int direction, int ndevs);

int otx2_mbox_regions_init(struct otx2_mbox *mbox, void __force **hwbase,
			   struct pci_dev *pdev, void __force *reg_base,
			   int direction, int ndevs, unsigned long *bmap);
void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid);
void otx2_mbox_msg_send_up(struct otx2_mbox *mbox, int devid);
int otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid);
int otx2_mbox_busy_poll_for_rsp(struct otx2_mbox *mbox, int devid);
struct mbox_msghdr *otx2_mbox_alloc_msg_rsp(struct otx2_mbox *mbox, int devid,
					    int size, int size_rsp);
struct mbox_msghdr *otx2_mbox_get_rsp(struct otx2_mbox *mbox, int devid,
				      struct mbox_msghdr *msg);
int otx2_mbox_check_rsp_msgs(struct otx2_mbox *mbox, int devid);
int otx2_reply_invalid_msg(struct otx2_mbox *mbox, int devid,
			   u16 pcifunc, u16 id);
bool otx2_mbox_nonempty(struct otx2_mbox *mbox, int devid);
const char *otx2_mbox_id2name(u16 id);
static inline struct mbox_msghdr *otx2_mbox_alloc_msg(struct otx2_mbox *mbox,
						      int devid, int size)
{}

bool otx2_mbox_wait_for_zero(struct otx2_mbox *mbox, int devid);

/* Mailbox message types */
#define MBOX_MSG_MASK
#define MBOX_MSG_INVALID
#define MBOX_MSG_MAX

#define MBOX_MESSAGES

/* Messages initiated by AF (range 0xC00 - 0xEFF) */
#define MBOX_UP_CGX_MESSAGES

#define MBOX_UP_CPT_MESSAGES

#define MBOX_UP_MCS_MESSAGES

enum {};

/* Mailbox message formats */

#define RVU_DEFAULT_PF_FUNC

/* Generic request msg used for those mbox messages which
 * don't send any data in the request.
 */
struct msg_req {};

/* Generic response msg used an ack or response for those mbox
 * messages which don't have a specific rsp msg format.
 */
struct msg_rsp {};

/* RVU mailbox error codes
 * Range 256 - 300.
 */
enum rvu_af_status {};

struct ready_msg_rsp {};

/* Structure for requesting resource provisioning.
 * 'modify' flag to be used when either requesting more
 * or to detach partial of a certain resource type.
 * Rest of the fields specify how many of what type to
 * be attached.
 * To request LFs from two blocks of same type this mailbox
 * can be sent twice as below:
 *      struct rsrc_attach *attach;
 *       .. Allocate memory for message ..
 *       attach->cptlfs = 3; <3 LFs from CPT0>
 *       .. Send message ..
 *       .. Allocate memory for message ..
 *       attach->modify = 1;
 *       attach->cpt_blkaddr = BLKADDR_CPT1;
 *       attach->cptlfs = 2; <2 LFs from CPT1>
 *       .. Send message ..
 */
struct rsrc_attach {};

/* Structure for relinquishing resources.
 * 'partial' flag to be used when relinquishing all resources
 * but only of a certain type. If not set, all resources of all
 * types provisioned to the RVU function will be detached.
 */
struct rsrc_detach {};

/* Number of resources available to the caller.
 * In reply to MBOX_MSG_FREE_RSRC_CNT.
 */
struct free_rsrcs_rsp {};

#define MSIX_VECTOR_INVALID
#define MAX_RVU_BLKLF_CNT

struct msix_offset_rsp {};

struct get_hw_cap_rsp {};

/* CGX mbox message formats */

struct cgx_stats_rsp {};

struct cgx_fec_stats_rsp {};
/* Structure for requesting the operation for
 * setting/getting mac address in the CGX interface
 */
struct cgx_mac_addr_set_or_get {};

/* Structure for requesting the operation to
 * add DMAC filter entry into CGX interface
 */
struct cgx_mac_addr_add_req {};

/* Structure for response against the operation to
 * add DMAC filter entry into CGX interface
 */
struct cgx_mac_addr_add_rsp {};

/* Structure for requesting the operation to
 * delete DMAC filter entry from CGX interface
 */
struct cgx_mac_addr_del_req {};

/* Structure for response against the operation to
 * get maximum supported DMAC filter entries
 */
struct cgx_max_dmac_entries_get_rsp {};

struct cgx_link_user_info {};

struct cgx_link_info_msg {};

struct cgx_pause_frm_cfg {};

enum fec_type {};

struct fec_mode {};

struct sfp_eeprom_s {};

struct phy_s {};

struct cgx_lmac_fwdata_s {};

struct cgx_fw_data {};

struct cgx_set_link_mode_args {};

struct cgx_set_link_mode_req {};

struct cgx_set_link_mode_rsp {};

struct cgx_mac_addr_reset_req {};

struct cgx_mac_addr_update_req {};

struct cgx_mac_addr_update_rsp {};

#define RVU_LMAC_FEAT_FC
#define RVU_LMAC_FEAT_HIGIG2
			/* flow control from physical link higig2 messages */
#define RVU_LMAC_FEAT_PTP
#define RVU_LMAC_FEAT_DMACF
#define RVU_MAC_VERSION
#define RVU_MAC_CGX
#define RVU_MAC_RPM

struct cgx_features_info_msg {};

struct rpm_stats_rsp {};

struct cgx_pfc_cfg {};

struct cgx_pfc_rsp {};

 /* NPA mbox message formats */

struct npc_set_pkind {};

/* NPA mbox message formats */

/* NPA mailbox error codes
 * Range 301 - 400.
 */
enum npa_af_status {};

/* For NPA LF context alloc and init */
struct npa_lf_alloc_req {};

struct npa_lf_alloc_rsp {};

/* NPA AQ enqueue msg */
struct npa_aq_enq_req {};

struct npa_aq_enq_rsp {};

/* Disable all contexts of type 'ctype' */
struct hwctx_disable_req {};

/* NIX mbox message formats */

/* NIX mailbox error codes
 * Range 401 - 500.
 */
enum nix_af_status {};

/* For NIX RX vtag action  */
enum nix_rx_vtag0_type {};

/* For NIX LF context alloc and init */
struct nix_lf_alloc_req {};

struct nix_lf_alloc_rsp {};

struct nix_lf_free_req {};

/* CN10K NIX AQ enqueue msg */
struct nix_cn10k_aq_enq_req {};

struct nix_cn10k_aq_enq_rsp {};

/* NIX AQ enqueue msg */
struct nix_aq_enq_req {};

struct nix_aq_enq_rsp {};

/* Tx scheduler/shaper mailbox messages */

#define MAX_TXSCHQ_PER_FUNC

struct nix_txsch_alloc_req {};

struct nix_txsch_alloc_rsp {};

struct nix_txsch_free_req {};

struct nix_txschq_config {};

struct nix_vtag_config {};

struct nix_vtag_config_rsp {};

#define NIX_FLOW_KEY_TYPE_L3_L4_MASK

struct nix_rss_flowkey_cfg {};

struct nix_rss_flowkey_cfg_rsp {};

struct nix_set_mac_addr {};

struct nix_get_mac_addr_rsp {};

struct nix_mark_format_cfg {};

struct nix_mark_format_cfg_rsp {};

struct nix_rx_mode {};

struct nix_rx_cfg {};

struct nix_frs_cfg {};

struct nix_lso_format_cfg {};

struct nix_lso_format_cfg_rsp {};

struct nix_bp_cfg_req {};

/* Maximum channels any single NIX interface can have */
#define NIX_MAX_BPID_CHAN
struct nix_bp_cfg_rsp {};

struct nix_mcast_grp_create_req {};

struct nix_mcast_grp_create_rsp {};

struct nix_mcast_grp_destroy_req {};

struct nix_mcast_grp_update_req {};

struct nix_mcast_grp_update_rsp {};

/* Global NIX inline IPSec configuration */
struct nix_inline_ipsec_cfg {};

/* Per NIX LF inline IPSec configuration */
struct nix_inline_ipsec_lf_cfg {};

struct nix_hw_info {};

struct nix_bandprof_alloc_req {};

struct nix_bandprof_alloc_rsp {};

struct nix_bandprof_free_req {};

struct nix_bandprof_get_hwinfo_rsp {};

/* NPC mbox message structs */

#define NPC_MCAM_ENTRY_INVALID
#define NPC_MCAM_INVALID_MAP

/* NPC mailbox error codes
 * Range 701 - 800.
 */
enum npc_af_status {};

struct npc_mcam_alloc_entry_req {};

struct npc_mcam_alloc_entry_rsp {};

struct npc_mcam_free_entry_req {};

struct mcam_entry {};

struct npc_mcam_write_entry_req {};

/* Enable/Disable a given entry */
struct npc_mcam_ena_dis_entry_req {};

struct npc_mcam_shift_entry_req {};

struct npc_mcam_shift_entry_rsp {};

struct npc_mcam_alloc_counter_req {};

struct npc_mcam_alloc_counter_rsp {};

struct npc_mcam_oper_counter_req {};

struct npc_mcam_oper_counter_rsp {};

struct npc_mcam_unmap_counter_req {};

struct npc_mcam_alloc_and_write_entry_req {};

struct npc_mcam_alloc_and_write_entry_rsp {};

struct npc_get_kex_cfg_rsp {};

struct ptp_get_cap_rsp {};

struct flow_msg {};

struct npc_install_flow_req {};

struct npc_install_flow_rsp {};

struct npc_delete_flow_req {};

struct npc_delete_flow_rsp {};

struct npc_mcam_read_entry_req {};

struct npc_mcam_read_entry_rsp {};

struct npc_mcam_read_base_rule_rsp {};

struct npc_mcam_get_stats_req {};

struct npc_mcam_get_stats_rsp {};

struct npc_get_field_hash_info_req {};

struct npc_get_field_hash_info_rsp {};

enum ptp_op {};

struct ptp_req {};

struct ptp_rsp {};

struct npc_get_field_status_req {};

struct npc_get_field_status_rsp {};

struct set_vf_perm  {};

struct lmtst_tbl_setup_req {};

struct ndc_sync_op {};

/* CPT mailbox error codes
 * Range 901 - 1000.
 */
enum cpt_af_status {};

/* CPT mbox message formats */
struct cpt_rd_wr_reg_msg {};

struct cpt_lf_alloc_req_msg {};

#define CPT_INLINE_INBOUND
#define CPT_INLINE_OUTBOUND

/* Mailbox message request format for CPT IPsec
 * inline inbound and outbound configuration.
 */
struct cpt_inline_ipsec_cfg_msg {};

/* Mailbox message request and response format for CPT stats. */
struct cpt_sts_req {};

struct cpt_sts_rsp {};

/* Mailbox message request format to configure reassembly timeout. */
struct cpt_rxc_time_cfg_req {};

/* Mailbox message request format to request for CPT_INST_S lmtst. */
struct cpt_inst_lmtst_req {};

/* Mailbox message format to request for CPT LF reset */
struct cpt_lf_rst_req {};

/* Mailbox message format to request for CPT faulted engines */
struct cpt_flt_eng_info_req {};

struct cpt_flt_eng_info_rsp {};

struct sdp_node_info {};

struct sdp_chan_info_msg {};

struct sdp_get_chan_info_msg {};

/* CGX mailbox error codes
 * Range 1101 - 1200.
 */
enum cgx_af_status {};

enum mcs_direction {};

enum mcs_rsrc_type {};

struct mcs_alloc_rsrc_req {};

struct mcs_alloc_rsrc_rsp {};

struct mcs_free_rsrc_req {};

struct mcs_flowid_entry_write_req {};

struct mcs_secy_plcy_write_req {};

/* RX SC_CAM mapping */
struct mcs_rx_sc_cam_write_req {};

struct mcs_sa_plcy_write_req {};

struct mcs_tx_sc_sa_map {};

struct mcs_rx_sc_sa_map {};

struct mcs_flowid_ena_dis_entry {};

struct mcs_pn_table_write_req {};

struct mcs_hw_info {};

struct mcs_set_active_lmac {};

struct mcs_set_lmac_mode {};

struct mcs_port_reset_req {};

struct mcs_port_cfg_set_req {};

struct mcs_port_cfg_get_req {};

struct mcs_port_cfg_get_rsp {};

struct mcs_custom_tag_cfg_get_req {};

struct mcs_custom_tag_cfg_get_rsp {};

/* MCS mailbox error codes
 * Range 1201 - 1300.
 */
enum mcs_af_status {};

struct mcs_set_pn_threshold {};

enum mcs_ctrl_pkt_rulew_type {};

struct mcs_alloc_ctrl_pkt_rule_req {};

struct mcs_alloc_ctrl_pkt_rule_rsp {};

struct mcs_free_ctrl_pkt_rule_req {};

struct mcs_ctrl_pkt_rule_write_req {};

struct mcs_stats_req {};

struct mcs_flowid_stats {};

struct mcs_secy_stats {};

struct mcs_port_stats {};

/* Only for CN10K-B */
struct mcs_sa_stats {};

struct mcs_sc_stats {};

struct mcs_clear_stats {};

struct mcs_intr_cfg {};

struct mcs_intr_info {};

#endif /* MBOX_H */