FreeBSD kernel CAM code
cam_queue.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_queue.h>
#include <cam/cam_debug.h>
Include dependency graph for cam_queue.c:

Go to the source code of this file.

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_CAMQ, "CAM queue", "CAM queue buffers")
 
static MALLOC_DEFINE (M_CAMDEVQ, "CAM dev queue", "CAM dev queue buffers")
 
static MALLOC_DEFINE (M_CAMCCBQ, "CAM ccb queue", "CAM ccb queue buffers")
 
static __inline int queue_cmp (cam_pinfo **queue_array, int i, int j)
 
static __inline void swap (cam_pinfo **queue_array, int i, int j)
 
static void heap_up (cam_pinfo **queue_array, int new_index)
 
static void heap_down (cam_pinfo **queue_array, int index, int last_index)
 
int camq_init (struct camq *camq, int size)
 
void camq_fini (struct camq *queue)
 
u_int32_t camq_resize (struct camq *queue, int new_size)
 
void camq_insert (struct camq *queue, cam_pinfo *new_entry)
 
cam_pinfocamq_remove (struct camq *queue, int index)
 
void camq_change_priority (struct camq *queue, int index, u_int32_t new_priority)
 
struct cam_devqcam_devq_alloc (int devices, int openings)
 
int cam_devq_init (struct cam_devq *devq, int devices, int openings)
 
void cam_devq_free (struct cam_devq *devq)
 
u_int32_t cam_devq_resize (struct cam_devq *camq, int devices)
 
struct cam_ccbqcam_ccbq_alloc (int openings)
 
void cam_ccbq_free (struct cam_ccbq *ccbq)
 
u_int32_t cam_ccbq_resize (struct cam_ccbq *ccbq, int new_size)
 
int cam_ccbq_init (struct cam_ccbq *ccbq, int openings)
 
void cam_ccbq_fini (struct cam_ccbq *ccbq)
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ cam_ccbq_alloc()

struct cam_ccbq * cam_ccbq_alloc ( int  openings)

Definition at line 234 of file cam_queue.c.

References cam_ccbq_init().

Here is the call graph for this function:

◆ cam_ccbq_fini()

void cam_ccbq_fini ( struct cam_ccbq ccbq)

Definition at line 289 of file cam_queue.c.

References camq_fini(), and cam_ccbq::queue.

Referenced by cam_ccbq_free(), and xpt_release_device().

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

◆ cam_ccbq_free()

void cam_ccbq_free ( struct cam_ccbq ccbq)

Definition at line 252 of file cam_queue.c.

References cam_ccbq_fini().

Here is the call graph for this function:

◆ cam_ccbq_init()

int cam_ccbq_init ( struct cam_ccbq ccbq,
int  openings 
)

Definition at line 277 of file cam_queue.c.

References camq_init(), cam_ccbq::dev_openings, cam_ccbq::queue, and cam_ccbq::total_openings.

Referenced by cam_ccbq_alloc(), and xpt_alloc_device().

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

◆ cam_ccbq_resize()

u_int32_t cam_ccbq_resize ( struct cam_ccbq ccbq,
int  new_size 
)

Definition at line 261 of file cam_queue.c.

References camq::array_size, CAM_REQ_CMP, camq_resize(), cam_ccbq::dev_active, cam_ccbq::dev_openings, cam_ccbq::queue, and cam_ccbq::total_openings.

Referenced by xpt_dev_ccbq_resize().

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

◆ cam_devq_alloc()

struct cam_devq * cam_devq_alloc ( int  devices,
int  openings 
)

Definition at line 186 of file cam_queue.c.

References cam_devq_init().

Referenced by cam_simq_alloc().

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

◆ cam_devq_free()

void cam_devq_free ( struct cam_devq devq)

Definition at line 216 of file cam_queue.c.

References camq_fini(), cam_devq::send_mtx, and cam_devq::send_queue.

Referenced by cam_simq_free().

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

◆ cam_devq_init()

int cam_devq_init ( struct cam_devq devq,
int  devices,
int  openings 
)

Definition at line 203 of file cam_queue.c.

