common/cnxk: allow reuse of SSO API for inline dev
[dpdk.git] / drivers / common / cnxk / roc_cpt.h
index cb2838e..c80a8e0 100644 (file)
@@ -7,12 +7,39 @@
 
 #include "roc_api.h"
 
+#define ROC_AE_CPT_BLOCK_TYPE1 0
+#define ROC_AE_CPT_BLOCK_TYPE2 1
+
 /* Default engine groups */
 #define ROC_CPT_DFLT_ENG_GRP_SE           0UL
 #define ROC_CPT_DFLT_ENG_GRP_SE_IE 1UL
 #define ROC_CPT_DFLT_ENG_GRP_AE           2UL
 
 #define ROC_CPT_MAX_LFS 64
+#define ROC_CN10K_CPT_INST_DW_M1                                               \
+       ((uint64_t)(((sizeof(struct cpt_inst_s) / 16) - 1) & 0x7))
+#define ROC_CN10K_TWO_CPT_INST_DW_M1                                           \
+       ((uint64_t)(((sizeof(struct cpt_inst_s) * 2 / 16) - 1) & 0x7))
+
+/* Vector of sizes in the burst of 16 CPT inst except first in 63:19 of
+ * APT_LMT_ARG_S
+ */
+#define ROC_CN10K_CPT_LMT_ARG                                                  \
+       (ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 0) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 1) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 2) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 3) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 4) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 5) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 6) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 7) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 8) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 9) |                            \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 10) |                           \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 11) |                           \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 12) |                           \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 13) |                           \
+        ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 14))
 
 /* CPT helper macros */
 #define ROC_CPT_AH_HDR_LEN      12
@@ -20,6 +47,7 @@
 #define ROC_CPT_AES_GCM_MAC_LEN         16
 #define ROC_CPT_AES_CBC_IV_LEN  16
 #define ROC_CPT_SHA1_HMAC_LEN   12
+#define ROC_CPT_SHA2_HMAC_LEN   16
 #define ROC_CPT_AUTH_KEY_LEN_MAX 64
 
 #define ROC_CPT_DES3_KEY_LEN     24
 #define ROC_CPT_TUNNEL_IPV4_HDR_LEN 20
 #define ROC_CPT_TUNNEL_IPV6_HDR_LEN 40
 
+struct roc_cpt_lmtline {
+       uint64_t io_addr;
+       uint64_t *fc_addr;
+       uintptr_t lmt_base;
+};
+
 struct roc_cpt_lf {
        /* Input parameters */
        uint16_t lf_id;
@@ -61,6 +95,8 @@ struct roc_cpt_lf {
        uint16_t msixoff;
        uint16_t pf_func;
        uint64_t *fc_addr;
+       uint32_t fc_hyst_bits;
+       uint64_t fc_thresh;
        uint64_t io_addr;
        uint8_t *iq_vaddr;
        struct roc_nix *inl_outb_nix;
@@ -88,6 +124,15 @@ struct roc_cpt_rxc_time_cfg {
        uint16_t zombie_thres;
 };
 
+static inline int
+roc_cpt_is_iq_full(struct roc_cpt_lf *lf)
+{
+       if (*lf->fc_addr < lf->fc_thresh)
+               return 0;
+
+       return 1;
+}
+
 int __roc_api roc_cpt_rxc_time_cfg(struct roc_cpt *roc_cpt,
                                   struct roc_cpt_rxc_time_cfg *cfg);
 int __roc_api roc_cpt_dev_init(struct roc_cpt *roc_cpt);
@@ -106,5 +151,10 @@ int __roc_api roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt,
 int __roc_api roc_cpt_afs_print(struct roc_cpt *roc_cpt);
 int __roc_api roc_cpt_lfs_print(struct roc_cpt *roc_cpt);
 void __roc_api roc_cpt_iq_disable(struct roc_cpt_lf *lf);
+void __roc_api roc_cpt_iq_enable(struct roc_cpt_lf *lf);
+int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
+                                  struct roc_cpt_lmtline *lmtline, int lf_id);
+
+void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
 
 #endif /* _ROC_CPT_H_ */