Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
c2.h File Reference
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/idr.h>
#include "c2_provider.h"
#include "c2_mq.h"
#include "c2_status.h"

Go to the source code of this file.

Data Structures

struct  c2_adapter_pci_regs
 
struct  c2_pci_regs
 
struct  c2_txp_desc
 
struct  c2_rxp_desc
 
struct  c2_rxp_hdr
 
struct  c2_tx_desc
 
struct  c2_rx_desc
 
struct  c2_alloc
 
struct  c2_array
 
struct  sp_chunk
 
struct  c2_pd_table
 
struct  c2_qp_table
 
struct  c2_element
 
struct  c2_ring
 
struct  c2_dev
 
struct  c2_port
 

Macros

#define DRV_NAME   "c2"
 
#define DRV_VERSION   "1.1"
 
#define PFX   DRV_NAME ": "
 
#define BAR_0   0
 
#define BAR_2   2
 
#define BAR_4   4
 
#define RX_BUF_SIZE   (1536 + 8)
 
#define ETH_JUMBO_MTU   9000
 
#define C2_MAGIC   "CEPHEUS"
 
#define C2_VERSION   4
 
#define C2_IVN   (18 & 0x7fffffff)
 
#define C2_REG0_SIZE   (16 * 1024)
 
#define C2_REG2_SIZE   (2 * 1024 * 1024)
 
#define C2_REG4_SIZE   (256 * 1024 * 1024)
 
#define C2_NUM_TX_DESC   341
 
#define C2_NUM_RX_DESC   256
 
#define C2_PCI_REGS_OFFSET   (0x10000)
 
#define C2_RXP_HRXDQ_OFFSET   (((C2_REG4_SIZE)/2))
 
#define C2_RXP_HRXDQ_SIZE   (4096)
 
#define C2_TXP_HTXDQ_OFFSET   (((C2_REG4_SIZE)/2) + C2_RXP_HRXDQ_SIZE)
 
#define C2_TXP_HTXDQ_SIZE   (4096)
 
#define C2_TX_TIMEOUT   (6*HZ)
 
#define PCI_BAR0_HOST_HINT   0x100
 
#define PCI_BAR0_ADAPTER_HINT   0x2000
 
#define CQ_ARMED   0x01
 
#define CQ_WAIT_FOR_DMA   0x80
 
#define C2_HINT_MAKE(q_index, hint_count)   (((q_index) << 16) | hint_count)
 
#define C2_HINT_GET_INDEX(hint)   (((hint) & 0x7FFF0000) >> 16)
 
#define C2_HINT_GET_COUNT(hint)   ((hint) & 0x0000FFFF)
 
#define C2_ADAPTER_PCI_REGS_OFFSET   0x10000
 
#define C2_SET_CUR_RX(c2dev, cur_rx)   __raw_writel((__force u32) cpu_to_be32(cur_rx), c2dev->mmio_txp_ring + 4092)
 
#define C2_GET_CUR_RX(c2dev)   be32_to_cpu((__force __be32) readl(c2dev->mmio_txp_ring + 4092))
 

Enumerations

enum  adapter_pci_regs {
  C2_REGS_MAGIC = 0x0000, C2_REGS_VERS = 0x0008, C2_REGS_IVN = 0x000C, C2_REGS_PCI_WINSIZE = 0x0010,
  C2_REGS_Q0_QSIZE = 0x0014, C2_REGS_Q0_MSGSIZE = 0x0018, C2_REGS_Q0_POOLSTART = 0x001C, C2_REGS_Q0_SHARED = 0x0020,
  C2_REGS_Q1_QSIZE = 0x0024, C2_REGS_Q1_MSGSIZE = 0x0028, C2_REGS_Q1_SHARED = 0x0030, C2_REGS_Q2_QSIZE = 0x0034,
  C2_REGS_Q2_MSGSIZE = 0x0038, C2_REGS_Q2_SHARED = 0x0040, C2_REGS_ENADDR = 0x004C, C2_REGS_RDMA_ENADDR = 0x0054,
  C2_REGS_HRX_CUR = 0x006C
}
 
