net/softnic: add port action profile

Add pipeline's port action profile implementation to the softnic.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
This commit is contained in:
Jasvinder Singh 2018-07-06 18:21:00 +01:00 committed by Cristian Dumitrescu
parent ea96935de2
commit 8c8c0af0ff
8 changed files with 831 additions and 2 deletions

View File

@ -8,8 +8,10 @@ include $(RTE_SDK)/mk/rte.vars.mk
#
LIB = librte_pmd_softnic.a
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -lrte_pipeline
LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_sched
LDLIBS += -lrte_bus_vdev
@ -27,6 +29,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_swq.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_link.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_tm.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_tap.c
SRCS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += rte_eth_softnic_action.c
#
# Export include files

View File

@ -0,0 +1,359 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2018 Intel Corporation
*/
#ifndef __INCLUDE_HASH_FUNC_H__
#define __INCLUDE_HASH_FUNC_H__
#include <rte_common.h>
static inline uint64_t
hash_xor_key8(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0;
xor0 = seed ^ (k[0] & m[0]);
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key16(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key24(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
xor0 ^= k[2] & m[2];
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key32(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0, xor1;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor0 ^= xor1;
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key40(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0, xor1;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor0 ^= xor1;
xor0 ^= k[4] & m[4];
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key48(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0, xor1, xor2;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
xor0 ^= xor1;
xor0 ^= xor2;
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key56(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0, xor1, xor2;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
xor0 ^= xor1;
xor2 ^= k[6] & m[6];
xor0 ^= xor2;
return (xor0 >> 32) ^ xor0;
}
static inline uint64_t
hash_xor_key64(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t xor0, xor1, xor2, xor3;
xor0 = ((k[0] & m[0]) ^ seed) ^ (k[1] & m[1]);
xor1 = (k[2] & m[2]) ^ (k[3] & m[3]);
xor2 = (k[4] & m[4]) ^ (k[5] & m[5]);
xor3 = (k[6] & m[6]) ^ (k[7] & m[7]);
xor0 ^= xor1;
xor2 ^= xor3;
xor0 ^= xor2;
return (xor0 >> 32) ^ xor0;
}
#if defined(RTE_ARCH_X86_64)
#include <x86intrin.h>
static inline uint64_t
hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t crc0;
crc0 = _mm_crc32_u64(seed, k[0] & m[0]);
return crc0;
}
static inline uint64_t
hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, crc0, crc1;
k0 = k[0] & m[0];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, k2, crc0, crc1;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc0 = _mm_crc32_u64(crc0, k2);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, k2, crc0, crc1, crc2, crc3;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
crc3 = k2 >> 32;
crc0 = _mm_crc32_u64(crc0, crc1);
crc1 = _mm_crc32_u64(crc2, crc3);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, k2, crc0, crc1, crc2, crc3;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
crc0 = _mm_crc32_u64(crc0, crc1);
crc1 = _mm_crc32_u64(crc2, crc3);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, k2, k5, crc0, crc1, crc2, crc3;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
k5 = k[5] & m[5];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
crc1 = _mm_crc32_u64(crc3, k5);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
k5 = k[5] & m[5];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
crc5 = k5 >> 32;
crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint64_t k0, k2, k5, crc0, crc1, crc2, crc3, crc4, crc5;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
k5 = k[5] & m[5];
crc0 = _mm_crc32_u64(k0, seed);
crc1 = _mm_crc32_u64(k0 >> 32, k[1] & m[1]);
crc2 = _mm_crc32_u64(k2, k[3] & m[3]);
crc3 = _mm_crc32_u64(k2 >> 32, k[4] & m[4]);
crc4 = _mm_crc32_u64(k5, k[6] & m[6]);
crc5 = _mm_crc32_u64(k5 >> 32, k[7] & m[7]);
crc0 = _mm_crc32_u64(crc0, (crc1 << 32) ^ crc2);
crc1 = _mm_crc32_u64(crc3, (crc4 << 32) ^ crc5);
crc0 ^= crc1;
return crc0;
}
#define hash_default_key8 hash_crc_key8
#define hash_default_key16 hash_crc_key16
#define hash_default_key24 hash_crc_key24
#define hash_default_key32 hash_crc_key32
#define hash_default_key40 hash_crc_key40
#define hash_default_key48 hash_crc_key48
#define hash_default_key56 hash_crc_key56
#define hash_default_key64 hash_crc_key64
#elif defined(RTE_ARCH_ARM64)
#include "hash_func_arm64.h"
#else
#define hash_default_key8 hash_xor_key8
#define hash_default_key16 hash_xor_key16
#define hash_default_key24 hash_xor_key24
#define hash_default_key32 hash_xor_key32
#define hash_default_key40 hash_xor_key40
#define hash_default_key48 hash_xor_key48
#define hash_default_key56 hash_xor_key56
#define hash_default_key64 hash_xor_key64
#endif
#endif

View File

@ -0,0 +1,261 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2017 Linaro Limited. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __HASH_FUNC_ARM64_H__
#define __HASH_FUNC_ARM64_H__
#define _CRC32CX(crc, val) \
__asm__("crc32cx %w[c], %w[c], %x[v]":[c] "+r" (crc):[v] "r" (val))
static inline uint64_t
hash_crc_key8(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key;
uint64_t *m = mask;
uint32_t crc0;
crc0 = seed;
_CRC32CX(crc0, k[0] & m[0]);
return crc0;
}
static inline uint64_t
hash_crc_key16(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0;
uint64_t *m = mask;
uint32_t crc0, crc1;
k0 = k[0] & m[0];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key24(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0, k2;
uint64_t *m = mask;
uint32_t crc0, crc1;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
_CRC32CX(crc0, k2);
crc0 ^= crc1;
return crc0;
}
static inline uint64_t
hash_crc_key32(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0, k2;
uint64_t *m = mask;
uint32_t crc0, crc1, crc2, crc3;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
crc2 = k2;
_CRC32CX(crc2, k[3] & m[3]);
crc3 = k2 >> 32;
_CRC32CX(crc0, crc1);
_CRC32CX(crc2, crc3);
crc0 ^= crc2;
return crc0;
}
static inline uint64_t
hash_crc_key40(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0, k2;
uint64_t *m = mask;
uint32_t crc0, crc1, crc2, crc3;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
crc2 = k2;
_CRC32CX(crc2, k[3] & m[3]);
crc3 = k2 >> 32;
_CRC32CX(crc3, k[4] & m[4]);
_CRC32CX(crc0, crc1);
_CRC32CX(crc2, crc3);
crc0 ^= crc2;
return crc0;
}
static inline uint64_t
hash_crc_key48(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0, k2, k5;
uint64_t *m = mask;
uint32_t crc0, crc1, crc2, crc3;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
k5 = k[5] & m[5];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
crc2 = k2;
_CRC32CX(crc2, k[3] & m[3]);
crc3 = k2 >> 32;
_CRC32CX(crc3, k[4] & m[4]);
_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
_CRC32CX(crc3, k5);
crc0 ^= crc3;
return crc0;
}
static inline uint64_t
hash_crc_key56(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0, k2, k5;
uint64_t *m = mask;
uint32_t crc0, crc1, crc2, crc3, crc4, crc5;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
k5 = k[5] & m[5];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
crc2 = k2;
_CRC32CX(crc2, k[3] & m[3]);
crc3 = k2 >> 32;
_CRC32CX(crc3, k[4] & m[4]);
crc4 = k5;
_CRC32CX(crc4, k[6] & m[6]);
crc5 = k5 >> 32;
_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
_CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5);
crc0 ^= crc3;
return crc0;
}
static inline uint64_t
hash_crc_key64(void *key, void *mask, __rte_unused uint32_t key_size,
uint64_t seed)
{
uint64_t *k = key, k0, k2, k5;
uint64_t *m = mask;
uint32_t crc0, crc1, crc2, crc3, crc4, crc5;
k0 = k[0] & m[0];
k2 = k[2] & m[2];
k5 = k[5] & m[5];
crc0 = k0;
_CRC32CX(crc0, seed);
crc1 = k0 >> 32;
_CRC32CX(crc1, k[1] & m[1]);
crc2 = k2;
_CRC32CX(crc2, k[3] & m[3]);
crc3 = k2 >> 32;
_CRC32CX(crc3, k[4] & m[4]);
crc4 = k5;
_CRC32CX(crc4, k[6] & m[6]);
crc5 = k5 >> 32;
_CRC32CX(crc5, k[7] & m[7]);
_CRC32CX(crc0, ((uint64_t)crc1 << 32) ^ crc2);
_CRC32CX(crc3, ((uint64_t)crc4 << 32) ^ crc5);
crc0 ^= crc3;
return crc0;
}
#define hash_default_key8 hash_crc_key8
#define hash_default_key16 hash_crc_key16
#define hash_default_key24 hash_crc_key24
#define hash_default_key32 hash_crc_key32
#define hash_default_key40 hash_crc_key40
#define hash_default_key48 hash_crc_key48
#define hash_default_key56 hash_crc_key56
#define hash_default_key64 hash_crc_key64
#endif

View File

@ -1,11 +1,13 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Intel Corporation
allow_experimental_apis = true
install_headers('rte_eth_softnic.h')
sources = files('rte_eth_softnic_tm.c',
'rte_eth_softnic.c',
'rte_eth_softnic_mempool.c',
'rte_eth_softnic_swq.c',
'rte_eth_softnic_link.c',
'rte_eth_softnic_tap.c')
deps += 'sched'
'rte_eth_softnic_tap.c',
'rte_eth_softnic_action.c')
deps += ['pipeline', 'sched']

View File

@ -235,6 +235,7 @@ pmd_init(struct pmd_params *params)
tm_init(p);
softnic_tmgr_init(p);
softnic_tap_init(p);
softnic_port_in_action_profile_init(p);
return p;
}
@ -245,6 +246,7 @@ pmd_free(struct pmd_internals *p)
if (p == NULL)
return;
softnic_port_in_action_profile_free(p);
softnic_tap_free(p);
softnic_tmgr_free(p);
tm_free(p);

View File

@ -0,0 +1,162 @@
/* 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 "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 = hash_default_key8;
break;
case 16:
params->lb.f_hash = hash_default_key16;
break;
case 24:
params->lb.f_hash = hash_default_key24;
break;
case 32:
params->lb.f_hash = hash_default_key32;
break;
case 40:
params->lb.f_hash = hash_default_key40;
break;
case 48:
params->lb.f_hash = hash_default_key48;
break;
case 56:
params->lb.f_hash = hash_default_key56;
break;
case 64:
params->lb.f_hash = hash_default_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,
&params->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,
&params->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;
}

View File

@ -14,6 +14,7 @@
#include <rte_ring.h>
#include <rte_ethdev.h>
#include <rte_sched.h>
#include <rte_port_in_action.h>
#include <rte_ethdev_driver.h>
#include <rte_tm_driver.h>
@ -219,6 +220,24 @@ struct softnic_tap {
TAILQ_HEAD(softnic_tap_list, softnic_tap);
/**
* 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);
/**
* PMD Internals
*/
@ -235,6 +254,7 @@ struct pmd_internals {
struct softnic_link_list link_list;
struct softnic_tmgr_port_list tmgr_port_list;
struct softnic_tap_list tap_list;
struct softnic_port_in_action_profile_list port_in_action_profile_list;
};
/**
@ -348,4 +368,22 @@ struct softnic_tap *
softnic_tap_create(struct pmd_internals *p,
const char *name);
/**
* 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);
#endif /* __INCLUDE_RTE_ETH_SOFTNIC_INTERNALS_H__ */

View File

@ -31,7 +31,9 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
# Order is important: from higher level to lower level
#
_LDLIBS-$(CONFIG_RTE_LIBRTE_FLOW_CLASSIFY) += -lrte_flow_classify
_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += --whole-archive
_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += -lrte_pipeline
_LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += --no-whole-archive
_LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE) += -lrte_table
_LDLIBS-$(CONFIG_RTE_LIBRTE_PORT) += -lrte_port