References camq_init(), cam_devq::send_active, cam_devq::send_mtx, cam_devq::send_openings, and cam_devq::send_queue.

Referenced by cam_devq_alloc().

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

◆ cam_devq_resize()

u_int32_t cam_devq_resize ( struct cam_devq camq,
int  devices 
)

Definition at line 225 of file cam_queue.c.

References camq_resize().

Referenced by xpt_alloc_device(), and xpt_release_device().

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

◆ camq_change_priority()

void camq_change_priority ( struct camq queue,
int  index,
u_int32_t  new_priority 
)

Definition at line 173 of file cam_queue.c.

References camq::entries, heap_down(), heap_up(), cam_pinfo::priority, and camq::queue_array.

Referenced by xpt_schedule_dev().

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

◆ camq_fini()

void camq_fini ( struct camq queue)

Definition at line 84 of file cam_queue.c.

References camq::queue_array.

Referenced by cam_ccbq_fini(), and cam_devq_free().

Here is the caller graph for this function:

◆ camq_init()

int camq_init ( struct camq camq,
int  size 
)

Definition at line 58 of file cam_queue.c.

References camq::array_size, and camq::queue_array.

Referenced by cam_ccbq_init(), and cam_devq_init().

Here is the caller graph for this function:

◆ camq_insert()

void camq_insert ( struct camq queue,
cam_pinfo new_entry 
)

Definition at line 126 of file cam_queue.c.

References camq::array_size, camq::entries, heap_up(), cam_pinfo::index, and camq::queue_array.

Referenced by cam_ccbq_insert_ccb(), cam_ccbq_remove_ccb(), and xpt_schedule_dev().

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

◆ camq_remove()

cam_pinfo * camq_remove ( struct camq queue,
int  index 
)

Definition at line 146 of file cam_queue.c.

References CAM_UNQUEUED_INDEX, camq::entries, heap_down(), cam_pinfo::index, and camq::queue_array.

Referenced by cam_ccbq_insert_ccb(), cam_ccbq_remove_ccb(), xpt_freeze_devq_device(), and xpt_run_devq().

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

◆ camq_resize()

u_int32_t camq_resize ( struct camq queue,
int  new_size 
)

Definition at line 92 of file cam_queue.c.

References camq::array_size, CAM_REQ_CMP, CAM_RESRC_UNAVAIL, camq::entries, and camq::queue_array.

Referenced by cam_ccbq_insert_ccb(), cam_ccbq_resize(), and cam_devq_resize().

Here is the caller graph for this function:

◆ heap_down()

static void heap_down ( cam_pinfo **  queue_array,
int  index,
int  last_index 
)
static

Definition at line 358 of file cam_queue.c.

References queue_cmp(), and swap().

Referenced by camq_change_priority(), and camq_remove().

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

◆ heap_up()

static void heap_up ( cam_pinfo **  queue_array,
int  new_index 
)
static

Definition at line 336 of file cam_queue.c.

References queue_cmp(), and swap().

Referenced by camq_change_priority(), and camq_insert().

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

◆ MALLOC_DEFINE() [1/3]

static MALLOC_DEFINE ( M_CAMCCBQ  ,
"CAM ccb queue"  ,
"CAM ccb queue buffers"   
)
static

◆ MALLOC_DEFINE() [2/3]

static MALLOC_DEFINE ( M_CAMDEVQ  ,
"CAM dev queue"  ,
"CAM dev queue buffers"   
)
static

◆ MALLOC_DEFINE() [3/3]

static MALLOC_DEFINE ( M_CAMQ  ,
"CAM queue"  ,
"CAM queue buffers"   
)
static

◆ queue_cmp()

static __inline int queue_cmp ( cam_pinfo **  queue_array,
int  i,
int  j 
)
static

Definition at line 304 of file cam_queue.c.

Referenced by heap_down(), and heap_up().

Here is the caller graph for this function:

◆ swap()

static __inline void swap ( cam_pinfo **  queue_array,
int  i,
int  j 
)
static

Definition at line 319 of file cam_queue.c.

References cam_pinfo::index.

Referenced by heap_down(), and heap_up().

Here is the caller graph for this function: