On Fri, 6 Oct 2023 18:28:10 +0200 Morten Brørup <m...@smartsharesystems.com> wrote:
> > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > Sent: Friday, 6 October 2023 18.03 > > > > On Fri, 6 Oct 2023 12:03:46 +0200 > > Morten Brørup <m...@smartsharesystems.com> wrote: > > > > > 2. The "processing" thread receives its packets from the rte_ring. > > This thread should sleep until packets are ready for it in the rte_ring. > > > > > > The "ingress" thread knows when it puts packets into the rte_ring, so > > it can signal that event to the "processing" thread, to wake it up; > > either as an interrupt/signal, or through a file descriptor. Is this > > supported by rte_epoll (or other DPDK APIs), and how? > > > > When having to do this in applications, I used a eventfd() as well as > > the rte ring. > > The ingress write's to eventfd and the other thread used epoll on the > > fd. > > > > Optimized this by having the ingress thread only signal via write if > > ring was in empty state. > > And the reader thread only needs to do (epoll/read) if ring became empty > > during last cycle; > > i.e num packets from rte_ring_burst() was 0. > > > > Basically, when using epoll and other SW event models, you need to turn > > all data sources > > into file descriptors. > > This sounds exactly like what I am looking for. > > Are there DPDK APIs for eventfd(), so I can use them with rte_epoll_wait? Eventfd is just a system call. You then add the resulting fd to epoll object with rte_epoll_ctl().