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