Search Linux Wireless

Re: [PATCH 14/20] wlcore: restore default channel configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-11-27 at 23:32 +0200, Arik Nemtsov wrote:
> On Tue, Nov 27, 2012 at 3:36 PM, Luciano Coelho <coelho@xxxxxx> wrote:
> > On Tue, 2012-11-27 at 08:44 +0200, Arik Nemtsov wrote:
> >> From: Victor Goldenshtein <victorg@xxxxxx>
> >>
> >> wlcore allocates two static structs wl1271_band_2ghz & wl1271_band_5ghz
> >> which are used/modified by Reg-Domain e.g. some channel might be marked
> >> as passive at some point. Make sure we don't keep stale settings around
> >> if the HW is unregistered/registered during operation.
> >>
> >> [Arik - use Tx-power constant and tweak commit message]
> >>
> >> Signed-off-by: Victor Goldenshtein <victorg@xxxxxx>
> >> Signed-off-by: Arik Nemtsov <arik@xxxxxxxxxx>
> >> ---
> >
> > [...]
> >
> >> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> >> index e68cd3f..3ced59b 100644
> >> --- a/drivers/net/wireless/ti/wlcore/main.c
> >> +++ b/drivers/net/wireless/ti/wlcore/main.c
> >
> > [...]
> >
> >> @@ -5537,6 +5537,7 @@ wlcore_iface_combinations[] = {
> >>
> >>  static int wl1271_init_ieee80211(struct wl1271 *wl)
> >>  {
> >> +     int i;
> >>       static const u32 cipher_suites[] = {
> >>               WLAN_CIPHER_SUITE_WEP40,
> >>               WLAN_CIPHER_SUITE_WEP104,
> >> @@ -5599,6 +5600,22 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
> >>                    ARRAY_SIZE(wl1271_channels_5ghz) >
> >>                    WL1271_MAX_CHANNELS);
> >>       /*
> >> +     * clear channel flags from the previous usage
> >> +     * and restore max_power & max_antenna_gain values.
> >> +     */
> >> +     for (i = 0; i < ARRAY_SIZE(wl1271_channels); i++) {
> >> +             wl1271_band_2ghz.channels[i].flags = 0;
> >> +             wl1271_band_2ghz.channels[i].max_power = WLCORE_MAX_TXPWR;
> >> +             wl1271_band_2ghz.channels[i].max_antenna_gain = 0;
> >> +     }
> >> +
> >> +     for (i = 0; i < ARRAY_SIZE(wl1271_channels_5ghz); i++) {
> >> +             wl1271_band_5ghz.channels[i].flags = 0;
> >> +             wl1271_band_5ghz.channels[i].max_power = WLCORE_MAX_TXPWR;
> >> +             wl1271_band_5ghz.channels[i].max_antenna_gain = 0;
> >> +     }
> >> +
> >> +     /*
> >
> > This looks a bit hacky, because you must know what values are being
> > modified by cfg80211.  What if in the future there are more values in
> > the channel structure that are being modified?
> >
> > The best would be to have a copy of the struct to pass to cfg80211 when
> > the hardware is registered and realloc it when we unregister.  That
> > would be safer and more future-proof, but would use a bit more memory
> > though.
> 
> Yea a new struct wasn't used because of the memory requirement. I
> agree a copy is cleaner.
> Let's start with this one to solve the actual bug and make a TODO for later?

Sure, let's add it to the TOneverbeDOne list. :P


> I'm also not sure that having cfg80211 change a structure allocated
> and owned by the driver is the cleanest solution for the regulatory
> stuff.

Yeah, but it has always been like that.  I think the idea is probably
the same: to avoid duplicate arrays.  But if cfg80211 modifies it, it
should be able to reset it back to the original as well.  Or the driver
must alloc a new one each time.

I wonder what the other drivers do...

--
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux