netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, nhorman@tuxdriver.com,
	jhs@mojatatu.com, xiyou.wangcong@gmail.com, idosch@mellanox.com,
	mlxsw@mellanox.com
Subject: [patch net-next v2 00/10] mlxsw: Implement ACL-dropped packets identification
Date: Tue, 25 Feb 2020 11:45:17 +0100	[thread overview]
Message-ID: <20200225104527.2849-1-jiri@resnulli.us> (raw)

From: Jiri Pirko <jiri@mellanox.com>

mlxsw hardware allows to insert a ACL-drop action with a value defined
by user that would be later on passed with a dropped packet.

To implement this, use the existing TC action cookie and pass it to the
driver. As the cookie format coming down from TC and the mlxsw HW cookie
format is different, do the mapping of these two using idr and rhashtable.

The cookie is passed up from the HW through devlink_trap_report() to
drop_monitor code. A new metadata type is used for that.

Example:
$ tc qdisc add dev enp0s16np1 clsact
$ tc filter add dev enp0s16np1 ingress protocol ip pref 10 flower skip_sw dst_ip 192.168.1.2 action drop cookie 3b45fa38c8
                                                                                                                ^^^^^^^^^^
$ devlink trap set pci/0000:00:10.0 trap acl action trap
$ dropwatch
Initializing null lookup method
dropwatch> set hw true
setting hardware drops monitoring to 1
dropwatch> set alertmode packet
Setting alert mode
Alert mode successfully set
dropwatch> start
Enabling monitoring...
Kernel monitoring activated.
Issue Ctrl-C to stop monitoring
drop at: ingress_flow_action_drop (acl_drops)
origin: hardware
input port ifindex: 30
input port name: enp0s16np1
cookie: 3b45fa38c8    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
timestamp: Fri Jan 24 17:10:53 2020 715387671 nsec
protocol: 0x800
length: 98
original length: 98

This way the user may insert multiple drop rules and monitor the dropped
packets with the information of which action caused the drop.

Jiri Pirko (10):
  flow_offload: pass action cookie through offload structures
  devlink: add trap metadata type for cookie
  drop_monitor: extend by passing cookie from driver
  devlink: extend devlink_trap_report() to accept cookie and pass
  mlxsw: core_acl_flex_actions: Add trap with userdef action
  mlxsw: core_acl_flex_actions: Implement flow_offload action cookie
    offload
  mlxsw: pci: Extract cookie index for ACL discard trap packets
  mlxsw: spectrum_trap: Lookup and pass cookie down to
    devlink_trap_report()
  netdevsim: add ACL trap reporting cookie as a metadata
  selftests: netdevsim: Extend devlink trap test to include flow action
    cookie

 drivers/net/ethernet/mellanox/mlxsw/core.h    |   5 +-
 .../mellanox/mlxsw/core_acl_flex_actions.c    | 289 +++++++++++++++++-
 .../mellanox/mlxsw/core_acl_flex_actions.h    |   7 +-
 drivers/net/ethernet/mellanox/mlxsw/pci.c     |   9 +
 drivers/net/ethernet/mellanox/mlxsw/pci_hw.h  |   5 +
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |  11 +-
 .../ethernet/mellanox/mlxsw/spectrum_acl.c    |   7 +-
 .../ethernet/mellanox/mlxsw/spectrum_flower.c |   3 +-
 .../ethernet/mellanox/mlxsw/spectrum_trap.c   |  46 ++-
 drivers/net/netdevsim/dev.c                   | 117 ++++++-
 drivers/net/netdevsim/netdevsim.h             |   2 +
 include/net/devlink.h                         |   8 +-
 include/net/drop_monitor.h                    |   3 +
 include/net/flow_offload.h                    |  11 +
 include/uapi/linux/devlink.h                  |   2 +
 include/uapi/linux/net_dropmon.h              |   1 +
 net/core/devlink.c                            |  14 +-
 net/core/drop_monitor.c                       |  33 +-
 net/core/flow_offload.c                       |  21 ++
 net/sched/cls_api.c                           |  31 +-
 .../drivers/net/netdevsim/devlink_trap.sh     |   5 +
 21 files changed, 605 insertions(+), 25 deletions(-)

-- 
2.21.1


             reply	other threads:[~2020-02-25 10:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 10:45 Jiri Pirko [this message]
2020-02-25 10:45 ` [patch net-next v2 01/10] flow_offload: pass action cookie through offload structures Jiri Pirko
2020-02-25 18:20   ` Jakub Kicinski
2020-02-25 10:45 ` [patch net-next v2 02/10] devlink: add trap metadata type for cookie Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 03/10] drop_monitor: extend by passing cookie from driver Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 04/10] devlink: extend devlink_trap_report() to accept cookie and pass Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 05/10] mlxsw: core_acl_flex_actions: Add trap with userdef action Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 06/10] mlxsw: core_acl_flex_actions: Implement flow_offload action cookie offload Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 07/10] mlxsw: pci: Extract cookie index for ACL discard trap packets Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 08/10] mlxsw: spectrum_trap: Lookup and pass cookie down to devlink_trap_report() Jiri Pirko
2020-02-25 10:45 ` [patch net-next v2 09/10] netdevsim: add ACL trap reporting cookie as a metadata Jiri Pirko
2020-02-25 18:25   ` Jakub Kicinski
2020-02-25 10:45 ` [patch net-next v2 10/10] selftests: netdevsim: Extend devlink trap test to include flow action cookie Jiri Pirko
2020-02-25 19:06 ` [patch net-next v2 00/10] mlxsw: Implement ACL-dropped packets identification David Miller

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=20200225104527.2849-1-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).