blob: f0329703643bc44f33121a0e94f2ca2cc6b0ec7c [file] [log] [blame]
Dave Hudsondcd08fb2013-11-22 09:25:16 -06001/*
2 * sfe_ipv4.h
3 * Shortcut forwarding engine.
4 *
5 * XXX - fill in the appropriate GPL notice.
6 */
7
8/*
9 * IPv4 connection flags.
10 */
11#define SFE_IPV4_CREATE_FLAG_NO_SEQ_CHECK 0x1
12 /* Indicates that we should not check sequence numbers */
13
14/*
15 * IPv4 connection creation structure.
16 */
17struct sfe_ipv4_create {
18 int protocol;
19 struct net_device *src_dev;
20 struct net_device *dest_dev;
21 uint32_t flags;
22 uint32_t src_mtu;
23 uint32_t dest_mtu;
24 __be32 src_ip;
25 __be32 src_ip_xlate;
26 __be32 dest_ip;
27 __be32 dest_ip_xlate;
28 __be16 src_port;
29 __be16 src_port_xlate;
30 __be16 dest_port;
31 __be16 dest_port_xlate;
32 uint8_t src_mac[ETH_ALEN];
33 uint8_t src_mac_xlate[ETH_ALEN];
34 uint8_t dest_mac[ETH_ALEN];
35 uint8_t dest_mac_xlate[ETH_ALEN];
36 uint8_t src_td_window_scale;
37 uint32_t src_td_max_window;
38 uint32_t src_td_end;
39 uint32_t src_td_max_end;
40 uint8_t dest_td_window_scale;
41 uint32_t dest_td_max_window;
42 uint32_t dest_td_end;
43 uint32_t dest_td_max_end;
Matthew McClintockbe7b47d2013-11-27 13:26:23 -060044 uint32_t mark;
Dave Hudsondcd08fb2013-11-22 09:25:16 -060045};
46
47/*
48 * IPv4 connection destruction structure.
49 */
50struct sfe_ipv4_destroy {
51 int protocol;
52 __be32 src_ip;
53 __be32 dest_ip;
54 __be16 src_port;
55 __be16 dest_port;
56};
57
58/*
59 * Structure used to sync IPv4 connection stats/state back within the system.
60 *
61 * NOTE: The addresses here are NON-NAT addresses, i.e. the true endpoint addressing.
62 * 'src' is the creator of the connection.
63 */
64struct sfe_ipv4_sync {
65 int protocol; /* IP protocol number (IPPROTO_...) */
66 __be32 src_ip; /* Non-NAT source address, i.e. the creator of the connection */
67 __be16 src_port; /* Non-NAT source port */
68 __be32 dest_ip; /* Non-NAT destination address, i.e. to whom the connection was created */
69 __be16 dest_port; /* Non-NAT destination port */
70 uint32_t src_td_max_window;
71 uint32_t src_td_end;
72 uint32_t src_td_max_end;
73 uint64_t src_packet_count;
74 uint64_t src_byte_count;
75 uint32_t dest_td_max_window;
76 uint32_t dest_td_end;
77 uint32_t dest_td_max_end;
78 uint64_t dest_packet_count;
79 uint64_t dest_byte_count;
80 uint64_t delta_jiffies; /* Time to be added to the current timeout to keep the connection alive */
81};
82
83/*
84 * Type used for a sync rule callback.
85 */
86typedef void (*sfe_ipv4_sync_rule_callback_t)(struct sfe_ipv4_sync *);
87
88extern int sfe_ipv4_recv(struct net_device *dev, struct sk_buff *skb);
89extern void sfe_ipv4_create_rule(struct sfe_ipv4_create *sic);
90extern void sfe_ipv4_destroy_rule(struct sfe_ipv4_destroy *sid);
91extern void sfe_ipv4_destroy_all_rules_for_dev(struct net_device *dev);
92extern void sfe_ipv4_register_sync_rule_callback(sfe_ipv4_sync_rule_callback_t callback);
93
Matthew McClintockbe7b47d2013-11-27 13:26:23 -060094/*
95 * IPv4 connection mark structure
96 */
97struct sfe_ipv4_mark {
98 int protocol;
99 __be32 src_ip;
100 __be32 dest_ip;
101 __be16 src_port;
102 __be16 dest_port;
103 uint32_t mark;
104};
105static void sfe_ipv4_mark_rule(struct sfe_ipv4_mark *mark);