enum  pci_regs {
  C2_HISR = 0x0000, C2_DISR = 0x0004, C2_HIMR = 0x0008, C2_DIMR = 0x000C,
  C2_NISR0 = 0x0010, C2_NISR1 = 0x0014, C2_NIMR0 = 0x0018, C2_NIMR1 = 0x001C,
  C2_IDIS = 0x0020, NES_INT_STAT = 0x0000, NES_INT_MASK = 0x0004, NES_INT_PENDING = 0x0008,
  NES_INTF_INT_STAT = 0x000C, NES_INTF_INT_MASK = 0x0010, NES_TIMER_STAT = 0x0014, NES_PERIODIC_CONTROL = 0x0018,
  NES_ONE_SHOT_CONTROL = 0x001C, NES_EEPROM_COMMAND = 0x0020, NES_EEPROM_DATA = 0x0024, NES_FLASH_COMMAND = 0x0028,
  NES_FLASH_DATA = 0x002C, NES_SOFTWARE_RESET = 0x0030, NES_CQ_ACK = 0x0034, NES_WQE_ALLOC = 0x0040,
  NES_CQE_ALLOC = 0x0044, NES_AEQ_ALLOC = 0x0048
}
 
enum  { C2_PCI_HRX_INT = 1 << 8, C2_PCI_HTX_INT = 1 << 17, C2_PCI_HRX_QUI = 1 << 31 }
 
enum  c2_txp_flags { TXP_HTXD_DONE = 0, TXP_HTXD_READY = 1 << 0, TXP_HTXD_UNINIT = 1 << 1 }
 
enum  c2_rxp_flags { RXP_HRXD_UNINIT = 0, RXP_HRXD_READY = 1 << 0, RXP_HRXD_DONE = 1 << 1 }
 
enum  c2_rxp_status { RXP_HRXD_ZERO = 0, RXP_HRXD_OK = 1 << 0, RXP_HRXD_BUF_OV = 1 << 1 }
 
enum  txp_desc { C2_TXP_FLAGS = 0x0000, C2_TXP_LEN = 0x0002, C2_TXP_ADDR = 0x0004 }
 
enum  rxp_desc {
  C2_RXP_FLAGS = 0x0000, C2_RXP_STATUS = 0x0002, C2_RXP_COUNT = 0x0004, C2_RXP_LEN = 0x0006,
  C2_RXP_ADDR = 0x0008
}
 

Functions

struct c2_txp_desc __attribute__ ((packed))
 
int c2_register_device (struct c2_dev *c2dev)
 
void c2_unregister_device (struct c2_dev *c2dev)
 
int c2_rnic_init (struct c2_dev *c2dev)
 
void c2_rnic_term (struct c2_dev *c2dev)
 
void c2_rnic_interrupt (struct c2_dev *c2dev)
 
int c2_del_addr (struct c2_dev *c2dev, __be32 inaddr, __be32 inmask)
 
int c2_add_addr (struct c2_dev *c2dev, __be32 inaddr, __be32 inmask)
 
int c2_alloc_qp (struct c2_dev *c2dev, struct c2_pd *pd, struct ib_qp_init_attr *qp_attrs, struct c2_qp *qp)
 
void c2_free_qp (struct c2_dev *c2dev, struct c2_qp *qp)
 
struct ib_qpc2_get_qp (struct ib_device *device, int qpn)
 
int c2_qp_modify (struct c2_dev *c2dev, struct c2_qp *qp, struct ib_qp_attr *attr, int attr_mask)
 
int c2_qp_set_read_limits (struct c2_dev *c2dev, struct c2_qp *qp, int ord, int ird)
 
int c2_post_send (struct ib_qp *ibqp, struct ib_send_wr *ib_wr, struct ib_send_wr **bad_wr)
 
int c2_post_receive (struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, struct ib_recv_wr **bad_wr)
 
void __devinit c2_init_qp_table (struct c2_dev *c2dev)
 
void __devexit c2_cleanup_qp_table (struct c2_dev *c2dev)
 
void c2_set_qp_state (struct c2_qp *, int)
 
struct c2_qpc2_find_qpn (struct c2_dev *c2dev, int qpn)
 
int c2_pd_alloc (struct c2_dev *c2dev, int privileged, struct c2_pd *pd)
 
void c2_pd_free (struct c2_dev *c2dev, struct c2_pd *pd)
 
int __devinit c2_init_pd_table (struct c2_dev *c2dev)
 
void __devexit c2_cleanup_pd_table (struct c2_dev *c2dev)
 
int c2_init_cq (struct c2_dev *c2dev, int entries, struct c2_ucontext *ctx, struct c2_cq *cq)
 
void c2_free_cq (struct c2_dev *c2dev, struct c2_cq *cq)
 
void c2_cq_event (struct c2_dev *c2dev, u32 mq_index)
 
void c2_cq_clean (struct c2_dev *c2dev, struct c2_qp *qp, u32 mq_index)
 
int c2_poll_cq (struct ib_cq *ibcq, int num_entries, struct ib_wc *entry)
 
int c2_arm_cq (struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
 
int c2_llp_connect (struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param)
 
int c2_llp_accept (struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param)
 
int c2_llp_reject (struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
 
int c2_llp_service_create (struct iw_cm_id *cm_id, int backlog)
 
int c2_llp_service_destroy (struct iw_cm_id *cm_id)
 
int c2_nsmr_register_phys_kern (struct c2_dev *c2dev, u64 *addr_list, int page_size, int pbl_depth, u32 length, u32 off, u64 *va, enum c2_acf acf, struct c2_mr *mr)
 
int c2_stag_dealloc (struct c2_dev *c2dev, u32 stag_index)
 
void c2_ae_event (struct c2_dev *c2dev, u32 mq_index)
 
int c2_init_mqsp_pool (struct c2_dev *c2dev, gfp_t gfp_mask, struct sp_chunk **root)
 
void c2_free_mqsp_pool (struct c2_dev *c2dev, struct sp_chunk *root)
 
__be16c2_alloc_mqsp (struct c2_dev *c2dev, struct sp_chunk *head, dma_addr_t *dma_addr, gfp_t gfp_mask)
 
void c2_free_mqsp (__be16 *mqsp)
 

Variables

u16 flags
 
u16 len
 
u64 addr
 
u16 status
 
u16 count
 
u16 rsvd
 
struct c2_tx_desc __attribute__
 

Macro Definition Documentation

#define BAR_0   0

Definition at line 52 of file c2.h.

#define BAR_2   2

Definition at line 53 of file c2.h.

#define BAR_4   4

Definition at line 54 of file c2.h.

#define C2_ADAPTER_PCI_REGS_OFFSET   0x10000

Definition at line 403 of file c2.h.

#define C2_GET_CUR_RX (   c2dev)    be32_to_cpu((__force __be32) readl(c2dev->mmio_txp_ring + 4092))

Definition at line 427 of file c2.h.

#define C2_HINT_GET_COUNT (   hint)    ((hint) & 0x0000FFFF)

Definition at line 396 of file c2.h.

#define C2_HINT_GET_INDEX (   hint)    (((hint) & 0x7FFF0000) >> 16)

Definition at line 395 of file c2.h.

#define C2_HINT_MAKE (   q_index,
  hint_count 
)    (((q_index) << 16) | hint_count)

Definition at line 394 of file c2.h.

#define C2_IVN   (18 & 0x7fffffff)

Definition at line 60 of file c2.h.

#define C2_MAGIC   "CEPHEUS"

Definition at line 58 of file c2.h.

#define C2_NUM_RX_DESC   256

Definition at line 66 of file c2.h.

#define C2_NUM_TX_DESC   341

Definition at line 65 of file c2.h.

#define C2_PCI_REGS_OFFSET   (0x10000)

Definition at line 67 of file c2.h.

#define C2_REG0_SIZE   (16 * 1024)

Definition at line 62 of file c2.h.

#define C2_REG2_SIZE   (2 * 1024 * 1024)

Definition at line 63 of file c2.h.

#define C2_REG4_SIZE   (256 * 1024 * 1024)

Definition at line 64 of file c2.h.

#define C2_RXP_HRXDQ_OFFSET   (((C2_REG4_SIZE)/2))

Definition at line 68 of file c2.h.

#define C2_RXP_HRXDQ_SIZE   (4096)

Definition at line 69 of file c2.h.

#define C2_SET_CUR_RX (   c2dev,
  cur_rx 
)    __raw_writel((__force u32) cpu_to_be32(cur_rx), c2dev->mmio_txp_ring + 4092)

