vxge_config.h revision a734c64bff58bda2fa48c2795453e092167b0ff7
/*
* vxge-config.h: iPXE driver for Neterion Inc's X3100 Series 10GbE
* PCIe I/O Virtualized Server Adapter.
*
* Copyright(c) 2002-2010 Neterion Inc.
*
* This software may be used and distributed according to the terms of
* the GNU General Public License (GPL), incorporated herein by
* reference. Drivers based on or derived from this code fall under
* the GPL and must retain the authorship, copyright and license
* notice.
*
*/
#ifndef VXGE_CONFIG_H
#define VXGE_CONFIG_H
#include <stdint.h>
#ifndef VXGE_CACHE_LINE_SIZE
#define VXGE_CACHE_LINE_SIZE 4096
#endif
#define WAIT_FACTOR 1
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
#define VXGE_HW_MAC_MAX_WIRE_PORTS 2
#define VXGE_HW_MAC_MAX_AGGR_PORTS 2
#define VXGE_HW_MAC_MAX_PORTS 3
#define VXGE_HW_MIN_MTU 68
#define VXGE_HW_MAX_MTU 9600
#define VXGE_HW_DEFAULT_MTU 1500
#ifndef __iomem
#define __iomem
#endif
#ifndef ____cacheline_aligned
#define ____cacheline_aligned
#endif
/**
* debug filtering masks
*/
#define VXGE_NONE 0x00
#define VXGE_INFO 0x01
#define VXGE_INTR 0x02
#define VXGE_XMIT 0x04
#define VXGE_POLL 0x08
#define VXGE_ERR 0x10
#define VXGE_TRACE 0x20
#define NULL_VPID 0xFFFFFFFF
#define VXGE_HW_EVENT_BASE 0
#define VXGE_LL_EVENT_BASE 100
#define VXGE_HW_BASE_INF 100
#define VXGE_HW_BASE_ERR 200
#define VXGE_HW_BASE_BADCFG 300
#define VXGE_HW_DEF_DEVICE_POLL_MILLIS 1000
#define VXGE_HW_MAX_PAYLOAD_SIZE_512 2
enum vxge_hw_status {
VXGE_HW_OK = 0,
VXGE_HW_FAIL = 1,
VXGE_HW_PENDING = 2,
};
/**
* enum enum vxge_hw_device_link_state - Link state enumeration.
* @VXGE_HW_LINK_NONE: Invalid link state.
* @VXGE_HW_LINK_DOWN: Link is down.
* @VXGE_HW_LINK_UP: Link is up.
*
*/
enum vxge_hw_device_link_state {
};
/*forward declaration*/
struct vxge_vpath;
struct __vxge_hw_virtualpath;
/**
* struct vxge_hw_ring_rxd_1 - One buffer mode RxD for ring
*
* One buffer mode RxD for ring structure
*/
struct vxge_hw_ring_rxd_1 {
};
/**
* struct vxge_hw_fifo_txd - Transmit Descriptor
*
* Transmit descriptor (TxD).Fifo descriptor contains configured number
* (list) of TxDs. * For more details please refer to Titan User Guide,
* Section 5.4.2 "Transmit Descriptor (TxD) Format".
*/
struct vxge_hw_fifo_txd {
};
/**
* struct vxge_hw_device_date - Date Format
* @day: Day
* @month: Month
* @year: Year
* @date: Date in string format
*
* Structure for returning date
*/
#define VXGE_HW_FW_STRLEN 32
struct vxge_hw_device_date {
char date[VXGE_HW_FW_STRLEN];
};
struct vxge_hw_device_version {
char version[VXGE_HW_FW_STRLEN];
};
/*
* struct __vxge_hw_non_offload_db_wrapper - Non-offload Doorbell Wrapper
* @control_0: Bits 0 to 7 - Doorbell type.
* Bits 8 to 31 - Reserved.
* Bits 32 to 39 - The highest TxD in this TxDL.
* Bits 40 to 47 - Reserved.
* Bits 48 to 55 - Reserved.
* Bits 56 to 63 - No snoop flags.
* @txdl_ptr: The starting location of the TxDL in host memory.
*
* Created by the host and written to the adapter via PIO to a Kernel Doorbell
* FIFO. All non-offload doorbell wrapper fields must be written by the host as
* part of a doorbell write. Consumed by the adapter but is not written by the
* adapter.
*/
struct __vxge_hw_non_offload_db_wrapper {
#define VXGE_HW_NODBW_TYPE_NODBW 0
#define VXGE_HW_NODBW_LIST_NO_SNOOP_TXD_READ_TXD0_WRITE 0x2
#define VXGE_HW_NODBW_LIST_NO_SNOOP_TX_FRAME_DATA_READ 0x1
};
/*
* struct __vxge_hw_fifo - Fifo.
* @vp_id: Virtual path id
* @tx_intr_num: Interrupt Number associated with the TX
* @txdl: Start pointer of the txdl list of this fifo.
* iPXE does not support tx fragmentation, so we need
* only one txd in a list
* @depth: total number of lists in this fifo
* @hw_offset: txd index from where adapter owns the txd list
* @sw_offset: txd index from where driver owns the txd list
*
* @stats: Statistics of this fifo
*
*/
struct __vxge_hw_fifo {
struct vxge_hw_vpath_reg *vp_reg;
struct __vxge_hw_non_offload_db_wrapper *nofl_db;
struct vxge_hw_fifo_txd *txdl;
#define VXGE_HW_FIFO_TXD_DEPTH 128
struct __vxge_hw_virtualpath *vpathh;
};
/* Structure that represents the Rx descriptor block which contains
* 128 Rx descriptors.
*/
struct __vxge_hw_ring_block {
#define VXGE_HW_MAX_RXDS_PER_BLOCK_1 127
#define END_OF_BLOCK 0xFEFFFFFFFFFFFFFFULL
/* 0xFEFFFFFFFFFFFFFF to mark last Rxd in this blk */
/* Logical ptr to next */
/* Buff0_ptr.In a 32 bit arch the upper 32 bits should be 0 */
};
/*
* struct __vxge_hw_ring - Ring channel.
*
* Note: The structure is cache line aligned to better utilize
* CPU cache performance.
*/
struct __vxge_hw_ring {
struct vxge_hw_vpath_reg *vp_reg;
struct vxge_hw_common_reg *common_reg;
#define VXGE_HW_RING_RXD_QWORDS_MODE_1 4
#define VXGE_HW_RING_RXD_QWORD_LIMIT 16
struct __vxge_hw_ring_block *rxdl;
#define VXGE_HW_RING_BUF_PER_BLOCK 9
#define VXGE_HW_RING_RX_POLL_WEIGHT 8
struct __vxge_hw_virtualpath *vpathh;
};
/*
* struct __vxge_hw_virtualpath - Virtual Path
*
* Virtual path structure to encapsulate the data related to a virtual path.
* Virtual paths are allocated by the HW upon getting configuration from the
* driver and inserted into the list of virtual paths.
*/
struct __vxge_hw_virtualpath {
#define VXGE_HW_VP_NOT_OPEN 0
#define VXGE_HW_VP_OPEN 1
struct __vxge_hw_device *hldev;
struct vxge_hw_vpath_reg *vp_reg;
struct vxge_hw_vpmgmt_reg *vpmgmt_reg;
struct __vxge_hw_non_offload_db_wrapper *nofl_db;
struct __vxge_hw_ring ringh;
struct __vxge_hw_fifo fifoh;
};
#define VXGE_HW_INFO_LEN 64
#define VXGE_HW_PMD_INFO_LEN 16
#define VXGE_MAX_PRINT_BUF_SIZE 128
/**
* struct vxge_hw_device_hw_info - Device information
* @host_type: Host Type
* @func_id: Function Id
* @vpath_mask: vpath bit mask
* @fw_version: Firmware version
* @fw_date: Firmware Date
* @flash_version: Firmware version
* @flash_date: Firmware Date
* @mac_addrs: Mac addresses for each vpath
* @mac_addr_masks: Mac address masks for each vpath
*
* Returns the vpath mask that has the bits set for each vpath allocated
* for the driver and the first mac address for each vpath
*/
struct vxge_hw_device_hw_info {
#define VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION 0
#define VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION 1
#define VXGE_HW_NO_MR_SR_VH0_FUNCTION0 2
#define VXGE_HW_NO_MR_SR_VH0_VIRTUAL_FUNCTION 3
#define VXGE_HW_MR_SR_VH0_INVALID_CONFIG 4
#define VXGE_HW_SR_VH_FUNCTION0 5
#define VXGE_HW_SR_VH_VIRTUAL_FUNCTION 6
#define VXGE_HW_VH_NORMAL_FUNCTION 7
#define VXGE_HW_FUNCTION_MODE_MIN 0
#define VXGE_HW_FUNCTION_MODE_MAX 11
#define VXGE_HW_FUNCTION_MODE_SINGLE_FUNCTION 0
#define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION 1
#define VXGE_HW_FUNCTION_MODE_SRIOV 2
#define VXGE_HW_FUNCTION_MODE_MRIOV 3
#define VXGE_HW_FUNCTION_MODE_MRIOV_8 4
#define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION_17 5
#define VXGE_HW_FUNCTION_MODE_SRIOV_8 6
#define VXGE_HW_FUNCTION_MODE_SRIOV_4 7
#define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION_2 8
#define VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION_4 9
#define VXGE_HW_FUNCTION_MODE_MRIOV_4 10
struct vxge_hw_device_version fw_version;
struct vxge_hw_device_date fw_date;
struct vxge_hw_device_version flash_version;
struct vxge_hw_device_date flash_date;
};
/**
* struct __vxge_hw_device - Hal device object
* @magic: Magic Number
* @bar0: BAR0 virtual address.
* @pdev: Physical device handle
* @config: Confguration passed by the LL driver at initialization
* @link_state: Link state
*
* HW device object. Represents Titan adapter
*/
struct __vxge_hw_device {
#define VXGE_HW_DEVICE_MAGIC 0x12345678
#define VXGE_HW_DEVICE_DEAD 0xDEADDEAD
struct pci_device *pdev;
struct net_device *ndev;
#define VXGE_HW_DEVICE_ACCESS_RIGHT_VPATH 0x1
#define VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM 0x2
#define VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM 0x4
struct vxge_hw_legacy_reg *legacy_reg;
struct vxge_hw_toc_reg *toc_reg;
struct vxge_hw_common_reg *common_reg;
struct vxge_hw_mrpcim_reg *mrpcim_reg;
struct vxge_hw_srpcim_reg *srpcim_reg \
struct vxge_hw_vpmgmt_reg *vpmgmt_reg \
struct vxge_hw_vpath_reg *vpath_reg \
struct __vxge_hw_virtualpath virtual_path;
struct vxge_hw_device_hw_info hw_info;
};
if (i < 16) { \
} \
else { \
m1[0] = 0x80000000; \
} \
}
if (i < 16) { \
} \
else { \
m1[0] = 0; \
m1[1] = 0; \
} \
}
/**
* enum enum vxge_hw_txdl_state - Descriptor (TXDL) state.
* @VXGE_HW_TXDL_STATE_NONE: Invalid state.
* @VXGE_HW_TXDL_STATE_AVAIL: Descriptor is available for reservation.
* @VXGE_HW_TXDL_STATE_POSTED: Descriptor is posted for processing by the
* device.
* @VXGE_HW_TXDL_STATE_FREED: Descriptor is free and can be reused for
* filling-in and posting later.
*
*
*/
enum vxge_hw_txdl_state {
};
/* fifo and ring circular buffer offset tracking apis */
{
if (++(*offset) >= upper_limit)
*offset = 0;
}
/* rxd offset handling apis */
{
offset);
}
/* txd offset handling apis */
{
}
/**
* vxge_hw_ring_rxd_1b_set - Prepare 1-buffer-mode descriptor.
* @rxdh: Descriptor handle.
* @dma_pointer: DMA address of a single receive buffer this descriptor
* should carry. Note that by the time vxge_hw_ring_rxd_1b_set is called,
* the receive buffer should be already mapped to the device
* @size: Size of the receive @dma_pointer buffer.
*
* Prepare 1-buffer-mode Rx descriptor for posting
* (via vxge_hw_ring_rxd_post()).
*
* This inline helper-function does not return any parameters and always
* succeeds.
*
*/
static inline
{
}
struct pci_device *pdev,
struct vxge_hw_device_hw_info *hw_info);
enum vxge_hw_status
struct vxge_hw_device_hw_info *hw_info);
enum vxge_hw_status
struct vxge_hw_device_hw_info *hw_info);
/**
* vxge_hw_device_link_state_get - Get link state.
* @devh: HW device handle.
*
* Get link state.
* Returns: link state.
*/
static inline
struct __vxge_hw_device *devh)
{
return devh->link_state;
}
struct __vxge_hw_device **devh,
void *bar0,
struct pci_device *pdev,
enum vxge_hw_status
enum vxge_hw_status
enum vxge_hw_status
void
enum vxge_hw_status
void
void
enum vxge_hw_status
enum vxge_hw_status
enum vxge_hw_status
enum vxge_hw_status
#ifndef readq
{
ret <<= 32;
return ret;
}
#endif
#ifndef writeq
{
}
#endif
{
}
{
}
static inline enum vxge_hw_status
{
wmb();
wmb();
return status;
}
void
enum vxge_hw_status
enum vxge_hw_status
struct __vxge_hw_virtualpath *vpath,
enum vxge_hw_status
enum vxge_hw_status
enum vxge_hw_status
/**
* vxge_debug
* @mask: mask for the debug
* @fmt: printf like format string
*/
if (debug_filter & mask) \
} while (0);
enum vxge_hw_status
enum vxge_hw_status
void
#endif