DPDK patches and discussions
 help / color / mirror / Atom feed
From: Amit Prakash Shukla <amitprakashs@marvell.com>
To: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
Subject: RE: [EXT] [PATCH v3 2/2] test: add reassembly perf test
Date: Tue, 30 May 2023 10:51:14 +0000	[thread overview]
Message-ID: <PH0PR18MB51671CFBCCC7E3B5FB58648DC84B9@PH0PR18MB5167.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20230529145502.11805-2-pbhagavatula@marvell.com>



> -----Original Message-----
> From: pbhagavatula@marvell.com <pbhagavatula@marvell.com>
> Sent: Monday, May 29, 2023 8:25 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh Bhagavatula
> <pbhagavatula@marvell.com>
> Subject: [EXT] [PATCH v3 2/2] test: add reassembly perf test
> 
> External Email
> 
> ----------------------------------------------------------------------
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Add reassembly perf autotest for both ipv4 and ipv6 reassembly.
> Each test is performed with variable number of fragments per flow, either
> ordered or unordered fragments and interleaved flows.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  app/test/meson.build            |    2 +
>  app/test/test_reassembly_perf.c | 1001
> +++++++++++++++++++++++++++++++
>  2 files changed, 1003 insertions(+)
>  create mode 100644 app/test/test_reassembly_perf.c
> 
> diff --git a/app/test/meson.build b/app/test/meson.build index
> d96ae7a961..70f320f388 100644
> --- a/app/test/meson.build
> +++ b/app/test/meson.build
> @@ -108,6 +108,7 @@ test_sources = files(
>          'test_rawdev.c',
>          'test_rcu_qsbr.c',
>          'test_rcu_qsbr_perf.c',
> +        'test_reassembly_perf.c',
>          'test_reciprocal_division.c',
>          'test_reciprocal_division_perf.c',
>          'test_red.c',
> @@ -297,6 +298,7 @@ perf_test_names = [
>          'trace_perf_autotest',
>          'ipsec_perf_autotest',
>          'thash_perf_autotest',
> +        'reassembly_perf_autotest',
>  ]
> 
>  driver_test_names = [
> diff --git a/app/test/test_reassembly_perf.c
> b/app/test/test_reassembly_perf.c new file mode 100644 index
> 0000000000..850485a9c5
> --- /dev/null
> +++ b/app/test/test_reassembly_perf.c
> @@ -0,0 +1,1001 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2023 Marvell.
> + */
> +
> +#include <rte_byteorder.h>
> +#include <rte_common.h>
> +#include <rte_cycles.h>
> +#include <rte_ether.h>
> +#include <rte_hexdump.h>
> +#include <rte_ip.h>
> +#include <rte_ip_frag.h>
> +#include <rte_mbuf.h>
> +#include <rte_mbuf_pool_ops.h>
> +#include <rte_random.h>
> +#include <rte_udp.h>
> +
> +#include "test.h"
> +
> +#define MAX_FLOWS	    (1024 * 32)
> +#define MAX_BKTS	    MAX_FLOWS
> +#define MAX_ENTRIES_PER_BKT 16
> +#define MAX_FRAGMENTS	    RTE_LIBRTE_IP_FRAG_MAX_FRAG
> +#define MIN_FRAGMENTS	    2
> +#define MAX_PKTS	    (MAX_FLOWS * MAX_FRAGMENTS)
> +
> +#define MAX_PKT_LEN 2048
> +#define MAX_TTL_MS  (5 * MS_PER_S)
> +
> +/* use RFC863 Discard Protocol */
> +#define UDP_SRC_PORT 9
> +#define UDP_DST_PORT 9
> +
> +/* use RFC5735 / RFC2544 reserved network test addresses */ #define
> +IP_SRC_ADDR(x) ((198U << 24) | (18 << 16) | (0 << 8) | (x)) #define
> +IP_DST_ADDR(x) ((198U << 24) | (18 << 16) | (1 << 8) | (x))
> +
> +/* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking
> +(RFC5180) */ static uint8_t ip6_addr[16] = {32, 1, 2, 0, 0, 0, 0, 0, 0,
> +0, 0, 0, 0, 0, 0, 0}; #define IP6_VERSION 6
> +
> +#define IP_DEFTTL 64 /* from RFC 1340. */
> +
> +static struct rte_ip_frag_tbl *frag_tbl; static struct rte_mempool
> +*pkt_pool; static struct rte_mbuf
> *mbufs[MAX_FLOWS][MAX_FRAGMENTS];
> +static uint8_t frag_per_flow[MAX_FLOWS]; static uint32_t flow_cnt;
> +
> +#define FILL_MODE_LINEAR      0
> +#define FILL_MODE_RANDOM      1
> +#define FILL_MODE_INTERLEAVED 2
> +
> +static int
> +reassembly_test_setup(void)
> +{
> +	uint64_t max_ttl_cyc = (MAX_TTL_MS * rte_get_timer_hz()) / 1E3;
> +
> +	frag_tbl = rte_ip_frag_table_create(MAX_FLOWS,

I see MAX_BKTS and MAX_FLOWS are same in this application. Just for code readability please use MAX_BKTS.

> MAX_ENTRIES_PER_BKT,
> +					    MAX_FLOWS *
> MAX_ENTRIES_PER_BKT,
> +					    max_ttl_cyc, rte_socket_id());
> +	if (frag_tbl == NULL)
> +		return TEST_FAILED;
> +
> +	rte_mbuf_set_user_mempool_ops("ring_mp_mc");
> +	pkt_pool = rte_pktmbuf_pool_create(
> +		"reassembly_perf_pool", MAX_FLOWS * MAX_FRAGMENTS,
> 0, 0,
> +		RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
> +	if (pkt_pool == NULL) {
> +		printf("[%s] Failed to create pkt pool\n", __func__);
> +		rte_ip_frag_table_destroy(frag_tbl);
> +		return TEST_FAILED;
> +	}
> +
> +	return TEST_SUCCESS;
> +}
> +
> +static void
> +reassembly_test_teardown(void)
> +{
> +	if (frag_tbl != NULL)
> +		rte_ip_frag_table_destroy(frag_tbl);
> +
> +	if (pkt_pool != NULL)
> +		rte_mempool_free(pkt_pool);
> +}
> +

<snip>

> +static void
> +ipv4_frag_fill_data(struct rte_mbuf **mbuf, uint8_t nb_frags, uint32_t
> flow_id,
> +		    uint8_t fill_mode)
> +{
> +	struct rte_ether_hdr *eth_hdr;
> +	struct rte_ipv4_hdr *ip_hdr;
> +	struct rte_udp_hdr *udp_hdr;
> +	uint16_t frag_len;
> +	uint8_t i;
> +
> +	frag_len = MAX_PKT_LEN / nb_frags;
> +	if (frag_len % 8)
> +		frag_len = RTE_ALIGN_MUL_CEIL(frag_len, 8);
> +
> +	for (i = 0; i < nb_frags; i++) {
> +		struct rte_mbuf *frag = mbuf[i];
> +		uint16_t frag_offset = 0;
> +		uint32_t ip_cksum;
> +		uint16_t pkt_len;
> +		uint16_t *ptr16;
> +
> +		frag_offset = i * (frag_len / 8);
> +
> +		if (i == nb_frags - 1)
> +			frag_len = MAX_PKT_LEN - (frag_len * (nb_frags -
> 1));
> +		else
> +			frag_offset |= RTE_IPV4_HDR_MF_FLAG;
> +
> +		rte_pktmbuf_reset_headroom(frag);
> +		eth_hdr = rte_pktmbuf_mtod(frag, struct rte_ether_hdr *);
> +		ip_hdr = rte_pktmbuf_mtod_offset(frag, struct rte_ipv4_hdr
> *,
> +						 sizeof(struct
> rte_ether_hdr));
> +		udp_hdr = rte_pktmbuf_mtod_offset(
> +			frag, struct rte_udp_hdr *,
> +			sizeof(struct rte_ether_hdr) +
> +				sizeof(struct rte_ipv4_hdr));
> +
> +		rte_ether_unformat_addr("02:00:00:00:00:01",
> +					&eth_hdr->dst_addr);
> +		rte_ether_unformat_addr("02:00:00:00:00:00",
> +					&eth_hdr->src_addr);
> +		eth_hdr->ether_type =
> rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
> +
> +		pkt_len = frag_len;
> +		/*
> +		 * Initialize UDP header.
> +		 */
> +		if (i == 0) {
> +			udp_hdr->src_port =
> rte_cpu_to_be_16(UDP_SRC_PORT);
> +			udp_hdr->dst_port =
> rte_cpu_to_be_16(UDP_DST_PORT);
> +			udp_hdr->dgram_len = rte_cpu_to_be_16(pkt_len);
> +			udp_hdr->dgram_cksum = 0; /* No UDP checksum.
> */
> +		}
> +
> +		/*
> +		 * Initialize IP header.
> +		 */
> +		pkt_len = (uint16_t)(pkt_len + sizeof(struct rte_ipv4_hdr));
> +		ip_hdr->version_ihl = RTE_IPV4_VHL_DEF;
> +		ip_hdr->type_of_service = 0;
> +		ip_hdr->fragment_offset = rte_cpu_to_be_16(frag_offset);
> +		ip_hdr->time_to_live = IP_DEFTTL;
> +		ip_hdr->next_proto_id = IPPROTO_UDP;
> +		ip_hdr->packet_id =
> +			rte_cpu_to_be_16((flow_id + 1) % UINT16_MAX);
> +		ip_hdr->total_length = rte_cpu_to_be_16(pkt_len);
> +		ip_hdr->src_addr =
> rte_cpu_to_be_32(IP_SRC_ADDR(flow_id));
> +		ip_hdr->dst_addr =
> rte_cpu_to_be_32(IP_DST_ADDR(flow_id));

Flow_id is 32 bit and max number of flows for this application are 32768. Using the flow-id directly for
First octet will overwrite even the subsequent octect. It is fine for this test as benchmark testing subnet
Is 198.18.0.0/15 and with 32k flows it is not beaching the network part of the ip-address, but a comment
Will help if anyone tries to increase number of flows in future.

> +
> +		/*
> +		 * Compute IP header checksum.
> +		 */
> +		ptr16 = (unaligned_uint16_t *)ip_hdr;
> +		ip_cksum = 0;
> +		ip_cksum += ptr16[0];
> +		ip_cksum += ptr16[1];
> +		ip_cksum += ptr16[2];
> +		ip_cksum += ptr16[3];
> +		ip_cksum += ptr16[4];
> +		ip_cksum += ptr16[6];
> +		ip_cksum += ptr16[7];
> +		ip_cksum += ptr16[8];
> +		ip_cksum += ptr16[9];

Reviewed-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Tested-by: Amit Prakash Shukla <amitprakashs@marvell.com>


  reply	other threads:[~2023-05-30 10:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 12:54 [PATCH 1/3] ip_frag: optimize key compare and hash generation pbhagavatula
2023-05-23 12:54 ` [PATCH 2/3] ip_frag: improve reassembly lookup performance pbhagavatula
2023-05-23 12:54 ` [PATCH 3/3] test: add reassembly perf test pbhagavatula
2023-05-23 14:39 ` [PATCH v2 1/3] ip_frag: optimize key compare and hash generation pbhagavatula
2023-05-23 14:39   ` [PATCH v2 2/3] ip_frag: improve reassembly lookup performance pbhagavatula
2023-05-23 16:22     ` Honnappa Nagarahalli
2023-05-23 17:58       ` Pavan Nikhilesh Bhagavatula
2023-05-23 22:23         ` Pavan Nikhilesh Bhagavatula
2023-05-23 22:30     ` Stephen Hemminger
2023-05-29 13:17       ` [EXT] " Pavan Nikhilesh Bhagavatula
2023-05-23 14:39   ` [PATCH v2 3/3] test: add reassembly perf test pbhagavatula
2023-05-29 14:55   ` [PATCH v3 1/2] ip_frag: optimize key compare and hash generation pbhagavatula
2023-05-29 14:55     ` [PATCH v3 2/2] test: add reassembly perf test pbhagavatula
2023-05-30 10:51       ` Amit Prakash Shukla [this message]
2023-05-30  3:09     ` [PATCH v3 1/2] ip_frag: optimize key compare and hash generation Stephen Hemminger
2023-05-30 17:50       ` [EXT] " Pavan Nikhilesh Bhagavatula
2023-05-30  7:44     ` Ruifeng Wang
2023-05-31  4:26     ` [PATCH v4 " pbhagavatula
2023-05-31  4:26       ` [PATCH v4 2/2] test: add reassembly perf test pbhagavatula
2023-06-05 11:12         ` Константин Ананьев
2023-06-02 17:01       ` [PATCH v5 1/2] ip_frag: optimize key compare and hash generation pbhagavatula
2023-06-02 17:01         ` [PATCH v5 2/2] test: add reassembly perf test pbhagavatula
2023-06-27  9:36           ` Konstantin Ananyev
2023-06-05 11:09         ` [PATCH v5 1/2] ip_frag: optimize key compare and hash generation Константин Ананьев
2023-06-27  9:23         ` Konstantin Ananyev
2023-07-11 16:52         ` [PATCH v6 " pbhagavatula
2023-07-11 16:52           ` [PATCH v6 2/2] test: add reassembly perf test pbhagavatula
2023-07-12 14:59           ` [PATCH v6 1/2] ip_frag: optimize key compare and hash generation 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=PH0PR18MB51671CFBCCC7E3B5FB58648DC84B9@PH0PR18MB5167.namprd18.prod.outlook.com \
    --to=amitprakashs@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    /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).