sfxge.h (278221) | sfxge.h (278250) |
---|---|
1/*- 2 * Copyright (c) 2010-2011 Solarflare Communications, Inc. 3 * All rights reserved. 4 * 5 * This software was developed in part by Philip Paeps under contract for 6 * Solarflare Communications, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2010-2011 Solarflare Communications, Inc. 3 * All rights reserved. 4 * 5 * This software was developed in part by Philip Paeps under contract for 6 * Solarflare Communications, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/dev/sfxge/sfxge.h 278221 2015-02-04 20:03:57Z arybchik $ | 29 * $FreeBSD: head/sys/dev/sfxge/sfxge.h 278250 2015-02-05 11:39:15Z arybchik $ |
30 */ 31 32#ifndef _SFXGE_H 33#define _SFXGE_H 34 35#include <sys/param.h> 36#include <sys/kernel.h> 37#include <sys/condvar.h> --- 79 unchanged lines hidden (view full) --- 117 118 /* Linked list of TX queues with completions to process */ 119 struct sfxge_txq *txq; 120 struct sfxge_txq **txqs; 121 122 /* Structure members not used on event processing path */ 123 unsigned int buf_base_id; 124 unsigned int entries; | 30 */ 31 32#ifndef _SFXGE_H 33#define _SFXGE_H 34 35#include <sys/param.h> 36#include <sys/kernel.h> 37#include <sys/condvar.h> --- 79 unchanged lines hidden (view full) --- 117 118 /* Linked list of TX queues with completions to process */ 119 struct sfxge_txq *txq; 120 struct sfxge_txq **txqs; 121 122 /* Structure members not used on event processing path */ 123 unsigned int buf_base_id; 124 unsigned int entries; |
125 char lock_name[SFXGE_LOCK_NAME_MAX]; |
|
125} __aligned(CACHE_LINE_SIZE); 126 127#define SFXGE_NDESCS 1024 128#define SFXGE_MODERATION 30 129 130enum sfxge_intr_state { 131 SFXGE_INTR_UNINITIALIZED = 0, 132 SFXGE_INTR_INITIALIZED, --- 24 unchanged lines hidden (view full) --- 157 SFXGE_MCDI_COMPLETED 158}; 159 160struct sfxge_mcdi { 161 struct mtx lock; 162 struct cv cv; 163 enum sfxge_mcdi_state state; 164 efx_mcdi_transport_t transport; | 126} __aligned(CACHE_LINE_SIZE); 127 128#define SFXGE_NDESCS 1024 129#define SFXGE_MODERATION 30 130 131enum sfxge_intr_state { 132 SFXGE_INTR_UNINITIALIZED = 0, 133 SFXGE_INTR_INITIALIZED, --- 24 unchanged lines hidden (view full) --- 158 SFXGE_MCDI_COMPLETED 159}; 160 161struct sfxge_mcdi { 162 struct mtx lock; 163 struct cv cv; 164 enum sfxge_mcdi_state state; 165 efx_mcdi_transport_t transport; |
166 167 /* Only used in debugging output */ 168 char lock_name[SFXGE_LOCK_NAME_MAX]; |
|
165}; 166 167struct sfxge_hw_stats { 168 clock_t update_time; 169 efsys_mem_t dma_buf; 170 void *decode_buf; 171}; 172 --- 8 unchanged lines hidden (view full) --- 181 struct mtx lock; 182 enum sfxge_port_state init_state; 183#ifndef SFXGE_HAVE_PAUSE_MEDIAOPTS 184 unsigned int wanted_fc; 185#endif 186 struct sfxge_hw_stats phy_stats; 187 struct sfxge_hw_stats mac_stats; 188 efx_link_mode_t link_mode; | 169}; 170 171struct sfxge_hw_stats { 172 clock_t update_time; 173 efsys_mem_t dma_buf; 174 void *decode_buf; 175}; 176 --- 8 unchanged lines hidden (view full) --- 185 struct mtx lock; 186 enum sfxge_port_state init_state; 187#ifndef SFXGE_HAVE_PAUSE_MEDIAOPTS 188 unsigned int wanted_fc; 189#endif 190 struct sfxge_hw_stats phy_stats; 191 struct sfxge_hw_stats mac_stats; 192 efx_link_mode_t link_mode; |
193 194 /* Only used in debugging output */ 195 char lock_name[SFXGE_LOCK_NAME_MAX]; |
|
189}; 190 191enum sfxge_softc_state { 192 SFXGE_UNINITIALIZED = 0, 193 SFXGE_INITIALIZED, 194 SFXGE_REGISTERED, 195 SFXGE_STARTED 196}; 197 198struct sfxge_softc { 199 device_t dev; 200 struct sx softc_lock; | 196}; 197 198enum sfxge_softc_state { 199 SFXGE_UNINITIALIZED = 0, 200 SFXGE_INITIALIZED, 201 SFXGE_REGISTERED, 202 SFXGE_STARTED 203}; 204 205struct sfxge_softc { 206 device_t dev; 207 struct sx softc_lock; |
208 char softc_lock_name[SFXGE_LOCK_NAME_MAX]; |
|
201 enum sfxge_softc_state init_state; 202 struct ifnet *ifnet; 203 unsigned int if_flags; 204 struct sysctl_oid *stats_node; 205 struct sysctl_oid *txqs_node; 206 207 struct task task_reset; 208 209 efx_family_t family; 210 caddr_t vpd_data; 211 size_t vpd_size; 212 efx_nic_t *enp; | 209 enum sfxge_softc_state init_state; 210 struct ifnet *ifnet; 211 unsigned int if_flags; 212 struct sysctl_oid *stats_node; 213 struct sysctl_oid *txqs_node; 214 215 struct task task_reset; 216 217 efx_family_t family; 218 caddr_t vpd_data; 219 size_t vpd_size; 220 efx_nic_t *enp; |
213 struct mtx enp_lock; | 221 efsys_lock_t enp_lock; |
214 215 unsigned int rxq_entries; 216 unsigned int txq_entries; 217 218 bus_dma_tag_t parent_dma_tag; 219 efsys_bar_t bar; 220 221 struct sfxge_intr intr; --- 22 unchanged lines hidden (view full) --- 244 struct ifmedia media; 245 246 size_t rx_prefix_size; 247 size_t rx_buffer_size; 248 uma_zone_t rx_buffer_zone; 249 250#ifndef SFXGE_HAVE_MQ 251 struct mtx tx_lock __aligned(CACHE_LINE_SIZE); | 222 223 unsigned int rxq_entries; 224 unsigned int txq_entries; 225 226 bus_dma_tag_t parent_dma_tag; 227 efsys_bar_t bar; 228 229 struct sfxge_intr intr; --- 22 unchanged lines hidden (view full) --- 252 struct ifmedia media; 253 254 size_t rx_prefix_size; 255 size_t rx_buffer_size; 256 uma_zone_t rx_buffer_zone; 257 258#ifndef SFXGE_HAVE_MQ 259 struct mtx tx_lock __aligned(CACHE_LINE_SIZE); |
260 char tx_lock_name[SFXGE_LOCK_NAME_MAX]; |
|
252#endif 253}; 254 255#define SFXGE_LINK_UP(sc) ((sc)->port.link_mode != EFX_LINK_DOWN) 256#define SFXGE_RUNNING(sc) ((sc)->ifnet->if_drv_flags & IFF_DRV_RUNNING) 257 258#define SFXGE_PARAM(_name) "hw.sfxge." #_name 259 --- 49 unchanged lines hidden (view full) --- 309extern void sfxge_port_stop(struct sfxge_softc *sc); 310extern void sfxge_mac_link_update(struct sfxge_softc *sc, 311 efx_link_mode_t mode); 312extern int sfxge_mac_filter_set(struct sfxge_softc *sc); 313extern int sfxge_port_ifmedia_init(struct sfxge_softc *sc); 314 315#define SFXGE_MAX_MTU (9 * 1024) 316 | 261#endif 262}; 263 264#define SFXGE_LINK_UP(sc) ((sc)->port.link_mode != EFX_LINK_DOWN) 265#define SFXGE_RUNNING(sc) ((sc)->ifnet->if_drv_flags & IFF_DRV_RUNNING) 266 267#define SFXGE_PARAM(_name) "hw.sfxge." #_name 268 --- 49 unchanged lines hidden (view full) --- 318extern void sfxge_port_stop(struct sfxge_softc *sc); 319extern void sfxge_mac_link_update(struct sfxge_softc *sc, 320 efx_link_mode_t mode); 321extern int sfxge_mac_filter_set(struct sfxge_softc *sc); 322extern int sfxge_port_ifmedia_init(struct sfxge_softc *sc); 323 324#define SFXGE_MAX_MTU (9 * 1024) 325 |
317#define SFXGE_ADAPTER_LOCK_INIT(_sc, _name) \ 318 sx_init(&(_sc)->softc_lock, (_name)) | 326#define SFXGE_ADAPTER_LOCK_INIT(_sc, _ifname) \ 327 do { \ 328 struct sfxge_softc *__sc = (_sc); \ 329 \ 330 snprintf((__sc)->softc_lock_name, \ 331 sizeof((__sc)->softc_lock_name), \ 332 "%s:softc", (_ifname)); \ 333 sx_init(&(__sc)->softc_lock, (__sc)->softc_lock_name); \ 334 } while (B_FALSE) |
319#define SFXGE_ADAPTER_LOCK_DESTROY(_sc) \ 320 sx_destroy(&(_sc)->softc_lock) 321#define SFXGE_ADAPTER_LOCK(_sc) \ 322 sx_xlock(&(_sc)->softc_lock) 323#define SFXGE_ADAPTER_UNLOCK(_sc) \ 324 sx_xunlock(&(_sc)->softc_lock) 325#define SFXGE_ADAPTER_LOCK_ASSERT_OWNED(_sc) \ 326 sx_assert(&(_sc)->softc_lock, LA_XLOCKED) 327 | 335#define SFXGE_ADAPTER_LOCK_DESTROY(_sc) \ 336 sx_destroy(&(_sc)->softc_lock) 337#define SFXGE_ADAPTER_LOCK(_sc) \ 338 sx_xlock(&(_sc)->softc_lock) 339#define SFXGE_ADAPTER_UNLOCK(_sc) \ 340 sx_xunlock(&(_sc)->softc_lock) 341#define SFXGE_ADAPTER_LOCK_ASSERT_OWNED(_sc) \ 342 sx_assert(&(_sc)->softc_lock, LA_XLOCKED) 343 |
328#define SFXGE_PORT_LOCK_INIT(_port, _name) \ 329 mtx_init(&(_port)->lock, (_name), NULL, MTX_DEF) | 344#define SFXGE_PORT_LOCK_INIT(_port, _ifname) \ 345 do { \ 346 struct sfxge_port *__port = (_port); \ 347 \ 348 snprintf((__port)->lock_name, \ 349 sizeof((__port)->lock_name), \ 350 "%s:port", (_ifname)); \ 351 mtx_init(&(__port)->lock, (__port)->lock_name, \ 352 NULL, MTX_DEF); \ 353 } while (B_FALSE) |
330#define SFXGE_PORT_LOCK_DESTROY(_port) \ 331 mtx_destroy(&(_port)->lock) 332#define SFXGE_PORT_LOCK(_port) \ 333 mtx_lock(&(_port)->lock) 334#define SFXGE_PORT_UNLOCK(_port) \ 335 mtx_unlock(&(_port)->lock) 336#define SFXGE_PORT_LOCK_ASSERT_OWNED(_port) \ 337 mtx_assert(&(_port)->lock, MA_OWNED) 338 | 354#define SFXGE_PORT_LOCK_DESTROY(_port) \ 355 mtx_destroy(&(_port)->lock) 356#define SFXGE_PORT_LOCK(_port) \ 357 mtx_lock(&(_port)->lock) 358#define SFXGE_PORT_UNLOCK(_port) \ 359 mtx_unlock(&(_port)->lock) 360#define SFXGE_PORT_LOCK_ASSERT_OWNED(_port) \ 361 mtx_assert(&(_port)->lock, MA_OWNED) 362 |
339#define SFXGE_MCDI_LOCK_INIT(_mcdi, _name) \ 340 mtx_init(&(_mcdi)->lock, (_name), NULL, MTX_DEF) | 363#define SFXGE_MCDI_LOCK_INIT(_mcdi, _ifname) \ 364 do { \ 365 struct sfxge_mcdi *__mcdi = (_mcdi); \ 366 \ 367 snprintf((__mcdi)->lock_name, \ 368 sizeof((__mcdi)->lock_name), \ 369 "%s:mcdi", (_ifname)); \ 370 mtx_init(&(__mcdi)->lock, (__mcdi)->lock_name, \ 371 NULL, MTX_DEF); \ 372 } while (B_FALSE) |
341#define SFXGE_MCDI_LOCK_DESTROY(_mcdi) \ 342 mtx_destroy(&(_mcdi)->lock) 343#define SFXGE_MCDI_LOCK(_mcdi) \ 344 mtx_lock(&(_mcdi)->lock) 345#define SFXGE_MCDI_UNLOCK(_mcdi) \ 346 mtx_unlock(&(_mcdi)->lock) 347#define SFXGE_MCDI_LOCK_ASSERT_OWNED(_mcdi) \ 348 mtx_assert(&(_mcdi)->lock, MA_OWNED) 349 | 373#define SFXGE_MCDI_LOCK_DESTROY(_mcdi) \ 374 mtx_destroy(&(_mcdi)->lock) 375#define SFXGE_MCDI_LOCK(_mcdi) \ 376 mtx_lock(&(_mcdi)->lock) 377#define SFXGE_MCDI_UNLOCK(_mcdi) \ 378 mtx_unlock(&(_mcdi)->lock) 379#define SFXGE_MCDI_LOCK_ASSERT_OWNED(_mcdi) \ 380 mtx_assert(&(_mcdi)->lock, MA_OWNED) 381 |
350#define SFXGE_EVQ_LOCK_INIT(_evq, _name) \ 351 mtx_init(&(_evq)->lock, (_name), NULL, MTX_DEF) | 382#define SFXGE_EVQ_LOCK_INIT(_evq, _ifname, _evq_index) \ 383 do { \ 384 struct sfxge_evq *__evq = (_evq); \ 385 \ 386 snprintf((__evq)->lock_name, \ 387 sizeof((__evq)->lock_name), \ 388 "%s:evq%u", (_ifname), (_evq_index)); \ 389 mtx_init(&(__evq)->lock, (__evq)->lock_name, \ 390 NULL, MTX_DEF); \ 391 } while (B_FALSE) |
352#define SFXGE_EVQ_LOCK_DESTROY(_evq) \ 353 mtx_destroy(&(_evq)->lock) 354#define SFXGE_EVQ_LOCK(_evq) \ 355 mtx_lock(&(_evq)->lock) 356#define SFXGE_EVQ_UNLOCK(_evq) \ 357 mtx_unlock(&(_evq)->lock) 358#define SFXGE_EVQ_LOCK_ASSERT_OWNED(_evq) \ 359 mtx_assert(&(_evq)->lock, MA_OWNED) 360 361#endif /* _SFXGE_H */ | 392#define SFXGE_EVQ_LOCK_DESTROY(_evq) \ 393 mtx_destroy(&(_evq)->lock) 394#define SFXGE_EVQ_LOCK(_evq) \ 395 mtx_lock(&(_evq)->lock) 396#define SFXGE_EVQ_UNLOCK(_evq) \ 397 mtx_unlock(&(_evq)->lock) 398#define SFXGE_EVQ_LOCK_ASSERT_OWNED(_evq) \ 399 mtx_assert(&(_evq)->lock, MA_OWNED) 400 401#endif /* _SFXGE_H */ |