Search Linux Wireless

Re: New Regulatory Domain Api.

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

 



On Thu, Oct 09, 2008 at 03:17:18PM -0700, Kolekar, Abhijeet wrote:
> Hello Luis,
>   I have been trying to implement new regulatory api for iwlwifi drivers. One of the problem we are facing
> is that , when we tried to remove iwlagn driver without removing the cfg80211,and then again inserting the
> same module , we cannot set the regulatory domain.  The reasons for this probably be ,as  we are just giving a pointer to
> regulatory domain in regulatory_hint function which may lead to potential memory link.

This was done intentionally by design so we can allow cfg80211 to free
the regulatory domain structure itself.

> Cfg80211 should copy the regulatory domain
> information in its own memory rather than a pointer to driver memory.

That is one way of doing it but we discussed this particular point on
the lists IIRC and at OLS too and we decided to let cfg80211 rather
be the father of the pointer and to be in charge of freeing it later.
This allows us to have a central place which will be in charge of this
pointer once gobbled up and therefore make it less prone to error
amongst callers.

Did you try to see where or why it was actually failing?

My guess is it fails when ignore_request() is called, particularly in
this section:

	switch (set_by) {

	/* -- stuff -- */

        case REGDOM_SET_BY_DRIVER:
                BUG_ON(!wiphy);
                if (last_request->initiator == set_by) {
                        /* Two separate drivers hinting different things,
                         * this is possible if you have two devices
                         * present on a system with different EEPROM regulatory
                         * readings. XXX: Do intersection, we support
                         * only
                         * the first regulatory hint for now */
                        if (last_request->wiphy != wiphy)
                                return -EALREADY;
                        if (rd)
                                return -EALREADY;
                        /* Driver should not be trying to hint different
                         * regulatory domains! */
                        BUG_ON(!alpha2_equal(alpha2,
                                        cfg80211_regdomain->alpha2));
                        return -EALREADY;
                }


In your case I think you hit this after rmmod and modprobe:

	if (last_request->wiphy != wiphy)
		return -EALREADY;

since the last wiphy != your new wiphy. The reason this check was added
though, as the comment indicates, was to prevent two drivers with
different regulatory domains from trying to set it. In your case this
doesn't affect your requested setting as the old regulatory domain
is still set. This check currently also forces the first device detected
on the system and its regutory_hint() to be respected over any other
devices considering that your built in wireless card on your laptop
will probably be detected first over your cardbus card, or USB card
for example.

In other words this you can treat -EALREADY return value as non
critical, as per the documentation (please see include/net/wireless.h).

  Luis
--
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 Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux