FD.io VPP  v17.01.1-3-gc6833f8
Vector Packet Processing
ssvm_eth.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_ssvm_eth_h__
16 #define __included_ssvm_eth_h__
17 
18 #include <vnet/vnet.h>
19 
20 #include <vppinfra/elog.h>
21 #include <vppinfra/error.h>
22 #include <vppinfra/format.h>
23 #include <vppinfra/hash.h>
24 #include <vppinfra/vec.h>
25 #include <vppinfra/elog.h>
26 #include <vlib/vlib.h>
27 #include <vnet/ethernet/ethernet.h>
28 #include <vnet/devices/devices.h>
29 #include <vnet/ip/ip.h>
30 #include <vnet/pg/pg.h>
32 
33 #include <ssvm.h>
34 
37 
38 #define SSVM_BUFFER_SIZE \
39  (VLIB_BUFFER_DATA_SIZE + VLIB_BUFFER_PRE_DATA_SIZE)
40 #define SSVM_PACKET_TYPE 1
41 
42 typedef struct
43 {
44  /* Type of queue element */
47 #define SSVM_BUFFER_NEXT_PRESENT (1<<0)
55  /* offset 16 */
57  /* pad to an even multiple of 64 octets */
60 
61 typedef struct
62 {
63  /* vector of point-to-point connections */
65 
68 
69  /* Configurable parameters */
70  /* base address for next placement */
75 
76  /* Segment names */
77  u8 **names;
78 
79  /* convenience */
84 
86 
87 typedef enum
88 {
97 
98 /*
99  * debug scaffolding.
100  */
101 static inline void
103 {
104 #if CLIB_DEBUG > 0
106  ssvm_private_t *intfc;
108  u32 *elt_indices;
109  u32 n_available;
110  int i;
111 
112  for (i = 0; i < vec_len (em->intfcs); i++)
113  {
114  intfc = em->intfcs + i;
115  sh = intfc->sh;
116  u32 my_pid = intfc->my_pid;
117 
118  if (need_lock)
119  ssvm_lock (sh, my_pid, 15);
120 
121  elt_indices = (u32 *) (sh->opaque[CHUNK_POOL_FREELIST_INDEX]);
122  n_available = (u32) (uword) (sh->opaque[CHUNK_POOL_NFREE]);
123 
124  for (i = 0; i < n_available; i++)
125  ASSERT (elt_indices[i] < 2048);
126 
127  if (need_lock)
128  ssvm_unlock (sh);
129  }
130 #endif
131 }
132 
133 #endif /* __included_ssvm_eth_h__ */
134 
135 /*
136  * fd.io coding-style-patch-verification: ON
137  *
138  * Local Variables:
139  * eval: (c-set-style "gnu")
140  * End:
141  */
u64 segment_size
Definition: ssvm_eth.h:72
ssvm_eth_opaque_index_t
Definition: ssvm_eth.h:87
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
elog_main_t * elog_main
Definition: ssvm_eth.h:82
u32 * buffer_cache
Definition: ssvm_eth.h:66
void * opaque[SSVM_N_OPAQUE]
Definition: ssvm.h:62
struct _vlib_node_registration vlib_node_registration_t
ssvm_shared_header_t * sh
Definition: ssvm.h:73
struct _vnet_device_class vnet_device_class_t
u32 * chunk_cache
Definition: ssvm_eth.h:67
unsigned long u64
Definition: types.h:89
vnet_device_class_t ssvm_eth_device_class
vnet_main_t * vnet_main
Definition: ssvm_eth.h:81
static void ssvm_unlock(ssvm_shared_header_t *h)
Definition: ssvm.h:102
vlib_main_t * vlib_main
Definition: ssvm_eth.h:80
ssvm_private_t * intfcs
Definition: ssvm_eth.h:64
vlib_node_registration_t ssvm_eth_input_node
(constructor) VLIB_REGISTER_NODE (ssvm_eth_input_node)
Definition: node.c:17
static void ssvm_eth_validate_freelists(int need_lock)
Definition: ssvm_eth.h:102
#define SSVM_BUFFER_SIZE
Definition: ssvm_eth.h:38
u32 my_pid
Definition: ssvm.h:75
#define ASSERT(truth)
unsigned int u32
Definition: types.h:88
u64 next_base_va
Definition: ssvm_eth.h:71
u64 uword
Definition: types.h:112
unsigned short u16
Definition: types.h:57
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
ssvm_eth_main_t ssvm_eth_main
Definition: ssvm_eth.h:85
u16 total_length_not_including_first_buffer
Definition: ssvm_eth.h:52
short i16
Definition: types.h:46
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:67
static void ssvm_lock(ssvm_shared_header_t *h, u32 my_pid, u32 tag)
Definition: ssvm.h:85
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".