Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp860727pxr; Mon, 11 Apr 2022 08:57:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVZff0d500CQzcybotkEp5CeUYp6JQKCxsTZs8Jakyf/BXaiNKmb0bYf7rA71XeAuWqjgu X-Received: by 2002:a17:902:bb85:b0:154:9a18:4a6d with SMTP id m5-20020a170902bb8500b001549a184a6dmr32632297pls.62.1649692667853; Mon, 11 Apr 2022 08:57:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649692667; cv=pass; d=google.com; s=arc-20160816; b=sJfNzWDvx6wKlzfvNGKBYwAxOCCcYQE4dmyIlhup0zuftrHw+C9rqWHRzj/3u23eQd s33Vbt0xzr1kmcQ9xCWs+AV0EFp9s/qDUZOuLrxRu9+3JW+3OEYvfc/tr54JsvEDd1im ZY1e5C6l1UkmqFkBJlzrZzpns2TEOsKN2n4GxRGpKo2aYYn9hUlUAG0+nCIsWm04ZYV+ PnjMKcxipWkvi2kggPp2KvDjIC7WeZJFAx9l9tXvSqjSJYmNgv4mzqPGp+E2U3VU9T9U j74e6eS/oAdqLfStBNun/8rwdE1CKDptikYthqcFkoIRlkkeWlqFjzFb02L9ANBXqEXG ZgSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=KOdfg8+fDHMrxFcwbEaPl+vpiKC2hLmjsFuZLQBHiXQ=; b=OVQizu2kvxytg0i86jZlibtlfJAaHdw2ggub6QbOmYxv+/it+L3A8PR95SmtJgVJwW k+n5OE3piJ8Ym9ILjVegwFYrg8JVu1CxcN8KNVA8scMAnzHB0CI2NqdkZ4odcE6RzdhE AcdZHWzs5HioxmdMEt4hNRFBtavL30X1/3jgzhmxlfS+ScsY/TF7jtzsAUNuTVvkFfgN exYdLlCZU28goTBK/VVut9yPLfy9TVHKqcHSPXdfn4F8HwfbYQ3jSOu7tUHhYBUKHQlX 8QXWqtCfW91XJP+8Z2YTSVTqfaoXR49d5MsNJhxqgAUq+uCRofMQ7qWRUJe9UeQEOygR boyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b=DRy7n78y; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a63210b000000b00382050266easi159965pgh.420.2022.04.11.08.57.32; Mon, 11 Apr 2022 08:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b=DRy7n78y; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239932AbiDIN4b (ORCPT + 99 others); Sat, 9 Apr 2022 09:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235318AbiDIN43 (ORCPT ); Sat, 9 Apr 2022 09:56:29 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2047.outbound.protection.outlook.com [40.107.102.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 741954757C for ; Sat, 9 Apr 2022 06:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dp8txRNfSOjEvS3AED/jnQI6FqZXBBMTdaa9b7nh5bvC5SyPjOMIzXnnLuyGwOvWtZ8OZDfb9PAAG/hsHJglfIrIWo5ZXSqNycLgsnmmHPH0gU1U5n6gfZgp9nxUwQQjKfsW/aOulMKP5uK8/cUJr25kE67kDx/lbGyYvPsKN22ZkzBmrlLzPv0VOPvcgMrctCJo75NzQXE2miD9nOq4muO911QsiQVRJKP9fFVBkg3klwNbRm2/DJXeBibTu+6ujDGhzJuTgs3u0OUeGI3mcciVk6Z2NgFC7KH93jp/4kFGoy2Wd4881isia1MaSy0cnI2BqsqF6xw6i+jtIjrchg== 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=KOdfg8+fDHMrxFcwbEaPl+vpiKC2hLmjsFuZLQBHiXQ=; b=cKn1wYLPIHIbh6uCblUea5t4UgaN8wij+h2cV3lVgdLvd3oVamLZabNjTglvQKyOO1+XkZX1ql6OK1b/CzxXpxdDV3c8IfgyW7WEgvRJv6NmG3N65GlGs1XzH0fM4RPZhcdtzkd3fzBZvY+VKLhM2WZByCyDTXG9MtbOYEME0fONNkQtMBvJyKc5ZAKDdl9J1Fc/sqVg5xsAThJHseOVzsWTo50PZYm3tWUlEIJOhLCQtiTUo9+QrlAA178n536D+yYAqx2E01V1qQkL1kEEKwOBkNhwReW4bMLX7CCMkb953yKPNU53nSIteOgQmpGXL1tZoFrLxgxTSHHZrbi0cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KOdfg8+fDHMrxFcwbEaPl+vpiKC2hLmjsFuZLQBHiXQ=; b=DRy7n78yURwN/ALSkMQFvk+IFoqXKf69mNM63SZXZvD4NWlZPPjjkeNDaLtLM6D3xojZgNTgx7exDVv5fhO22kUGmo/S+aZvFWO0/OI4CteN5LJILqVPdecCHTb6utwvz1+dEriae+ARicho6QjHQJNGGAody0HQi2TPi9rVO5U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by BL0PR11MB3505.namprd11.prod.outlook.com (2603:10b6:208:7d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.27; Sat, 9 Apr 2022 13:54:19 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::24bd:6fda:ce8c:191d]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::24bd:6fda:ce8c:191d%4]) with mapi id 15.20.5144.028; Sat, 9 Apr 2022 13:54:19 +0000 From: =?ISO-8859-1?Q?J=E9r=F4me?= Pouiller To: Julia Lawall , Jaehee Park Cc: Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev, Stefano Brivio Subject: Re: [PATCH] staging: wfx: use container_of() to get vif Date: Sat, 09 Apr 2022 15:54:09 +0200 Message-ID: <1911301.taCxCBeP46@pc-42> Organization: Silicon Labs In-Reply-To: <20220408222102.GB2511628@jaehee-ThinkPad-X1-Extreme> References: <20220407204128.GA1810425@jaehee-ThinkPad-X1-Extreme> <20220408222102.GB2511628@jaehee-ThinkPad-X1-Extreme> Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-ClientProxiedBy: PR0P264CA0142.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1a::34) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5c6713c-576f-468f-ac79-08da1a307152 X-MS-TrafficTypeDiagnostic: BL0PR11MB3505:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: naZaTA2n6luxr+UKEj/pJSHqrPi1RvmC1Y38Y6iuq7TD4TnqhfLK3mX6HRaVqTkuofUFxJtk3EBGJW9U/XwTbohonSYsAfzaPejhY/boYUWOlBgfeO9W+rKaEJktns8EmKcn9nIC0zA05ovtKrqWTb9ANNbJY8eCgH1aPz+N/BNqdQDsK2dPtelrjEXaE7PxmTKV2aqRf656eCc9el6WHOQsmAe745xD7AjaFpgMJyhO8nqn73B8KoeylBtL24cGbveo810Fhm2Xx7KuFgJiJzkC0fG46mN7P3W+Xf38pCE67oi7vnNFaZjaeZTEqTHGMmtCh9pf0yzZzb+SBh0JLGYQ1ztJaE1Gkl1a2QIvdPoM7R4/Tjz7tFibykt5B/wOsrtsmIJ4ygpOjA2BpRIbOnalJE9XHXG2dMwTuCCy3lqrGMQ6zwg64lpWc9pFpJlRg5g6tr47BSWJ3VNjDszHwEQDnYF1WOmR113HCcmzOJHbbU/15pA4lj17HSnY9sQQFBxBkRj1qUnAv9L2SF4bwLby+HB0Rk5M+lJpLRRqtkmHYQJWJiwFlzqssAxkZ8BDE3IPqoB9z3772pdMBZXlAsz92rAY8c/tvmzlk/JVlAZuTPgR4CyWQgHYADggV/r7PIZAcf8MW0Y+mXhDaPT6Yo6vvJju1E68jRoWI9ngqGJBJGiherFNx9gPuIbzObhci0QHjhHZoc1CkUmHyTEWCg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(7916004)(366004)(6666004)(36916002)(52116002)(9686003)(6506007)(6512007)(83380400001)(186003)(33716001)(8936002)(4326008)(8676002)(2906002)(5660300002)(66476007)(6486002)(508600001)(66946007)(54906003)(66556008)(110136005)(316002)(66574015)(86362001)(38100700002)(39026012);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?LfTcAI5Z+h3FufnpPslT2GH/byFEgI9Q64k36EgECBsZ7Qk7Id0aSmECVL?= =?iso-8859-1?Q?0UiApJAYZ7L2qKIKtDVsMIBzVQxAkq7bU+X49DqVm/INROndGHSFM0iSLb?= =?iso-8859-1?Q?hPb6HzSHxaZFYdlYte6D6iF8dC0esbiwOuALvQlDsxugw7dgNx91uwvped?= =?iso-8859-1?Q?4o0lktKMkJGVk5+n7D9ZOL1EVEkz/ScCm3+s1cyjzh8meE1xZi4+xi0UkC?= =?iso-8859-1?Q?8OJaRZnA8U5AAOyMehaRxa7yOocg8eKwg7CXRzVwJkUE56CK/ippDvAgY+?= =?iso-8859-1?Q?xC6PxQpcbp3d8MDqryzEGIhjllRF/3WGAQ4weNP1Iw1RjPgxtzjE9xVL8X?= =?iso-8859-1?Q?JTP2N3lj7ZTEW/4xJGYvd/hF/i4jTDsxQQXuLR2Oxn3IHlsv8acBMzEuLn?= =?iso-8859-1?Q?ZHZSsFA7U+lUx5weihAMHI/wTsPonElgn86SolmKv/GrsvA9W9T2HGj4W1?= =?iso-8859-1?Q?ZIogbQnoGxuPaukY0DqRwRlkds+/TXkysAX5w/GKT84hrKPrQdCG49u2TW?= =?iso-8859-1?Q?pj59Khrat+3Xa6Q696cAnW/RVhlFztM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1?Q?yuuEddaobzlUuphCe1BX+R+JZg8y1lwuSIOlFXqbcqW5QrVG/RbCKUu8rS?= =?iso-8859-1?Q?PKL6M9ojAdckYcqA8G4397CbO2Ah9FiUweJmLrArBy1In0ZnTmPVPYTtIH?= =?iso-8859-1?Q?dp15RipnQyRo/91nyaS+061lvwF/SjvAQArzLbuhvYQiSSjZw4FaVOHgcN?= =?iso-8859-1?Q?m5btF5bBKYVANsB5PSNRb3c4KpISx2rcitAfxx7GAaY10aRS3QvVCl0tPR?= =?iso-8859-1?Q?SK1615JF/ZHzYd8xk66nLlQqi81qJLJal+CnZm3CC/HcP1Tdj+MNRKeIDb?= =?iso-8859-1?Q?Beh8XC0bAK6eEIS1V+pxlJo4sMHyDoOAY5+DNpmgvH39rO9Lb6FTZIpY28?= =?iso-8859-1?Q?hRF/dHEjY3OrAtiaZ5HS2Dep/kKsB0aDqwU97CVOSyrNYU0B2lV2kUJQf8?= =?iso-8859-1?Q?ri?= X-MS-Exchange-AntiSpam-MessageData-1: yCVt7BnEQ+KISA== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5c6713c-576f-468f-ac79-08da1a307152 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2022 13:54:19.2090 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PzIDpsu+mUa0LLHCVDtofcqv+kOsbNo7bmvbDrj5drFUTm6+ujJqlDyHSetwNwqES+6MBCJc0fhvatcv08mOHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3505 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 9 April 2022 00:21:02 CEST Jaehee Park wrote: > On Fri, Apr 08, 2022 at 11:49:49AM +0200, Julia Lawall wrote: > > On Thu, 7 Apr 2022, Jaehee Park wrote: > > > > > Use container_of() to get vif. This improves the code in two ways: > > > [1] it speeds up the compilation because container_of() saves steps t= o > > > retrieve vif (the representation of ieee80211_vif), and > > > > I don't understand this part. > > > > julia > > >=20 > Thank you for your message. I revised the commit message (below)-- > I hope it makes it clearer. I'm open to suggestions as well! >=20 > Currently, upon virtual interface creation, wfx_add_interface() stores > a reference to the corresponding struct ieee80211_vif in private data, > for later usage. This is not needed when using the container_of > construct. This construct already has all the info it needs to retrieve > the reference to the corresponding struct from the offset that is > already available, inherent in container_of(), between its type and > member inputs (struct ieee80211_vif and drv_priv, respectively). > Remove vif (which was previously storing the reference to the struct > ieee80211_vif) from the struct wfx_vif, define a macro > wvif_to_vif(wvif) for container_of(), and replace all wvif->vif with > the newly defined container_of construct. >=20 > Sorry if I'm putting out more information than was asked for: > Diagram is worth a thousand words; this one is made by Stefano when > he was explaining the container_of() construct: >=20 > .-----------------------------------. > | .------------------------------. | > '->| struct ieee80211_vif | | > |------------------------------| | > | 1 | | > | 2 | | > | .--------------------------.| | > | 3| struct wfx_vif drv_priv | | > | |---------------------------| | > | | ... | | > | | | | > | | struct ieee80211_vif *vif---' > '------------------------------' > In this example, the offset is 3. > What I want to convey here is the compiler already knows the offset > of drv_priv within struct ieee80211_vif by using the container_of() > construct. So, it doesn't need to do extra work. Wow, nice ascii art :) I think that Julia has not understand why you said it "speeds up the compilation". I think you meant "speeds up the execution", don't you? --=20 J=E9r=F4me Pouiller