Subject: Re: Single socket with TX_RING and RX_RING

From: Daniel Borkmann <[email-masked]>
Date: Wed, 15 May 2013 15:20:45 +0200

On 05/15/2013 02:53 PM, Ricardo Tubío wrote:
> Once I tell kernel to export the TX_RING through setsockopt() (see code
> below) I always get an error (EBUSY) if i try to tell kernel to export the
> RX_RING with the same socket descriptor. Therefore, I have to open an
> additional socket for the RX_RING and I require of two sockets when I though
> that I would only require of one socket for both TX and RX using mmap()ed
> memory.
>
> Do I need both sockets or am I doing something wrong?

The second time you call init_ring() in your code e.g. with TX_RING, where
you have previously set it up for the RX_RING. The kernel will give you
-EBUSY because the packet socket is already mmap(2)'ed.