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 <linux/dma-mapping.h>
#include <linux/jiffies.h>
#include <linux/prefetch.h>
#include <linux/export.h>
#include <net/ipv6.h>
#include <net/tcp.h>
#include "cxgb4.h"
#include "t4_regs.h"
#include "t4_msg.h"
#include "t4fw_api.h"

Go to the source code of this file.

Data Structures

struct  tx_sw_desc
 
struct  rx_sw_desc
 

Macros

#define FL_PG_ORDER   (16 - PAGE_SHIFT)
 
#define RX_COPY_THRES   256
 
#define RX_PULL_LEN   128
 
#define RX_PKT_SKB_LEN   512
 
#define MAX_TX_RECLAIM   16
 
#define MAX_RX_REFILL   16U
 
#define RX_QCHECK_PERIOD   (HZ / 2)
 
#define TX_QCHECK_PERIOD   (HZ / 2)
 
#define MAX_TIMER_TX_RECLAIM   100
 
#define NOMEM_TMR_IDX   (SGE_NTIMERS - 1)
 
#define FL_STARVE_THRES   4
 
#define ETHTXQ_STOP_THRES   (1 + DIV_ROUND_UP((3 * MAX_SKB_FRAGS) / 2 + (MAX_SKB_FRAGS & 1), 8))
 
#define TXQ_STOP_THRES   (SGE_MAX_WR_LEN / sizeof(struct tx_desc))
 
#define MAX_IMM_TX_PKT_LEN   128
 
#define MAX_CTRL_WR_LEN   SGE_MAX_WR_LEN
 
#define FL_MTU_SMALL   1500
 
#define FL_MTU_LARGE   9000
 
#define FL_MTU_SMALL_BUFSIZE(adapter)   fl_mtu_bufsize(adapter, FL_MTU_SMALL)
 
#define FL_MTU_LARGE_BUFSIZE(adapter)   fl_mtu_bufsize(adapter, FL_MTU_LARGE)
 
#define READ_FL_BUF(x)   t4_read_reg(adap, SGE_FL_BUFFER_SIZE0+(x)*sizeof(u32))
 

Enumerations

enum  {
  RX_BUF_FLAGS = 0x1f, RX_BUF_SIZE = 0x0f, RX_UNMAPPED_BUF = 0x10, RX_SMALL_PG_BUF = 0x0,
  RX_LARGE_PG_BUF = 0x1, RX_SMALL_MTU_BUF = 0x2, RX_LARGE_MTU_BUF = 0x3
}
 

Functions

netdev_tx_t t4_eth_xmit (struct sk_buff *skb, struct net_device *dev)
 
int t4_mgmt_tx (struct adapter *adap, struct sk_buff *skb)
 
int t4_ofld_send (struct adapter *adap, struct sk_buff *skb)
 
int cxgb4_ofld_send (struct net_device *dev, struct sk_buff *skb)
 
 EXPORT_SYMBOL (cxgb4_ofld_send)
 
struct sk_buffcxgb4_pktgl_to_skb (const struct pkt_gl *gl, unsigned int skb_len, unsigned int pull_len)
 
 EXPORT_SYMBOL (cxgb4_pktgl_to_skb)
 
int t4_ethrx_handler (struct sge_rspq *q, const __be64 *rsp, const struct pkt_gl *si)
 
irqreturn_t t4_sge_intr_msix (int irq, void *cookie)
 
irq_handler_t t4_intr_handler (struct adapter *adap)
 
int t4_sge_alloc_rxq (struct adapter *adap, struct sge_rspq *iq, bool fwevtq, struct net_device *dev, int intr_idx, struct sge_fl *fl, rspq_handler_t hnd)
 
int t4_sge_alloc_eth_txq (struct adapter *adap, struct sge_eth_txq *txq, struct net_device *dev, struct netdev_queue *netdevq, unsigned int iqid)
 
int t4_sge_alloc_ctrl_txq (struct adapter *adap, struct sge_ctrl_txq *txq, struct net_device *dev, unsigned int iqid, unsigned int cmplqid)
 
int t4_sge_alloc_ofld_txq (struct adapter *adap, struct sge_ofld_txq *txq, struct net_device *dev, unsigned int iqid)
 
void t4_free_sge_resources (struct adapter *adap)
 
void t4_sge_start (struct adapter *adap)
 
void t4_sge_stop (struct adapter *adap)
 
int t4_sge_init (struct adapter *adap)
 

Macro Definition Documentation

#define ETHTXQ_STOP_THRES   (1 + DIV_ROUND_UP((3 * MAX_SKB_FRAGS) / 2 + (MAX_SKB_FRAGS & 1), 8))

Definition at line 117 of file sge.c.

#define FL_MTU_LARGE   9000

Definition at line 154 of file sge.c.

#define FL_MTU_LARGE_BUFSIZE (   adapter)    fl_mtu_bufsize(adapter, FL_MTU_LARGE)

Definition at line 165 of file sge.c.

#define FL_MTU_SMALL   1500

Definition at line 153 of file sge.c.

