From: Jacob Keller <jacob.e.keller@intel.com>
To: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>, netdev@vger.kernel.org
Cc: Steen Hegelund <Steen.Hegelund@microchip.com>,
Lars Povlsen <lars.povlsen@microchip.com>,
Daniel Machon <daniel.machon@microchip.com>,
<UNGLinuxDriver@microchip.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v2] net: sparx5: flower: fix fragment flags handling
Date: Wed, 10 Apr 2024 15:20:15 -0700 [thread overview]
Message-ID: <22153526-f764-420e-84f1-851006c67e76@intel.com> (raw)
In-Reply-To: <20240410095224.6372-1-ast@fiberby.net>
On 4/10/2024 2:52 AM, Asbjørn Sloth Tønnesen wrote:
> I noticed that only 3 out of the 4 input bits were used,
> mt.key->flags & FLOW_DIS_IS_FRAGMENT was never checked.
>
> In order to avoid a complicated maze, I converted it to
> use a 16 byte mapping table.
>
> As shown in the table below the old heuristics doesn't
> always do the right thing, ie. when FLOW_DIS_IS_FRAGMENT=1/1
> then it used to only match follow-up fragment packets.
>
> Here are all the combinations, and their resulting new/old
> VCAP key/mask filter:
>
> /- FLOW_DIS_IS_FRAGMENT (key/mask)
> | /- FLOW_DIS_FIRST_FRAG (key/mask)
> | | /-- new VCAP fragment (key/mask)
> v v v v- old VCAP fragment (key/mask)
>
> 0/0 0/0 -/- -/- impossible (due to entry cond. on mask)
> 0/0 0/1 -/- 0/3 !! invalid (can't match non-fragment + follow-up frag)
> 0/0 1/0 -/- -/- impossible (key > mask)
> 0/0 1/1 1/3 1/3 first fragment
>
> 0/1 0/0 0/3 3/3 !! not fragmented
> 0/1 0/1 0/3 3/3 !! not fragmented (+ not first fragment)
> 0/1 1/0 -/- -/- impossible (key > mask)
> 0/1 1/1 -/- 1/3 !! invalid (non-fragment and first frag)
>
> 1/0 0/0 -/- -/- impossible (key > mask)
> 1/0 0/1 -/- -/- impossible (key > mask)
> 1/0 1/0 -/- -/- impossible (key > mask)
> 1/0 1/1 -/- -/- impossible (key > mask)
>
> 1/1 0/0 1/1 3/3 !! some fragment
> 1/1 0/1 3/3 3/3 follow-up fragment
> 1/1 1/0 -/- -/- impossible (key > mask)
> 1/1 1/1 1/3 1/3 first fragment
>
> In the datasheet the VCAP fragment values are documented as:
> 0 = no fragment
> 1 = initial fragment
> 2 = suspicious fragment
> 3 = valid follow-up fragment
>
> Result: 3 combinations match the old behavior,
> 3 combinations have been corrected,
> 2 combinations are now invalid, and fail,
> 8 combinations are impossible.
>
Appreciate the detailed analysis with the lookup table. This is a bit
more opaque but a maze of combinations would be even less readable and
maintainable.
Makes sense.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
next prev parent reply other threads:[~2024-04-10 22:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 9:52 Asbjørn Sloth Tønnesen
2024-04-10 22:20 ` Jacob Keller [this message]
2024-04-11 7:04 ` Daniel Machon
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=22153526-f764-420e-84f1-851006c67e76@intel.com \
--to=jacob.e.keller@intel.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=ast@fiberby.net \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=lars.povlsen@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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
all inboxes | Powered by JetHome®