summaryrefslogtreecommitdiff
path: root/net/openvswitch/meter.h
diff options
context:
space:
mode:
authorTonghao Zhang <xiangxia.m.yue@gmail.com>2020-04-24 08:08:03 +0800
committerDavid S. Miller <davem@davemloft.net>2020-04-23 18:26:11 -0700
commiteb58eebc7fb5e23c9cc7d557c0a9236630591526 (patch)
tree8c1a3c09ebc1b041f6abf4416a1c4b9382b2cc7b /net/openvswitch/meter.h
parentc7c4c44c9a95d87e50ced38f7480e779cb472174 (diff)
net: openvswitch: set max limitation to meters
Don't allow user to create meter unlimitedly, which may cause to consume a large amount of kernel memory. The max number supported is decided by physical memory and 20K meters as default. Cc: Pravin B Shelar <pshelar@ovn.org> Cc: Andy Zhou <azhou@ovn.org> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch/meter.h')
-rw-r--r--net/openvswitch/meter.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/openvswitch/meter.h b/net/openvswitch/meter.h
index f52052d30a16..61a3ca43cd77 100644
--- a/net/openvswitch/meter.h
+++ b/net/openvswitch/meter.h
@@ -20,6 +20,7 @@ struct datapath;
#define DP_MAX_BANDS 1
#define DP_METER_ARRAY_SIZE_MIN BIT_ULL(10)
+#define DP_METER_NUM_MAX (200000UL)
struct dp_meter_band {
u32 type;
@@ -50,6 +51,7 @@ struct dp_meter_instance {
struct dp_meter_table {
struct dp_meter_instance __rcu *ti;
u32 count;
+ u32 max_meters_allowed;
};
extern struct genl_family dp_meter_genl_family;