-/* Minimum number of bytes of headroom for a packet returned by dpif_recv()
- * member function. This headroom allows "struct odp_msg" to be replaced by
- * "struct ofp_packet_in" without copying the buffer. */
-#define DPIF_RECV_MSG_PADDING \
- ROUND_UP(sizeof(struct ofp_packet_in) - sizeof(struct odp_msg), 8)
-BUILD_ASSERT_DECL(sizeof(struct ofp_packet_in) > sizeof(struct odp_msg));
-BUILD_ASSERT_DECL(DPIF_RECV_MSG_PADDING % 8 == 0);
+enum dpif_upcall_type {
+ DPIF_UC_MISS, /* Miss in flow table. */
+ DPIF_UC_ACTION, /* ODP_ACTION_ATTR_USERSPACE action. */
+ DPIF_UC_SAMPLE, /* Packet sampling. */
+ DPIF_N_UC_TYPES
+};
+
+const char *dpif_upcall_type_to_string(enum dpif_upcall_type);
+
+/* A packet passed up from the datapath to userspace.
+ *
+ * If 'key' or 'actions' is nonnull, then it points into data owned by
+ * 'packet', so their memory cannot be freed separately. (This is hardly a
+ * great way to do things but it works out OK for the dpif providers and
+ * clients that exist so far.)
+ */
+struct dpif_upcall {
+ /* All types. */
+ enum dpif_upcall_type type;
+ struct ofpbuf *packet; /* Packet data. */
+ struct nlattr *key; /* Flow key. */
+ size_t key_len; /* Length of 'key' in bytes. */
+
+ /* DPIF_UC_ACTION only. */
+ uint64_t userdata; /* Argument to ODP_ACTION_ATTR_USERSPACE. */
+
+ /* DPIF_UC_SAMPLE only. */
+ uint32_t sample_pool; /* # of sampling candidate packets so far. */
+ struct nlattr *actions; /* Associated flow actions. */
+ size_t actions_len;
+};