In this post, I’ll be discussing how I utilized the accelerators of the BlueField device, using doca_compress.

  • Understand the architecture
  • DOCA Core primitives
    • Device enumerations with doca_devinfo
  • Run sample applications
    • Regex offload sample
    • Compression sample: doca_compress

First, our program opens a device capable of supporting hardware compression engine. The device here means PF, VF, or SF in the BlueField device, and it is stored into struct doca_dev object.

Next, the compression context doca_compress is created, and the progress engine (PE) is also created. PE is DOCA’s async completion dispatcher. PE must be connected to the context because it is the one that fires callbacks when the hardware finishes the work.

Also, memory and buffers are managed. A doca_mmap is created, and doca_buf now points to the mmap’ed memory.

Finally, the task is submitted to the hardware work queue. The compression engine picks up the task from the queue and begins reading over DMA from the source buffer, compressing it, and writing over DMA to the destination buffer. All this process happens without CPU involvment.

While the hardware is working on the given task, our program polls the PE. The function doca_pe_progress checks the hardware completion queue for finished tasks. When the compression finishes, doca_pe_progress detects it and fires the registered callback.