2 * Copyright (c) 2019 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #include <vlib/vlib.h>
17 #include <vnet/vnet.h>
18 #include <vppinfra/error.h>
19 #include <vnet/ethernet/ethernet.h>
20 #include <vnet/feature/feature.h>
21 #include <vnet/gso/gso.h>
24 set_interface_feature_gso_command_fn (vlib_main_t * vm,
25 unformat_input_t * input,
26 vlib_cli_command_t * cmd)
28 vnet_main_t *vnm = vnet_get_main ();
29 unformat_input_t _line_input, *line_input = &_line_input;
30 clib_error_t *error = 0;
35 /* Get a line of input. */
36 if (!unformat_user (input, unformat_line_input, line_input))
39 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
42 (line_input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
44 else if (unformat (line_input, "enable"))
46 else if (unformat (line_input, "disable"))
50 error = unformat_parse_error (line_input);
55 if (sw_if_index == ~0)
57 error = clib_error_return (0, "Interface not specified...");
60 int rv = vnet_sw_interface_gso_enable_disable (sw_if_index, enable);
64 case VNET_API_ERROR_INVALID_VALUE:
65 error = clib_error_return (0, "interface type is not hardware");
67 case VNET_API_ERROR_FEATURE_DISABLED:
68 error = clib_error_return (0, "interface should be ethernet interface");
75 unformat_free (line_input);
80 VLIB_CLI_COMMAND (set_interface_feature_gso_command, static) = {
81 .path = "set interface feature gso",
82 .short_help = "set interface feature gso <intfc> [enable | disable]",
83 .function = set_interface_feature_gso_command_fn,
88 * fd.io coding-style-patch-verification: ON
91 * eval: (c-set-style "gnu")