xref: /linux/drivers/net/ethernet/marvell/prestera/prestera_counter.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1*6e36c7bcSVolodymyr Mytnyk /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2*6e36c7bcSVolodymyr Mytnyk /* Copyright (c) 2021 Marvell International Ltd. All rights reserved. */
3*6e36c7bcSVolodymyr Mytnyk 
4*6e36c7bcSVolodymyr Mytnyk #ifndef _PRESTERA_COUNTER_H_
5*6e36c7bcSVolodymyr Mytnyk #define _PRESTERA_COUNTER_H_
6*6e36c7bcSVolodymyr Mytnyk 
7*6e36c7bcSVolodymyr Mytnyk #include <linux/types.h>
8*6e36c7bcSVolodymyr Mytnyk 
9*6e36c7bcSVolodymyr Mytnyk struct prestera_counter_stats {
10*6e36c7bcSVolodymyr Mytnyk 	u64 packets;
11*6e36c7bcSVolodymyr Mytnyk 	u64 bytes;
12*6e36c7bcSVolodymyr Mytnyk };
13*6e36c7bcSVolodymyr Mytnyk 
14*6e36c7bcSVolodymyr Mytnyk struct prestera_switch;
15*6e36c7bcSVolodymyr Mytnyk struct prestera_counter;
16*6e36c7bcSVolodymyr Mytnyk struct prestera_counter_block;
17*6e36c7bcSVolodymyr Mytnyk 
18*6e36c7bcSVolodymyr Mytnyk int prestera_counter_init(struct prestera_switch *sw);
19*6e36c7bcSVolodymyr Mytnyk void prestera_counter_fini(struct prestera_switch *sw);
20*6e36c7bcSVolodymyr Mytnyk 
21*6e36c7bcSVolodymyr Mytnyk int prestera_counter_get(struct prestera_counter *counter, u32 client,
22*6e36c7bcSVolodymyr Mytnyk 			 struct prestera_counter_block **block,
23*6e36c7bcSVolodymyr Mytnyk 			 u32 *counter_id);
24*6e36c7bcSVolodymyr Mytnyk void prestera_counter_put(struct prestera_counter *counter,
25*6e36c7bcSVolodymyr Mytnyk 			  struct prestera_counter_block *block, u32 counter_id);
26*6e36c7bcSVolodymyr Mytnyk int prestera_counter_stats_get(struct prestera_counter *counter,
27*6e36c7bcSVolodymyr Mytnyk 			       struct prestera_counter_block *block,
28*6e36c7bcSVolodymyr Mytnyk 			       u32 counter_id, u64 *packets, u64 *bytes);
29*6e36c7bcSVolodymyr Mytnyk 
30*6e36c7bcSVolodymyr Mytnyk #endif /* _PRESTERA_COUNTER_H_ */
31