ia64/linux-2.6.18-xen.hg

view drivers/net/sfc/sfc_resource/ci/driver/efab/hardware.h @ 847:ad4d307bf9ce

net sfc: Update sfc and sfc_resource driver to latest release

...and update sfc_netfront, sfc_netback, sfc_netutil for any API changes

sfc_netback: Fix asymmetric use of SFC buffer table alloc and free
sfc_netback: Clean up if no SFC accel device found
sfc_netback: Gracefully handle case where page grant fails
sfc_netback: Disable net acceleration if the physical link goes down
sfc_netfront: Less verbose error messages, more verbose counters for
rx discard errors
sfc_netfront: Gracefully handle case where SFC netfront fails during
initialisation

Signed-off-by: Kieran Mansley <kmansley@solarflare.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 11:59:10 2009 +0100 (2009-03-31)
parents e4dd072db259
children
line source
1 /****************************************************************************
2 * Driver for Solarflare network controllers -
3 * resource management for Xen backend, OpenOnload, etc
4 * (including support for SFE4001 10GBT NIC)
5 *
6 * This file provides EtherFabric NIC hardware interface.
7 *
8 * Copyright 2005-2007: Solarflare Communications Inc,
9 * 9501 Jeronimo Road, Suite 250,
10 * Irvine, CA 92618, USA
11 *
12 * Developed and maintained by Solarflare Communications:
13 * <linux-xen-drivers@solarflare.com>
14 * <onload-dev@solarflare.com>
15 *
16 * Certain parts of the driver were implemented by
17 * Alexandra Kossovsky <Alexandra.Kossovsky@oktetlabs.ru>
18 * OKTET Labs Ltd, Russia,
19 * http://oktetlabs.ru, <info@oktetlabs.ru>
20 * by request of Solarflare Communications
21 *
22 *
23 * This program is free software; you can redistribute it and/or modify it
24 * under the terms of the GNU General Public License version 2 as published
25 * by the Free Software Foundation, incorporated herein by reference.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU General Public License for more details.
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35 ****************************************************************************
36 */
38 #ifndef __CI_DRIVER_EFAB_HARDWARE_H__
39 #define __CI_DRIVER_EFAB_HARDWARE_H__
41 #include "ci/driver/efab/hardware/workarounds.h"
42 #include <ci/efhw/hardware_sysdep.h>
45 /*----------------------------------------------------------------------------
46 *
47 * Common EtherFabric definitions
48 *
49 *---------------------------------------------------------------------------*/
51 #include <ci/efhw/debug.h>
52 #include <ci/efhw/common.h>
53 #include <ci/driver/efab/hardware/common.h>
55 /*----------------------------------------------------------------------------
56 *
57 * EtherFabric varients
58 *
59 *---------------------------------------------------------------------------*/
61 #include <ci/driver/efab/hardware/falcon.h>
63 /*----------------------------------------------------------------------------
64 *
65 * EtherFabric Portable Hardware Layer defines
66 *
67 *---------------------------------------------------------------------------*/
69 /*-------------- Initialisation ------------ */
70 #define efhw_nic_close_hardware(nic) \
71 ((nic)->efhw_func->close_hardware(nic))
73 #define efhw_nic_init_hardware(nic, ev_handlers, mac_addr, non_irq_evq) \
74 ((nic)->efhw_func->init_hardware((nic), (ev_handlers), (mac_addr), \
75 (non_irq_evq)))
77 /*-------------- Interrupt support ------------ */
78 /** Handle interrupt. Return 0 if not handled, 1 if handled. */
79 #define efhw_nic_interrupt(nic) \
80 ((nic)->efhw_func->interrupt(nic))
82 #define efhw_nic_interrupt_enable(nic) \
83 ((nic)->efhw_func->interrupt_enable(nic))
85 #define efhw_nic_interrupt_disable(nic) \
86 ((nic)->efhw_func->interrupt_disable(nic))
88 #define efhw_nic_set_interrupt_moderation(nic, val) \
89 ((nic)->efhw_func->set_interrupt_moderation(nic, val))
91 /*-------------- Event support ------------ */
93 #define efhw_nic_event_queue_enable(nic, evq, size, q_base, buf_base) \
94 ((nic)->efhw_func->event_queue_enable(nic, evq, size, q_base, \
95 buf_base))
97 #define efhw_nic_event_queue_disable(nic, evq, timer_only) \
98 ((nic)->efhw_func->event_queue_disable(nic, evq, timer_only))
100 #define efhw_nic_wakeup_request(nic, q_base, index, evq) \
101 ((nic)->efhw_func->wakeup_request(nic, q_base, index, evq))
103 #define efhw_nic_sw_event(nic, data, ev) \
104 ((nic)->efhw_func->sw_event(nic, data, ev))
106 /*-------------- Filter support ------------ */
107 #define efhw_nic_ipfilter_set(nic, type, index, dmaq, \
108 saddr, sport, daddr, dport) \
109 ((nic)->efhw_func->ipfilter_set(nic, type, index, dmaq, \
110 saddr, sport, daddr, dport))
112 #define efhw_nic_ipfilter_attach(nic, index, dmaq) \
113 ((nic)->efhw_func->ipfilter_attach(nic, index, dmaq))
115 #define efhw_nic_ipfilter_detach(nic, index) \
116 ((nic)->efhw_func->ipfilter_detach(nic, index))
118 #define efhw_nic_ipfilter_clear(nic, index) \
119 ((nic)->efhw_func->ipfilter_clear(nic, index))
121 /*-------------- DMA support ------------ */
122 #define efhw_nic_dmaq_tx_q_init(nic, dmaq, evq, owner, tag, \
123 dmaq_size, index, flags) \
124 ((nic)->efhw_func->dmaq_tx_q_init(nic, dmaq, evq, owner, tag, \
125 dmaq_size, index, flags))
127 #define efhw_nic_dmaq_rx_q_init(nic, dmaq, evq, owner, tag, \
128 dmaq_size, index, flags) \
129 ((nic)->efhw_func->dmaq_rx_q_init(nic, dmaq, evq, owner, tag, \
130 dmaq_size, index, flags))
132 #define efhw_nic_dmaq_tx_q_disable(nic, dmaq) \
133 ((nic)->efhw_func->dmaq_tx_q_disable(nic, dmaq))
135 #define efhw_nic_dmaq_rx_q_disable(nic, dmaq) \
136 ((nic)->efhw_func->dmaq_rx_q_disable(nic, dmaq))
138 #define efhw_nic_flush_tx_dma_channel(nic, dmaq) \
139 ((nic)->efhw_func->flush_tx_dma_channel(nic, dmaq))
141 #define efhw_nic_flush_rx_dma_channel(nic, dmaq) \
142 ((nic)->efhw_func->flush_rx_dma_channel(nic, dmaq))
144 /*-------------- MAC Low level interface ---- */
145 #define efhw_gmac_get_mac_addr(nic) \
146 ((nic)->gmac->get_mac_addr((nic)->gmac))
148 /*-------------- Buffer table -------------- */
149 #define efhw_nic_buffer_table_set(nic, addr, bufsz, region, \
150 own_id, buf_id) \
151 ((nic)->efhw_func->buffer_table_set(nic, addr, bufsz, region, \
152 own_id, buf_id))
154 #define efhw_nic_buffer_table_set_n(nic, buf_id, addr, bufsz, \
155 region, n_pages, own_id) \
156 ((nic)->efhw_func->buffer_table_set_n(nic, buf_id, addr, bufsz, \
157 region, n_pages, own_id))
159 #define efhw_nic_buffer_table_clear(nic, id, num) \
160 ((nic)->efhw_func->buffer_table_clear(nic, id, num))
162 #define efhw_nic_buffer_table_commit(nic) \
163 ((nic)->efhw_func->buffer_table_commit(nic))
165 /*----------------------------------------------------------------------------
166 * Hardware specific portability macros for performance critical code.
167 *
168 * Warning: and driver code which is using these defines is not
169 * capable of supporting multiple NIC varients and should be built and
170 * marked appropriately
171 *
172 *---------------------------------------------------------------------------*/
174 #if defined(__CI_HARDWARE_CONFIG_FALCON__)
176 /* --- DMA --- */
177 #define EFHW_DMA_ADDRMASK (0xffffffffffffffffULL)
179 /* --- Buffers --- */
180 #define EFHW_BUFFER_ADDR FALCON_BUFFER_4K_ADDR
181 #define EFHW_BUFFER_PAGE FALCON_BUFFER_4K_PAGE
182 #define EFHW_BUFFER_OFF FALCON_BUFFER_4K_OFF
184 /* --- Filters --- */
185 #define EFHW_IP_FILTER_NUM FALCON_FILTER_TBL_NUM
187 #define EFHW_MAX_PAGE_SIZE FALCON_MAX_PAGE_SIZE
189 #else
190 # error no hardware definition found
191 #endif
193 #if PAGE_SIZE <= EFHW_MAX_PAGE_SIZE
194 #define EFHW_NIC_PAGE_SIZE PAGE_SIZE
195 #else
196 #define EFHW_NIC_PAGE_SIZE EFHW_MAX_PAGE_SIZE
197 #endif
198 #define EFHW_NIC_PAGE_MASK (~(EFHW_NIC_PAGE_SIZE-1))
200 #endif /* __CI_DRIVER_EFAB_HARDWARE_H__ */