Definition at line 424 of file c2.h.

#define C2_TX_TIMEOUT   (6*HZ)

Definition at line 72 of file c2.h.

#define C2_TXP_HTXDQ_OFFSET   (((C2_REG4_SIZE)/2) + C2_RXP_HRXDQ_SIZE)

Definition at line 70 of file c2.h.

#define C2_TXP_HTXDQ_SIZE   (4096)

Definition at line 71 of file c2.h.

#define C2_VERSION   4

Definition at line 59 of file c2.h.

#define CQ_ARMED   0x01

Definition at line 383 of file c2.h.

#define CQ_WAIT_FOR_DMA   0x80

Definition at line 384 of file c2.h.

#define DRV_NAME   "c2"

Definition at line 48 of file c2.h.

#define DRV_VERSION   "1.1"

Definition at line 49 of file c2.h.

#define ETH_JUMBO_MTU   9000

Definition at line 57 of file c2.h.

#define PCI_BAR0_ADAPTER_HINT   0x2000

Definition at line 378 of file c2.h.

#define PCI_BAR0_HOST_HINT   0x100

Definition at line 377 of file c2.h.

#define PFX   DRV_NAME ": "

Definition at line 50 of file c2.h.

#define RX_BUF_SIZE   (1536 + 8)

Definition at line 56 of file c2.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
C2_PCI_HRX_INT 
C2_PCI_HTX_INT 
C2_PCI_HRX_QUI 

Definition at line 139 of file c2.h.

Enumerator:
C2_REGS_MAGIC 
C2_REGS_VERS 
C2_REGS_IVN 
C2_REGS_PCI_WINSIZE 
C2_REGS_Q0_QSIZE 
C2_REGS_Q0_MSGSIZE 
C2_REGS_Q0_POOLSTART 
C2_REGS_Q0_SHARED 
C2_REGS_Q1_QSIZE 
C2_REGS_Q1_MSGSIZE 
C2_REGS_Q1_SHARED 
C2_REGS_Q2_QSIZE 
C2_REGS_Q2_MSGSIZE 
C2_REGS_Q2_SHARED 
C2_REGS_ENADDR 
C2_REGS_RDMA_ENADDR 
C2_REGS_HRX_CUR 

Definition at line 79 of file c2.h.

Enumerator:
RXP_HRXD_UNINIT 
RXP_HRXD_READY 
RXP_HRXD_DONE 

Definition at line 168 of file c2.h.

Enumerator:
RXP_HRXD_ZERO 
RXP_HRXD_OK 
RXP_HRXD_BUF_OV 

Definition at line 175 of file c2.h.

Enumerator:
TXP_HTXD_DONE 
TXP_HTXD_READY 
TXP_HTXD_UNINIT 

Definition at line 161 of file c2.h.

