table

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package table implements RTE Table.

This tool is part of the DPDK Packet Framework tool suite and provides a standard interface to implement different types of lookup tables for data plane processing.

Virtually any search algorithm that can uniquely associate data to a lookup key can be fitted under this lookup table abstraction. For the flow table use-case, the lookup key is an n-tuple of packet fields that uniquely identifies a traffic flow, while data represents actions and action meta-data associated with the same traffic flow.

Index

Constants

This section is empty.

Variables

View Source
var (
	HashExtOps    = (*Ops)(&C.rte_table_hash_ext_ops)
	HashLruOps    = (*Ops)(&C.rte_table_hash_lru_ops)
	HashCuckooOps = (*Ops)(&C.rte_table_hash_cuckoo_ops)
)

Table ops implementations.

View Source
var (
	// LPMOps is the LPM IPv4 ops.
	LPMOps = (*Ops)(&C.rte_table_lpm_ops)

	// LPM6Ops is the LPM IPv6 ops.
	LPM6Ops = (*Ops)(&C.rte_table_lpm_ipv6_ops)
)

Functions

This section is empty.

Types

type ACLField

type ACLField [C.sizeof_struct_rte_acl_field / 8]uint64

ACLField describes a field to match.

func NewACLField16

func NewACLField16(value, maskRange uint16) ACLField

NewACLField16 returns ACLField with 16-bit value and range mask.

func NewACLField32

func NewACLField32(value, maskRange uint32) ACLField

NewACLField32 returns ACLField with 32-bit value and range mask.

func NewACLField64

func NewACLField64(value, maskRange uint64) ACLField

NewACLField64 returns ACLField with 64-bit value and range mask.

func NewACLField8

func NewACLField8(value, maskRange uint8) ACLField

NewACLField8 returns ACLField with 8-bit value and range mask.

type ACLFieldDef

type ACLFieldDef struct {
	Type       uint8  // type - RTE_ACL_FIELD_TYPE_*.
	Size       uint8  // size of field 1,2,4, or 8.
	FieldIndex uint8  // index of field inside the rule.
	InputIndex uint8  // 0-N input index.
	Offset     uint32 // offset to start of field.
}

ACLFieldDef is the ACL Field definition. Each field in the ACL rule has an associate definition. It defines the type of field, its size, its offset in the input buffer, the field index, and the input index. For performance reasons, the inner loop of the search function is unrolled to process four input bytes at a time. This requires the input to be grouped into sets of 4 consecutive bytes. The loop processes the first input byte as part of the setup and then subsequent bytes must be in groups of 4 consecutive bytes.

type ACLParams

type ACLParams struct {
	Name        string        // Name.
	Rules       uint32        // Maximum number of ACL rules in the table.
	FieldFormat []ACLFieldDef // Format specification of the fields of the ACL rule.
}

ACLParams is the ACL table parameters.

func (*ACLParams) Ops

func (p *ACLParams) Ops() *Ops

Ops implements Params interface.

func (*ACLParams) Transform

func (p *ACLParams) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type ACLRuleAdd

type ACLRuleAdd struct {
	Priority   int32
	FieldValue [C.RTE_ACL_MAX_FIELDS]ACLField
}

ACLRuleAdd is the key for adding a key/value to a table.

type ACLRuleDelete

type ACLRuleDelete struct {
	FieldValue [C.RTE_ACL_MAX_FIELDS]ACLField
}

ACLRuleDelete is the key for deleting a key/value from a table.

type ArrayKey

type ArrayKey struct {
	Pos uint32
}

ArrayKey is the key for adding/deleting key from table.

type ArrayParams

type ArrayParams struct {
	// Number of array entries. Has to be a power of two.
	Entries uint32

	// Byte offset within input packet meta-data where lookup key
	// (i.e. the array entry index) is located.
	Offset uint32
}

ArrayParams is the Array table parameters.

