When the flow_offload infrastructure was added, per-action statistics,
 which were previously possible for drivers to support in TC offload,
 were not plumbed through, perhaps because the drivers in the tree did
 not implement them.
In TC (and in the previous offload API) statistics are per-action,
 though generally only on 'delivery' actions like mirred, ok and shot.
 Actions also have an index, which may be supplied by the user, which
 allows the sharing of entities such as counters between multiple rules.
The existing driver implementations did not support this, however,
 instead allocating a single counter per rule.  The flow_offload API did
 not support this either, as (a) the information that two actions were
 actually the same action never reached the driver, and (b) the
 TC_CLSFLOWER_STATS callback is only able to return a single set of
 stats, which are added to all counters for actions on the rule.
Patch #1 of this series fixes (a) by adding a cookie member to struct
 flow_action_entry, while the remaining patches fix (b) by adding a per-
 action offload callback (TC_SETUP_ACTION/TC_ACTION_STATS) for
 RTM_GETACTION, and also (patch #4) calling it for each action when
 dumping a rule.
For drivers supporting per-action stats (of which none yet exist
 upstream, hence RFC), this also means that RTM_GETACTION will return
 up-to-date stats, rather than stale values from the last time the rule
 was dumped.

Changed in v4:
* Incorporated RTM_GETACTION offload series
* Replaced TC_CLSFLOWER_STATS stats-array with multiple TC_SETUP_ACTION
  callbacks
* dropped header inclusion fix (submitted separately)
* re-added RFC tags

Changed in v3:
* replaced action_index with cookie, so drivers don't have to look at
  flow_action_id to distinguish shared actions
* removed RFC tags

Changed in v2:
* use array instead of new callback for getting stats
* remove CVLAN patch (posted separately for net)
* add header inclusion fix

Edward Cree (4):
  flow_offload: add a cookie to flow_action_entry
  net/sched: add callback to get stats on an action from clsflower
    offload
  net/sched: add action block binding to other classifiers
  net/sched: call action stats offload in flower or mall dump

 include/linux/netdevice.h  |  1 +
 include/net/act_api.h      |  7 +++++-
 include/net/flow_offload.h |  2 ++
 include/net/pkt_cls.h      | 18 ++++++++++++++
 net/sched/act_api.c        | 51 ++++++++++++++++++++++++++++++++++++++
 net/sched/cls_api.c        |  2 ++
 net/sched/cls_bpf.c        | 10 +++++++-
 net/sched/cls_flower.c     | 13 ++++++++++
 net/sched/cls_matchall.c   | 12 +++++++++
 net/sched/cls_u32.c        |  7 ++++++
 10 files changed, 121 insertions(+), 2 deletions(-)

Reply via email to