netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jouni Malinen <jkm@devicescape.com>, Jiri Benc <jbenc@suse.cz>
Cc: netdev@vger.kernel.org
Subject: d80211 and sta_aid for AP functionality
Date: Mon, 14 Aug 2006 10:19:24 +0200	[thread overview]
Message-ID: <44E0320C.6090003@sipsolutions.net> (raw)
In-Reply-To: <44E02F41.2060300@sipsolutions.net>

Hey,

I was looking through the d80211 code and noticed this comment and code:

        /* TODO: sta_aid could be replaced by 2008-bit large bitfield of
         * that could be used in TIM element generation. This would also
         * make TIM element generation a bit faster. */
        /* AID mapping to station data. NULL, if AID is free. AID is in the
         * range 1..2007 and sta_aid[i] corresponds to AID i+1. */
        struct sta_info *sta_aid[MAX_AID_TABLE_SIZE];

Note that this is part of struct ieee80211_if_ap which is in a union for 
each virtual device.

About 15 seconds later it almost blew me off my chair ;) I had realized 
that this is 8k kernel memory for each virtual device with absolutely no 
function in the common case! AX_AID_TABLE_SIZE is set to 2007 (the 
802.11 spec maximum)...

In fact, with this, the struct ieee80211_sub_if_data is 8560 bytes, 
without it it's a meager 588 bytes. Hence, when the interface is 
anything but an AP interface, we waste almost 8K. And even if it's an AP 
interface, who ever has 2007 stations associated?

Since the stations are saved in a hash-table (the hashing by the last 
byte of the mac address doesn't seem too efficient though...) all the 
sta_aids array needs to do is answer the following questions quickly:
 (a) is the AID N used?
 (b) what is the sta_info pointer for AID N?

Since userspace manages AIDs, we don't even need to be able to answer 
things like "what is the lowest unused AID?". I don't quite understand 
why we don't stop userspace from using the same AID for different 
stations, which will give surely result in trouble, but hey.

Looking through the code, I notice that above (a) and (b) can be 
collapsed into just keeping track of the TIM throughout the code. I 
suppose that's meant by the comment above? Then we can't add the check 
for saying 'hey you stupid userspace that AID is already used' but 
that's ok I guess.

If you can confirm that my analysis is correct I'd be willing to try 
making this change. This would at least go down to 251 bytes for the 
bitmap and thus reduce sub_if_data to about 760 bytes. The only 
complication I see with this right now is that of locking, but I haven't 
looked closely yet.

johannes


  parent reply	other threads:[~2006-08-14  8:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-14  8:07 [wireless] bunch of questions and notes on d80211 Johannes Berg
2006-08-14  8:10 ` bcm43xx for d80211 softirq loop Johannes Berg
     [not found]   ` <44E0300D.1000402-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2006-08-14  8:21     ` Johannes Berg
2006-08-14 13:27   ` Michael Buesch
2006-08-14  8:12 ` [d80211 rfc] link master interface from wiphy Johannes Berg
2006-08-14 12:01   ` Dan Williams
2006-08-16 17:05   ` Jiri Benc
2006-08-17  7:18     ` Johannes Berg
2006-08-14  8:13 ` [PATCH] d80211: fix some 0 vs. NULL comparisons Johannes Berg
2006-08-14 13:20   ` Johannes Berg
2006-08-14 15:48     ` Jouni Malinen
2006-08-14  8:15 ` [PATCH] d80211: get rid of the WME bitfield Johannes Berg
2006-08-14 16:12   ` Jouni Malinen
2006-08-15  7:11     ` Johannes Berg
2006-08-14  8:16 ` ieee80211_japan_5ghz / firmware etc.?? Johannes Berg
2006-08-14  8:16 ` ieee80211_set_encryption Johannes Berg
2006-08-14 15:53   ` ieee80211_set_encryption Jouni Malinen
2006-08-14  8:18 ` network manager confused with bcm43xx-d80211? Johannes Berg
2006-08-14 11:46   ` Dan Williams
2006-08-14 12:28     ` Johannes Berg
2006-08-14 12:48       ` Larry Finger
2006-08-14 12:54         ` Johannes Berg
2006-08-14  8:19 ` Johannes Berg [this message]
2006-08-17 18:21   ` d80211 and sta_aid for AP functionality Jiri Benc
2006-08-14  8:22 ` wlan#ap seems bogus Johannes Berg
2006-08-14 14:04   ` Johannes Berg
2006-08-14 18:53     ` Simon Barber
2006-08-15  7:22       ` Johannes Berg
2006-08-14 15:58   ` Jouni Malinen
2006-08-14 16:04     ` 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=44E0320C.6090003@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jbenc@suse.cz \
    --cc=jkm@devicescape.com \
    --cc=netdev@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 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).