From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08268A052F for ; Mon, 10 Feb 2020 12:39:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D382E1BF7C; Mon, 10 Feb 2020 12:39:17 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 17B171B9BF; Mon, 10 Feb 2020 12:39:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2020 03:39:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,424,1574150400"; d="scan'208";a="431573506" Received: from silpixa00373417.ir.intel.com (HELO silpixa00373417.ger.corp.intel.com) ([10.237.223.96]) by fmsmga005.fm.intel.com with ESMTP; 10 Feb 2020 03:39:12 -0800 From: Ciara Loftus To: dev@dpdk.org Cc: Ciara Loftus , stable@dpdk.org Date: Mon, 10 Feb 2020 11:40:07 +0000 Message-Id: <20200210114009.49590-2-ciara.loftus@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200210114009.49590-1-ciara.loftus@intel.com> References: <20200210114009.49590-1-ciara.loftus@intel.com> Subject: [dpdk-stable] [PATCH v3 1/3] net/af_xdp: fix umem frame size & headroom calculations X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The previous frame size calculation incorrectly used mb_pool->private_data_size and didn't include mb_pool->header_size. Instead of performing a manual calculation, use the rte_mempool_calc_obj_size API to determine the frame size. The previous frame headroom calculation also incorrectly used mb_pool->private_data_size and didn't include mb_pool->header_size or the mbuf priv size. Fix this. Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") Cc: stable@dpdk.org Signed-off-by: Ciara Loftus --- drivers/net/af_xdp/rte_eth_af_xdp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 683e2a559..8b189119c 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -755,11 +756,13 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, void *base_addr = NULL; struct rte_mempool *mb_pool = rxq->mb_pool; - usr_config.frame_size = rte_pktmbuf_data_room_size(mb_pool) + - ETH_AF_XDP_MBUF_OVERHEAD + - mb_pool->private_data_size; - usr_config.frame_headroom = ETH_AF_XDP_DATA_HEADROOM + - mb_pool->private_data_size; + usr_config.frame_size = rte_mempool_calc_obj_size(mb_pool->elt_size, + mb_pool->flags, + NULL); + usr_config.frame_headroom = mb_pool->header_size + + sizeof(struct rte_mbuf) + + rte_pktmbuf_priv_size(mb_pool) + + RTE_PKTMBUF_HEADROOM; umem = rte_zmalloc_socket("umem", sizeof(*umem), 0, rte_socket_id()); if (umem == NULL) { -- 2.17.1