Make "controller nl:0" work again, by fixing a layering violation.
[sliver-openvswitch.git] / datapath / datapath.h
index b342cbb..01fbaae 100644 (file)
@@ -3,8 +3,10 @@
 #ifndef DATAPATH_H
 #define DATAPATH_H 1
 
+#include <linux/mutex.h>
 #include <linux/netlink.h>
 #include <linux/netdevice.h>
+#include <linux/workqueue.h>
 #include <linux/skbuff.h>
 #include "openflow.h"
 #include "flow.h"
 #endif
 
 /* Capabilities supported by this implementation. */
-#define OFP_SUPPORTED_CAPABILITIES (OFPC_MULTI_PHY_TX)
+#define OFP_SUPPORTED_CAPABILITIES ( OFPC_FLOW_STATS \
+               | OFPC_TABLE_STATS \
+               | OFPC_PORT_STATS \
+               | OFPC_MULTI_PHY_TX )
 
 /* Actions supported by this implementation. */
 #define OFP_SUPPORTED_ACTIONS ( (1 << OFPAT_OUTPUT) \
@@ -64,16 +69,38 @@ struct sender {
        uint32_t seq;           /* Netlink sequence ID of request. */
 };
 
-int dp_output_port(struct datapath *, struct sk_buff *, int out_port);
+#define PORT_STATUS_BITS (OFPPFL_PORT_DOWN | OFPPFL_LINK_DOWN)
+#define PORT_FLAG_BITS (~PORT_STATUS_BITS)
+
+struct net_bridge_port {
+       u16     port_no;
+       u32 flags;              /* Some subset of PORT_FLAG_BITS. */
+       u32 status;             /* Some subset of PORT_STATUS_BITS. */
+       spinlock_t lock;
+       struct work_struct port_task;
+       struct datapath *dp;
+       struct net_device *dev;
+       struct list_head node; /* Element in datapath.ports. */
+};
+
+extern struct mutex dp_mutex;
+
+int dp_output_port(struct datapath *, struct sk_buff *, int out_port,
+                  int ignore_no_fwd);
 int dp_output_control(struct datapath *, struct sk_buff *, uint32_t, 
                        size_t, int);
 int dp_set_origin(struct datapath *, uint16_t, struct sk_buff *);
 int dp_send_features_reply(struct datapath *, const struct sender *);
 int dp_send_config_reply(struct datapath *, const struct sender *);
-int dp_send_flow_expired(struct datapath *, struct sw_flow *);
+int dp_send_flow_expired(struct datapath *, struct sw_flow *,
+                        enum ofp_flow_expired_reason);
 int dp_send_error_msg(struct datapath *, const struct sender *, 
-                       uint16_t, uint16_t, const uint8_t *, size_t);
-int dp_update_port_flags(struct datapath *dp, const struct ofp_phy_port *opp);
+                       uint16_t, uint16_t, const void *, size_t);
+int dp_update_port_flags(struct datapath *dp, const struct ofp_port_mod *opm);
+int dp_send_echo_reply(struct datapath *, const struct sender *,
+                      const struct ofp_header *);
+int dp_send_hello(struct datapath *, const struct sender *,
+                 const struct ofp_header *);
 
 /* Should hold at least RCU read lock when calling */
 struct datapath *dp_get(int dp_idx);