net: qos: police action add index for tc flower offloading
authorPo Liu <Po.Liu@nxp.com>
Wed, 24 Jun 2020 09:36:30 +0000 (17:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Jun 2020 05:04:26 +0000 (22:04 -0700)
Hardware device may include more than one police entry. Specifying the
action's index make it possible for several tc filters to share the same
police action when installing the filters.

Propagate this index to device drivers through the flow offload
intermediate representation, so that drivers could share a single
hardware policer between multiple filters.

v1->v2 changes:
- Update the commit message suggest by Ido Schimmel <idosch@idosch.org>

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/flow_offload.h
net/sched/cls_api.c

index c2ef19c..eed9807 100644 (file)
@@ -232,6 +232,7 @@ struct flow_action_entry {
                        bool                    truncate;
                } sample;
                struct {                                /* FLOW_ACTION_POLICE */
+                       u32                     index;
                        s64                     burst;
                        u64                     rate_bytes_ps;
                        u32                     mtu;
index 6aba7d5..fdc4c89 100644 (file)
@@ -3659,6 +3659,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
                        entry->police.rate_bytes_ps =
                                tcf_police_rate_bytes_ps(act);
                        entry->police.mtu = tcf_police_tcfp_mtu(act);
+                       entry->police.index = act->tcfa_index;
                } else if (is_tcf_ct(act)) {
                        entry->id = FLOW_ACTION_CT;
                        entry->ct.action = tcf_ct_action(act);