.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
7 | 4 | */ |
---|
8 | 5 | |
---|
9 | 6 | #ifndef METER_H |
---|
.. | .. |
---|
16 | 13 | #include <linux/openvswitch.h> |
---|
17 | 14 | #include <linux/genetlink.h> |
---|
18 | 15 | #include <linux/skbuff.h> |
---|
| 16 | +#include <linux/bits.h> |
---|
19 | 17 | |
---|
20 | 18 | #include "flow.h" |
---|
21 | 19 | struct datapath; |
---|
22 | 20 | |
---|
23 | 21 | #define DP_MAX_BANDS 1 |
---|
| 22 | +#define DP_METER_ARRAY_SIZE_MIN BIT_ULL(10) |
---|
| 23 | +#define DP_METER_NUM_MAX (200000UL) |
---|
24 | 24 | |
---|
25 | 25 | struct dp_meter_band { |
---|
26 | 26 | u32 type; |
---|
.. | .. |
---|
33 | 33 | struct dp_meter { |
---|
34 | 34 | spinlock_t lock; /* Per meter lock */ |
---|
35 | 35 | struct rcu_head rcu; |
---|
36 | | - struct hlist_node dp_hash_node; /*Element in datapath->meters |
---|
37 | | - * hash table. |
---|
38 | | - */ |
---|
39 | 36 | u32 id; |
---|
40 | 37 | u16 kbps:1, keep_stats:1; |
---|
41 | 38 | u16 n_bands; |
---|
.. | .. |
---|
45 | 42 | struct dp_meter_band bands[]; |
---|
46 | 43 | }; |
---|
47 | 44 | |
---|
| 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 | + |
---|
48 | 57 | extern struct genl_family dp_meter_genl_family; |
---|
49 | 58 | int ovs_meters_init(struct datapath *dp); |
---|
50 | 59 | void ovs_meters_exit(struct datapath *dp); |
---|