All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amritha Nambiar <amritha.nambiar@intel.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: alexander.h.duyck@intel.com, jakub.kicinski@netronome.com,
	amritha.nambiar@intel.com, sridhar.samudrala@intel.com,
	jhs@mojatatu.com, jesse.brandeburg@intel.com, jiri@resnulli.us,
	xiyou.wangcong@gmail.com
Subject: [net-next,RFC PATCH] Introduce TC Range classifier
Date: Thu, 13 Sep 2018 13:52:01 -0700	[thread overview]
Message-ID: <153687160312.43503.11156697286063840163.stgit@anamhost.jf.intel.com> (raw)

This patch introduces a TC range classifier to support filtering based
on ranges. Only port-range filters are supported currently. This can
be combined with flower classifier to support filters that are a
combination of port-ranges and other parameters based on existing
fields supported by cls_flower. The 'goto chain' action can be used to
combine the flower and range filter.
The filter precedence is decided based on the 'prio' value.

Example:
1. Match on a port range:
-----------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 range\
ip_proto tcp dst_port 1-15 skip_hw action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 range chain 0
filter protocol ip pref 2 range chain 0 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  skip_hw
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1 installed 34 sec used 2 sec
        Action statistics:
        Sent 1380 bytes 30 pkt (dropped 30, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

2. Match on IP address and port range:
--------------------------------------
$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 flower\
  dst_ip 192.168.1.1 skip_hw action goto chain 11

$ tc filter add dev enp4s0 protocol ip parent ffff: prio 2 chain 11\
  range ip_proto tcp dst_port 1-15 action drop

$ tc -s filter show dev enp4s0 parent ffff:
filter protocol ip pref 2 flower chain 0
filter protocol ip pref 2 flower chain 0 handle 0x1
  eth_type ipv4
  dst_ip 192.168.1.1
  skip_hw
  not_in_hw
        action order 1: gact action goto chain 11
         random type none pass val 0
         index 1 ref 1 bind 1 installed 1426 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 0, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0

filter protocol ip pref 2 range chain 11
filter protocol ip pref 2 range chain 11 handle 0x1
  eth_type ipv4
  ip_proto tcp
  dst_port_min 1
  dst_port_max 15
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 2 ref 1 bind 1 installed 1310 sec used 2 sec
        Action statistics:
        Sent 460 bytes 10 pkt (dropped 10, overlimits 0 requeues 0)
        backlog 0b 0p requeues 0
---

Amritha Nambiar (1):
      net: sched: cls_range: Introduce Range classifier


 include/uapi/linux/pkt_cls.h |   19 +
 net/sched/Kconfig            |   10 +
 net/sched/Makefile           |    1 
 net/sched/cls_range.c        |  725 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 755 insertions(+)
 create mode 100644 net/sched/cls_range.c

             reply	other threads:[~2018-09-14  7:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 20:52 Amritha Nambiar [this message]
2018-09-13 20:52 ` [net-next, RFC PATCH] net: sched: cls_range: Introduce Range classifier Amritha Nambiar
2018-09-14  9:58   ` Jiri Pirko
2018-09-15  1:31     ` Nambiar, Amritha
2018-09-14 21:06   ` Cong Wang
2018-09-14  9:49 ` [net-next,RFC PATCH] Introduce TC " Jiri Pirko
2018-09-14 21:09   ` Cong Wang
2018-09-15  1:29     ` Nambiar, Amritha

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=153687160312.43503.11156697286063840163.stgit@anamhost.jf.intel.com \
    --to=amritha.nambiar@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.