common/cnxk: add lower bound check for SSO resources
[dpdk.git] / drivers / common / cnxk / roc_mbox.h
index b63fe10..2c30f19 100644 (file)
@@ -95,6 +95,8 @@ struct mbox_msghdr {
          msg_rsp)                                                             \
        M(CGX_STATS_RST, 0x21A, cgx_stats_rst, msg_req, msg_rsp)               \
        M(RPM_STATS, 0x21C, rpm_stats, msg_req, rpm_stats_rsp)                 \
+       M(CGX_PRIO_FLOW_CTRL_CFG, 0x21F, cgx_prio_flow_ctrl_cfg, cgx_pfc_cfg,  \
+         cgx_pfc_rsp)                                                         \
        /* NPA mbox IDs (range 0x400 - 0x5FF) */                               \
        M(NPA_LF_ALLOC, 0x400, npa_lf_alloc, npa_lf_alloc_req,                 \
          npa_lf_alloc_rsp)                                                    \
@@ -114,7 +116,7 @@ struct mbox_msghdr {
          msg_rsp)                                                             \
        M(SSO_GRP_GET_PRIORITY, 0x606, sso_grp_get_priority, sso_info_req,     \
          sso_grp_priority)                                                    \
-       M(SSO_WS_CACHE_INV, 0x607, sso_ws_cache_inv, msg_req, msg_rsp)         \
+       M(SSO_WS_CACHE_INV, 0x607, sso_ws_cache_inv, ssow_lf_inv_req, msg_rsp) \
        M(SSO_GRP_QOS_CONFIG, 0x608, sso_grp_qos_config, sso_grp_qos_cfg,      \
          msg_rsp)                                                             \
        M(SSO_GRP_GET_STATS, 0x609, sso_grp_get_stats, sso_info_req,           \
@@ -123,6 +125,9 @@ struct mbox_msghdr {
          sso_hws_stats)                                                       \
        M(SSO_HW_RELEASE_XAQ, 0x611, sso_hw_release_xaq_aura,                  \
          sso_hw_xaq_release, msg_rsp)                                         \
+       M(SSO_CONFIG_LSW, 0x612, ssow_config_lsw, ssow_config_lsw, msg_rsp)    \
+       M(SSO_HWS_CHNG_MSHIP, 0x613, ssow_chng_mship, ssow_chng_mship,         \
+         msg_rsp)                                                             \
        /* TIM mbox IDs (range 0x800 - 0x9FF) */                               \
        M(TIM_LF_ALLOC, 0x800, tim_lf_alloc, tim_lf_alloc_req,                 \
          tim_lf_alloc_rsp)                                                    \
@@ -151,6 +156,16 @@ struct mbox_msghdr {
        M(CPT_GET_CAPS, 0xBFD, cpt_caps_get, msg_req, cpt_caps_rsp_msg)        \
        M(CPT_GET_ENG_GRP, 0xBFF, cpt_eng_grp_get, cpt_eng_grp_req,            \
          cpt_eng_grp_rsp)                                                     \
+       /* REE mbox IDs (range 0xE00 - 0xFFF) */                               \
+       M(REE_CONFIG_LF, 0xE01, ree_config_lf, ree_lf_req_msg, msg_rsp)        \
+       M(REE_RD_WR_REGISTER, 0xE02, ree_rd_wr_register, ree_rd_wr_reg_msg,    \
+         ree_rd_wr_reg_msg)                                                   \
+       M(REE_RULE_DB_PROG, 0xE03, ree_rule_db_prog, ree_rule_db_prog_req_msg, \
+         msg_rsp)                                                             \
+       M(REE_RULE_DB_LEN_GET, 0xE04, ree_rule_db_len_get, ree_req_msg,        \
+         ree_rule_db_len_rsp_msg)                                             \
+       M(REE_RULE_DB_GET, 0xE05, ree_rule_db_get, ree_rule_db_get_req_msg,    \
+         ree_rule_db_get_rsp_msg)                                             \
        /* SDP mbox IDs (range 0x1000 - 0x11FF) */                             \
        M(SET_SDP_CHAN_INFO, 0x1000, set_sdp_chan_info, sdp_chan_info_msg,     \
          msg_rsp)                                                             \
@@ -247,7 +262,8 @@ struct mbox_msghdr {
        M(NIX_CPT_BP_ENABLE, 0x8020, nix_cpt_bp_enable, nix_bp_cfg_req,        \
          nix_bp_cfg_rsp)                                                      \
        M(NIX_CPT_BP_DISABLE, 0x8021, nix_cpt_bp_disable, nix_bp_cfg_req,      \
-         msg_rsp)
+         msg_rsp)                                                             \
+       M(NIX_RX_SW_SYNC, 0x8022, nix_rx_sw_sync, msg_req, msg_rsp)
 
 /* Messages initiated by AF (range 0xC00 - 0xDFF) */
 #define MBOX_UP_CGX_MESSAGES                                                   \
@@ -313,6 +329,7 @@ struct npc_set_pkind {
 #define ROC_PRIV_FLAGS_LEN_90B   BIT_ULL(3)
 #define ROC_PRIV_FLAGS_EXDSA     BIT_ULL(4)
 #define ROC_PRIV_FLAGS_VLAN_EXDSA BIT_ULL(5)
+#define ROC_PRIV_FLAGS_PRE_L2    BIT_ULL(6)
 #define ROC_PRIV_FLAGS_CUSTOM    BIT_ULL(63)
        uint64_t __io mode;
 #define PKIND_TX BIT_ULL(0)
@@ -540,6 +557,19 @@ struct cgx_pause_frm_cfg {
        uint8_t __io tx_pause;
 };
 
+struct cgx_pfc_cfg {
+       struct mbox_msghdr hdr;
+       uint8_t __io rx_pause;
+       uint8_t __io tx_pause;
+       uint16_t __io pfc_en; /*  bitmap indicating enabled traffic classes */
+};
+
+struct cgx_pfc_rsp {
+       struct mbox_msghdr hdr;
+       uint8_t __io rx_pause;
+       uint8_t __io tx_pause;
+};
+
 struct sfp_eeprom_s {
 #define SFP_EEPROM_SIZE 256
        uint16_t __io sff_id;
@@ -1114,7 +1144,9 @@ struct nix_bp_cfg_req {
 /* PF can be mapped to either CGX or LBK interface,
  * so maximum 64 channels are possible.
  */
-#define NIX_MAX_CHAN 64
+#define NIX_MAX_CHAN    64
+#define NIX_CGX_MAX_CHAN 16
+#define NIX_LBK_MAX_CHAN 1
 struct nix_bp_cfg_rsp {
        struct mbox_msghdr hdr;
        /* Channel and bpid mapping */
@@ -1240,6 +1272,33 @@ struct ssow_lf_free_req {
        uint16_t __io hws;
 };
 
+#define SSOW_INVAL_SELECTIVE_VER 0x1000
+struct ssow_lf_inv_req {
+       struct mbox_msghdr hdr;
+       uint16_t nb_hws;                 /* Number of HWS to invalidate*/
+       uint16_t hws[MAX_RVU_BLKLF_CNT]; /* Array of HWS */
+};
+
+struct ssow_config_lsw {
+       struct mbox_msghdr hdr;
+#define SSOW_LSW_DIS    0
+#define SSOW_LSW_GW_WAIT 1
+#define SSOW_LSW_GW_IMM         2
+       uint8_t __io lsw_mode;
+#define SSOW_WQE_REL_LSW_WAIT 0
+#define SSOW_WQE_REL_IMM      1
+       uint8_t __io wqe_release;
+};
+
+struct ssow_chng_mship {
+       struct mbox_msghdr hdr;
+       uint8_t __io set;        /* Membership set to modify. */
+       uint8_t __io enable;     /* Enable/Disable the hwgrps. */
+       uint8_t __io hws;        /* HWS to modify. */
+       uint16_t __io nb_hwgrps; /* Number of hwgrps in the array */
+       uint16_t __io hwgrps[MAX_RVU_BLKLF_CNT]; /* Array of hwgrps. */
+};
+
 struct sso_hw_setconfig {
        struct mbox_msghdr hdr;
        uint32_t __io npa_aura_id;
@@ -1452,6 +1511,96 @@ struct cpt_eng_grp_rsp {
        uint8_t __io eng_grp_num;
 };
 
+/* REE mailbox error codes
+ * Range 1001 - 1100.
+ */
+enum ree_af_status {
+       REE_AF_ERR_RULE_UNKNOWN_VALUE = -1001,
+       REE_AF_ERR_LF_NO_MORE_RESOURCES = -1002,
+       REE_AF_ERR_LF_INVALID = -1003,
+       REE_AF_ERR_ACCESS_DENIED = -1004,
+       REE_AF_ERR_RULE_DB_PARTIAL = -1005,
+       REE_AF_ERR_RULE_DB_EQ_BAD_VALUE = -1006,
+       REE_AF_ERR_RULE_DB_BLOCK_ALLOC_FAILED = -1007,
+       REE_AF_ERR_BLOCK_NOT_IMPLEMENTED = -1008,
+       REE_AF_ERR_RULE_DB_INC_OFFSET_TOO_BIG = -1009,
+       REE_AF_ERR_RULE_DB_OFFSET_TOO_BIG = -1010,
+       REE_AF_ERR_Q_IS_GRACEFUL_DIS = -1011,
+       REE_AF_ERR_Q_NOT_GRACEFUL_DIS = -1012,
+       REE_AF_ERR_RULE_DB_ALLOC_FAILED = -1013,
+       REE_AF_ERR_RULE_DB_TOO_BIG = -1014,
+       REE_AF_ERR_RULE_DB_GEQ_BAD_VALUE = -1015,
+       REE_AF_ERR_RULE_DB_LEQ_BAD_VALUE = -1016,
+       REE_AF_ERR_RULE_DB_WRONG_LENGTH = -1017,
+       REE_AF_ERR_RULE_DB_WRONG_OFFSET = -1018,
+       REE_AF_ERR_RULE_DB_BLOCK_TOO_BIG = -1019,
+       REE_AF_ERR_RULE_DB_SHOULD_FILL_REQUEST = -1020,
+       REE_AF_ERR_RULE_DBI_ALLOC_FAILED = -1021,
+       REE_AF_ERR_LF_WRONG_PRIORITY = -1022,
+       REE_AF_ERR_LF_SIZE_TOO_BIG = -1023,
+};
+
+/* REE mbox message formats */
+
+struct ree_req_msg {
+       struct mbox_msghdr hdr;
+       uint32_t __io blkaddr;
+};
+
+struct ree_lf_req_msg {
+       struct mbox_msghdr hdr;
+       uint32_t __io blkaddr;
+       uint32_t __io size;
+       uint8_t __io lf;
+       uint8_t __io pri;
+};
+
+struct ree_rule_db_prog_req_msg {
+       struct mbox_msghdr hdr;
+#define REE_RULE_DB_REQ_BLOCK_SIZE ((64ULL * 1024ULL) >> 1)
+       uint8_t __io rule_db[REE_RULE_DB_REQ_BLOCK_SIZE];
+       uint32_t __io blkaddr;       /* REE0 or REE1 */
+       uint32_t __io total_len;     /* total len of rule db */
+       uint32_t __io offset;        /* offset of current rule db block */
+       uint16_t __io len;           /* length of rule db block */
+       uint8_t __io is_last;        /* is this the last block */
+       uint8_t __io is_incremental; /* is incremental flow */
+       uint8_t __io is_dbi;         /* is rule db incremental */
+};
+
+struct ree_rule_db_get_req_msg {
+       struct mbox_msghdr hdr;
+       uint32_t __io blkaddr;
+       uint32_t __io offset; /* retrieve db from this offset */
+       uint8_t __io is_dbi;  /* is request for rule db incremental */
+};
+
+struct ree_rd_wr_reg_msg {
+       struct mbox_msghdr hdr;
+       uint64_t __io reg_offset;
+       uint64_t __io *ret_val;
+       uint64_t __io val;
+       uint32_t __io blkaddr;
+       uint8_t __io is_write;
+};
+
+struct ree_rule_db_len_rsp_msg {
+       struct mbox_msghdr hdr;
+       uint32_t __io blkaddr;
+       uint32_t __io len;
+       uint32_t __io inc_len;
+};
+
+struct ree_rule_db_get_rsp_msg {
+       struct mbox_msghdr hdr;
+#define REE_RULE_DB_RSP_BLOCK_SIZE (15ULL * 1024ULL)
+       uint8_t __io rule_db[REE_RULE_DB_RSP_BLOCK_SIZE];
+       uint32_t __io total_len; /* total len of rule db */
+       uint32_t __io offset;    /* offset of current rule db block */
+       uint16_t __io len;       /* length of rule db block */
+       uint8_t __io is_last;    /* is this the last block */
+};
+
 /* NPC mbox message structs */
 
 #define NPC_MCAM_ENTRY_INVALID 0xFFFF