diff mbox series

[ovs-dev,11/20] datapath: Add meter netlink definitions

Message ID 1517355622-26114-12-git-send-email-gvrose8192@gmail.com
State Superseded
Headers show
Series Update and backport of upstream Linux | expand

Commit Message

Gregory Rose Jan. 30, 2018, 11:40 p.m. UTC
From: Andy Zhou <azhou@ovn.org>

Upstream commit:
    commit 5794040647de4011598a6d005fdad95d24fd385b
    Author: Andy Zhou <azhou@ovn.org>
    Date:   Fri Nov 10 12:09:40 2017 -0800

    openvswitch: Add meter netlink definitions

    Meter has its own netlink family. Define netlink messages and attributes
    for communicating with the user space programs.

    Signed-off-by: Andy Zhou <azhou@ovn.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc: Andy Zhou <azhou@ovn.org>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/linux/compat/include/linux/openvswitch.h | 51 +++++++++++++++++++++++
 1 file changed, 51 insertions(+)

Comments

Pravin Shelar Feb. 2, 2018, 6:18 p.m. UTC | #1
On Tue, Jan 30, 2018 at 3:40 PM, Greg Rose <gvrose8192@gmail.com> wrote:
> From: Andy Zhou <azhou@ovn.org>
>
> Upstream commit:
>     commit 5794040647de4011598a6d005fdad95d24fd385b
>     Author: Andy Zhou <azhou@ovn.org>
>     Date:   Fri Nov 10 12:09:40 2017 -0800
>
>     openvswitch: Add meter netlink definitions
>
>     Meter has its own netlink family. Define netlink messages and attributes
>     for communicating with the user space programs.
>
>     Signed-off-by: Andy Zhou <azhou@ovn.org>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Cc: Andy Zhou <azhou@ovn.org>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>

I am not sure if meter userspace is targeted for 2.9, if it is then we
can backport metering related patches to 2.9
Gregory Rose Feb. 2, 2018, 6:28 p.m. UTC | #2
On 2/2/2018 10:18 AM, Pravin Shelar wrote:
> On Tue, Jan 30, 2018 at 3:40 PM, Greg Rose <gvrose8192@gmail.com> wrote:
>> From: Andy Zhou <azhou@ovn.org>
>>
>> Upstream commit:
>>      commit 5794040647de4011598a6d005fdad95d24fd385b
>>      Author: Andy Zhou <azhou@ovn.org>
>>      Date:   Fri Nov 10 12:09:40 2017 -0800
>>
>>      openvswitch: Add meter netlink definitions
>>
>>      Meter has its own netlink family. Define netlink messages and attributes
>>      for communicating with the user space programs.
>>
>>      Signed-off-by: Andy Zhou <azhou@ovn.org>
>>      Signed-off-by: David S. Miller <davem@davemloft.net>
>>
>> Cc: Andy Zhou <azhou@ovn.org>
>> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> I am not sure if meter userspace is targeted for 2.9, if it is then we
> can backport metering related patches to 2.9

Andy sent me a patch for theĀ  meter side userspace code that will 
interface to the kernel datapath metering.
I just need to find a bit of time to appy, test and post for review.

Thanks,

- Greg
diff mbox series

Patch

diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h
index 6081a29..164f57d 100644
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ b/datapath/linux/compat/include/linux/openvswitch.h
@@ -945,4 +945,55 @@  enum ovs_action_attr {
 
 #define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
 
+/* Meters. */
+#define OVS_METER_FAMILY  "ovs_meter"
+#define OVS_METER_MCGROUP "ovs_meter"
+#define OVS_METER_VERSION 0x1
+
+enum ovs_meter_cmd {
+	OVS_METER_CMD_UNSPEC,
+	OVS_METER_CMD_FEATURES,	/* Get features supported by the datapath. */
+	OVS_METER_CMD_SET,	/* Add or modify a meter. */
+	OVS_METER_CMD_DEL,	/* Delete a meter. */
+	OVS_METER_CMD_GET	/* Get meter stats. */
+};
+
+enum ovs_meter_attr {
+	OVS_METER_ATTR_UNSPEC,
+	OVS_METER_ATTR_ID,	/* u32 meter ID within datapath. */
+	OVS_METER_ATTR_KBPS,	/* No argument. If set, units in kilobits
+				 * per second. Otherwise, units in
+				 * packets per second.
+				 */
+	OVS_METER_ATTR_STATS,	/* struct ovs_flow_stats for the meter. */
+	OVS_METER_ATTR_BANDS,	/* Nested attributes for meter bands. */
+	OVS_METER_ATTR_USED,	/* u64 msecs last used in monotonic time. */
+	OVS_METER_ATTR_CLEAR,	/* Flag to clear stats, used. */
+	OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */
+	OVS_METER_ATTR_MAX_BANDS,  /* u32 max number of bands per meter. */
+	OVS_METER_ATTR_PAD,
+	__OVS_METER_ATTR_MAX
+};
+
+#define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1)
+
+enum ovs_band_attr {
+	OVS_BAND_ATTR_UNSPEC,
+	OVS_BAND_ATTR_TYPE,	/* u32 OVS_METER_BAND_TYPE_* constant. */
+	OVS_BAND_ATTR_RATE,	/* u32 band rate in meter units (see above). */
+	OVS_BAND_ATTR_BURST,	/* u32 burst size in meter units. */
+	OVS_BAND_ATTR_STATS,	/* struct ovs_flow_stats for the band. */
+	__OVS_BAND_ATTR_MAX
+};
+
+#define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1)
+
+enum ovs_meter_band_type {
+	OVS_METER_BAND_TYPE_UNSPEC,
+	OVS_METER_BAND_TYPE_DROP,   /* Drop exceeding packets. */
+	__OVS_METER_BAND_TYPE_MAX
+};
+
+#define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1)
+
 #endif /* _LINUX_OPENVSWITCH_H */