Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: ѽ҉ᶬḳ℠ <vtol@gmx.net>
Cc: "netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: [nftables 0.9.2 | flow table] check whether it works?
Date: Thu, 26 Mar 2020 11:22:50 +0100	[thread overview]
Message-ID: <20200326102250.ccefwkbojzesmz24@salvia> (raw)
In-Reply-To: <a549d215-7aa6-bc66-d004-a3b504bf2e17@gmx.net>

On Thu, Mar 26, 2020 at 07:17:12AM +0000, ѽ҉ᶬḳ℠ wrote:
> On 22/03/2020 14:18, ѽ҉ᶬḳ℠ wrote:
> > How it is possible to check whether flowtable offloading actually works?
> > 
> > Can the populated flowtables somehow be dumped / observed / monitored?
> > 
> > If not mistaken the conntrack table would exhibit the [OFFLOAD] label
> > but observing the conntack table it does not show such label.
> > 
> > Reading https://lwn.net/Articles/738214/:
> > 
> > > Patch 5/5 Switches and NICs come with built-in flow table, I've been
> > >    observing out of tree patches in OpenWRT/LEDE to integrate this into
> > >    Netfilter for a little while. This patch adds the ndo hooks to
> > >    populate hardware flow table.
> > 
> > This node running OpenWrt with Marvell Armada 385 88F6820 (that
> > supposedly features Accelerated Data Path) with integrated NIC plus an
> > onboard Marvell 88E6176 switch, latter driven by DSA, I am wondering
> > whether flowtables offloading is even expected to work in such setup?
> > 
> 
> There is no way to see/check whether flowtable offloading actually
> works, or how to debug it?

As of Linux kernel 5.5, there are two ways:

* Check if [OFFLOAD] flag is shown, e.g.

# conntrack -L
tcp      6 src=192.168.10.2 dst=10.0.1.2 sport=47046 dport=5201 src=10.0.1.2 dst=10.0.1.1 sport=5201 dport=47046 [OFFLOAD] mark=0 secctx=null use=2
tcp      6 src=192.168.10.2 dst=10.0.1.2 sport=47044 dport=5201 src=10.0.1.2 dst=10.0.1.1 sport=5201 dport=47044 [OFFLOAD] mark=0 secctx=null use=2
conntrack v1.4.5 (conntrack-tools): 2 flow entries have been shown.

(you need current conntrack-tools git snapshot, this will be available
starting conntrack-tools >= 1.4.6).

* You can add a

table ip filter {
    flowtable f {
        hook ingress priority filter
        devices = { eth0, eth1 }
    }

    chain forward {
        type filter hook forward priority filter; policy accept;
        ip protocol tcp flow add @f counter log prefix "offload: " accept
        counter
    }
}

You can either turn on logging after the 'flow add @f' statement for
matching packets that correspond to flows that are being offloaded.

If the flow is offloaded, the counter catch-all rule at the end of
forward should not be updated, as the packets will not follow the
classic forwarding path [1].

I'm also preparing a patchset to allow to turn on counters optionally,
so users observe that flows that have the [OFFLOAD] tag get their
counters updated.

[1] https://www.kernel.org/doc/Documentation/networking/nf_flowtable.txt

  reply	other threads:[~2020-03-26 10:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 14:18 [nftables 0.9.2 | flow table] check whether it works? ѽ҉ᶬḳ℠
2020-03-26  7:17 ` ѽ҉ᶬḳ℠
2020-03-26 10:22   ` Pablo Neira Ayuso [this message]
2020-03-26 10:41     ` ѽ҉ᶬḳ℠
2020-03-26 11:29       ` Pablo Neira Ayuso

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=20200326102250.ccefwkbojzesmz24@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter@vger.kernel.org \
    --cc=vtol@gmx.net \
    /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