All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Djimeli <kdjimeli@igalia.com>
To: William Tu <u9012063@gmail.com>
Cc: "Björn Töpel" <bjorn.topel@gmail.com>, Xdp <xdp-newbies@vger.kernel.org>
Subject: Re: AF_XDP socket (sock2) unable to read, after writing with another AF_XDP socket (sock1)
Date: Mon, 26 Nov 2018 17:03:31 +0100	[thread overview]
Message-ID: <f0f3bc68403cae4099d32db7156c8329@igalia.com> (raw)
In-Reply-To: <CALDO+SbRNLSYpwOG4TS_72E81rnsmYwmYfBKC8nTsJxHjQrLyg@mail.gmail.com>

On 2018-11-10 15:58, William Tu wrote:
> On Sat, Nov 10, 2018 at 6:31 AM Björn Töpel <bjorn.topel@gmail.com> wrote:
>>
>> Den tors 8 nov. 2018 kl 16:15 skrev Konrad Djimeli <kdjimeli@igalia.com>:
>> >
>> [...]
>> > > In terms of correctness:
>> > >
>> > > In 3. you pass the same UMEM indicies to the Tx ring (ids={0,
>> > > FRAME_SIZE, 2*FRAME_SIZE, ...}), as you have passed to the fill
>> > > ring. This is not correct. Userspace to track what ids are owned by
>> > > the user and by the kernel. Now, both the fill ring and Tx ring
>> > > contain the same id.
>> > Please I have been looking into this for some days now, but I have not
>> > been able to understand what you where referring to and how to fix it.
>> >
>>
>> Ok, let's talk about the basics, and hopefully it will clear up. The
>> indicies/ids into the UMEM are used to point out packet buffers.
>>
>> The Rx/Tx/Completion/Fill rings are used to pass ownership between the
>> kernel and the user application. E.g. if fill id X with data and pass
>> that to the kernel for transmission, the application has passed
>> ownership of buffer X to the kernel. The application cannot (well,
>> shouldn't) touch the buffer pointed out by X until the kernel is done
>> with the buffer -- in other words, when the buffer is passed back to
>> the application via the completion ring. Analogous, when you pass id Y
>> to the fill ring, Y is owned by the kernel. The application cannot
>> (again, shouldn't) touch the data pointed out by Y until ownership is
>> passed back to the application via the Rx ring.
>>
> 
> Hi Konrad,
> 
> I made a slide about using how the rx/tx/completion/fill ring works for OVS.
> Hope this is helpful for you.
> https://drive.google.com/open?id=1gM3lndS6WeS16QNk74L22UNx5D5wlS2o
> 
> Another thing for debugging is first to add a print in the XDP code,
> so making sure the packet is there at the XDP layer.
> https://github.com/williamtu/ovs-ebpf/blob/afxdp-array/bpf/xdp.h#L71
> 
> Then I usually prints the xsk stats
> https://github.com/williamtu/ovs-ebpf/blob/afxdp-array/lib/netdev-linux.c#L656
> So making sure I'm not mess up with these rings.
> 
> Regards,
> William

Hello William,

Thanks a lot. I have gone through the resources you provided, and they
have been 
very helpful, especially the document on how the rx/tx/completion/fill
ring works.

Thanks,
Konrad

  reply	other threads:[~2018-11-27  2:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 16:52 AF_XDP socket (sock2) unable to read, after writing with another AF_XDP socket (sock1) Konrad Djimeli
2018-11-01 18:27 ` Marius Gerling
2018-11-02 15:30   ` Konrad Djimeli
2018-11-01 18:49 ` Björn Töpel
2018-11-02 16:08   ` Konrad Djimeli
2018-11-03  8:38     ` Björn Töpel
2018-11-08 15:15   ` Konrad Djimeli
2018-11-10 14:31     ` Björn Töpel
2018-11-10 14:58       ` William Tu
2018-11-26 16:03         ` Konrad Djimeli [this message]
2018-11-26 16:04       ` Konrad Djimeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0f3bc68403cae4099d32db7156c8329@igalia.com \
    --to=kdjimeli@igalia.com \
    --cc=bjorn.topel@gmail.com \
    --cc=u9012063@gmail.com \
    --cc=xdp-newbies@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.