Multi Channel DMA Intel® FPGA IP for PCI Express User Guide

ID 683821
Date 10/29/2021
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

8.3.2. libmcmem Library Information

libmcmem library manages the DMA memory used by the application. It uses hugepages to provide application with required DMA memory.

ifc_env_init:

  • Function description: Allocate & Initialize hugepages
  • Prototype: int ifc_env_init(char *bdf, size_t payload)
  • Return values: Returns 0 if successful, negative otherwise

ifc_env_exit

  • Function description: Free hugepages
  • Prototype: void ifc_env_exit(void)

ifc_dma_alloc:

  • Function description: Allocate buffer for I/O request
  • Prototype: struct ifc_mem_struct *ifc_dma_alloc(void)
  • Return values: pointer to ifc_mem_struct on success. NULL in case of fails

ifc_dma_free

  • Function description: Free buffer
  • Prototype: void ifc_dma_free(struct ifc_mem_struct *r)

ifc_allocated_chunks

  • Function description: Get total number of DMA buffer chunks allocated
  • Prototype: int ifc_allocated_chunks(void)

libmcmem uses ifc_mem_struct as shown below to pass the DMA buffer to the application.

ifc_mem_struct

Table 115.  Strucutre Description
Structure DMA buffer structure
void *virt_addr Virtual address of the buffer
uint64_t phy_addr Physical address of the buffer
size_t len Length of the buffer
int ctx For library, not for application

You can configure the number of huge pages that the library should use using the following NUM_HUGE_PAGES macro in software/user/common/include/ifc_libmcmem.h