Documentation
¶
Overview ¶
Package lpm wraps RTE LPM library.
Please refer to DPDK Programmer's Guide for reference and caveats.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindExisting ¶
FindExisting finds an existing LPM object and return a pointer to it.
Specify pointer to *LPM or *LPM6 in ptr to find respective object by its memzone name.
Example ¶
package main import ( "github.com/rksawyer/go-dpdk/lpm" ) func main() { // find LPM for IPv4 lookups. var myLPM *lpm.LPM if err := lpm.FindExisting("my_lpm_object", &myLPM); err != nil { panic(err) } // find LPM6 for IPv6 lookups. var myLPM6 *lpm.LPM6 if err := lpm.FindExisting("my_lpm6_object", &myLPM6); err != nil { panic(err) } }
Types ¶
type LPM ¶
type LPM C.struct_rte_lpm
LPM is an RTE Longest Prefix Match lookup object.
func Create ¶
Create an LPM object.
Specify name as an LPM object name, socket_id as a NUMA socket ID for LPM table memory allocation and config as a structure containing the configuration.
Returns handle to LPM object on success, and errno value:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure E_RTE_SECONDARY - function was called from a secondary process instance EINVAL - invalid parameter passed to function ENOSPC - the maximum number of memzones has already been allocated EEXIST - a memzone with the same name already exists ENOMEM - no appropriate memory area found in which to create memzone
func (*LPM) Add ¶
Add a rule to LPM object. Panics if ipnet is not IPv4 subnet.
ip/prefix is an IP address/subnet to add, nextHop is a value associated with added IP subnet.
func (*LPM) IsRulePresent ¶
IsRulePresent checks if a rule present in the LPM and returns nextHop if it is. Panics if ipnet is not IPv4 subnet.
type LPM6 ¶
type LPM6 C.struct_rte_lpm6
LPM6 is an RTE Longest Prefix Match lookup object.
func Create6 ¶
Create6 an LPM6 object.
Specify name as an LPM6 object name, socket_id as a NUMA socket ID for LPM6 table memory allocation and config as a structure containing the configuration.
Returns handle to LPM6 object on success, and errno value:
E_RTE_NO_CONFIG - function could not get pointer to rte_config structure E_RTE_SECONDARY - function was called from a secondary process instance EINVAL - invalid parameter passed to function ENOSPC - the maximum number of memzones has already been allocated EEXIST - a memzone with the same name already exists ENOMEM - no appropriate memory area found in which to create memzone
func (*LPM6) Add ¶
Add a rule to LPM6 object.
ip/prefix is an IP address/subnet to add, nextHop is a value associated with added IP subnet. Panics if ip is not IPv6.
func (*LPM6) IsRulePresent ¶
IsRulePresent checks if a rule present in the LPM6 and returns nextHop if it is. Panics if ip is not IPv6.