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 5D360A04DD for ; Wed, 28 Oct 2020 11:48:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 551462C2A; Wed, 28 Oct 2020 11:48:55 +0100 (CET) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by dpdk.org (Postfix) with ESMTP id 2CC342C2A for ; Wed, 28 Oct 2020 11:48:53 +0100 (CET) Received: by mail-wm1-f44.google.com with SMTP id e2so4295953wme.1 for ; Wed, 28 Oct 2020 03:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z+uqd4CiSn7V/4DCeB5ywq97akHg4EDLuviOkalqc5Y=; b=OE55R84M6uCXbe2D7tzQRY/rL1i1nvaWl6iHH7LT7+AywWjS43wtNdnr2DJcih0EwX KRRQomxp7bW8XcUFYhiEsn8ULXvtRtsMp2NyueIHJORVXyff2WKUFpctiRmu90G483x9 Nwqa19xWA0PNlu7RGAvdjtVJBQqbKQ8zT/DEnogLjtmJGaXY3KSLcDoFkG0lk8cFwYPW uojjEw3qZAEYQIbl4ycgXe0r2FogNp0IyWQGtVG+0R7aMlyHIx2xw+fcIk2QF5WhYOOt PyRZSLCRmUZIum4Rsx7u1FJ2zZ8Vd/TAsu/SbH042X7QHGm3g4iEv0t5Hn1dVyAhakjK ybfw== 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:mime-version:content-transfer-encoding; bh=z+uqd4CiSn7V/4DCeB5ywq97akHg4EDLuviOkalqc5Y=; b=BbAMk0+pHgscVyD0BCX+U7S8MDstVTxv1f+kKBoU+6f7V2t8/rZZRAsVrnxmxTmSll k2VyjYEbhVkUjKBNTuvCTOZJO2kKu0IegaihB0H/53e/obK1sD6sqb4s7sFrZpy6w1gV 1p5Jcd4YZhMmcDkg6y/ZIPa8NBA7jdZ7l+KMWunlVznowxPS9pJd00qiLYZmcBIhKdsj e1UjAzBVDGimus5UHRAG8mooM6JSmM0FtyPcXB0t0VSEseB6qJ7rm6gYYyCOP+2Vv9rN 0I9al1FZVrZHLTrQ7/ZrdCoM7ghEFWV659jmXdVXVJSxJg7NXr7r0kdRKoUDNla6mqWA DCJQ== X-Gm-Message-State: AOAM5339AXahBgiM7GOxDapGXxGnjWUC3bPpACCBfo6UrB4AYQFwHmRJ 6C1cznjeT8MXSPQTjFp8IZ4= X-Google-Smtp-Source: ABdhPJwxYsJXvtxnjd9DEW9D8AHoh7QEgLZXw1t5Gc264ovsVKN0GMq1SWww6azjaWdN9IPOcxGp9g== X-Received: by 2002:a7b:cc89:: with SMTP id p9mr7739221wma.4.1603882132877; Wed, 28 Oct 2020 03:48:52 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id o3sm6446288wru.15.2020.10.28.03.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:48:52 -0700 (PDT) From: luca.boccassi@gmail.com To: Ciara Loftus Cc: dpdk stable Date: Wed, 28 Oct 2020 10:43:30 +0000 Message-Id: <20201028104606.3504127-51-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/af_xdp: fix umem size' has been queued to stable release 19.11.6 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" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From fc8892c12e467fe1dd4aec41f328a0ffec7ce58f Mon Sep 17 00:00:00 2001 From: Ciara Loftus Date: Thu, 10 Sep 2020 09:06:47 +0000 Subject: [PATCH] net/af_xdp: fix umem size [ upstream commit fb053c35c66ee0052fcb715f137c49305f83a6db ] The kernel expects the start address of the UMEM to be page size aligned. Since the mempool is not guaranteed to have such alignment, we have been aligning the address to the start of the page the mempool is on. However when passing the 'size' of the UMEM during it's creation we did not take this into account. This commit adds the amount by which the address was aligned to the size of the UMEM. Bugzilla ID: 532 Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") Signed-off-by: Ciara Loftus --- drivers/net/af_xdp/rte_eth_af_xdp.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 844cd9986c..fbc95e5483 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -743,12 +743,17 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused, } #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) -static inline uint64_t get_base_addr(struct rte_mempool *mp) +static inline uint64_t get_base_addr(struct rte_mempool *mp, uint64_t *align) { struct rte_mempool_memhdr *memhdr; + uint64_t memhdr_addr, aligned_addr; memhdr = STAILQ_FIRST(&mp->mem_list); - return (uint64_t)memhdr->addr & ~(getpagesize() - 1); + memhdr_addr = (uint64_t)memhdr->addr; + aligned_addr = memhdr_addr & ~(getpagesize() - 1); + *align = memhdr_addr - aligned_addr; + + return aligned_addr; } static struct @@ -763,6 +768,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, .flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG}; void *base_addr = NULL; struct rte_mempool *mb_pool = rxq->mb_pool; + uint64_t umem_size, align = 0; usr_config.frame_size = rte_mempool_calc_obj_size(mb_pool->elt_size, mb_pool->flags, @@ -779,12 +785,11 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, } umem->mb_pool = mb_pool; - base_addr = (void *)get_base_addr(mb_pool); + base_addr = (void *)get_base_addr(mb_pool, &align); + umem_size = mb_pool->populated_size * usr_config.frame_size + align; - ret = xsk_umem__create(&umem->umem, base_addr, - mb_pool->populated_size * usr_config.frame_size, - &umem->fq, &umem->cq, - &usr_config); + ret = xsk_umem__create(&umem->umem, base_addr, umem_size, + &umem->fq, &umem->cq, &usr_config); if (ret) { AF_XDP_LOG(ERR, "Failed to create umem"); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:13.372652229 +0000 +++ 0051-net-af_xdp-fix-umem-size.patch 2020-10-28 10:35:11.516830200 +0000 @@ -1,8 +1,10 @@ -From fb053c35c66ee0052fcb715f137c49305f83a6db Mon Sep 17 00:00:00 2001 +From fc8892c12e467fe1dd4aec41f328a0ffec7ce58f Mon Sep 17 00:00:00 2001 From: Ciara Loftus Date: Thu, 10 Sep 2020 09:06:47 +0000 Subject: [PATCH] net/af_xdp: fix umem size +[ upstream commit fb053c35c66ee0052fcb715f137c49305f83a6db ] + The kernel expects the start address of the UMEM to be page size aligned. Since the mempool is not guaranteed to have such alignment, we have been @@ -15,7 +17,6 @@ Bugzilla ID: 532 Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") -Cc: stable@dpdk.org Signed-off-by: Ciara Loftus --- @@ -23,10 +24,10 @@ 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c -index 7ce4ad04af..b65ee449fc 100644 +index 844cd9986c..fbc95e5483 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c -@@ -746,12 +746,17 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused, +@@ -743,12 +743,17 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused, } #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) @@ -46,7 +47,7 @@ } static struct -@@ -766,6 +771,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, +@@ -763,6 +768,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, .flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG}; void *base_addr = NULL; struct rte_mempool *mb_pool = rxq->mb_pool; @@ -54,7 +55,7 @@ usr_config.frame_size = rte_mempool_calc_obj_size(mb_pool->elt_size, mb_pool->flags, -@@ -782,12 +788,11 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, +@@ -779,12 +785,11 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals __rte_unused, } umem->mb_pool = mb_pool;