Skip to content

Commit 77b9900

Browse files
jpirkodavem330
authored andcommitted
tc: introduce Flower classifier
This patch introduces a flow-based filter. So far, the very essential packet fields are supported. This patch is only the first step. There is a lot of potential performance improvements possible to implement. Also a lot of features are missing now. They will be addressed in follow-up patches. Signed-off-by: Jiri Pirko <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 59346af commit 77b9900

File tree

4 files changed

+729
-0
lines changed

4 files changed

+729
-0
lines changed

include/uapi/linux/pkt_cls.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,36 @@ enum {
409409

410410
#define TCA_BPF_MAX (__TCA_BPF_MAX - 1)
411411

412+
/* Flower classifier */
413+
414+
enum {
415+
TCA_FLOWER_UNSPEC,
416+
TCA_FLOWER_CLASSID,
417+
TCA_FLOWER_INDEV,
418+
TCA_FLOWER_ACT,
419+
TCA_FLOWER_KEY_ETH_DST, /* ETH_ALEN */
420+
TCA_FLOWER_KEY_ETH_DST_MASK, /* ETH_ALEN */
421+
TCA_FLOWER_KEY_ETH_SRC, /* ETH_ALEN */
422+
TCA_FLOWER_KEY_ETH_SRC_MASK, /* ETH_ALEN */
423+
TCA_FLOWER_KEY_ETH_TYPE, /* be16 */
424+
TCA_FLOWER_KEY_IP_PROTO, /* u8 */
425+
TCA_FLOWER_KEY_IPV4_SRC, /* be32 */
426+
TCA_FLOWER_KEY_IPV4_SRC_MASK, /* be32 */
427+
TCA_FLOWER_KEY_IPV4_DST, /* be32 */
428+
TCA_FLOWER_KEY_IPV4_DST_MASK, /* be32 */
429+
TCA_FLOWER_KEY_IPV6_SRC, /* struct in6_addr */
430+
TCA_FLOWER_KEY_IPV6_SRC_MASK, /* struct in6_addr */
431+
TCA_FLOWER_KEY_IPV6_DST, /* struct in6_addr */
432+
TCA_FLOWER_KEY_IPV6_DST_MASK, /* struct in6_addr */
433+
TCA_FLOWER_KEY_TCP_SRC, /* be16 */
434+
TCA_FLOWER_KEY_TCP_DST, /* be16 */
435+
TCA_FLOWER_KEY_UDP_SRC, /* be16 */
436+
TCA_FLOWER_KEY_UDP_DST, /* be16 */
437+
__TCA_FLOWER_MAX,
438+
};
439+
440+
#define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
441+
412442
/* Extended Matches */
413443

414444
struct tcf_ematch_tree_hdr {

net/sched/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,16 @@ config NET_CLS_BPF
477477
To compile this code as a module, choose M here: the module will
478478
be called cls_bpf.
479479

480+
config NET_CLS_FLOWER
481+
tristate "Flower classifier"
482+
select NET_CLS
483+
---help---
484+
If you say Y here, you will be able to classify packets based on
485+
a configurable combination of packet keys and masks.
486+
487+
To compile this code as a module, choose M here: the module will
488+
be called cls_flower.
489+
480490
config NET_EMATCH
481491
bool "Extended Matches"
482492
select NET_CLS

net/sched/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ obj-$(CONFIG_NET_CLS_BASIC) += cls_basic.o
5656
obj-$(CONFIG_NET_CLS_FLOW) += cls_flow.o
5757
obj-$(CONFIG_NET_CLS_CGROUP) += cls_cgroup.o
5858
obj-$(CONFIG_NET_CLS_BPF) += cls_bpf.o
59+
obj-$(CONFIG_NET_CLS_FLOWER) += cls_flower.o
5960
obj-$(CONFIG_NET_EMATCH) += ematch.o
6061
obj-$(CONFIG_NET_EMATCH_CMP) += em_cmp.o
6162
obj-$(CONFIG_NET_EMATCH_NBYTE) += em_nbyte.o

0 commit comments

Comments
 (0)