FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
gso_api.c
Go to the documentation of this file.
1
/*
2
*------------------------------------------------------------------
3
* gso_api.c - Generic Segmentation Offload api
4
*
5
* Copyright (c) 2019 Cisco and/or its affiliates.
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at:
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*------------------------------------------------------------------
18
*/
19
20
#include <
vnet/vnet.h
>
21
#include <
vlibmemory/api.h
>
22
#include <
vnet/gso/gso.h
>
23
24
#include <
vnet/vnet_msg_enum.h
>
25
26
#define vl_typedefs
/* define message structures */
27
#include <
vnet/vnet_all_api_h.h
>
28
#undef vl_typedefs
29
30
#define vl_endianfun
/* define message structures */
31
#include <
vnet/vnet_all_api_h.h
>
32
#undef vl_endianfun
33
34
/* instantiate all the print functions we know about */
35
#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
36
#define vl_printfun
37
#include <
vnet/vnet_all_api_h.h
>
38
#undef vl_printfun
39
40
#include <
vlibapi/api_helper_macros.h
>
41
42
#define foreach_feature_gso_api_msg \
43
_(FEATURE_GSO_ENABLE_DISABLE, feature_gso_enable_disable)
44
45
static
void
46
vl_api_feature_gso_enable_disable_t_handler
47
(
vl_api_feature_gso_enable_disable_t
* mp)
48
{
49
vl_api_feature_gso_enable_disable_reply_t *rmp;
50
int
rv
= 0;
51
52
VALIDATE_SW_IF_INDEX
(mp);
53
54
rv
=
55
vnet_sw_interface_gso_enable_disable
(ntohl (mp->
sw_if_index
),
56
mp->
enable_disable
);
57
58
BAD_SW_IF_INDEX_LABEL
;
59
60
REPLY_MACRO
(VL_API_FEATURE_GSO_ENABLE_DISABLE_REPLY);
61
}
62
63
#define vl_msg_name_crc_list
64
#include <vnet/gso/gso.api.h>
65
#undef vl_msg_name_crc_list
66
67
static
void
68
setup_message_id_table
(
api_main_t
*
am
)
69
{
70
#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
71
foreach_vl_msg_name_crc_gso;
72
#undef _
73
}
74
75
static
clib_error_t
*
76
feature_gso_api_hookup
(
vlib_main_t
*
vm
)
77
{
78
api_main_t
*
am
=
vlibapi_get_main
();
79
80
#define _(N,n) \
81
vl_msg_api_set_handlers(VL_API_##N, #n, \
82
vl_api_##n##_t_handler, \
83
vl_noop_handler, \
84
vl_api_##n##_t_endian, \
85
vl_api_##n##_t_print, \
86
sizeof(vl_api_##n##_t), 1);
87
foreach_feature_gso_api_msg
;
88
#undef _
89
90
/*
91
* Set up the (msg_name, crc, message-id) table
92
*/
93
setup_message_id_table
(
am
);
94
95
return
0;
96
}
97
98
VLIB_API_INIT_FUNCTION
(
feature_gso_api_hookup
);
99
100
/*
101
* fd.io coding-style-patch-verification: ON
102
*
103
* Local Variables:
104
* eval: (c-set-style "gnu")
105
* End:
106
*/
VALIDATE_SW_IF_INDEX
#define VALIDATE_SW_IF_INDEX(mp)
Definition:
api_helper_macros.h:281
api.h
VLIB_API_INIT_FUNCTION
VLIB_API_INIT_FUNCTION(feature_gso_api_hookup)
setup_message_id_table
static void setup_message_id_table(api_main_t *am)
Definition:
gso_api.c:68
vl_api_feature_gso_enable_disable_t_handler
static void vl_api_feature_gso_enable_disable_t_handler(vl_api_feature_gso_enable_disable_t *mp)
Definition:
gso_api.c:47
am
app_main_t * am
Definition:
application.c:489
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition:
nat44_ei.c:3047
feature_gso_api_hookup
static clib_error_t * feature_gso_api_hookup(vlib_main_t *vm)
Definition:
gso_api.c:76
vl_api_feature_gso_enable_disable_t::enable_disable
bool enable_disable
Definition:
gso.api:31
vnet_msg_enum.h
REPLY_MACRO
#define REPLY_MACRO(t)
Definition:
api_helper_macros.h:30
foreach_feature_gso_api_msg
#define foreach_feature_gso_api_msg
Definition:
gso_api.c:42
vnet_sw_interface_gso_enable_disable
int vnet_sw_interface_gso_enable_disable(u32 sw_if_index, u8 enable)
Definition:
gso.c:27
vlibapi_get_main
static api_main_t * vlibapi_get_main(void)
Definition:
api_common.h:390
gso.h
BAD_SW_IF_INDEX_LABEL
#define BAD_SW_IF_INDEX_LABEL
Definition:
api_helper_macros.h:289
api_main_t
API main structure, used by both vpp and binary API clients.
Definition:
api_common.h:228
vl_api_feature_gso_enable_disable_t
Enable or disable interface feature gso arc.
Definition:
gso.api:26
api_helper_macros.h
vlib_main_t
Definition:
main.h:102
clib_error_t
Definition:
clib_error.h:21
vnet_all_api_h.h
vl_api_feature_gso_enable_disable_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition:
gso.api:30
rv
int __clib_unused rv
Definition:
application.c:491
vnet.h
src
vnet
gso
gso_api.c
Generated on Sat Jan 8 2022 10:05:00 for FD.io VPP by
1.8.17