network-programming

Sending data with PACKET_MMAP and PACKET_TX_RING is slower than “normal” (without)

戏子无情 提交于 2020-11-30 06:19:31
问题 I’m writing a traffic generator in C using the PACKET_MMAP socket option to create a ring buffer to send data over a raw socket. The ring buffer is filled with Ethernet frames to send and sendto is called. The entire contents of the ring buffer is sent over the socket which should give higher performance than having a buffer in memory and calling sendto repeatedly for every frame in the buffer that needs sending. When not using PACKET_MMAP, upon calling sendto a single frame is copied from