summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorHoratiu Vultur <horatiu.vultur@microchip.com>2023-02-07 13:35:49 +0300
committerDavid S. Miller <davem@davemloft.net>2023-02-08 12:13:08 +0300
commit9ed138ff37670e7eb6291d822f5648de685cfb32 (patch)
treee37198c75a16cbffcb28ec9c8492c5b5b12ecf49 /drivers/net/ethernet
parent1fe8a3b61fd6eb4a46fde7c22127ffa99ab27ed2 (diff)
downloadlinux-9ed138ff37670e7eb6291d822f5648de685cfb32.tar.xz
net: lan966x: Add support for TC flower filter statistics
Add flower filter packet statistics. This will just read the TCAM counter of the rule, which mention how many packages were hit by this rule. Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c b/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c
index 88c655d6318f..1e464bb804ae 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_tc_flower.c
@@ -234,6 +234,24 @@ static int lan966x_tc_flower_del(struct lan966x_port *port,
return err;
}
+static int lan966x_tc_flower_stats(struct lan966x_port *port,
+ struct flow_cls_offload *f,
+ struct vcap_admin *admin)
+{
+ struct vcap_counter count = {};
+ int err;
+
+ err = vcap_get_rule_count_by_cookie(port->lan966x->vcap_ctrl,
+ &count, f->cookie);
+ if (err)
+ return err;
+
+ flow_stats_update(&f->stats, 0x0, count.value, 0, 0,
+ FLOW_ACTION_HW_STATS_IMMEDIATE);
+
+ return err;
+}
+
int lan966x_tc_flower(struct lan966x_port *port,
struct flow_cls_offload *f,
bool ingress)
@@ -252,6 +270,8 @@ int lan966x_tc_flower(struct lan966x_port *port,
return lan966x_tc_flower_add(port, f, admin, ingress);
case FLOW_CLS_DESTROY:
return lan966x_tc_flower_del(port, f, admin);
+ case FLOW_CLS_STATS:
+ return lan966x_tc_flower_stats(port, f, admin);
default:
return -EOPNOTSUPP;
}