net/softnic: replace legacy pipeline with SWX pipeline
Replace the legacy pipeline support with support for the SWX pipeline. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
This commit is contained in:
parent
87dc5c2067
commit
fa0a52a708
@ -10,7 +10,6 @@ sources = files(
|
||||
'conn.c',
|
||||
'parser.c',
|
||||
'rte_eth_softnic.c',
|
||||
'rte_eth_softnic_action.c',
|
||||
'rte_eth_softnic_cli.c',
|
||||
'rte_eth_softnic_link.c',
|
||||
'rte_eth_softnic_mempool.c',
|
||||
|
@ -160,8 +160,6 @@ pmd_dev_stop(struct rte_eth_dev *dev)
|
||||
/* Firmware */
|
||||
softnic_pipeline_disable_all(p);
|
||||
softnic_pipeline_free(p);
|
||||
softnic_table_action_profile_free(p);
|
||||
softnic_port_in_action_profile_free(p);
|
||||
softnic_link_free(p);
|
||||
softnic_softnic_swq_free_keep_rxq_txq(p);
|
||||
softnic_mempool_free(p);
|
||||
@ -180,8 +178,6 @@ pmd_free(struct pmd_internals *p)
|
||||
|
||||
softnic_thread_free(p);
|
||||
softnic_pipeline_free(p);
|
||||
softnic_table_action_profile_free(p);
|
||||
softnic_port_in_action_profile_free(p);
|
||||
softnic_link_free(p);
|
||||
softnic_swq_free(p);
|
||||
softnic_mempool_free(p);
|
||||
@ -261,8 +257,6 @@ pmd_init(struct pmd_params *params)
|
||||
softnic_mempool_init(p);
|
||||
softnic_swq_init(p);
|
||||
softnic_link_init(p);
|
||||
softnic_port_in_action_profile_init(p);
|
||||
softnic_table_action_profile_init(p);
|
||||
softnic_pipeline_init(p);
|
||||
|
||||
status = softnic_thread_init(p);
|
||||
|
@ -1,423 +0,0 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
* Copyright(c) 2010-2018 Intel Corporation
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <rte_string_fns.h>
|
||||
#include <rte_table_hash_func.h>
|
||||
|
||||
#include "rte_eth_softnic_internals.h"
|
||||
|
||||
/**
|
||||
* Input port
|
||||
*/
|
||||
int
|
||||
softnic_port_in_action_profile_init(struct pmd_internals *p)
|
||||
{
|
||||
TAILQ_INIT(&p->port_in_action_profile_list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
softnic_port_in_action_profile_free(struct pmd_internals *p)
|
||||
{
|
||||
for ( ; ; ) {
|
||||
struct softnic_port_in_action_profile *profile;
|
||||
|
||||
profile = TAILQ_FIRST(&p->port_in_action_profile_list);
|
||||
if (profile == NULL)
|
||||
break;
|
||||
|
||||
TAILQ_REMOVE(&p->port_in_action_profile_list, profile, node);
|
||||
free(profile);
|
||||
}
|
||||
}
|
||||
|
||||
struct softnic_port_in_action_profile *
|
||||
softnic_port_in_action_profile_find(struct pmd_internals *p,
|
||||
const char *name)
|
||||
{
|
||||
struct softnic_port_in_action_profile *profile;
|
||||
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
TAILQ_FOREACH(profile, &p->port_in_action_profile_list, node)
|
||||
if (strcmp(profile->name, name) == 0)
|
||||
return profile;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct softnic_port_in_action_profile *
|
||||
softnic_port_in_action_profile_create(struct pmd_internals *p,
|
||||
const char *name,
|
||||
struct softnic_port_in_action_profile_params *params)
|
||||
{
|
||||
struct softnic_port_in_action_profile *profile;
|
||||
struct rte_port_in_action_profile *ap;
|
||||
int status;
|
||||
|
||||
/* Check input params */
|
||||
if (name == NULL ||
|
||||
softnic_port_in_action_profile_find(p, name) ||
|
||||
params == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((params->action_mask & (1LLU << RTE_PORT_IN_ACTION_LB)) &&
|
||||
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;
|
||||
}
|
||||
|
||||
/* Resource */
|
||||
ap = rte_port_in_action_profile_create(0);
|
||||
if (ap == NULL)
|
||||
return NULL;
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_PORT_IN_ACTION_FLTR)) {
|
||||
status = rte_port_in_action_profile_action_register(ap,
|
||||
RTE_PORT_IN_ACTION_FLTR,
|
||||
¶ms->fltr);
|
||||
|
||||
if (status) {
|
||||
rte_port_in_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_PORT_IN_ACTION_LB)) {
|
||||
status = rte_port_in_action_profile_action_register(ap,
|
||||
RTE_PORT_IN_ACTION_LB,
|
||||
¶ms->lb);
|
||||
|
||||
if (status) {
|
||||
rte_port_in_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
status = rte_port_in_action_profile_freeze(ap);
|
||||
if (status) {
|
||||
rte_port_in_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Node allocation */
|
||||
profile = calloc(1, sizeof(struct softnic_port_in_action_profile));
|
||||
if (profile == NULL) {
|
||||
rte_port_in_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Node fill in */
|
||||
strlcpy(profile->name, name, sizeof(profile->name));
|
||||
memcpy(&profile->params, params, sizeof(*params));
|
||||
profile->ap = ap;
|
||||
|
||||
/* Node add to list */
|
||||
TAILQ_INSERT_TAIL(&p->port_in_action_profile_list, profile, node);
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Table
|
||||
*/
|
||||
int
|
||||
softnic_table_action_profile_init(struct pmd_internals *p)
|
||||
{
|
||||
TAILQ_INIT(&p->table_action_profile_list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
softnic_table_action_profile_free(struct pmd_internals *p)
|
||||
{
|
||||
for ( ; ; ) {
|
||||
struct softnic_table_action_profile *profile;
|
||||
|
||||
profile = TAILQ_FIRST(&p->table_action_profile_list);
|
||||
if (profile == NULL)
|
||||
break;
|
||||
|
||||
TAILQ_REMOVE(&p->table_action_profile_list, profile, node);
|
||||
rte_table_action_profile_free(profile->ap);
|
||||
free(profile);
|
||||
}
|
||||
}
|
||||
|
||||
struct softnic_table_action_profile *
|
||||
softnic_table_action_profile_find(struct pmd_internals *p,
|
||||
const char *name)
|
||||
{
|
||||
struct softnic_table_action_profile *profile;
|
||||
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
TAILQ_FOREACH(profile, &p->table_action_profile_list, node)
|
||||
if (strcmp(profile->name, name) == 0)
|
||||
return profile;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct softnic_table_action_profile *
|
||||
softnic_table_action_profile_create(struct pmd_internals *p,
|
||||
const char *name,
|
||||
struct softnic_table_action_profile_params *params)
|
||||
{
|
||||
struct softnic_table_action_profile *profile;
|
||||
struct rte_table_action_profile *ap;
|
||||
int status;
|
||||
|
||||
/* Check input params */
|
||||
if (name == NULL ||
|
||||
softnic_table_action_profile_find(p, name) ||
|
||||
params == NULL ||
|
||||
((params->action_mask & (1LLU << RTE_TABLE_ACTION_FWD)) == 0))
|
||||
return NULL;
|
||||
|
||||
if ((params->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) &&
|
||||
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;
|
||||
}
|
||||
|
||||
/* Resource */
|
||||
ap = rte_table_action_profile_create(¶ms->common);
|
||||
if (ap == NULL)
|
||||
return NULL;
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_FWD)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_FWD,
|
||||
NULL);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_LB,
|
||||
¶ms->lb);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_MTR)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_MTR,
|
||||
¶ms->mtr);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TM)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_TM,
|
||||
¶ms->tm);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_ENCAP)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_ENCAP,
|
||||
¶ms->encap);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_NAT)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_NAT,
|
||||
¶ms->nat);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TTL)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_TTL,
|
||||
¶ms->ttl);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_STATS)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_STATS,
|
||||
¶ms->stats);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TIME)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_TIME,
|
||||
NULL);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_TAG,
|
||||
NULL);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_DECAP,
|
||||
NULL);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (params->action_mask & (1LLU << RTE_TABLE_ACTION_SYM_CRYPTO)) {
|
||||
status = rte_table_action_profile_action_register(ap,
|
||||
RTE_TABLE_ACTION_SYM_CRYPTO,
|
||||
¶ms->sym_crypto);
|
||||
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
status = rte_table_action_profile_freeze(ap);
|
||||
if (status) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Node allocation */
|
||||
profile = calloc(1, sizeof(struct softnic_table_action_profile));
|
||||
if (profile == NULL) {
|
||||
rte_table_action_profile_free(ap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Node fill in */
|
||||
strlcpy(profile->name, name, sizeof(profile->name));
|
||||
memcpy(&profile->params, params, sizeof(*params));
|
||||
profile->ap = ap;
|
||||
|
||||
/* Node add to list */
|
||||
TAILQ_INSERT_TAIL(&p->table_action_profile_list, profile, node);
|
||||
|
||||
return profile;
|
||||
}
|
@ -196,6 +196,7 @@ cmd_softnic_thread_pipeline_enable(struct pmd_internals *softnic,
|
||||
size_t out_size)
|
||||
{
|
||||
char *pipeline_name;
|
||||
struct pipeline *p;
|
||||
uint32_t thread_id;
|
||||
int status;
|
||||
|
||||
@ -215,13 +216,18 @@ cmd_softnic_thread_pipeline_enable(struct pmd_internals *softnic,
|
||||
}
|
||||
|
||||
pipeline_name = tokens[3];
|
||||
p = softnic_pipeline_find(softnic, pipeline_name);
|
||||
if (!p) {
|
||||
snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(tokens[4], "enable") != 0) {
|
||||
snprintf(out, out_size, MSG_ARG_NOT_FOUND, "enable");
|
||||
return;
|
||||
}
|
||||
|
||||
status = softnic_thread_pipeline_enable(softnic, thread_id, pipeline_name);
|
||||
status = softnic_thread_pipeline_enable(softnic, thread_id, p);
|
||||
if (status) {
|
||||
snprintf(out, out_size, MSG_CMD_FAIL, "thread pipeline enable");
|
||||
return;
|
||||
@ -239,6 +245,7 @@ cmd_softnic_thread_pipeline_disable(struct pmd_internals *softnic,
|
||||
size_t out_size)
|
||||
{
|
||||
char *pipeline_name;
|
||||
struct pipeline *p;
|
||||
uint32_t thread_id;
|
||||
int status;
|
||||
|
||||
@ -258,13 +265,18 @@ cmd_softnic_thread_pipeline_disable(struct pmd_internals *softnic,
|
||||
}
|
||||
|
||||
pipeline_name = tokens[3];
|
||||
p = softnic_pipeline_find(softnic, pipeline_name);
|
||||
if (!p) {
|
||||
snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(tokens[4], "disable") != 0) {
|
||||
snprintf(out, out_size, MSG_ARG_NOT_FOUND, "disable");
|
||||
return;
|
||||
}
|
||||
|
||||
status = softnic_thread_pipeline_disable(softnic, thread_id, pipeline_name);
|
||||
status = softnic_thread_pipeline_disable(softnic, thread_id, p);
|
||||
if (status) {
|
||||
snprintf(out, out_size, MSG_CMD_FAIL,
|
||||
"thread pipeline disable");
|
||||
|
@ -13,9 +13,8 @@
|
||||
#include <rte_mbuf.h>
|
||||
#include <rte_ring.h>
|
||||
#include <rte_ethdev.h>
|
||||
#include <rte_port_in_action.h>
|
||||
#include <rte_table_action.h>
|
||||
#include <rte_pipeline.h>
|
||||
#include <rte_swx_pipeline.h>
|
||||
#include <rte_swx_ctl.h>
|
||||
|
||||
#include <rte_ethdev_core.h>
|
||||
#include <ethdev_driver.h>
|
||||
@ -89,207 +88,18 @@ struct softnic_link {
|
||||
|
||||
TAILQ_HEAD(softnic_link_list, softnic_link);
|
||||
|
||||
/**
|
||||
* Input port action
|
||||
*/
|
||||
struct softnic_port_in_action_profile_params {
|
||||
uint64_t action_mask;
|
||||
struct rte_port_in_action_fltr_config fltr;
|
||||
struct rte_port_in_action_lb_config lb;
|
||||
};
|
||||
|
||||
struct softnic_port_in_action_profile {
|
||||
TAILQ_ENTRY(softnic_port_in_action_profile) node;
|
||||
char name[NAME_SIZE];
|
||||
struct softnic_port_in_action_profile_params params;
|
||||
struct rte_port_in_action_profile *ap;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(softnic_port_in_action_profile_list, softnic_port_in_action_profile);
|
||||
|
||||
/**
|
||||
* Table action
|
||||
*/
|
||||
struct softnic_table_action_profile_params {
|
||||
uint64_t action_mask;
|
||||
struct rte_table_action_common_config common;
|
||||
struct rte_table_action_lb_config lb;
|
||||
struct rte_table_action_mtr_config mtr;
|
||||
struct rte_table_action_tm_config tm;
|
||||
struct rte_table_action_encap_config encap;
|
||||
struct rte_table_action_nat_config nat;
|
||||
struct rte_table_action_ttl_config ttl;
|
||||
struct rte_table_action_stats_config stats;
|
||||
struct rte_table_action_sym_crypto_config sym_crypto;
|
||||
};
|
||||
|
||||
struct softnic_table_action_profile {
|
||||
TAILQ_ENTRY(softnic_table_action_profile) node;
|
||||
char name[NAME_SIZE];
|
||||
struct softnic_table_action_profile_params params;
|
||||
struct rte_table_action_profile *ap;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(softnic_table_action_profile_list, softnic_table_action_profile);
|
||||
|
||||
struct softnic_table_meter_profile {
|
||||
TAILQ_ENTRY(softnic_table_meter_profile) node;
|
||||
uint32_t meter_profile_id;
|
||||
struct rte_table_action_meter_profile profile;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(softnic_table_meter_profile_list,
|
||||
softnic_table_meter_profile);
|
||||
|
||||
/**
|
||||
* Pipeline
|
||||
*/
|
||||
struct pipeline_params {
|
||||
uint32_t timer_period_ms;
|
||||
uint32_t offset_port_id;
|
||||
};
|
||||
|
||||
enum softnic_port_in_type {
|
||||
PORT_IN_RXQ,
|
||||
PORT_IN_SWQ,
|
||||
PORT_IN_SOURCE,
|
||||
};
|
||||
|
||||
struct softnic_port_in_params {
|
||||
/* Read */
|
||||
enum softnic_port_in_type type;
|
||||
char dev_name[NAME_SIZE];
|
||||
union {
|
||||
struct {
|
||||
uint16_t queue_id;
|
||||
} rxq;
|
||||
|
||||
struct {
|
||||
const char *mempool_name;
|
||||
const char *file_name;
|
||||
uint32_t n_bytes_per_pkt;
|
||||
} source;
|
||||
};
|
||||
uint32_t burst_size;
|
||||
|
||||
/* Action */
|
||||
char action_profile_name[NAME_SIZE];
|
||||
};
|
||||
|
||||
enum softnic_port_out_type {
|
||||
PORT_OUT_TXQ,
|
||||
PORT_OUT_SWQ,
|
||||
PORT_OUT_SINK,
|
||||
};
|
||||
|
||||
struct softnic_port_out_params {
|
||||
enum softnic_port_out_type type;
|
||||
char dev_name[NAME_SIZE];
|
||||
union {
|
||||
struct {
|
||||
uint16_t queue_id;
|
||||
} txq;
|
||||
|
||||
struct {
|
||||
const char *file_name;
|
||||
uint32_t max_n_pkts;
|
||||
} sink;
|
||||
};
|
||||
uint32_t burst_size;
|
||||
int retry;
|
||||
uint32_t n_retries;
|
||||
};
|
||||
|
||||
enum softnic_table_type {
|
||||
TABLE_ACL,
|
||||
TABLE_ARRAY,
|
||||
TABLE_HASH,
|
||||
TABLE_LPM,
|
||||
TABLE_STUB,
|
||||
};
|
||||
|
||||
struct softnic_table_acl_params {
|
||||
uint32_t n_rules;
|
||||
uint32_t ip_header_offset;
|
||||
int ip_version;
|
||||
};
|
||||
|
||||
struct softnic_table_array_params {
|
||||
uint32_t n_keys;
|
||||
uint32_t key_offset;
|
||||
};
|
||||
|
||||
#ifndef TABLE_RULE_MATCH_SIZE_MAX
|
||||
#define TABLE_RULE_MATCH_SIZE_MAX 256
|
||||
#endif
|
||||
|
||||
struct softnic_table_hash_params {
|
||||
uint32_t n_keys;
|
||||
uint32_t key_offset;
|
||||
uint32_t key_size;
|
||||
uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
|
||||
uint32_t n_buckets;
|
||||
int extendable_bucket;
|
||||
};
|
||||
|
||||
struct softnic_table_lpm_params {
|
||||
uint32_t n_rules;
|
||||
uint32_t key_offset;
|
||||
uint32_t key_size;
|
||||
};
|
||||
|
||||
struct softnic_table_params {
|
||||
/* Match */
|
||||
enum softnic_table_type match_type;
|
||||
union {
|
||||
struct softnic_table_acl_params acl;
|
||||
struct softnic_table_array_params array;
|
||||
struct softnic_table_hash_params hash;
|
||||
struct softnic_table_lpm_params lpm;
|
||||
} match;
|
||||
|
||||
/* Action */
|
||||
char action_profile_name[NAME_SIZE];
|
||||
};
|
||||
|
||||
struct softnic_port_in {
|
||||
struct softnic_port_in_params params;
|
||||
struct softnic_port_in_action_profile *ap;
|
||||
struct rte_port_in_action *a;
|
||||
};
|
||||
|
||||
struct softnic_port_out {
|
||||
struct softnic_port_out_params params;
|
||||
};
|
||||
|
||||
struct softnic_table {
|
||||
struct softnic_table_params params;
|
||||
struct softnic_table_action_profile *ap;
|
||||
struct rte_table_action *a;
|
||||
struct rte_table_action_dscp_table dscp_table;
|
||||
struct softnic_table_meter_profile_list meter_profiles;
|
||||
};
|
||||
|
||||
struct pipeline {
|
||||
TAILQ_ENTRY(pipeline) node;
|
||||
char name[NAME_SIZE];
|
||||
|
||||
struct rte_pipeline *p;
|
||||
struct pipeline_params params;
|
||||
struct softnic_port_in port_in[RTE_PIPELINE_PORT_IN_MAX];
|
||||
struct softnic_port_out port_out[RTE_PIPELINE_PORT_OUT_MAX];
|
||||
struct softnic_table table[RTE_PIPELINE_TABLE_MAX];
|
||||
uint32_t n_ports_in;
|
||||
uint32_t n_ports_out;
|
||||
uint32_t n_tables;
|
||||
|
||||
struct rte_ring *msgq_req;
|
||||
struct rte_ring *msgq_rsp;
|
||||
uint32_t timer_period_ms;
|
||||
struct rte_swx_pipeline *p;
|
||||
struct rte_swx_ctl_pipeline *ctl;
|
||||
|
||||
int enabled;
|
||||
uint32_t thread_id;
|
||||
uint32_t cpu_id;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(pipeline_list, pipeline);
|
||||
@ -309,6 +119,15 @@ TAILQ_HEAD(pipeline_list, pipeline);
|
||||
#define THREAD_TIMER_PERIOD_MS 100
|
||||
#endif
|
||||
|
||||
/* Pipeline instruction quanta: Needs to be big enough to do some meaningful
|
||||
* work, but not too big to avoid starving any other pipelines mapped to the
|
||||
* same thread. For a pipeline that executes 10 instructions per packet, a
|
||||
* quanta of 1000 instructions equates to processing 100 packets.
|
||||
*/
|
||||
#ifndef PIPELINE_INSTR_QUANTA
|
||||
#define PIPELINE_INSTR_QUANTA 1000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Main thread: data plane thread context
|
||||
*/
|
||||
@ -322,37 +141,14 @@ struct softnic_thread {
|
||||
/**
|
||||
* Data plane threads: context
|
||||
*/
|
||||
#ifndef TABLE_RULE_ACTION_SIZE_MAX
|
||||
#define TABLE_RULE_ACTION_SIZE_MAX 2048
|
||||
#endif
|
||||
|
||||
struct softnic_table_data {
|
||||
struct rte_table_action *a;
|
||||
};
|
||||
|
||||
struct pipeline_data {
|
||||
struct rte_pipeline *p;
|
||||
struct softnic_table_data table_data[RTE_PIPELINE_TABLE_MAX];
|
||||
uint32_t n_tables;
|
||||
|
||||
struct rte_ring *msgq_req;
|
||||
struct rte_ring *msgq_rsp;
|
||||
uint64_t timer_period; /* Measured in CPU cycles. */
|
||||
uint64_t time_next;
|
||||
|
||||
uint8_t buffer[TABLE_RULE_ACTION_SIZE_MAX];
|
||||
};
|
||||
|
||||
struct softnic_thread_data {
|
||||
struct rte_pipeline *p[THREAD_PIPELINES_MAX];
|
||||
struct rte_swx_pipeline *p[THREAD_PIPELINES_MAX];
|
||||
uint32_t n_pipelines;
|
||||
|
||||
struct pipeline_data pipeline_data[THREAD_PIPELINES_MAX];
|
||||
struct rte_ring *msgq_req;
|
||||
struct rte_ring *msgq_rsp;
|
||||
uint64_t timer_period; /* Measured in CPU cycles. */
|
||||
uint64_t time_next;
|
||||
uint64_t time_next_min;
|
||||
uint64_t iter;
|
||||
} __rte_cache_aligned;
|
||||
|
||||
@ -367,8 +163,6 @@ struct pmd_internals {
|
||||
struct softnic_mempool_list mempool_list;
|
||||
struct softnic_swq_list swq_list;
|
||||
struct softnic_link_list link_list;
|
||||
struct softnic_port_in_action_profile_list port_in_action_profile_list;
|
||||
struct softnic_table_action_profile_list table_action_profile_list;
|
||||
struct pipeline_list pipeline_list;
|
||||
struct softnic_thread thread[RTE_MAX_LCORE];
|
||||
struct softnic_thread_data thread_data[RTE_MAX_LCORE];
|
||||
@ -447,42 +241,6 @@ softnic_link_create(struct pmd_internals *p,
|
||||
const char *name,
|
||||
struct softnic_link_params *params);
|
||||
|
||||
/**
|
||||
* Input port action
|
||||
*/
|
||||
int
|
||||
softnic_port_in_action_profile_init(struct pmd_internals *p);
|
||||
|
||||
void
|
||||
softnic_port_in_action_profile_free(struct pmd_internals *p);
|
||||
|
||||
struct softnic_port_in_action_profile *
|
||||
softnic_port_in_action_profile_find(struct pmd_internals *p,
|
||||
const char *name);
|
||||
|
||||
struct softnic_port_in_action_profile *
|
||||
softnic_port_in_action_profile_create(struct pmd_internals *p,
|
||||
const char *name,
|
||||
struct softnic_port_in_action_profile_params *params);
|
||||
|
||||
/**
|
||||
* Table action
|
||||
*/
|
||||
int
|
||||
softnic_table_action_profile_init(struct pmd_internals *p);
|
||||
|
||||
void
|
||||
softnic_table_action_profile_free(struct pmd_internals *p);
|
||||
|
||||
struct softnic_table_action_profile *
|
||||
softnic_table_action_profile_find(struct pmd_internals *p,
|
||||
const char *name);
|
||||
|
||||
struct softnic_table_action_profile *
|
||||
softnic_table_action_profile_create(struct pmd_internals *p,
|
||||
const char *name,
|
||||
struct softnic_table_action_profile_params *params);
|
||||
|
||||
/**
|
||||
* Pipeline
|
||||
*/
|
||||
@ -504,228 +262,9 @@ softnic_pipeline_find(struct pmd_internals *p, const char *name);
|
||||
struct pipeline *
|
||||
softnic_pipeline_create(struct pmd_internals *p,
|
||||
const char *name,
|
||||
struct pipeline_params *params);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_in_create(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
struct softnic_port_in_params *params,
|
||||
int enabled);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_in_connect_to_table(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t port_id,
|
||||
uint32_t table_id);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_out_create(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
struct softnic_port_out_params *params);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_out_find(struct pmd_internals *softnic,
|
||||
const char *pipeline_name,
|
||||
const char *name,
|
||||
uint32_t *port_id);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_create(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
struct softnic_table_params *params);
|
||||
|
||||
struct softnic_table_meter_profile *
|
||||
softnic_pipeline_table_meter_profile_find(struct softnic_table *table,
|
||||
uint32_t meter_profile_id);
|
||||
|
||||
struct softnic_table_rule_match_acl {
|
||||
int ip_version;
|
||||
|
||||
RTE_STD_C11
|
||||
union {
|
||||
struct {
|
||||
uint32_t sa;
|
||||
uint32_t da;
|
||||
} ipv4;
|
||||
|
||||
struct {
|
||||
uint8_t sa[16];
|
||||
uint8_t da[16];
|
||||
} ipv6;
|
||||
};
|
||||
|
||||
uint32_t sa_depth;
|
||||
uint32_t da_depth;
|
||||
uint16_t sp0;
|
||||
uint16_t sp1;
|
||||
uint16_t dp0;
|
||||
uint16_t dp1;
|
||||
uint8_t proto;
|
||||
uint8_t proto_mask;
|
||||
uint32_t priority;
|
||||
};
|
||||
|
||||
struct softnic_table_rule_match_array {
|
||||
uint32_t pos;
|
||||
};
|
||||
|
||||
struct softnic_table_rule_match_hash {
|
||||
uint8_t key[TABLE_RULE_MATCH_SIZE_MAX];
|
||||
};
|
||||
|
||||
struct softnic_table_rule_match_lpm {
|
||||
int ip_version;
|
||||
|
||||
RTE_STD_C11
|
||||
union {
|
||||
uint32_t ipv4;
|
||||
uint8_t ipv6[16];
|
||||
};
|
||||
|
||||
uint8_t depth;
|
||||
};
|
||||
|
||||
struct softnic_table_rule_match {
|
||||
enum softnic_table_type match_type;
|
||||
|
||||
union {
|
||||
struct softnic_table_rule_match_acl acl;
|
||||
struct softnic_table_rule_match_array array;
|
||||
struct softnic_table_rule_match_hash hash;
|
||||
struct softnic_table_rule_match_lpm lpm;
|
||||
} match;
|
||||
};
|
||||
|
||||
#ifndef SYM_CRYPTO_MAX_KEY_SIZE
|
||||
#define SYM_CRYPTO_MAX_KEY_SIZE (256)
|
||||
#endif
|
||||
struct softnic_table_rule_action {
|
||||
uint64_t action_mask;
|
||||
struct rte_table_action_fwd_params fwd;
|
||||
struct rte_table_action_lb_params lb;
|
||||
struct rte_table_action_mtr_params mtr;
|
||||
struct rte_table_action_tm_params tm;
|
||||
struct rte_table_action_encap_params encap;
|
||||
struct rte_table_action_nat_params nat;
|
||||
struct rte_table_action_ttl_params ttl;
|
||||
struct rte_table_action_stats_params stats;
|
||||
struct rte_table_action_time_params time;
|
||||
struct rte_table_action_tag_params tag;
|
||||
struct rte_table_action_decap_params decap;
|
||||
struct rte_table_action_sym_crypto_params sym_crypto;
|
||||
uint8_t sym_crypto_key[SYM_CRYPTO_MAX_KEY_SIZE];
|
||||
};
|
||||
|
||||
int
|
||||
softnic_pipeline_port_in_stats_read(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t port_id,
|
||||
struct rte_pipeline_port_in_stats *stats,
|
||||
int clear);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_in_enable(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t port_id);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_in_disable(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t port_id);
|
||||
|
||||
int
|
||||
softnic_pipeline_port_out_stats_read(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t port_id,
|
||||
struct rte_pipeline_port_out_stats *stats,
|
||||
int clear);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_stats_read(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
struct rte_pipeline_table_stats *stats,
|
||||
int clear);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_add(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
struct softnic_table_rule_match *match,
|
||||
struct softnic_table_rule_action *action,
|
||||
void **data);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_add_bulk(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
struct softnic_table_rule_match *match,
|
||||
struct softnic_table_rule_action *action,
|
||||
void **data,
|
||||
uint32_t *n_rules);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_add_default(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
struct softnic_table_rule_action *action,
|
||||
void **data);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_delete(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
struct softnic_table_rule_match *match);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_delete_default(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_stats_read(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
void *data,
|
||||
struct rte_table_action_stats_counters *stats,
|
||||
int clear);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_mtr_profile_add(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
uint32_t meter_profile_id,
|
||||
struct rte_table_action_meter_profile *profile);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_mtr_profile_delete(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
uint32_t meter_profile_id);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_mtr_read(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
void *data,
|
||||
uint32_t tc_mask,
|
||||
struct rte_table_action_mtr_counters *stats,
|
||||
int clear);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_dscp_table_update(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
uint64_t dscp_mask,
|
||||
struct rte_table_action_dscp_table *dscp_table);
|
||||
|
||||
int
|
||||
softnic_pipeline_table_rule_ttl_read(struct pmd_internals *p,
|
||||
const char *pipeline_name,
|
||||
uint32_t table_id,
|
||||
void *data,
|
||||
struct rte_table_action_ttl_counters *stats,
|
||||
int clear);
|
||||
const char *lib_file_name,
|
||||
const char *iospec_file_name,
|
||||
int numa_node);
|
||||
|
||||
/**
|
||||
* Thread
|
||||
@ -739,12 +278,15 @@ softnic_thread_free(struct pmd_internals *p);
|
||||
int
|
||||
softnic_thread_pipeline_enable(struct pmd_internals *p,
|
||||
uint32_t thread_id,
|
||||
const char *pipeline_name);
|
||||
struct pipeline *pipeline);
|
||||
|
||||
int
|
||||
softnic_thread_pipeline_disable(struct pmd_internals *p,
|
||||
uint32_t thread_id,
|
||||
const char *pipeline_name);
|
||||
struct pipeline *pipeline);
|
||||
|
||||
void
|
||||
softnic_thread_pipeline_disable_all(struct pmd_internals *p);
|
||||
|
||||
/**
|
||||
* CLI
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user