From: Alexander Simon <alexander.simon@saxnet.de>
To: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 3/4] mac80211: Add function to build HT caps
Date: Tue, 12 Apr 2011 11:06:11 +0000 (UTC) [thread overview]
Message-ID: <loom.20110412T130449-831@post.gmane.org> (raw)
In-Reply-To: 1302604964.2139.5.camel@alex-2
Some refracturing work.
Add a new function ieee80211_ie_build_ht_cap in util.c.
Use this shared code from ieee80211_build_preq_ies (util.c) and
ieee80211_add_ht_ie (work.c)
This will be used from ibss.c also.
Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>
---
ieee80211_i.h | 2 ++
util.c | 54 +++++++++++++++++++++++++++++++++++++-----------------
work.c | 29 +----------------------------
3 files changed, 40 insertions(+), 45 deletions(-)
diff -Nrup a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
--- a/net/mac80211/ieee80211_i.h 2011-03-31 21:04:02.000000000 +0200
+++ b/net/mac80211/ieee80211_i.h 2011-04-12 09:55:16.000000000 +0200
@@ -1351,6 +1352,8 @@ void ieee80211_recalc_smps(struct ieee80
size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
const u8 *ids, int n_ids, size_t offset);
size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
+u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
+ u16 cap);
/* internal work items */
void ieee80211_work_init(struct ieee80211_local *local);
diff -Nrup a/net/mac80211/util.c b/net/mac80211/util.c
--- a/net/mac80211/util.c 2011-03-31 21:04:02.000000000 +0200
+++ b/net/mac80211/util.c 2011-04-12 09:55:48.000000000 +0200
@@ -1007,23 +1007,8 @@ int ieee80211_build_preq_ies(struct ieee
offset = noffset;
}
- if (sband->ht_cap.ht_supported) {
- u16 cap = sband->ht_cap.cap;
- __le16 tmp;
-
- *pos++ = WLAN_EID_HT_CAPABILITY;
- *pos++ = sizeof(struct ieee80211_ht_cap);
- memset(pos, 0, sizeof(struct ieee80211_ht_cap));
- tmp = cpu_to_le16(cap);
- memcpy(pos, &tmp, sizeof(u16));
- pos += sizeof(u16);
- *pos++ = sband->ht_cap.ampdu_factor |
- (sband->ht_cap.ampdu_density <<
- IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
- memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
- pos += sizeof(sband->ht_cap.mcs);
- pos += 2 + 4 + 1; /* ext info, BF cap, antsel */
- }
+ if (sband->ht_cap.ht_supported)
+ pos = ieee80211_ie_build_ht_cap(pos, sband, sband->ht_cap.cap);
/*
* If adding more here, adjust code in main.c
@@ -1443,3 +1428,38 @@ size_t ieee80211_ie_split_vendor(const u
return pos;
}
+
+u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
+ u16 cap)
+{
+ __le16 tmp;
+
+ *pos++ = WLAN_EID_HT_CAPABILITY;
+ *pos++ = sizeof(struct ieee80211_ht_cap);
+ memset(pos, 0, sizeof(struct ieee80211_ht_cap));
+
+ /* capability flags */
+ tmp = cpu_to_le16(cap);
+ memcpy(pos, &tmp, sizeof(u16));
+ pos += sizeof(u16);
+
+ /* AMPDU parameters */
+ *pos++ = sband->ht_cap.ampdu_factor |
+ (sband->ht_cap.ampdu_density <<
+ IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
+
+ /* MCS set */
+ memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
+ pos += sizeof(sband->ht_cap.mcs);
+
+ /* extended capabilities */
+ pos += sizeof(__le16);
+
+ /* BF capabilities */
+ pos += sizeof(__le32);
+
+ /* antenna selection */
+ pos += sizeof(u8);
+
+ return pos;
+}
diff -Nrup a/net/mac80211/work.c b/net/mac80211/work.c
--- a/net/mac80211/work.c 2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/work.c 2011-04-12 09:43:30.000000000 +0200
@@ -110,7 +110,6 @@ static void ieee80211_add_ht_ie(struct s
u8 *pos;
u32 flags = channel->flags;
u16 cap = sband->ht_cap.cap;
- __le16 tmp;
if (!sband->ht_cap.ht_supported)
return;
@@ -161,34 +160,8 @@ static void ieee80211_add_ht_ie(struct s
}
/* reserve and fill IE */
-
pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2);
- *pos++ = WLAN_EID_HT_CAPABILITY;
- *pos++ = sizeof(struct ieee80211_ht_cap);
- memset(pos, 0, sizeof(struct ieee80211_ht_cap));
-
- /* capability flags */
- tmp = cpu_to_le16(cap);
- memcpy(pos, &tmp, sizeof(u16));
- pos += sizeof(u16);
-
- /* AMPDU parameters */
- *pos++ = sband->ht_cap.ampdu_factor |
- (sband->ht_cap.ampdu_density <<
- IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
-
- /* MCS set */
- memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
- pos += sizeof(sband->ht_cap.mcs);
-
- /* extended capabilities */
- pos += sizeof(__le16);
-
- /* BF capabilities */
- pos += sizeof(__le32);
-
- /* antenna selection */
- pos += sizeof(u8);
+ ieee80211_ie_build_ht_cap(pos, sband, cap);
}
static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
next prev parent reply other threads:[~2011-04-12 11:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-12 10:42 [PATCH 1/4] cfg80211: Add channel type for IBSS Alexander Simon
2011-04-12 11:04 ` [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE " Alexander Simon
2011-04-12 11:08 ` Johannes Berg
2011-04-12 11:06 ` Alexander Simon [this message]
2011-04-12 11:16 ` [PATCH 3/4] mac80211: Add function to build HT caps Johannes Berg
2011-04-12 11:22 ` Alexander Simon
2011-04-12 11:07 ` [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS Alexander Simon
2011-04-12 11:19 ` Johannes Berg
2011-04-28 12:13 ` Alexander Simon
2011-04-28 12:56 ` Johannes Berg
2011-04-29 6:54 ` Alexander Simon
2011-04-29 7:21 ` Johannes Berg
2011-04-29 8:37 ` Alexander Simon
2011-04-29 12:36 ` Alexander Simon
2011-04-29 12:39 ` Johannes Berg
2011-04-29 12:50 ` Alexander Simon
2011-04-26 19:11 ` [PATCH 1/4] cfg80211: Add channel type " John W. Linville
2011-04-28 12:15 ` Alexander Simon
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=loom.20110412T130449-831@post.gmane.org \
--to=alexander.simon@saxnet.de \
--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 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).