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 {
31 struct plt_pci_device *pci_dev;
40 uint32_t xaq_buf_size;
43 #define ROC_SSO_MEM_SZ (16 * 1024)
44 uint8_t reserved[ROC_SSO_MEM_SZ] __plt_cache_aligned;
45 } __plt_cache_aligned;
47 static __plt_always_inline void
48 roc_sso_hws_head_wait(uintptr_t tag_op)
53 asm volatile(PLT_CPU_FEATURE_PREAMBLE
54 " ldr %[tag], [%[tag_op]] \n"
55 " tbnz %[tag], 35, done%= \n"
58 " ldr %[tag], [%[tag_op]] \n"
59 " tbz %[tag], 35, rty%= \n"
62 : [tag_op] "r"(tag_op));
64 /* Wait for the SWTAG/SWTAG_FULL operation */
65 while (!(plt_read64(tag_op) & BIT_ULL(35)))
70 /* SSO device initialization */
71 int __roc_api roc_sso_dev_init(struct roc_sso *roc_sso);
72 int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso);
74 /* SSO device configuration */
75 int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws,
77 void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso);
78 int __roc_api roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso,
79 struct roc_sso_hwgrp_qos *qos,
80 uint8_t nb_qos, uint32_t nb_xaq);
81 int __roc_api roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso,
82 uint32_t npa_aura_id, uint16_t hwgrps);
83 int __roc_api roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso,
85 int __roc_api roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso,
86 uint16_t hwgrp, uint8_t weight,
87 uint8_t affinity, uint8_t priority);
88 uint64_t __roc_api roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns);
89 int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws,
90 uint16_t hwgrp[], uint16_t nb_hwgrp);
91 int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws,
92 uint16_t hwgrp[], uint16_t nb_hwgrp);
93 int __roc_api roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso,
94 uint8_t hws, uint16_t hwgrp);
95 uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws);
96 uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso,
100 void __roc_api roc_sso_dump(struct roc_sso *roc_sso, uint8_t nb_hws,
101 uint16_t hwgrp, FILE *f);
102 int __roc_api roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp,
103 struct roc_sso_hwgrp_stats *stats);
104 int __roc_api roc_sso_hws_stats_get(struct roc_sso *roc_sso, uint8_t hws,
105 struct roc_sso_hws_stats *stats);
107 #endif /* _ROC_SSOW_H_ */