Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / drivers / xen / sfc_netback / accel_solarflare.h
1 /****************************************************************************
2  * Solarflare driver for Xen network acceleration
3  *
4  * Copyright 2006-2008: Solarflare Communications Inc,
5  *                      9501 Jeronimo Road, Suite 250,
6  *                      Irvine, CA 92618, USA
7  *
8  * Maintained by Solarflare Communications <linux-xen-drivers@solarflare.com>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU General Public License version 2 as published
12  * by the Free Software Foundation, incorporated herein by reference.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  ****************************************************************************
23  */
24
25 #ifndef NETBACK_ACCEL_SOLARFLARE_H
26 #define NETBACK_ACCEL_SOLARFLARE_H
27
28 #include "accel.h"
29 #include "accel_msg_iface.h"
30
31 #include "driverlink_api.h"
32
33 #define MAX_NICS 5
34 #define MAX_PORTS 2
35
36
37 extern int netback_accel_sf_init(void);
38 extern void netback_accel_sf_shutdown(void);
39 extern int netback_accel_sf_hwtype(struct netback_accel *bend);
40
41 extern int netback_accel_sf_char_init(void);
42 extern void netback_accel_sf_char_shutdown(void);
43
44 extern int netback_accel_setup_vnic_hw(struct netback_accel *bend);
45 extern void netback_accel_shutdown_vnic_hw(struct netback_accel *bend);
46
47 extern int netback_accel_add_buffers(struct netback_accel *bend, int pages, 
48                                      int log2_pages, u32 *grants,
49                                      u32 *buf_addr_out);
50 extern int netback_accel_remove_buffers(struct netback_accel *bend);
51
52
53 /* Add a filter for the specified IP/port to the backend */
54 extern int
55 netback_accel_filter_check_add(struct netback_accel *bend, 
56                                struct netback_accel_filter_spec *filt);
57 /* Remove a filter entry for the specific device and IP/port */
58 extern
59 void netback_accel_filter_remove_index(struct netback_accel *bend, 
60                                        int filter_index);
61 extern
62 void netback_accel_filter_remove_spec(struct netback_accel *bend, 
63                                       struct netback_accel_filter_spec *filt);
64
65 /* This is designed to look a bit like a skb */
66 struct netback_pkt_buf {
67         union {
68                 unsigned char *raw;
69         } mac;
70         union {
71                 struct iphdr  *iph;
72                 struct arphdr *arph;
73                 unsigned char *raw;
74         } nh;
75         int protocol;
76 };
77
78 /*! \brief Handle a received packet: insert fast path filters as necessary
79  * \param skb The packet buffer
80  */
81 extern void netback_accel_rx_packet(struct netback_pkt_buf *skb, void *fwd_priv);
82
83 /*! \brief Handle a transmitted packet: update fast path filters as necessary
84  * \param skb The packet buffer
85  */
86 extern void netback_accel_tx_packet(struct sk_buff *skb, void *fwd_priv);
87
88 #endif /* NETBACK_ACCEL_SOLARFLARE_H */