DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <arybchenko@solarflare.com>,
	Olivier Matz <olivier.matz@6wind.com>
Subject: [dpdk-dev] [RFC 2/2] ethdev: check received mbufs sanity
Date: Mon, 13 Aug 2018 18:03:46 +0200	[thread overview]
Message-ID: <1534176226-21911-2-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1534176226-21911-1-git-send-email-david.marchand@6wind.com>

Let's check the mbufs given by the drivers directly in the rx handler.
The only drawback is that you need CONFIG_RTE_LIBRTE_MBUF_DEBUG to be set
for this to actually do some real checks.

Signed-off-by: David Marchand <david.marchand@6wind.com>
---
 lib/librte_ethdev/rte_ethdev.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 7070e9a..8843307 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3803,6 +3803,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 	uint16_t nb_rx;
+	uint16_t index;
 
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
@@ -3816,6 +3817,9 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
 	nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
 				     rx_pkts, nb_pkts);
 
+	for (index = 0; index < nb_rx; index++)
+		__rte_mbuf_sanity_check(rx_pkts[index], 1);
+
 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
 	if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) {
 		struct rte_eth_rxtx_callback *cb =
-- 
2.7.4

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 16:03 [dpdk-dev] [RFC 1/2] mbuf: add a sanity check on segment metadata David Marchand
2018-08-13 16:03 ` David Marchand [this message]
2018-08-24 10:17   ` [dpdk-dev] [RFC 2/2] ethdev: check received mbufs sanity David Marchand
2018-08-23  7:39 ` [dpdk-dev] [RFC 1/2] mbuf: add a sanity check on segment metadata Olivier Matz
2018-08-23  7:45   ` David Marchand

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=1534176226-21911-2-git-send-email-david.marchand@6wind.com \
    --to=david.marchand@6wind.com \
    --cc=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=olivier.matz@6wind.com \
    --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).