From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F8ay8Sr30dnYt6hsKjgTHghlrOSSEb07gwA0PfNGyjI=; b=BtOgwK0sdDm0XwRyz7QV3iAyH3fVEmd1DaielanTWP3nXhqTvKEXTQYtnVJL1bjkVO TBK1k6GtXC09oWTvlVffsu5SMnvue5U3KPlxejAgkuy3K+vfwYDpoqvRYzkhRTQ7xl0q hybwwSPJD5uSVJ1G63uWAE4agT/hbmuuPwJhl0lcPF/He9+dXfHqGIze+zavTEnIf6DJ LHWF0g/YdIU+BUu9jY3cp+8Rwww19C/1CCQisUZA/Kt9gnmONyOL77cjdG7iAQQGQpML tMLjsM3SMEQDmabyrfBgdmx4MsmvrYZWODCumaxhvhUb+w1M5AVRs0y+Kte72ML1/Bi9 iF2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F8ay8Sr30dnYt6hsKjgTHghlrOSSEb07gwA0PfNGyjI=; b=KFnIiSNM7QsnyN57d+X76ebobuUNJtlrwJSvk7dWXobswqVyNKO8sbUy+1Hu7gLnUv +ZB3x+3Uw7luEnEGqJRoCOTteoUYAqlYJACri7qZS5ZIyRKbBlP+olCdor3ZLWFtQQ6U ZwyL8CQUhW/+GkpyNlT1mMkuEZKuNrvra8G1zFf4czaBkVx6Hp3KZGRZAPNVNhmgNn3A MXtCedX8pmljBtnCcZMmF8G7EJHxai+wWdimFg9fVOud5fXtCEfL4L93FqWWqL5u6sZL NSJuUilaII2tPhqgycq2hWDT+17iO1/U249vLb2y0zqY2duUV1xZj95PVOGu/pv2+dR/ ibsg== X-Gm-Message-State: AOUpUlEZDBESliAZT67bUKTa09LSlbQItvhgtr23IJWRxKHPHoQaRvp1 OPKtDtA8cpEjnXmPWolAicD+Z7A9Bfs= X-Google-Smtp-Source: AA+uWPxVDJFtBlUxJ/GsezSrJjYOX8NZCoJv+0NCCtxkALD+pnul1W4Q4CAcebOqFlT75oHGqDjmfQ== X-Received: by 2002:a1c:7c13:: with SMTP id x19-v6mr8949272wmc.27.1534176268016; Mon, 13 Aug 2018 09:04:28 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id m207-v6sm10613247wma.31.2018.08.13.09.04.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Aug 2018 09:04:27 -0700 (PDT) From: David Marchand To: dev@dpdk.org Cc: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Olivier Matz Date: Mon, 13 Aug 2018 18:03:46 +0200 Message-Id: <1534176226-21911-2-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534176226-21911-1-git-send-email-david.marchand@6wind.com> References: <1534176226-21911-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [RFC 2/2] ethdev: check received mbufs sanity X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2018 16:04:28 -0000 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