session: remove ipv6 lookup threading assert
[vpp.git] / src / plugins / marvell / pp2 / pp2.h
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17
18 #define MVCONF_DBG_LEVEL 0
19 #define MVCONF_PP2_BPOOL_COOKIE_SIZE 32
20 #define MVCONF_PP2_BPOOL_DMA_ADDR_SIZE 64
21 #define MVCONF_DMA_PHYS_ADDR_T_SIZE 64
22 #define MVCONF_SYS_DMA_UIO
23 #define MVCONF_TYPES_PUBLIC
24 #define MVCONF_DMA_PHYS_ADDR_T_PUBLIC
25
26 #include <vlib/vlib.h>
27
28 #include "mv_std.h"
29 #include "env/mv_sys_dma.h"
30 #include "drivers/mv_pp2.h"
31 #include <drivers/mv_pp2_bpool.h>
32 #include <drivers/mv_pp2_ppio.h>
33
34 typedef struct
35 {
36   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
37   u16 size;
38   u32 queue_index;
39   struct pp2_bpool *bpool;
40 } mrvl_pp2_inq_t;
41
42 typedef struct
43 {
44   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
45   u16 size;
46   u32 *buffers;
47   u16 head;
48   u16 tail;
49 } mrvl_pp2_outq_t;
50
51 typedef struct
52 {
53   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
54   u32 flags;
55 #define MRVL_PP2_IF_F_ADMIN_UP (1 << 0)
56   struct pp2_ppio *ppio;
57   u32 per_interface_next_index;
58
59   mrvl_pp2_inq_t *inqs;
60   mrvl_pp2_outq_t *outqs;
61
62   u32 dev_instance;
63   u32 sw_if_index;
64   u32 hw_if_index;
65 } mrvl_pp2_if_t;
66
67 #define MRVL_PP2_BUFF_BATCH_SZ VLIB_FRAME_SIZE
68
69 typedef struct
70 {
71   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
72   struct pp2_hif *hif;
73   struct pp2_ppio_desc *descs;
74   struct buff_release_entry bre[MRVL_PP2_BUFF_BATCH_SZ];
75   u32 buffers[VLIB_FRAME_SIZE];
76 } mrvl_pp2_per_thread_data_t;
77
78 typedef struct
79 {
80   mrvl_pp2_if_t *interfaces;
81   mrvl_pp2_per_thread_data_t *per_thread_data;
82
83   /* API message ID base */
84   u16 msg_id_base;
85 } mrvl_pp2_main_t;
86
87 extern vnet_device_class_t mrvl_pp2_device_class;
88 extern mrvl_pp2_main_t mrvl_pp2_main;
89
90 typedef struct
91 {
92   u8 *name;
93   u16 rx_q_sz;
94   u16 tx_q_sz;
95
96   /* return */
97   i32 rv;
98   u32 sw_if_index;
99   clib_error_t *error;
100 } mrvl_pp2_create_if_args_t;
101
102 void mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args);
103 void mrvl_pp2_delete_if (mrvl_pp2_if_t * dfif);
104 clib_error_t *mrvl_pp2_plugin_api_hookup (vlib_main_t * vm);
105
106 /* output.c */
107
108 #define foreach_mrvl_pp2_tx_func_error \
109   _(NO_FREE_SLOTS, "no free tx slots")                  \
110   _(PPIO_SEND, "pp2_ppio_send errors")                  \
111   _(PPIO_GET_NUM_OUTQ_DONE, "pp2_ppio_get_num_outq_done errors")
112
113 typedef enum
114 {
115 #define _(f,s) MRVL_PP2_TX_ERROR_##f,
116   foreach_mrvl_pp2_tx_func_error
117 #undef _
118     MRVL_PP2_TX_N_ERROR,
119 } mrvl_pp2_tx_func_error_t;
120
121 uword mrvl_pp2_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node,
122                              vlib_frame_t * frame);
123
124 /* input.c */
125
126 typedef struct
127 {
128   u32 next_index;
129   u32 hw_if_index;
130   struct pp2_ppio_desc desc;
131 } mrvl_pp2_input_trace_t;
132
133 extern vlib_node_registration_t mrvl_pp2_input_node;
134
135 /* format.c */
136 format_function_t format_mrvl_pp2_input_trace;
137 format_function_t format_mrvl_pp2_interface;
138 format_function_t format_mrvl_pp2_interface_name;
139
140
141 /*
142  * fd.io coding-style-patch-verification: ON
143  *
144  * Local Variables:
145  * eval: (c-set-style "gnu")
146  * End:
147  */