1812afe71SBenoît Ganne/*
2812afe71SBenoît Ganne *------------------------------------------------------------------
3812afe71SBenoît Ganne * Copyright (c) 2019 Cisco and/or its affiliates.
4812afe71SBenoît Ganne * Licensed under the Apache License, Version 2.0 (the "License");
5812afe71SBenoît Ganne * you may not use this file except in compliance with the License.
6812afe71SBenoît Ganne * You may obtain a copy of the License at:
7812afe71SBenoît Ganne *
8812afe71SBenoît Ganne *     http://www.apache.org/licenses/LICENSE-2.0
9812afe71SBenoît Ganne *
10812afe71SBenoît Ganne * Unless required by applicable law or agreed to in writing, software
11812afe71SBenoît Ganne * distributed under the License is distributed on an "AS IS" BASIS,
12812afe71SBenoît Ganne * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13812afe71SBenoît Ganne * See the License for the specific language governing permissions and
14812afe71SBenoît Ganne * limitations under the License.
15812afe71SBenoît Ganne *------------------------------------------------------------------
16812afe71SBenoît Ganne */
17812afe71SBenoît Ganne
18812afe71SBenoît Ganne#include <vlib/vlib.h>
19812afe71SBenoît Ganne#include <rdma/rdma.h>
20812afe71SBenoît Ganne
21812afe71SBenoît Ganneuword
22812afe71SBenoît Ganneunformat_rdma_create_if_args (unformat_input_t * input, va_list * vargs)
23812afe71SBenoît Ganne{
24812afe71SBenoît Ganne  rdma_create_if_args_t *args = va_arg (*vargs, rdma_create_if_args_t *);
25812afe71SBenoît Ganne  unformat_input_t _line_input, *line_input = &_line_input;
26812afe71SBenoît Ganne  uword ret = 1;
27812afe71SBenoît Ganne
28812afe71SBenoît Ganne  if (!unformat_user (input, unformat_line_input, line_input))
29812afe71SBenoît Ganne    return 0;
30812afe71SBenoît Ganne
31812afe71SBenoît Ganne  clib_memset (args, 0, sizeof (*args));
32812afe71SBenoît Ganne
33812afe71SBenoît Ganne  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
34812afe71SBenoît Ganne    {
35812afe71SBenoît Ganne      if (unformat (line_input, "host-if %s", &args->ifname))
36812afe71SBenoît Ganne	;
37812afe71SBenoît Ganne      else if (unformat (line_input, "name %s", &args->name))
38812afe71SBenoît Ganne	;
39812afe71SBenoît Ganne      else if (unformat (line_input, "rx-queue-size %u", &args->rxq_size))
40812afe71SBenoît Ganne	;
41812afe71SBenoît Ganne      else if (unformat (line_input, "tx-queue-size %u", &args->txq_size))
42812afe71SBenoît Ganne	;
43812afe71SBenoît Ganne      else if (unformat (line_input, "num-rx-queues %u", &args->rxq_num))
44812afe71SBenoît Ganne	;
45d8c1ef92SBenoît Ganne      else if (unformat (line_input, "mode auto"))
46d8c1ef92SBenoît Ganne	args->mode = RDMA_MODE_AUTO;
47d8c1ef92SBenoît Ganne      else if (unformat (line_input, "mode ibv"))
48d8c1ef92SBenoît Ganne	args->mode = RDMA_MODE_IBV;
49d8c1ef92SBenoît Ganne      else if (unformat (line_input, "mode dv"))
50d8c1ef92SBenoît Ganne	args->mode = RDMA_MODE_DV;
51812afe71SBenoît Ganne      else
52812afe71SBenoît Ganne	{
53812afe71SBenoît Ganne	  /* return failure on unknown input */
54812afe71SBenoît Ganne	  ret = 0;
55812afe71SBenoît Ganne	  break;
56812afe71SBenoît Ganne	}
57812afe71SBenoît Ganne    }
58812afe71SBenoît Ganne
59812afe71SBenoît Ganne  unformat_free (line_input);
60812afe71SBenoît Ganne  return ret;
61812afe71SBenoît Ganne}
62812afe71SBenoît Ganne
63812afe71SBenoît Ganne/*
64812afe71SBenoît Ganne * fd.io coding-style-patch-verification: ON
65812afe71SBenoît Ganne *
66812afe71SBenoît Ganne * Local Variables:
67812afe71SBenoît Ganne * eval: (c-set-style "gnu")
68812afe71SBenoît Ganne * End:
69812afe71SBenoît Ganne */
70