Blob Blame History Raw
From: Po Liu <Po.Liu@nxp.com>
Date: Wed, 24 Jun 2020 17:36:30 +0800
Subject: net: qos: police action add index for tc flower offloading
Patch-mainline: v5.9-rc1
Git-commit: 627e39b1399e72e53895eec6bbec30199ed43de2
References: bsc#1176447

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>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 include/net/flow_offload.h |    1 +
 net/sched/cls_api.c        |    1 +
 2 files changed, 2 insertions(+)

--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -230,6 +230,7 @@ struct flow_action_entry {
 			bool			truncate;
 		} sample;
 		struct {				/* FLOW_ACTION_POLICE */
+			u32			index;
 			s64			burst;
 			u64			rate_bytes_ps;
 			u32			mtu;
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3663,6 +3663,7 @@ int tc_setup_flow_action(struct flow_act
 			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);