From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Marchand Subject: [RFC 2/2] ethdev: check received mbufs sanity Date: Mon, 13 Aug 2018 18:03:46 +0200 Message-ID: <1534176226-21911-2-git-send-email-david.marchand@6wind.com> References: <1534176226-21911-1-git-send-email-david.marchand@6wind.com> Cc: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Olivier Matz To: dev@dpdk.org Return-path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 9618D493D for ; Mon, 13 Aug 2018 18:04:28 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id w24-v6so9342083wmc.1 for ; Mon, 13 Aug 2018 09:04:28 -0700 (PDT) In-Reply-To: <1534176226-21911-1-git-send-email-david.marchand@6wind.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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