diff options
author | Benoît Ganne <bganne@cisco.com> | 2021-03-17 14:41:33 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-05-04 07:23:03 +0000 |
commit | f5a45680ee1c9c586ab2b037e3d71354789e4403 (patch) | |
tree | 81cc137d27befc7802efccd91aa6728c627f9064 /src/plugins/rdma/test_api.c | |
parent | ee60ac638c9abcd0763c57fce0e3e646723ea0e0 (diff) |
rdma: add support for RSS configuration
Type: feature
Change-Id: I911ee94b624ef5edf46b34666597eff93df1d1ed
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/rdma/test_api.c')
-rw-r--r-- | src/plugins/rdma/test_api.c | 92 |
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) |