From: Ariel Levkovich <lariel@mellanox.com>
To: netdev@vger.kernel.org
Cc: jiri@resnulli.us, kuba@kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, ast@kernel.org, daniel@iogearbox.net,
Ariel Levkovich <lariel@mellanox.com>
Subject: [PATCH net-next v2 0/3] ] TC datapath hash api
Date: Wed, 1 Jul 2020 21:47:16 +0300 [thread overview]
Message-ID: <20200701184719.8421-1-lariel@mellanox.com> (raw)
Supporting datapath hash allows user to set up rules that provide
load balancing of traffic across multiple vports and for ECMP path
selection while keeping the number of rule at minimum.
Instead of matching on exact flow spec, which requires a rule per
flow, user can define rules based on hashing on the packet headers
and distribute the flows to different buckets. The number of rules
in this case will be constant and equal to the number of buckets.
The datapath hash functionality is achieved in two steps -
performing the hash action and then matching on the result, as
part of the packet's classification.
The api allows user to define a filter with a tc hash action
where the hash function can be standard asymetric hashing that Linux
offers or alternatively user can provide a bpf program that
performs hash calculation on a packet.
Usage is as follows:
$ tc filter add dev ens1f0_0 ingress \
prio 1 chain 0 proto ip \
flower ip_proto tcp \
action hash bpf object-file <file> \
action goto chain 2
$ tc filter add dev ens1f0_0 ingress \
prio 1 chain 0 proto ip \
flower ip_proto udp \
action hash bpf asym_l4 basis <basis> \
action goto chain 2
$ tc filter add dev ens1f0_0 ingress \
prio 1 chain 2 proto ip \
flower hash 0x0/0xf \
action mirred egress redirect dev ens1f0_1
$ tc filter add dev ens1f0_0 ingress \
prio 1 chain 2 proto ip \
flower hash 0x1/0xf \
action mirred egress redirect dev ens1f0_2
Ariel Levkovich (3):
net/sched: Introduce action hash
net/flow_dissector: add packet hash dissection
net/sched: cls_flower: Add hash info to flow classification
include/linux/skbuff.h | 4 +
include/net/act_api.h | 2 +
include/net/flow_dissector.h | 9 +
include/net/tc_act/tc_hash.h | 22 ++
include/uapi/linux/pkt_cls.h | 4 +
include/uapi/linux/tc_act/tc_hash.h | 32 +++
net/core/flow_dissector.c | 17 ++
net/sched/Kconfig | 11 +
net/sched/Makefile | 1 +
net/sched/act_hash.c | 389 ++++++++++++++++++++++++++++
net/sched/cls_api.c | 1 +
net/sched/cls_flower.c | 16 ++
12 files changed, 508 insertions(+)
create mode 100644 include/net/tc_act/tc_hash.h
create mode 100644 include/uapi/linux/tc_act/tc_hash.h
create mode 100644 net/sched/act_hash.c
--
2.25.2
next reply other threads:[~2020-07-01 18:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-01 18:47 Ariel Levkovich [this message]
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
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=20200701184719.8421-1-lariel@mellanox.com \
--to=lariel@mellanox.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--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