#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <rte_table_hash_func.h>
#include "action.h"
static struct port_in_action_profile_list port_in_action_profile_list;
int
port_in_action_profile_init(void)
{
TAILQ_INIT(&port_in_action_profile_list);
return 0;
}
struct port_in_action_profile *
port_in_action_profile_find(const char *name)
{
struct port_in_action_profile *profile;
if (name == NULL)
return NULL;
TAILQ_FOREACH(profile, &port_in_action_profile_list, node)
if (strcmp(profile->name, name) == 0)
return profile;
return NULL;
}
struct port_in_action_profile *
port_in_action_profile_create(const char *name,
struct port_in_action_profile_params *params)
{
struct port_in_action_profile *profile;
struct rte_port_in_action_profile *ap;
int status;
if ((name == NULL) ||
port_in_action_profile_find(name) ||
(params == NULL))
return NULL;
(params->lb.f_hash == NULL)) {
switch (params->lb.key_size) {
case 8:
params->lb.f_hash = rte_table_hash_crc_key8;
break;
case 16:
params->lb.f_hash = rte_table_hash_crc_key16;
break;
case 24:
params->lb.f_hash = rte_table_hash_crc_key24;
break;
case 32:
params->lb.f_hash = rte_table_hash_crc_key32;
break;
case 40:
params->lb.f_hash = rte_table_hash_crc_key40;
break;
case 48:
params->lb.f_hash = rte_table_hash_crc_key48;
break;
case 56:
params->lb.f_hash = rte_table_hash_crc_key56;
break;
case 64:
params->lb.f_hash = rte_table_hash_crc_key64;
break;
default:
return NULL;
}
params->lb.seed = 0;
}
if (ap == NULL)
return NULL;
¶ms->fltr);
if (status) {
return NULL;
}
}
¶ms->lb);
if (status) {
return NULL;
}
}
if (status) {
return NULL;
}
profile = calloc(1, sizeof(struct port_in_action_profile));
if (profile == NULL) {
return NULL;
}
strlcpy(profile->name, name, sizeof(profile->name));
memcpy(&profile->params, params, sizeof(*params));
profile->ap = ap;
TAILQ_INSERT_TAIL(&port_in_action_profile_list, profile, node);
return profile;
}
static struct table_action_profile_list table_action_profile_list;
int
table_action_profile_init(void)
{
TAILQ_INIT(&table_action_profile_list);
return 0;
}
struct table_action_profile *
table_action_profile_find(const char *name)
{
struct table_action_profile *profile;
if (name == NULL)
return NULL;
TAILQ_FOREACH(profile, &table_action_profile_list, node)
if (strcmp(profile->name, name) == 0)
return profile;
return NULL;
}
struct table_action_profile *
table_action_profile_create(const char *name,
struct table_action_profile_params *params)
{
struct table_action_profile *profile;
struct rte_table_action_profile *ap;
int status;
if ((name == NULL) ||
table_action_profile_find(name) ||
(params == NULL) ||
return NULL;
(params->lb.f_hash == NULL)) {
switch (params->lb.key_size) {
case 8:
params->lb.f_hash = rte_table_hash_crc_key8;
break;
case 16:
params->lb.f_hash = rte_table_hash_crc_key16;
break;
case 24:
params->lb.f_hash = rte_table_hash_crc_key24;
break;
case 32:
params->lb.f_hash = rte_table_hash_crc_key32;
break;
case 40:
params->lb.f_hash = rte_table_hash_crc_key40;
break;
case 48:
params->lb.f_hash = rte_table_hash_crc_key48;
break;
case 56:
params->lb.f_hash = rte_table_hash_crc_key56;
break;
case 64:
params->lb.f_hash = rte_table_hash_crc_key64;
break;
default:
return NULL;
}
params->lb.seed = 0;
}
if (ap == NULL)
return NULL;
NULL);
if (status) {
return NULL;
}
}
¶ms->lb);
if (status) {
return NULL;
}
}
¶ms->mtr);
if (status) {
return NULL;
}
}
¶ms->tm);
if (status) {
return NULL;
}
}
¶ms->encap);
if (status) {
return NULL;
}
}
¶ms->nat);
if (status) {
return NULL;
}
}
¶ms->ttl);
if (status) {
return NULL;
}
}
¶ms->stats);
if (status) {
return NULL;
}
}
NULL);
if (status) {
return NULL;
}
}
¶ms->sym_crypto);
if (status) {
return NULL;
}
}
NULL);
if (status) {
return NULL;
}
}
NULL);
if (status) {
return NULL;
}
}
if (status) {
return NULL;
}
profile = calloc(1, sizeof(struct table_action_profile));
if (profile == NULL) {
return NULL;
}
strlcpy(profile->name, name, sizeof(profile->name));
memcpy(&profile->params, params, sizeof(*params));
profile->ap = ap;
TAILQ_INSERT_TAIL(&table_action_profile_list, profile, node);
return profile;
}
__rte_experimental int rte_port_in_action_profile_freeze(struct rte_port_in_action_profile *profile)
__rte_experimental struct rte_port_in_action_profile * rte_port_in_action_profile_create(uint32_t socket_id)
__rte_experimental int rte_port_in_action_profile_free(struct rte_port_in_action_profile *profile)
__rte_experimental int rte_port_in_action_profile_action_register(struct rte_port_in_action_profile *profile, enum rte_port_in_action_type type, void *action_config)
@ RTE_PORT_IN_ACTION_FLTR
__rte_experimental struct rte_table_action_profile * rte_table_action_profile_create(struct rte_table_action_common_config *common)
__rte_experimental int rte_table_action_profile_action_register(struct rte_table_action_profile *profile, enum rte_table_action_type type, void *action_config)
@ RTE_TABLE_ACTION_SYM_CRYPTO
__rte_experimental int rte_table_action_profile_free(struct rte_table_action_profile *profile)
__rte_experimental int rte_table_action_profile_freeze(struct rte_table_action_profile *profile)