Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
sge.c File Reference
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <net/ipv6.h>
#include <net/tcp.h>
#include <linux/dma-mapping.h>
#include <linux/prefetch.h>
#include "t4vf_common.h"
#include "t4vf_defs.h"
#include "../cxgb4/t4_regs.h"
#include "../cxgb4/t4fw_api.h"
#include "../cxgb4/t4_msg.h"

Go to the source code of this file.

Data Structures

struct  tx_sw_desc
 
struct  rx_sw_desc
 

Macros

#define POISON_BUF_VAL   -1
 

Enumerations

enum  {
  EQ_UNIT = SGE_EQ_IDXSIZE, FL_PER_EQ_UNIT = EQ_UNIT / sizeof(__be64), TXD_PER_EQ_UNIT = EQ_UNIT / sizeof(__be64), MAX_TX_RECLAIM = 16,
  MAX_RX_REFILL = 16, RX_QCHECK_PERIOD = (HZ / 2), TX_QCHECK_PERIOD = (HZ / 2), MAX_TIMER_TX_RECLAIM = 100,
  FL_STARVE_THRES = 4, ETHTXQ_MAX_FRAGS = MAX_SKB_FRAGS + 1, ETHTXQ_MAX_SGL_LEN, ETHTXQ_MAX_HDR,
  ETHTXQ_MAX_FLITS = ETHTXQ_MAX_SGL_LEN + ETHTXQ_MAX_HDR, ETHTXQ_STOP_THRES = 1 + DIV_ROUND_UP(ETHTXQ_MAX_FLITS, TXD_PER_EQ_UNIT), MAX_IMM_TX_PKT_LEN = FW_WR_IMMDLEN_MASK, MAX_CTRL_WR_LEN = 256,
  MAX_IMM_TX_LEN, RX_COPY_THRES = 256, RX_PULL_LEN = 128, RX_SKB_LEN = 512
}
 
enum  { RX_LARGE_BUF = 1 << 0, RX_UNMAPPED_BUF = 1 << 1 }
 

Functions

int t4vf_eth_xmit (struct sk_buff *skb, struct net_device *dev)
 
struct sk_bufft4vf_pktgl_to_skb (const struct pkt_gl *gl, unsigned int skb_len, unsigned int pull_len)
 
void t4vf_pktgl_free (const struct pkt_gl *gl)
 
int t4vf_ethrx_handler (struct sge_rspq *rspq, const __be64 *rsp, const struct pkt_gl *gl)
 
int process_responses (struct sge_rspq *rspq, int budget)
 
irqreturn_t t4vf_sge_intr_msix (int irq, void *cookie)
 
irqreturn_t t4vf_intr_msi (int irq, void *cookie)
 
irq_handler_t t4vf_intr_handler (struct adapter *adapter)
 
int t4vf_sge_alloc_rxq (struct adapter *adapter, struct sge_rspq *rspq, bool iqasynch, struct net_device *dev, int intr_dest, struct sge_fl *fl, rspq_handler_t hnd)
 
int t4vf_sge_alloc_eth_txq (struct adapter *adapter, struct sge_eth_txq *txq, struct net_device *dev, struct netdev_queue *devq, unsigned int iqid)
 
void t4vf_free_sge_resources (struct adapter *adapter)
 
void t4vf_sge_start (struct adapter *adapter)
 
void t4vf_sge_stop (struct adapter *adapter)
 
int t4vf_sge_init (struct adapter *adapter)
 

Macro Definition Documentation

#define POISON_BUF_VAL   -1

Definition at line 562 of file sge.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
EQ_UNIT 
FL_PER_EQ_UNIT 
TXD_PER_EQ_UNIT 
MAX_TX_RECLAIM 
MAX_RX_REFILL 
RX_QCHECK_PERIOD 
TX_QCHECK_PERIOD 
MAX_TIMER_TX_RECLAIM 
FL_STARVE_THRES 
ETHTXQ_MAX_FRAGS 
ETHTXQ_MAX_SGL_LEN 
ETHTXQ_MAX_HDR 
ETHTXQ_MAX_FLITS 
ETHTXQ_STOP_THRES 
MAX_IMM_TX_PKT_LEN 
MAX_CTRL_WR_LEN 
MAX_IMM_TX_LEN 
RX_COPY_THRES 
RX_PULL_LEN 
RX_SKB_LEN 

Definition at line 64 of file sge.c.

anonymous enum
Enumerator:
RX_LARGE_BUF 
RX_UNMAPPED_BUF 

Definition at line 196 of file sge.c.

Function Documentation

int process_responses ( struct sge_rspq rspq,
int  budget 
)

