event/octeontx2: add devargs for inflight buffer count
[dpdk.git] / drivers / event / octeontx2 / otx2_evdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #ifndef __OTX2_EVDEV_H__
6 #define __OTX2_EVDEV_H__
7
8 #include <rte_eventdev.h>
9
10 #include "otx2_common.h"
11 #include "otx2_dev.h"
12 #include "otx2_mempool.h"
13
14 #define EVENTDEV_NAME_OCTEONTX2_PMD otx2_eventdev
15
16 #define sso_func_trace otx2_sso_dbg
17
18 #define OTX2_SSO_MAX_VHGRP                  RTE_EVENT_MAX_QUEUES_PER_DEV
19 #define OTX2_SSO_MAX_VHWS                   (UINT8_MAX)
20 #define OTX2_SSO_FC_NAME                    "otx2_evdev_xaq_fc"
21 #define OTX2_SSO_XAQ_SLACK                  (8)
22 #define OTX2_SSO_XAQ_CACHE_CNT              (0x7)
23
24 /* SSO LF register offsets (BAR2) */
25 #define SSO_LF_GGRP_OP_ADD_WORK0            (0x0ull)
26 #define SSO_LF_GGRP_OP_ADD_WORK1            (0x8ull)
27
28 #define SSO_LF_GGRP_QCTL                    (0x20ull)
29 #define SSO_LF_GGRP_EXE_DIS                 (0x80ull)
30 #define SSO_LF_GGRP_INT                     (0x100ull)
31 #define SSO_LF_GGRP_INT_W1S                 (0x108ull)
32 #define SSO_LF_GGRP_INT_ENA_W1S             (0x110ull)
33 #define SSO_LF_GGRP_INT_ENA_W1C             (0x118ull)
34 #define SSO_LF_GGRP_INT_THR                 (0x140ull)
35 #define SSO_LF_GGRP_INT_CNT                 (0x180ull)
36 #define SSO_LF_GGRP_XAQ_CNT                 (0x1b0ull)
37 #define SSO_LF_GGRP_AQ_CNT                  (0x1c0ull)
38 #define SSO_LF_GGRP_AQ_THR                  (0x1e0ull)
39 #define SSO_LF_GGRP_MISC_CNT                (0x200ull)
40
41 #define USEC2NSEC(__us)                 ((__us) * 1E3)
42
43 enum otx2_sso_lf_type {
44         SSO_LF_GGRP,
45         SSO_LF_GWS
46 };
47
48 struct otx2_sso_evdev {
49         OTX2_DEV; /* Base class */
50         uint8_t max_event_queues;
51         uint8_t max_event_ports;
52         uint8_t is_timeout_deq;
53         uint8_t nb_event_queues;
54         uint8_t nb_event_ports;
55         uint8_t configured;
56         uint32_t deq_tmo_ns;
57         uint32_t min_dequeue_timeout_ns;
58         uint32_t max_dequeue_timeout_ns;
59         int32_t max_num_events;
60         uint64_t *fc_mem;
61         uint64_t xaq_lmt;
62         uint64_t nb_xaq_cfg;
63         rte_iova_t fc_iova;
64         struct rte_mempool *xaq_pool;
65         /* Dev args */
66         uint32_t xae_cnt;
67         /* HW const */
68         uint32_t xae_waes;
69         uint32_t xaq_buf_size;
70         uint32_t iue;
71 } __rte_cache_aligned;
72
73 static inline struct otx2_sso_evdev *
74 sso_pmd_priv(const struct rte_eventdev *event_dev)
75 {
76         return event_dev->data->dev_private;
77 }
78
79 static inline int
80 parse_kvargs_value(const char *key, const char *value, void *opaque)
81 {
82         RTE_SET_USED(key);
83
84         *(uint32_t *)opaque = (uint32_t)atoi(value);
85         return 0;
86 }
87
88 /* Init and Fini API's */
89 int otx2_sso_init(struct rte_eventdev *event_dev);
90 int otx2_sso_fini(struct rte_eventdev *event_dev);
91
92 #endif /* __OTX2_EVDEV_H__ */