[SRU][F:linux-bluefield][PATCH 2/7] net: qos: police action add index for tc flower offloading

Bodong Wang bodong at nvidia.com
Tue Aug 3 19:16:04 UTC 2021

From: Po Liu <Po.Liu at nxp.com>

BugLink: https://bugs.launchpad.net/bugs/1938818

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 at idosch.org>

Signed-off-by: Po Liu <Po.Liu at nxp.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 627e39b1399e72e53895eec6bbec30199ed43de2)
Signed-off-by: Bodong Wang <bodong at nvidia.com>
 include/net/flow_offload.h | 1 +
 net/sched/cls_api.c        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index faa9418..fb3495d 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -199,6 +199,7 @@ struct flow_action_entry {
 			bool			truncate;
 		} sample;
 		struct {				/* FLOW_ACTION_POLICE */
+			u32			index;
 			s64			burst;
 			u64			rate_bytes_ps;
 			u32			mtu;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index cdb51b5..78f534d 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3605,6 +3605,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
 			entry->police.rate_bytes_ps =
 			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);

More information about the kernel-team mailing list