enum pci_regs
Enumerator:
C2_HISR 
C2_DISR 
C2_HIMR 
C2_DIMR 
C2_NISR0 
C2_NISR1 
C2_NIMR0 
C2_NIMR1 
C2_IDIS 
NES_INT_STAT 
NES_INT_MASK 
NES_INT_PENDING 
NES_INTF_INT_STAT 
NES_INTF_INT_MASK 
NES_TIMER_STAT 
NES_PERIODIC_CONTROL 
NES_ONE_SHOT_CONTROL 
NES_EEPROM_COMMAND 
NES_EEPROM_DATA 
NES_FLASH_COMMAND 
NES_FLASH_DATA 
NES_SOFTWARE_RESET 
NES_CQ_ACK 
NES_WQE_ALLOC 
NES_CQE_ALLOC 
NES_AEQ_ALLOC 

Definition at line 127 of file c2.h.

enum rxp_desc
Enumerator:
C2_RXP_FLAGS 
C2_RXP_STATUS 
C2_RXP_COUNT 
C2_RXP_LEN 
C2_RXP_ADDR 

Definition at line 189 of file c2.h.

enum txp_desc
Enumerator:
C2_TXP_FLAGS 
C2_TXP_LEN 
C2_TXP_ADDR 

Definition at line 182 of file c2.h.

Function Documentation

struct c2_txp_desc __attribute__ ( (packed)  )
read

Definition at line 171 of file esd_usb2.c.

int c2_add_addr ( struct c2_dev c2dev,
__be32  inaddr,
__be32  inmask 
)

Definition at line 212 of file c2_rnic.c.

void c2_ae_event ( struct c2_dev c2dev,
u32  mq_index 
)

Definition at line 147 of file c2_ae.c.

__be16* c2_alloc_mqsp ( struct c2_dev c2dev,
struct sp_chunk head,
dma_addr_t dma_addr,
gfp_t  gfp_mask 
)

Definition at line 89 of file c2_alloc.c.

int c2_alloc_qp ( struct c2_dev c2dev,
struct c2_pd pd,
struct ib_qp_init_attr qp_attrs,
struct c2_qp qp 
)

Definition at line 413 of file c2_qp.c.

int c2_arm_cq ( struct ib_cq ibcq,
enum ib_cq_notify_flags  flags 
)

Definition at line 222 of file c2_cq.c.

void __devexit c2_cleanup_pd_table ( struct c2_dev c2dev)

Definition at line 87 of file c2_pd.c.

void __devexit c2_cleanup_qp_table ( struct c2_dev c2dev)

Definition at line 1019 of file c2_qp.c.

void c2_cq_clean ( struct c2_dev c2dev,
struct c2_qp qp,
u32  mq_index 
)

Definition at line 82 of file c2_cq.c.

void c2_cq_event ( struct c2_dev c2dev,
u32  mq_index 
)

Definition at line 68 of file c2_cq.c.

int c2_del_addr ( struct c2_dev c2dev,
__be32  inaddr,
__be32  inmask 
)

Definition at line 274 of file c2_rnic.c.

struct c2_qp* c2_find_qpn ( struct c2_dev c2dev,
int  qpn 
)
read

Definition at line 402 of file c2_qp.c.

void c2_free_cq ( struct c2_dev c2dev,
struct c2_cq cq 
)

Definition at line 386 of file c2_cq.c.

void c2_free_mqsp ( __be16 mqsp)

Definition at line 122 of file c2_alloc.c.

void c2_free_mqsp_pool ( struct c2_dev c2dev,
struct sp_chunk root 
)

Definition at line 77 of file c2_alloc.c.

void c2_free_qp ( struct c2_dev c2dev,
struct c2_qp qp 
)

Definition at line 598 of file c2_qp.c.

struct ib_qp* c2_get_qp ( struct ib_device device,
int  qpn 
)
read

Definition at line 219 of file c2_provider.c.

int c2_init_cq ( struct c2_dev c2dev,
int  entries,
struct c2_ucontext ctx,
struct c2_cq cq 
)

