From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6084FA0C43 for ; Thu, 29 Jul 2021 09:13:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B772410EF; Thu, 29 Jul 2021 09:13:55 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2065.outbound.protection.outlook.com [40.107.100.65]) by mails.dpdk.org (Postfix) with ESMTP id 7BADB40687; Thu, 29 Jul 2021 09:13:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dZH8b346yLX5LLga364O7M1OjeUmf6M2tD0IT/pbxFD5fXxcxQnGmdX3gpZf6TLobDqxKNFMnodPRhJ/KR/ylJrMkc0/ZjmluQQr/rmfGJf0DmwaCBuLKQd07NNSE1klAy2DuRC9xaB/HOAL1hWm4qQ1UlOsYFBmRDRVKGYuvYKTHriWqqGXT4dS25NoTAKMWUpW9xzYNiUek8wz/4aK4sVg3Q78XQ82CAv3+C1FCjrJUFgov8755iq8fMKuU4Rg7yB4IJOUPLkx5i15u5vlrTw5PI/pHg60VTIfOln4emLM5lTfalUtHtSDvK8mu8GsxB1fOWvdWWZpERRziSSMZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XsIGefkTrKfA/JaUaFQ1GC+DE8ZZn1qk0Ix/k6NIPlc=; b=WgLtMpLUpu9foD/d91r/mujo2CmcIzie4DLHOcp2SRcStdgyyWDqDqYc1CBNEa5Q15o6MFSeNclZUmvDR/eea9+qKWl0iTwz8/UXL4bL7VVMXWjDzcDM/WonD7lqK4aEM6yPYWCGKVDSg+mgfIh5hUG844OIBQweWIV+/WF69v4GetPCODPCgYe58Dq35Ka6zPMXnny+fURKA2FE9CojRom92QcNvmmSgNnhvoRyW6MxwKqni7D/I8DqXohhDnooljARsK9fSoUa8hMivwc1UgY0bS2nUO7DIfAQMTQYZrk0oi+pf9c7gPQ8SzMiTYXhF60lr2DOIqMObF0Re/yQYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=ovn.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XsIGefkTrKfA/JaUaFQ1GC+DE8ZZn1qk0Ix/k6NIPlc=; b=aoe/DoWnXxerNtikLWMkvieoJAP4tadRBOOT0nDgT6yIqsDTVELkMYKOY0Ya1tHU6b1cUZCXxicZsNaHTCYNXGswTZvMurU0UfAIpeRN3ObInOnq21Ii2H7zxZ1QpPtFPlTXBT2hCy4A+X8aR5B4MibdbA07E7kUKHB0Hfj540bVB5z0PG2yMAc5wq3vgYQUUPNvoAjwE3/kl3ota+DyFWKeo4mbjllIBh7pfnHd5OJhncwDdEYEZ5I902+hUMg03XgLQDG/qBi7iD08cjgqrdilYDs5wxDsTtDgopTrsaRng5Cdnrsf6Sj2OysHnXih0kTH8BukxVKog6vBp4jbcA== Received: from BN8PR12CA0013.namprd12.prod.outlook.com (2603:10b6:408:60::26) by BL0PR12MB4707.namprd12.prod.outlook.com (2603:10b6:208:8a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.29; Thu, 29 Jul 2021 07:13:51 +0000 Received: from BN8NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::5a) by BN8PR12CA0013.outlook.office365.com (2603:10b6:408:60::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.20 via Frontend Transport; Thu, 29 Jul 2021 07:13:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; ovn.org; dkim=none (message not signed) header.d=none;ovn.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT068.mail.protection.outlook.com (10.13.177.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4373.18 via Frontend Transport; Thu, 29 Jul 2021 07:13:50 +0000 Received: from [172.27.12.234] (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 29 Jul 2021 07:13:47 +0000 To: Olivier Matz CC: , Ilya Maximets , Gaetan Rivet , Majd Dibbiny , Asaf Penso , Thomas Monjalon , Harry Van Haaren , References: <20210713064910.12793-1-elibr@nvidia.com> <20210713064910.12793-3-elibr@nvidia.com> From: Eli Britstein Message-ID: <045f7d4b-c9dc-0a1e-25c8-359f14dfcc66@nvidia.com> Date: Thu, 29 Jul 2021 10:13:45 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 156f427a-28fb-46b7-4fa0-08d952606ac2 X-MS-TrafficTypeDiagnostic: BL0PR12MB4707: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: No7LmY6TTVEYjvqGVeYJ8VVjgmjyRYcLUyMUqZ4HZE9QK/6WhBd1ytHIWIkDuva8QdrtM1saqmoDASF+T1ar4pq8lr7k6qggpaukVieafa7CGEMWEb/rvgAY/osre635aJDSgiNN02rXPD66gg0wOXsRnNFHXLonuJSARcfAdNIMgSpSflYxUtohXG6NUmIxWXoRP+LXtvjjLx181YkQgXLVpG+RPJ77wPkKB9UCNBszbEZWQqZ5TP2P8O1eFbv3ZsQEkAOkOwdly2GN0Z7+692g+/C0ovV4j5zRkg6Wm2XT9z8ayT+4h+kzrm/LvvoN/c1YPCQvY/OV+Tm/yDC+4ODBJiw1zO9SwafZ8TpL7Jw8U+sSX0qEbsZLHapuZpVgeh7nLM7Ua2+JSp+Vmyu9YmeB+HE7Ezd879oq4hbQr0MKo40C0XD63IM35FzPfSaVOS4Qw/rJjxtYahG4ppXMte7fHixnaUGkea/lbJpJ/uLlxn8m7yTYtcE+ThQU6zS2zdGHrPQ3s8xjNeF80xdS6U0fxAFJi5nIzRZw0Rv4cs5hQ8xuVNf3BX7wrDRSWS2fNHnCbNwExQH0sZxZbQfapspnovOHW8xV0Fb3keYiOX0sSo5SzamdzqLvxK+JWEJFEBE96sqcU+IxP4aNDGpRbDNw1i4K1TSllIMRaQRqodOJu0wbz/FFPjvAUIBvLK7zK+1mJ2Yr/CdaczmX1pxdATuFLRKOPufOKifecaw8v/NOGsQXN5AYNIn8wj+SbnRKredkCfMNvejoTxc/cyZsVGWhskvIM1mJkqtZpeovVDvtwOPlCbBZd95Ch6K+/bcEepFvehhzRLc8Ly4qyFipJrbvgOoXpYTamoUJkndcLa8= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(346002)(376002)(396003)(136003)(46966006)(36840700001)(31696002)(82310400003)(70206006)(47076005)(478600001)(86362001)(36860700001)(7636003)(4326008)(36906005)(336012)(31686004)(5660300002)(6916009)(83380400001)(356005)(426003)(70586007)(316002)(2616005)(53546011)(26005)(186003)(36756003)(16526019)(8676002)(16576012)(966005)(82740400003)(8936002)(54906003)(2906002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2021 07:13:50.9554 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 156f427a-28fb-46b7-4fa0-08d952606ac2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4707 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 2/3] mbuf: avoid cast-align warning in pktmbuf mtod offset macro X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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" On 7/28/2021 6:28 PM, Olivier Matz wrote: > External email: Use caution opening links or attachments > > > On Tue, Jul 13, 2021 at 09:49:09AM +0300, Eli Britstein wrote: >> In rte_pktmbuf_mtod_offset macro, there is a casting from char * to type >> 't', which may cause cast-align warning when using gcc flags >> '-Werror -Wcast-align': >> >> .../include/rte_mbuf_core.h:723:3: error: cast increases required alignment >> of target type [-Werror=cast-align] >> 723 | ((t)((char *)(m)->buf_addr + (m)->data_off + (o))) >> | ^ >> >> As the code assumes correct alignment, add first a (void *) casting, to >> avoid the warning. >> >> Fixes: af75078fece3 ("first public release") >> Cc: stable@dpdk.org >> >> Signed-off-by: Eli Britstein > My initial thinking was that it's the problem of the application: if > -Werror=cast-align is used, it is up to the application to cast the > return value of rte_pktmbuf_mtod_offset() to (void *) before casting it > to the network type. > > But, if I understand correctly, the problem is not about the application > code itself, but about inlined code in the header files of dpdk > (i.e. compiling an empty C file that just includes the dpdk headers with > -Werror=cast-align). Is it correct? If yes I think it should be > highlighted in the commit log. I think yes, though in this specific patch it is not even an inline function, but a macro. However, I don't have a synthetic application example to show those warnings, thus didn't put such in the commit msg. > > Out of curiosity, how did you find the errors? I mean, is it possible > that some casts are missing some other headers, or is this patchset > exhaustive? Currently OVS-DPDK is compiled only with -Wno-cast-align. Following complaint that a recent commit introduced a degradation in OVS [1], I compiled OVS without this warning deprecation. The fixes in OVS are [2] and [3] (already merged). The fixes in DPDK are in this patch-set. [1] https://mail.openvswitch.org/pipermail/ovs-dev/2021-July/385084.html [2] https://mail.openvswitch.org/pipermail/ovs-dev/2021-July/386278.html     e8cccd3a3589 ("netdev-offload-dpdk: Fix IPv6 rewrite cast-align warning.") [3] https://mail.openvswitch.org/pipermail/ovs-dev/2021-July/386279.html     1f7f557603a5 ("netdev-offload-dpdk: Fix vxlan vni cast-align warnings.") > Thanks, > Olivier > > >> --- >> lib/mbuf/rte_mbuf_core.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h >> index bb38d7f581..dabdeee604 100644 >> --- a/lib/mbuf/rte_mbuf_core.h >> +++ b/lib/mbuf/rte_mbuf_core.h >> @@ -720,7 +720,7 @@ struct rte_mbuf_ext_shared_info { >> * The type to cast the result into. >> */ >> #define rte_pktmbuf_mtod_offset(m, t, o) \ >> - ((t)((char *)(m)->buf_addr + (m)->data_off + (o))) >> + ((t)(void *)((char *)(m)->buf_addr + (m)->data_off + (o))) >> >> /** >> * A macro that points to the start of the data in the mbuf. >> -- >> 2.28.0.2311.g225365fb51 >>