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 522F4A0542; Fri, 7 Feb 2020 18:01:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 933E31C11B; Fri, 7 Feb 2020 18:01:35 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1E9061C0D8; Fri, 7 Feb 2020 18:01:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2020 09:01:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,414,1574150400"; d="scan'208";a="226528356" Received: from silpixa00373417.ir.intel.com (HELO silpixa00373417.ger.corp.intel.com) ([10.237.223.96]) by fmsmga008.fm.intel.com with ESMTP; 07 Feb 2020 09:01:31 -0800 From: Ciara Loftus To: dev@dpdk.org Cc: Ciara Loftus , stable@dpdk.org Date: Fri, 7 Feb 2020 17:02:24 +0000 Message-Id: <20200207170224.25564-1-ciara.loftus@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v2 1/3] net/af_xdp: fix umem frame size & headroom calculations 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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