uint64_t encap_data;
uint64_t decap_data;
uint8_t core_idx;
+ bool unique_data;
};
/* Storage for struct rte_flow_action_raw_encap including external data. */
static void
add_set_src_mac(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_mac set_macs[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t mac = para.counter;
uint16_t i;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
mac = 1;
/* Mac address to be set is random each time */
static void
add_set_dst_mac(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_mac set_macs[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t mac = para.counter;
uint16_t i;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
mac = 1;
/* Mac address to be set is random each time */
static void
add_set_src_ipv4(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_ipv4 set_ipv4[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ip = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ip = 1;
/* IPv4 value to be set is random each time */
static void
add_set_dst_ipv4(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_ipv4 set_ipv4[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ip = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ip = 1;
/* IPv4 value to be set is random each time */
static void
add_set_src_ipv6(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_ipv6 set_ipv6[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ipv6 = para.counter;
uint8_t i;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ipv6 = 1;
/* IPv6 value to set is random each time */
static void
add_set_dst_ipv6(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_ipv6 set_ipv6[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ipv6 = para.counter;
uint8_t i;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ipv6 = 1;
/* IPv6 value to set is random each time */
static void
add_set_src_tp(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_tp set_tp[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t tp = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
tp = 100;
/* TP src port is random each time */
static void
add_set_dst_tp(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_tp set_tp[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t tp = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
tp = 100;
/* TP src port is random each time */
static void
add_inc_tcp_ack(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static rte_be32_t value[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ack_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ack_value = 1;
value[para.core_idx] = RTE_BE32(ack_value);
static void
add_dec_tcp_ack(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static rte_be32_t value[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ack_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ack_value = 1;
value[para.core_idx] = RTE_BE32(ack_value);
static void
add_inc_tcp_seq(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static rte_be32_t value[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t seq_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
seq_value = 1;
value[para.core_idx] = RTE_BE32(seq_value);
static void
add_dec_tcp_seq(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static rte_be32_t value[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t seq_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
seq_value = 1;
value[para.core_idx] = RTE_BE32(seq_value);
static void
add_set_ttl(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_ttl set_ttl[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t ttl_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ttl_value = 1;
/* Set ttl to random value each time */
static void
add_set_ipv4_dscp(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_dscp set_dscp[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t dscp_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
dscp_value = 1;
/* Set dscp to random value each time */
static void
add_set_ipv6_dscp(struct rte_flow_action *actions,
uint8_t actions_counter,
- __rte_unused struct additional_para para)
+ struct additional_para para)
{
static struct rte_flow_action_set_dscp set_dscp[RTE_MAX_LCORE] __rte_cache_aligned;
uint32_t dscp_value = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
dscp_value = 1;
/* Set dscp to random value each time */
return;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ip_dst = 1;
memset(&ipv4_hdr, 0, sizeof(struct rte_ipv4_hdr));
return;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
vni_value = 1;
memset(&vxlan_hdr, 0, sizeof(struct rte_vxlan_hdr));
return;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
vni_value = 1;
memset(&vxlan_gpe_hdr, 0, sizeof(struct rte_vxlan_gpe_hdr));
return;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
vni_value = 1;
memset(&geneve_hdr, 0, sizeof(struct rte_geneve_hdr));
return;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
teid_value = 1;
memset(>p_hdr, 0, sizeof(struct rte_flow_item_gtp));
uint32_t ip_dst = para.counter;
/* Fixed value */
- if (FIXED_VALUES)
+ if (!para.unique_data)
ip_dst = 1;
items[0].spec = &item_eth;
void
fill_actions(struct rte_flow_action *actions, uint64_t *flow_actions,
uint32_t counter, uint16_t next_table, uint16_t hairpinq,
- uint64_t encap_data, uint64_t decap_data, uint8_t core_idx)
+ uint64_t encap_data, uint64_t decap_data, uint8_t core_idx,
+ bool unique_data)
{
struct additional_para additional_para_data;
uint8_t actions_counter = 0;
.encap_data = encap_data,
.decap_data = decap_data,
.core_idx = core_idx,
+ .unique_data = unique_data,
};
if (hairpinq != 0) {
static bool delete_flag;
static bool dump_socket_mem_flag;
static bool enable_fwd;
+static bool unique_data;
static struct rte_mempool *mbuf_mp;
static uint32_t nb_lcores;
printf(" --enable-fwd: To enable packets forwarding"
" after insertion\n");
printf(" --portmask=N: hexadecimal bitmask of ports used\n");
+ printf(" --unique-data: flag to set using unique data for all"
+ " actions that support data, such as header modify and encap actions\n");
printf("To set flow attributes:\n");
printf(" --ingress: set ingress attribute in flows\n");
{ "deletion-rate", 0, 0, 0 },
{ "dump-socket-mem", 0, 0, 0 },
{ "enable-fwd", 0, 0, 0 },
+ { "unique-data", 0, 0, 0 },
{ "portmask", 1, 0, 0 },
{ "cores", 1, 0, 0 },
/* Attributes */
if (strcmp(lgopts[opt_idx].name,
"dump-iterations") == 0)
dump_iterations = true;
+ if (strcmp(lgopts[opt_idx].name,
+ "unique-data") == 0)
+ unique_data = true;
if (strcmp(lgopts[opt_idx].name,
"deletion-rate") == 0)
delete_flag = true;
*/
flow = generate_flow(port_id, 0, flow_attrs,
global_items, global_actions,
- flow_group, 0, 0, 0, 0, core_id, &error);
+ flow_group, 0, 0, 0, 0, core_id, unique_data, &error);
if (flow == NULL) {
print_flow_error(error);
JUMP_ACTION_TABLE, counter,
hairpin_queues_num,
encap_data, decap_data,
- core_id, &error);
+ core_id, unique_data, &error);
if (force_quit)
counter = end_counter;
delete_flag = false;
dump_socket_mem_flag = false;
flow_group = DEFAULT_GROUP;
+ unique_data = false;
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
if (nb_lcores <= 1)
rte_exit(EXIT_FAILURE, "This app needs at least two cores\n");
-
printf(":: Flows Count per port: %d\n\n", rules_count);
if (has_meter())