@@ -21,6 +21,7 @@
#include <stddef.h>
#include <stdint.h>
+#include "dpif.h"
#include "flow.h"
struct ofpbuf;
@@ -60,4 +61,7 @@ bool dpif_netlink_is_internal_device(const char *name);
enum ovs_vport_type netdev_to_ovs_vport_type(const char *type);
+typedef int dpif_netlink_sflow_upcall_callback(struct dpif_upcall_sflow
+ *dupcall);
+
#endif /* dpif-netlink.h */
@@ -83,6 +83,9 @@ struct netdev_flow_api {
int (*flow_del)(struct netdev *, const ovs_u128 *ufid,
struct dpif_flow_stats *);
+ /* Registers an upcall callback to process sFlow packet */
+ void (*register_nl_sflow_upcall_cb)(dpif_netlink_sflow_upcall_callback *);
+
/* Initializies the netdev flow api.
* Return 0 if successful, otherwise returns a positive errno value. */
int (*init_flow_api)(struct netdev *);
@@ -666,3 +666,15 @@ netdev_set_flow_api_enabled(const struct smap *ovs_other_config)
}
}
}
+
+void
+netdev_regsiter_nl_sflow_upcall_cb(struct netdev *netdev,
+ dpif_netlink_sflow_upcall_callback *cb)
+{
+ const struct netdev_flow_api *flow_api =
+ ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api);
+
+ if (flow_api && flow_api->register_nl_sflow_upcall_cb) {
+ flow_api->register_nl_sflow_upcall_cb(cb);
+ }
+}
@@ -22,6 +22,7 @@
#include "openvswitch/types.h"
#include "packets.h"
#include "flow.h"
+#include "dpif-netlink.h"
#ifdef __cplusplus
extern "C" {
@@ -124,6 +125,8 @@ int netdev_ports_flow_get(const char *dpif_type, struct match *match,
struct dpif_flow_stats *stats,
struct dpif_flow_attrs *attrs,
struct ofpbuf *buf);
+void netdev_regsiter_nl_sflow_upcall_cb(struct netdev *netdev,
+ dpif_netlink_sflow_upcall_callback *cb);
#ifdef __cplusplus
}