.TH "rte_lpm.h" 3 "Version 24.11.4" "DPDK" \" -*- nroff -*-
.ad l
.nh
.SH NAME
rte_lpm.h
.SH SYNOPSIS
.br
.PP
\fC#include <errno\&.h>\fP
.br
\fC#include <stdalign\&.h>\fP
.br
\fC#include <stdint\&.h>\fP
.br
\fC#include <rte_branch_prediction\&.h>\fP
.br
\fC#include <rte_byteorder\&.h>\fP
.br
\fC#include <rte_common\&.h>\fP
.br
\fC#include <rte_vect\&.h>\fP
.br
\fC#include <rte_rcu_qsbr\&.h>\fP
.br
\fC#include 'rte_lpm_scalar\&.h'\fP
.br

.SS "Data Structures"

.in +1c
.ti -1c
.RI "struct \fBrte_lpm_config\fP"
.br
.ti -1c
.RI "struct \fBrte_lpm_rcu_config\fP"
.br
.in -1c
.SS "Macros"

.in +1c
.ti -1c
.RI "#define \fBRTE_LPM_NAMESIZE\fP   32"
.br
.ti -1c
.RI "#define \fBRTE_LPM_MAX_DEPTH\fP   32"
.br
.ti -1c
.RI "#define \fBRTE_LPM_LOOKUP_SUCCESS\fP   0x01000000"
.br
.ti -1c
.RI "#define \fBrte_lpm_lookup_bulk\fP(lpm,  ips,  next_hops,  n)   		rte_lpm_lookup_bulk_func(lpm, ips, next_hops, n)"
.br
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBrte_lpm_qsbr_mode\fP { \fBRTE_LPM_QSBR_MODE_DQ\fP = 0, \fBRTE_LPM_QSBR_MODE_SYNC\fP }"
.br
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "struct rte_lpm * \fBrte_lpm_create\fP (const char *name, int socket_id, const struct \fBrte_lpm_config\fP *config)"
.br
.ti -1c
.RI "struct rte_lpm * \fBrte_lpm_find_existing\fP (const char *name)"
.br
.ti -1c
.RI "void \fBrte_lpm_free\fP (struct rte_lpm *lpm)"
.br
.ti -1c
.RI "int \fBrte_lpm_rcu_qsbr_add\fP (struct rte_lpm *lpm, struct \fBrte_lpm_rcu_config\fP *cfg)"
.br
.ti -1c
.RI "int \fBrte_lpm_add\fP (struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t next_hop)"
.br
.ti -1c
.RI "int \fBrte_lpm_is_rule_present\fP (struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t *next_hop)"
.br
.ti -1c
.RI "int \fBrte_lpm_delete\fP (struct rte_lpm *lpm, uint32_t ip, uint8_t depth)"
.br
.ti -1c
.RI "void \fBrte_lpm_delete_all\fP (struct rte_lpm *lpm)"
.br
.ti -1c
.RI "static int \fBrte_lpm_lookup\fP (const struct rte_lpm *lpm, uint32_t ip, uint32_t *next_hop)"
.br
.ti -1c
.RI "static void \fBrte_lpm_lookupx4\fP (const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], uint32_t defv)"
.br
.in -1c
.SH "Detailed Description"
.PP 
RTE Longest Prefix Match (LPM) 
.PP
Definition in file \fBrte_lpm\&.h\fP\&.
.SH "Macro Definition Documentation"
.PP 
.SS "#define RTE_LPM_NAMESIZE   32"
Max number of characters in LPM name\&. 
.PP
Definition at line \fB29\fP of file \fBrte_lpm\&.h\fP\&.
.SS "#define RTE_LPM_MAX_DEPTH   32"
Maximum depth value possible for IPv4 LPM\&. 
.PP
Definition at line \fB32\fP of file \fBrte_lpm\&.h\fP\&.
.SS "#define RTE_LPM_LOOKUP_SUCCESS   0x01000000"
Bitmask used to indicate successful lookup 
.PP
Definition at line \fB63\fP of file \fBrte_lpm\&.h\fP\&.
.SS "#define rte_lpm_lookup_bulk(lpm, ips, next_hops, n)   		rte_lpm_lookup_bulk_func(lpm, ips, next_hops, n)"
Lookup multiple IP addresses in an LPM table\&. This may be implemented as a macro, so the address of the function should not be used\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.br
\fIips\fP Array of IPs to be looked up in the LPM table 
.br
\fInext_hops\fP Next hop of the most specific rule found for IP (valid on lookup hit only)\&. This is an array of two byte values\&. The most significant byte in each value says whether the lookup was successful (bitmask RTE_LPM_LOOKUP_SUCCESS is set)\&. The least significant byte is the actual next hop\&. 
.br
\fIn\fP Number of elements in ips (and next_hops) array to lookup\&. This should be a compile time constant, and divisible by 8 for best performance\&. 
.RE
.PP
\fBReturns\fP
.RS 4
-EINVAL for incorrect arguments, otherwise 0 
.RE
.PP

