Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
ipath_driver.c File Reference
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/idr.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/vmalloc.h>
#include <linux/bitmap.h>
#include <linux/slab.h>
#include <linux/module.h>
#include "ipath_kernel.h"
#include "ipath_verbs.h"

Go to the source code of this file.


#define DRIVER_LOAD_MSG   "QLogic " IPATH_DRV_NAME " loaded: "
#define PFX   IPATH_DRV_NAME ": "
#define PCI_VENDOR_ID_PATHSCALE   0x1fc1
#define STATUS_TIMEOUT   60
#define LED_OVER_BOTH_OFF   (8)


const charipath_get_unit_name (int unit)
 DEFINE_SPINLOCK (ipath_devs_lock)
 LIST_HEAD (ipath_dev_list)
 module_param_named (debug, ipath_debug, uint, S_IWUSR|S_IRUGO)
 MODULE_PARM_DESC (debug,"mask for debug prints")
 EXPORT_SYMBOL_GPL (ipath_debug)
 module_param_named (mtu4096, ipath_mtu4096, uint, S_IRUGO)
 MODULE_PARM_DESC (mtu4096,"enable MTU of 4096 bytes, if supported")
 module_param_named (hol_timeout_ms, ipath_hol_timeout_ms, uint, S_IRUGO)
 MODULE_PARM_DESC (hol_timeout_ms,"duration of user app suspension after link failure")
 module_param_named (linkrecovery, ipath_linkrecovery, uint, S_IWUSR|S_IRUGO)
 MODULE_PARM_DESC (linkrecovery,"enable workaround for link recovery issue")
 MODULE_AUTHOR ("QLogic <>")
 MODULE_DESCRIPTION ("QLogic InfiniPath driver")
 MODULE_DEVICE_TABLE (pci, ipath_pci_tbl)
struct ipath_devdataipath_lookup (int unit)
int ipath_count_units (int *npresentp, int *nupp, int *maxportsp)
int __attribute__ ((weak))
 DEFINE_MUTEX (ipath_mutex)
void ipath_disarm_piobufs (struct ipath_devdata *dd, unsigned first, unsigned cnt)
int ipath_wait_linkstate (struct ipath_devdata *dd, u32 state, int msecs)
int ipath_decode_err (struct ipath_devdata *dd, char *buf, size_t blen, ipath_err_t err)
struct sk_buffipath_alloc_skb (struct ipath_devdata *dd, gfp_t gfp_mask)
void ipath_kreceive (struct ipath_portdata *pd)
int ipath_setrcvhdrsize (struct ipath_devdata *dd, unsigned rhdrsize)
u32 __iomemipath_getpiobuf (struct ipath_devdata *dd, u32 plen, u32 *pbufnum)
void ipath_chg_pioavailkernel (struct ipath_devdata *dd, unsigned start, unsigned len, int avail)
int ipath_create_rcvhdrq (struct ipath_devdata *dd, struct ipath_portdata *pd)
void ipath_cancel_sends (struct ipath_devdata *dd, int restore_sendctrl)
void ipath_force_pio_avail_update (struct ipath_devdata *dd)
int ipath_set_linkstate (struct ipath_devdata *dd, u8 newstate)
int ipath_set_mtu (struct ipath_devdata *dd, u16 arg)
int ipath_set_lid (struct ipath_devdata *dd, u32 lid, u8 lmc)
void ipath_write_kreg_port (const struct ipath_devdata *dd, ipath_kreg regno, unsigned port, u64 value)
void ipath_set_led_override (struct ipath_devdata *dd, unsigned int val)
void ipath_shutdown_device (struct ipath_devdata *dd)
void ipath_free_pddata (struct ipath_devdata *dd, struct ipath_portdata *pd)
int ipath_reset_device (int unit)
void ipath_hol_down (struct ipath_devdata *dd)
void ipath_hol_up (struct ipath_devdata *dd)
void ipath_hol_event (unsigned long opaque)
int ipath_set_rx_pol_inv (struct ipath_devdata *dd, u8 new_pol_inv)
void ipath_enable_armlaunch (struct ipath_devdata *dd)
void ipath_disable_armlaunch (struct ipath_devdata *dd)
 module_init (infinipath_init)
 module_exit (infinipath_cleanup)


const char ib_ipath_version [] = IPATH_IDSTR "\n"
wait_queue_head_t ipath_state_wait
unsigned ipath_debug = __IPATH_INFO
unsigned ipath_mtu4096 = 1
unsigned ipath_linkrecovery = 1
const charipath_ibcstatus_str []

Macro Definition Documentation

#define DRIVER_LOAD_MSG   "QLogic " IPATH_DRV_NAME " loaded: "

Definition at line 58 of file ipath_driver.c.

#define LED_OVER_BOTH_OFF   (8)

Definition at line 2250 of file ipath_driver.c.


Definition at line 2248 of file ipath_driver.c.


Definition at line 2247 of file ipath_driver.c.


Definition at line 136 of file ipath_driver.c.

#define PCI_VENDOR_ID_PATHSCALE   0x1fc1

Definition at line 135 of file ipath_driver.c.

#define PFX   IPATH_DRV_NAME ": "

Definition at line 59 of file ipath_driver.c.

#define STATUS_TIMEOUT   60

Definition at line 139 of file ipath_driver.c.

Function Documentation

int __attribute__ ( (weak)  )

Definition at line 291 of file ipath_driver.c.

DEFINE_MUTEX ( ipath_mutex  )
DEFINE_SPINLOCK ( ipath_devs_lock  )
EXPORT_SYMBOL_GPL ( ipath_debug  )
struct sk_buff* ipath_alloc_skb ( struct ipath_devdata dd,
gfp_t  gfp_mask 

ipath_alloc_skb - allocate an skb and buffer with possible constraints : the infinipath device : the sk_buff SFP mask

Definition at line 1066 of file ipath_driver.c.

void ipath_cancel_sends ( struct ipath_devdata dd,
int  restore_sendctrl 

Definition at line 1856 of file ipath_driver.c.

void ipath_chg_pioavailkernel ( struct ipath_devdata dd,
unsigned  start,
unsigned  len,
int  avail 

ipath_chg_pioavailkernel - change which send buffers are available for kernel : the infinipath device : the starting send buffer number : the number of send buffers : true if the buffers are available for kernel use, false otherwise

Definition at line 1671 of file ipath_driver.c.

int ipath_count_units ( int npresentp,
int nupp,
int maxportsp 

Definition at line 250 of file ipath_driver.c.

int ipath_create_rcvhdrq ( struct ipath_devdata dd,
struct ipath_portdata pd 

ipath_create_rcvhdrq - create a receive header queue : the infinipath device : the port data

this must be contiguous memory (from an i/o perspective), and must be DMA'able (which means for some systems, it will go through an IOMMU, or be forced into a low address range).

Definition at line 1767 of file ipath_driver.c.

int ipath_decode_err ( struct ipath_devdata dd,
char buf,
size_t  blen,
ipath_err_t  err 

Definition at line 918 of file ipath_driver.c.

void ipath_disable_armlaunch ( struct ipath_devdata dd)

Definition at line 2779 of file ipath_driver.c.

void ipath_disarm_piobufs ( struct ipath_devdata dd,
unsigned  first,
unsigned  cnt 

ipath_disarm_piobufs - cancel a range of PIO buffers : the infinipath device : the first PIO buffer to cancel : the number of PIO buffers to cancel

cancel a range of PIO buffers, used when they might be armed, but not triggered. Used at init to ensure buffer state, and also user process close, in case it died while writing to a PIO buffer Also after errors.

Definition at line 815 of file ipath_driver.c.

void ipath_enable_armlaunch ( struct ipath_devdata dd)

Definition at line 2769 of file ipath_driver.c.

void ipath_force_pio_avail_update ( struct ipath_devdata dd)

Definition at line 1945 of file ipath_driver.c.

void ipath_free_pddata ( struct ipath_devdata dd,
struct ipath_portdata pd 

ipath_free_pddata - free a port's allocated data : the infinipath device : the portdata structure

free up any allocated data for a port This should not touch anything that would affect a simultaneous re-allocation of port data, because it is called after ipath_mutex is released (and can be called from reinit as well). It should never change any chip state, or global driver state. (The only exception to global state is freeing the port0 port0_skbs.)

Definition at line 2434 of file ipath_driver.c.

const char* ipath_get_unit_name ( int  unit)

Definition at line 51 of file ipath_driver.c.

u32 __iomem* ipath_getpiobuf ( struct ipath_devdata dd,
u32  plen,
u32 pbufnum 

ipath_getpiobuf - find an available pio buffer : the infinipath device : the size of the PIO buffer needed in 32-bit words : the buffer number is placed here

Definition at line 1626 of file ipath_driver.c.

void ipath_hol_down ( struct ipath_devdata dd)

Definition at line 2691 of file ipath_driver.c.

void ipath_hol_event ( unsigned long  opaque)

Definition at line 2718 of file ipath_driver.c.

void ipath_hol_up ( struct ipath_devdata dd)

Definition at line 2706 of file ipath_driver.c.

void ipath_kreceive ( struct ipath_portdata pd)

Definition at line 1150 of file ipath_driver.c.

struct ipath_devdata* ipath_lookup ( int  unit)

Definition at line 238 of file ipath_driver.c.

int ipath_reset_device ( int  unit)

ipath_reset_device - reset the chip if possible : the device to reset

Whether or not reset is successful, we attempt to re-initialize the chip (that is, much like a driver unload/reload). We clear the INITTED flag so that the various entry points will fail until we reinitialize. For now, we only allow this if no user ports are open that use chip resources

Definition at line 2559 of file ipath_driver.c.

void ipath_set_led_override ( struct ipath_devdata dd,
unsigned int  val 

Definition at line 2279 of file ipath_driver.c.

int ipath_set_lid ( struct ipath_devdata dd,
u32  lid,
u8  lmc 

Definition at line 2201 of file ipath_driver.c.

int ipath_set_linkstate ( struct ipath_devdata dd,
u8  newstate 

Definition at line 2005 of file ipath_driver.c.

int ipath_set_mtu ( struct ipath_devdata dd,
u16  arg 

ipath_set_mtu - set the MTU : the infinipath device

  • : the new MTU

we can handle "any" incoming size, the issue here is whether we need to restrict our outgoing size. For now, we don't do any sanity checking on this, and we don't deal with what happens to programs that are already running when the size changes. NOTE: changing the MTU will usually cause the IBC to go back to link INIT state...

Definition at line 2134 of file ipath_driver.c.

int ipath_set_rx_pol_inv ( struct ipath_devdata dd,
u8  new_pol_inv 

Definition at line 2742 of file ipath_driver.c.

int ipath_setrcvhdrsize ( struct ipath_devdata dd,
unsigned  rhdrsize 

ipath_setrcvhdrsize - set the receive header size : the infinipath device : the receive header size

called from user init code, and also layered driver init

Definition at line 1452 of file ipath_driver.c.

void ipath_shutdown_device ( struct ipath_devdata dd)

ipath_shutdown_device - shut down a device : the infinipath device

This is called to make the device quiet when we are about to unload the driver, and also when the device is administratively disabled. It does not free any data structures. Everything it does has to be setup again by ipath_init_chip(dd,1)

Definition at line 2327 of file ipath_driver.c.

int ipath_wait_linkstate ( struct ipath_devdata dd,
u32  state,
int  msecs 

ipath_wait_linkstate - wait for an IB link state change to occur : the infinipath device : the state to wait for : the number of milliseconds to wait

wait up to msecs milliseconds for IB link state change to occur for now, take the easy polling route. Currently used only by ipath_set_linkstate. Returns 0 if state reached, otherwise -ETIMEDOUT state can have multiple states set, for any of several transitions.

Definition at line 852 of file ipath_driver.c.

void ipath_write_kreg_port ( const struct ipath_devdata dd,
ipath_kreg  regno,
unsigned  port,
u64  value 

ipath_write_kreg_port - write a device's per-port 64-bit kernel register : the infinipath device : the register number to write : the port containing the register : the value to write

Registers that vary with the chip implementation constants (port) use this routine.

Definition at line 2225 of file ipath_driver.c.

LIST_HEAD ( ipath_dev_list  )
MODULE_AUTHOR ( "QLogic <>"  )
MODULE_DESCRIPTION ( "QLogic InfiniPath driver )
module_exit ( infinipath_cleanup  )
module_init ( infinipath_init  )
module_param_named ( debug  ,
ipath_debug  ,
uint  ,
module_param_named ( mtu4096  ,
ipath_mtu4096  ,
uint  ,
module_param_named ( hol_timeout_ms  ,
ipath_hol_timeout_ms  ,
uint  ,
module_param_named ( linkrecovery  ,
ipath_linkrecovery  ,
uint  ,
"mask for debug prints"   
MODULE_PARM_DESC ( mtu4096  ,
"enable MTU of 4096  bytes,
if supported"   
MODULE_PARM_DESC ( hol_timeout_ms  ,
"duration of user app suspension after link failure"   
MODULE_PARM_DESC ( linkrecovery  ,
"enable workaround for link recovery issue"   

Variable Documentation

const char ib_ipath_version[] = IPATH_IDSTR "\n"

Definition at line 65 of file ipath_driver.c.

unsigned ipath_debug = __IPATH_INFO

Definition at line 73 of file ipath_driver.c.

const char* ipath_ibcstatus_str[]
Initial value:
= {
"LTState18", "LTState19", "LTState1A", "LTState1B",
"LTState1C", "LTState1D", "LTState1E", "LTState1F"

Definition at line 100 of file ipath_driver.c.

unsigned ipath_linkrecovery = 1

Definition at line 88 of file ipath_driver.c.

unsigned ipath_mtu4096 = 1

Definition at line 79 of file ipath_driver.c.

wait_queue_head_t ipath_state_wait

Definition at line 71 of file ipath_driver.c.