DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] [pktgen] [PATCH] Ignore the enable range cmd when sending packets
@ 2018-04-08 13:14 Bing Zhao
  0 siblings, 0 replies; only message in thread
From: Bing Zhao @ 2018-04-08 13:14 UTC (permalink / raw)
  To: keith.wiles, dev; +Cc: bing.zhao, Bing Zhao

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-08 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-08 13:14 [dpdk-dev] [PATCH] [pktgen] [PATCH] Ignore the enable range cmd when sending packets Bing Zhao

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).