summaryrefslogtreecommitdiff
path: root/datapath-windows/include
diff options
context:
space:
mode:
authorldejing <ldejing@vmware.com>2022-08-18 19:11:00 +0800
committerAlin-Gabriel Serdean <aserdean@ovn.org>2022-09-20 02:48:44 +0300
commitb26015c33fe420399fff1c9f35d1e3204c441954 (patch)
tree7f5ea882a645a452a41da75e4834caf7bfe1fbd0 /datapath-windows/include
parent7af5c33c1629b309cbcbe3b6c9c3bd6d3b4c0abf (diff)
downloadopenvswitch-b26015c33fe420399fff1c9f35d1e3204c441954.tar.gz
datapath-windows: support meter action initial version
This patch implemented meter action, currently, meter only support drop method and only support one band. The overall implementation is, when a packet comes in, it will first lookup meter according to the meter id, then get the band->rates and delta time since last access the same meter from the meter struct. Add the multiply result(band->rates * delta_time) to bucket, finally bucket minus the packet size, if the result larger than zero, allow the packet go through, otherwise deny the packet go through. Test case: 1. Setting the size meter size 3M, then the bandwidth was limit around 3M; ovs-ofctl -O OpenFlow13 add-meter br-test meter=2,kbps,\ band=type=drop,rate=3000 ovs-ofctl add-flow br-test "table=0,priority=1,ip \ actions=meter:2,normal" -O OpenFlow13 2. Setting the meter size 8M, then the bandwidth was limit around 8M; ovs-ofctl -O OpenFlow13 add-meter br-test meter=2,\ kbps,band=type=drop,rate=8000 ovs-ofctl add-flow br-test "table=0,priority=1,ip\ actions=meter:2,normal" -O OpenFlow13 Signed-off-by: ldejing <ldejing@vmware.com> Signed-off-by: Alin-Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'datapath-windows/include')
-rw-r--r--datapath-windows/include/OvsDpInterfaceExt.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/datapath-windows/include/OvsDpInterfaceExt.h b/datapath-windows/include/OvsDpInterfaceExt.h
index 5fd8000d1..045e4cbd6 100644
--- a/datapath-windows/include/OvsDpInterfaceExt.h
+++ b/datapath-windows/include/OvsDpInterfaceExt.h
@@ -74,6 +74,9 @@
#define OVS_WIN_NL_CT_FAMILY_ID (NLMSG_MIN_TYPE + 7)
#define OVS_WIN_NL_CTLIMIT_FAMILY_ID (NLMSG_MIN_TYPE + 8)
+/* Meter Family */
+#define OVS_WIN_NL_METER_FAMILY_ID (NLMSG_MIN_TYPE + 9)
+
#define OVS_WIN_NL_INVALID_MCGRP_ID 0
#define OVS_WIN_NL_MCGRP_START_ID 100
#define OVS_WIN_NL_VPORT_MCGRP_ID (OVS_WIN_NL_MCGRP_START_ID + 1)