1 /* Interface exported by OpenFlow module. */
6 #include <linux/mutex.h>
7 #include <linux/netlink.h>
8 #include <linux/netdevice.h>
9 #include <linux/skbuff.h>
14 #define NL_FLOWS_PER_MESSAGE 100
19 #define dprintk(x...) printk(x)
22 /* Capabilities supported by this implementation. */
23 #define OFP_SUPPORTED_CAPABILITIES ( OFPC_FLOW_STATS \
28 /* Actions supported by this implementation. */
29 #define OFP_SUPPORTED_ACTIONS ( (1 << OFPAT_OUTPUT) \
30 | (1 << OFPAT_SET_DL_VLAN) \
31 | (1 << OFPAT_SET_DL_SRC) \
32 | (1 << OFPAT_SET_DL_DST) \
33 | (1 << OFPAT_SET_NW_SRC) \
34 | (1 << OFPAT_SET_NW_DST) \
35 | (1 << OFPAT_SET_TP_SRC) \
36 | (1 << OFPAT_SET_TP_DST) )
43 /* Unique identifier for this datapath, incorporates the dp_idx and
44 * a hardware address */
47 struct timer_list timer; /* Expiration timer. */
48 struct sw_chain *chain; /* Forwarding rules. */
49 struct task_struct *dp_task; /* Kernel thread for maintenance. */
51 /* Data related to the "of" device of this datapath */
52 struct net_device *netdev;
54 /* Configuration set from controller */
56 uint16_t miss_send_len;
59 struct net_bridge_port *ports[OFPP_MAX];
60 struct net_bridge_port *local_port; /* OFPP_LOCAL port. */
61 struct list_head port_list; /* All ports, including local_port. */
64 /* Information necessary to reply to the sender of an OpenFlow message. */
66 uint32_t xid; /* OpenFlow transaction ID of request. */
67 uint32_t pid; /* Netlink process ID of sending socket. */
68 uint32_t seq; /* Netlink sequence ID of request. */
71 extern struct mutex dp_mutex;
73 int dp_output_port(struct datapath *, struct sk_buff *, int out_port);
74 int dp_output_control(struct datapath *, struct sk_buff *, uint32_t,
76 int dp_set_origin(struct datapath *, uint16_t, struct sk_buff *);
77 int dp_send_features_reply(struct datapath *, const struct sender *);
78 int dp_send_config_reply(struct datapath *, const struct sender *);
79 int dp_send_flow_expired(struct datapath *, struct sw_flow *);
80 int dp_send_error_msg(struct datapath *, const struct sender *,
81 uint16_t, uint16_t, const uint8_t *, size_t);
82 int dp_update_port_flags(struct datapath *dp, const struct ofp_phy_port *opp);
83 int dp_send_echo_reply(struct datapath *, const struct sender *,
84 const struct ofp_header *);
86 /* Should hold at least RCU read lock when calling */
87 struct datapath *dp_get(int dp_idx);
89 #endif /* datapath.h */