Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_hal_queues.c File Reference
#include "ocs_os.h"
#include "ocs_hal.h"
#include "ocs_hal_queues.h"

Go to the source code of this file.

Data Structures

struct  tok_t
 Declare token object. More...
 
struct  tokarray_t
 Declare token array object. More...
 
struct  tokmatch_t
 Declare token match structure. More...
 

Macros

#define HAL_QTOP_DEBUG   0
 
#define TOKEN_LEN   32
 
#define P(x)   case x: return #x;
 
#define P(x)   case x: return #x;
 

Enumerations

enum  tok_type_e {
  TOK_LPAREN = 1, TOK_RPAREN, TOK_COLON, TOK_EQUALS,
  TOK_QUEUE, TOK_ATTR_NAME, TOK_NUMBER, TOK_NUMBER_VALUE,
  TOK_NUMBER_LIST
}
 return string given a QTOP entry More...
 
enum  tok_subtype_e {
  TOK_SUB_EQ = 100, TOK_SUB_CQ, TOK_SUB_RQ, TOK_SUB_MQ,
  TOK_SUB_WQ, TOK_SUB_LEN, TOK_SUB_CLASS, TOK_SUB_ULP,
  TOK_SUB_FILTER, TOK_SUB_RQ_POLICY, TOK_SUB_NVMEQ
}
 Declare token sub-types. More...
 

Functions

ocs_hal_rtn_e ocs_hal_init_queues (ocs_hal_t *hal, ocs_hal_qtop_t *qtop)
 Initialize queues. More...
 
hal_eq_t * hal_new_eq (ocs_hal_t *hal, uint32_t entry_count)
 Allocate a new EQ object. More...
 
hal_cq_t * hal_new_cq (hal_eq_t *eq, uint32_t entry_count)
 Allocate a new CQ object. More...
 
uint32_t hal_new_cq_set (hal_eq_t *eqs[], hal_cq_t *cqs[], uint32_t num_cqs, uint32_t entry_count)
 Allocate a new CQ Set of objects. More...
 
hal_mq_t * hal_new_mq (hal_cq_t *cq, uint32_t entry_count)
 Allocate a new MQ object. More...
 
hal_wq_t * hal_new_wq (hal_cq_t *cq, uint32_t entry_count, uint32_t class, uint32_t ulp)
 Allocate a new WQ object. More...
 
hal_rq_t * hal_new_rq (hal_cq_t *cq, uint32_t entry_count, uint32_t ulp)
 Allocate a hal_rq_t object. More...
 
uint32_t hal_new_rq_set (hal_cq_t *cqs[], hal_rq_t *rqs[], uint32_t num_rq_pairs, uint32_t entry_count, uint32_t ulp)
 Allocate a hal_rq_t object SET. More...
 
void hal_del_eq (hal_eq_t *eq)
 Free an EQ object. More...
 
void hal_del_cq (hal_cq_t *cq)
 Free a CQ object. More...
 
void hal_del_mq (hal_mq_t *mq)
 Free a MQ object. More...
 
void hal_del_wq (hal_wq_t *wq)
 Free a WQ object. More...
 
void hal_del_rq (hal_rq_t *rq)
 Free an RQ object. More...
 
void hal_queue_dump (ocs_hal_t *hal)
 Display HAL queue objects. More...
 
void hal_queue_teardown (ocs_hal_t *hal)
 Teardown HAL queue objects. More...
 
hal_wq_t * ocs_hal_queue_next_wq (ocs_hal_t *hal, ocs_hal_io_t *io)
 Allocate a WQ to an IO object. More...
 
uint32_t ocs_hal_qtop_eq_count (ocs_hal_t *hal)
 Return count of EQs for a queue topology object. More...
 
static ocs_hal_qtop_entry_e subtype2qtop (tok_subtype_e q)
 convert queue subtype to QTOP entry More...
 
static int32_t idstart (int c)
 test if character is ID start character More...
 
static int32_t idchar (int c)
 test if character is an ID character More...
 
static const char * tokenize (const char *s, tok_t *tok)
 Scan string and return next token. More...
 
