From: Wisam Jaddo <wisamm@mellanox.com>
To: dev@dpdk.org, thomas@monjalon.net, asafp@mellanox.com,
akozyrev@nvidia.com, akozyrev@mellanox.com,
arybchenko@solarflare.com, jackmin@mellanox.com
Subject: [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions
Date: Sun, 30 Aug 2020 11:15:44 +0000 [thread overview]
Message-ID: <20200830111544.4190-14-wisamm@mellanox.com> (raw)
In-Reply-To: <20200830111544.4190-1-wisamm@mellanox.com>
Sometime the user want to have fixed values of
encap/decap or header modify for all flows.
This will introduce the ability to choose from
fixed or dynamic values by setting the flag in
config.h
To use different value for each flow:
config.h: #define FIXED_VALUES 0
To use single value for all flows:
config.h: #define FIXED_VALUES 1
Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
app/test-flow-perf/actions_gen.c | 131 +++++++++++++++++++++++++++----
app/test-flow-perf/config.h | 6 ++
2 files changed, 120 insertions(+), 17 deletions(-)
diff --git a/app/test-flow-perf/actions_gen.c b/app/test-flow-perf/actions_gen.c
index 278c0a3004..e3a95d7ab2 100644
--- a/app/test-flow-perf/actions_gen.c
+++ b/app/test-flow-perf/actions_gen.c
@@ -214,6 +214,10 @@ add_set_src_mac(struct rte_flow_action *actions,
uint32_t mac = para.counter;
uint16_t i;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ mac = 1;
+
/* Mac address to be set is random each time */
for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
set_mac.mac_addr[i] = mac & 0xff;
@@ -233,6 +237,10 @@ add_set_dst_mac(struct rte_flow_action *actions,
uint32_t mac = para.counter;
uint16_t i;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ mac = 1;
+
/* Mac address to be set is random each time */
for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) {
set_mac.mac_addr[i] = mac & 0xff;
@@ -249,9 +257,14 @@ add_set_src_ipv4(struct rte_flow_action *actions,
__rte_unused struct additional_para para)
{
static struct rte_flow_action_set_ipv4 set_ipv4;
+ uint32_t ip = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ip = 1;
/* IPv4 value to be set is random each time */
- set_ipv4.ipv4_addr = RTE_BE32(para.counter + 1);
+ set_ipv4.ipv4_addr = RTE_BE32(ip + 1);
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC;
actions[actions_counter].conf = &set_ipv4;
@@ -263,9 +276,14 @@ add_set_dst_ipv4(struct rte_flow_action *actions,
__rte_unused struct additional_para para)
{
static struct rte_flow_action_set_ipv4 set_ipv4;
+ uint32_t ip = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ip = 1;
/* IPv4 value to be set is random each time */
- set_ipv4.ipv4_addr = RTE_BE32(para.counter + 1);
+ set_ipv4.ipv4_addr = RTE_BE32(ip + 1);
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_SET_IPV4_DST;
actions[actions_counter].conf = &set_ipv4;
@@ -280,6 +298,10 @@ add_set_src_ipv6(struct rte_flow_action *actions,
uint32_t ipv6 = para.counter;
uint8_t i;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ipv6 = 1;
+
/* IPv6 value to set is random each time */
for (i = 0; i < 16; i++) {
set_ipv6.ipv6_addr[i] = ipv6 & 0xff;
@@ -299,6 +321,10 @@ add_set_dst_ipv6(struct rte_flow_action *actions,
uint32_t ipv6 = para.counter;
uint8_t i;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ipv6 = 1;
+
/* IPv6 value to set is random each time */
for (i = 0; i < 16; i++) {
set_ipv6.ipv6_addr[i] = ipv6 & 0xff;
@@ -317,9 +343,12 @@ add_set_src_tp(struct rte_flow_action *actions,
static struct rte_flow_action_set_tp set_tp;
uint32_t tp = para.counter;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ tp = 100;
+
/* TP src port is random each time */
- if (tp > 0xffff)
- tp = tp >> 16;
+ tp = tp % 0xffff;
set_tp.port = RTE_BE16(tp & 0xffff);
@@ -335,6 +364,10 @@ add_set_dst_tp(struct rte_flow_action *actions,
static struct rte_flow_action_set_tp set_tp;
uint32_t tp = para.counter;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ tp = 100;
+
/* TP src port is random each time */
if (tp > 0xffff)
tp = tp >> 16;
@@ -350,7 +383,14 @@ add_inc_tcp_ack(struct rte_flow_action *actions,
uint8_t actions_counter,
__rte_unused struct additional_para para)
{
- static rte_be32_t value = RTE_BE32(1);
+ static rte_be32_t value;
+ uint32_t ack_value = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ack_value = 1;
+
+ value = RTE_BE32(ack_value);
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_INC_TCP_ACK;
actions[actions_counter].conf = &value;
@@ -361,7 +401,14 @@ add_dec_tcp_ack(struct rte_flow_action *actions,
uint8_t actions_counter,
__rte_unused struct additional_para para)
{
- static rte_be32_t value = RTE_BE32(1);
+ static rte_be32_t value;
+ uint32_t ack_value = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ack_value = 1;
+
+ value = RTE_BE32(ack_value);
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK;
actions[actions_counter].conf = &value;
@@ -372,7 +419,14 @@ add_inc_tcp_seq(struct rte_flow_action *actions,
uint8_t actions_counter,
__rte_unused struct additional_para para)
{
- static rte_be32_t value = RTE_BE32(1);
+ static rte_be32_t value;
+ uint32_t seq_value = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ seq_value = 1;
+
+ value = RTE_BE32(seq_value);
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ;
actions[actions_counter].conf = &value;
@@ -383,7 +437,14 @@ add_dec_tcp_seq(struct rte_flow_action *actions,
uint8_t actions_counter,
__rte_unused struct additional_para para)
{
- static rte_be32_t value = RTE_BE32(1);
+ static rte_be32_t value;
+ uint32_t seq_value = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ seq_value = 1;
+
+ value = RTE_BE32(seq_value);
actions[actions_counter].type = RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ;
actions[actions_counter].conf = &value;
@@ -397,9 +458,12 @@ add_set_ttl(struct rte_flow_action *actions,
static struct rte_flow_action_set_ttl set_ttl;
uint32_t ttl_value = para.counter;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ttl_value = 1;
+
/* Set ttl to random value each time */
- while (ttl_value > 0xff)
- ttl_value = ttl_value >> 8;
+ ttl_value = ttl_value % 0xff;
set_ttl.ttl_value = ttl_value;
@@ -423,9 +487,12 @@ add_set_ipv4_dscp(struct rte_flow_action *actions,
static struct rte_flow_action_set_dscp set_dscp;
uint32_t dscp_value = para.counter;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ dscp_value = 1;
+
/* Set dscp to random value each time */
- while (dscp_value > 0xff)
- dscp_value = dscp_value >> 8;
+ dscp_value = dscp_value % 0xff;
set_dscp.dscp = dscp_value;
@@ -441,9 +508,12 @@ add_set_ipv6_dscp(struct rte_flow_action *actions,
static struct rte_flow_action_set_dscp set_dscp;
uint32_t dscp_value = para.counter;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ dscp_value = 1;
+
/* Set dscp to random value each time */
- while (dscp_value > 0xff)
- dscp_value = dscp_value >> 8;
+ dscp_value = dscp_value % 0xff;
set_dscp.dscp = dscp_value;
@@ -507,13 +577,18 @@ add_ipv4_header(uint8_t **header, uint64_t data,
struct additional_para para)
{
struct rte_flow_item_ipv4 ipv4_item;
+ uint32_t ip_dst = para.counter;
if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_IPV4)))
return;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ip_dst = 1;
+
memset(&ipv4_item, 0, sizeof(struct rte_flow_item_ipv4));
ipv4_item.hdr.src_addr = RTE_IPV4(127, 0, 0, 1);
- ipv4_item.hdr.dst_addr = RTE_BE32(para.counter);
+ ipv4_item.hdr.dst_addr = RTE_BE32(ip_dst);
ipv4_item.hdr.version_ihl = RTE_IPV4_VHL_DEF;
if (data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_UDP))
ipv4_item.hdr.next_proto_id = RTE_IP_TYPE_UDP;
@@ -574,6 +649,10 @@ add_vxlan_header(uint8_t **header, uint64_t data,
if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN)))
return;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ vni_value = 1;
+
memset(&vxlan_item, 0, sizeof(struct rte_flow_item_vxlan));
for (i = 0; i < 3; i++)
@@ -595,6 +674,10 @@ add_vxlan_gpe_header(uint8_t **header, uint64_t data,
if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_VXLAN_GPE)))
return;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ vni_value = 1;
+
memset(&vxlan_gpe_item, 0, sizeof(struct rte_flow_item_vxlan_gpe));
for (i = 0; i < 3; i++)
@@ -633,6 +716,10 @@ add_geneve_header(uint8_t **header, uint64_t data,
if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GENEVE)))
return;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ vni_value = 1;
+
memset(&geneve_item, 0, sizeof(struct rte_flow_item_geneve));
for (i = 0; i < 3; i++)
@@ -647,13 +734,18 @@ add_gtp_header(uint8_t **header, uint64_t data,
struct additional_para para)
{
struct rte_flow_item_gtp gtp_item;
+ uint32_t teid_value = para.counter;
if (!(data & FLOW_ITEM_MASK(RTE_FLOW_ITEM_TYPE_GTP)))
return;
+ /* Fixed value */
+ if (FIXED_VALUES)
+ teid_value = 1;
+
memset(>p_item, 0, sizeof(struct rte_flow_item_gtp));
- gtp_item.teid = RTE_BE32(para.counter);
+ gtp_item.teid = RTE_BE32(teid_value);
gtp_item.msg_type = 255;
memcpy(*header, >p_item, sizeof(gtp_item));
@@ -764,13 +856,18 @@ add_vxlan_encap(struct rte_flow_action *actions,
static struct rte_flow_item_ipv4 item_ipv4;
static struct rte_flow_item_udp item_udp;
static struct rte_flow_item_vxlan item_vxlan;
+ uint32_t ip_dst = para.counter;
+
+ /* Fixed value */
+ if (FIXED_VALUES)
+ ip_dst = 1;
items[0].spec = &item_eth;
items[0].mask = &item_eth;
items[0].type = RTE_FLOW_ITEM_TYPE_ETH;
item_ipv4.hdr.src_addr = RTE_IPV4(127, 0, 0, 1);
- item_ipv4.hdr.dst_addr = RTE_IPV4(255, 255, 255, 255);
+ item_ipv4.hdr.dst_addr = RTE_BE32(ip_dst);
item_ipv4.hdr.version_ihl = RTE_IPV4_VHL_DEF;
items[1].spec = &item_ipv4;
items[1].mask = &item_ipv4;
diff --git a/app/test-flow-perf/config.h b/app/test-flow-perf/config.h
index ee1a4a3724..8f42bc589c 100644
--- a/app/test-flow-perf/config.h
+++ b/app/test-flow-perf/config.h
@@ -16,6 +16,12 @@
#define NR_RXD 256
#define NR_TXD 256
+/* This is used for encap/decap & header modify actions.
+ * When it's 1: it means all actions have fixed values.
+ * When it's 0: it means all actions will have different values.
+ */
+#define FIXED_VALUES 1
+
/* Items/Actions parameters */
#define JUMP_ACTION_TABLE 2
#define VLAN_VALUE 1
--
2.17.1
next prev parent reply other threads:[~2020-08-30 11:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 02/13] doc/flow-perf: fix app sections Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 03/13] app/flow-perf: start supporting user order Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 04/13] app/flow-perf: add header modify actions support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 05/13] app/flow-perf: add flag action support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 06/13] app/flow-perf: fix memory leak from RSS action Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 07/13] app/flow-perf: add raw encap/decap actions support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 08/13] app/flow-perf: add VXLAN " Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 09/13] app/flow-perf: fix source ipv4 matching Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 10/13] app/flow-perf: add random mark id values Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 11/13] app/flow-perf: add set port mask to options Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 12/13] app/flow-perf: add icmp matching support Wisam Jaddo
2020-08-30 11:15 ` Wisam Jaddo [this message]
2020-09-14 18:15 ` [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Ferruh Yigit
2020-09-21 21:36 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200830111544.4190-14-wisamm@mellanox.com \
--to=wisamm@mellanox.com \
--cc=akozyrev@mellanox.com \
--cc=akozyrev@nvidia.com \
--cc=arybchenko@solarflare.com \
--cc=asafp@mellanox.com \
--cc=dev@dpdk.org \
--cc=jackmin@mellanox.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).