All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marius Gerling <mariusgerling@gmail.com>
To: Konrad Djimeli <kdjimeli@igalia.com>
Cc: xdp-newbies@vger.kernel.org
Subject: Re: AF_XDP socket (sock2)  unable to read, after writing with another AF_XDP socket (sock1)
Date: Thu, 1 Nov 2018 19:27:42 +0100	[thread overview]
Message-ID: <ABE87697-2B6F-4F4B-BE08-2CBD84A88408@gmail.com> (raw)
In-Reply-To: <ad85176a72e82878a4073a4215aa5e3a@igalia.com>

Hello Konrad,

some things to think of while using AF_XDP.

 - Received data is forwarded to an AF_XDP socket with the bps_redirect_map call in the kernel part. You are sending the data to the first AF_XDP socket all the time.
 - With AF_XDP one bypasses all the TCP/IP stack of the Linux kernel. This means that one needs to set the Ethernet, IP, UDP (or TCP) headers by themselves at the beginning of the packet. (I don’t exactly know if this is needed for the loopback adapter you are using)

You might want to have a look at other AF_XDP implementations. One is in my repo: https://github.com/gerl1ng/afxdp-packet-processor (folder server_afxdp). Some more information is given in the PDF in that repo.

Marius

> On 1. Nov 2018, at 17:52, Konrad Djimeli <kdjimeli@igalia.com> wrote:
> 
> Hello,
> 
> I am working on developing a Snabb Switch app which uses Af_XDP sockets
> and so far I have not found any AF_XDP sample example online, except for
> the sample in the Linux Kernel source. I have tried modifying the
> example, to create two sockets (sock1 and sock2) sharing a UMEM with
> custom write_sock and read_sock functions. But when I do a write with
> "sock1" I am unable to read the data with "sock2". Here is the code
> https://github.com/djkonro/afxdp/blob/master/xdpsock/xdpsock_user.c ,
> and I am new to working with AF_XDP sockets and I wish I could get some
> pointers to what may be wrong with the program. 
> 
> Thanks,
> Konrad
> www.djimeli.me

  reply	other threads:[~2018-11-02  3:37 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 [this message]
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
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=ABE87697-2B6F-4F4B-BE08-2CBD84A88408@gmail.com \
    --to=mariusgerling@gmail.com \
    --cc=kdjimeli@igalia.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.