static const char * token_type2s (tok_type_e type)
 convert token type to string More...
 
static const char * token_subtype2s (tok_subtype_e subtype)
 convert token sub-type to string More...
 
static void tok_syntax (ocs_hal_t *hal, tokarray_t *tokarray)
 Generate syntax error message. More...
 
static uint32_t tok_getnumber (ocs_hal_t *hal, ocs_hal_qtop_t *qtop, tok_t *tok)
 parse a number More...
 
static int32_t parse_topology (ocs_hal_t *hal, tokarray_t *tokarray, ocs_hal_qtop_t *qtop)
 parse an array of tokens More...
 
ocs_hal_qtop_t * ocs_hal_qtop_parse (ocs_hal_t *hal, const char *qtop_string)
 Parse queue topology string. More...
 
void ocs_hal_qtop_free (ocs_hal_qtop_t *qtop)
 free queue topology object More...
 

Variables

static tokmatch_t cmatches []
 Declare single character matches. More...
 
static tokmatch_t smatches []
 Declare identifier match strings. More...
 

Macro Details

#define HAL_QTOP_DEBUG   0

Definition at line 42 of file ocs_hal_queues.c.

#define P (   x)    case x: return #x;
#define P (   x)    case x: return #x;
#define TOKEN_LEN   32

Definition at line 1102 of file ocs_hal_queues.c.

Enumeration Details

Declare token sub-types.

Enumerator
TOK_SUB_EQ 
TOK_SUB_CQ 
TOK_SUB_RQ 
TOK_SUB_MQ 
TOK_SUB_WQ 
TOK_SUB_LEN 
TOK_SUB_CLASS 
TOK_SUB_ULP 
TOK_SUB_FILTER 
TOK_SUB_RQ_POLICY 
TOK_SUB_NVMEQ 

Definition at line 1148 of file ocs_hal_queues.c.

enum tok_type_e

return string given a QTOP entry

Parameters
entryQTOP entry
Returns
returns string or "unknown" Declare token types
Enumerator
TOK_LPAREN 
TOK_RPAREN 
TOK_COLON 
TOK_EQUALS 
TOK_QUEUE 
TOK_ATTR_NAME 
TOK_NUMBER 
TOK_NUMBER_VALUE 
TOK_NUMBER_LIST 

Definition at line 1133 of file ocs_hal_queues.c.

Function Details

void hal_del_cq ( hal_cq_t *  cq)

Free a CQ object.

The CQ object and any child queue objects are freed

Parameters
cqpointer to CQ object
Returns
none

Definition at line 863 of file ocs_hal_queues.c.

void hal_del_eq ( hal_eq_t *  eq)

Free an EQ object.

The EQ object and any child queue objects are freed

Parameters
eqpointer to EQ object
Returns
none

Definition at line 837 of file ocs_hal_queues.c.

void hal_del_mq ( hal_mq_t *  mq)

Free a MQ object.

The MQ object is freed

Parameters
mqpointer to MQ object
Returns
none

Definition at line 900 of file ocs_hal_queues.c.

void hal_del_rq ( hal_rq_t *  rq)

Free an RQ object.

The RQ object is freed

Parameters
rqpointer to RQ object
Returns
none

Definition at line 938 of file ocs_hal_queues.c.

void hal_del_wq ( hal_wq_t *  wq)

Free a WQ object.

The WQ object is freed

Parameters
wqpointer to WQ object
Returns
none

Definition at line 919 of file ocs_hal_queues.c.

hal_cq_t* hal_new_cq ( hal_eq_t *  eq,
uint32_t  entry_count 
)

Allocate a new CQ object.

A new CQ object is instantiated

Parameters
eqpointer to parent EQ object
entry_countnumber of entries in the CQ
Returns
pointer to allocated CQ object

Definition at line 477 of file ocs_hal_queues.c.

uint32_t hal_new_cq_set ( hal_eq_t *  eqs[],
hal_cq_t *  cqs[],
uint32_t  num_cqs,
uint32_t  entry_count 
)

