22 #include "../include/mlx_device.h" 23 #include "../include/mlx_cmd.h" 24 #include "../../mlx_utils/include/public/mlx_bail.h" 25 #include "../../mlx_utils/include/public/mlx_pci.h" 26 #include "../../mlx_utils/include/public/mlx_memory.h" 27 #include "../../mlx_utils/include/public/mlx_logging.h" 29 #define CHECK_BIT(field, offset) (((field) & ((mlx_uint32)1 << (offset))) != 0) 58 #define CHECK_DEVICE_INIT_TRIES 10 108 if( nodnic_supported == 0 ){
110 goto nodnic_unsupported;
142 device_priv->nodnic_revision = (
buffer >> 24) & 0xFF;
146 goto unsupported_revision;
152 device_priv->hardware_format = (
buffer >> 16) & 0xFF;
156 unsupported_revision:
157 nodnic_hardware_format_read_err:
158 nodnic_offset_read_err:
159 nodnic_revision_read_err:
179 if (device_priv->device_cap.crspace_doorbells == 0) {
184 disable = 0x80000000;
201 if( device_priv ==
NULL ){
239 if( device_priv ==
NULL ){
244 device_cap = &device_priv->device_cap;
250 #define NODNIC_DEVICE_SUPPORT_MAC_FILTERS_OFFSET 15 251 #define NODNIC_DEVICE_SUPPORT_PROMISC_FILTER_OFFSET 14 252 #define NODNIC_DEVICE_SUPPORT_PROMISC_MULT_FILTER_OFFSET 13 253 #define NODNIC_DEVICE_LOG_WORKING_BUFFER_SIZE_OFFSET 8 254 #define NODNIC_DEVICE_LOG_WORKING_BUFFER_SIZE_MASK 0x7 255 #define NODNIC_DEVICE_LOG_PKEY_TABLE_SIZE_OFFSET 4 256 #define NODNIC_DEVICE_LOG_PKEY_TABLE_SIZE_MASK 0xF 257 #define NODNIC_DEVICE_NUM_PORTS_OFFSET 0 273 #define NODNIC_DEVICE_CRSPACE_DB_OFFSET 12 274 device_cap->crspace_doorbells =
CHECK_BIT(
buffer, NODNIC_DEVICE_CRSPACE_DB_OFFSET);
280 #define NODNIC_DEVICE_LOG_MAX_RING_SIZE_OFFSET 24 281 #define NODNIC_DEVICE_LOG_MAX_RING_SIZE_MASK 0x3F 282 #define NODNIC_DEVICE_PD_MASK 0xFFFFFF 291 device_priv->lkey =
buffer;
294 if ( device_cap->crspace_doorbells ) {
297 device_priv->crspace_clear_int = device_priv->utils->config +
buffer;
305 device_priv->device_guid = guid_l | (guid_h << 32);
307 #define NODNIC_DEVICE_SUPPORT_RX_PI_DMA_OFFSET 31 308 #define NODNIC_DEVICE_SUPPORT_RX_PI_DMA_MASK 0x1 309 #define NODNIC_DEVICE_SUPPORT_UAR_TRX_DB_OFFSET 29 310 #define NODNIC_DEVICE_SUPPORT_UAR_TRX_DB_MASK 0x1 311 #define NODNIC_DEVICE_SUPPORT_BAR_CQ_CONTROL_OFFSET 27 312 #define NODNIC_DEVICE_SUPPORT_BAR_CQ_CONTROL_MASK 0x1 325 #define NODNIC_DEVICE_LOG_UAR_PAGE_SIZE_OFFSET 0 326 #define NODNIC_DEVICE_LOG_UAR_PAGE_SIZE_MASK 0xFF 345 if( device_priv ==
NULL ){
#define NODNIC_CMDQ_PHY_ADDR_LOW_OFFSET
#define NODNIC_DEVICE_LOG_MAX_RING_SIZE_MASK
mlx_status nodnic_device_teardown(IN nodnic_device_priv *device_priv)
mlx_uint8 log_pkey_table_size
mlx_status mlx_memory_cpu_to_be32(IN mlx_utils *utils, IN mlx_uint32 source, IN mlx_uint32 *destination)
#define NODNIC_NIC_INTERFACE_SUPPORTED_BIT
#define NODNIC_NIC_INTERFACE_OFFSET
#define MLX_INVALID_PARAMETER
mlx_status mlx_pci_mem_write(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint8 bar_index, IN mlx_uint64 offset, IN mlx_uintn count, IN mlx_void *buffer)
#define NODNIC_INITIALIZING_BIT
mlx_status mlx_pci_mem_read(IN mlx_utils *utils, IN mlx_pci_width width, IN mlx_uint8 bar_index, IN mlx_uint64 offset, IN mlx_uintn count, OUT mlx_void *buffer)
#define NODNIC_DEVICE_LOG_UAR_PAGE_SIZE_OFFSET
FILE_LICENCE(GPL2_OR_LATER)
mlx_status nodnic_device_clear_int(IN nodnic_device_priv *device_priv)
#define NODNIC_NIC_INTERFACE_SUPPORTED_OFFSET
#define NODNIC_DEVICE_LOG_MAX_RING_SIZE_OFFSET
mlx_status nodnic_device_get_fw_version(IN nodnic_device_priv *device_priv, OUT mlx_uint16 *fw_ver_minor, OUT mlx_uint16 *fw_ver_sub_minor, OUT mlx_uint16 *fw_ver_major)
mlx_status mlx_utils_delay_in_ms(IN mlx_uint32 msecs)
#define NODNIC_NIC_DISABLE_INT_OFFSET
#define NODNIC_DEVICE_LOG_PKEY_TABLE_SIZE_MASK
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
#define NODNIC_DEVICE_SUPPORT_RX_PI_DMA_OFFSET
mlx_uint8 support_rx_pi_dma
mlx_status nodnic_cmd_write(IN nodnic_device_priv *device_priv, IN mlx_uint32 address, IN mlx_pci_gw_buffer buffer)
#define NODNIC_DEVICE_SUPPORT_BAR_CQ_CONTROL_OFFSET
static mlx_status disable_nodnic_inteface(IN nodnic_device_priv *device_priv)
#define CHECK_DEVICE_INIT_TRIES
#define NODNIC_DEVICE_LOG_UAR_PAGE_SIZE_MASK
#define NODNIC_HARDWARE_FORMAT_OFFSET
#define NODNIC_DEVICE_NUM_PORTS_OFFSET
#define NODNIC_DEVICE_PD_MASK
#define NODNIC_INITIALIZING_OFFSET
mlx_status nodnic_device_get_cap(IN nodnic_device_priv *device_priv)
mlx_uint8 support_bar_cq_ctrl
#define NODNIC_DEVICE_LOG_WORKING_BUFFER_SIZE_MASK
static mlx_status check_nodnic_interface_supported(IN nodnic_device_priv *device_priv, OUT mlx_boolean *out)
#define MLX_FATAL_CHECK_STATUS(status, label, message)
#define NODIC_SUPPORTED_REVISION
#define NODNIC_DEVICE_LOG_WORKING_BUFFER_SIZE_OFFSET
static mlx_status nodnic_device_start_nodnic(IN nodnic_device_priv *device_priv)
#define CHECK_BIT(field, offset)
#define NODNIC_DEVICE_LOG_PKEY_TABLE_SIZE_OFFSET
mlx_uint8 support_uar_tx_db
static mlx_status wait_for_device_initialization(IN nodnic_device_priv *device_priv)
#define NODNIC_DEVICE_SUPPORT_UAR_TRX_DB_OFFSET
#define NODNIC_DEVICE_SUPPORT_PROMISC_FILTER_OFFSET
static mlx_status nodnic_device_get_nodnic_data(IN nodnic_device_priv *device_priv)
#define NODNIC_DEVICE_SUPPORT_PROMISC_MULT_FILTER_OFFSET
mlx_boolean support_promisc_filter
#define MLX_DEBUG_ERROR(...)
mlx_uint8 log_uar_page_size
mlx_status nodnic_device_init(IN nodnic_device_priv *device_priv)
#define NODNIC_LOCATION_OFFSET
mlx_uint8 log_max_ring_size
mlx_boolean support_promisc_multicast_filter
#define NODNIC_NIC_INTERFACE_BIT
#define MLX_CHECK_STATUS(id, status, label, message)
mlx_status nodnic_cmd_read(IN nodnic_device_priv *device_priv, IN mlx_uint32 address, OUT mlx_pci_gw_buffer *buffer)
#define NODNIC_DEVICE_SUPPORT_MAC_FILTERS_OFFSET
#define NULL
NULL pointer (VOID *)
#define NODNIC_DISABLE_INTERFACE_BIT
#define NODNIC_REVISION_OFFSET
mlx_uint8 log_working_buffer_size
mlx_boolean support_mac_filters