All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Brandon Cazander <brandon.cazander@multapplied.net>
Cc: "xdp-newbies@vger.kernel.org" <xdp-newbies@vger.kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	David Miller <davem@davemloft.net>,
	brouer@redhat.com
Subject: Re: xdpgeneric, XDP_PASS, and bpf_xdp_adjust_head decapsulation dropping packets
Date: Thu, 1 Aug 2019 20:16:16 +0200	[thread overview]
Message-ID: <20190801201612.3aef7783@carbon> (raw)
In-Reply-To: <20190801173324.GA660183@multapplied.net>

On Thu, 1 Aug 2019 17:33:36 +0000
Brandon Cazander <brandon.cazander@multapplied.net> wrote:

> Thank you very much for your prompt and detailed review of my report!
> Some of these answers may be moot now that you have found the specific
> commit that caused the issue.

True.
 
> On Thu, Aug 01, 2019 at 10:18:49AM +0200, Jesper Dangaard Brouer wrote:
> 
> > Are you sure you are using "xdpgeneric" mode?
> > As virtio_net do have "native" XDP mode.  
> 
> The program is loaded with XDP_FLAGS_SKB_MODE in this case. I'm having a
> separate issue with "native" XDP on virtio_net that I'm working on but
> it is more likely an issue with my code.
> 
> > Encapsulated packet starts at a funny offset, making it harder to follow.  
> 
> Sorry about that. I should have made it easier.

No problem.

> > Looking at the code, I think the packet will be dropped earlier than
> > the pskb_trim_rcsum() call, in the check if (skb->len < len).  
> 
> I had the same suspicion but a probe in the corresponding drop showed no
> results, and furthermore, the InTruncatedPkts SNMP counter was not
> increasing.

Strange.

> > You only support IPv4 encapsulated packets?
> > 
> > Do you handle ARP requests separately?  
> 
> Sorry, I wanted a minimal example so this is stripped down.

I figured, that you already handled that.
 
> > Can you test an earlier kernel, specifically before: commit
> > 458bf2f224f0 ("net: core: support XDP generic on stacked devices.")
> > (Author: Stephen Hemminger)
> > 
> > $ git describe --contains  458bf2f224f04
> > v5.2-rc3~26^2~11^2
> > 
> > I fear that this commit, which moved generic-XDP to a later call point,
> > might cause this.  Because it could be that the SKB network_header
> > update, is now done before calling XDP program (... still looking at
> > code details).  
> 
> You have already confirmed this but I can also confirm that a kernel
> before commit 458bf2f224f0 works with no changes to my program.

Thanks for also confirming. I've just send a patchset with fixes:
 https://patchwork.ozlabs.org/project/netdev/list/?series=122796&state=%2a

I can recommend that you look at the selftest script test_xdp_vlan.sh:
 https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/test_xdp_vlan.sh

Which uses veth and network namespaces for testing.  If you get the
hint, then you can actually create these small scripts, that can
function as unit and regression tests for XDP code snippets.

Our XDP-tutorial also uses veth as a development environment:
 https://github.com/xdp-project/xdp-tutorial/tree/master/testenv
-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  reply	other threads:[~2019-08-01 18:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-31 21:12 xdpgeneric, XDP_PASS, and bpf_xdp_adjust_head decapsulation dropping packets Brandon Cazander
2019-08-01  8:18 ` Jesper Dangaard Brouer
2019-08-01 14:54   ` Jesper Dangaard Brouer
2019-08-01 16:05     ` Jesper Dangaard Brouer
2019-08-01 17:33   ` Brandon Cazander
2019-08-01 18:16     ` Jesper Dangaard Brouer [this message]
2019-08-01 18:53       ` Brandon Cazander
2019-08-01 18:00 ` [net v1 PATCH 0/4] net: fix regressions for generic-XDP Jesper Dangaard Brouer
2019-08-01 18:00   ` [net v1 PATCH 1/4] bpf: fix XDP vlan selftests test_xdp_vlan.sh Jesper Dangaard Brouer
2019-08-01 18:00   ` [net v1 PATCH 2/4] selftests/bpf: add wrapper scripts for test_xdp_vlan.sh Jesper Dangaard Brouer
2019-08-01 18:00   ` [net v1 PATCH 3/4] selftests/bpf: reduce time to execute test_xdp_vlan.sh Jesper Dangaard Brouer
2019-08-01 18:00   ` [net v1 PATCH 4/4] net: fix bpf_xdp_adjust_head regression for generic-XDP Jesper Dangaard Brouer
2019-08-02  0:44     ` Jakub Kicinski
2019-08-02  7:53       ` Jesper Dangaard Brouer
2019-08-02 17:08         ` Jakub Kicinski
2019-08-05 18:19   ` [net v1 PATCH 0/4] net: fix regressions " David Miller

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=20190801201612.3aef7783@carbon \
    --to=brouer@redhat.com \
    --cc=brandon.cazander@multapplied.net \
    --cc=davem@davemloft.net \
    --cc=stephen@networkplumber.org \
    --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.