Allocate a new CQ Set of objects.

Parameters
eqspointer to a set of EQ objects.
cqspointer to a set of CQ objects to be returned.
num_cqsnumber of CQ queues in the set.
entry_countnumber of entries in the CQ.
Returns
0 on success and -1 on failure.

Definition at line 518 of file ocs_hal_queues.c.

hal_eq_t* hal_new_eq ( ocs_hal_t *  hal,
uint32_t  entry_count 
)

Allocate a new EQ object.

A new EQ object is instantiated

Parameters
halpointer to HAL object
entry_countnumber of entries in the EQ
Returns
pointer to allocated EQ object

Definition at line 433 of file ocs_hal_queues.c.

hal_mq_t* hal_new_mq ( hal_cq_t *  cq,
uint32_t  entry_count 
)

Allocate a new MQ object.

A new MQ object is instantiated

Parameters
cqpointer to parent CQ object
entry_countnumber of entries in the MQ
Returns
pointer to allocated MQ object

Definition at line 581 of file ocs_hal_queues.c.

hal_rq_t* hal_new_rq ( hal_cq_t *  cq,
uint32_t  entry_count,
uint32_t  ulp 
)

Allocate a hal_rq_t object.

Allocate an RQ object, which encapsulates 2 SLI queues (for rq pair)

Parameters
cqpointer to parent CQ object
entry_countnumber of entries in the RQs
ulpULP index for this RQ
Returns
pointer to newly allocated hal_rq_t

Definition at line 668 of file ocs_hal_queues.c.

uint32_t hal_new_rq_set ( hal_cq_t *  cqs[],
hal_rq_t *  rqs[],
uint32_t  num_rq_pairs,
uint32_t  entry_count,
uint32_t  ulp 
)

Allocate a hal_rq_t object SET.

Allocate an RQ object SET, where each element in set encapsulates 2 SLI queues (for rq pair)

Parameters
cqspointers to be associated with RQs.
rqsRQ pointers to be returned on success.
num_rq_pairsnumber of rq pairs in the Set.
entry_countnumber of entries in the RQs
ulpULP index for this RQ
Returns
0 in success and -1 on failure.

Definition at line 747 of file ocs_hal_queues.c.

hal_wq_t* hal_new_wq ( hal_cq_t *  cq,
uint32_t  entry_count,
uint32_t  class,
uint32_t  ulp 
)

Allocate a new WQ object.

A new WQ object is instantiated

Parameters
cqpointer to parent CQ object
entry_countnumber of entries in the WQ
classWQ class
ulpindex of chute
Returns
pointer to allocated WQ object

Definition at line 623 of file ocs_hal_queues.c.

void hal_queue_dump ( ocs_hal_t *  hal)

Display HAL queue objects.

The HAL queue objects are displayed using ocs_log

Parameters
halpointer to HAL object
Returns
none

Definition at line 967 of file ocs_hal_queues.c.

void hal_queue_teardown ( ocs_hal_t *  hal)

Teardown HAL queue objects.

The HAL queue objects are freed

Parameters
halpointer to HAL object
Returns
none

Definition at line 1012 of file ocs_hal_queues.c.

static int32_t idchar ( int  c)
static

test if character is an ID character

Parameters
ccharacter to test
Returns
TRUE if character is an ID character

Definition at line 1233 of file ocs_hal_queues.c.

static int32_t idstart ( int  c)
static

test if character is ID start character

Parameters
ccharacter to test
Returns
TRUE if character is an ID start character

Definition at line 1220 of file ocs_hal_queues.c.

ocs_hal_rtn_e ocs_hal_init_queues ( ocs_hal_t *  hal,
ocs_hal_qtop_t *  qtop 
)

Initialize queues.

Given the parsed queue topology spec, the SLI queues are created and initialized

Parameters
halpointer to HAL object
qtoppointer to queue topology
Returns
returns 0 for success, an error code value for failure.

Definition at line 56 of file ocs_hal_queues.c.

uint32_t ocs_hal_qtop_eq_count ( ocs_hal_t *  hal)

