gso: api cleanup
[vpp.git] / src / vnet / gso / gso_api.c
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/format_fns.h>
25 #include <vnet/gso/gso.api_enum.h>
26 #include <vnet/gso/gso.api_types.h>
27
28 #define REPLY_MSG_ID_BASE gso_main.msg_id_base
29 #include <vlibapi/api_helper_macros.h>
30
31 static void
32   vl_api_feature_gso_enable_disable_t_handler
33   (vl_api_feature_gso_enable_disable_t * mp)
34 {
35   vl_api_feature_gso_enable_disable_reply_t *rmp;
36   int rv = 0;
37
38   VALIDATE_SW_IF_INDEX (mp);
39
40   rv =
41     vnet_sw_interface_gso_enable_disable (ntohl (mp->sw_if_index),
42                                           mp->enable_disable);
43
44   BAD_SW_IF_INDEX_LABEL;
45
46   REPLY_MACRO (VL_API_FEATURE_GSO_ENABLE_DISABLE_REPLY);
47 }
48
49 #include <vnet/gso/gso.api.c>
50
51 static clib_error_t *
52 feature_gso_api_hookup (vlib_main_t * vm)
53 {
54   /*
55    * Set up the (msg_name, crc, message-id) table
56    */
57   gso_main.msg_id_base = setup_message_id_table ();
58
59   return 0;
60 }
61
62 VLIB_API_INIT_FUNCTION (feature_gso_api_hookup);
63
64 /*
65  * fd.io coding-style-patch-verification: ON
66  *
67  * Local Variables:
68  * eval: (c-set-style "gnu")
69  * End:
70  */