FreeBSD kernel CXGBE device code
t4_mp_ring.c File Reference
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/counter.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
#include "t4_mp_ring.h"
Include dependency graph for t4_mp_ring.c:

Go to the source code of this file.

Data Structures

union  ring_state
 

Enumerations

enum  {
  IDLE = 0 , COALESCING , BUSY , TOO_BUSY ,
  TAKING_OVER , STALLED
}
 
enum  { C_FAST = 0 , C_2 , C_3 , C_TAKEOVER }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static uint16_t space_available (struct mp_ring *r, union ring_state s)
 
static uint16_t increment_idx (struct mp_ring *r, uint16_t idx, uint16_t n)
 
static void drain_ring (struct mp_ring *r, int budget)
 
static void drain_txpkts (struct mp_ring *r, union ring_state os, int budget)
 
int mp_ring_alloc (struct mp_ring **pr, int size, void *cookie, ring_drain_t drain, ring_can_drain_t can_drain, struct malloc_type *mt, struct mtx *lck, int flags)
 
void mp_ring_free (struct mp_ring *r)
 
int mp_ring_enqueue (struct mp_ring *r, void **items, int n, int budget)
 
void mp_ring_check_drainage (struct mp_ring *r, int budget)
 
void mp_ring_reset_stats (struct mp_ring *r)
 
bool mp_ring_is_idle (struct mp_ring *r)
 
void mp_ring_sysctls (struct mp_ring *r, struct sysctl_ctx_list *ctx, struct sysctl_oid_list *children)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IDLE 
COALESCING 
BUSY 
TOO_BUSY 
TAKING_OVER 
STALLED 

Definition at line 75 of file t4_mp_ring.c.

◆ anonymous enum

anonymous enum
Enumerator
C_FAST 
C_2 
C_3 
C_TAKEOVER 

Definition at line 84 of file t4_mp_ring.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ drain_ring()

static void drain_ring ( struct mp_ring r,
int  budget 
)
static

◆ drain_txpkts()

static void drain_txpkts ( struct mp_ring r,
union ring_state  os,
int  budget 
)
static

Definition at line 230 of file t4_mp_ring.c.

References BUSY, cidx, ring_state::cidx, mp_ring::cons_lock, mp_ring::drain, drain_ring(), ring_state::flags, IDLE, pidx, ring_state::pidx_tail, r, and ring_state::state.

Referenced by mp_ring_check_drainage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ increment_idx()

static uint16_t increment_idx ( struct mp_ring r,
uint16_t  idx,
uint16_t  n 
)
inlinestatic

Definition at line 105 of file t4_mp_ring.c.

References r.

Referenced by drain_ring(), and mp_ring_enqueue().

Here is the caller graph for this function:

◆ mp_ring_alloc()

int mp_ring_alloc ( struct mp_ring **  pr,
int  size,
void *  cookie,
ring_drain_t  drain,
ring_can_drain_t  can_drain,
struct malloc_type *  mt,
struct mtx *  lck,
int  flags 
)

Definition at line 261 of file t4_mp_ring.c.

References mp_ring::abdications, mp_ring::can_drain, mp_ring::cons_idle, mp_ring::cons_idle2, mp_ring::cons_lock, mp_ring::consumed, mp_ring::consumer, mp_ring::cookie, mp_ring::drain, mp_ring::dropped, mp_ring_free(), mp_ring::mt, mp_ring::not_consumer, r, and mp_ring::stalls.

Referenced by alloc_txq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mp_ring_check_drainage()

void mp_ring_check_drainage ( struct mp_ring r,
int  budget 
)

Definition at line 479 of file t4_mp_ring.c.

References BUSY, mp_ring::can_drain, ring_state::cidx, COALESCING, mp_ring::cons_lock, drain_ring(), drain_txpkts(), ring_state::flags, ring_state::pidx_tail, r, STALLED, and ring_state::state.

Referenced by cxgbe_qflush(), handle_eth_egr_update(), mp_ring_enqueue(), and quiesce_txq().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mp_ring_enqueue()

int mp_ring_enqueue ( struct mp_ring r,
void **  items,
int  n,
int  budget 
)

◆ mp_ring_free()

void mp_ring_free ( struct mp_ring r)

◆ mp_ring_is_idle()

bool mp_ring_is_idle ( struct mp_ring r)

Definition at line 522 of file t4_mp_ring.c.

References ring_state::cidx, ring_state::flags, IDLE, ring_state::pidx_head, ring_state::pidx_tail, r, and ring_state::state.

Referenced by cxgbe_qflush(), handle_eth_egr_update(), and quiesce_txq().

Here is the caller graph for this function:

◆ mp_ring_reset_stats()

void mp_ring_reset_stats ( struct mp_ring r)

Definition at line 506 of file t4_mp_ring.c.

References mp_ring::abdications, mp_ring::cons_idle, mp_ring::cons_idle2, mp_ring::consumed, mp_ring::consumer, mp_ring::dropped, mp_ring::not_consumer, r, and mp_ring::stalls.

Referenced by clear_stats(), and t4vf_ioctl().

Here is the caller graph for this function:

◆ mp_ring_sysctls()

void mp_ring_sysctls ( struct mp_ring r,
struct sysctl_ctx_list *  ctx,
struct sysctl_oid_list *  children 
)

Definition at line 535 of file t4_mp_ring.c.

References mp_ring::abdications, C_2, C_3, C_FAST, C_TAKEOVER, mp_ring::cons_idle, mp_ring::cons_idle2, mp_ring::consumed, mp_ring::consumer, mp_ring::dropped, mp_ring::not_consumer, r, and mp_ring::stalls.

Referenced by add_txq_sysctls().

Here is the caller graph for this function:

◆ space_available()

static uint16_t space_available ( struct mp_ring r,
union ring_state  s 
)
inlinestatic

Definition at line 92 of file t4_mp_ring.c.

References ring_state::cidx, ring_state::pidx_head, and r.

Referenced by mp_ring_enqueue().

Here is the caller graph for this function: