public inbox for xdp-newbies@vger.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Lorenzo Mainardi <lormayna@gmail.com>, xdp-newbies@vger.kernel.org
Subject: Re: Newbie help
Date: Sun, 12 Dec 2021 17:47:23 +0100	[thread overview]
Message-ID: <87h7bdhisk.fsf@toke.dk> (raw)
In-Reply-To: <CACLEbghzZw=cxAZGxU4fYqfUeojw1yt9RF0cHBiDOux0K0=LaQ@mail.gmail.com>

Lorenzo Mainardi <lormayna@gmail.com> writes:

> Hello everyone,
> I am trying to follow this tutorial
> (https://developers.redhat.com/blog/2021/04/01/get-started-with-xdp)
> to learn XDP.
>
> So I compiled my XDP program and then attached it to an interface:
>
> lorenzo@kwaremont:~/progetti/xdp_test$ ip addr show eno1
> 2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500
> xdpgeneric/id:37 qdisc pfifo_fast state DOWN group default qlen 1000
>     link/ether 8c:dc:d4:8e:38:c7 brd ff:ff:ff:ff:ff:ff
>     altname enp9s0
>     inet 10.0.8.1/24 scope global eno1
>        valid_lft forever preferred_lft forever
> lorenzo@kwaremont:~/progetti/xdp_test$ ping 10.0.8.1
> PING 10.0.8.1 (10.0.8.1) 56(84) bytes of data.
> 64 bytes from 10.0.8.1: icmp_seq=1 ttl=64 time=0.047 ms
> 64 bytes from 10.0.8.1: icmp_seq=2 ttl=64 time=0.033 ms
> ^C
> --- 10.0.8.1 ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 1018ms
> rtt min/avg/max/mdev = 0.033/0.040/0.047/0.007 ms
>
> Anyway, it seems that the program is not dropping packets. Is there
> any way to troubleshoot it? Where am I wrong?

Erm, you're pinging the interface from within the machine itself? That
will never hit the XDP hook of the interface, those packets just go over
loopback.

XDP processes packets on ingress, when they arrive *on that interface*.
So you'll have to try the ping from outside the machine itself (although
from the NO-CARRIER flag on the interface it looks like it's not
actually connected to anything?).

For testing, it can be useful to use virtual Ethernet (veth) devices;
they have full support for XDP. The XDP tutorial will help you get setup
to use those: https://github.com/xdp-project/xdp-tutorial

-Toke


      reply	other threads:[~2021-12-12 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 15:06 Newbie help Lorenzo Mainardi
2021-12-12 16:47 ` Toke Høiland-Jørgensen [this message]

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=87h7bdhisk.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=lormayna@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox