aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/rdma/test_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/rdma/test_api.c')
-rw-r--r--src/plugins/rdma/test_api.c92
1 files changed, 91 insertions, 1 deletions
diff --git a/src/plugins/rdma/test_api.c b/src/plugins/rdma/test_api.c
index ff5dec1ad95..e9d5fcaad98 100644
--- a/src/plugins/rdma/test_api.c
+++ b/src/plugins/rdma/test_api.c
@@ -58,6 +58,40 @@ api_rdma_mode (rdma_mode_t mode)
return ~0;
}
+static vl_api_rdma_rss4_t
+api_rdma_rss4 (rdma_rss4_t rss4)
+{
+ switch (rss4)
+ {
+ case RDMA_RSS4_AUTO:
+ return RDMA_API_RSS4_AUTO;
+ case RDMA_RSS4_IP:
+ return RDMA_API_RSS4_IP;
+ case RDMA_RSS4_IP_UDP:
+ return RDMA_API_RSS4_IP_UDP;
+ case RDMA_RSS4_IP_TCP:
+ return RDMA_API_RSS4_IP_TCP;
+ }
+ return ~0;
+}
+
+static vl_api_rdma_rss6_t
+api_rdma_rss6 (rdma_rss6_t rss6)
+{
+ switch (rss6)
+ {
+ case RDMA_RSS6_AUTO:
+ return RDMA_API_RSS6_AUTO;
+ case RDMA_RSS6_IP:
+ return RDMA_API_RSS6_IP;
+ case RDMA_RSS6_IP_UDP:
+ return RDMA_API_RSS6_IP_UDP;
+ case RDMA_RSS6_IP_TCP:
+ return RDMA_API_RSS6_IP_TCP;
+ }
+ return ~0;
+}
+
/* rdma create API */
static int
api_rdma_create (vat_main_t * vam)
@@ -103,7 +137,10 @@ api_rdma_create_v2 (vat_main_t * vam)
M (RDMA_CREATE_V2, mp);
snprintf ((char *) mp->host_if, sizeof (mp->host_if), "%s", args.ifname);
- snprintf ((char *) mp->name, sizeof (mp->name), "%s", args.name);
+ if (args.name)
+ snprintf ((char *) mp->name, sizeof (mp->name), "%s", args.name);
+ else
+ mp->name[0] = 0;
mp->rxq_num = clib_host_to_net_u16 (args.rxq_num);
mp->rxq_size = clib_host_to_net_u16 (args.rxq_size);
mp->txq_size = clib_host_to_net_u16 (args.txq_size);
@@ -117,6 +154,41 @@ api_rdma_create_v2 (vat_main_t * vam)
return ret;
}
+static int
+api_rdma_create_v3 (vat_main_t *vam)
+{
+ vl_api_rdma_create_v3_t *mp;
+ rdma_create_if_args_t args;
+ int ret;
+
+ if (!unformat_user (vam->input, unformat_rdma_create_if_args, &args))
+ {
+ clib_warning ("unknown input `%U'", format_unformat_error, vam->input);
+ return -99;
+ }
+
+ M (RDMA_CREATE_V3, mp);
+
+ snprintf ((char *) mp->host_if, sizeof (mp->host_if), "%s", args.ifname);
+ if (args.name)
+ snprintf ((char *) mp->name, sizeof (mp->name), "%s", args.name);
+ else
+ mp->name[0] = 0;
+ mp->rxq_num = clib_host_to_net_u16 (args.rxq_num);
+ mp->rxq_size = clib_host_to_net_u16 (args.rxq_size);
+ mp->txq_size = clib_host_to_net_u16 (args.txq_size);
+ mp->mode = api_rdma_mode (args.mode);
+ mp->no_multi_seg = args.no_multi_seg;
+ mp->max_pktlen = clib_host_to_net_u16 (args.max_pktlen);
+ mp->rss4 = api_rdma_rss4 (args.rss4);
+ mp->rss6 = api_rdma_rss6 (args.rss6);
+
+ S (mp);
+ W (ret);
+
+ return ret;
+}
+
/* rdma-create reply handler */
static void
vl_api_rdma_create_reply_t_handler (vl_api_rdma_create_reply_t * mp)
@@ -153,6 +225,24 @@ vl_api_rdma_create_v2_reply_t_handler (vl_api_rdma_create_v2_reply_t * mp)
vam->regenerate_interface_table = 1;
}
+/* rdma-create reply handler v3 */
+static void
+vl_api_rdma_create_v3_reply_t_handler (vl_api_rdma_create_v3_reply_t *mp)
+{
+ vat_main_t *vam = rdma_test_main.vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (retval == 0)
+ {
+ fformat (vam->ofp, "created rdma with sw_if_index %d\n",
+ ntohl (mp->sw_if_index));
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+ vam->regenerate_interface_table = 1;
+}
+
/* rdma delete API */
static int
api_rdma_delete (vat_main_t * vam)