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 8922CA0C52; Thu, 21 Oct 2021 18:16:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C16F410E2; Thu, 21 Oct 2021 18:16:32 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2047.outbound.protection.outlook.com [40.107.101.47]) by mails.dpdk.org (Postfix) with ESMTP id B31F940683; Thu, 21 Oct 2021 18:16:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n/QeoKhfW8xIaOfuBR+3qp2/VS+vzN4WmAwTbUoGhtoUXm1Gx1YdWuqcZofZx93iLSbzJBEf4CZnK9sRaVffLnOvtiM9tuOrAcvb4H7CXdZha/BCMuoN1fP9nkoSbNOBSUYiyiBzB/SgCsW1IZqCgoTl57hn+ii9qBJ8wRByDxZbGxPnTUzCQVaBzkO4PHhtaiNg7d0DCG2Faau/5w72JSdsLmopa4IdYdkB2Crck2Hk7Sa2Vt4w4nnlAEQH1fB2PwpmG5RB9z0vtggCJoqVUiKUDX5nXoDgoURO/uWdwf0MXRz7RJZB55nBpoRzDPS1j4xi0HwC4vujqnBjbS22Lg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gQ6JLIcFcfuzveL/qcoiXUtDI3IrTMZt0jbuhGjdBjc=; b=PFCRqHqZsIydMbIwcJC/YJyGEdblWpUQDNMaudJBM1I7fwnqEro0bcE02e0DE92A5Vfa+wDM0iWrZic2YvD5VEUMW+GBBFif8oWPAl0BprW3h8Kmc+2xc5qgjrRcbesS3+ZkE4mLYfZ5nu7S/2AYggwZKplSfNjgjsZLXhhEGO7x6nCq82vyPJgo+oDJG0z8jlqZNLJxBCXobYDuMwVkGuWkXldwSw3ASz0BT22elfOmag0nmf//lPNPsO1bajWBOZ7OVAVcVrOHvAJNvbxqgKfHs8sw01TaBNBgLYyXz3hnYOami1A5U2/taS9XxNHfdKlSNepLdGw/d2mhl//6Eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=gQ6JLIcFcfuzveL/qcoiXUtDI3IrTMZt0jbuhGjdBjc=; b=TDL07c8G3hfmuXoQZ5MAb7b+QtXbmiN9u6qW9Bt3Y502C9ZTgB4LsxLL4LVcIFUXHsWc6gnXZ+uyNohm0sfTLJMlzbHMkZDqFdaiPgsJO4I0A3GXy21zlTT4tUJj2Zpino/FDt/qGP9gHoVxdE/juLaOIqmR/QX6zPTwjUCPQVjWQhx87As4UKPn5i0oV1Ao34On6EFNxEsX8j+nP8ApRe8GU9PM5jb04mOiaqOlx0xf5nAs/HySbiof41IKIx3C/FspY6a68SR4e4X7bTcriO2u9KUO19fruDYkrB1DYeV6P3qmwwd8MDDi++tPy+475KTVgW3IAN2sgjK5npdiBg== Received: from BN9PR03CA0929.namprd03.prod.outlook.com (2603:10b6:408:107::34) by CH2PR12MB4054.namprd12.prod.outlook.com (2603:10b6:610:a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Thu, 21 Oct 2021 16:16:27 +0000 Received: from BN8NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:408:107:cafe::58) by BN9PR03CA0929.outlook.office365.com (2603:10b6:408:107::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Thu, 21 Oct 2021 16:16:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; 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 BN8NAM11FT064.mail.protection.outlook.com (10.13.176.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4628.16 via Frontend Transport; Thu, 21 Oct 2021 16:16:26 +0000 Received: from [172.27.13.59] (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 21 Oct 2021 16:16:22 +0000 To: Stephen Hemminger CC: , Matan Azrad , Asaf Penso , Slava Ovsiienko , Thomas Monjalon , , , , References: <20210713064910.12793-1-elibr@nvidia.com> <20211021085132.12672-1-elibr@nvidia.com> <20211021084848.21e24030@hermes.local> From: Eli Britstein Message-ID: <1ce86c5c-6255-398b-de8a-8c79c6c747cd@nvidia.com> Date: Thu, 21 Oct 2021 19:16:19 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211021084848.21e24030@hermes.local> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4980aa3-1d28-4b2a-1c33-08d994ae22a0 X-MS-TrafficTypeDiagnostic: CH2PR12MB4054: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z36TYxmZpx37twzi/I7dEWXBoCwB0/0XnWaMpy2b/7FnninSHSXiWu3fYJQjxgDw740ZOQUfh7HsS0l1dUT3Gg8QVdIbLPeUzLySPkaaTt1JmaTlQNjIcF6jlRGhoq4W29QMoZc03Zc5JUm8X5MunlsYR1tXmXCRHcwXnniOtBY0jmbRRwKRu0v7LFu/xcLQWyD7sYSXwQmFySEs7r7YLqA81yKGznwJfBXf00RPuJXOvceQtUcoKFxEzkbAY86lg8OU82tPGyGaqo5As8I0kFudIKGpD5KAuickN0saFVtjaOm28DDM31Xnoo8frrluII18a4u8Yu5ZA1cu+rOBpfoEhn3WNwDgQRyuZ3NPOsVVGsOnI2z82ww6CWT41T8c6Iv+dSQwQNUjufSgrXz+XxKkGeCv27sP1Qik43DsUiqfN5dmsPdUpU/b/Zk8pdSfPIxiYInlsnRtoHy/1S/JhCHFzms8JbOCygrV9OnOePj1CRuJJEneTKRyGVvukmrP34dZCIZH7RzI9AEyY7qF2CDz9s1Qiw8Cq3OcPieBejsNe2gJtVBzcaYHzfijV5lelUNe1fRz7NzDIuJCVDKRHz2WZ4zFnTS+7cJPRC9OttP0ajaefAm9ggCXvrNXyC87aYAIhPmUjwkQKwr9Eaez4wgcaljWq6BHhEDeca7W0iSZQqC9NgveqKSGaPMTXdK+Mdpa6TEr1hn+eq0KEAvMiAwfv9NNC/7cHZzQ1y6F9V0= 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)(46966006)(36840700001)(47076005)(53546011)(36860700001)(316002)(426003)(6916009)(70586007)(356005)(8936002)(54906003)(4326008)(5660300002)(86362001)(31696002)(6666004)(8676002)(2616005)(70206006)(83380400001)(36906005)(16576012)(186003)(16526019)(7636003)(26005)(82310400003)(36756003)(336012)(2906002)(31686004)(508600001)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 16:16:26.9038 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4980aa3-1d28-4b2a-1c33-08d994ae22a0 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: BN8NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4054 Subject: Re: [dpdk-dev] [PATCH V2 1/3] net: avoid cast-align warning in VLAN insert function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 10/21/2021 6:48 PM, Stephen Hemminger wrote: > External email: Use caution opening links or attachments > > > On Thu, 21 Oct 2021 11:51:30 +0300 > Eli Britstein wrote: > >> In rte_vlan_insert there is a casting of rte_pktmbuf_prepend returned >> value to (struct rte_ether_hdr *), which causes cast-align warning when >> using strict cast align flag with supporting gcc: >> gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 >> CFLAGS="-Wcast-align=strict" make V=1 -C examples/l2fwd clean static >> >> In file included from main.c:35: >> /dpdk/build/include/rte_ether.h:370:7: warning: cast increases required >> alignment of target type [-Wcast-align] >> 370 | nh = (struct rte_ether_hdr *) >> | ^ >> >> As the code assumes correct alignment, add first a (void *) casting, to >> avoid the warning. >> >> Fixes: c974021a5949 ("ether: add soft vlan encap/decap") >> Cc: stable@dpdk.org >> >> Signed-off-by: Eli Britstein >> Acked-by: Olivier Matz > After cast to void * the second cast is not necessary. > > nh = (void *)rte_pktmbuf_prepend(...) > > Ideally rte_pktmbuf_prepend() should return void * but that is > an API change. Removing the second cast, it is silently done anyway, as 'nh' is of type 'struct rte_ether_hdr *'. Going with this approach (I can also do it for patch 3/3), we can change rte_pktmbuf_prepend to return (void *), and let the applications using it do the silent cast. What do you think?