DPDK  22.03.0
Data Structures | Functions
rte_swx_table_learner.h File Reference
#include <stdint.h>
#include <rte_compat.h>

Go to the source code of this file.

Data Structures

struct  rte_swx_table_learner_params
 

Functions

__rte_experimental uint64_t rte_swx_table_learner_footprint_get (struct rte_swx_table_learner_params *params)
 
__rte_experimental uint64_t rte_swx_table_learner_mailbox_size_get (void)
 
__rte_experimental void * rte_swx_table_learner_create (struct rte_swx_table_learner_params *params, int numa_node)
 
__rte_experimental int rte_swx_table_learner_lookup (void *table, void *mailbox, uint64_t time, uint8_t **key, uint64_t *action_id, uint8_t **action_data, int *hit)
 
__rte_experimental uint32_t rte_swx_table_learner_add (void *table, void *mailbox, uint64_t time, uint64_t action_id, uint8_t *action_data)
 
__rte_experimental void rte_swx_table_learner_delete (void *table, void *mailbox)
 
__rte_experimental void rte_swx_table_learner_free (void *table)
 

Detailed Description

RTE SWX Learner Table

The learner table API.

This table type is typically used for learning or connection tracking, where it allows for the implementation of the "add on miss" scenario: whenever the lookup key is not found in the table (lookup miss), the data plane can decide to add this key to the table with a given action with no control plane intervention. Likewise, the table keys expire based on a configurable timeout and are automatically deleted from the table with no control plane intervention.

Definition in file rte_swx_table_learner.h.

Function Documentation

◆ rte_swx_table_learner_footprint_get()

__rte_experimental uint64_t rte_swx_table_learner_footprint_get ( struct rte_swx_table_learner_params params)

Learner table memory footprint get

Parameters
[in]paramsTable create parameters.
Returns
Table memory footprint in bytes.

◆ rte_swx_table_learner_mailbox_size_get()

__rte_experimental uint64_t rte_swx_table_learner_mailbox_size_get ( void  )

Learner table mailbox size get

The mailbox is used to store the context of a lookup operation that is in progress and it is passed as a parameter to the lookup operation. This allows for multiple concurrent lookup operations into the same table.

Returns
Table mailbox footprint in bytes.

◆ rte_swx_table_learner_create()

__rte_experimental void* rte_swx_table_learner_create ( struct rte_swx_table_learner_params params,
int  numa_node 
)

Learner table create

Parameters
[in]paramsTable creation parameters.
[in]numa_nodeNon-Uniform Memory Access (NUMA) node.
Returns
Table handle, on success, or NULL, on error.

◆ rte_swx_table_learner_lookup()

__rte_experimental int rte_swx_table_learner_lookup ( void *  table,
void *  mailbox,
uint64_t  time,
uint8_t **  key,
uint64_t *  action_id,
uint8_t **  action_data,
int *  hit 
)

Learner table key lookup

The table lookup operation searches a given key in the table and upon its completion it returns an indication of whether the key is found in the table (lookup hit) or not (lookup miss). In case of lookup hit, the action_id and the action_data associated with the key are also returned.

Multiple invocations of this function may be required in order to complete a single table lookup operation for a given table and a given lookup key. The completion of the table lookup operation is flagged by a return value of 1; in case of a return value of 0, the function must be invoked again with exactly the same arguments.

The mailbox argument is used to store the context of an on-going table key lookup operation, and possibly an associated key add operation. The mailbox mechanism allows for multiple concurrent table key lookup and add operations into the same table.

Parameters
[in]tableTable handle.
[in]mailboxMailbox for the current table lookup operation.
[in]timeCurrent time measured in CPU clock cycles.
[in]keyLookup key. Its size must be equal to the table key_size.
[out]action_idID of the action associated with the key. Must point to a valid 64-bit variable. Only valid when the function returns 1 and hit is set to true.
[out]action_dataAction data for the action_id action. Must point to a valid array of table action_data_size bytes. Only valid when the function returns 1 and hit is set to true.
[out]hitOnly valid when the function returns 1. Set to non-zero (true) on table lookup hit and to zero (false) on table lookup miss.
Returns
0 when the table lookup operation is not yet completed, and 1 when the table lookup operation is completed. No other return values are allowed.

◆ rte_swx_table_learner_add()

__rte_experimental uint32_t rte_swx_table_learner_add ( void *  table,
void *  mailbox,
uint64_t  time,
uint64_t  action_id,
uint8_t *  action_data 
)

Learner table key add

This operation takes the latest key that was looked up in the table and adds it to the table with the given action ID and action data. Typically, this operation is only invoked when the latest lookup operation in the current table resulted in lookup miss.

Parameters
[in]tableTable handle.
[in]mailboxMailbox for the current operation.
[in]timeCurrent time measured in CPU clock cycles.
[out]action_idID of the action associated with the key.
[out]action_dataAction data for the action_id action.
Returns
0 on success, 1 or error (table full).

◆ rte_swx_table_learner_delete()

__rte_experimental void rte_swx_table_learner_delete ( void *  table,
void *  mailbox 
)

Learner table key delete

This operation takes the latest key that was looked up in the table and deletes it from the table. Typically, this operation is only invoked to force the deletion of the key before the key expires on timeout due to inactivity.

Parameters
[in]tableTable handle.
[in]mailboxMailbox for the current operation.

◆ rte_swx_table_learner_free()

__rte_experimental void rte_swx_table_learner_free ( void *  table)

Learner table free

Parameters
[in]tableTable handle.