DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bing Zhao <ilovethull@163.com>
To: keith.wiles@intel.com, dev@dpdk.org
Cc: bing.zhao@hxt-semitech.com, Bing Zhao <ilovethull@163.com>
Subject: [dpdk-dev] [PATCH] [pktgen] [PATCH] Ignore the enable range cmd when sending packets
Date: Sun,  8 Apr 2018 21:14:19 +0800	[thread overview]
Message-ID: <20180408131419.16348-1-ilovethull@163.com> (raw)

When using "enable [ports] range" command to enable the range sending feature, the code will only set the "SEND_RANGE_PKTS" without any "CLEAR_FAST_ALLOC_FLAG" (belongs to "start" command).
If the enable actiong is done when no packets are sending, everything will be OK. But when sending packets, it will automaticlly switch the bufferpool from tx_mp to range_mp without "pktgen_setup_packets" called to set up and fill some fileds of the buffers. I assume that the sending process will fail and the buffers will get leaked. (Correct me if anything wrong). And the alloc function will return -105 which indicates no free buffer. Then the only thing we can do is to quit the process and restart it.
To avoid such wrong operation procedures, a check is added in the enable_range function.

Thanks

Signed-off-by: Bing Zhao <ilovethull@163.com>
---
 app/pktgen-cmds.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c
index 66ea98a..cc3a2ec 100644
--- a/app/pktgen-cmds.c
+++ b/app/pktgen-cmds.c
@@ -2591,6 +2591,10 @@ void
 enable_range(port_info_t *info, uint32_t state)
 {
 	if (state == ENABLE_STATE) {
+		if (SENDING_PACKETS & rte_atomic32_read(&info->port_flags)) {
+			pktgen_log_warning("Cannot enable the range settings while sending packets!");
+			return;
+		}
 		pktgen_clr_port_flags(info, SEND_SEQ_PKTS);
 		pktgen_clr_port_flags(info, SEND_PCAP_PKTS);
 		pktgen_set_port_flags(info, SEND_RANGE_PKTS);
-- 
2.11.0.windows.1

                 reply	other threads:[~2018-04-08 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180408131419.16348-1-ilovethull@163.com \
    --to=ilovethull@163.com \
    --cc=bing.zhao@hxt-semitech.com \
    --cc=dev@dpdk.org \
    --cc=keith.wiles@intel.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).