common/cnxk: add NPA diagnostic and performance counter apis
PATCH 1/1 common/cnxk: add NPA diagnostic and performance counter apis
Add DPC (Diagnostic and Performance Counter) support for NPA pool operations on CN20K. This allows allocating and attaching hardware counters to pool/aura for monitoring alloc/free, outstanding buffers, and high-watermark.
--- drivers/common/cnxk/hw/npa.h | 10 + drivers/common/cnxk/roc_features.h | 6 + drivers/common/cnxk/roc_mbox.h | 19 ++ drivers/common/cnxk/roc_npa.c | 235 ++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 45 ++++ drivers/common/cnxk/roc_npa_priv.h | 2 + .../common/cnxk/roc_platform_base_symbols.c | 4 + 7 files changed, 321 insertions(+)
drivers/common/cnxk/hw/npa.h +10 -0
@@ -48,6 +48,8 @@#define NPA_AF_BATCH_ACCEPT_CTL (0x6a8ull)/* [CN10K, .) */ #define NPA_AF_BATCH_ERR_DATA0 (0x6c0ull)/* [CN10K, .) */ #define NPA_AF_BATCH_ERR_DATA1 (0x6c8ull)/* [CN10K, .) */ +#define NPA_AF_DPCX_CFG (a) (0x800ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_AF_DPC_PERMITX (a) (0x1000ull | (uint64_t)(a) << 3)/* [CN20K, .) */ #define NPA_AF_LFX_AURAS_CFG (a) (0x4000ull | (uint64_t)(a) << 18)#define NPA_AF_LFX_LOC_AURAS_BASE (a) (0x4010ull | (uint64_t)(a) << 18)#define NPA_AF_LFX_QINTS_CFG (a) (0x4100ull | (uint64_t)(a) << 18)
@@ -89,6 +91,14 @@#define NPA_LF_AURA_BATCH_FREE0 (0x400ull)/* [CN10K, .) */ #define NPA_LF_AURA_BATCH_FREEX (a) \ (0x400ull | (uint64_t)(a) << 3)/* [CN10K, .) */ +#define NPA_LF_DPCX_ALLOC_CNT (a) \ + (0x808ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_LF_DPCX_FREE_CNT (a) \ + (0x810ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_LF_DPCX_OUTST_BUF_CNT (a) \ + (0x818ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_LF_DPCX_CNT_HI_WM (a) \ + (0x820ull | (uint64_t)(a) << 6)/* [CN20K, .) */ /* Enum offsets */
drivers/common/cnxk/roc_features.h +6 -0
@@ -132,6 +132,12 @@ roc_feature_nix_has_sq_cnt_update(void)return roc_model_is_cn20k (); } +static inline bool +roc_feature_npa_has_dpc (void ) +{ +return roc_model_is_cn20k (); +} +static inline bool roc_feature_nix_has_16b_align (void ) {
drivers/common/cnxk/roc_mbox.h +19 -0
@@ -123,6 +123,10 @@ struct mbox_msghdr { msg_rsp) \ M(NPA_CN20K_AQ_ENQ, 0x404, npa_cn20k_aq_enq, npa_cn20k_aq_enq_req, \ npa_cn20k_aq_enq_rsp) \ + M(NPA_CN20K_DPC_ALLOC, 0x405, npa_cn20k_dpc_alloc, \ + npa_cn20k_dpc_alloc_req, npa_cn20k_dpc_alloc_rsp) \ + M(NPA_CN20K_DPC_FREE, 0x406, npa_cn20k_dpc_free, \ + npa_cn20k_dpc_free_req, msg_rsp) \ /* SSO/SSOW mbox IDs (range 0x600 - 0x7FF) */ \ M(SSO_LF_ALLOC, 0x600, sso_lf_alloc, sso_lf_alloc_req, \ sso_lf_alloc_rsp) \
@@ -1423,6 +1427,21 @@ struct npa_cn20k_aq_enq_rsp { }; }; +struct npa_cn20k_dpc_alloc_req { +struct mbox_msghdr hdr; + uint16_t __io dpc_conf; +}; + +struct npa_cn20k_dpc_alloc_rsp { +struct mbox_msghdr hdr; + uint8_t __io cntr_id; +}; + +struct npa_cn20k_dpc_free_req { +struct mbox_msghdr hdr; + uint8_t __io cntr_id; +}; +/* Disable all contexts of type 'ctype' */ struct hwctx_disable_req {struct mbox_msghdr hdr;
drivers/common/cnxk/roc_npa.c +235 -0
238 lines not on this page · raw message
drivers/common/cnxk/roc_npa.h +45 -0
56 lines not on this page · raw message
drivers/common/cnxk/roc_npa_priv.h +2 -0
@@ -16,6 +16,8 @@ enum npa_error_status {NPA_ERR_DEVICE_NOT_BOUNDED =-519 ,NPA_ERR_HALO_INIT =-520 ,NPA_ERR_HALO_FINI =-521 , +NPA_ERR_DPC_ALLOC =-522 , + NPA_ERR_DPC_FREE = -523, }; struct npa_lf {
drivers/common/cnxk/roc_platform_base_symbols.c +4 -0
@@ -452,6 +452,10 @@ RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_dump) RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_buf_type_update) RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_buf_type_mask) RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_buf_type_limit_get) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_dpc_alloc) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_dpc_free) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_pool_dpc_enable) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_pool_dpc_disable) RTE_EXPORT_INTERNAL_SYMBOL(roc_npc_mark_actions_get) RTE_EXPORT_INTERNAL_SYMBOL(roc_npc_mark_actions_sub_return) RTE_EXPORT_INTERNAL_SYMBOL(roc_npc_vtag_actions_get)
Signature · 1 line
2.48.1
PATCH v2 1/1 common/cnxk: add NPA diagnostic and performance counter apis
Add DPC (Diagnostic and Performance Counter) support for NPA pool operations on CN20K. This allows allocating and attaching hardware counters to pool/aura for monitoring alloc/free, outstanding buffers, and high-watermark.
---
v2:
* Fixed commit message.
drivers/common/cnxk/hw/npa.h | 10 + drivers/common/cnxk/roc_features.h | 6 + drivers/common/cnxk/roc_mbox.h | 19 ++ drivers/common/cnxk/roc_npa.c | 235 ++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 45 ++++ drivers/common/cnxk/roc_npa_priv.h | 2 + .../common/cnxk/roc_platform_base_symbols.c | 4 + 7 files changed, 321 insertions(+)
drivers/common/cnxk/hw/npa.h +10 -0
@@ -48,6 +48,8 @@#define NPA_AF_BATCH_ACCEPT_CTL (0x6a8ull)/* [CN10K, .) */ #define NPA_AF_BATCH_ERR_DATA0 (0x6c0ull)/* [CN10K, .) */ #define NPA_AF_BATCH_ERR_DATA1 (0x6c8ull)/* [CN10K, .) */ +#define NPA_AF_DPCX_CFG (a) (0x800ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_AF_DPC_PERMITX (a) (0x1000ull | (uint64_t)(a) << 3)/* [CN20K, .) */ #define NPA_AF_LFX_AURAS_CFG (a) (0x4000ull | (uint64_t)(a) << 18)#define NPA_AF_LFX_LOC_AURAS_BASE (a) (0x4010ull | (uint64_t)(a) << 18)#define NPA_AF_LFX_QINTS_CFG (a) (0x4100ull | (uint64_t)(a) << 18)
@@ -89,6 +91,14 @@#define NPA_LF_AURA_BATCH_FREE0 (0x400ull)/* [CN10K, .) */ #define NPA_LF_AURA_BATCH_FREEX (a) \ (0x400ull | (uint64_t)(a) << 3)/* [CN10K, .) */ +#define NPA_LF_DPCX_ALLOC_CNT (a) \ + (0x808ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_LF_DPCX_FREE_CNT (a) \ + (0x810ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_LF_DPCX_OUTST_BUF_CNT (a) \ + (0x818ull | (uint64_t)(a) << 6)/* [CN20K, .) */ +#define NPA_LF_DPCX_CNT_HI_WM (a) \ + (0x820ull | (uint64_t)(a) << 6)/* [CN20K, .) */ /* Enum offsets */
drivers/common/cnxk/roc_features.h +6 -0
@@ -132,6 +132,12 @@ roc_feature_nix_has_sq_cnt_update(void)return roc_model_is_cn20k (); } +static inline bool +roc_feature_npa_has_dpc (void ) +{ +return roc_model_is_cn20k (); +} +static inline bool roc_feature_nix_has_16b_align (void ) {
drivers/common/cnxk/roc_mbox.h +19 -0
@@ -123,6 +123,10 @@ struct mbox_msghdr { msg_rsp) \ M(NPA_CN20K_AQ_ENQ, 0x404, npa_cn20k_aq_enq, npa_cn20k_aq_enq_req, \ npa_cn20k_aq_enq_rsp) \ + M(NPA_CN20K_DPC_ALLOC, 0x405, npa_cn20k_dpc_alloc, \ + npa_cn20k_dpc_alloc_req, npa_cn20k_dpc_alloc_rsp) \ + M(NPA_CN20K_DPC_FREE, 0x406, npa_cn20k_dpc_free, \ + npa_cn20k_dpc_free_req, msg_rsp) \ /* SSO/SSOW mbox IDs (range 0x600 - 0x7FF) */ \ M(SSO_LF_ALLOC, 0x600, sso_lf_alloc, sso_lf_alloc_req, \ sso_lf_alloc_rsp) \
@@ -1423,6 +1427,21 @@ struct npa_cn20k_aq_enq_rsp { }; }; +struct npa_cn20k_dpc_alloc_req { +struct mbox_msghdr hdr; + uint16_t __io dpc_conf; +}; + +struct npa_cn20k_dpc_alloc_rsp { +struct mbox_msghdr hdr; + uint8_t __io cntr_id; +}; + +struct npa_cn20k_dpc_free_req { +struct mbox_msghdr hdr; + uint8_t __io cntr_id; +}; +/* Disable all contexts of type 'ctype' */ struct hwctx_disable_req {struct mbox_msghdr hdr;
drivers/common/cnxk/roc_npa.c +235 -0
238 lines not on this page · raw message
drivers/common/cnxk/roc_npa.h +45 -0
56 lines not on this page · raw message
drivers/common/cnxk/roc_npa_priv.h +2 -0
@@ -16,6 +16,8 @@ enum npa_error_status {NPA_ERR_DEVICE_NOT_BOUNDED =-519 ,NPA_ERR_HALO_INIT =-520 ,NPA_ERR_HALO_FINI =-521 , +NPA_ERR_DPC_ALLOC =-522 , + NPA_ERR_DPC_FREE = -523, }; struct npa_lf {
drivers/common/cnxk/roc_platform_base_symbols.c +4 -0
@@ -452,6 +452,10 @@ RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_dump) RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_buf_type_update) RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_buf_type_mask) RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_buf_type_limit_get) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_dpc_alloc) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_dpc_free) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_pool_dpc_enable) +RTE_EXPORT_INTERNAL_SYMBOL(roc_npa_pool_dpc_disable) RTE_EXPORT_INTERNAL_SYMBOL(roc_npc_mark_actions_get) RTE_EXPORT_INTERNAL_SYMBOL(roc_npc_mark_actions_sub_return) RTE_EXPORT_INTERNAL_SYMBOL(roc_npc_vtag_actions_get)
Signature · 1 line
2.48.1
Recheck-request: iol-unit-arm64-testing
Jerin Jacob
AppliedQuoted 2 lines · Nawal Kishor
Recheck-request: iol-unit-arm64-testing
Applied to dpdk-next-net-mrvl/for-main. Thanks