How to perform zero-copy TX using DPDK MLX5 poll mode driver?

Hi, I am working on a low-latency datacenter network transport on top of unreliable packet I/O drivers. Could someone help me understand how to send a packet using mlx5 pmd without first copying the payload data into DPDK rte_mbuf? I used to program against the Infiniband Verbs API and performing a zero-copy TX is as simple as 1) registering memory region with ibv_reg_mr, 2) filling out an ibv_sge struct with virtual address of the payload data, and 3) ibv_post_send. I have googled around and found some recent work on supporting external buffer in DPDK: e.g. https://www.dpdk.org/wp-content/uploads/sites/35/2018/10/am-06-External-buffer-slides.pdf & https://www.dpdk.org/wp-content/uploads/sites/35/2018/12/Yongseok_Koh_Embracing_Externally_Allocated_Memory.pdf. However, I am still very confused about how to use the APIs. For example, method rte_pktmbuf_attach_extbuf requires me to supply the IO address (i.e. physical address) of the payload (in addition to the virtual address) and I am not sure how to obtain/manage such info. In my understanding, Mellanox NICs can manage the address translation in HW so I shouldn’t have to do any of these by myself, right? Thank you!

Hi,

To give the io address of the buffer, you can use rte_mempool_virt2iova to convert the virtual address to the physical address of your external buffer.

You can find some info on unit testing here:

http://inbox.dpdk.org/dev/20190603083936.my6rdbsmbj2dtazk@platinum/

Br,

Marc