From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F3B5A04AB; Sun, 30 Aug 2020 13:24:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E85191C193; Sun, 30 Aug 2020 13:16:42 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50059.outbound.protection.outlook.com [40.107.5.59]) by dpdk.org (Postfix) with ESMTP id 785741C121 for ; Sun, 30 Aug 2020 13:16:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWsHELaEbaQDnNGyzsImLZXwDAT1a+f+COFCxq1YNSVjEiP4zeF2lrcLtopa2uvjwzCBYLYY+UmlVZhmPvJtMcWXX9JttJJ+eyhz7ZCGlEc2p8xjDZua00Mv0ZkUI0cU5XKCo0njxWYQRxKxt1q+q5/5KUhgTYi93cM8Hw/Wxn4v9u7t9yd7FZu4GqtpH2jxKfN/99rxi+M2jh+k83Q20RajBefXcLjtOFxyhe+WusYYpzqdwiy9Co9uN9Dk0txc6SD1859rl9ECSOog+0EoIO2hvHODLV7G7JutGZAQsfXsA/MJMU1G0rY3PSxxoXham25DpYaCUXlCzRsLbxb1CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s4gzNTuYc/Bm3VpkfC3jNr4WTDw29tJBbMMxMxWoeBU=; b=aF9MyPwrdIqc1+Gbe4/zWMxiYiuQ7ftRtMBczCEcluZrYXWcRb5O1zyoodCPs7zf+ZATiZi329CnMPJWcdvaLMCe5nrewGt72qySRpkOAIapWL7ytRDFzstRAsDKErX5x9n51EZx9nMRaWYSDUz6id0lKzdSeHiY1oCeTnzmexgiDFgmNbnqRnpoZ/LAE2tBft4KWqQy8T/8Y3wR2Au6g6u36aIzNhcRkWWNLcb6xIqNkV4ENO0GWK4GJVA6zCzpaz+TGZrrxABTQrWBmHEjrd/jHMmBTO8HX71hruN2pyjayspxwqlAmNG+z1NGXLg3ZPf6qHIHy8zc+8x5+f9v1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s4gzNTuYc/Bm3VpkfC3jNr4WTDw29tJBbMMxMxWoeBU=; b=oxB5SPr9pV5Q/4Ok5T1sFGTSHjeGxd6oeRmuWBcbT17ufr2qchxGZ+1Tyzu+xUQFcPsUACdjMSwHkcbmt4A2JxTnnZ+L6JPk/AnrouW9IOZR1TXiptmfRxgfq8GYpUqc+btWNVwh+KW3cl4x4tW/Vi49w/4iWFiR9F48RdIEX6w= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) by AM0PR0502MB3762.eurprd05.prod.outlook.com (2603:10a6:208:1b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.21; Sun, 30 Aug 2020 11:16:36 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::4c8a:9848:2e2a:3598]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::4c8a:9848:2e2a:3598%6]) with mapi id 15.20.3326.025; Sun, 30 Aug 2020 11:16:36 +0000 From: Wisam Jaddo To: dev@dpdk.org, thomas@monjalon.net, asafp@mellanox.com, akozyrev@nvidia.com, akozyrev@mellanox.com, arybchenko@solarflare.com, jackmin@mellanox.com Date: Sun, 30 Aug 2020 11:15:44 +0000 Message-Id: <20200830111544.4190-14-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200830111544.4190-1-wisamm@mellanox.com> References: <20200830111544.4190-1-wisamm@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: AM4PR05CA0008.eurprd05.prod.outlook.com (2603:10a6:205::21) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by AM4PR05CA0008.eurprd05.prod.outlook.com (2603:10a6:205::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Sun, 30 Aug 2020 11:16:35 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a0de68c4-8606-4eeb-7702-08d84cd62874 X-MS-TrafficTypeDiagnostic: AM0PR0502MB3762: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qgFMozcHhzTTJJT4dyu+rq+szb/zODeDQ7EOAqAewBLopFCzZ8ny97zDqoExzYdd3rJIEbw8Rck7rpruexMbH3HsbGCyY4Cqkw0f+qoLLX/tfORMVWvnEhYY44RYg2+2flMv1m4rMukkAWjz+GtXXRoGNqBkZcxVn//iq/hSbP5FlAxPAvegE2DJITQzr/jKviqBoFOpO+fp8uweoSZxEhlfZFFE7RjroxRQaOy6bOJrb8RbnyhU7SN/3fqjFho3trRg6RXvMYyj2fxWREF5eVJ9hDUR3Z7zaXgAWFCMcKZf/+m3fpj4SyzqVIzDkba8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6610.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(136003)(39860400002)(376002)(346002)(478600001)(316002)(5660300002)(8886007)(2906002)(6636002)(86362001)(36756003)(6666004)(1076003)(55016002)(8936002)(26005)(2616005)(7696005)(66946007)(66556008)(52116002)(83380400001)(16526019)(8676002)(186003)(956004)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 2uQcW4Tr/RCHPIeyohb7GmIEPi0ZikstlMUVnLcJuESrldg6R+EUwub6EnMNVv3HvgEgSE6OMlajKuWbVaD4/z9EqxDPvxKpPn/hzITdQXm6XnckAPzw508XMutXtCDCf0NNrjtvW2hPle4VNtXQTAYygrVu/lcZFPUbIMKOZHw+L2ec9qhN0AaInTz4xK4uGh88FEwTeGhKKu7mR+1bJEPUyb0Vyuj+vVba3l7YEHKuoDLHAG9Cnr7DdrJfNkfBQr0lSc5bJTw2Q3uDQm0DgN9rZbbXJd51qhjtAhTWgm7SmuFU6Z7nPwwHce0a8fCjpz3QXcDzAbfm8pwbz3e5GUu3l+rKjqJN6f2DPJ1AaYmJos8A1FhuHt77Lt491c1sTEu52Ik7pe6dSAHDhP4vwGP1Ztg0wA7/B5teh7h3MgNi5I6wL7T1fajrP6Zwct3/67WX+3brWmcAw7qHHfU8SlI2fW3s1ubVCOUdEQGkRzBl2Al4vupUprdpo50HH+l4ljk/jtzJ5+v71I9uv7o7aJ1qWJ74efDKk/PCgWskeQ7CSuUE0QmqKJdlPYPdzmO5QUCBiWdexQgwNy4fnP0X04MqmUWp0AozVDpP7PcUT6FqWdyfIHgvHfMpqIOIyY6RhV5q3iM6aG1V+TD8DAyZNA== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0de68c4-8606-4eeb-7702-08d84cd62874 X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB6610.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2020 11:16:36.0677 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q8pZAMNTLI/FP7wbK8r+Xw6nrm8vT+8Sa4ZPDExmf34zWlFq3dMPtm+CSuSMGUATyPlay6w9Tc1qFH1/dM9vPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3762 Subject: [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Alexander Kozyrev --- 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