lib/pattern: Support binary pattern buffers on windows
[fio.git] / engines / librpma_fio.h
index 8cfb2e2d1a40e533ae567e516e3a38c75b82258f..480ded1bde15b24f80209ae688cf49ee26e0d2d5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * librpma_fio: librpma_apm and librpma_gpspm engines' common header.
  *
- * Copyright 2021, Intel Corporation
+ * Copyright 2021-2022, Intel Corporation
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License,
@@ -41,6 +41,8 @@ struct librpma_fio_options_values {
        char *port;
        /* Direct Write to PMem is possible */
        unsigned int direct_write_to_pmem;
+       /* Set to 0 to wait for completion instead of busy-wait polling completion. */
+       unsigned int busy_wait_polling;
 };
 
 extern struct fio_option librpma_fio_options[];
@@ -70,12 +72,17 @@ struct librpma_fio_mem {
 
        /* size of the mapped persistent memory */
        size_t size_mmap;
+
+#ifdef CONFIG_LIBPMEM2_INSTALLED
+       /* libpmem2 structure used for mapping PMem */
+       struct pmem2_map *map;
+#endif
 };
 
 char *librpma_fio_allocate_dram(struct thread_data *td, size_t size,
                struct librpma_fio_mem *mem);
 
-char *librpma_fio_allocate_pmem(struct thread_data *td, const char *filename,
+char *librpma_fio_allocate_pmem(struct thread_data *td, struct fio_file *f,
                size_t size, struct librpma_fio_mem *mem);
 
 void librpma_fio_free(struct librpma_fio_mem *mem);
@@ -92,12 +99,13 @@ typedef int (*librpma_fio_flush_t)(struct thread_data *td,
  * - ( 0) - skip
  * - (-1) - on error
  */
-typedef int (*librpma_fio_get_io_u_index_t)(struct rpma_completion *cmpl,
+typedef int (*librpma_fio_get_io_u_index_t)(struct ibv_wc *wc,
                unsigned int *io_u_index);
 
 struct librpma_fio_client_data {
        struct rpma_peer *peer;
        struct rpma_conn *conn;
+       struct rpma_cq *cq;
 
        /* aligned td->orig_buffer */
        char *orig_buffer_aligned;
@@ -197,29 +205,29 @@ static inline int librpma_fio_client_io_complete_all_sends(
                struct thread_data *td)
 {
        struct librpma_fio_client_data *ccd = td->io_ops_data;
-       struct rpma_completion cmpl;
+       struct ibv_wc wc;
        int ret;
 
        while (ccd->op_send_posted != ccd->op_send_completed) {
                /* get a completion */
-               ret = rpma_conn_completion_get(ccd->conn, &cmpl);
+               ret = rpma_cq_get_wc(ccd->cq, 1, &wc, NULL);
                if (ret == RPMA_E_NO_COMPLETION) {
                        /* lack of completion is not an error */
                        continue;
                } else if (ret != 0) {
                        /* an error occurred */
-                       librpma_td_verror(td, ret, "rpma_conn_completion_get");
+                       librpma_td_verror(td, ret, "rpma_cq_get_wc");
                        break;
                }
 
-               if (cmpl.op_status != IBV_WC_SUCCESS)
+               if (wc.status != IBV_WC_SUCCESS)
                        return -1;
 
-               if (cmpl.op == RPMA_OP_SEND)
+               if (wc.opcode == IBV_WC_SEND)
                        ++ccd->op_send_completed;
                else {
                        log_err(
-                               "A completion other than RPMA_OP_SEND got during cleaning up the CQ from SENDs\n");
+                               "A completion other than IBV_WC_SEND got during cleaning up the CQ from SENDs\n");
                        return -1;
                }
        }
@@ -249,6 +257,7 @@ struct librpma_fio_server_data {
 
        /* resources of an incoming connection */
        struct rpma_conn *conn;
+       struct rpma_cq *cq;
 
        char *ws_ptr;
        struct rpma_mr_local *ws_mr;