FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
avf_fdir_lib.c File Reference
+ Include dependency graph for avf_fdir_lib.c:

Go to the source code of this file.

Macros

#define AVF_FDIR_IPV6_TC_OFFSET   20
 
#define AVF_IPV6_TC_MASK   (0xFF << AVF_FDIR_IPV6_TC_OFFSET)
 
#define AVF_FDIR_MAX_QREGION_SIZE   128
 

Functions

static int fls_u32 (u32 x)
 
static int ether_addr_is_zero (const struct avf_ether_addr *ea)
 
int avf_fdir_rcfg_create (struct avf_fdir_conf **rcfg, int tunnel_level, u16 vsi, u16 nrxq)
 Create a rule cfg object. More...
 
int avf_fdir_rcfg_destroy (struct avf_fdir_conf *rcfg)
 Destroy a rule cfg object. More...
 
int avf_fdir_rcfg_set_hdr (struct avf_fdir_conf *rcfg, int layer, enum virtchnl_proto_hdr_type hdr)
 Set match potocol header on specific layer, it will overwrite is already be set. More...
 
int avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, struct avf_flow_item *item, struct avf_flow_error *error)
 Set a match field on specific protocol layer, if any match field already be set on this layer, it will be overwritten. More...
 
int avf_fdir_rcfg_act_queue (struct avf_fdir_conf *rcfg, int queue, int size, int act_idx)
 Set action as to queue(group), conflict with drop action. More...
 
int avf_fdir_parse_action_qregion (struct avf_fdir_conf *rcfg, const struct avf_flow_action *act, int act_idx, struct avf_flow_error *error)
 Set action as to queue group, conflict with drop action. More...
 
int avf_fdir_rcfg_act_drop (struct avf_fdir_conf *rcfg, int act_idx)
 Set action as as drop, conflict with to queue(gropu) action. More...
 
int avf_fdir_rcfg_act_mark (struct avf_fdir_conf *rcfg, const u32 mark, int act_idx)
 Set action as mark, it can co-exist with to queue(group) or drop action. More...
 
