From: "Donald_Lee@trendmicro.com" <Donald_Lee@trendmicro.com>
To: "thomas@monjalon.net" <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/tap: fix Rx miss the packets
Date: Thu, 4 Jul 2019 16:11:34 +0000 [thread overview]
Message-ID: <2936367A-8014-44CB-A597-798584D74581@trendmicro.com> (raw)
From: Donald Lee <donald_lee@trendmicro.com>
After pmd_rx_burst be triggered, it doesn't retrieve all the frames.
It may leave some pending frames there.
Signed-off-by: Donald Lee <donald_lee@trendmicro.com>
---
drivers/net/tap/rte_eth_tap.c | 7 ++++++-
drivers/net/tap/rte_eth_tap.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 3841842f0..e2785e011 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -353,10 +353,11 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
unsigned long num_rx_bytes = 0;
uint32_t trigger = tap_trigger;
- if (trigger == rxq->trigger_seen)
+ if (trigger == rxq->trigger_seen && !rxq->keep_trigger)
return 0;
if (trigger)
rxq->trigger_seen = trigger;
+ rxq->keep_trigger = 0;
process_private = rte_eth_devices[rxq->in_port].process_private;
rte_compiler_barrier();
for (num_rx = 0; num_rx < nb_pkts; ) {
@@ -431,6 +432,9 @@ pmd_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
bufs[num_rx++] = mbuf;
num_rx_bytes += mbuf->pkt_len;
}
+ /* may have pending packets, keep trigger */
+ if (num_rx == nb_pkts)
+ rxq->keep_trigger = 1;
end:
rxq->stats.ipackets += num_rx;
rxq->stats.ibytes += num_rx_bytes;
@@ -1352,6 +1356,7 @@ tap_rx_queue_setup(struct rte_eth_dev *dev,
rxq->mp = mp;
rxq->trigger_seen = 1; /* force initial burst */
+ rxq->keep_trigger = 0;
rxq->in_port = dev->data->port_id;
rxq->queue_id = rx_queue_id;
rxq->nb_rx_desc = nb_desc;
diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h
index 8d6d53dc0..842e8c0b7 100644
--- a/drivers/net/tap/rte_eth_tap.h
+++ b/drivers/net/tap/rte_eth_tap.h
@@ -45,6 +45,7 @@ struct pkt_stats {
struct rx_queue {
struct rte_mempool *mp; /* Mempool for RX packets */
uint32_t trigger_seen; /* Last seen Rx trigger value */
+ uint16_t keep_trigger; /* Keep trigger state */
uint16_t in_port; /* Port ID */
uint16_t queue_id; /* queue ID*/
struct pkt_stats stats; /* Stats for this RX queue */
--
2.19.1
<table class="TM_EMAIL_NOTICE"><tr><td><pre>
TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential
and may be subject to copyright or other intellectual property protection.
If you are not the intended recipient, you are not authorized to use or
disclose this information, and we request that you notify us by reply mail or
telephone and delete the original message from your mail system.
</pre></td></tr></table>
next reply other threads:[~2019-07-04 16:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 16:11 Donald_Lee [this message]
2019-07-04 16:42 ` Thomas Monjalon
2019-07-12 10:20 Donald_Lee
2019-07-12 13:50 ` Wiles, Keith
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=2936367A-8014-44CB-A597-798584D74581@trendmicro.com \
--to=donald_lee@trendmicro.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/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).