FD.io VPP
v17.04-9-g99c0734
Vector Packet Processing
Main Page
Related Pages
Data Structures
Source
Files
Symbols
svm_fifo_segment.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016 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_fifo_segment_h__
16
#define __included_ssvm_fifo_segment_h__
17
18
#include "
svm_fifo.h
"
19
#include "
ssvm.h
"
20
21
typedef
struct
22
{
23
volatile
svm_fifo_t
**
fifos
;
24
u8
*
segment_name
;
25
}
svm_fifo_segment_header_t
;
26
27
typedef
struct
28
{
29
ssvm_private_t
ssvm
;
30
svm_fifo_segment_header_t
*
h
;
31
}
svm_fifo_segment_private_t
;
32
33
typedef
struct
34
{
35
/** pool of segments */
36
svm_fifo_segment_private_t
*
segments
;
37
/* Where to put the next one */
38
u64
next_baseva
;
39
u32
timeout_in_seconds
;
40
}
svm_fifo_segment_main_t
;
41
42
extern
svm_fifo_segment_main_t
svm_fifo_segment_main
;
43
44
typedef
struct
45
{
46
char
*
segment_name
;
47
u32
segment_size
;
48
u32
new_segment_index
;
49
}
svm_fifo_segment_create_args_t
;
50
51
static
inline
svm_fifo_segment_private_t
*
52
svm_fifo_get_segment
(
u32
segment_index)
53
{
54
svm_fifo_segment_main_t
*ssm = &
svm_fifo_segment_main
;
55
return
vec_elt_at_index
(ssm->
segments
, segment_index);
56
}
57
58
#define foreach_ssvm_fifo_segment_api_error \
59
_(OUT_OF_SPACE, "Out of space in segment", -200)
60
61
typedef
enum
62
{
63
#define _(n,s,c) SSVM_FIFO_SEGMENT_API_ERROR_##n = c,
64
foreach_ssvm_fifo_segment_api_error
65
#undef _
66
}
ssvm_fifo_segment_api_error_enum_t
;
67
68
int
svm_fifo_segment_create
(
svm_fifo_segment_create_args_t
*
a
);
69
int
svm_fifo_segment_attach
(
svm_fifo_segment_create_args_t
*
a
);
70
void
svm_fifo_segment_delete
(
svm_fifo_segment_private_t
* s);
71
72
svm_fifo_t
*
svm_fifo_segment_alloc_fifo
(
svm_fifo_segment_private_t
* s,
73
u32
data_size_in_bytes);
74
void
svm_fifo_segment_free_fifo
(
svm_fifo_segment_private_t
* s,
75
svm_fifo_t
* f);
76
77
void
svm_fifo_segment_init
(
u64
baseva,
u32
timeout_in_seconds);
78
79
u32
svm_fifo_segment_index
(
svm_fifo_segment_private_t
* s);
80
81
#endif
/* __included_ssvm_fifo_segment_h__ */
82
83
/*
84
* fd.io coding-style-patch-verification: ON
85
*
86
* Local Variables:
87
* eval: (c-set-style "gnu")
88
* End:
89
*/
ssvm_fifo_segment_api_error_enum_t
ssvm_fifo_segment_api_error_enum_t
Definition:
svm_fifo_segment.h:61
svm_fifo_segment_main_t
Definition:
svm_fifo_segment.h:33
a
a
Definition:
bitmap.h:516
svm_fifo_segment_main_t::timeout_in_seconds
u32 timeout_in_seconds
Definition:
svm_fifo_segment.h:39
svm_fifo_segment_header_t
Definition:
svm_fifo_segment.h:21
svm_fifo_segment_alloc_fifo
svm_fifo_t * svm_fifo_segment_alloc_fifo(svm_fifo_segment_private_t *s, u32 data_size_in_bytes)
Definition:
svm_fifo_segment.c:119
svm_fifo_segment_index
u32 svm_fifo_segment_index(svm_fifo_segment_private_t *s)
Definition:
svm_fifo_segment.c:182
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition:
vec_bootstrap.h:174
u64
unsigned long u64
Definition:
types.h:89
svm_fifo_segment_free_fifo
void svm_fifo_segment_free_fifo(svm_fifo_segment_private_t *s, svm_fifo_t *f)
Definition:
svm_fifo_segment.c:146
svm_fifo_segment_delete
void svm_fifo_segment_delete(svm_fifo_segment_private_t *s)
Definition:
svm_fifo_segment.c:111
svm_fifo_t
Definition:
svm_fifo.h:45
svm_fifo_segment_header_t::segment_name
u8 * segment_name
Definition:
svm_fifo_segment.h:24
svm_fifo_segment_create_args_t::segment_name
char * segment_name
Definition:
svm_fifo_segment.h:46
svm_fifo_segment_main
svm_fifo_segment_main_t svm_fifo_segment_main
Definition:
svm_fifo_segment.c:18
svm_fifo_segment_private_t::h
svm_fifo_segment_header_t * h
Definition:
svm_fifo_segment.h:30
svm_fifo_segment_create_args_t::new_segment_index
u32 new_segment_index
Definition:
svm_fifo_segment.h:48
foreach_ssvm_fifo_segment_api_error
#define foreach_ssvm_fifo_segment_api_error
Definition:
svm_fifo_segment.h:58
svm_fifo_segment_private_t
Definition:
svm_fifo_segment.h:27
ssvm.h
svm_fifo_segment_create
int svm_fifo_segment_create(svm_fifo_segment_create_args_t *a)
(master) create an svm fifo segment
Definition:
svm_fifo_segment.c:22
svm_fifo_segment_create_args_t::segment_size
u32 segment_size
Definition:
svm_fifo_segment.h:47
svm_fifo_get_segment
static svm_fifo_segment_private_t * svm_fifo_get_segment(u32 segment_index)
Definition:
svm_fifo_segment.h:52
u32
unsigned int u32
Definition:
types.h:88
svm_fifo_segment_init
void svm_fifo_segment_init(u64 baseva, u32 timeout_in_seconds)
Definition:
svm_fifo_segment.c:173
svm_fifo_segment_attach
int svm_fifo_segment_attach(svm_fifo_segment_create_args_t *a)
(slave) attach to an svm fifo segment
Definition:
svm_fifo_segment.c:75
svm_fifo_segment_private_t::ssvm
ssvm_private_t ssvm
Definition:
svm_fifo_segment.h:29
svm_fifo_segment_main_t::segments
svm_fifo_segment_private_t * segments
pool of segments
Definition:
svm_fifo_segment.h:36
u8
unsigned char u8
Definition:
types.h:56
svm_fifo_segment_create_args_t
Definition:
svm_fifo_segment.h:44
svm_fifo.h
ssvm_private_t
Definition:
ssvm.h:74
svm_fifo_segment_header_t::fifos
volatile svm_fifo_t ** fifos
Definition:
svm_fifo_segment.h:23
svm_fifo_segment_main_t::next_baseva
u64 next_baseva
Definition:
svm_fifo_segment.h:38
src
svm
svm_fifo_segment.h
Generated on Mon May 15 2017 20:49:55 for FD.io VPP by
1.8.11