MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_device_reconfigure

Function test_device_reconfigure

dpdk/app/test/test_cryptodev.c:12881–12958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12879}
12880
12881static int
12882test_device_reconfigure(void)
12883{
12884 struct crypto_testsuite_params *ts_params = &testsuite_params;
12885 uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs;
12886 struct rte_cryptodev_qp_conf qp_conf = {
12887 .nb_descriptors = MAX_NUM_OPS_INFLIGHT,
12888 .mp_session = ts_params->session_mpool
12889 };
12890 uint16_t qp_id, dev_id, num_devs = 0;
12891
12892 TEST_ASSERT((num_devs = rte_cryptodev_count()) >= 1,
12893 "Need at least %d devices for test", 1);
12894
12895 dev_id = ts_params->valid_devs[0];
12896
12897 /* Stop the device in case it's started so it can be configured */
12898 rte_cryptodev_stop(dev_id);
12899
12900 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf),
12901 "Failed test for rte_cryptodev_configure: "
12902 "dev_num %u", dev_id);
12903
12904 /* Reconfigure with same configure params */
12905 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf),
12906 "Failed test for rte_cryptodev_configure: "
12907 "dev_num %u", dev_id);
12908
12909 /* Reconfigure with just one queue pair */
12910 ts_params->conf.nb_queue_pairs = 1;
12911
12912 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
12913 &ts_params->conf),
12914 "Failed to configure cryptodev: dev_id %u, qp_id %u",
12915 ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
12916
12917 for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) {
12918 TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
12919 ts_params->valid_devs[0], qp_id, &qp_conf,
12920 rte_cryptodev_socket_id(
12921 ts_params->valid_devs[0])),
12922 "Failed test for "
12923 "rte_cryptodev_queue_pair_setup: num_inflights "
12924 "%u on qp %u on cryptodev %u",
12925 qp_conf.nb_descriptors, qp_id,
12926 ts_params->valid_devs[0]);
12927 }
12928
12929 /* Reconfigure with max number of queue pairs */
12930 ts_params->conf.nb_queue_pairs = orig_nb_qps;
12931
12932 TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0],
12933 &ts_params->conf),
12934 "Failed to configure cryptodev: dev_id %u, qp_id %u",
12935 ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs);
12936
12937 qp_conf.mp_session = ts_params->session_mpool;
12938

Callers

nothing calls this directly

Calls 7

rte_cryptodev_countFunction · 0.85
rte_cryptodev_stopFunction · 0.85
rte_cryptodev_configureFunction · 0.85
rte_cryptodev_socket_idFunction · 0.85
rte_cryptodev_startFunction · 0.85

Tested by

no test coverage detected