f85799ba810a592c2319bf45cf34076a0ebb5c22
[dpdk.git] / drivers / common / cnxk / roc_sso.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef _ROC_SSO_H_
6 #define _ROC_SSO_H_
7
8 struct roc_sso_hwgrp_qos {
9         uint16_t hwgrp;
10         uint8_t xaq_prcnt;
11         uint8_t iaq_prcnt;
12         uint8_t taq_prcnt;
13 };
14
15 struct roc_sso {
16         struct plt_pci_device *pci_dev;
17         /* Public data. */
18         uint16_t max_hwgrp;
19         uint16_t max_hws;
20         uint16_t nb_hwgrp;
21         uint8_t nb_hws;
22         uintptr_t lmt_base;
23         /* HW Const. */
24         uint32_t xae_waes;
25         uint32_t xaq_buf_size;
26         uint32_t iue;
27         /* Private data. */
28 #define ROC_SSO_MEM_SZ (16 * 1024)
29         uint8_t reserved[ROC_SSO_MEM_SZ] __plt_cache_aligned;
30 } __plt_cache_aligned;
31
32 /* SSO device initialization */
33 int __roc_api roc_sso_dev_init(struct roc_sso *roc_sso);
34 int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso);
35
36 /* SSO device configuration */
37 int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws,
38                                 uint16_t nb_hwgrp);
39 void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso);
40 int __roc_api roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso,
41                                        struct roc_sso_hwgrp_qos *qos,
42                                        uint8_t nb_qos, uint32_t nb_xaq);
43 int __roc_api roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso,
44                                       uint32_t npa_aura_id, uint16_t hwgrps);
45 int __roc_api roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso,
46                                         uint16_t hwgrps);
47 int __roc_api roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso,
48                                          uint16_t hwgrp, uint8_t weight,
49                                          uint8_t affinity, uint8_t priority);
50 uint64_t __roc_api roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns);
51 int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws,
52                                uint16_t hwgrp[], uint16_t nb_hwgrp);
53 int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws,
54                                  uint16_t hwgrp[], uint16_t nb_hwgrp);
55 int __roc_api roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso,
56                                             uint8_t hws, uint16_t hwgrp);
57 uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws);
58 uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso,
59                                            uint16_t hwgrp);
60
61 /* Debug */
62 void __roc_api roc_sso_dump(struct roc_sso *roc_sso, uint8_t nb_hws,
63                             uint16_t hwgrp, FILE *f);
64
65 #endif /* _ROC_SSOW_H_ */