1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
8 struct roc_sso_hwgrp_qos {
15 struct roc_sso_hws_stats {
19 struct roc_sso_hwgrp_stats {
30 struct roc_sso_xaq_data {
40 struct plt_pci_device *pci_dev;
47 struct roc_sso_xaq_data xaq;
50 uint32_t xaq_buf_size;
53 #define ROC_SSO_MEM_SZ (16 * 1024)
54 uint8_t reserved[ROC_SSO_MEM_SZ] __plt_cache_aligned;
55 } __plt_cache_aligned;
57 static __plt_always_inline uint64_t
58 roc_sso_hws_head_wait(uintptr_t base)
60 uintptr_t tag_op = base + SSOW_LF_GWS_TAG;
63 #if defined(__aarch64__)
64 asm volatile(PLT_CPU_FEATURE_PREAMBLE
65 " ldr %[tag], [%[tag_op]] \n"
66 " tbnz %[tag], 35, done%= \n"
69 " ldr %[tag], [%[tag_op]] \n"
70 " tbz %[tag], 35, rty%= \n"
73 : [tag_op] "r"(tag_op));
76 tag = plt_read64(tag_op);
77 } while (!(tag & BIT_ULL(35)));
82 /* SSO device initialization */
83 int __roc_api roc_sso_dev_init(struct roc_sso *roc_sso);
84 int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso);
86 /* SSO device configuration */
87 int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws,
89 void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso);
90 int __roc_api roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso,
91 struct roc_sso_hwgrp_qos *qos,
92 uint8_t nb_qos, uint32_t nb_xaq);
93 int __roc_api roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso,
94 uint32_t npa_aura_id, uint16_t hwgrps);
95 int __roc_api roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso,
97 int __roc_api roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso,
98 uint16_t hwgrp, uint8_t weight,
99 uint8_t affinity, uint8_t priority);
100 uint64_t __roc_api roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns);
101 int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws,
102 uint16_t hwgrp[], uint16_t nb_hwgrp);
103 int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws,
104 uint16_t hwgrp[], uint16_t nb_hwgrp);
105 int __roc_api roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso,
106 uint8_t hws, uint16_t hwgrp);
107 uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws);
108 uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso,
110 int __roc_api roc_sso_hwgrp_init_xaq_aura(struct roc_sso *roc_sso,
112 int __roc_api roc_sso_hwgrp_free_xaq_aura(struct roc_sso *roc_sso,
116 void __roc_api roc_sso_dump(struct roc_sso *roc_sso, uint8_t nb_hws,
117 uint16_t hwgrp, FILE *f);
118 int __roc_api roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp,
119 struct roc_sso_hwgrp_stats *stats);
120 int __roc_api roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws,
121 struct roc_sso_hws_stats *stats);
123 #endif /* _ROC_SSOW_H_ */