hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/openvswitch/meter.h
....@@ -1,9 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2017 Nicira, Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of version 2 of the GNU General Public
6
- * License as published by the Free Software Foundation.
74 */
85
96 #ifndef METER_H
....@@ -16,11 +13,14 @@
1613 #include <linux/openvswitch.h>
1714 #include <linux/genetlink.h>
1815 #include <linux/skbuff.h>
16
+#include <linux/bits.h>
1917
2018 #include "flow.h"
2119 struct datapath;
2220
2321 #define DP_MAX_BANDS 1
22
+#define DP_METER_ARRAY_SIZE_MIN BIT_ULL(10)
23
+#define DP_METER_NUM_MAX (200000UL)
2424
2525 struct dp_meter_band {
2626 u32 type;
....@@ -33,9 +33,6 @@
3333 struct dp_meter {
3434 spinlock_t lock; /* Per meter lock */
3535 struct rcu_head rcu;
36
- struct hlist_node dp_hash_node; /*Element in datapath->meters
37
- * hash table.
38
- */
3936 u32 id;
4037 u16 kbps:1, keep_stats:1;
4138 u16 n_bands;
....@@ -45,6 +42,18 @@
4542 struct dp_meter_band bands[];
4643 };
4744
45
+struct dp_meter_instance {
46
+ struct rcu_head rcu;
47
+ u32 n_meters;
48
+ struct dp_meter __rcu *dp_meters[];
49
+};
50
+
51
+struct dp_meter_table {
52
+ struct dp_meter_instance __rcu *ti;
53
+ u32 count;
54
+ u32 max_meters_allowed;
55
+};
56
+
4857 extern struct genl_family dp_meter_genl_family;
4958 int ovs_meters_init(struct datapath *dp);
5059 void ovs_meters_exit(struct datapath *dp);