]> git.droids-corp.org - dpdk.git/commitdiff
gpudev: use device memory pointer for CPU unmap
authorElena Agostini <eagostini@nvidia.com>
Mon, 21 Feb 2022 23:07:06 +0000 (23:07 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 22 Feb 2022 19:04:39 +0000 (20:04 +0100)
Update rte_gpu_mem_cpu_unmap() header documentation
and the test application to use GPU pointer when unmapping.

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
app/test-gpudev/main.c
lib/gpudev/rte_gpudev.h

index 417f2d78b7dbfa6b942ae9cacbd865bac4f364f4..d4b8b8971d48ab31f4a9fb72bc916b2b8beac33b 100644 (file)
@@ -210,7 +210,7 @@ gpu_mem_cpu_map(uint16_t gpu_id)
                fprintf(stderr, "rte_gpu_mem_cpu_map returned error\n");
                goto error;
        }
-       printf("GPU memory mapped for CPU access at 0x%p\n", ptr_cpu);
+       printf("GPU memory CPU mapped at 0x%p\n", ptr_cpu);
 
        ((uint8_t *)ptr_cpu)[0] = 0x4;
        ((uint8_t *)ptr_cpu)[1] = 0x5;
@@ -221,12 +221,12 @@ gpu_mem_cpu_map(uint16_t gpu_id)
                        ((uint8_t *)ptr_cpu)[1],
                        ((uint8_t *)ptr_cpu)[2]);
 
-       ret = rte_gpu_mem_cpu_unmap(gpu_id, ptr_cpu);
+       ret = rte_gpu_mem_cpu_unmap(gpu_id, ptr_gpu);
        if (ret < 0) {
                fprintf(stderr, "rte_gpu_mem_cpu_unmap returned error %d\n", ret);
                goto error;
        }
-       printf("GPU memory mapped for CPU access at 0x%p\n", ptr_cpu);
+       printf("GPU memory CPU unmapped, 0x%p not valid anymore\n", ptr_cpu);
 
        ret = rte_gpu_mem_free(gpu_id, ptr_gpu);
        if (ret < 0) {
@@ -240,7 +240,7 @@ gpu_mem_cpu_map(uint16_t gpu_id)
 
 error:
 
-       rte_gpu_mem_cpu_unmap(gpu_id, ptr_cpu);
+       rte_gpu_mem_cpu_unmap(gpu_id, ptr_gpu);
        rte_gpu_mem_free(gpu_id, ptr_gpu);
 
        printf("\n=======> TEST: FAILED\n");
index 5cc4eb5828a9aaa51e1b8ba318ecdea61f43699b..9802bff2a5322d7dc62c39e5701eae22fe8f4970 100644 (file)
@@ -489,7 +489,7 @@ void *rte_gpu_mem_cpu_map(int16_t dev_id, size_t size, void *ptr);
  * @param dev_id
  *   Reference device ID.
  * @param ptr
- *   Pointer to the memory area to be unmapped.
+ *   Pointer to the GPU memory area to be unmapped.
  *   NULL is a no-op accepted value.
  *
  * @return