int avf_fdir_rcfg_validate (struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
 Validate a flow rule cfg, check with PF driver if the rule cfg is supportted or not. More...
 
int avf_fdir_rule_create (struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
 Create a flow rule, a FDIR rule is expected to be programmed into hardware if return success. More...
 
int avf_fdir_rule_destroy (struct avf_fdir_vc_ctx *ctx, struct avf_fdir_conf *rcfg)
 Destroy a flow rule. More...
 
int avf_fdir_parse_action (const struct avf_flow_action actions[], struct avf_fdir_conf *rcfg, struct avf_flow_error *error)
 
int avf_fdir_parse_pattern (struct avf_fdir_conf *rcfg, struct avf_flow_item avf_items[], struct avf_flow_error *error)
 
int avf_flow_error_set (struct avf_flow_error *error, int code, enum avf_flow_error_type type, const void *cause, const char *message)
 Initialize flow error structure. More...
 
char * avf_fdir_prgm_error_decode (int err_no)
 

Macro Definition Documentation

◆ AVF_FDIR_IPV6_TC_OFFSET

#define AVF_FDIR_IPV6_TC_OFFSET   20

Definition at line 21 of file avf_fdir_lib.c.

◆ AVF_FDIR_MAX_QREGION_SIZE

#define AVF_FDIR_MAX_QREGION_SIZE   128

Definition at line 23 of file avf_fdir_lib.c.

◆ AVF_IPV6_TC_MASK

#define AVF_IPV6_TC_MASK   (0xFF << AVF_FDIR_IPV6_TC_OFFSET)

Definition at line 22 of file avf_fdir_lib.c.

Function Documentation

◆ avf_fdir_parse_action()

int avf_fdir_parse_action ( const struct avf_flow_action  actions[],
struct avf_fdir_conf rcfg,
struct avf_flow_error error 
)

Definition at line 672 of file avf_fdir_lib.c.

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

◆ avf_fdir_parse_action_qregion()

int avf_fdir_parse_action_qregion ( struct avf_fdir_conf rcfg,
const struct avf_flow_action act,
int  act_idx,
struct avf_flow_error error 
)

Set action as to queue group, conflict with drop action.

Parameters
rcfgthe rule cfg object
actflow actions
act_idxaction index @error save error cause
Returns
0 = successful. < 0 = failure.

Definition at line 507 of file avf_fdir_lib.c.

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

◆ avf_fdir_parse_pattern()

int avf_fdir_parse_pattern ( struct avf_fdir_conf rcfg,
struct avf_flow_item  avf_items[],
struct avf_flow_error error 
)

Definition at line 789 of file avf_fdir_lib.c.

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

◆ avf_fdir_prgm_error_decode()

char* avf_fdir_prgm_error_decode ( int  err_no)

Definition at line 827 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ avf_fdir_rcfg_act_drop()

int avf_fdir_rcfg_act_drop ( struct avf_fdir_conf rcfg,
int  act_idx 
)

Set action as as drop, conflict with to queue(gropu) action.

Parameters
rcfgthe rule cfg object
act_idxaction index
Returns
0 = successful. < 0 = failure.

Definition at line 564 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ avf_fdir_rcfg_act_mark()

int avf_fdir_rcfg_act_mark ( struct avf_fdir_conf rcfg,
const u32  mark,
int  act_idx 
)

Set action as mark, it can co-exist with to queue(group) or drop action.

Parameters
rcfgthe rule cfg object
marka 32 bit flow mark
act_idxaction index
Returns
0 = successful. < 0 = failure.

Definition at line 578 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ avf_fdir_rcfg_act_queue()

int avf_fdir_rcfg_act_queue ( struct avf_fdir_conf rcfg,
int  queue,
int  size,
int  act_idx 
)

Set action as to queue(group), conflict with drop action.

Parameters
rcfgrule cfg object
queuequeue id.
sizequeue group size, must be 2^n. 1 means only to single queue.
act_idxaction index
Returns
0 = successful. < 0 = failure.

Definition at line 486 of file avf_fdir_lib.c.

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

◆ avf_fdir_rcfg_create()

int avf_fdir_rcfg_create ( struct avf_fdir_conf **  rcfg,
int  tunnel_level,
u16  vsi,
u16  nrxq 
)

Create a rule cfg object.

Parameters
rcfgcreated rule cfg object.
tunneltunnel level where protocol header start from 0 from moster outer layer. 1 from first inner layer. 2 form second inner layer. ...
vsiavf vsi id
nrxqthe rx queue number of the avf
Returns
0 = successful. < 0 = failure.

Definition at line 43 of file avf_fdir_lib.c.

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

◆ avf_fdir_rcfg_destroy()

int avf_fdir_rcfg_destroy ( struct avf_fdir_conf rcfg)

Destroy a rule cfg object.

Parameters
rcfgthe cfg object to destroy.
Returns
0 = successful. < 0 = failure.

Definition at line 62 of file avf_fdir_lib.c.

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

◆ avf_fdir_rcfg_set_field()

int avf_fdir_rcfg_set_field ( struct avf_fdir_conf rcfg,
int  layer,
struct avf_flow_item item,
struct avf_flow_error error 
)

Set a match field on specific protocol layer, if any match field already be set on this layer, it will be overwritten.

Parameters
rcfgthe rule cfg object
layerlayer of the protocol header.
itemflow item
errorsave error cause
Returns
0 = successful. < 0 = failure.

Definition at line 85 of file avf_fdir_lib.c.

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

◆ avf_fdir_rcfg_set_hdr()

int avf_fdir_rcfg_set_hdr ( struct avf_fdir_conf rcfg,
int  layer,
enum virtchnl_proto_hdr_type  hdr 
)

Set match potocol header on specific layer, it will overwrite is already be set.

Parameters
rcfgthe rule cfg object
layerlayer of the protocol header.
hdrprotocol header type.
Returns
0 = successful. < 0 = failure.

Definition at line 70 of file avf_fdir_lib.c.

◆ avf_fdir_rcfg_validate()

int avf_fdir_rcfg_validate ( struct avf_fdir_vc_ctx ctx,
struct avf_fdir_conf rcfg 
)

Validate a flow rule cfg, check with PF driver if the rule cfg is supportted or not.

Parameters
ctxvirtual channel context
rcfgthe rule cfg object.
Returns
0 = successful. < 0 = failure.

Definition at line 594 of file avf_fdir_lib.c.

◆ avf_fdir_rule_create()

int avf_fdir_rule_create ( struct avf_fdir_vc_ctx ctx,
struct avf_fdir_conf rcfg 
)

Create a flow rule, a FDIR rule is expected to be programmed into hardware if return success.

Parameters
ctxvirtual channel context
rcfgrule cfg object.
Returns
0 = successfule. < 0 = failure.

Definition at line 620 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ avf_fdir_rule_destroy()

int avf_fdir_rule_destroy ( struct avf_fdir_vc_ctx ctx,
struct avf_fdir_conf rcfg 
)

Destroy a flow rule.

Parameters
ctxvirtual channel context
rcfgthe rule cfg object.
Returns
0 = successfule. < 0 = failure.

Definition at line 647 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ avf_flow_error_set()

int avf_flow_error_set ( struct avf_flow_error error,
int  code,
enum avf_flow_error_type  type,
const void *  cause,
const char *  message 
)

Initialize flow error structure.

Parameters
[out]errorPointer to flow error structure (may be NULL).
codeRelated error code
typeCause field and error types.
causeObject responsible for the error.
messageHuman-readable error message.
Returns
Negative error code (errno value)

Definition at line 810 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ ether_addr_is_zero()

static int ether_addr_is_zero ( const struct avf_ether_addr ea)
inlinestatic

Definition at line 35 of file avf_fdir_lib.c.

+ Here is the caller graph for this function:

◆ fls_u32()

static int fls_u32 ( u32  x)
inlinestatic

Definition at line 29 of file avf_fdir_lib.c.

+ Here is the caller graph for this function: