0

I'm using DPDK. It provides a function to send packets: rte_eth_tx_burst. But this fuction only puts packets in the send queue of a Ethernet Device,and the Ethernet Device then waits for more packets, then send them in a bunch.

Is there a way where I can put a packet in the Ethernet Device send queue, and make it send the packet immediately?

2 Answers2

2

Usually rte_eth_tx_burst() not only puts packets into the TX queue, but also notifies the NIC to start the transmission. Sure, it depends on PMD and the device, but it's rather uncommon for device to wait for some more packets.

For example, for e1000 PMD (which supports a whole family of NICs), the rte_eth_tx_burst() ends down in the eth_igb_xmit_pkts(). At the very bottom of this function there is signal to NIC:

    /*
     * Set the Transmit Descriptor Tail (TDT).
     */
    E1000_PCI_REG_WRITE_RELAXED(txq->tdt_reg_addr, tx_id);

Basically, it's a write to the device register, updating the tail of the queue and making the NIC to (wake up and) start the transmission. Thanks to DMA, NIC has direct access in RAM to the TX queue and the buffers to transmit, so the transmission will be (eventually) done by NIC without blocking the CPU.

Andriy Berestovskyy
  • 8,059
  • 3
  • 17
  • 33
1

rte_eth_tx_burst will actually send the packets as soon as possible. The ethernet device doesn't wait for more packets. The 'burst' part is to free up CPU resources, not NIC resources, and it puts all packet descriptors in the queue immediately. If the transmit queue is empty (and since DPDK takes over your port, it should be) then packets should be sent immediately.

If you want to read up how data transfer between memory and the NIC works, here's a good summary.

If you'd like for some reason to process packets one-by-one, you can just use 1 as the burst size.

AdamTL
  • 170
  • 11