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 689D8A0542; Thu, 13 Feb 2020 03:46:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7013C1BDF8; Thu, 13 Feb 2020 03:46:58 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 6F2C41BDAE; Thu, 13 Feb 2020 03:46:56 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Feb 2020 18:46:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,434,1574150400"; d="scan'208";a="252131123" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga002.jf.intel.com with ESMTP; 12 Feb 2020 18:46:53 -0800 Date: Thu, 13 Feb 2020 10:45:33 +0800 From: Ye Xiaolong To: Ciara Loftus Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20200213024533.GN80720@intel.com> References: <20200210114009.49590-1-ciara.loftus@intel.com> <20200210114009.49590-2-ciara.loftus@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210114009.49590-2-ciara.loftus@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v3 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" On 02/10, Ciara Loftus wrote: >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 > Reviewed-by: Xiaolong Ye