All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Bob Copeland <me@bobcopeland.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] ath5k: Adjust opmode when interfaces are removed.
Date: Fri, 08 Oct 2010 11:18:34 -0700	[thread overview]
Message-ID: <4CAF607A.4090305@candelatech.com> (raw)
In-Reply-To: <AANLkTi=abVBncBxEKV4oQNSSm4fS5a-qZ=a38BJRPSg_@mail.gmail.com>

On 10/08/2010 11:13 AM, Bob Copeland wrote:
> On Fri, Oct 8, 2010 at 2:06 PM, Ben Greear<greearb@candelatech.com>  wrote:
>> On 10/08/2010 11:03 AM, Bob Copeland wrote:
>>>
>>> On Fri, Oct 8, 2010 at 12:43 PM,<greearb@candelatech.com>    wrote:
>>>>
>>>> @@ -558,6 +577,7 @@ void ath5k_update_bssid_mask(struct ath5k_softc *sc,
>>>> struct ieee80211_vif *vif)
>>>>         memset(&iter_data.mask, 0xff, ETH_ALEN);
>>>>         iter_data.found_active = false;
>>>>         iter_data.need_set_hw_addr = true;
>>>> +       iter_data.opmode = NL80211_IFTYPE_UNSPECIFIED;
>>>>
>>>>         if (vif)
>>>>                 ath_vif_iter(&iter_data, vif->addr, vif);
>>>> @@ -567,6 +587,11 @@ void ath5k_update_bssid_mask(struct ath5k_softc *sc,
>>>> struct ieee80211_vif *vif)
>>>>                                                    &iter_data);
>>>>         memcpy(sc->bssidmask, iter_data.mask, ETH_ALEN);
>>>>
>>>> +       if (update_opmode&&    sc->opmode != iter_data.opmode) {
>>>> +               sc->opmode = iter_data.opmode;
>>>> +               ath_do_set_opmode(sc);
>>>> +       }
>>>> +
>>>
>>> Should we really couple updating bssid mask and configuring
>>> the opmode?  Generally, I dislike adding boolean flags to
>>> functions because it's hard to figure out from the callsite
>>> what is happening (you have to go back to the prototype), and
>>> it usually indicates that the abstraction is a little broken.
>>
>> Well, we need to do the iteration over all VIFS to figure out what to set
>> this
>> too.  Seems doing one iteration v/s doing two is worth the
>> extra flag?
>
> I admit I haven't looked at the context, so I'm not sure how ugly it
> is, but you can often do this kind of thing by inverting the loop:
>
> update_vif_data()
> {
>     for all vifs:
>        compute new bssid&  opmode
>
>     update_bssid(new_bssid)
>     update_opmode(neW_opmode)
> }
>
> and call that instead (even in the single vif case).

I can just always set the opmode if you prefer that.  Maybe
change the name of that method.

I'll work on a patch.

Thanks,
Ben

>


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


  reply	other threads:[~2010-10-08 18:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-08 16:43 [PATCH 1/2] ath5k: Print out opmode in debugfs greearb
2010-10-08 16:43 ` [PATCH 2/2] ath5k: Adjust opmode when interfaces are removed greearb
2010-10-08 18:03   ` Bob Copeland
2010-10-08 18:06     ` Ben Greear
2010-10-08 18:13       ` Bob Copeland
2010-10-08 18:18         ` Ben Greear [this message]
2010-10-08 18:25           ` Bob Copeland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CAF607A.4090305@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=me@bobcopeland.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.