1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2017 Nicira, Inc.
9 #include <linux/init.h>
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/netlink.h>
13 #include <linux/openvswitch.h>
14 #include <linux/genetlink.h>
15 #include <linux/skbuff.h>
20 #define DP_MAX_BANDS 1
22 struct dp_meter_band
{
26 u32 bucket
; /* 1/1000 packets, or in bits */
27 struct ovs_flow_stats stats
;
31 spinlock_t lock
; /* Per meter lock */
33 struct hlist_node dp_hash_node
; /*Element in datapath->meters
37 u16 kbps
:1, keep_stats
:1;
41 struct ovs_flow_stats stats
;
42 struct dp_meter_band bands
[];
45 extern struct genl_family dp_meter_genl_family
;
46 int ovs_meters_init(struct datapath
*dp
);
47 void ovs_meters_exit(struct datapath
*dp
);
48 bool ovs_meter_execute(struct datapath
*dp
, struct sk_buff
*skb
,
49 struct sw_flow_key
*key
, u32 meter_id
);