From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2D1541DEC; Sun, 5 Mar 2023 21:52:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AC5240EF0; Sun, 5 Mar 2023 21:52:02 +0100 (CET) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by mails.dpdk.org (Postfix) with ESMTP id 0A04C40EE5 for ; Sun, 5 Mar 2023 21:52:01 +0100 (CET) Received: by mail-pj1-f66.google.com with SMTP id kb15so7870173pjb.1 for ; Sun, 05 Mar 2023 12:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678049520; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oSx5lkP5lAQIEt+7X900gHvplS6fsscXm8lfFn0Pn/c=; b=e6jWeR+RBVRDW7tptdgISextNj4X1cvRIDb+EibabG1qKXeOIn9gGtG7UY2g/qLcLn tbDhOMjyFthFrzTOWbywwXR6doeRENVVpWHgx8yqmEaqEeQs+aTWLku7yeHxKvbF8epP mO2kxb8zz5O31aU5SYaQvagzF+T3X5mPH8EWIGLqF6YgdvW88m7yHet50oWj7FSrKxc/ HQDHpH+/XSvtLTSFWyVhiP79q9qt92yVcJk8mY3I4s4tuYpABaM/+WUPhg0np5kcNYxK Zp4diPoBFlTnPaZ+xV4T19FmfnwyA/2xKaJWHUTKNhXH+Y6e3ZU0ICNO8h2CrS42AMt2 5GFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678049520; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oSx5lkP5lAQIEt+7X900gHvplS6fsscXm8lfFn0Pn/c=; b=ODTfrEU4Qn38mrzlFnB2w4owlgpJ5C5GgimfTOCpoJMxTKVz04e4OZgAh3eGV/cgUc nhTFc7FUczBr19qFBNs7t5+9kdAMxfG8yECYfwgmLZAKwrLqDZPuK1rI5/KkSX8LP/jq ybm+cw0gvimsuM06Qhf5LZX8GTuodxXGffw7qCaXwyi3hjLFHQPIxFiEV/ezmpIebnsC BVNS4ss2ddSpCcaBxiXCwVhkCKzMuSgiDx4dd1xKgOSjcax21ElgtFpt4FNfDUQMcgt9 h9OldB3m+7EynnKFmitHOtiXOJsbLPqqlMsZ2L7J8zpASqIiCrX2wMASbs3X6v96ibDN TJ6Q== X-Gm-Message-State: AO0yUKVSueRgJKIWjKE8NkbeOhagX7eW5k600RyjTZ3+FdA9FjuNQp8Z VdMdoyuGcq67cWdGZbQASeU4GQm8BUHWOX7967Y= X-Google-Smtp-Source: AK7set8pSspKd7FHoV3bFMqzDWxzk9YDe88ERRAwtLpodx0md1Psgu4y/OTEfSY+7ROgaB1dCLjfQQ== X-Received: by 2002:a17:902:e54a:b0:19e:8bfe:7d79 with SMTP id n10-20020a170902e54a00b0019e8bfe7d79mr11071183plf.1.1678049519635; Sun, 05 Mar 2023 12:51:59 -0800 (PST) Received: from localhost.localdomain ([139.177.225.233]) by smtp.gmail.com with ESMTPSA id d6-20020a170902cec600b00198fde9178csm5112608plg.197.2023.03.05.12.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 12:51:59 -0800 (PST) From: Zhuobin Huang To: dev@dpdk.org Cc: cunming.liang@intel.com Subject: [PATCH v2] app/test: fix data length of each packet segment Date: Mon, 6 Mar 2023 04:51:44 +0800 Message-Id: <20230305205144.14443-1-zobin1999@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org v2: * fix code format Fixes: a9c9e9698d5e ("app/test: allow to create packets of different sizes") Cc: cunming.liang@intel.com Signed-off-by: Zhuobin Huang --- ...x-data-length-of-each-packet-segment.patch | 54 +++++++++++++++++++ app/test/packet_burst_generator.c | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 0001-app-test-fix-data-length-of-each-packet-segment.patch diff --git a/0001-app-test-fix-data-length-of-each-packet-segment.patch b/0001-app-test-fix-data-length-of-each-packet-segment.patch new file mode 100644 index 0000000000..aa52bb2ae2 --- /dev/null +++ b/0001-app-test-fix-data-length-of-each-packet-segment.patch @@ -0,0 +1,54 @@ +From 7b3827259bded81127fb33572868815bd53ad564 Mon Sep 17 00:00:00 2001 +From: Zhuobin Huang +Date: Mon, 6 Mar 2023 04:13:20 +0800 +Subject: [PATCH] app/test: fix data length of each packet segment + +Assign correct data length to each segments according +to the given pkt_len and nb_pkt_segs, instead of +using pkt_len as the data_len of every packet segment + +Fixes: a9c9e9698d5e ("app/test: allow to create packets of different sizes") +Cc: cunming.liang@intel.com + +Signed-off-by: Zhuobin Huang +--- + app/test/packet_burst_generator.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c +index 6b42b9b83b..c2e51a3bf1 100644 +--- a/app/test/packet_burst_generator.c ++++ b/app/test/packet_burst_generator.c +@@ -350,6 +350,8 @@ generate_packet_burst_proto(struct rte_mempool *mp, + struct rte_mbuf *pkt_seg; + struct rte_mbuf *pkt; + ++ const uint8_t pkt_seg_data_len = pkt_len / nb_pkt_segs; ++ + for (nb_pkt = 0; nb_pkt < nb_pkt_per_burst; nb_pkt++) { + pkt = rte_pktmbuf_alloc(mp); + if (pkt == NULL) { +@@ -359,7 +361,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, + break; + } + +- pkt->data_len = pkt_len; ++ pkt->data_len = pkt_seg_data_len; + pkt_seg = pkt; + for (i = 1; i < nb_pkt_segs; i++) { + pkt_seg->next = rte_pktmbuf_alloc(mp); +@@ -369,7 +371,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, + goto nomore_mbuf; + } + pkt_seg = pkt_seg->next; +- pkt_seg->data_len = pkt_len; ++ if(i != nb_pkt_segs - 1) ++ pkt_seg->data_len = pkt_seg_data_len; ++ else ++ pkt_seg->data_len = pkt_seg_data_len + pkt_len % nb_pkt_segs; + } + pkt_seg->next = NULL; /* Last segment of packet. */ + +-- +2.34.1 + diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index c2e51a3bf1..940f6ddde8 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -371,7 +371,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, goto nomore_mbuf; } pkt_seg = pkt_seg->next; - if(i != nb_pkt_segs - 1) + if (i != nb_pkt_segs - 1) pkt_seg->data_len = pkt_seg_data_len; else pkt_seg->data_len = pkt_seg_data_len + pkt_len % nb_pkt_segs; -- 2.34.1