Re: xdpgeneric, XDP_PASS, and bpf_xdp_adjust_head decapsulation dropping packets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 1 Aug 2019 17:33:36 +0000
Brandon Cazander <brandon.cazander@xxxxxxxxxxxxxxx> 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



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux