All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: greearb@gmail.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] wireless: Use first phyX name available when registering phy devices.
Date: Mon, 27 Sep 2010 09:39:59 -0700	[thread overview]
Message-ID: <4CA0C8DF.7050609@candelatech.com> (raw)
In-Reply-To: <1285604243.4043.25.camel@jlt3.sipsolutions.net>

On 09/27/2010 09:17 AM, Johannes Berg wrote:
> On Mon, 2010-09-27 at 09:07 -0700, greearb@gmail.com wrote:
>
>> @@ -346,16 +332,36 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
>>
>>   	if (unlikely(!wiphy_idx_valid(rdev->wiphy_idx))) {
>>   		wiphy_counter--;
>> +		goto too_many_devs;
>> +	}
>
> I believe the other path can also reduce the counter again, since it's
> another failure case? Not that I'm really worried about it though.
>
>> +	/* 64k wiphy devices is enough for anyone! */
>> +	for (i = 0; i<  0xFFFF; i++) {
>
> Come to think of it, this could be "i<= wiphy_counter", since in N
> devices, only N different names can be in use, so checking N+1 names
> will be sufficient, right?

I think it doesn't matter so much either way.  If we want to get really
paranoid about this, then we need to hash lookup of phy by index and name
and probably allow some reuse of phy indexes in case someone wants to reload
a module 4 billion times.

But, since current use is probably < 2 phys in most cases, and less than 500 in
all cases, I think we could just leave the code as is.  I'd guess the only reason
to change this is if we ever get usable virtual phys (netdev had the same migration
when VLANs started being useful and suddenly it was OK to have several thousand
interfaces.)

That said, I'll redo the patch if you want these changes.

Thanks,
Ben

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


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

      reply	other threads:[~2010-09-27 16:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-27 16:07 [PATCH 1/2] Revert "wireless: Keep phy name consistent across module reloads." greearb
2010-09-27 16:07 ` [PATCH 2/2] wireless: Use first phyX name available when registering phy devices greearb
2010-09-27 16:17   ` Johannes Berg
2010-09-27 16:39     ` Ben Greear [this message]

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=4CA0C8DF.7050609@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=greearb@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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.