All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC net-next 0/9] TC filter HW offloads
@ 2016-02-01  8:34 Amir Vadai
  2016-02-01  8:34 ` [RFC net-next 1/9] net/flow_dissector: Make dissector_uses_key() and skb_flow_dissector_target() public Amir Vadai
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: Amir Vadai @ 2016-02-01  8:34 UTC (permalink / raw)
  To: David S. Miller, netdev, John Fastabend
  Cc: Or Gerlitz, Hadar Har-Zion, Jiri Pirko, Jamal Hadi Salim, Amir Vadai

Hi,

So... just before sending that, I noted Jonh's series that
deals with tc and u32. One notable difference between the 
two approaches is that here we "normalize" the upper layer
way of describing matching and actions into a generic structure
(flow dissector, etc), which should allow to use offload different
potential consumer tools (TC flower, TC u32 subset), netfilter, etc).
Another difference is with this series uses the switchdev
framework which would allow using the proposed HW offloading
mechanisms for physical and SRIOV embedded switches too that
make use of switchdev.

This patchset introduces an infrastructure to offload matching of flows and
some basic actions to hardware, currenrtly using iproute2 / tc tool.

In this patchset, the classification is described using the flower filter, and
the supported actions are drop (using gact) and mark (using skbedit).

Flow classifcation is described using a flow dissector that is built by 
the tc filter. The filter also calls the actions to be serialized into the new
structure - switchdev_obj_port_flow_act.

The flow dissector and the serialized actions are passed using switchdev ops to
the HW driver, which parse it to hardware commands. We propose to use the
kernel flow-dissector to describe flows/ACLs in the switchdev framework which
by itself could be also used for HW offloading of other kernel networking
components.

An implementation for the above is provided using mlx5 driver and Mellanox 
ConnectX4 HW.

Some issues that will be addressed before making the final submission:
1. 'offload' should be a generic filter attribute and not flower filter
   specific.
2. Serialization of actions will be changed into a list instead of one big
   structure to describe all actions.

Few more matters to discuss 

1. Should HW offloading be done only under explicit admin directive?

2. switchdev is used today for physical switch HW and on an upcoming proposal
for SRIOV e-switch vport representors too. Here, we're doing that with a NIC, 
that can potentially serve as an uplink port for v-switch (e.g under Para-Virtual 
scheme).

Sample usage of the feature:

export TC=../iproute2/tc/tc
export ETH=ens9

ifconfig ens9 11.11.11.11/24 up

# add an ingress qdisc
$TC qdisc add dev $ETH ingress

# Drop ICMP (ip_proto 1) packets
$TC filter add dev $ETH protocol ip prio 20 parent ffff: \
                flower eth_type ip ip_proto 1 \
                indev $ETH offload \
                action drop

# Mark (with 0x1234) TCP (ip_proto 6) packets
$TC filter add dev $ETH protocol ip prio 30 parent ffff: \
                flower eth_type ip ip_proto 6 \
                indev $ETH offload \
                action skbedit mark 0x1234

# A NOP filter for packets that are marked (0x1234)
$TC filter add dev $ETH protocol ip prio 10 parent ffff: \
                handle 0x1234 fw action pass

# See that pings are blocked
# See that ssh is working (=TCP traffic)

# See NOP filter counters. If >0, HW marked and NOP filter catched it
$TC -s filter show dev $ETH parent ffff:

This patchset depends on a small fix [1] that is currently under review in the
mailing list.  It was applied and tested on net-next commit 7a26019
("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net")

[1] Depends on "net/mlx5_core: Set flow steering dest only for forward rules"
    - http://patchwork.ozlabs.org/patch/574055/   

Thanks,
Amir

Amir Vadai (9):
  net/flow_dissector: Make dissector_uses_key() and
    skb_flow_dissector_target() public
  net/switchdev: Introduce hardware offload support
  net/act: Offload support by tc actions
  net/act_skbedit: Introduce hardware offload support
  net/act_gact: Introduce hardware offload support for drop
  net/cls_flower: Introduce hardware offloading
  net/mlx5_core: Go to next flow table support
  net/mlx5e: Introduce MLX5_FLOW_NAMESPACE_OFFLOADS
  net/mlx5e: Flow steering support through switchdev

 drivers/net/ethernet/mellanox/mlx5/core/Kconfig    |   7 +
 drivers/net/ethernet/mellanox/mlx5/core/Makefile   |   3 +
 drivers/net/ethernet/mellanox/mlx5/core/en.h       |  10 +
 drivers/net/ethernet/mellanox/mlx5/core/en_fs.c    |  10 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |   2 +
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |   2 +
 .../net/ethernet/mellanox/mlx5/core/en_switchdev.c | 475 +++++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/en_switchdev.h |  60 +++
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c  |  26 ++
 include/linux/mlx5/fs.h                            |   1 +
 include/net/act_api.h                              |   3 +
 include/net/flow_dissector.h                       |  13 +
 include/net/pkt_cls.h                              |   2 +
 include/net/switchdev.h                            |  46 ++
 include/uapi/linux/pkt_cls.h                       |   1 +
 net/core/flow_dissector.c                          |  13 -
 net/sched/act_gact.c                               |  17 +
 net/sched/act_skbedit.c                            |  18 +
 net/sched/cls_api.c                                |  27 ++
 net/sched/cls_flower.c                             |  54 ++-
 net/switchdev/switchdev.c                          |  33 ++
 21 files changed, 807 insertions(+), 16 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_switchdev.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en_switchdev.h

-- 
2.7.0

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-02-01 21:45 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01  8:34 [RFC net-next 0/9] TC filter HW offloads Amir Vadai
2016-02-01  8:34 ` [RFC net-next 1/9] net/flow_dissector: Make dissector_uses_key() and skb_flow_dissector_target() public Amir Vadai
2016-02-01  8:34 ` [RFC net-next 2/9] net/switchdev: Introduce hardware offload support Amir Vadai
2016-02-01  9:06   ` Jiri Pirko
2016-02-01  9:11     ` amirva
2016-02-01  9:26   ` John Fastabend
2016-02-01  8:34 ` [RFC net-next 3/9] net/act: Offload support by tc actions Amir Vadai
2016-02-01  8:34 ` [RFC net-next 4/9] net/act_skbedit: Introduce hardware offload support Amir Vadai
2016-02-01  8:34 ` [RFC net-next 5/9] net/act_gact: Introduce hardware offload support for drop Amir Vadai
2016-02-01  8:34 ` [RFC net-next 6/9] net/cls_flower: Introduce hardware offloading Amir Vadai
2016-02-01  9:31   ` John Fastabend
2016-02-01  9:47     ` John Fastabend
2016-02-01 10:43     ` Amir Vadai
2016-02-01 21:25       ` John Fastabend
2016-02-01  8:34 ` [RFC net-next 7/9] net/mlx5_core: Go to next flow table support Amir Vadai
2016-02-01  8:34 ` [RFC net-next 8/9] net/mlx5e: Introduce MLX5_FLOW_NAMESPACE_OFFLOADS Amir Vadai
2016-02-01  8:34 ` [RFC net-next 9/9] net/mlx5e: Flow steering support through switchdev Amir Vadai
2016-02-01 18:52   ` Saeed Mahameed
2016-02-01 21:45     ` Or Gerlitz
2016-02-01  9:21 ` [RFC net-next 0/9] TC filter HW offloads John Fastabend
2016-02-01 14:37   ` Amir Vadai
2016-02-01 19:59     ` Tom Herbert
2016-02-01 20:14     ` John Fastabend

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.