#define FL_MTU_SMALL_BUFSIZE (   adapter)    fl_mtu_bufsize(adapter, FL_MTU_SMALL)

Definition at line 164 of file sge.c.

#define FL_PG_ORDER   (16 - PAGE_SHIFT)

Definition at line 58 of file sge.c.

#define FL_STARVE_THRES   4

Definition at line 110 of file sge.c.

#define MAX_CTRL_WR_LEN   SGE_MAX_WR_LEN

Definition at line 135 of file sge.c.

#define MAX_IMM_TX_PKT_LEN   128

Definition at line 130 of file sge.c.

#define MAX_RX_REFILL   16U

Definition at line 83 of file sge.c.

#define MAX_TIMER_TX_RECLAIM   100

Definition at line 99 of file sge.c.

#define MAX_TX_RECLAIM   16

Definition at line 77 of file sge.c.

#define NOMEM_TMR_IDX   (SGE_NTIMERS - 1)

Definition at line 104 of file sge.c.

#define READ_FL_BUF (   x)    t4_read_reg(adap, SGE_FL_BUFFER_SIZE0+(x)*sizeof(u32))
#define RX_COPY_THRES   256

Definition at line 62 of file sge.c.

#define RX_PKT_SKB_LEN   512

Definition at line 69 of file sge.c.

#define RX_PULL_LEN   128

Definition at line 63 of file sge.c.

#define RX_QCHECK_PERIOD   (HZ / 2)

Definition at line 89 of file sge.c.

#define TX_QCHECK_PERIOD   (HZ / 2)

Definition at line 94 of file sge.c.

#define TXQ_STOP_THRES   (SGE_MAX_WR_LEN / sizeof(struct tx_desc))

Definition at line 124 of file sge.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
RX_BUF_FLAGS 
RX_BUF_SIZE 
RX_UNMAPPED_BUF 
RX_SMALL_PG_BUF 
RX_LARGE_PG_BUF 
RX_SMALL_MTU_BUF 
RX_LARGE_MTU_BUF 

Definition at line 177 of file sge.c.

Function Documentation

int cxgb4_ofld_send ( struct net_device dev,
struct sk_buff skb 
)

cxgb4_ofld_send - send an offload packet : the net device : the packet

Sends an offload packet. This is an exported version of , intended for ULDs.

Definition at line 1468 of file sge.c.

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

cxgb4_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 1502 of file sge.c.

EXPORT_SYMBOL ( cxgb4_ofld_send  )
EXPORT_SYMBOL ( cxgb4_pktgl_to_skb  )
netdev_tx_t t4_eth_xmit ( struct sk_buff skb,
struct net_device dev 
)

t4_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 938 of file sge.c.

int t4_ethrx_handler ( struct sge_rspq q,
const __be64 rsp,
const struct pkt_gl si 
)

t4_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 1620 of file sge.c.

void t4_free_sge_resources ( struct adapter adap)

t4_free_sge_resources - free SGE resources : the adapter

Frees resources used by the SGE queue sets.

Definition at line 2362 of file sge.c.

irq_handler_t t4_intr_handler ( struct adapter adap)

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

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

Definition at line 1943 of file sge.c.

int t4_mgmt_tx ( struct adapter adap,
struct sk_buff skb 
)

t4_mgmt_tx - send a management message : the adapter : the packet containing the management message

Send a management message through control queue 0.

Definition at line 1224 of file sge.c.

int t4_ofld_send ( struct adapter adap,
struct sk_buff skb 
)

t4_ofld_send - send an offload packet : the adapter : the packet

Sends an offload packet. We use the packet queue_mapping to select the appropriate Tx queue as follows: bit 0 indicates whether the packet should be sent as regular or control, bits 1-15 select the queue.

Definition at line 1450 of file sge.c.

int t4_sge_alloc_ctrl_txq ( struct adapter adap,
struct sge_ctrl_txq txq,
struct net_device dev,
unsigned int  iqid,
unsigned int  cmplqid 
)

Definition at line 2209 of file sge.c.

int t4_sge_alloc_eth_txq ( struct adapter adap,
struct sge_eth_txq txq,
struct net_device dev,
struct netdev_queue netdevq,
unsigned int  iqid 
)

Definition at line 2155 of file sge.c.

int t4_sge_alloc_ofld_txq ( struct adapter adap,
struct sge_ofld_txq txq,
struct net_device dev,
unsigned int  iqid 
)

Definition at line 2262 of file sge.c.

int t4_sge_alloc_rxq ( struct adapter adap,
struct sge_rspq iq,
bool  fwevtq,
struct net_device dev,
int  intr_idx,
struct sge_fl fl,
rspq_handler_t  hnd 
)

Definition at line 2041 of file sge.c.

int t4_sge_init ( struct adapter adap)

Definition at line 2634 of file sge.c.

irqreturn_t t4_sge_intr_msix ( int  irq,
void cookie 
)

Definition at line 1867 of file sge.c.

void t4_sge_start ( struct adapter adap)

Definition at line 2430 of file sge.c.

void t4_sge_stop ( struct adapter adap)

t4_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 2445 of file sge.c.