Definition at line 286 of file c2_cq.c.

int c2_init_mqsp_pool ( struct c2_dev c2dev,
gfp_t  gfp_mask,
struct sp_chunk **  root 
)

Definition at line 71 of file c2_alloc.c.

int __devinit c2_init_pd_table ( struct c2_dev c2dev)

Definition at line 73 of file c2_pd.c.

void __devinit c2_init_qp_table ( struct c2_dev c2dev)

Definition at line 1013 of file c2_qp.c.

int c2_llp_accept ( struct iw_cm_id cm_id,
struct iw_cm_conn_param iw_param 
)

Definition at line 283 of file c2_cm.c.

int c2_llp_connect ( struct iw_cm_id cm_id,
struct iw_cm_conn_param iw_param 
)

Definition at line 41 of file c2_cm.c.

int c2_llp_reject ( struct iw_cm_id cm_id,
const void pdata,
u8  pdata_len 
)

Definition at line 389 of file c2_cm.c.

int c2_llp_service_create ( struct iw_cm_id cm_id,
int  backlog 
)

Definition at line 131 of file c2_cm.c.

int c2_llp_service_destroy ( struct iw_cm_id cm_id)

Definition at line 216 of file c2_cm.c.

int c2_nsmr_register_phys_kern ( struct c2_dev c2dev,
u64 addr_list,
int  page_size,
int  pbl_depth,
u32  length,
u32  off,
u64 va,
enum c2_acf  acf,
struct c2_mr mr 
)

Definition at line 174 of file c2_mm.c.

int c2_pd_alloc ( struct c2_dev c2dev,
int  privileged,
struct c2_pd pd 
)

Definition at line 43 of file c2_pd.c.

void c2_pd_free ( struct c2_dev c2dev,
struct c2_pd pd 
)

Definition at line 66 of file c2_pd.c.

int c2_poll_cq ( struct ib_cq ibcq,
int  num_entries,
struct ib_wc entry 
)

Definition at line 201 of file c2_cq.c.

int c2_post_receive ( struct ib_qp ibqp,
struct ib_recv_wr ib_wr,
struct ib_recv_wr **  bad_wr 
)

Definition at line 942 of file c2_qp.c.

int c2_post_send ( struct ib_qp ibqp,
struct ib_send_wr ib_wr,
struct ib_send_wr **  bad_wr 
)

Definition at line 788 of file c2_qp.c.

int c2_qp_modify ( struct c2_dev c2dev,
struct c2_qp qp,
struct ib_qp_attr attr,
int  attr_mask 
)

Definition at line 134 of file c2_qp.c.

int c2_qp_set_read_limits ( struct c2_dev c2dev,
struct c2_qp qp,
int  ord,
int  ird 
)

Definition at line 253 of file c2_qp.c.

int c2_register_device ( struct c2_dev c2dev)

Definition at line 765 of file c2_provider.c.

int c2_rnic_init ( struct c2_dev c2dev)

Definition at line 445 of file c2_rnic.c.

void c2_rnic_interrupt ( struct c2_dev c2dev)

Definition at line 43 of file c2_intr.c.

void c2_rnic_term ( struct c2_dev c2dev)

Definition at line 614 of file c2_rnic.c.

void c2_set_qp_state ( struct c2_qp ,
int   
)

Definition at line 120 of file c2_qp.c.

int c2_stag_dealloc ( struct c2_dev c2dev,
u32  stag_index 
)

Definition at line 316 of file c2_mm.c.

void c2_unregister_device ( struct c2_dev c2dev)

Definition at line 881 of file c2_provider.c.

Variable Documentation

u64 addr

Definition at line 204 of file c2.h.

u16 count

Definition at line 212 of file c2.h.

u16 flags

Definition at line 202 of file c2.h.

u16 len

Definition at line 203 of file c2.h.

u16 rsvd

Definition at line 220 of file c2.h.

Definition at line 211 of file c2.h.