[SRU][J:linux-bluefield][PATCH v1 4/5] net/sched: flower: Support hardware miss to tc action

William Tu witu at nvidia.com
Thu May 11 17:38:55 UTC 2023


From: Paul Blakey <paulb at nvidia.com>

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

To support hardware miss to tc action in actions on the flower
classifier, implement the required getting of filter actions,
and setup filter exts (actions) miss by giving it the filter's
handle and actions.

Signed-off-by: Paul Blakey <paulb at nvidia.com>
Reviewed-by: Jiri Pirko <jiri at nvidia.com>
Reviewed-by: Simon Horman <simon.horman at corigine.com>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner at gmail.com>
Signed-off-by: Jakub Kicinski <kuba at kernel.org>
(cherry picked from commit 606c7c43d08c4daf954ec8d58ae6dd39292fb457)
Signed-off-by: Paul Blakey <paulb at nvidia.com>
Signed-off-by: William Tu <witu at nvidia.com>
Acked-by: Tim Gardner <tim.gardner at canonical.com>
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz at canonical.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz at canonical.com>
---
 net/sched/cls_flower.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 54228e684f86..311637e9e875 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -535,6 +535,15 @@ static struct cls_fl_filter *__fl_get(struct cls_fl_head *head, u32 handle)
 	return f;
 }
 
+static struct tcf_exts *fl_get_exts(const struct tcf_proto *tp, u32 handle)
+{
+	struct cls_fl_head *head = rcu_dereference_bh(tp->root);
+	struct cls_fl_filter *f;
+
+	f = idr_find(&head->handle_idr, handle);
+	return f ? &f->exts : NULL;
+}
+
 static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f,
 		       bool *last, bool rtnl_held,
 		       struct netlink_ext_ack *extack)
@@ -2067,7 +2076,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 	}
 	fnew->handle = handle;
 
-	err = tcf_exts_init(&fnew->exts, net, TCA_FLOWER_ACT, 0);
+	err = tcf_exts_init_ex(&fnew->exts, net, TCA_FLOWER_ACT, 0, tp, handle,
+			       !tc_skip_hw(fnew->flags));
 	if (err < 0)
 		goto errout_idr;
 
@@ -3237,6 +3247,7 @@ static struct tcf_proto_ops cls_fl_ops __read_mostly = {
 	.tmplt_create	= fl_tmplt_create,
 	.tmplt_destroy	= fl_tmplt_destroy,
 	.tmplt_dump	= fl_tmplt_dump,
+	.get_exts	= fl_get_exts,
 	.owner		= THIS_MODULE,
 	.flags		= TCF_PROTO_OPS_DOIT_UNLOCKED,
 };
-- 
2.34.1




More information about the kernel-team mailing list