print_link_info(struct link *link, char *out, size_t out_size)
{
struct rte_eth_stats stats;
- struct ether_addr mac_addr;
+ struct rte_ether_addr mac_addr;
struct rte_eth_link eth_link;
uint16_t mtu;
static const char cmd_cryptodev_help[] =
"cryptodev <cryptodev_name>\n"
" dev <device_name> | dev_id <device_id>\n"
-" queue <n_queues> <queue_size>\n";
+" queue <n_queues> <queue_size>\n"
+" max_sessions <n_sessions>";
static void
cmd_cryptodev(char **tokens,
char *name;
memset(¶ms, 0, sizeof(params));
- if (n_tokens != 7) {
+ if (n_tokens != 9) {
snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
return;
}
if (strcmp(tokens[4], "queue")) {
snprintf(out, out_size, MSG_ARG_NOT_FOUND,
- "4");
+ "queue");
return;
}
return;
}
+ if (strcmp(tokens[7], "max_sessions")) {
+ snprintf(out, out_size, MSG_ARG_NOT_FOUND,
+ "max_sessions");
+ return;
+ }
+
+ if (parser_read_uint32(¶ms.session_pool_size, tokens[8]) < 0) {
+ snprintf(out, out_size, MSG_ARG_INVALID,
+ "queue_size");
+ return;
+ }
+
if (cryptodev_create(name, ¶ms) == NULL) {
snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]);
return;
" tc <n_tc>\n"
" stats none | pkts | bytes | both]\n"
" [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]\n"
-" [encap ether | vlan | qinq | mpls | pppoe |\n"
+" [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe \n"
" vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]\n"
" [nat src | dst\n"
" proto udp | tcp]\n"
" stats none | pkts]\n"
" [stats pkts | bytes | both]\n"
" [time]\n"
-" [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset> "
-" mempool_create <mempool_name>\n"
-" mempool_init <mempool_name>]\n"
+" [sym_crypto dev <CRYPTODEV_NAME> offset <op_offset>]\n"
" [tag]\n"
" [decap]\n";
p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
n_extra_tokens = 5;
- } else {
+ } else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+ p.encap.encap_mask =
+ 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+ else {
snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
return;
}
if ((t0 < n_tokens) && (strcmp(tokens[t0], "sym_crypto") == 0)) {
struct cryptodev *cryptodev;
- struct mempool *mempool;
- if (n_tokens < t0 + 9 ||
+ if (n_tokens < t0 + 5 ||
strcmp(tokens[t0 + 1], "dev") ||
- strcmp(tokens[t0 + 3], "offset") ||
- strcmp(tokens[t0 + 5], "mempool_create") ||
- strcmp(tokens[t0 + 7], "mempool_init")) {
+ strcmp(tokens[t0 + 3], "offset")) {
snprintf(out, out_size, MSG_ARG_MISMATCH,
"table action profile sym_crypto");
return;
return;
}
- mempool = mempool_find(tokens[t0 + 6]);
- if (mempool == NULL) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "table action profile sym_crypto");
- return;
- }
- p.sym_crypto.mp_create = mempool->m;
-
- mempool = mempool_find(tokens[t0 + 8]);
- if (mempool == NULL) {
- snprintf(out, out_size, MSG_ARG_INVALID,
- "table action profile sym_crypto");
- return;
- }
- p.sym_crypto.mp_init = mempool->m;
+ p.sym_crypto.mp_create = cryptodev->mp_create;
+ p.sym_crypto.mp_init = cryptodev->mp_init;
p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO;
- t0 += 9;
+ t0 += 5;
} /* sym_crypto */
if ((t0 < n_tokens) && (strcmp(tokens[t0], "tag") == 0)) {
* ether <da> <sa>
* | vlan <da> <sa> <pcp> <dei> <vid>
* | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ * | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
* | mpls unicast | multicast
* <da> <sa>
* label0 <label> <tc> <ttl>
parser_read_uint32(&mtr->meter_profile_id, tokens[1]) ||
strcmp(tokens[2], "policer") ||
strcmp(tokens[3], "g") ||
- parse_policer_action(tokens[4], &mtr->policer[e_RTE_METER_GREEN]) ||
+ parse_policer_action(tokens[4], &mtr->policer[RTE_COLOR_GREEN]) ||
strcmp(tokens[5], "y") ||
- parse_policer_action(tokens[6], &mtr->policer[e_RTE_METER_YELLOW]) ||
+ parse_policer_action(tokens[6], &mtr->policer[RTE_COLOR_YELLOW]) ||
strcmp(tokens[7], "r") ||
- parse_policer_action(tokens[8], &mtr->policer[e_RTE_METER_RED]))
+ parse_policer_action(tokens[8], &mtr->policer[RTE_COLOR_RED]))
return 0;
return 9;
return 1 + 9;
}
+ /* qinq_pppoe */
+ if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+ uint32_t svlan_pcp, svlan_dei, svlan_vid;
+ uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+ if ((n_tokens < 10) ||
+ parse_mac_addr(tokens[1],
+ &a->encap.qinq_pppoe.ether.da) ||
+ parse_mac_addr(tokens[2],
+ &a->encap.qinq_pppoe.ether.sa) ||
+ parser_read_uint32(&svlan_pcp, tokens[3]) ||
+ (svlan_pcp > 0x7) ||
+ parser_read_uint32(&svlan_dei, tokens[4]) ||
+ (svlan_dei > 0x1) ||
+ parser_read_uint32(&svlan_vid, tokens[5]) ||
+ (svlan_vid > 0xFFF) ||
+ parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+ (cvlan_pcp > 0x7) ||
+ parser_read_uint32(&cvlan_dei, tokens[7]) ||
+ (cvlan_dei > 0x1) ||
+ parser_read_uint32(&cvlan_vid, tokens[8]) ||
+ (cvlan_vid > 0xFFF) ||
+ parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+ tokens[9]))
+ return 0;
+
+ a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+ a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+ a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+ a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+ a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+ a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+ a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+ a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+ return 1 + 10;
+
+ }
+
/* mpls */
if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
uint32_t label, tc, ttl;
switch (xform[i]->type) {
case RTE_CRYPTO_SYM_XFORM_CIPHER:
- if (xform[i]->cipher.key.data)
- free(xform[i]->cipher.key.data);
if (p->cipher_auth.cipher_iv.val)
free(p->cipher_auth.cipher_iv.val);
if (p->cipher_auth.cipher_iv_update.val)
free(p->cipher_auth.cipher_iv_update.val);
break;
case RTE_CRYPTO_SYM_XFORM_AUTH:
- if (xform[i]->auth.key.data)
- free(xform[i]->cipher.key.data);
if (p->cipher_auth.auth_iv.val)
free(p->cipher_auth.cipher_iv.val);
if (p->cipher_auth.auth_iv_update.val)
free(p->cipher_auth.cipher_iv_update.val);
break;
case RTE_CRYPTO_SYM_XFORM_AEAD:
- if (xform[i]->aead.key.data)
- free(xform[i]->cipher.key.data);
if (p->aead.iv.val)
free(p->aead.iv.val);
if (p->aead.aad.val)
static struct rte_crypto_sym_xform *
parse_table_action_cipher(struct rte_table_action_sym_crypto_params *p,
- char **tokens, uint32_t n_tokens, uint32_t encrypt,
- uint32_t *used_n_tokens)
+ uint8_t *key, uint32_t max_key_len, char **tokens,
+ uint32_t n_tokens, uint32_t encrypt, uint32_t *used_n_tokens)
{
struct rte_crypto_sym_xform *xform_cipher;
int status;
/* cipher_key */
len = strlen(tokens[4]);
- xform_cipher->cipher.key.data = calloc(1, len / 2 + 1);
- if (xform_cipher->cipher.key.data == NULL)
+ if (len / 2 > max_key_len) {
+ status = -ENOMEM;
goto error_exit;
+ }
- status = parse_hex_string(tokens[4],
- xform_cipher->cipher.key.data,
- (uint32_t *)&len);
+ status = parse_hex_string(tokens[4], key, (uint32_t *)&len);
if (status < 0)
goto error_exit;
+ xform_cipher->cipher.key.data = key;
xform_cipher->cipher.key.length = (uint16_t)len;
/* cipher_iv */
return xform_cipher;
error_exit:
- if (xform_cipher->cipher.key.data)
- free(xform_cipher->cipher.key.data);
-
if (p->cipher_auth.cipher_iv.val) {
free(p->cipher_auth.cipher_iv.val);
p->cipher_auth.cipher_iv.val = NULL;
static struct rte_crypto_sym_xform *
parse_table_action_cipher_auth(struct rte_table_action_sym_crypto_params *p,
- char **tokens, uint32_t n_tokens, uint32_t encrypt,
- uint32_t *used_n_tokens)
+ uint8_t *key, uint32_t max_key_len, char **tokens,
+ uint32_t n_tokens, uint32_t encrypt, uint32_t *used_n_tokens)
{
struct rte_crypto_sym_xform *xform_cipher;
struct rte_crypto_sym_xform *xform_auth;
/* auth_key */
len = strlen(tokens[10]);
- xform_auth->auth.key.data = calloc(1, len / 2 + 1);
- if (xform_auth->auth.key.data == NULL)
+ if (len / 2 > max_key_len) {
+ status = -ENOMEM;
goto error_exit;
+ }
- status = parse_hex_string(tokens[10],
- xform_auth->auth.key.data, (uint32_t *)&len);
+ status = parse_hex_string(tokens[10], key, (uint32_t *)&len);
if (status < 0)
goto error_exit;
+ xform_auth->auth.key.data = key;
xform_auth->auth.key.length = (uint16_t)len;
+ key += xform_auth->auth.key.length;
+ max_key_len -= xform_auth->auth.key.length;
+
if (strcmp(tokens[11], "digest_size"))
goto error_exit;
if (status < 0)
goto error_exit;
- xform_cipher = parse_table_action_cipher(p, tokens, 7, encrypt,
- used_n_tokens);
+ xform_cipher = parse_table_action_cipher(p, key, max_key_len, tokens,
+ 7, encrypt, used_n_tokens);
if (xform_cipher == NULL)
goto error_exit;
}
error_exit:
- if (xform_auth->auth.key.data)
- free(xform_auth->auth.key.data);
if (p->cipher_auth.auth_iv.val) {
free(p->cipher_auth.auth_iv.val);
p->cipher_auth.auth_iv.val = 0;
static struct rte_crypto_sym_xform *
parse_table_action_aead(struct rte_table_action_sym_crypto_params *p,
- char **tokens, uint32_t n_tokens, uint32_t encrypt,
- uint32_t *used_n_tokens)
+ uint8_t *key, uint32_t max_key_len, char **tokens,
+ uint32_t n_tokens, uint32_t encrypt, uint32_t *used_n_tokens)
{
struct rte_crypto_sym_xform *xform_aead;
int status;
/* aead_key */
len = strlen(tokens[4]);
- xform_aead->aead.key.data = calloc(1, len / 2 + 1);
- if (xform_aead->aead.key.data == NULL)
+ if (len / 2 > max_key_len) {
+ status = -ENOMEM;
goto error_exit;
+ }
- status = parse_hex_string(tokens[4], xform_aead->aead.key.data,
- (uint32_t *)&len);
+ status = parse_hex_string(tokens[4], key, (uint32_t *)&len);
if (status < 0)
goto error_exit;
+ xform_aead->aead.key.data = key;
xform_aead->aead.key.length = (uint16_t)len;
/* aead_iv */
return xform_aead;
error_exit:
- if (xform_aead->aead.key.data)
- free(xform_aead->aead.key.data);
if (p->aead.iv.val) {
free(p->aead.iv.val);
p->aead.iv.val = NULL;
{
struct rte_table_action_sym_crypto_params *p = &a->sym_crypto;
struct rte_crypto_sym_xform *xform = NULL;
+ uint8_t *key = a->sym_crypto_key;
+ uint32_t max_key_len = SYM_CRYPTO_MAX_KEY_SIZE;
uint32_t used_n_tokens;
uint32_t encrypt;
int status;
tokens += 3;
n_tokens -= 3;
- xform = parse_table_action_cipher(p, tokens, n_tokens, encrypt,
- &used_n_tokens);
+ xform = parse_table_action_cipher(p, key, max_key_len, tokens,
+ n_tokens, encrypt, &used_n_tokens);
} else if (strcmp(tokens[3], "cipher_auth") == 0) {
tokens += 3;
n_tokens -= 3;
- xform = parse_table_action_cipher_auth(p, tokens, n_tokens,
- encrypt, &used_n_tokens);
+ xform = parse_table_action_cipher_auth(p, key, max_key_len,
+ tokens, n_tokens, encrypt, &used_n_tokens);
} else if (strcmp(tokens[3], "aead") == 0) {
tokens += 3;
n_tokens -= 3;
- xform = parse_table_action_aead(p, tokens, n_tokens, encrypt,
- &used_n_tokens);
+ xform = parse_table_action_aead(p, key, max_key_len, tokens,
+ n_tokens, encrypt, &used_n_tokens);
}
if (xform == NULL)
}
static void
-ether_addr_show(FILE *f, struct ether_addr *addr)
+ether_addr_show(FILE *f, struct rte_ether_addr *addr)
{
fprintf(f, "%02x:%02x:%02x:%02x:%02x:%02x",
(uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1],
struct rte_table_action_mtr_tc_params *p =
&a->mtr.mtr[i];
enum rte_table_action_policer ga =
- p->policer[e_RTE_METER_GREEN];
+ p->policer[RTE_COLOR_GREEN];
enum rte_table_action_policer ya =
- p->policer[e_RTE_METER_YELLOW];
+ p->policer[RTE_COLOR_YELLOW];
enum rte_table_action_policer ra =
- p->policer[e_RTE_METER_RED];
+ p->policer[RTE_COLOR_RED];
fprintf(f, "tc%u meter %u policer g %s y %s r %s ",
i,
for (dscp = 0, l = 1; ; l++) {
char line[64];
char *tokens[3];
- enum rte_meter_color color;
+ enum rte_color color;
uint32_t tc_id, tc_queue_id, n_tokens = RTE_DIM(tokens);
if (fgets(line, sizeof(line), f) == NULL)
switch (tokens[2][0]) {
case 'g':
case 'G':
- color = e_RTE_METER_GREEN;
+ color = RTE_COLOR_GREEN;
break;
case 'y':
case 'Y':
- color = e_RTE_METER_YELLOW;
+ color = RTE_COLOR_YELLOW;
break;
case 'r':
case 'R':
- color = e_RTE_METER_RED;
+ color = RTE_COLOR_RED;
break;
default: