From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Ariel Levkovich <lariel@mellanox.com>, netdev@vger.kernel.org
Cc: jiri@resnulli.us, jiri@mellanox.com, kuba@kernel.org,
xiyou.wangcong@gmail.com, ast@kernel.org, daniel@iogearbox.net
Subject: Re: [PATCH net-next v2 0/3] ] TC datapath hash api
Date: Sun, 5 Jul 2020 17:50:34 -0400 [thread overview]
Message-ID: <7c673079-043d-927b-fba2-e7a27d05f3e2@mojatatu.com> (raw)
In-Reply-To: <8ea64f66-8966-0f19-e329-1c0e5dc4d6d4@mellanox.com>
Hi Ariel,
On 2020-07-05 1:26 p.m., Ariel Levkovich wrote:
>
> On 7/3/20 7:22 AM, Jamal Hadi Salim wrote:
[..]
> Hi Jamal,
>
> I agree that using skbedit makes some sense and can provide the same
> functionality.
>
> However I believe that from a concept point of view, using it is wrong.
>
> In my honest opinion, the concept here is to perform some calculation on
> the packet itself and its headers while the skb->hash field
>
> is the storage location of the calculation result (in SW).
>
> Furthermore, looking forward to HW offload support, the HW devices will
> be offloading the hash calculation and
>
> not rewriting skb metadata fields. Therefore the action should be the
> hash, not skbedit.
>
> Another thing that I can mention, which is kind of related to what I
> wrote above, is that for all existing skbedit supported fields,
>
> user typically provides a desired value of his choosing to set to a skb
> metadata field.
>
> Here, the value is unknown and probably not a real concern to the user.
>
>
> To sum it up, I look at this as performing some operation on the packet
> rather then just
>
> setting an skb metadata field and therefore it requires an explicit, new
> action.
>
>
> What do you think?
skbedit is generally the action for any skb metadata modification
(of which hash is one).
Note: We already have skbedit offload for skbmark today.
The hash feature is useful for software as well (as your use case
showed). I agree with you that the majority of the cases are going to
be a computation of some form that results in dynamic skb->hash.
But the hash should be possible to be statically set by a policy.
BTW, nothing in skbedit is against computing what the new metadata
should be.
IMO: A good arguement to not make it part of skbedit is if it adds
unnecessary complexity to skbedit or policy definitions.
>
>>
>> 2) I think it would make sense to create a skb hash classifier
>> instead of tying this entirely to flower i.e i should not
>> have to change u32 just so i can support hash classification.
>> So policy would be something of the sort:
>>
>> $ tc filter add dev ens1f0_0 ingress \
>> prio 1 chain 0 proto ip \
>> flower ip_proto tcp \
>> action skbedit hash bpf object-file <file> \
>> action goto chain 2
>>
>> $ tc filter add dev ens1f0_0 ingress \
>> prio 1 chain 2 proto ip \
>> handle 0x0 skbhash flowid 1:11 mask 0xf \
>> action mirred egress redirect dev ens1f0_1
>>
>> $ tc filter add dev ens1f0_0 ingress \
>> prio 1 chain 2 proto ip \
>> handle 0x1 skbhash flowid 1:11 mask 0xf \
>> action mirred egress redirect dev ens1f0_2
>>
>> IOW, we maintain current modularity as opposed
>> to dumping everything into flower.
>> Ive always wanted to write the skbhash classifier but
>> time was scarce. At one point i had some experiment
>> where I would copy skb hash into mark in the driver
>> and use fw classifier for further processing.
>> It was ugly.
>
> I agree but perhaps we should make it a separate effort and not block
> this one.
>
> I still think we should have support via flower. This is the HW offload
> path eventually.
>
My main concern is modularity and the tc principle of doing small
things (and in principle doing them well).
Flower is becoming the sink for everything hardware
offload but f.e u32 also does h/w offload as well and we dont
want to limit it to just those two classifiers for the future...
Note: Flower is not very good performance-wise in the ingress in
s/ware. Something that is more specialized like the way skb mark fw
classifier is will be a lot more efficient. One good reason to make
hardware[1] do the hard work is to save the cyles in the host.
So to me adding to flower does not help that cause.
cheers,
jamal
[1] Whether the hash is set by RSS or an offloaded classifier or
shows up in some simple pkt header (IFE original patch had skb
hash being set in one machine and transported across machines
for use in a remote machine - that setup is in use in production).
cheers,
jamal
next prev parent reply other threads:[~2020-07-05 21:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-01 18:47 [PATCH net-next v2 0/3] ] TC datapath hash api Ariel Levkovich
2020-07-01 18:47 ` [PATCH net-next v2 1/3] net/sched: Introduce action hash Ariel Levkovich
2020-07-01 22:20 ` kernel test robot
2020-07-02 20:52 ` Cong Wang
2020-07-01 18:47 ` [PATCH net-next v2 2/3] net/flow_dissector: add packet hash dissection Ariel Levkovich
2020-07-01 18:47 ` [PATCH net-next v2 3/3] net/sched: cls_flower: Add hash info to flow classification Ariel Levkovich
2020-07-03 11:22 ` [PATCH net-next v2 0/3] ] TC datapath hash api Jamal Hadi Salim
2020-07-05 17:26 ` Ariel Levkovich
2020-07-05 21:50 ` Jamal Hadi Salim [this message]
2020-07-06 0:28 ` Cong Wang
2020-07-09 13:52 ` Ariel Levkovich
2020-07-06 0:23 ` Cong Wang
2020-07-07 10:05 ` Jiri Pirko
2020-07-08 13:54 ` Jamal Hadi Salim
2020-07-08 14:45 ` Jiri Pirko
2020-07-09 11:00 ` Jamal Hadi Salim
2020-07-09 12:19 ` Jiri Pirko
2020-07-10 12:04 ` Jamal Hadi Salim
2020-08-07 10:41 ` Jamal Hadi Salim
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=7c673079-043d-927b-fba2-e7a27d05f3e2@mojatatu.com \
--to=jhs@mojatatu.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=jiri@mellanox.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=lariel@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.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