event/dlb2: add v2.5 queue depth functions
[dpdk.git] / drivers / event / dlb2 / pf / dlb2_main.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2020 Intel Corporation
3  */
4
5 #ifndef __DLB2_MAIN_H
6 #define __DLB2_MAIN_H
7
8 #include <rte_debug.h>
9 #include <rte_log.h>
10 #include <rte_spinlock.h>
11 #include <rte_pci.h>
12 #include <rte_bus_pci.h>
13 #include <rte_eal_paging.h>
14
15 #ifdef DLB2_USE_NEW_HEADERS
16 #include "base/dlb2_hw_types_new.h"
17 #else
18 #include "base/dlb2_hw_types.h"
19 #endif
20 #include "../dlb2_user.h"
21
22 #define DLB2_DEFAULT_UNREGISTER_TIMEOUT_S 5
23
24 struct dlb2_dev;
25
26 struct dlb2_port_memory {
27         struct dlb2_list_head list;
28         void *cq_base;
29         bool valid;
30 };
31
32 struct dlb2_dev {
33         struct rte_pci_device *pdev;
34         struct dlb2_hw hw;
35         /* struct list_head list; */
36         struct device *dlb2_device;
37         bool domain_reset_failed;
38         /* The resource mutex serializes access to driver data structures and
39          * hardware registers.
40          */
41         rte_spinlock_t resource_mutex;
42         bool worker_launched;
43         u8 revision;
44 };
45
46 struct dlb2_dev *dlb2_probe(struct rte_pci_device *pdev);
47
48 int dlb2_pf_reset(struct dlb2_dev *dlb2_dev);
49 int dlb2_pf_create_sched_domain(struct dlb2_hw *hw,
50                                 struct dlb2_create_sched_domain_args *args,
51                                 struct dlb2_cmd_response *resp);
52 int dlb2_pf_create_ldb_queue(struct dlb2_hw *hw,
53                              u32 domain_id,
54                              struct dlb2_create_ldb_queue_args *args,
55                              struct dlb2_cmd_response *resp);
56 int dlb2_pf_create_dir_queue(struct dlb2_hw *hw,
57                              u32 domain_id,
58                              struct dlb2_create_dir_queue_args *args,
59                              struct dlb2_cmd_response *resp);
60 int dlb2_pf_create_ldb_port(struct dlb2_hw *hw,
61                             u32 domain_id,
62                             struct dlb2_create_ldb_port_args *args,
63                             uintptr_t cq_dma_base,
64                             struct dlb2_cmd_response *resp);
65 int dlb2_pf_create_dir_port(struct dlb2_hw *hw,
66                             u32 domain_id,
67                             struct dlb2_create_dir_port_args *args,
68                             uintptr_t cq_dma_base,
69                             struct dlb2_cmd_response *resp);
70 int dlb2_pf_start_domain(struct dlb2_hw *hw,
71                          u32 domain_id,
72                          struct dlb2_start_domain_args *args,
73                          struct dlb2_cmd_response *resp);
74 int dlb2_pf_enable_ldb_port(struct dlb2_hw *hw,
75                             u32 domain_id,
76                             struct dlb2_enable_ldb_port_args *args,
77                             struct dlb2_cmd_response *resp);
78 int dlb2_pf_disable_ldb_port(struct dlb2_hw *hw,
79                              u32 domain_id,
80                              struct dlb2_disable_ldb_port_args *args,
81                              struct dlb2_cmd_response *resp);
82 int dlb2_pf_enable_dir_port(struct dlb2_hw *hw,
83                             u32 domain_id,
84                             struct dlb2_enable_dir_port_args *args,
85                             struct dlb2_cmd_response *resp);
86 int dlb2_pf_disable_dir_port(struct dlb2_hw *hw,
87                              u32 domain_id,
88                              struct dlb2_disable_dir_port_args *args,
89                              struct dlb2_cmd_response *resp);
90 int dlb2_pf_reset_domain(struct dlb2_hw *hw, u32 domain_id);
91 int dlb2_pf_ldb_port_owned_by_domain(struct dlb2_hw *hw,
92                                      u32 domain_id,
93                                      u32 port_id);
94 int dlb2_pf_dir_port_owned_by_domain(struct dlb2_hw *hw,
95                                      u32 domain_id,
96                                      u32 port_id);
97
98 #endif /* __DLB2_MAIN_H */