2 *------------------------------------------------------------------
3 * Copyright (c) 2020 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *------------------------------------------------------------------
18 #include <vlib/vlib.h>
19 #include <af_xdp/af_xdp.h>
22 unformat_af_xdp_create_if_args (unformat_input_t * input, va_list * vargs)
24 af_xdp_create_if_args_t *args = va_arg (*vargs, af_xdp_create_if_args_t *);
25 unformat_input_t _line_input, *line_input = &_line_input;
28 if (!unformat_user (input, unformat_line_input, line_input))
31 clib_memset (args, 0, sizeof (*args));
33 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
35 if (unformat (line_input, "host-if %s", &args->linux_ifname))
37 else if (unformat (line_input, "name %s", &args->name))
39 else if (unformat (line_input, "rx-queue-size %u", &args->rxq_size))
41 else if (unformat (line_input, "tx-queue-size %u", &args->txq_size))
43 else if (unformat (line_input, "num-rx-queues all"))
44 args->rxq_num = AF_XDP_NUM_RX_QUEUES_ALL;
45 else if (unformat (line_input, "num-rx-queues %u", &args->rxq_num))
47 else if (unformat (line_input, "prog %s", &args->prog))
49 else if (unformat (line_input, "netns %s", &args->netns))
51 else if (unformat (line_input, "no-zero-copy"))
52 args->mode = AF_XDP_MODE_COPY;
53 else if (unformat (line_input, "zero-copy"))
54 args->mode = AF_XDP_MODE_ZERO_COPY;
55 else if (unformat (line_input, "no-syscall-lock"))
56 args->flags |= AF_XDP_CREATE_FLAGS_NO_SYSCALL_LOCK;
59 /* return failure on unknown input */
65 unformat_free (line_input);
70 * fd.io coding-style-patch-verification: ON
73 * eval: (c-set-style "gnu")