double ratio;
enum cleanup_st cleanup;
+ int perf_comp_force_stop;
};
int
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
return res;
}
ops[op_id]->private_xform = priv_xform;
}
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_enq = rte_compressdev_enqueue_burst(dev_id,
mem->qp_id, ops,
num_ops);
/* Dequeue the last operations */
while (total_deq_ops < total_ops) {
+ if (unlikely(test_data->perf_comp_force_stop))
+ goto end;
+
num_deq = rte_compressdev_dequeue_burst(dev_id,
mem->qp_id,
deq_ops,
rte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);
rte_compressdev_private_xform_free(dev_id, priv_xform);
rte_free(ops);
+
+ if (test_data->perf_comp_force_stop) {
+ RTE_LOG(ERR, USER1,
+ "lcore: %d Perf. test has been aborted by user\n",
+ mem->lcore_id);
+ res = -1;
+ }
+
return res;
}
* Copyright(c) 2018 Intel Corporation
*/
+#include <signal.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <rte_malloc.h>
#include <rte_eal.h>
#include <rte_log.h>
}
};
+static struct comp_test_data *test_data;
+
static int
comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id)
{
return ret;
}
+static void
+comp_perf_cleanup_on_signal(int signalNumber __rte_unused)
+{
+ test_data->perf_comp_force_stop = 1;
+}
+
+static void
+comp_perf_register_cleanup_on_signal(void)
+{
+ signal(SIGTERM, comp_perf_cleanup_on_signal);
+ signal(SIGINT, comp_perf_cleanup_on_signal);
+}
+
int
main(int argc, char **argv)
{
uint8_t level_idx = 0;
int ret, i;
- struct comp_test_data *test_data;
void *ctx[RTE_MAX_LCORE] = {};
uint8_t enabled_cdevs[RTE_COMPRESS_MAX_DEVS];
int nb_compressdevs = 0;
rte_exit(EXIT_FAILURE, "Cannot reserve memory in socket %d\n",
rte_socket_id());
+ comp_perf_register_cleanup_on_signal();
+
ret = EXIT_SUCCESS;
test_data->cleanup = ST_TEST_DATA;
comp_perf_options_default(test_data);
/* fallthrough */
case ST_COMPDEV:
for (i = 0; i < nb_compressdevs &&
- i < RTE_COMPRESS_MAX_DEVS; i++)
+ i < RTE_COMPRESS_MAX_DEVS; i++) {
rte_compressdev_stop(enabled_cdevs[i]);
+ rte_compressdev_close(enabled_cdevs[i]);
+ }
/* fallthrough */
case ST_TEST_DATA:
rte_free(test_data);