[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200701184719.8421-1-lariel@mellanox.com>
Date: Wed, 1 Jul 2020 21:47:16 +0300
From: Ariel Levkovich <lariel@...lanox.com>
To: netdev@...r.kernel.org
Cc: jiri@...nulli.us, kuba@...nel.org, jhs@...atatu.com,
xiyou.wangcong@...il.com, ast@...nel.org, daniel@...earbox.net,
Ariel Levkovich <lariel@...lanox.com>
Subject: [PATCH net-next v2 0/3] ] TC datapath hash api
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
Powered by blists - more mailing lists