blob: 588dabe20da904a49a314e2228e01a0001576109 [file] [log] [blame]
Mohsin Kazmi29467b52019-10-08 19:42:38 +02001/*
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
Filip Tehlar7ea3f062021-06-21 10:08:43 +000024#include <vnet/format_fns.h>
25#include <vnet/gso/gso.api_enum.h>
26#include <vnet/gso/gso.api_types.h>
Mohsin Kazmi29467b52019-10-08 19:42:38 +020027
Filip Tehlar7ea3f062021-06-21 10:08:43 +000028#define REPLY_MSG_ID_BASE gso_main.msg_id_base
Mohsin Kazmi29467b52019-10-08 19:42:38 +020029#include <vlibapi/api_helper_macros.h>
30
Mohsin Kazmi29467b52019-10-08 19:42:38 +020031static 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
Filip Tehlar7ea3f062021-06-21 10:08:43 +000049#include <vnet/gso/gso.api.c>
Mohsin Kazmi29467b52019-10-08 19:42:38 +020050
51static clib_error_t *
52feature_gso_api_hookup (vlib_main_t * vm)
53{
Mohsin Kazmi29467b52019-10-08 19:42:38 +020054 /*
55 * Set up the (msg_name, crc, message-id) table
56 */
Filip Tehlar7ea3f062021-06-21 10:08:43 +000057 gso_main.msg_id_base = setup_message_id_table ();
Mohsin Kazmi29467b52019-10-08 19:42:38 +020058
59 return 0;
60}
61
62VLIB_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 */