func (*ArrayParams) Ops

func (p *ArrayParams) Ops() *Ops

Ops implements Params interface.

func (*ArrayParams) Transform

func (p *ArrayParams) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type HashFunc

type HashFunc C.rte_hash_function

HashFunc is the signature of hash function used for Cuckoo-Hash table implementation.

var (
	// Crc32Hash is the DPDK CRC32 hash function.
	Crc32Hash HashFunc = (HashFunc)(C.go_crc32f)
)

type HashOpHash

type HashOpHash C.rte_table_hash_op_hash

HashOpHash is the signature of hash function used for Hash table implementation.

type HashParams

type HashParams struct {
	// Set this to desired Hash*Ops variable.
	TableOps *Ops

	// Name.
	Name string

	// Key size (number of bytes).
	KeySize uint32

	// Byte offset within packet meta-data where the key is located
	KeyOffset uint32

	// Key mask.
	KeyMask []byte

	// Number of keys.
	KeysNum uint32

	// Number of buckets.
	BucketsNum uint32

	// Hash function.
	Hash struct {
		Func HashOpHash
		Seed uint64
	}

	// Hash function for HashCuckooOps.
	CuckooHash struct {
		Func HashFunc
		Seed uint32
	}
}

HashParams is the Hash table parameters.

func (*HashParams) Ops

func (p *HashParams) Ops() *Ops

Ops implements Params interface.

func (*HashParams) Transform

func (p *HashParams) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type LPM6Key

type LPM6Key struct {
	// IP address.
	IP [C.RTE_LPM_IPV6_ADDR_SIZE]byte

	// IP address depth. The most significant "depth" bits of the IP
	// address specify the network part of the IP address, while the
	// rest of the bits specify the host part of the address and are
	// ignored for the purpose of route specification.
	Depth uint8
}

LPM6Key is the insert key for LPM IPv4 table.

type LPMKey

type LPMKey struct {
	// IP address.
	IP uint32

	// IP address depth. The most significant "depth" bits of the IP
	// address specify the network part of the IP address, while the
	// rest of the bits specify the host part of the address and are
	// ignored for the purpose of route specification.
	Depth uint8
	// contains filtered or unexported fields
}

LPMKey is the insert key for LPM IPv4 table.

type LPMParams

type LPMParams struct {
	TableOps *Ops

	// Name.
	Name string

	// Number of rules.
	Rules uint32

	// Field is currently unused.
	NumTBL8 uint32

	// Number of bytes at the start of the table entry that uniquely
	// identify the entry. Cannot be bigger than table entry size.
	EntryUniqueSize uint32

	// Byte offset within input packet meta-data where lookup key
	// (i.e. the destination IP address) is located.
	Offset uint32
}

LPMParams is the Hash table parameters.

func (*LPMParams) Ops added in v0.0.11

func (p *LPMParams) Ops() *Ops

Ops implements Params interface.

func (*LPMParams) Transform

func (p *LPMParams) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type Ops

Ops is the function table implementing table.

type Params

type Params interface {
	common.Transformer
	Ops() *Ops
}

Params is the parameters for creating a table.

type Stats

type Stats struct {
	PacketsIn         uint64
	PacketsLookupMiss uint64
}

Stats is a table statistics.

type StubParams

type StubParams struct{}

StubParams is the empty parameters for Stub table.

func (*StubParams) Ops

func (p *StubParams) Ops() *Ops

Ops implements Params interface.

func (*StubParams) Transform

func (p *StubParams) Transform(alloc common.Allocator) (unsafe.Pointer, func(unsafe.Pointer))

Transform implements common.Transformer interface.

type Table

type Table [0]byte

Table is the instance of a lookup table.

func Create

func Create(socket int, p Params, entrySize uint32) *Table

Create a table manually. May return nil pointer in case of an error.

func (*Table) Free

func (t *Table) Free(tableOps *Ops) error

Free deletes a table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL