Data Accelerator Offload
|
#include <assert.h>
#include <errno.h>
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rte_common.h>
#include <rte_compat.h>
#include <rte_debug.h>
#include <rte_graph.h>
#include <rte_graph_worker.h>
Go to the source code of this file.
Macros | |
#define | DAO_GRAPH_FEATURE_ARC_INITIALIZER ((dao_graph_feature_arc_t)UINT64_MAX) |
#define | DAO_GRAPH_FEATURE_MAX_PER_ARC 64 |
#define | DAO_GRAPH_FEATURE_ARC_NAMELEN RTE_NODE_NAMESIZE |
Typedefs | |
typedef uint64_t | dao_graph_feature_arc_t |
typedef uint8_t | dao_graph_feature_t |
Functions | |
int | dao_graph_feature_arc_init (int max_feature_arcs) |
int | dao_graph_feature_arc_create (const char *feature_arc_name, int max_features, int max_indexes, struct rte_node_register *start_node, dao_graph_feature_arc_t *_dfl) |
int | dao_graph_feature_arc_lookup_by_name (const char *arc_name, dao_graph_feature_arc_t *_dfl) |
int | dao_graph_feature_add (dao_graph_feature_arc_t _dfl, struct rte_node_register *feature_node, const char *runs_after, const char *runs_before) |
int | dao_graph_feature_enable (dao_graph_feature_arc_t _dfl, uint32_t index, const char *feature_name, int64_t data) |
int | dao_graph_feature_validate (dao_graph_feature_arc_t _dfl, uint32_t index, const char *feature_name, int is_enable_disable) |
int | dao_graph_feature_disable (dao_graph_feature_arc_t _dfl, uint32_t index, const char *feature_name) |
int | dao_graph_feature_destroy (dao_graph_feature_arc_t _dfl, const char *feature_name) |
int | dao_graph_feature_arc_destroy (dao_graph_feature_arc_t _dfl) |
int | dao_graph_feature_arc_cleanup (void) |
Define APIs and structures/variables with respect to
A feature arc represents an ordered list of features/protocols at a given networking layer. Feature arc provides a high level abstraction to connect various rte_graph nodes, designated as feature nodes, and allowing steering of packets across these feature nodes fast path processing in a generic manner. In a typical network stack, often a protocol or feature must be first enabled on a given interface, before any packet received on that interface is steered to feature processing. For eg: incoming IPv4 packets are sent to routing sub-system only after a valid IPv4 address is assigned to the received interface. In other words, often packets needs to be steered across features not based on the packet content but based on whether feature is enable or disable on a given incoming/outgoing interface. Feature arc provides mechanism to enable/disable feature(s) on each interface and allowing seamless packet steering across enabled feature nodes in fast path.
Feature arc also provides a way to steer packets from standard nodes to custom/user-defined feature nodes without any change in standard node's fast path functions
On a given interface multiple feature(s) might be enabled in a particular feature arc. For instance, both "ipv4-output" and "IPsec policy output" features may be enabled on "eth0" interface in "L3-output" feature arc. Similarly, "ipv6-output" and "ipsec-output" may be enabled on "eth1" interface in same "L3-output" feature arc.
When multiple features are present in a given feature arc, its imperative to allow each feature processing in a particular sequential order. For instance, in "L3-input" feature arc it may be required to run "IPsec input" feature first, for packet decryption, before "ip-lookup". So a sequential order must be maintained among features present in a feature arc.
Features are enabled/disabled multiple times at runtime to some or all available interfaces present in the system. Features can be enabled/disabled even after rte_graph_create() is called. Enable/disabling features on one interface is independent of other interface.
A given feature might consume packet (if it's configured to consume) or may forward it to next enabled feature. For instance, "IPsec input" feature may consume/drop all packets with "Protect" policy action while all packets with policy action as "Bypass" may be forwarded to next enabled feature (with in same feature arc)
This library facilitates rte graph based applications to steer packets in fast path to different feature nodes with-in a feature arc and support all functionalities described above
In order to use feature-arc APIs, applications needs to do following in control path:
In fast path, nodes uses
dao_graph_feature_enable()/dao_graph_feature_disable() APIs are not thread-safe hence must be called by single core while other cores are not using any fast path feature arc APIs.
Definition in file dao_graph_feature_arc.h.
#define DAO_GRAPH_FEATURE_ARC_INITIALIZER ((dao_graph_feature_arc_t)UINT64_MAX) |
< Initializer value for dao_graph_feature_arc_t Initializer value for dao_graph_feature_arc_t
Definition at line 105 of file dao_graph_feature_arc.h.
#define DAO_GRAPH_FEATURE_MAX_PER_ARC 64 |
Max number of features supported in a given feature arc
Definition at line 109 of file dao_graph_feature_arc.h.
#define DAO_GRAPH_FEATURE_ARC_NAMELEN RTE_NODE_NAMESIZE |
Length of feature arc name
Definition at line 112 of file dao_graph_feature_arc.h.
typedef uint64_t dao_graph_feature_arc_t |
dao_graph feature arc object
Definition at line 118 of file dao_graph_feature_arc.h.
typedef uint8_t dao_graph_feature_t |
dao_graph feature object
Definition at line 121 of file dao_graph_feature_arc.h.
int dao_graph_feature_arc_init | ( | int | max_feature_arcs | ) |
Initialize feature arc subsystem
max_feature_arcs | Maximum number of feature arcs required to be supported |
int dao_graph_feature_arc_create | ( | const char * | feature_arc_name, |
int | max_features, | ||
int | max_indexes, | ||
struct rte_node_register * | start_node, | ||
dao_graph_feature_arc_t * | _dfl | ||
) |
Create a feature arc
feature_arc_name | Feature arc name with max length of DAO_GRAPH_FEATURE_ARC_NAMELEN | |
max_features | Maximum number of features to be supported in this feature arc | |
max_indexes | Maximum number of interfaces/ports/indexes to be supported | |
start_node | Base node where this feature arc's features are checked in fast path | |
[out] | _dfl | Feature arc object |
int dao_graph_feature_arc_lookup_by_name | ( | const char * | arc_name, |
dao_graph_feature_arc_t * | _dfl | ||
) |
Get feature arc object with name
arc_name | Feature arc name provided to successful dao_graph_feature_arc_create | |
[out] | _dfl | Feature arc object returned |
int dao_graph_feature_add | ( | dao_graph_feature_arc_t | _dfl, |
struct rte_node_register * | feature_node, | ||
const char * | runs_after, | ||
const char * | runs_before | ||
) |
Add a feature to already created feature arc
_dfl | Feature arc handle returned from dao_graph_feature_arc_create() |
feature_node | Graph node representing feature. On success, feature_node is next_node of feature_arc->start_node |
runs_after | Add this feature_node after already added "runs_after". Creates start_node -> runs_after -> this_feature sequence |
runs_before | Add this feature_node before already added "runs_before". Creates start_node -> this_feature -> runs_before sequence |
Must be called before rte_graph_create
int dao_graph_feature_enable | ( | dao_graph_feature_arc_t | _dfl, |
uint32_t | index, | ||
const char * | feature_name, | ||
int64_t | data | ||
) |
Enable feature within a feature arc
Must be called after rte_graph_create(). API is NOT Thread-safe
_dfl | Feature arc object returned by dao_graph_feature_arc_create or dao_graph_feature_arc_lookup_by_name |
index | Application specific index. Can be corresponding to interface_id/port_id etc |
feature_name | Name of the node which is already added via dao_graph_feature_add |
data | Application specific data which is retrieved in fast path |
int dao_graph_feature_validate | ( | dao_graph_feature_arc_t | _dfl, |
uint32_t | index, | ||
const char * | feature_name, | ||
int | is_enable_disable | ||
) |
Validate whether subsequent enable/disable feature would succeed or not API is thread-safe
_dfl | Feature arc object returned by dao_graph_feature_arc_create or dao_graph_feature_arc_lookup_by_name |
index | Application specific index. Can be corresponding to interface_id/port_id etc |
feature_name | Name of the node which is already added via dao_graph_feature_add |
is_enable_disable | If 1, validate whether subsequent dao_graph_feature_enable would pass or not If 0, validate whether subsequent dao_graph_feature_disable would pass or not |
int dao_graph_feature_disable | ( | dao_graph_feature_arc_t | _dfl, |
uint32_t | index, | ||
const char * | feature_name | ||
) |
Disable already enabled feature within a feature arc
Must be called after rte_graph_create(). API is NOT Thread-safe
_dfl | Feature arc object returned by dao_graph_feature_arc_create or dao_graph_feature_arc_lookup_by_name |
index | Application specific index. Can be corresponding to interface_id/port_id etc |
feature_name | Name of the node which is already added via dao_graph_feature_add |
int dao_graph_feature_destroy | ( | dao_graph_feature_arc_t | _dfl, |
const char * | feature_name | ||
) |
Destroy Feature
_dfl | Feature arc object returned by dao_graph_feature_arc_create or dao_graph_feature_arc_lookup_by_name |
feature_name | Feature name provided to dao_graph_feature_add |
int dao_graph_feature_arc_destroy | ( | dao_graph_feature_arc_t | _dfl | ) |
Delete feature_arc object
_dfl | Feature arc object returned by dao_graph_feature_arc_create or dao_graph_feature_arc_lookup_by_name |
int dao_graph_feature_arc_cleanup | ( | void | ) |
Cleanup all feature arcs