DPDK patches and discussions
 help / color / mirror / Atom feed
From: Oleksandr Nahnybida <oleksandrn@interfacemasters.com>
To: reshma.pattan@intel.com, stephen@networkplumber.org
Cc: dev@dpdk.org
Subject: [PATCH v2 2/2] test/pcapng: test chained mbufs
Date: Fri, 13 Sep 2024 16:06:00 +0300	[thread overview]
Message-ID: <nefxl4axip5gfq4c7ployqxtnorgubcbrkugfziftcasq7jreb@bqyveydkttlq> (raw)
In-Reply-To: <rf7wzd6ytwereegdzzfduo46suisj5azxsfgvc3r5ufip6iwqt@bhidb2bsahmy>

Adjust test to check if pcapng works with chained mbufs

Signed-off-by: Oleksandr Nahnybida <oleksandrn@interfacemasters.com>
---
Sorry for the mess.
Resending PATCH v2 2/2 as the previous submission was incorrectly
threaded to the v1. Please ignore the earlier email

 app/test/test_pcapng.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c
index 2665b08c76..b219873c3a 100644
--- a/app/test/test_pcapng.c
+++ b/app/test/test_pcapng.c
@@ -102,6 +102,14 @@ mbuf1_prepare(struct dummy_mbuf *dm, uint32_t plen)
 	pkt.udp.dgram_len = rte_cpu_to_be_16(plen);

 	memcpy(rte_pktmbuf_mtod(dm->mb, void *), &pkt, sizeof(pkt));
+
+	/* Idea here is to create mbuf chain big enough that after mbuf deep copy they won't be
+	 * compressed into single mbuf to properly test store of chained mbufs
+	 */
+	dummy_mbuf_prep(&dm->mb[1], dm->buf[1], sizeof(dm->buf[1]), pkt_len);
+	dummy_mbuf_prep(&dm->mb[2], dm->buf[2], sizeof(dm->buf[2]), pkt_len);
+	rte_pktmbuf_chain(&dm->mb[0], &dm->mb[1]);
+	rte_pktmbuf_chain(&dm->mb[0], &dm->mb[2]);
 }

 static int
@@ -117,7 +125,7 @@ test_setup(void)

 	/* Make a pool for cloned packets */
 	mp = rte_pktmbuf_pool_create_by_ops("pcapng_test_pool",
-					    MAX_BURST, 0, 0,
+					    MAX_BURST * 32, 0, 0,
 					    rte_pcapng_mbuf_size(pkt_len) + 128,
 					    SOCKET_ID_ANY, "ring_mp_sc");
 	if (mp == NULL) {
@@ -155,7 +163,7 @@ fill_pcapng_file(rte_pcapng_t *pcapng, unsigned int num_packets)
 		for (i = 0; i < burst_size; i++) {
 			struct rte_mbuf *mc;

-			mc = rte_pcapng_copy(port_id, 0, orig, mp, pkt_len,
+			mc = rte_pcapng_copy(port_id, 0, orig, mp, rte_pktmbuf_pkt_len(orig),
 					     RTE_PCAPNG_DIRECTION_IN, NULL);
 			if (mc == NULL) {
 				fprintf(stderr, "Cannot copy packet\n");
--
2.46.0


  reply	other threads:[~2024-09-13 13:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 12:19 [PATCH 1/2] pcapng: fix handling of " Oleksandr Nahnybida
2024-09-13 12:34 ` [PATCH v2 " Oleksandr Nahnybida
2024-09-13 13:06   ` Oleksandr Nahnybida [this message]
2024-09-13 12:40 ` [PATCH v2 2/2] test/pcapng: test " Oleksandr Nahnybida
2024-09-13 15:27   ` Stephen Hemminger
2024-09-13 12:54 ` Oleksandr Nahnybida
2024-09-13 15:25 ` [PATCH 1/2] pcapng: fix handling of " Stephen Hemminger

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=nefxl4axip5gfq4c7ployqxtnorgubcbrkugfziftcasq7jreb@bqyveydkttlq \
    --to=oleksandrn@interfacemasters.com \
    --cc=dev@dpdk.org \
    --cc=reshma.pattan@intel.com \
    --cc=stephen@networkplumber.org \
    /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).