linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: "Kolekar, Abhijeet" <abhijeet.kolekar@intel.com>
Cc: "lrodrigues@atheros.com" <lrodrigues@atheros.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Zhu, Yi" <yi.zhu@intel.com>
Subject: Re: New Regulatory Domain Api.
Date: Thu, 9 Oct 2008 08:45:47 -0700	[thread overview]
Message-ID: <20081009154547.GB13349@tesla> (raw)
In-Reply-To: <B27EBC40D200ED48A3F4CC2EBEABAE0B16C892F2@orsmsx501.amr.corp.intel.com>

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

  reply	other threads:[~2008-10-09 22:46 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09 22:17 New Regulatory Domain Api Kolekar, Abhijeet
2008-10-09 15:45 ` Luis R. Rodriguez [this message]
2008-10-10  3:22   ` Zhu Yi
2008-10-10 16:49     ` Luis R. Rodriguez
2008-10-14  6:59       ` Zhu Yi
2008-10-14  7:04         ` Luis R. Rodriguez
2008-10-14  7:36           ` Zhu Yi
2008-10-14  9:04             ` Luis R. Rodriguez
2008-10-14  9:13               ` Luis R. Rodriguez
2008-10-14  9:23                 ` Zhu Yi
2008-10-14  9:27                   ` Zhu Yi
2008-10-14  9:32                     ` Johannes Berg
2008-10-14  9:30                   ` Luis R. Rodriguez
2008-10-14 20:35               ` John W. Linville
2008-10-14 21:15                 ` Johannes Berg
2008-10-14 21:19                   ` John W. Linville
2008-10-14 21:27                     ` Johannes Berg
2008-10-14 21:50                       ` John W. Linville
2008-10-14 21:57                         ` Johannes Berg
2008-10-15 15:46                       ` Marcel Holtmann
2008-10-15 15:59                         ` Johannes Berg
2008-10-15 17:26                           ` Marcel Holtmann
2008-10-15 17:39                             ` Luis R. Rodriguez
2008-10-15 17:45                               ` Johannes Berg
2008-10-15 18:11                                 ` Luis R. Rodriguez
2008-10-15 17:47                               ` Marcel Holtmann
2008-10-15 11:25                                 ` Luis R. Rodriguez
2008-10-15 19:25                                   ` Marcel Holtmann
2008-10-15 13:16                                     ` Luis R. Rodriguez
2008-10-15 23:31                                       ` Tomas Winkler
2008-10-15 17:08                                         ` Luis R. Rodriguez
2008-10-16  0:35                                           ` Tomas Winkler
2008-10-15 17:44                                             ` Luis R. Rodriguez
2008-10-16  0:57                                               ` Tomas Winkler
2008-10-15 18:56                                                 ` Luis R. Rodriguez
2008-10-16  3:00                                                   ` Zhu Yi
2008-10-16 11:38                                                     ` Luis R. Rodriguez
2008-10-20  2:51                                                       ` Zhu Yi
2008-10-20  3:40                                                         ` Luis R. Rodriguez
2008-10-20  5:18                                                           ` Zhu Yi
2008-10-20  6:33                                                             ` Luis R. Rodriguez
2008-10-20  6:38                                                               ` Johannes Berg
2008-10-20  6:46                                                                 ` Luis R. Rodriguez
2008-10-20  6:50                                                                   ` Johannes Berg
2008-10-20  6:59                                                                     ` Luis R. Rodriguez
2008-10-20  7:22                                                                       ` Zhu Yi
2008-10-20 16:43                                                                         ` Marcel Holtmann
2008-10-21  1:34                                                                           ` Zhu Yi
2008-10-21  1:42                                                                             ` Luis R. Rodriguez
2008-10-21  1:58                                                                               ` Zhu Yi
2008-10-21  2:37                                                                                 ` Luis R. Rodriguez
2008-10-21  4:02                                                                                   ` Zhu Yi
2008-10-21  4:58                                                                                     ` Luis R. Rodriguez
2008-10-21  5:28                                                                                       ` Zhu Yi
2008-10-21  6:02                                                                                         ` Luis R. Rodriguez
2008-10-21  6:46                                                                                           ` Zhu Yi
2008-10-21  6:07                                                                                       ` Marcel Holtmann
2008-10-21  6:29                                                                                         ` Luis R. Rodriguez
2008-10-21  6:51                                                                                           ` Marcel Holtmann
2008-10-21 17:13                                                                                             ` John W. Linville
2008-10-21 17:43                                                                                               ` Marcel Holtmann
2008-10-21 17:48                                                                                                 ` John W. Linville
2008-10-21 11:02                                                                                                   ` Luis R. Rodriguez
2008-10-21 18:05                                                                                                     ` John W. Linville
2008-10-21 11:21                                                                                                       ` Luis R. Rodriguez
2008-10-22  9:20                                                                                                     ` Zhu Yi
2008-10-22 10:13                                                                                                       ` Luis R. Rodriguez
2008-10-23  2:29                                                                                                         ` Zhu Yi
2008-10-21  6:40                                                                                         ` Johannes Berg
2008-10-21  6:47                                                                                           ` Marcel Holtmann
2008-10-21  7:05                                                                                   ` Johannes Berg
     [not found]                                                                                     ` <79124FD53D2E084387D88C71BEB48F3EDD3625@CPEXBE-EML29.kpnsp.local>
2008-10-21  7:37                                                                                       ` Johannes Berg
2008-10-21 16:39                                                                                     ` Marcel Holtmann
2008-10-21 11:04                                                                                       ` Luis R. Rodriguez
2008-10-21 16:40                                                                                       ` Johannes Berg
2008-10-15 17:40                             ` Johannes Berg
2008-10-15  2:00                   ` Zhu Yi
2008-10-14  9:19     ` Johannes Berg
2008-10-15  1:40       ` Zhu Yi
2008-10-15 15:50         ` Marcel Holtmann
2008-10-15 16:01           ` Johannes Berg
2008-10-15 17:29             ` Marcel Holtmann
2008-10-15 17:36               ` Johannes Berg

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=20081009154547.GB13349@tesla \
    --to=lrodriguez@atheros.com \
    --cc=abhijeet.kolekar@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodrigues@atheros.com \
    --cc=yi.zhu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).