lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 12 Apr 2022 00:01:23 -0400
From:   Jaehee Park <jhpark1013@...il.com>
To:     Julia Lawall <julia.lawall@...ia.fr>
Cc:     Jérôme Pouiller <jerome.pouiller@...abs.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
        outreachy@...ts.linux.dev, Stefano Brivio <sbrivio@...hat.com>
Subject: Re: [PATCH] staging: wfx: use container_of() to get vif

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! 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