i40e_osdep.c (6d011ad5f677a2d2c99eb1d848089000ea3f463c) | i40e_osdep.c (4294f337b02257f24cc0177c5031abea7fdc3d75) |
---|---|
1/****************************************************************************** 2 3 Copyright (c) 2013-2015, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 18 unchanged lines hidden (view full) --- 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32******************************************************************************/ 33/*$FreeBSD$*/ 34 | 1/****************************************************************************** 2 3 Copyright (c) 2013-2015, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 18 unchanged lines hidden (view full) --- 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32******************************************************************************/ 33/*$FreeBSD$*/ 34 |
35#include <machine/stdarg.h> | 35#include <sys/limits.h> |
36 37#include "ixl.h" 38 39/******************************************************************** 40 * Manage DMA'able memory. 41 *******************************************************************/ 42static void 43i40e_dmamap_cb(void *arg, bus_dma_segment_t * segs, int nseg, int error) --- 88 unchanged lines hidden (view full) --- 132 bus_dma_tag_destroy(mem->tag); 133 return (0); 134} 135 136void 137i40e_init_spinlock(struct i40e_spinlock *lock) 138{ 139 mtx_init(&lock->mutex, "mutex", | 36 37#include "ixl.h" 38 39/******************************************************************** 40 * Manage DMA'able memory. 41 *******************************************************************/ 42static void 43i40e_dmamap_cb(void *arg, bus_dma_segment_t * segs, int nseg, int error) --- 88 unchanged lines hidden (view full) --- 132 bus_dma_tag_destroy(mem->tag); 133 return (0); 134} 135 136void 137i40e_init_spinlock(struct i40e_spinlock *lock) 138{ 139 mtx_init(&lock->mutex, "mutex", |
140 MTX_NETWORK_LOCK, MTX_DEF | MTX_DUPOK); | 140 "ixl spinlock", MTX_DEF | MTX_DUPOK); |
141} 142 143void 144i40e_acquire_spinlock(struct i40e_spinlock *lock) 145{ 146 mtx_lock(&lock->mutex); 147} 148 --- 5 unchanged lines hidden (view full) --- 154 155void 156i40e_destroy_spinlock(struct i40e_spinlock *lock) 157{ 158 if (mtx_initialized(&lock->mutex)) 159 mtx_destroy(&lock->mutex); 160} 161 | 141} 142 143void 144i40e_acquire_spinlock(struct i40e_spinlock *lock) 145{ 146 mtx_lock(&lock->mutex); 147} 148 --- 5 unchanged lines hidden (view full) --- 154 155void 156i40e_destroy_spinlock(struct i40e_spinlock *lock) 157{ 158 if (mtx_initialized(&lock->mutex)) 159 mtx_destroy(&lock->mutex); 160} 161 |
162void 163i40e_msec_pause(int msecs) 164{ 165 int ticks_to_pause = (msecs * hz) / 1000; 166 int start_ticks = ticks; 167 168 if (cold || SCHEDULER_STOPPED()) { 169 i40e_msec_delay(msecs); 170 return; 171 } 172 173 while (1) { 174 kern_yield(PRI_USER); 175 int yielded_ticks = ticks - start_ticks; 176 if (yielded_ticks > ticks_to_pause) 177 break; 178 else if (yielded_ticks < 0 179 && (yielded_ticks + INT_MAX + 1 > ticks_to_pause)) { 180 break; 181 } 182 } 183} 184 |
|
162/* 163 * Helper function for debug statement printing 164 */ 165void | 185/* 186 * Helper function for debug statement printing 187 */ 188void |
166i40e_debug_d(struct i40e_hw *hw, enum i40e_debug_mask mask, char *fmt, ...) | 189i40e_debug_shared(struct i40e_hw *hw, enum i40e_debug_mask mask, char *fmt, ...) |
167{ 168 va_list args; 169 170 if (!(mask & ((struct i40e_hw *)hw)->debug_mask)) 171 return; 172 173 va_start(args, fmt); 174 device_printf(((struct i40e_osdep *)hw->back)->dev, fmt, args); --- 23 unchanged lines hidden --- | 190{ 191 va_list args; 192 193 if (!(mask & ((struct i40e_hw *)hw)->debug_mask)) 194 return; 195 196 va_start(args, fmt); 197 device_printf(((struct i40e_osdep *)hw->back)->dev, fmt, args); --- 23 unchanged lines hidden --- |