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 B4072A2E1B for ; Thu, 5 Sep 2019 12:18:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC8E91EF77; Thu, 5 Sep 2019 12:18:24 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id E8E981EF8C for ; Thu, 5 Sep 2019 12:18:23 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 62C80308213F; Thu, 5 Sep 2019 10:18:23 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844393DB3; Thu, 5 Sep 2019 10:18:22 +0000 (UTC) From: Kevin Traynor To: Andrew Rybchenko Cc: dpdk stable Date: Thu, 5 Sep 2019 11:17:09 +0100 Message-Id: <20190905101754.21933-9-ktraynor@redhat.com> In-Reply-To: <20190905101754.21933-1-ktraynor@redhat.com> References: <20190905101754.21933-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 05 Sep 2019 10:18:23 +0000 (UTC) Subject: [dpdk-stable] patch 'net/sfc: unify power of 2 alignment check macro' has been queued to LTS release 18.11.3 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 LTS release 18.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 09/12/19. 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. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/fc3912e3ff0a47ae476fa41067724f804283aa0c Thanks. Kevin Traynor --- >From fc3912e3ff0a47ae476fa41067724f804283aa0c Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Wed, 24 Jul 2019 14:16:34 +0100 Subject: [PATCH] net/sfc: unify power of 2 alignment check macro [ upstream commit 0270853d94e298820f3361b43dfdbf95e6a05c88 ] Substitute driver-defined IS_P2ALIGNED() with EFX_IS_P2ALIGNED() defined in libefx. Add type argument and cast value and alignment to one specified type. Fixes: e1b944598579 ("net/sfc: build libefx") Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/ef10_rx.c | 4 ++-- drivers/net/sfc/base/efx.h | 4 ++++ drivers/net/sfc/efsys.h | 43 +++++++++++++++++++--------------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c index 6e3277daf..d182ec801 100644 --- a/drivers/net/sfc/base/ef10_rx.c +++ b/drivers/net/sfc/base/ef10_rx.c @@ -1097,10 +1097,10 @@ ef10_rx_qcreate( goto fail7; } - if (!IS_P2ALIGNED(es_max_dma_len, + if (!EFX_IS_P2ALIGNED(uint32_t, es_max_dma_len, EFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT)) { rc = EINVAL; goto fail8; } - if (!IS_P2ALIGNED(es_buf_stride, + if (!EFX_IS_P2ALIGNED(uint32_t, es_buf_stride, EFX_RX_ES_SUPER_BUFFER_BUF_ALIGNMENT)) { rc = EINVAL; diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index eacd431df..444f6d1db 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -37,4 +37,8 @@ extern "C" { ((_type)(_value) & -(_type)(_align)) +/* Test if value is power of 2 aligned. */ +#define EFX_IS_P2ALIGNED(_type, _value, _align) \ + ((((_type)(_value)) & ((_type)(_align) - 1)) == 0) + /* Return codes */ diff --git a/drivers/net/sfc/efsys.h b/drivers/net/sfc/efsys.h index 8fd6e1bb5..2bfa29e79 100644 --- a/drivers/net/sfc/efsys.h +++ b/drivers/net/sfc/efsys.h @@ -70,11 +70,4 @@ typedef bool boolean_t; #endif -/* There are macros for alignment in DPDK, but we need to make a proper - * correspondence here, if we want to re-use them at all - */ -#ifndef IS_P2ALIGNED -#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0) -#endif - #ifndef ISP2 #define ISP2(x) rte_is_power_of_2(x) @@ -228,5 +221,6 @@ typedef struct efsys_mem_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_dword_t))); \ \ _addr = (volatile uint32_t *)(_base + (_offset)); \ @@ -245,5 +239,6 @@ typedef struct efsys_mem_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_qword_t))); \ \ _addr = (volatile uint64_t *)(_base + (_offset)); \ @@ -263,5 +258,6 @@ typedef struct efsys_mem_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_oword_t))); \ \ _addr = (volatile __m128i *)(_base + (_offset)); \ @@ -284,5 +280,6 @@ typedef struct efsys_mem_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_dword_t))); \ \ EFSYS_PROBE2(mem_writed, unsigned int, (_offset), \ @@ -301,5 +298,6 @@ typedef struct efsys_mem_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_qword_t))); \ \ EFSYS_PROBE3(mem_writeq, unsigned int, (_offset), \ @@ -319,5 +317,6 @@ typedef struct efsys_mem_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_oword_t))); \ \ \ @@ -384,5 +383,6 @@ typedef struct efsys_bar_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_dword_t))); \ _NOTE(CONSTANTCONDITION); \ if (_lock) \ @@ -408,5 +408,6 @@ typedef struct efsys_bar_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_qword_t))); \ \ SFC_BAR_LOCK(_esbp); \ @@ -430,5 +431,6 @@ typedef struct efsys_bar_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_oword_t))); \ \ _NOTE(CONSTANTCONDITION); \ @@ -460,5 +462,6 @@ typedef struct efsys_bar_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_dword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_dword_t))); \ \ _NOTE(CONSTANTCONDITION); \ @@ -485,5 +488,6 @@ typedef struct efsys_bar_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_qword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_qword_t))); \ \ SFC_BAR_LOCK(_esbp); \ @@ -519,5 +523,6 @@ typedef struct efsys_bar_s { \ _NOTE(CONSTANTCONDITION); \ - SFC_ASSERT(IS_P2ALIGNED(_offset, sizeof(efx_oword_t))); \ + SFC_ASSERT(EFX_IS_P2ALIGNED(size_t, _offset, \ + sizeof(efx_oword_t))); \ \ _NOTE(CONSTANTCONDITION); \ -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-09-05 10:36:48.058773883 +0100 +++ 0009-net-sfc-unify-power-of-2-alignment-check-macro.patch 2019-09-05 10:36:47.473701408 +0100 @@ -1 +1 @@ -From 0270853d94e298820f3361b43dfdbf95e6a05c88 Mon Sep 17 00:00:00 2001 +From fc3912e3ff0a47ae476fa41067724f804283aa0c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0270853d94e298820f3361b43dfdbf95e6a05c88 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index bb4489bbf..5f5dd3c62 100644 +index 6e3277daf..d182ec801 100644 @@ -25,2 +26,2 @@ -@@ -1120,10 +1120,10 @@ ef10_rx_qcreate( - goto fail9; +@@ -1097,10 +1097,10 @@ ef10_rx_qcreate( + goto fail7; @@ -32 +33 @@ - goto fail10; + goto fail8; @@ -39 +40 @@ -index 6aff68b54..53ddaa987 100644 +index eacd431df..444f6d1db 100644 @@ -42 +43 @@ -@@ -38,4 +38,8 @@ extern "C" { +@@ -37,4 +37,8 @@ extern "C" { @@ -52 +53 @@ -index 79fd3c144..eab5479a4 100644 +index 8fd6e1bb5..2bfa29e79 100644 @@ -67 +68 @@ -@@ -232,5 +225,6 @@ typedef struct efsys_mem_s { +@@ -228,5 +221,6 @@ typedef struct efsys_mem_s { @@ -75 +76 @@ -@@ -249,5 +243,6 @@ typedef struct efsys_mem_s { +@@ -245,5 +239,6 @@ typedef struct efsys_mem_s { @@ -83 +84 @@ -@@ -267,5 +262,6 @@ typedef struct efsys_mem_s { +@@ -263,5 +258,6 @@ typedef struct efsys_mem_s { @@ -91 +92 @@ -@@ -288,5 +284,6 @@ typedef struct efsys_mem_s { +@@ -284,5 +280,6 @@ typedef struct efsys_mem_s { @@ -99 +100 @@ -@@ -305,5 +302,6 @@ typedef struct efsys_mem_s { +@@ -301,5 +298,6 @@ typedef struct efsys_mem_s { @@ -107 +108 @@ -@@ -323,5 +321,6 @@ typedef struct efsys_mem_s { +@@ -319,5 +317,6 @@ typedef struct efsys_mem_s { @@ -115 +116 @@ -@@ -388,5 +387,6 @@ typedef struct efsys_bar_s { +@@ -384,5 +383,6 @@ typedef struct efsys_bar_s { @@ -123 +124 @@ -@@ -412,5 +412,6 @@ typedef struct efsys_bar_s { +@@ -408,5 +408,6 @@ typedef struct efsys_bar_s { @@ -131 +132 @@ -@@ -434,5 +435,6 @@ typedef struct efsys_bar_s { +@@ -430,5 +431,6 @@ typedef struct efsys_bar_s { @@ -139 +140 @@ -@@ -464,5 +466,6 @@ typedef struct efsys_bar_s { +@@ -460,5 +462,6 @@ typedef struct efsys_bar_s { @@ -147 +148 @@ -@@ -489,5 +492,6 @@ typedef struct efsys_bar_s { +@@ -485,5 +488,6 @@ typedef struct efsys_bar_s { @@ -155 +156 @@ -@@ -523,5 +527,6 @@ typedef struct efsys_bar_s { +@@ -519,5 +523,6 @@ typedef struct efsys_bar_s {