2021-08-02 14:18:36

by Vadym Kochan

[permalink] [raw]
Subject: [PATCH net-next v2 0/4] Marvell Prestera add policer support

From: Vadym Kochan <[email protected]>

Offload action police when keyed to a flower classifier.
Only rate and burst is supported for now. The conform-exceed
drop is assumed as a default value.

Policer support requires FW 3.1 version. Because there are some FW ABI
differences in ACL rule messages between 3.0 and 3.1 so added separate
"_ext" struct version with separate HW helper.

Also added new __tc_classid_to_hwtc() helper which calculates hw tc
without need of netdev but specifying the num of tc instead, because
ingress HW queues are globally and statically per ASIC not per port.

v2:
1) Added missing "static" in #4 patch prestera_hw.c

Serhiy Boiko (1):
net: marvell: prestera: Offload FLOW_ACTION_POLICE

Vadym Kochan (3):
net: marvell: prestera: do not fail if FW reply is bigger
net: marvell: prestera: turn FW supported versions into an array
net: sched: introduce __tc_classid_to_hwtc() helper

.../ethernet/marvell/prestera/prestera_acl.c | 14 ++
.../ethernet/marvell/prestera/prestera_acl.h | 11 +-
.../marvell/prestera/prestera_flower.c | 18 +++
.../ethernet/marvell/prestera/prestera_hw.c | 125 +++++++++++++++++-
.../ethernet/marvell/prestera/prestera_pci.c | 63 ++++-----
include/net/sch_generic.h | 9 +-
6 files changed, 197 insertions(+), 43 deletions(-)

--
2.17.1



2021-08-02 14:19:29

by Vadym Kochan

[permalink] [raw]
Subject: [PATCH net-next v2 3/4] net: sched: introduce __tc_classid_to_hwtc() helper

From: Vadym Kochan <[email protected]>

There might be a case when the ingress HW queues are globally shared in
ASIC and are not per port (netdev). So add a __tc_classid_to_hwtc()
version which accepts number of tc instead of netdev.

Signed-off-by: Vadym Kochan <[email protected]>
---
include/net/sch_generic.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c0069ac00e62..df04f4035a4b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -668,11 +668,16 @@ qdisc_class_find(const struct Qdisc_class_hash *hash, u32 id)
return NULL;
}

-static inline int tc_classid_to_hwtc(struct net_device *dev, u32 classid)
+static inline int __tc_classid_to_hwtc(u32 tc_num, u32 classid)
{
u32 hwtc = TC_H_MIN(classid) - TC_H_MIN_PRIORITY;

- return (hwtc < netdev_get_num_tc(dev)) ? hwtc : -EINVAL;
+ return (hwtc < tc_num) ? hwtc : -EINVAL;
+}
+
+static inline int tc_classid_to_hwtc(struct net_device *dev, u32 classid)
+{
+ return __tc_classid_to_hwtc(netdev_get_num_tc(dev), classid);
}

int qdisc_class_hash_init(struct Qdisc_class_hash *);
--
2.17.1