summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/rdma/api.c16
-rw-r--r--src/plugins/rdma/cli.c2
-rw-r--r--src/plugins/rdma/device.c17
-rw-r--r--src/plugins/rdma/rdma.api24
-rw-r--r--src/plugins/rdma/rdma.h8
-rw-r--r--src/plugins/rdma/test_api.c16
-rw-r--r--src/plugins/rdma/unformat.c6
7 files changed, 79 insertions, 10 deletions
diff --git a/src/plugins/rdma/api.c b/src/plugins/rdma/api.c
index cd3c36065f2..fe1103f99fe 100644
--- a/src/plugins/rdma/api.c
+++ b/src/plugins/rdma/api.c
@@ -29,6 +29,21 @@
#include <vlibapi/api_helper_macros.h>
+static rdma_mode_t
+rdma_api_mode (vl_api_rdma_mode_t mode)
+{
+ switch (mode)
+ {
+ case RDMA_API_MODE_AUTO:
+ return RDMA_MODE_AUTO;
+ case RDMA_API_MODE_IBV:
+ return RDMA_MODE_IBV;
+ case RDMA_API_MODE_DV:
+ return RDMA_MODE_DV;
+ }
+ return RDMA_MODE_AUTO;
+}
+
static void
vl_api_rdma_create_t_handler (vl_api_rdma_create_t * mp)
{
@@ -45,6 +60,7 @@ vl_api_rdma_create_t_handler (vl_api_rdma_create_t * mp)
args.rxq_num = ntohs (mp->rxq_num);
args.rxq_size = ntohs (mp->rxq_size);
args.txq_size = ntohs (mp->txq_size);
+ args.mode = rdma_api_mode (mp->mode);
rdma_create_if (vm, &args);
rv = args.rv;
diff --git a/src/plugins/rdma/cli.c b/src/plugins/rdma/cli.c
index 3f39cfeb66b..73e91c298b1 100644
--- a/src/plugins/rdma/cli.c
+++ b/src/plugins/rdma/cli.c
@@ -49,7 +49,7 @@ VLIB_CLI_COMMAND (rdma_create_command, static) = {
.path = "create interface rdma",
.short_help = "create interface rdma <host-if ifname> [name <name>]"
" [rx-queue-size <size>] [tx-queue-size <size>]"
- " [num-rx-queues <size>]",
+ " [num-rx-queues <size>] [mode <auto|ibv|dv]",
.function = rdma_create_command_fn,
};
/* *INDENT-ON* */
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c
index 70720e4df74..7316edbaa25 100644
--- a/src/plugins/rdma/device.c
+++ b/src/plugins/rdma/device.c
@@ -589,8 +589,8 @@ rdma_create_if (vlib_main_t * vm, rdma_create_if_args_t * args)
u16 qid;
int i;
- args->rxq_size = args->rxq_size ? args->rxq_size : 2 * VLIB_FRAME_SIZE;
- args->txq_size = args->txq_size ? args->txq_size : 2 * VLIB_FRAME_SIZE;
+ args->rxq_size = args->rxq_size ? args->rxq_size : 1024;
+ args->txq_size = args->txq_size ? args->txq_size : 1024;
args->rxq_num = args->rxq_num ? args->rxq_num : 1;
if (!is_pow2 (args->rxq_num))
@@ -611,6 +611,19 @@ rdma_create_if (vlib_main_t * vm, rdma_create_if_args_t * args)
goto err0;
}
+ switch (args->mode)
+ {
+ case RDMA_MODE_AUTO:
+ break;
+ case RDMA_MODE_IBV:
+ break;
+ case RDMA_MODE_DV:
+ args->rv = VNET_API_ERROR_INVALID_VALUE;
+ args->error = clib_error_return (0, "unsupported mode");
+ goto err0;
+ break;
+ }
+
dev_list = ibv_get_device_list (&n_devs);
if (n_devs == 0)
{
diff --git a/src/plugins/rdma/rdma.api b/src/plugins/rdma/rdma.api
index a24c4fc7e21..668f2380e6f 100644
--- a/src/plugins/rdma/rdma.api
+++ b/src/plugins/rdma/rdma.api
@@ -18,14 +18,23 @@
option version = "1.0.0";
import "vnet/interface_types.api";
+enum rdma_mode
+{
+ RDMA_API_MODE_AUTO = 0,
+ RDMA_API_MODE_IBV = 1,
+ RDMA_API_MODE_DV = 2,
+};
+
+
/** \brief
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param host_if - Linux netdev interface name
@param name - new rdma interface name
- @param rxq_num - number of receive queues
- @param rxq_size - receive queue size
- @param txq_size - transmit queue size
+ @param rxq_num - number of receive queues (optional)
+ @param rxq_size - receive queue size (optional)
+ @param txq_size - transmit queue size (optional)
+ @param mode - operation mode (optional)
*/
define rdma_create
@@ -35,10 +44,11 @@ define rdma_create
string host_if[64];
string name[64];
- u16 rxq_num;
- u16 rxq_size;
- u16 txq_size;
- option vat_help = "<host-if ifname> [name <name>] [rx-queue-size <size>] [tx-queue-size <size>] [num-rx-queues <size>]";
+ u16 rxq_num [default=1];
+ u16 rxq_size [default=1024];
+ u16 txq_size [default=1024];
+ vl_api_rdma_mode_t mode [default=0];
+ option vat_help = "<host-if ifname> [name <name>] [rx-queue-size <size>] [tx-queue-size <size>] [num-rx-queues <size>] [mode <auto|ibv|dv>]";
};
/** \brief
diff --git a/src/plugins/rdma/rdma.h b/src/plugins/rdma/rdma.h
index 6e602cb31df..470309afba7 100644
--- a/src/plugins/rdma/rdma.h
+++ b/src/plugins/rdma/rdma.h
@@ -102,6 +102,13 @@ typedef struct
extern rdma_main_t rdma_main;
+typedef enum
+{
+ RDMA_MODE_AUTO = 0,
+ RDMA_MODE_IBV,
+ RDMA_MODE_DV,
+} rdma_mode_t;
+
typedef struct
{
u8 *ifname;
@@ -109,6 +116,7 @@ typedef struct
u32 rxq_size;
u32 txq_size;
u32 rxq_num;
+ rdma_mode_t mode;
/* return */
int rv;
diff --git a/src/plugins/rdma/test_api.c b/src/plugins/rdma/test_api.c
index cfd65c029c2..19c35920b7b 100644
--- a/src/plugins/rdma/test_api.c
+++ b/src/plugins/rdma/test_api.c
@@ -43,6 +43,21 @@ typedef struct
rdma_test_main_t rdma_test_main;
+static vl_api_rdma_mode_t
+api_rdma_mode (rdma_mode_t mode)
+{
+ switch (mode)
+ {
+ case RDMA_MODE_AUTO:
+ return RDMA_API_MODE_AUTO;
+ case RDMA_MODE_IBV:
+ return RDMA_API_MODE_IBV;
+ case RDMA_MODE_DV:
+ return RDMA_API_MODE_DV;
+ }
+ return ~0;
+}
+
/* rdma create API */
static int
api_rdma_create (vat_main_t * vam)
@@ -64,6 +79,7 @@ api_rdma_create (vat_main_t * vam)
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);
S (mp);
W (ret);
diff --git a/src/plugins/rdma/unformat.c b/src/plugins/rdma/unformat.c
index 0b4a1212500..2bbb266f1bf 100644
--- a/src/plugins/rdma/unformat.c
+++ b/src/plugins/rdma/unformat.c
@@ -42,6 +42,12 @@ unformat_rdma_create_if_args (unformat_input_t * input, va_list * vargs)
;
else if (unformat (line_input, "num-rx-queues %u", &args->rxq_num))
;
+ else if (unformat (line_input, "mode auto"))
+ args->mode = RDMA_MODE_AUTO;
+ else if (unformat (line_input, "mode ibv"))
+ args->mode = RDMA_MODE_IBV;
+ else if (unformat (line_input, "mode dv"))
+ args->mode = RDMA_MODE_DV;
else
{
/* return failure on unknown input */