Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp828673pxb; Tue, 12 Apr 2022 14:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTmMdiaSAG7PbQowa1aCcRTzBsjGqWZZwBiHGuv7hoTyljV7SLbwTmKH07DoWovv5dT0PC X-Received: by 2002:a17:903:246:b0:153:87f0:a93e with SMTP id j6-20020a170903024600b0015387f0a93emr39735554plh.171.1649799428772; Tue, 12 Apr 2022 14:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649799428; cv=none; d=google.com; s=arc-20160816; b=YSVHBHqP4aF/2ffeMmUMkwvTXyhn1ywi4egqEMsOlsGv+5wqidSMdWqHFyjyOxvaPx hSwTuGaKPY0p3ElUnFl+9F4i8Digv4Cq8ztphbMPIUSA5+uqg1zzB4gHPu+SndaqEVAH c6L52sEgC4WMZb4UMTNaXnVU6IvuPIbt3cAc8VRVvbdHhic6Dov05S73spTgkExNBz7y 412K6i7d2DSip/yCJBCIaDkhwsWDqkl9Wqnz5J07VxaIop9S3l8/ZIeity0jE8F/Ly01 eASTvcv3XpExgnkN4a8z9L5UV3puEv48wsMSCQ6NnPqGpl/tqMC9mgo59q4FIdM6r3ch kWeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=4NRq9wUKR0Pv6QYoD5yUdpYhNg4tlKq7MmYRIVRzyYg=; b=TZwDgjqZmWpFVLJzjBdPaw5trEkPdTaKWyBhZlRonM3YSsTjSLeF1GDwE8GKrErhX2 cx06TFSrXdkUSlORfmLDcpuOR9K+jtKEXca85BK4t63uaBC+l3OFkqnIuNHmEVRBQjdb 85OV43rwSVfRfB4wfMup33VrpHQZ/FKpLI5wiiCne6BXfZ7MRZjZ5Jy1w9vY0vZxHqtX ClAYIlE3U9sIiIUCCoxJcuaRPDSN9s/wZgbghkOz0OyWIyQPf2T+EeumoQ0TjsSybnMV /oEAUcKwg46lSS0i7TIPTyrnUP6HmUgBnUf26JsTALhcLHyYvGrtXcNLGW7PhO6YR+cZ l2zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QzCANZSd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i20-20020a63e914000000b0039cd17a24fdsi3855196pgh.330.2022.04.12.14.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QzCANZSd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1FDDBBC85B; Tue, 12 Apr 2022 13:41:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238324AbiDLEEZ (ORCPT + 99 others); Tue, 12 Apr 2022 00:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345752AbiDLEEE (ORCPT ); Tue, 12 Apr 2022 00:04:04 -0400 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E97C833A0F for ; Mon, 11 Apr 2022 21:01:27 -0700 (PDT) Received: by mail-qv1-xf2d.google.com with SMTP id y19so3313934qvk.5 for ; Mon, 11 Apr 2022 21:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=4NRq9wUKR0Pv6QYoD5yUdpYhNg4tlKq7MmYRIVRzyYg=; b=QzCANZSdJ5P0+QrETcEAa6nqQQp1jd5ilnjCvFDnDT7sdPxYaJ10EojfQFQAg69hNZ pc425I6h5uZoTbN4CZVHIRffDzOOpuJennuxofR1caDO8EZAE4n/XKf8cRtK/VKaSjIA uVzhZ2dKVH+8iSdQvlWf0yBGRTe4KFfS/dpFO46TdYcVOtuUYXz/a5YXgzGPXWMeHkv9 V20UJ6t8nLZvj253txKvxL2aMaAB616KPMuEMfUeg8WpYHCfXqnJG8dkVr09Eh8edyjW f/wQweIS/rbsNs74SDT+yfLu04AAa8W1EUknm3+hS4og/ZPN8eqVz9oB6XGqfkwQiEcB qggQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=4NRq9wUKR0Pv6QYoD5yUdpYhNg4tlKq7MmYRIVRzyYg=; b=XvwA60HQFwUtqSl3XkP1n9Hs78AFaYRgFpC8MJcmWnu3kLwW5mc4CJVWV1hj/IIXod oyfOnRCdlFaXsDDmXB5wMKD5FiIrl8tiUTUL7koMlj11h61a6/ocSEpaJQwWm0SZW9AZ MUf/z+fuzVd4KQgyacEGAnEkM+sa6ZRUvcO9wx1iZX1lE7pbYsTcEhjRPXZ9eeh9kbL9 Upi5qIHL1bRa0ClY/K9rgu3pP8r88UbYGv+Wumvryqww5UHK+S6hbwZs++nkN2gzM75k 9Fh0LyIHQX+IjCyRxiBWruX/CcmSL4m+MSOKE89RfddHfyZ41MW8V1rebZ3CIc6hYwAg DNkQ== X-Gm-Message-State: AOAM532S1WBfR6k/nVgBguurhWJobx+sJ0FDmoOexna9XEaWQEUrDOz+ egde+4CvtSGw68Pj/LbkuzhZq/SMUYbXa79p X-Received: by 2002:a05:6214:19c8:b0:444:32f0:2351 with SMTP id j8-20020a05621419c800b0044432f02351mr2073117qvc.109.1649736086971; Mon, 11 Apr 2022 21:01:26 -0700 (PDT) Received: from jaehee-ThinkPad-X1-Extreme ([2607:fb90:50fb:900e:25ab:983d:ac30:58b5]) by smtp.gmail.com with ESMTPSA id t125-20020a372d83000000b0069c1df12422sm3349402qkh.84.2022.04.11.21.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 21:01:26 -0700 (PDT) Date: Tue, 12 Apr 2022 00:01:23 -0400 From: Jaehee Park To: Julia Lawall Cc: =?iso-8859-1?B?Suly9G1l?= Pouiller , 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 Message-ID: <20220412040123.GB2856917@jaehee-ThinkPad-X1-Extreme> References: <20220407204128.GA1810425@jaehee-ThinkPad-X1-Extreme> <20220408222102.GB2511628@jaehee-ThinkPad-X1-Extreme> <1911301.taCxCBeP46@pc-42> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sat, Apr 09, 2022 at 05:37:32PM +0200, Julia Lawall wrote: > > > On Sat, 9 Apr 2022, J?r?me Pouiller wrote: > > > 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 to > > > > > retrieve vif (the representation of ieee80211_vif), and > > > > > > > > I don't understand this part. > > > > > > > > julia > > > > > > > > > > Thank you for your message. I revised the commit message (below)-- > > > I hope it makes it clearer. I'm open to suggestions as well! > > > > > > 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. > > > > > > 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: > > > > > > .-----------------------------------. > > > | .------------------------------. | > > > '->| 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? > > Yes, that was my concern. > > julia Understood-- Thank you Julia and J?r?me for catching my mistake and clarifying!