Line data Source code
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 22 0 : unformat_rdma_create_if_args (unformat_input_t * input, va_list * vargs) 23 : { 24 0 : rdma_create_if_args_t *args = va_arg (*vargs, rdma_create_if_args_t *); 25 0 : unformat_input_t _line_input, *line_input = &_line_input; 26 0 : uword ret = 1; 27 : u32 tmp; 28 0 : if (!unformat_user (input, unformat_line_input, line_input)) 29 0 : return 0; 30 : 31 0 : clib_memset (args, 0, sizeof (*args)); 32 : 33 0 : while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) 34 : { 35 0 : if (unformat (line_input, "host-if %s", &args->ifname)) 36 : ; 37 0 : else if (unformat (line_input, "name %s", &args->name)) 38 : ; 39 0 : else if (unformat (line_input, "rx-queue-size %u", &args->rxq_size)) 40 : ; 41 0 : else if (unformat (line_input, "tx-queue-size %u", &args->txq_size)) 42 : ; 43 0 : else if (unformat (line_input, "num-rx-queues %u", &args->rxq_num)) 44 : ; 45 0 : else if (unformat (line_input, "mode auto")) 46 0 : args->mode = RDMA_MODE_AUTO; 47 0 : else if (unformat (line_input, "mode ibv")) 48 0 : args->mode = RDMA_MODE_IBV; 49 0 : else if (unformat (line_input, "mode dv")) 50 0 : args->mode = RDMA_MODE_DV; 51 0 : else if (unformat (line_input, "no-striding")) 52 0 : args->disable_striding_rq = 1; 53 0 : else if (unformat (line_input, "no-multi-seg")) 54 0 : args->no_multi_seg = 1; 55 0 : else if (unformat (line_input, "max-pktlen %u", &tmp)) 56 0 : args->max_pktlen = tmp; 57 0 : else if (unformat (line_input, "rss ipv4-udp")) 58 0 : args->rss4 = RDMA_RSS4_IP_UDP; 59 0 : else if (unformat (line_input, "rss ipv4-tcp")) 60 0 : args->rss4 = RDMA_RSS4_IP_TCP; 61 0 : else if (unformat (line_input, "rss ipv4")) 62 0 : args->rss4 = RDMA_RSS4_IP; 63 0 : else if (unformat (line_input, "rss ipv6-udp")) 64 0 : args->rss6 = RDMA_RSS6_IP_UDP; 65 0 : else if (unformat (line_input, "rss ipv6-tcp")) 66 0 : args->rss6 = RDMA_RSS6_IP_TCP; 67 0 : else if (unformat (line_input, "rss ipv6")) 68 0 : args->rss6 = RDMA_RSS6_IP; 69 : else 70 : { 71 : /* return failure on unknown input */ 72 0 : ret = 0; 73 0 : break; 74 : } 75 : } 76 : 77 0 : unformat_free (line_input); 78 0 : 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 : */