.PP
Definition at line \fB332\fP of file \fBrte_lpm\&.h\fP\&.
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBrte_lpm_qsbr_mode\fP"
RCU reclamation modes 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fIRTE_LPM_QSBR_MODE_DQ \fP\fP
Create defer queue for reclaim\&. 
.TP
\fB\fIRTE_LPM_QSBR_MODE_SYNC \fP\fP
Use blocking mode reclaim\&. No defer queue created\&. 
.PP
Definition at line \fB69\fP of file \fBrte_lpm\&.h\fP\&.
.SH "Function Documentation"
.PP 
.SS "struct rte_lpm * rte_lpm_create (const char * name, int socket_id, const struct \fBrte_lpm_config\fP * config)"
Create an LPM object\&.
.PP
\fBParameters\fP
.RS 4
\fIname\fP LPM object name 
.br
\fIsocket_id\fP NUMA socket ID for LPM table memory allocation 
.br
\fIconfig\fP Structure containing the configuration 
.RE
.PP
\fBReturns\fP
.RS 4
Handle to LPM object on success, NULL otherwise with rte_errno set to an appropriate values\&. Possible rte_errno values include:
.IP "\(bu" 2
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
.IP "\(bu" 2
E_RTE_SECONDARY - function was called from a secondary process instance
.IP "\(bu" 2
EINVAL - invalid parameter passed to function
.IP "\(bu" 2
ENOSPC - the maximum number of memzones has already been allocated
.IP "\(bu" 2
EEXIST - a memzone with the same name already exists
.IP "\(bu" 2
ENOMEM - no appropriate memory area found in which to create memzone 
.PP
.RE
.PP

.SS "struct rte_lpm * rte_lpm_find_existing (const char * name)"
Find an existing LPM object and return a pointer to it\&.
.PP
\fBParameters\fP
.RS 4
\fIname\fP Name of the lpm object as passed to \fBrte_lpm_create()\fP 
.RE
.PP
\fBReturns\fP
.RS 4
Pointer to lpm object or NULL if object not found with rte_errno set appropriately\&. Possible rte_errno values include:
.IP "\(bu" 2
ENOENT - required entry not available to return\&. 
.PP
.RE
.PP

.SS "void rte_lpm_free (struct rte_lpm * lpm)"
Free an LPM object\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle If lpm is NULL, no operation is performed\&. 
.RE
.PP

.SS "int rte_lpm_rcu_qsbr_add (struct rte_lpm * lpm, struct \fBrte_lpm_rcu_config\fP * cfg)"
Associate RCU QSBR variable with an LPM object\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP the lpm object to add RCU QSBR 
.br
\fIcfg\fP RCU QSBR configuration 
.RE
.PP
\fBReturns\fP
.RS 4
On success - 0 On error - 1 with error code set in rte_errno\&. Possible rte_errno codes are:
.IP "\(bu" 2
EINVAL - invalid pointer
.IP "\(bu" 2
EEXIST - already added QSBR
.IP "\(bu" 2
ENOMEM - memory allocation failure 
.PP
.RE
.PP

.SS "int rte_lpm_add (struct rte_lpm * lpm, uint32_t ip, uint8_t depth, uint32_t next_hop)"
Add a rule to the LPM table\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.br
\fIip\fP IP of the rule to be added to the LPM table 
.br
\fIdepth\fP Depth of the rule to be added to the LPM table 
.br
\fInext_hop\fP Next hop of the rule to be added to the LPM table 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, negative value otherwise 
.RE
.PP

.SS "int rte_lpm_is_rule_present (struct rte_lpm * lpm, uint32_t ip, uint8_t depth, uint32_t * next_hop)"
Check if a rule is present in the LPM table, and provide its next hop if it is\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.br
\fIip\fP IP of the rule to be searched 
.br
\fIdepth\fP Depth of the rule to searched 
.br
\fInext_hop\fP Next hop of the rule (valid only if it is found) 
.RE
.PP
\fBReturns\fP
.RS 4
1 if the rule exists, 0 if it does not, a negative value on failure 
.RE
.PP

.SS "int rte_lpm_delete (struct rte_lpm * lpm, uint32_t ip, uint8_t depth)"
Delete a rule from the LPM table\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.br
\fIip\fP IP of the rule to be deleted from the LPM table 
.br
\fIdepth\fP Depth of the rule to be deleted from the LPM table 
.RE
.PP
\fBReturns\fP
.RS 4
0 on success, negative value otherwise 
.RE
.PP

.SS "void rte_lpm_delete_all (struct rte_lpm * lpm)"
Delete all rules from the LPM table\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.RE
.PP

.SS "static int rte_lpm_lookup (const struct rte_lpm * lpm, uint32_t ip, uint32_t * next_hop)\fC [inline]\fP, \fC [static]\fP"
Lookup an IP into the LPM table\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.br
\fIip\fP IP to be looked up in the LPM table 
.br
\fInext_hop\fP Next hop of the most specific rule found for IP (valid on lookup hit only) 
.RE
.PP
\fBReturns\fP
.RS 4
-EINVAL for incorrect arguments, -ENOENT on lookup miss, 0 on lookup hit 
.RE
.PP

.PP
Definition at line \fB279\fP of file \fBrte_lpm\&.h\fP\&.
.SS "static void rte_lpm_lookupx4 (const struct rte_lpm * lpm, xmm_t ip, uint32_t hop[4], uint32_t defv)\fC [inline]\fP, \fC [static]\fP"
Lookup four IP addresses in an LPM table\&.
.PP
\fBParameters\fP
.RS 4
\fIlpm\fP LPM object handle 
.br
\fIip\fP Four IPs to be looked up in the LPM table 
.br
\fIhop\fP Next hop of the most specific rule found for IP (valid on lookup hit only)\&. This is an 4 elements array of two byte values\&. If the lookup was successful for the given IP, then least significant byte of the corresponding element is the actual next hop and the most significant byte is zero\&. If the lookup for the given IP failed, then corresponding element would contain default value, see description of then next parameter\&. 
.br
\fIdefv\fP Default value to populate into corresponding element of hop[] array, if lookup would fail\&. 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for DPDK from the source code\&.
