diff options
author | Vratko Polak <vrpolak@cisco.com> | 2023-12-14 17:11:38 +0100 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2023-12-15 08:44:10 +0000 |
commit | 04d262d1eba969538950da7183cfa77ff3d70dff (patch) | |
tree | 093b6db0909074f5731c2e67c5060a9738c3b8d4 /src/plugins/rdma/test_api.c | |
parent | 6d14c0cc5af3185563c4c7a00fe297cb1301ea03 (diff) |
rdma: add rdma_create_v4 that handles flags properly
The _v3 was not handling endianness on flags (e.g. mode).
Marking _v3 as deprecated, but keeping it
as there might be users who learned to preprocess their flag values.
+ Also, format PCI product_name as a vector, not a string.
Type: fix
Change-Id: I50c4b44f3570f02518dbd9a43239c1a37612d24a
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/plugins/rdma/test_api.c')
-rw-r--r-- | src/plugins/rdma/test_api.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/plugins/rdma/test_api.c b/src/plugins/rdma/test_api.c index e9d5fcaad98..4ec4d3bf345 100644 --- a/src/plugins/rdma/test_api.c +++ b/src/plugins/rdma/test_api.c @@ -189,6 +189,41 @@ api_rdma_create_v3 (vat_main_t *vam) return ret; } +static int +api_rdma_create_v4 (vat_main_t *vam) +{ + vl_api_rdma_create_v4_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_V4, 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 = args.rxq_num; + mp->rxq_size = args.rxq_size; + mp->txq_size = args.txq_size; + mp->mode = api_rdma_mode (args.mode); + mp->no_multi_seg = args.no_multi_seg; + mp->max_pktlen = 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) @@ -243,6 +278,24 @@ vl_api_rdma_create_v3_reply_t_handler (vl_api_rdma_create_v3_reply_t *mp) vam->regenerate_interface_table = 1; } +/* rdma-create reply handler v4 */ +static void +vl_api_rdma_create_v4_reply_t_handler (vl_api_rdma_create_v4_reply_t *mp) +{ + vat_main_t *vam = rdma_test_main.vat_main; + i32 retval = 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) |