Return count of EQs for a queue topology object.

The EQ count for in the HALs queue topology (hal->qtop) object is returned

Parameters
halpointer to HAL object
Returns
count of EQs

Definition at line 1097 of file ocs_hal_queues.c.

void ocs_hal_qtop_free ( ocs_hal_qtop_t *  qtop)

free queue topology object

Parameters
qtoppointer to QTOP object
Returns
none

Definition at line 1765 of file ocs_hal_queues.c.

ocs_hal_qtop_t* ocs_hal_qtop_parse ( ocs_hal_t *  hal,
const char *  qtop_string 
)

Parse queue topology string.

The queue topology object is allocated, and filled with the results of parsing the passed in queue topology string

Parameters
halpointer to HAL object
qtop_stringinput queue topology string
Returns
pointer to allocated QTOP object, or NULL if there was an error

Definition at line 1687 of file ocs_hal_queues.c.

hal_wq_t* ocs_hal_queue_next_wq ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Allocate a WQ to an IO object.

The next work queue index is used to assign a WQ to an IO.

If wq_steering is OCS_HAL_WQ_STEERING_CLASS, a WQ from io->wq_class is selected.

If wq_steering is OCS_HAL_WQ_STEERING_REQUEST, then a WQ from the EQ that the IO request came in on is selected.

If wq_steering is OCS_HAL_WQ_STEERING_CPU, then a WQ associted with the CPU the request is made on is selected.

Parameters
halpointer to HAL object
iopointer to IO object
Returns
Return pointer to next WQ

Definition at line 1053 of file ocs_hal_queues.c.

static int32_t parse_topology ( ocs_hal_t *  hal,
tokarray_t *  tokarray,
ocs_hal_qtop_t *  qtop 
)
static

parse an array of tokens

The tokens are semantically parsed, to generate QTOP entries.

Parameters
halpointer to HAL object
tokarrayarray array of tokens
qtopouptut QTOP object
Returns
returns 0 for success, a negative error code value for failure.

Definition at line 1509 of file ocs_hal_queues.c.

static ocs_hal_qtop_entry_e subtype2qtop ( tok_subtype_e  q)
static

convert queue subtype to QTOP entry

Parameters
qqueue subtype
Returns
QTOP entry or 0

Definition at line 1170 of file ocs_hal_queues.c.

static uint32_t tok_getnumber ( ocs_hal_t *  hal,
ocs_hal_qtop_t *  qtop,
tok_t *  tok 
)
static

parse a number

Parses tokens of type TOK_NUMBER and TOK_NUMBER_VALUE, returning a numeric value

Parameters
halpointer to HAL object
qtoppointer to QTOP object
tokpointer to token to parse
Returns
numeric value

Definition at line 1456 of file ocs_hal_queues.c.

static void tok_syntax ( ocs_hal_t *  hal,
tokarray_t *  tokarray 
)
static

Generate syntax error message.

A syntax error message is found, the input tokens are dumped up to and including the token that failed as indicated by the current iterator index.

Parameters
halpointer to HAL object
tokarraypointer to token array object
Returns
none

Definition at line 1431 of file ocs_hal_queues.c.

static const char* token_subtype2s ( tok_subtype_e  subtype)
static

convert token sub-type to string

Parameters
subtypetoken sub-type
Returns
string, or "unknown"

Definition at line 1399 of file ocs_hal_queues.c.

static const char* token_type2s ( tok_type_e  type)
static

convert token type to string

Parameters
typetoken type
Returns
string, or "unknown"

Definition at line 1373 of file ocs_hal_queues.c.

static const char* tokenize ( const char *  s,
tok_t *  tok 
)
static

Scan string and return next token.

The string is scanned and the next token is returned

Parameters
sinput string to scan
tokpointer to place scanned token
Returns
pointer to input string following scanned token, or NULL

Definition at line 1276 of file ocs_hal_queues.c.

Variable Details

tokmatch_t cmatches[]
static
Initial value:

Declare single character matches.

Definition at line 1241 of file ocs_hal_queues.c.