process_responses - process responses from an SGE response queue : the ingress response queue to process : how many responses can be processed in this round

Process responses from a Scatter Gather Engine response queue up to the supplied budget. Responses include received packets as well as control messages from firmware or hardware.

Additionally choose the interrupt holdoff time for the next interrupt on this queue. If the system is under memory shortage use a fairly long delay to help recovery.

Definition at line 1636 of file sge.c.

int t4vf_eth_xmit ( struct sk_buff skb,
struct net_device dev 
)

t4vf_eth_xmit - add a packet to an Ethernet TX queue : the packet : the egress net device

Add a packet to an SGE Ethernet TX queue. Runs with softirqs disabled.

Definition at line 1072 of file sge.c.

int t4vf_ethrx_handler ( struct sge_rspq rspq,
const __be64 rsp,
const struct pkt_gl gl 
)

t4vf_ethrx_handler - process an ingress ethernet packet : the response queue that received the packet : the response queue descriptor holding the RX_PKT message : the gather list of packet fragments

Process an ingress ethernet packet and deliver it to the stack.

Definition at line 1500 of file sge.c.

void t4vf_free_sge_resources ( struct adapter adapter)

t4vf_free_sge_resources - free SGE resources : the adapter

Frees resources used by the SGE queue sets.

Definition at line 2342 of file sge.c.

irq_handler_t t4vf_intr_handler ( struct adapter adapter)

t4vf_intr_handler - select the top-level interrupt handler : the adapter

Selects the top-level interrupt handler based on the type of interrupts (MSI-X or MSI).

Definition at line 1904 of file sge.c.

irqreturn_t t4vf_intr_msi ( int  irq,
void cookie 
)

Definition at line 1889 of file sge.c.

void t4vf_pktgl_free ( const struct pkt_gl gl)

t4vf_pktgl_free - free a packet gather list : the gather list

Releases the pages of a packet gather list. We do not own the last page on the list and do not free it.

Definition at line 1442 of file sge.c.

struct sk_buff* t4vf_pktgl_to_skb ( const struct pkt_gl gl,
unsigned int  skb_len,
unsigned int  pull_len 
)
read

t4vf_pktgl_to_skb - build an sk_buff from a packet gather list : the gather list : size of sk_buff main body if it carries fragments : amount of data to move to the sk_buff's main body

Builds an sk_buff from the given packet gather list. Returns the sk_buff or NULL if sk_buff allocation failed.

Definition at line 1395 of file sge.c.

int t4vf_sge_alloc_eth_txq ( struct adapter adapter,
struct sge_eth_txq txq,
struct net_device dev,
struct netdev_queue devq,
unsigned int  iqid 
)

t4vf_sge_alloc_eth_txq - allocate an SGE Ethernet TX Queue : the adapter : pointer to the new txq to be filled in : the network TX queue associated with the new txq : the relative ingress queue ID to which events relating to the new txq should be directed

Definition at line 2204 of file sge.c.

int t4vf_sge_alloc_rxq ( struct adapter adapter,
struct sge_rspq rspq,
bool  iqasynch,
struct net_device dev,
int  intr_dest,
struct sge_fl fl,
rspq_handler_t  hnd 
)

t4vf_sge_alloc_rxq - allocate an SGE RX Queue : the adapter : pointer to to the new rxq's Response Queue to be filled in : if 0, a normal rspq; if 1, an asynchronous event queue : the network device associated with the new rspq : MSI-X vector index (overriden in MSI mode) : pointer to the new rxq's Free List to be filled in : the interrupt handler to invoke for the rspq

Definition at line 2033 of file sge.c.

int t4vf_sge_init ( struct adapter adapter)

t4vf_sge_init - initialize SGE : the adapter

Performs SGE initialization needed every time after a chip reset. We do not initialize any of the queue sets here, instead the driver top-level must request those individually. We also do not enable DMA here, that should be done after the queues have been set up.

Definition at line 2407 of file sge.c.

irqreturn_t t4vf_sge_intr_msix ( int  irq,
void cookie 
)

Definition at line 1793 of file sge.c.

void t4vf_sge_start ( struct adapter adapter)

t4vf_sge_start - enable SGE operation : the adapter

Start tasklets and timers associated with the DMA engine.

Definition at line 2373 of file sge.c.

void t4vf_sge_stop ( struct adapter adapter)

t4vf_sge_stop - disable SGE operation : the adapter

Stop tasklets and timers associated with the DMA engine. Note that this is effective only if measures have been taken to disable any HW events that may restart them.

Definition at line 2388 of file sge.c.