FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
unformat.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2019 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:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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  *------------------------------------------------------------------
16  */
17 
18 #include <vlib/vlib.h>
19 #include <rdma/rdma.h>
20 
21 uword
23 {
24  rdma_create_if_args_t *args = va_arg (*vargs, rdma_create_if_args_t *);
25  unformat_input_t _line_input, *line_input = &_line_input;
26  uword ret = 1;
27  u32 tmp;
28  if (!unformat_user (input, unformat_line_input, line_input))
29  return 0;
30 
31  clib_memset (args, 0, sizeof (*args));
32 
33  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
34  {
35  if (unformat (line_input, "host-if %s", &args->ifname))
36  ;
37  else if (unformat (line_input, "name %s", &args->name))
38  ;
39  else if (unformat (line_input, "rx-queue-size %u", &args->rxq_size))
40  ;
41  else if (unformat (line_input, "tx-queue-size %u", &args->txq_size))
42  ;
43  else if (unformat (line_input, "num-rx-queues %u", &args->rxq_num))
44  ;
45  else if (unformat (line_input, "mode auto"))
46  args->mode = RDMA_MODE_AUTO;
47  else if (unformat (line_input, "mode ibv"))
48  args->mode = RDMA_MODE_IBV;
49  else if (unformat (line_input, "mode dv"))
50  args->mode = RDMA_MODE_DV;
51  else if (unformat (line_input, "no-striding"))
52  args->disable_striding_rq = 1;
53  else if (unformat (line_input, "no-multi-seg"))
54  args->no_multi_seg = 1;
55  else if (unformat (line_input, "max-pktlen %u", &tmp))
56  args->max_pktlen = tmp;
57  else if (unformat (line_input, "rss ipv4-udp"))
58  args->rss4 = RDMA_RSS4_IP_UDP;
59  else if (unformat (line_input, "rss ipv4-tcp"))
60  args->rss4 = RDMA_RSS4_IP_TCP;
61  else if (unformat (line_input, "rss ipv4"))
62  args->rss4 = RDMA_RSS4_IP;
63  else if (unformat (line_input, "rss ipv6-udp"))
64  args->rss6 = RDMA_RSS6_IP_UDP;
65  else if (unformat (line_input, "rss ipv6-tcp"))
66  args->rss6 = RDMA_RSS6_IP_TCP;
67  else if (unformat (line_input, "rss ipv6"))
68  args->rss6 = RDMA_RSS6_IP;
69  else
70  {
71  /* return failure on unknown input */
72  ret = 0;
73  break;
74  }
75  }
76 
77  unformat_free (line_input);
78  return ret;
79 }
80 
81 /*
82  * fd.io coding-style-patch-verification: ON
83  *
84  * Local Variables:
85  * eval: (c-set-style "gnu")
86  * End:
87  */
vlib.h
tmp
u32 * tmp
Definition: interface_output.c:1096
rdma_create_if_args_t::max_pktlen
u16 max_pktlen
Definition: rdma.h:285
rdma_create_if_args_t::rxq_num
u32 rxq_num
Definition: rdma.h:281
RDMA_RSS4_IP_TCP
@ RDMA_RSS4_IP_TCP
Definition: rdma.h:183
RDMA_RSS4_IP_UDP
@ RDMA_RSS4_IP_UDP
Definition: rdma.h:182
unformat_input_t
struct _unformat_input_t unformat_input_t
rdma_create_if_args_t::mode
rdma_mode_t mode
Definition: rdma.h:282
rdma_create_if_args_t::txq_size
u32 txq_size
Definition: rdma.h:280
rdma_create_if_args_t::disable_striding_rq
u8 disable_striding_rq
Definition: rdma.h:284
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
RDMA_MODE_AUTO
@ RDMA_MODE_AUTO
Definition: rdma.h:270
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
uword
u64 uword
Definition: types.h:112
rdma_create_if_args_t::rxq_size
u32 rxq_size
Definition: rdma.h:279
rdma_create_if_args_t
Definition: rdma.h:275
rdma_create_if_args_t::no_multi_seg
u8 no_multi_seg
Definition: rdma.h:283
unformat_line_input
__clib_export uword unformat_line_input(unformat_input_t *i, va_list *va)
Definition: unformat.c:415
rdma_create_if_args_t::rss6
rdma_rss6_t rss6
Definition: rdma.h:287
RDMA_RSS6_IP_UDP
@ RDMA_RSS6_IP_UDP
Definition: rdma.h:190
RDMA_RSS6_IP_TCP
@ RDMA_RSS6_IP_TCP
Definition: rdma.h:191
RDMA_RSS6_IP
@ RDMA_RSS6_IP
Definition: rdma.h:189
RDMA_RSS4_IP
@ RDMA_RSS4_IP
Definition: rdma.h:181
RDMA_MODE_IBV
@ RDMA_MODE_IBV
Definition: rdma.h:271
rdma_create_if_args_t::name
u8 * name
Definition: rdma.h:278
u32
unsigned int u32
Definition: types.h:88
rdma_create_if_args_t::rss4
rdma_rss4_t rss4
Definition: rdma.h:286
rdma_create_if_args_t::ifname
u8 * ifname
Definition: rdma.h:277
unformat_user
__clib_export uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
unformat
__clib_export uword unformat(unformat_input_t *input, const char *fmt,...)
Definition: unformat.c:978
RDMA_MODE_DV
@ RDMA_MODE_DV
Definition: rdma.h:272
rdma.h
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
unformat_rdma_create_if_args
uword unformat_rdma_create_if_args(unformat_input_t *input, va_list *vargs)
Definition: unformat.c:22