Skip to content

A redundant call to doca_mmap_set_memrange() in create_mmap() from rdma_common.c in GPUNetIO sample code? #7

@ianz94

Description

@ianz94

Hi, in the code snippet below which is from samples/doca_gpunetio/rdma_common.c:

doca_error_t create_mmap(struct doca_gpu *gpu_dev, struct rdma_mmap_obj *mmap_obj)
{
...
...
	/* Map GPU memory buffer used to receive packets with DMABuf */
	result = doca_gpu_dmabuf_fd(gpu_dev, mmap_obj->memrange_addr, mmap_obj->memrange_len, &(dmabuf_fd));
	if (result != DOCA_SUCCESS) {
		/* If failed, use nvidia-peermem legacy method */
		result = doca_mmap_set_memrange(mmap_obj->mmap, mmap_obj->memrange_addr, mmap_obj->memrange_len);
        ....
	} else {
		result = doca_mmap_set_dmabuf_memrange(mmap_obj->mmap,
						       dmabuf_fd,
						       mmap_obj->memrange_addr,
						       0,
						       mmap_obj->memrange_len);
		....
	}

	result = doca_mmap_set_memrange(mmap_obj->mmap, mmap_obj->memrange_addr, mmap_obj->memrange_len);  <-------- Is this redundant?

Not sure if the second call to doca_mmap_set_memrange is redundant or necessary? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions