Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/i40e_osdep.c
/****************************************************************************** | /****************************************************************************** | ||||
Copyright (c) 2013-2015, Intel Corporation | Copyright (c) 2013-2017, Intel Corporation | ||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
1. Redistributions of source code must retain the above copyright notice, | 1. Redistributions of source code must retain the above copyright notice, | ||||
this list of conditions and the following disclaimer. | this list of conditions and the following disclaimer. | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | i40e_allocate_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem, u32 size) | ||||
mem->va = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); | mem->va = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); | ||||
return(mem->va == NULL); | return(mem->va == NULL); | ||||
} | } | ||||
i40e_status | i40e_status | ||||
i40e_free_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem) | i40e_free_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem) | ||||
{ | { | ||||
free(mem->va, M_DEVBUF); | free(mem->va, M_DEVBUF); | ||||
mem->va = NULL; | |||||
return(0); | return(0); | ||||
} | } | ||||
i40e_status | i40e_status | ||||
i40e_allocate_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem, | i40e_allocate_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem, | ||||
enum i40e_memory_type type __unused, u64 size, u32 alignment) | enum i40e_memory_type type __unused, u64 size, u32 alignment) | ||||
{ | { | ||||
device_t dev = ((struct i40e_osdep *)hw->back)->dev; | device_t dev = ((struct i40e_osdep *)hw->back)->dev; | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
i40e_status | i40e_status | ||||
i40e_free_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem) | i40e_free_dma_mem(struct i40e_hw *hw, struct i40e_dma_mem *mem) | ||||
{ | { | ||||
bus_dmamap_sync(mem->tag, mem->map, | bus_dmamap_sync(mem->tag, mem->map, | ||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); | ||||
bus_dmamap_unload(mem->tag, mem->map); | bus_dmamap_unload(mem->tag, mem->map); | ||||
bus_dmamem_free(mem->tag, mem->va, mem->map); | bus_dmamem_free(mem->tag, mem->va, mem->map); | ||||
bus_dma_tag_destroy(mem->tag); | bus_dma_tag_destroy(mem->tag); | ||||
return (0); | return (I40E_SUCCESS); | ||||
} | } | ||||
void | void | ||||
i40e_init_spinlock(struct i40e_spinlock *lock) | i40e_init_spinlock(struct i40e_spinlock *lock) | ||||
{ | { | ||||
mtx_init(&lock->mutex, "mutex", | mtx_init(&lock->mutex, "mutex", | ||||
"ixl spinlock", MTX_DEF | MTX_DUPOK); | "ixl spinlock", MTX_DEF | MTX_DUPOK); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | i40e_debug_shared(struct i40e_hw *hw, enum i40e_debug_mask mask, char *fmt, ...) | ||||
vprintf(fmt, args); | vprintf(fmt, args); | ||||
va_end(args); | va_end(args); | ||||
} | } | ||||
const char * | const char * | ||||
ixl_vc_opcode_str(uint16_t op) | ixl_vc_opcode_str(uint16_t op) | ||||
{ | { | ||||
switch (op) { | switch (op) { | ||||
case I40E_VIRTCHNL_OP_VERSION: | case VIRTCHNL_OP_VERSION: | ||||
return ("VERSION"); | return ("VERSION"); | ||||
case I40E_VIRTCHNL_OP_RESET_VF: | case VIRTCHNL_OP_RESET_VF: | ||||
return ("RESET_VF"); | return ("RESET_VF"); | ||||
case I40E_VIRTCHNL_OP_GET_VF_RESOURCES: | case VIRTCHNL_OP_GET_VF_RESOURCES: | ||||
return ("GET_VF_RESOURCES"); | return ("GET_VF_RESOURCES"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_TX_QUEUE: | case VIRTCHNL_OP_CONFIG_TX_QUEUE: | ||||
return ("CONFIG_TX_QUEUE"); | return ("CONFIG_TX_QUEUE"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_RX_QUEUE: | case VIRTCHNL_OP_CONFIG_RX_QUEUE: | ||||
return ("CONFIG_RX_QUEUE"); | return ("CONFIG_RX_QUEUE"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES: | case VIRTCHNL_OP_CONFIG_VSI_QUEUES: | ||||
return ("CONFIG_VSI_QUEUES"); | return ("CONFIG_VSI_QUEUES"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_IRQ_MAP: | case VIRTCHNL_OP_CONFIG_IRQ_MAP: | ||||
return ("CONFIG_IRQ_MAP"); | return ("CONFIG_IRQ_MAP"); | ||||
case I40E_VIRTCHNL_OP_ENABLE_QUEUES: | case VIRTCHNL_OP_ENABLE_QUEUES: | ||||
return ("ENABLE_QUEUES"); | return ("ENABLE_QUEUES"); | ||||
case I40E_VIRTCHNL_OP_DISABLE_QUEUES: | case VIRTCHNL_OP_DISABLE_QUEUES: | ||||
return ("DISABLE_QUEUES"); | return ("DISABLE_QUEUES"); | ||||
case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS: | case VIRTCHNL_OP_ADD_ETH_ADDR: | ||||
return ("ADD_ETHER_ADDRESS"); | return ("ADD_ETH_ADDR"); | ||||
case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS: | case VIRTCHNL_OP_DEL_ETH_ADDR: | ||||
return ("DEL_ETHER_ADDRESS"); | return ("DEL_ETH_ADDR"); | ||||
case I40E_VIRTCHNL_OP_ADD_VLAN: | case VIRTCHNL_OP_ADD_VLAN: | ||||
return ("ADD_VLAN"); | return ("ADD_VLAN"); | ||||
case I40E_VIRTCHNL_OP_DEL_VLAN: | case VIRTCHNL_OP_DEL_VLAN: | ||||
return ("DEL_VLAN"); | return ("DEL_VLAN"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE: | case VIRTCHNL_OP_CONFIG_PROMISCUOUS_MODE: | ||||
return ("CONFIG_PROMISCUOUS_MODE"); | return ("CONFIG_PROMISCUOUS_MODE"); | ||||
case I40E_VIRTCHNL_OP_GET_STATS: | case VIRTCHNL_OP_GET_STATS: | ||||
return ("GET_STATS"); | return ("GET_STATS"); | ||||
case I40E_VIRTCHNL_OP_FCOE: | case VIRTCHNL_OP_RSVD: | ||||
return ("FCOE"); | return ("RSVD"); | ||||
case I40E_VIRTCHNL_OP_EVENT: | case VIRTCHNL_OP_EVENT: | ||||
return ("EVENT"); | return ("EVENT"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_RSS_KEY: | case VIRTCHNL_OP_CONFIG_RSS_KEY: | ||||
return ("CONFIG_RSS_KEY"); | return ("CONFIG_RSS_KEY"); | ||||
case I40E_VIRTCHNL_OP_CONFIG_RSS_LUT: | case VIRTCHNL_OP_CONFIG_RSS_LUT: | ||||
return ("CONFIG_RSS_LUT"); | return ("CONFIG_RSS_LUT"); | ||||
case I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS: | case VIRTCHNL_OP_GET_RSS_HENA_CAPS: | ||||
return ("GET_RSS_HENA_CAPS"); | return ("GET_RSS_HENA_CAPS"); | ||||
case I40E_VIRTCHNL_OP_SET_RSS_HENA: | case VIRTCHNL_OP_SET_RSS_HENA: | ||||
return ("SET_RSS_HENA"); | return ("SET_RSS_HENA"); | ||||
default: | default: | ||||
return ("UNKNOWN"); | return ("UNKNOWN"); | ||||
} | } | ||||
} | } | ||||
u16 | u16 | ||||
i40e_read_pci_cfg(struct i40e_hw *hw, u32 reg) | i40e_read_pci_cfg(struct i40e_hw *hw, u32 reg) | ||||
Show All 18 Lines |